summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/applet/Applet.java16
-rw-r--r--java/awt/AWTEvent.java4
-rw-r--r--java/awt/AWTEventMulticaster.java10
-rw-r--r--java/awt/AWTKeyStroke.java44
-rw-r--r--java/awt/AlphaComposite.java20
-rw-r--r--java/awt/BasicStroke.java162
-rw-r--r--java/awt/BorderLayout.java16
-rw-r--r--java/awt/BufferCapabilities.java2
-rw-r--r--java/awt/Button.java31
-rw-r--r--java/awt/Canvas.java34
-rw-r--r--java/awt/CardLayout.java254
-rw-r--r--java/awt/Checkbox.java32
-rw-r--r--java/awt/CheckboxGroup.java7
-rw-r--r--java/awt/CheckboxMenuItem.java17
-rw-r--r--java/awt/Choice.java52
-rw-r--r--java/awt/Color.java6
-rw-r--r--java/awt/ColorPaintContext.java42
-rw-r--r--java/awt/Component.java404
-rw-r--r--java/awt/Container.java118
-rw-r--r--java/awt/ContainerOrderFocusTraversalPolicy.java74
-rw-r--r--java/awt/Cursor.java10
-rw-r--r--java/awt/DefaultFocusTraversalPolicy.java14
-rw-r--r--java/awt/DefaultKeyboardFocusManager.java18
-rw-r--r--java/awt/Desktop.java68
-rw-r--r--java/awt/Dialog.java104
-rw-r--r--java/awt/DisplayMode.java6
-rw-r--r--java/awt/Event.java16
-rw-r--r--java/awt/EventDispatchThread.java30
-rw-r--r--java/awt/EventQueue.java40
-rw-r--r--java/awt/FileDialog.java33
-rw-r--r--java/awt/FlowLayout.java194
-rw-r--r--java/awt/FocusTraversalPolicy.java2
-rw-r--r--java/awt/Font.java86
-rw-r--r--java/awt/FontMetrics.java2
-rw-r--r--java/awt/Frame.java46
-rw-r--r--java/awt/GradientPaint.java40
-rw-r--r--java/awt/Graphics.java44
-rw-r--r--java/awt/Graphics2D.java150
-rw-r--r--java/awt/GraphicsConfiguration.java8
-rw-r--r--java/awt/GraphicsDevice.java14
-rw-r--r--java/awt/GridBagConstraints.java18
-rw-r--r--java/awt/GridBagLayout.java376
-rw-r--r--java/awt/GridLayout.java182
-rw-r--r--java/awt/Image.java8
-rw-r--r--java/awt/Insets.java2
-rw-r--r--java/awt/JobAttributes.java2
-rw-r--r--java/awt/KeyboardFocusManager.java32
-rw-r--r--java/awt/Label.java9
-rw-r--r--java/awt/LightweightDispatcher.java4
-rw-r--r--java/awt/List.java154
-rw-r--r--java/awt/MediaTracker.java124
-rw-r--r--java/awt/Menu.java20
-rw-r--r--java/awt/MenuBar.java16
-rw-r--r--java/awt/MenuComponent.java26
-rw-r--r--java/awt/MenuItem.java50
-rw-r--r--java/awt/MenuShortcut.java4
-rw-r--r--java/awt/MouseInfo.java4
-rw-r--r--java/awt/PageAttributes.java4
-rw-r--r--java/awt/Point.java2
-rw-r--r--java/awt/PointerInfo.java2
-rw-r--r--java/awt/Polygon.java229
-rw-r--r--java/awt/PopupMenu.java9
-rw-r--r--java/awt/Rectangle.java6
-rw-r--r--java/awt/RenderingHints.java92
-rw-r--r--java/awt/Robot.java38
-rw-r--r--java/awt/ScrollPane.java49
-rw-r--r--java/awt/ScrollPaneAdjustable.java37
-rw-r--r--java/awt/Scrollbar.java58
-rw-r--r--java/awt/Shape.java14
-rw-r--r--java/awt/SystemColor.java2
-rw-r--r--java/awt/TextArea.java38
-rw-r--r--java/awt/TextComponent.java181
-rw-r--r--java/awt/TextField.java36
-rw-r--r--java/awt/TexturePaint.java16
-rw-r--r--java/awt/Toolkit.java20
-rw-r--r--java/awt/Window.java220
-rw-r--r--java/awt/color/ICC_ColorSpace.java48
-rw-r--r--java/awt/color/ICC_Profile.java280
-rw-r--r--java/awt/color/ICC_ProfileGray.java4
-rw-r--r--java/awt/color/ICC_ProfileRGB.java44
-rw-r--r--java/awt/datatransfer/Clipboard.java64
-rw-r--r--java/awt/datatransfer/ClipboardOwner.java3
-rw-r--r--java/awt/datatransfer/DataFlavor.java129
-rw-r--r--java/awt/datatransfer/FlavorEvent.java2
-rw-r--r--java/awt/datatransfer/FlavorListener.java2
-rw-r--r--java/awt/datatransfer/MimeType.java2
-rw-r--r--java/awt/datatransfer/StringSelection.java5
-rw-r--r--java/awt/datatransfer/SystemFlavorMap.java94
-rw-r--r--java/awt/datatransfer/Transferable.java1
-rw-r--r--java/awt/datatransfer/UnsupportedFlavorException.java2
-rw-r--r--java/awt/dnd/Autoscroll.java1
-rw-r--r--java/awt/dnd/DnDEventMulticaster.java4
-rw-r--r--java/awt/dnd/DragGestureEvent.java32
-rw-r--r--java/awt/dnd/DragGestureRecognizer.java2
-rw-r--r--java/awt/dnd/DragSource.java34
-rw-r--r--java/awt/dnd/DragSourceContext.java58
-rw-r--r--java/awt/dnd/DragSourceDropEvent.java2
-rw-r--r--java/awt/dnd/DragSourceEvent.java2
-rw-r--r--java/awt/dnd/DropTarget.java30
-rw-r--r--java/awt/dnd/DropTargetContext.java6
-rw-r--r--java/awt/dnd/DropTargetDragEvent.java14
-rw-r--r--java/awt/dnd/DropTargetDropEvent.java8
-rw-r--r--java/awt/dnd/DropTargetEvent.java4
-rw-r--r--java/awt/dnd/MouseDragGestureRecognizer.java4
-rw-r--r--java/awt/dnd/peer/DropTargetContextPeer.java6
-rw-r--r--java/awt/event/AWTEventListener.java2
-rw-r--r--java/awt/event/ActionEvent.java6
-rw-r--r--java/awt/event/ComponentAdapter.java2
-rw-r--r--java/awt/event/ComponentEvent.java6
-rw-r--r--java/awt/event/InputEvent.java2
-rw-r--r--java/awt/event/InputMethodEvent.java2
-rw-r--r--java/awt/event/InvocationEvent.java12
-rw-r--r--java/awt/event/KeyEvent.java2
-rw-r--r--java/awt/event/MouseEvent.java8
-rw-r--r--java/awt/event/MouseListener.java2
-rw-r--r--java/awt/event/MouseWheelEvent.java2
-rw-r--r--java/awt/event/WindowEvent.java2
-rw-r--r--java/awt/font/FontRenderContext.java7
-rw-r--r--java/awt/font/GlyphJustificationInfo.java4
-rw-r--r--java/awt/font/GlyphMetrics.java6
-rw-r--r--java/awt/font/GlyphVector.java20
-rw-r--r--java/awt/font/GraphicAttribute.java18
-rw-r--r--java/awt/font/ImageGraphicAttribute.java26
-rw-r--r--java/awt/font/LineBreakMeasurer.java49
-rw-r--r--java/awt/font/LineMetrics.java20
-rw-r--r--java/awt/font/MultipleMaster.java10
-rw-r--r--java/awt/font/OpenType.java14
-rw-r--r--java/awt/font/ShapeGraphicAttribute.java28
-rw-r--r--java/awt/font/TextAttribute.java124
-rw-r--r--java/awt/font/TextHitInfo.java10
-rw-r--r--java/awt/font/TextLayout.java244
-rw-r--r--java/awt/font/TextMeasurer.java42
-rw-r--r--java/awt/font/TransformAttribute.java24
-rw-r--r--java/awt/geom/AffineTransform.java38
-rw-r--r--java/awt/geom/Arc2D.java138
-rw-r--r--java/awt/geom/Area.java1742
-rw-r--r--java/awt/geom/CubicCurve2D.java320
-rw-r--r--java/awt/geom/Ellipse2D.java6
-rw-r--r--java/awt/geom/FlatteningPathIterator.java8
-rw-r--r--java/awt/geom/GeneralPath.java517
-rw-r--r--java/awt/geom/Line2D.java48
-rw-r--r--java/awt/geom/QuadCurve2D.java266
-rw-r--r--java/awt/geom/RectangularShape.java12
-rw-r--r--java/awt/geom/RoundRectangle2D.java92
-rw-r--r--java/awt/im/InputContext.java4
-rw-r--r--java/awt/im/spi/InputMethodDescriptor.java1
-rw-r--r--java/awt/image/AffineTransformOp.java106
-rw-r--r--java/awt/image/AreaAveragingScaleFilter.java173
-rw-r--r--java/awt/image/BandCombineOp.java26
-rw-r--r--java/awt/image/BandedSampleModel.java540
-rw-r--r--java/awt/image/BufferedImage.java180
-rw-r--r--java/awt/image/BufferedImageFilter.java22
-rw-r--r--java/awt/image/BufferedImageOp.java44
-rw-r--r--java/awt/image/ByteLookupTable.java22
-rw-r--r--java/awt/image/ColorConvertOp.java136
-rw-r--r--java/awt/image/ColorModel.java114
-rw-r--r--java/awt/image/ComponentColorModel.java96
-rw-r--r--java/awt/image/ComponentSampleModel.java208
-rw-r--r--java/awt/image/ConvolveOp.java98
-rw-r--r--java/awt/image/CropImageFilter.java117
-rw-r--r--java/awt/image/DataBuffer.java158
-rw-r--r--java/awt/image/DataBufferByte.java64
-rw-r--r--java/awt/image/DataBufferDouble.java64
-rw-r--r--java/awt/image/DataBufferFloat.java64
-rw-r--r--java/awt/image/DataBufferInt.java68
-rw-r--r--java/awt/image/DataBufferShort.java60
-rw-r--r--java/awt/image/DataBufferUShort.java56
-rw-r--r--java/awt/image/DirectColorModel.java155
-rw-r--r--java/awt/image/FilteredImageSource.java67
-rw-r--r--java/awt/image/ImageConsumer.java30
-rw-r--r--java/awt/image/ImageFilter.java40
-rw-r--r--java/awt/image/ImageObserver.java18
-rw-r--r--java/awt/image/ImageProducer.java13
-rw-r--r--java/awt/image/IndexColorModel.java282
-rw-r--r--java/awt/image/Kernel.java32
-rw-r--r--java/awt/image/LookupOp.java68
-rw-r--r--java/awt/image/LookupTable.java4
-rw-r--r--java/awt/image/MemoryImageSource.java184
-rw-r--r--java/awt/image/MultiPixelPackedSampleModel.java188
-rw-r--r--java/awt/image/PackedColorModel.java82
-rw-r--r--java/awt/image/PixelGrabber.java166
-rw-r--r--java/awt/image/PixelInterleavedSampleModel.java2
-rw-r--r--java/awt/image/RGBImageFilter.java22
-rw-r--r--java/awt/image/Raster.java344
-rw-r--r--java/awt/image/RasterOp.java23
-rw-r--r--java/awt/image/RenderedImage.java2
-rw-r--r--java/awt/image/ReplicateScaleFilter.java63
-rw-r--r--java/awt/image/RescaleOp.java80
-rw-r--r--java/awt/image/SampleModel.java400
-rw-r--r--java/awt/image/ShortLookupTable.java20
-rw-r--r--java/awt/image/SinglePixelPackedSampleModel.java176
-rw-r--r--java/awt/image/TileObserver.java2
-rw-r--r--java/awt/image/WritableRaster.java156
-rw-r--r--java/awt/image/WritableRenderedImage.java2
-rw-r--r--java/awt/image/renderable/ContextualRenderedImageFactory.java2
-rw-r--r--java/awt/image/renderable/ParameterBlock.java2
-rw-r--r--java/awt/image/renderable/RenderContext.java2
-rw-r--r--java/awt/image/renderable/RenderableImage.java5
-rw-r--r--java/awt/image/renderable/RenderableImageOp.java2
-rw-r--r--java/awt/image/renderable/RenderableImageProducer.java2
-rw-r--r--java/awt/image/renderable/RenderedImageFactory.java2
-rw-r--r--java/awt/peer/ButtonPeer.java3
-rw-r--r--java/awt/peer/CanvasPeer.java3
-rw-r--r--java/awt/peer/CheckboxMenuItemPeer.java3
-rw-r--r--java/awt/peer/CheckboxPeer.java1
-rw-r--r--java/awt/peer/ChoicePeer.java5
-rw-r--r--java/awt/peer/ComponentPeer.java26
-rw-r--r--java/awt/peer/ContainerPeer.java13
-rw-r--r--java/awt/peer/DesktopPeer.java4
-rw-r--r--java/awt/peer/DialogPeer.java3
-rw-r--r--java/awt/peer/FileDialogPeer.java3
-rw-r--r--java/awt/peer/FontPeer.java1
-rw-r--r--java/awt/peer/FramePeer.java9
-rw-r--r--java/awt/peer/LabelPeer.java3
-rw-r--r--java/awt/peer/LightweightPeer.java1
-rw-r--r--java/awt/peer/ListPeer.java3
-rw-r--r--java/awt/peer/MenuBarPeer.java3
-rw-r--r--java/awt/peer/MenuComponentPeer.java7
-rw-r--r--java/awt/peer/MenuItemPeer.java3
-rw-r--r--java/awt/peer/MenuPeer.java1
-rw-r--r--java/awt/peer/MouseInfoPeer.java6
-rw-r--r--java/awt/peer/PanelPeer.java1
-rw-r--r--java/awt/peer/PopupMenuPeer.java1
-rw-r--r--java/awt/peer/RobotPeer.java1
-rw-r--r--java/awt/peer/ScrollPanePeer.java1
-rw-r--r--java/awt/peer/ScrollbarPeer.java3
-rw-r--r--java/awt/peer/TextComponentPeer.java7
-rw-r--r--java/awt/peer/TextFieldPeer.java5
-rw-r--r--java/awt/peer/WindowPeer.java9
-rw-r--r--java/awt/print/Book.java4
-rw-r--r--java/awt/print/PageFormat.java36
-rw-r--r--java/awt/print/Pageable.java16
-rw-r--r--java/awt/print/Paper.java22
-rw-r--r--java/awt/print/PrinterGraphics.java4
-rw-r--r--java/awt/print/PrinterIOException.java3
-rw-r--r--java/awt/print/PrinterJob.java12
-rw-r--r--java/beans/AppletInitializer.java2
-rw-r--r--java/beans/BeanDescriptor.java78
-rw-r--r--java/beans/BeanInfo.java212
-rw-r--r--java/beans/Beans.java46
-rw-r--r--java/beans/Customizer.java30
-rw-r--r--java/beans/DefaultPersistenceDelegate.java10
-rw-r--r--java/beans/DesignMode.java4
-rw-r--r--java/beans/Encoder.java36
-rw-r--r--java/beans/EventHandler.java166
-rw-r--r--java/beans/EventSetDescriptor.java60
-rw-r--r--java/beans/Expression.java18
-rw-r--r--java/beans/FeatureDescriptor.java2
-rw-r--r--java/beans/IndexedPropertyChangeEvent.java2
-rw-r--r--java/beans/IndexedPropertyDescriptor.java4
-rw-r--r--java/beans/Introspector.java462
-rw-r--r--java/beans/MethodDescriptor.java65
-rw-r--r--java/beans/ParameterDescriptor.java4
-rw-r--r--java/beans/PersistenceDelegate.java8
-rw-r--r--java/beans/PropertyChangeSupport.java2
-rw-r--r--java/beans/PropertyDescriptor.java24
-rw-r--r--java/beans/PropertyEditor.java196
-rw-r--r--java/beans/PropertyEditorManager.java20
-rw-r--r--java/beans/SimpleBeanInfo.java143
-rw-r--r--java/beans/Statement.java188
-rw-r--r--java/beans/VetoableChangeSupport.java2
-rw-r--r--java/beans/Visibility.java52
-rw-r--r--java/beans/XMLDecoder.java412
-rw-r--r--java/beans/XMLEncoder.java38
-rw-r--r--java/beans/beancontext/BeanContext.java192
-rw-r--r--java/beans/beancontext/BeanContextChild.java190
-rw-r--r--java/beans/beancontext/BeanContextChildComponentProxy.java14
-rw-r--r--java/beans/beancontext/BeanContextChildSupport.java552
-rw-r--r--java/beans/beancontext/BeanContextContainerProxy.java14
-rw-r--r--java/beans/beancontext/BeanContextEvent.java4
-rw-r--r--java/beans/beancontext/BeanContextMembershipEvent.java114
-rw-r--r--java/beans/beancontext/BeanContextMembershipListener.java34
-rw-r--r--java/beans/beancontext/BeanContextProxy.java18
-rw-r--r--java/beans/beancontext/BeanContextServiceAvailableEvent.java86
-rw-r--r--java/beans/beancontext/BeanContextServiceProvider.java148
-rw-r--r--java/beans/beancontext/BeanContextServiceProviderBeanInfo.java12
-rw-r--r--java/beans/beancontext/BeanContextServiceRevokedEvent.java120
-rw-r--r--java/beans/beancontext/BeanContextServiceRevokedListener.java24
-rw-r--r--java/beans/beancontext/BeanContextServices.java2
-rw-r--r--java/beans/beancontext/BeanContextServicesListener.java16
-rw-r--r--java/beans/beancontext/BeanContextServicesSupport.java312
-rw-r--r--java/beans/beancontext/BeanContextSupport.java326
-rw-r--r--java/io/BufferedInputStream.java66
-rw-r--r--java/io/BufferedOutputStream.java15
-rw-r--r--java/io/BufferedReader.java468
-rw-r--r--java/io/BufferedWriter.java102
-rw-r--r--java/io/ByteArrayInputStream.java14
-rw-r--r--java/io/ByteArrayOutputStream.java28
-rw-r--r--java/io/CharArrayReader.java90
-rw-r--r--java/io/CharArrayWriter.java70
-rw-r--r--java/io/DataInput.java104
-rw-r--r--java/io/DataInputStream.java188
-rw-r--r--java/io/DataOutput.java29
-rw-r--r--java/io/DataOutputStream.java73
-rw-r--r--java/io/DeleteFileHelper.java26
-rw-r--r--java/io/EOFException.java2
-rw-r--r--java/io/Externalizable.java30
-rw-r--r--java/io/File.java447
-rw-r--r--java/io/FileDescriptor.java32
-rw-r--r--java/io/FileFilter.java8
-rw-r--r--java/io/FileInputStream.java31
-rw-r--r--java/io/FileOutputStream.java37
-rw-r--r--java/io/FilePermission.java154
-rw-r--r--java/io/FileReader.java9
-rw-r--r--java/io/FileWriter.java8
-rw-r--r--java/io/FilenameFilter.java7
-rw-r--r--java/io/FilterInputStream.java14
-rw-r--r--java/io/FilterOutputStream.java9
-rw-r--r--java/io/FilterReader.java11
-rw-r--r--java/io/FilterWriter.java11
-rw-r--r--java/io/InputStream.java36
-rw-r--r--java/io/InputStreamReader.java242
-rw-r--r--java/io/InvalidClassException.java1
-rw-r--r--java/io/LineNumberInputStream.java44
-rw-r--r--java/io/LineNumberReader.java151
-rw-r--r--java/io/ObjectInput.java18
-rw-r--r--java/io/ObjectInputStream.java1795
-rw-r--r--java/io/ObjectInputValidation.java8
-rw-r--r--java/io/ObjectOutput.java9
-rw-r--r--java/io/ObjectOutputStream.java1042
-rw-r--r--java/io/ObjectStreamClass.java638
-rw-r--r--java/io/ObjectStreamConstants.java65
-rw-r--r--java/io/ObjectStreamField.java56
-rw-r--r--java/io/OutputStream.java10
-rw-r--r--java/io/OutputStreamWriter.java259
-rw-r--r--java/io/PipedInputStream.java217
-rw-r--r--java/io/PipedOutputStream.java50
-rw-r--r--java/io/PipedReader.java223
-rw-r--r--java/io/PipedWriter.java48
-rw-r--r--java/io/PrintStream.java78
-rw-r--r--java/io/PrintWriter.java115
-rw-r--r--java/io/PushbackInputStream.java56
-rw-r--r--java/io/PushbackReader.java129
-rw-r--r--java/io/RandomAccessFile.java212
-rw-r--r--java/io/Reader.java56
-rw-r--r--java/io/SequenceInputStream.java20
-rw-r--r--java/io/Serializable.java2
-rw-r--r--java/io/SerializablePermission.java13
-rw-r--r--java/io/StreamTokenizer.java392
-rw-r--r--java/io/StringBufferInputStream.java24
-rw-r--r--java/io/StringReader.java13
-rw-r--r--java/io/StringWriter.java6
-rw-r--r--java/io/UnsupportedEncodingException.java2
-rw-r--r--java/io/Writer.java22
-rw-r--r--java/lang/AbstractStringBuffer.java96
-rw-r--r--java/lang/Boolean.java4
-rw-r--r--java/lang/Character.java488
-rw-r--r--java/lang/Class.java326
-rw-r--r--java/lang/ClassLoader.java216
-rw-r--r--java/lang/Comparable.java4
-rw-r--r--java/lang/Double.java12
-rw-r--r--java/lang/Enum.java12
-rw-r--r--java/lang/EnumConstantNotPresentException.java2
-rw-r--r--java/lang/Float.java12
-rw-r--r--java/lang/IllegalArgumentException.java4
-rw-r--r--java/lang/IllegalStateException.java5
-rw-r--r--java/lang/IndexOutOfBoundsException.java2
-rw-r--r--java/lang/Integer.java26
-rw-r--r--java/lang/Long.java4
-rw-r--r--java/lang/Math.java24
-rw-r--r--java/lang/NoClassDefFoundError.java2
-rw-r--r--java/lang/Object.java2
-rw-r--r--java/lang/Package.java18
-rw-r--r--java/lang/ProcessBuilder.java6
-rw-r--r--java/lang/Runtime.java34
-rw-r--r--java/lang/SecurityException.java4
-rw-r--r--java/lang/SecurityManager.java28
-rw-r--r--java/lang/StackTraceElement.java2
-rw-r--r--java/lang/StrictMath.java418
-rw-r--r--java/lang/String.java268
-rw-r--r--java/lang/StringBuffer.java2
-rw-r--r--java/lang/StringBuilder.java6
-rw-r--r--java/lang/System.java176
-rw-r--r--java/lang/Thread.java78
-rw-r--r--java/lang/ThreadLocal.java2
-rw-r--r--java/lang/Throwable.java92
-rw-r--r--java/lang/TypeNotPresentException.java4
-rw-r--r--java/lang/UnsupportedOperationException.java4
-rw-r--r--java/lang/annotation/Annotation.java4
-rw-r--r--java/lang/annotation/AnnotationTypeMismatchException.java2
-rw-r--r--java/lang/annotation/IncompleteAnnotationException.java8
-rw-r--r--java/lang/instrument/ClassFileTransformer.java5
-rw-r--r--java/lang/instrument/Instrumentation.java26
-rw-r--r--java/lang/management/ClassLoadingMXBean.java3
-rw-r--r--java/lang/management/CompilationMXBean.java2
-rw-r--r--java/lang/management/GarbageCollectorMXBean.java2
-rw-r--r--java/lang/management/ManagementFactory.java494
-rw-r--r--java/lang/management/ManagementPermission.java5
-rw-r--r--java/lang/management/MemoryMXBean.java6
-rw-r--r--java/lang/management/MemoryManagerMXBean.java4
-rw-r--r--java/lang/management/MemoryNotificationInfo.java13
-rw-r--r--java/lang/management/MemoryPoolMXBean.java6
-rw-r--r--java/lang/management/MemoryType.java1
-rw-r--r--java/lang/management/MemoryUsage.java35
-rw-r--r--java/lang/management/MonitorInfo.java26
-rw-r--r--java/lang/management/OperatingSystemMXBean.java2
-rw-r--r--java/lang/management/RuntimeMXBean.java24
-rw-r--r--java/lang/management/ThreadInfo.java268
-rw-r--r--java/lang/management/ThreadMXBean.java44
-rw-r--r--java/lang/ref/PhantomReference.java8
-rw-r--r--java/lang/ref/Reference.java18
-rw-r--r--java/lang/ref/ReferenceQueue.java22
-rw-r--r--java/lang/ref/SoftReference.java10
-rw-r--r--java/lang/ref/WeakReference.java6
-rw-r--r--java/lang/reflect/AccessibleObject.java6
-rw-r--r--java/lang/reflect/AnnotatedElement.java2
-rw-r--r--java/lang/reflect/Array.java12
-rwxr-xr-xjava/lang/reflect/Constructor.java38
-rw-r--r--java/lang/reflect/Field.java14
-rw-r--r--java/lang/reflect/GenericArrayType.java2
-rw-r--r--java/lang/reflect/GenericDeclaration.java2
-rw-r--r--java/lang/reflect/InvocationHandler.java2
-rw-r--r--java/lang/reflect/MalformedParameterizedTypeException.java6
-rw-r--r--java/lang/reflect/Method.java42
-rw-r--r--java/lang/reflect/Modifier.java4
-rw-r--r--java/lang/reflect/Proxy.java14
-rw-r--r--java/lang/reflect/Type.java2
-rw-r--r--java/lang/reflect/TypeVariable.java6
-rw-r--r--java/lang/reflect/WildcardType.java4
-rw-r--r--java/math/BigDecimal.java490
-rw-r--r--java/math/BigInteger.java1328
-rw-r--r--java/math/MathContext.java56
-rw-r--r--java/math/RoundingMode.java10
-rw-r--r--java/net/ContentHandler.java4
-rw-r--r--java/net/DatagramSocket.java122
-rw-r--r--java/net/DatagramSocketImpl.java8
-rw-r--r--java/net/HttpURLConnection.java74
-rw-r--r--java/net/Inet4Address.java14
-rw-r--r--java/net/Inet6Address.java60
-rw-r--r--java/net/InetAddress.java96
-rw-r--r--java/net/InetSocketAddress.java16
-rw-r--r--java/net/MimeTypeMapper.java16
-rw-r--r--java/net/MulticastSocket.java26
-rw-r--r--java/net/NetworkInterface.java44
-rw-r--r--java/net/Proxy.java12
-rw-r--r--java/net/ProxySelector.java8
-rw-r--r--java/net/ResolverCache.java66
-rw-r--r--java/net/ServerSocket.java60
-rw-r--r--java/net/Socket.java72
-rw-r--r--java/net/SocketPermission.java314
-rw-r--r--java/net/URI.java526
-rw-r--r--java/net/URL.java168
-rw-r--r--java/net/URLClassLoader.java162
-rw-r--r--java/net/URLConnection.java56
-rw-r--r--java/net/URLDecoder.java84
-rw-r--r--java/net/URLEncoder.java78
-rw-r--r--java/net/URLStreamHandler.java198
-rw-r--r--java/nio/Buffer.java38
-rw-r--r--java/nio/BufferOverflowException.java2
-rw-r--r--java/nio/BufferUnderflowException.java2
-rw-r--r--java/nio/ByteBuffer.java118
-rw-r--r--java/nio/ByteBufferHelper.java49
-rw-r--r--java/nio/ByteBufferImpl.java68
-rw-r--r--java/nio/ByteOrder.java2
-rw-r--r--java/nio/CharBuffer.java80
-rw-r--r--java/nio/CharBufferImpl.java42
-rw-r--r--java/nio/CharSequenceBuffer.java4
-rw-r--r--java/nio/CharViewBufferImpl.java40
-rw-r--r--java/nio/DirectByteBufferImpl.java84
-rw-r--r--java/nio/DoubleBuffer.java52
-rw-r--r--java/nio/DoubleBufferImpl.java36
-rw-r--r--java/nio/DoubleViewBufferImpl.java26
-rw-r--r--java/nio/FloatBuffer.java52
-rw-r--r--java/nio/FloatBufferImpl.java30
-rw-r--r--java/nio/FloatViewBufferImpl.java34
-rw-r--r--java/nio/IntBuffer.java52
-rw-r--r--java/nio/IntBufferImpl.java26
-rw-r--r--java/nio/IntViewBufferImpl.java34
-rw-r--r--java/nio/InvalidMarkException.java2
-rw-r--r--java/nio/LongBuffer.java50
-rw-r--r--java/nio/LongBufferImpl.java32
-rw-r--r--java/nio/LongViewBufferImpl.java34
-rw-r--r--java/nio/MappedByteBuffer.java10
-rw-r--r--java/nio/MappedByteBufferImpl.java58
-rw-r--r--java/nio/ReadOnlyBufferException.java2
-rw-r--r--java/nio/ShortBuffer.java52
-rw-r--r--java/nio/ShortBufferImpl.java34
-rw-r--r--java/nio/ShortViewBufferImpl.java36
-rw-r--r--java/nio/channels/FileChannel.java4
-rw-r--r--java/nio/channels/SocketChannel.java16
-rw-r--r--java/nio/channels/spi/AbstractInterruptibleChannel.java12
-rw-r--r--java/nio/channels/spi/AbstractSelectableChannel.java56
-rw-r--r--java/nio/channels/spi/AbstractSelectionKey.java4
-rw-r--r--java/nio/channels/spi/AbstractSelector.java2
-rw-r--r--java/nio/channels/spi/SelectorProvider.java50
-rw-r--r--java/nio/charset/CharacterCodingException.java2
-rw-r--r--java/nio/charset/Charset.java92
-rw-r--r--java/nio/charset/CharsetDecoder.java6
-rw-r--r--java/nio/charset/CharsetEncoder.java8
-rw-r--r--java/nio/charset/CoderMalfunctionError.java2
-rw-r--r--java/nio/charset/CoderResult.java10
-rw-r--r--java/nio/charset/CodingErrorAction.java8
-rw-r--r--java/nio/charset/IllegalCharsetNameException.java6
-rw-r--r--java/nio/charset/MalformedInputException.java4
-rw-r--r--java/nio/charset/UnmappableCharacterException.java4
-rw-r--r--java/nio/charset/UnsupportedCharsetException.java6
-rw-r--r--java/rmi/AccessException.java2
-rw-r--r--java/rmi/AlreadyBoundException.java2
-rw-r--r--java/rmi/MarshalledObject.java30
-rw-r--r--java/rmi/Naming.java26
-rw-r--r--java/rmi/NoSuchObjectException.java2
-rw-r--r--java/rmi/NotBoundException.java2
-rw-r--r--java/rmi/RMISecurityException.java4
-rw-r--r--java/rmi/RMISecurityManager.java2
-rw-r--r--java/rmi/Remote.java12
-rw-r--r--java/rmi/RemoteException.java2
-rw-r--r--java/rmi/StubNotFoundException.java2
-rw-r--r--java/rmi/UnknownHostException.java2
-rw-r--r--java/rmi/activation/Activatable.java116
-rw-r--r--java/rmi/activation/ActivationDesc.java42
-rw-r--r--java/rmi/activation/ActivationGroup.java64
-rw-r--r--java/rmi/activation/ActivationGroupDesc.java78
-rw-r--r--java/rmi/activation/ActivationGroupID.java12
-rw-r--r--java/rmi/activation/ActivationID.java38
-rw-r--r--java/rmi/activation/ActivationInstantiator.java6
-rw-r--r--java/rmi/activation/ActivationMonitor.java12
-rw-r--r--java/rmi/activation/ActivationSystem.java38
-rw-r--r--java/rmi/activation/Activator.java4
-rw-r--r--java/rmi/activation/UnknownGroupException.java4
-rw-r--r--java/rmi/dgc/DGC.java6
-rw-r--r--java/rmi/dgc/Lease.java8
-rw-r--r--java/rmi/dgc/VMID.java40
-rw-r--r--java/rmi/registry/LocateRegistry.java18
-rw-r--r--java/rmi/registry/Registry.java22
-rw-r--r--java/rmi/registry/RegistryHandler.java2
-rw-r--r--java/rmi/server/LoaderHandler.java2
-rw-r--r--java/rmi/server/LogStream.java10
-rw-r--r--java/rmi/server/ObjID.java10
-rw-r--r--java/rmi/server/Operation.java8
-rw-r--r--java/rmi/server/RMIClassLoader.java20
-rw-r--r--java/rmi/server/RMIClientSocketFactory.java2
-rw-r--r--java/rmi/server/RMIFailureHandler.java2
-rw-r--r--java/rmi/server/RMIServerSocketFactory.java2
-rw-r--r--java/rmi/server/RMISocketFactory.java2
-rw-r--r--java/rmi/server/RemoteCall.java2
-rw-r--r--java/rmi/server/RemoteObject.java34
-rw-r--r--java/rmi/server/RemoteObjectInvocationHandler.java18
-rw-r--r--java/rmi/server/RemoteRef.java38
-rw-r--r--java/rmi/server/RemoteServer.java20
-rw-r--r--java/rmi/server/RemoteStub.java14
-rw-r--r--java/rmi/server/ServerRef.java2
-rw-r--r--java/rmi/server/Skeleton.java2
-rw-r--r--java/rmi/server/UID.java28
-rw-r--r--java/rmi/server/UnicastRemoteObject.java90
-rw-r--r--java/rmi/server/Unreferenced.java2
-rw-r--r--java/security/AccessControlContext.java70
-rw-r--r--java/security/AccessController.java4
-rw-r--r--java/security/AlgorithmParameterGenerator.java22
-rw-r--r--java/security/AlgorithmParameterGeneratorSpi.java8
-rw-r--r--java/security/AlgorithmParameters.java22
-rw-r--r--java/security/AlgorithmParametersSpi.java22
-rw-r--r--java/security/CodeSource.java4
-rw-r--r--java/security/DigestInputStream.java22
-rw-r--r--java/security/DigestOutputStream.java4
-rw-r--r--java/security/GeneralSecurityException.java2
-rw-r--r--java/security/Identity.java52
-rw-r--r--java/security/IdentityScope.java34
-rw-r--r--java/security/KeyFactory.java24
-rw-r--r--java/security/KeyFactorySpi.java24
-rw-r--r--java/security/KeyPairGenerator.java34
-rw-r--r--java/security/KeyPairGeneratorSpi.java6
-rw-r--r--java/security/KeyStore.java68
-rw-r--r--java/security/KeyStoreSpi.java52
-rw-r--r--java/security/MessageDigest.java36
-rw-r--r--java/security/MessageDigestSpi.java4
-rw-r--r--java/security/Permission.java10
-rw-r--r--java/security/Permissions.java12
-rw-r--r--java/security/Policy.java34
-rw-r--r--java/security/ProtectionDomain.java20
-rw-r--r--java/security/Provider.java10
-rw-r--r--java/security/ProviderException.java2
-rw-r--r--java/security/SecureClassLoader.java50
-rw-r--r--java/security/SecureRandom.java54
-rw-r--r--java/security/SecureRandomSpi.java8
-rw-r--r--java/security/Security.java178
-rw-r--r--java/security/Signature.java70
-rw-r--r--java/security/SignatureSpi.java40
-rw-r--r--java/security/SignedObject.java22
-rw-r--r--java/security/Signer.java8
-rw-r--r--java/security/acl/Acl.java4
-rw-r--r--java/security/acl/AclEntry.java4
-rw-r--r--java/security/acl/Group.java2
-rw-r--r--java/security/acl/Owner.java4
-rw-r--r--java/security/cert/CRL.java12
-rw-r--r--java/security/cert/CRLSelector.java2
-rw-r--r--java/security/cert/CertPathBuilder.java8
-rw-r--r--java/security/cert/CertPathBuilderResult.java8
-rw-r--r--java/security/cert/CertPathValidator.java8
-rw-r--r--java/security/cert/CertPathValidatorResult.java2
-rw-r--r--java/security/cert/CertPathValidatorSpi.java2
-rw-r--r--java/security/cert/CertSelector.java2
-rw-r--r--java/security/cert/CertStore.java6
-rw-r--r--java/security/cert/CertStoreParameters.java2
-rw-r--r--java/security/cert/CertStoreSpi.java2
-rw-r--r--java/security/cert/Certificate.java44
-rw-r--r--java/security/cert/CertificateFactory.java34
-rw-r--r--java/security/cert/CertificateFactorySpi.java39
-rw-r--r--java/security/cert/CollectionCertStoreParameters.java2
-rw-r--r--java/security/cert/LDAPCertStoreParameters.java2
-rw-r--r--java/security/cert/PKIXBuilderParameters.java2
-rw-r--r--java/security/cert/PKIXCertPathBuilderResult.java2
-rw-r--r--java/security/cert/PKIXCertPathChecker.java2
-rw-r--r--java/security/cert/PKIXCertPathValidatorResult.java2
-rw-r--r--java/security/cert/PKIXParameters.java2
-rw-r--r--java/security/cert/PolicyNode.java2
-rw-r--r--java/security/cert/PolicyQualifierInfo.java2
-rw-r--r--java/security/cert/X509CRL.java106
-rw-r--r--java/security/cert/X509CRLEntry.java46
-rw-r--r--java/security/cert/X509CertSelector.java36
-rw-r--r--java/security/cert/X509Certificate.java72
-rw-r--r--java/security/cert/X509Extension.java56
-rw-r--r--java/security/spec/AlgorithmParameterSpec.java12
-rw-r--r--java/security/spec/DSAParameterSpec.java12
-rw-r--r--java/security/spec/DSAPrivateKeySpec.java22
-rw-r--r--java/security/spec/DSAPublicKeySpec.java22
-rw-r--r--java/security/spec/EncodedKeySpec.java18
-rw-r--r--java/security/spec/InvalidParameterSpecException.java2
-rw-r--r--java/security/spec/KeySpec.java14
-rw-r--r--java/security/spec/PKCS8EncodedKeySpec.java18
-rw-r--r--java/security/spec/PSSParameterSpec.java4
-rw-r--r--java/security/spec/RSAKeyGenParameterSpec.java8
-rw-r--r--java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java4
-rw-r--r--java/security/spec/RSAOtherPrimeInfo.java2
-rw-r--r--java/security/spec/RSAPrivateCrtKeySpec.java26
-rw-r--r--java/security/spec/RSAPrivateKeySpec.java10
-rw-r--r--java/security/spec/RSAPublicKeySpec.java10
-rw-r--r--java/security/spec/X509EncodedKeySpec.java10
-rw-r--r--java/sql/Array.java14
-rw-r--r--java/sql/BatchUpdateException.java10
-rw-r--r--java/sql/Blob.java22
-rw-r--r--java/sql/CallableStatement.java24
-rw-r--r--java/sql/Clob.java26
-rw-r--r--java/sql/Connection.java50
-rw-r--r--java/sql/DataTruncation.java8
-rw-r--r--java/sql/DatabaseMetaData.java120
-rw-r--r--java/sql/Date.java22
-rw-r--r--java/sql/Driver.java18
-rw-r--r--java/sql/DriverManager.java46
-rw-r--r--java/sql/DriverPropertyInfo.java4
-rw-r--r--java/sql/ParameterMetaData.java4
-rw-r--r--java/sql/PreparedStatement.java20
-rw-r--r--java/sql/Ref.java4
-rw-r--r--java/sql/ResultSet.java130
-rw-r--r--java/sql/ResultSetMetaData.java8
-rw-r--r--java/sql/SQLData.java4
-rw-r--r--java/sql/SQLException.java14
-rw-r--r--java/sql/SQLInput.java7
-rw-r--r--java/sql/SQLOutput.java14
-rw-r--r--java/sql/SQLPermission.java4
-rw-r--r--java/sql/SQLWarning.java6
-rw-r--r--java/sql/Savepoint.java4
-rw-r--r--java/sql/Statement.java12
-rw-r--r--java/sql/Struct.java6
-rw-r--r--java/sql/Time.java17
-rw-r--r--java/sql/Timestamp.java68
-rw-r--r--java/sql/Types.java4
-rw-r--r--java/text/Annotation.java3
-rw-r--r--java/text/AttributedCharacterIterator.java38
-rw-r--r--java/text/AttributedString.java64
-rw-r--r--java/text/AttributedStringIterator.java74
-rw-r--r--java/text/Bidi.java40
-rw-r--r--java/text/BreakIterator.java120
-rw-r--r--java/text/CharacterIterator.java12
-rw-r--r--java/text/ChoiceFormat.java256
-rw-r--r--java/text/CollationElementIterator.java304
-rw-r--r--java/text/CollationKey.java16
-rw-r--r--java/text/Collator.java100
-rw-r--r--java/text/DateFormat.java474
-rw-r--r--java/text/DateFormatSymbols.java284
-rw-r--r--java/text/DecimalFormat.java740
-rw-r--r--java/text/DecimalFormatSymbols.java138
-rw-r--r--java/text/FieldPosition.java30
-rw-r--r--java/text/Format.java40
-rw-r--r--java/text/MessageFormat.java510
-rw-r--r--java/text/NumberFormat.java254
-rw-r--r--java/text/ParsePosition.java8
-rw-r--r--java/text/RuleBasedCollator.java696
-rw-r--r--java/text/SimpleDateFormat.java1086
-rw-r--r--java/text/StringCharacterIterator.java26
-rw-r--r--java/text/spi/DateFormatProvider.java8
-rw-r--r--java/text/spi/NumberFormatProvider.java2
-rw-r--r--java/util/AbstractCollection.java10
-rw-r--r--java/util/AbstractList.java386
-rw-r--r--java/util/AbstractMap.java198
-rw-r--r--java/util/AbstractSet.java22
-rw-r--r--java/util/ArrayList.java4
-rw-r--r--java/util/Arrays.java528
-rw-r--r--java/util/BitSet.java10
-rw-r--r--java/util/Calendar.java426
-rw-r--r--java/util/Collections.java778
-rw-r--r--java/util/Currency.java130
-rw-r--r--java/util/Date.java410
-rw-r--r--java/util/Dictionary.java8
-rw-r--r--java/util/DuplicateFormatFlagsException.java8
-rw-r--r--java/util/EnumMap.java384
-rw-r--r--java/util/EnumSet.java242
-rw-r--r--java/util/FormatFlagsConversionMismatchException.java6
-rw-r--r--java/util/Formattable.java8
-rw-r--r--java/util/FormattableFlags.java4
-rw-r--r--java/util/Formatter.java916
-rw-r--r--java/util/FormatterClosedException.java6
-rw-r--r--java/util/GregorianCalendar.java686
-rw-r--r--java/util/HashMap.java18
-rw-r--r--java/util/Hashtable.java52
-rw-r--r--java/util/IdentityHashMap.java8
-rw-r--r--java/util/IllegalFormatCodePointException.java6
-rw-r--r--java/util/IllegalFormatConversionException.java8
-rw-r--r--java/util/IllegalFormatException.java6
-rw-r--r--java/util/IllegalFormatFlagsException.java6
-rw-r--r--java/util/IllegalFormatPrecisionException.java6
-rw-r--r--java/util/IllegalFormatWidthException.java6
-rw-r--r--java/util/InputMismatchException.java6
-rw-r--r--java/util/LinkedHashMap.java8
-rw-r--r--java/util/LinkedHashSet.java2
-rw-r--r--java/util/LinkedList.java26
-rw-r--r--java/util/List.java2
-rw-r--r--java/util/Locale.java166
-rw-r--r--java/util/Map.java4
-rw-r--r--java/util/MissingFormatArgumentException.java10
-rw-r--r--java/util/MissingFormatWidthException.java6
-rw-r--r--java/util/PriorityQueue.java174
-rw-r--r--java/util/Properties.java146
-rw-r--r--java/util/PropertyPermission.java24
-rw-r--r--java/util/PropertyPermissionCollection.java2
-rw-r--r--java/util/Random.java12
-rw-r--r--java/util/ResourceBundle.java164
-rw-r--r--java/util/ServiceConfigurationError.java6
-rw-r--r--java/util/ServiceLoader.java66
-rw-r--r--java/util/SimpleTimeZone.java288
-rw-r--r--java/util/StringTokenizer.java2
-rw-r--r--java/util/TimeZone.java2418
-rw-r--r--java/util/Timer.java382
-rw-r--r--java/util/TreeMap.java552
-rw-r--r--java/util/TreeSet.java10
-rw-r--r--java/util/UUID.java76
-rw-r--r--java/util/UnknownFormatConversionException.java6
-rw-r--r--java/util/UnknownFormatFlagsException.java8
-rw-r--r--java/util/Vector.java12
-rw-r--r--java/util/WeakHashMap.java6
-rw-r--r--java/util/concurrent/CopyOnWriteArrayList.java248
-rw-r--r--java/util/jar/Attributes.java96
-rw-r--r--java/util/jar/JarEntry.java6
-rw-r--r--java/util/jar/JarFile.java194
-rw-r--r--java/util/jar/JarInputStream.java22
-rw-r--r--java/util/jar/JarOutputStream.java4
-rw-r--r--java/util/jar/Manifest.java8
-rw-r--r--java/util/logging/ConsoleHandler.java2
-rw-r--r--java/util/logging/ErrorManager.java5
-rw-r--r--java/util/logging/FileHandler.java110
-rw-r--r--java/util/logging/Formatter.java6
-rw-r--r--java/util/logging/Handler.java4
-rw-r--r--java/util/logging/Level.java45
-rw-r--r--java/util/logging/LogManager.java202
-rw-r--r--java/util/logging/LogRecord.java26
-rw-r--r--java/util/logging/Logger.java54
-rw-r--r--java/util/logging/LoggingMXBean.java4
-rw-r--r--java/util/logging/LoggingPermission.java8
-rw-r--r--java/util/logging/MemoryHandler.java30
-rw-r--r--java/util/logging/SocketHandler.java13
-rw-r--r--java/util/logging/StreamHandler.java58
-rw-r--r--java/util/logging/XMLFormatter.java44
-rw-r--r--java/util/prefs/AbstractPreferences.java38
-rw-r--r--java/util/prefs/NodeChangeEvent.java8
-rw-r--r--java/util/prefs/NodeChangeListener.java2
-rw-r--r--java/util/prefs/PreferenceChangeEvent.java6
-rw-r--r--java/util/prefs/PreferenceChangeListener.java2
-rw-r--r--java/util/prefs/Preferences.java31
-rw-r--r--java/util/prefs/PreferencesFactory.java2
-rw-r--r--java/util/regex/MatchResult.java10
-rw-r--r--java/util/regex/Pattern.java114
-rw-r--r--java/util/regex/PatternSyntaxException.java16
-rw-r--r--java/util/spi/LocaleNameProvider.java6
-rw-r--r--java/util/spi/TimeZoneNameProvider.java2
-rw-r--r--java/util/zip/Adler32.java66
-rw-r--r--java/util/zip/CRC32.java20
-rw-r--r--java/util/zip/CheckedInputStream.java16
-rw-r--r--java/util/zip/CheckedOutputStream.java2
-rw-r--r--java/util/zip/Deflater.java218
-rw-r--r--java/util/zip/DeflaterEngine.java618
-rw-r--r--java/util/zip/DeflaterHuffman.java726
-rw-r--r--java/util/zip/DeflaterOutputStream.java40
-rw-r--r--java/util/zip/DeflaterPending.java3
-rw-r--r--java/util/zip/GZIPInputStream.java86
-rw-r--r--java/util/zip/GZIPOutputStream.java64
-rw-r--r--java/util/zip/Inflater.java438
-rw-r--r--java/util/zip/InflaterDynHeader.java230
-rw-r--r--java/util/zip/InflaterHuffmanTree.java216
-rw-r--r--java/util/zip/InflaterInputStream.java74
-rw-r--r--java/util/zip/OutputWindow.java55
-rw-r--r--java/util/zip/PendingBuffer.java39
-rw-r--r--java/util/zip/StreamManipulator.java53
-rw-r--r--java/util/zip/ZipConstants.java1
-rw-r--r--java/util/zip/ZipEntry.java76
-rw-r--r--java/util/zip/ZipFile.java182
-rw-r--r--java/util/zip/ZipInputStream.java182
-rw-r--r--java/util/zip/ZipOutputStream.java212
796 files changed, 29852 insertions, 29955 deletions
diff --git a/java/applet/Applet.java b/java/applet/Applet.java
index bb855351b..2e4d46a84 100644
--- a/java/applet/Applet.java
+++ b/java/applet/Applet.java
@@ -249,11 +249,11 @@ public class Applet extends Panel
{
try
{
- return getImage(new URL(url, name));
+ return getImage(new URL(url, name));
}
catch (MalformedURLException e)
{
- return null;
+ return null;
}
}
@@ -302,11 +302,11 @@ public class Applet extends Panel
{
try
{
- return getAudioClip(new URL(url, name));
+ return getAudioClip(new URL(url, name));
}
catch (MalformedURLException e)
{
- return null;
+ return null;
}
}
@@ -361,7 +361,7 @@ public class Applet extends Panel
AudioClip ac = getAudioClip(url);
try
{
- ac.play();
+ ac.play();
}
catch (Exception ignored)
{
@@ -382,7 +382,7 @@ public class Applet extends Panel
{
try
{
- getAudioClip(url, name).play();
+ getAudioClip(url, name).play();
}
catch (Exception ignored)
{
@@ -518,7 +518,7 @@ public class Applet extends Panel
{
AccessibleStateSet s = super.getAccessibleStateSet();
if (isActive())
- s.add(AccessibleState.ACTIVE);
+ s.add(AccessibleState.ACTIVE);
return s;
}
} // class AccessibleApplet
@@ -534,7 +534,7 @@ public class Applet extends Panel
// and might be null afterward if we were unable to read the URL
// for some reason.
private Clip clip;
-
+
public URLAudioClip(URL url)
{
this.url = url;
diff --git a/java/awt/AWTEvent.java b/java/awt/AWTEvent.java
index 102062cdf..c4f772827 100644
--- a/java/awt/AWTEvent.java
+++ b/java/awt/AWTEvent.java
@@ -55,7 +55,7 @@ import java.awt.event.WindowEvent;
import java.util.EventObject;
/**
- * AWTEvent is the root event class for all AWT events in the JDK 1.1 event
+ * AWTEvent is the root event class for all AWT events in the JDK 1.1 event
* model. It supersedes the Event class from JDK 1.0. Subclasses outside of
* the java.awt package should have IDs greater than RESERVED_ID_MAX.
*
@@ -206,7 +206,7 @@ public abstract class AWTEvent extends EventObject
*/
public static final int RESERVED_ID_MAX = 1999;
-
+
/**
* Initializes a new AWTEvent from the old Java 1.0 event object.
*
diff --git a/java/awt/AWTEventMulticaster.java b/java/awt/AWTEventMulticaster.java
index 07a6ffc20..722dc752d 100644
--- a/java/awt/AWTEventMulticaster.java
+++ b/java/awt/AWTEventMulticaster.java
@@ -719,7 +719,7 @@ public class AWTEventMulticaster
* Chain <code>WindowListener</code> a and b.
*
* @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
+ * @param b the "b" listener, may be null
* @return latest entry in the chain
*/
public static WindowListener add(WindowListener a, WindowListener b)
@@ -731,7 +731,7 @@ public class AWTEventMulticaster
* Chain <code>WindowStateListener</code> a and b.
*
* @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
+ * @param b the "b" listener, may be null
* @return latest entry in the chain
* @since 1.4
*/
@@ -745,7 +745,7 @@ public class AWTEventMulticaster
* Chain <code>WindowFocusListener</code> a and b.
*
* @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
+ * @param b the "b" listener, may be null
* @return latest entry in the chain
* @since 1.4
*/
@@ -1083,7 +1083,7 @@ public class AWTEventMulticaster
* Chain <code>EventListener</code> a and b.
*
* @param a the "a" listener, may be null
- * @param b the "b" listener, may be null
+ * @param b the "b" listener, may be null
* @return latest entry in the chain
*/
protected static EventListener addInternal(EventListener a, EventListener b)
@@ -1176,7 +1176,7 @@ public class AWTEventMulticaster
* @since 1.4
*/
public static <T extends EventListener> T[] getListeners(EventListener l,
- Class<T> type)
+ Class<T> type)
{
ArrayList<EventListener> list = new ArrayList<EventListener>();
if (l instanceof AWTEventMulticaster)
diff --git a/java/awt/AWTKeyStroke.java b/java/awt/AWTKeyStroke.java
index 378e4eb15..bdccbf0d7 100644
--- a/java/awt/AWTKeyStroke.java
+++ b/java/awt/AWTKeyStroke.java
@@ -94,7 +94,7 @@ public class AWTKeyStroke implements Serializable
/** Prune stale entries. */
protected boolean removeEldestEntry(Map.Entry<AWTKeyStroke,AWTKeyStroke>
- eldest)
+ eldest)
{
return size() > MAX_CACHE_SIZE;
}
@@ -256,7 +256,7 @@ public class AWTKeyStroke implements Serializable
IllegalAccessException, InvocationTargetException
{
Constructor<?> c =
- subclass.getDeclaredConstructor((Class<?>[])null);
+ subclass.getDeclaredConstructor((Class<?>[])null);
c.setAccessible(true);
// Create a new instance, to make sure that we can, and
// to cause any ClassCastException.
@@ -279,7 +279,7 @@ public class AWTKeyStroke implements Serializable
/**
* Returns a keystroke representing a typed character.
*
- * @param keyChar the typed character
+ * @param keyChar the typed character
* @return the specified keystroke
*/
public static AWTKeyStroke getAWTKeyStroke(char keyChar)
@@ -396,7 +396,7 @@ public class AWTKeyStroke implements Serializable
* "alt shift released X" =&gt; getAWTKeyStroke(KeyEvent.VK_X,
* InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, true);<br>
* "typed a" =&gt; getAWTKeyStroke('a');
- * </code>
+ * </code>
*
* @param s the string to parse
* @throws IllegalArgumentException if s is null or cannot be parsed
@@ -416,25 +416,25 @@ public class AWTKeyStroke implements Serializable
{
token = t.nextToken();
if ("shift".equals(token))
- {
- modifiers |= KeyEvent.SHIFT_MASK;
- modifiers |= KeyEvent.SHIFT_DOWN_MASK;
- }
+ {
+ modifiers |= KeyEvent.SHIFT_MASK;
+ modifiers |= KeyEvent.SHIFT_DOWN_MASK;
+ }
else if ("ctrl".equals(token) || "control".equals(token))
- {
- modifiers |= KeyEvent.CTRL_MASK;
- modifiers |= KeyEvent.CTRL_DOWN_MASK;
- }
+ {
+ modifiers |= KeyEvent.CTRL_MASK;
+ modifiers |= KeyEvent.CTRL_DOWN_MASK;
+ }
else if ("meta".equals(token))
- {
- modifiers |= KeyEvent.META_MASK;
- modifiers |= KeyEvent.META_DOWN_MASK;
- }
+ {
+ modifiers |= KeyEvent.META_MASK;
+ modifiers |= KeyEvent.META_DOWN_MASK;
+ }
else if ("alt".equals(token))
- {
- modifiers |= KeyEvent.ALT_MASK;
- modifiers |= KeyEvent.ALT_DOWN_MASK;
- }
+ {
+ modifiers |= KeyEvent.ALT_MASK;
+ modifiers |= KeyEvent.ALT_DOWN_MASK;
+ }
else if ("button1".equals(token))
modifiers |= KeyEvent.BUTTON1_DOWN_MASK;
else if ("button2".equals(token))
@@ -452,7 +452,7 @@ public class AWTKeyStroke implements Serializable
false);
}
throw new IllegalArgumentException("Invalid 'typed' argument '"
- + s + "'");
+ + s + "'");
}
else if ("pressed".equals(token))
{
@@ -475,7 +475,7 @@ public class AWTKeyStroke implements Serializable
Integer code = (Integer) vktable.get(token);
if (code == null)
throw new IllegalArgumentException("Unknown token '" + token
- + "' in '" + s + "'");
+ + "' in '" + s + "'");
if (t.hasMoreTokens())
throw new IllegalArgumentException("Too many tokens: " + s);
return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, code.intValue(),
diff --git a/java/awt/AlphaComposite.java b/java/awt/AlphaComposite.java
index a668fdae6..d6c43d139 100644
--- a/java/awt/AlphaComposite.java
+++ b/java/awt/AlphaComposite.java
@@ -91,7 +91,7 @@ public final class AlphaComposite implements Composite
public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP);
public static final AlphaComposite DstAtop = getInstance(DST_ATOP);
public static final AlphaComposite Xor = getInstance(XOR);
-
+
private final int rule;
private final float alpha;
private AlphaComposite(int rule, float alpha)
@@ -113,7 +113,7 @@ public final class AlphaComposite implements Composite
{
return getInstance(rule, 1);
}
-
+
/**
* Creates an AlphaComposite object with the specified rule and the constant
* alpha to multiply with the alpha of the source. The source is multiplied
@@ -162,7 +162,7 @@ public final class AlphaComposite implements Composite
* Return an <code>AlphaComposite</code> similar to <code>this</code>,
* that uses the specified rule. If <code>rule</code> is the same as
* <code>this.rule</code>, then <code>this</code> is returned.
- *
+ *
* @since 1.6
*/
public AlphaComposite derive(int rule)
@@ -172,14 +172,14 @@ public final class AlphaComposite implements Composite
else
return AlphaComposite.getInstance(rule, this.getAlpha());
}
-
+
/**
* Return an <code>AlphaComposite</code> similar to <code>this</code>,
* that uses the specified <code>alpha</code>.
- *
+ *
* If <code>alph</code> is the same as <code>this.alpha</code>,
* then <code>this</code> is returned.
- *
+ *
* @since 1.6
*/
public AlphaComposite derive(float alpha)
@@ -189,22 +189,22 @@ public final class AlphaComposite implements Composite
else
return AlphaComposite.getInstance(this.getRule(), alpha);
}
-
+
public float getAlpha()
{
return alpha;
}
-
+
public int getRule()
{
return rule;
}
-
+
public int hashCode()
{
return 31 * Float.floatToIntBits(alpha) + rule;
}
-
+
public boolean equals(Object o)
{
if (! (o instanceof AlphaComposite))
diff --git a/java/awt/BasicStroke.java b/java/awt/BasicStroke.java
index ef6a7f0b7..eac69d986 100644
--- a/java/awt/BasicStroke.java
+++ b/java/awt/BasicStroke.java
@@ -1,4 +1,4 @@
-/* BasicStroke.java --
+/* BasicStroke.java --
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,7 +53,7 @@ import java.util.Arrays;
* A general purpose {@link Stroke} implementation that can represent a wide
* variety of line styles for use with subclasses of {@link Graphics2D}.
* <p>
- * The line cap and join styles can be set using the options illustrated
+ * The line cap and join styles can be set using the options illustrated
* here:
* <p>
* <img src="doc-files/capjoin.png" width="350" height="180"
@@ -64,37 +64,37 @@ import java.util.Arrays;
*/
public class BasicStroke implements Stroke
{
- /**
+ /**
* Indicates a mitered line join style. See the class overview for an
* illustration.
*/
public static final int JOIN_MITER = 0;
-
- /**
+
+ /**
* Indicates a rounded line join style. See the class overview for an
* illustration.
*/
public static final int JOIN_ROUND = 1;
-
- /**
+
+ /**
* Indicates a bevelled line join style. See the class overview for an
* illustration.
*/
public static final int JOIN_BEVEL = 2;
- /**
+ /**
* Indicates a flat line cap style. See the class overview for an
* illustration.
*/
public static final int CAP_BUTT = 0;
-
- /**
+
+ /**
* Indicates a rounded line cap style. See the class overview for an
* illustration.
*/
public static final int CAP_ROUND = 1;
-
- /**
+
+ /**
* Indicates a square line cap style. See the class overview for an
* illustration.
*/
@@ -102,19 +102,19 @@ public class BasicStroke implements Stroke
/** The stroke width. */
private final float width;
-
+
/** The line cap style. */
private final int cap;
-
+
/** The line join style. */
private final int join;
-
+
/** The miter limit. */
private final float limit;
-
+
/** The dash array. */
private final float[] dash;
-
+
/** The dash phase. */
private final float phase;
@@ -125,9 +125,9 @@ public class BasicStroke implements Stroke
* Creates a new <code>BasicStroke</code> instance with the given attributes.
*
* @param width the line width (>= 0.0f).
- * @param cap the line cap style (one of {@link #CAP_BUTT},
+ * @param cap the line cap style (one of {@link #CAP_BUTT},
* {@link #CAP_ROUND} or {@link #CAP_SQUARE}).
- * @param join the line join style (one of {@link #JOIN_ROUND},
+ * @param join the line join style (one of {@link #JOIN_ROUND},
* {@link #JOIN_BEVEL}, or {@link #JOIN_MITER}).
* @param miterlimit the limit to trim the miter join. The miterlimit must be
* greater than or equal to 1.0f.
@@ -145,36 +145,36 @@ public class BasicStroke implements Stroke
throw new IllegalArgumentException("width " + width + " < 0");
else if (cap < CAP_BUTT || cap > CAP_SQUARE)
throw new IllegalArgumentException("cap " + cap + " out of range ["
- + CAP_BUTT + ".." + CAP_SQUARE + "]");
+ + CAP_BUTT + ".." + CAP_SQUARE + "]");
else if (miterlimit < 1.0f && join == JOIN_MITER)
throw new IllegalArgumentException("miterlimit " + miterlimit
- + " < 1.0f while join == JOIN_MITER");
+ + " < 1.0f while join == JOIN_MITER");
else if (join < JOIN_MITER || join > JOIN_BEVEL)
throw new IllegalArgumentException("join " + join + " out of range ["
- + JOIN_MITER + ".." + JOIN_BEVEL
- + "]");
+ + JOIN_MITER + ".." + JOIN_BEVEL
+ + "]");
else if (dashPhase < 0.0f && dash != null)
throw new IllegalArgumentException("dashPhase " + dashPhase
- + " < 0.0f while dash != null");
+ + " < 0.0f while dash != null");
else if (dash != null)
if (dash.length == 0)
- throw new IllegalArgumentException("dash.length is 0");
+ throw new IllegalArgumentException("dash.length is 0");
else
- {
- boolean allZero = true;
-
- for ( int i = 0; i < dash.length; ++i)
- {
- if (dash[i] != 0.0f)
- {
- allZero = false;
- break;
- }
- }
-
- if (allZero)
- throw new IllegalArgumentException("all dashes are 0.0f");
- }
+ {
+ boolean allZero = true;
+
+ for ( int i = 0; i < dash.length; ++i)
+ {
+ if (dash[i] != 0.0f)
+ {
+ allZero = false;
+ break;
+ }
+ }
+
+ if (allZero)
+ throw new IllegalArgumentException("all dashes are 0.0f");
+ }
this.width = width;
this.cap = cap;
@@ -188,13 +188,13 @@ public class BasicStroke implements Stroke
* Creates a new <code>BasicStroke</code> instance with the given attributes.
*
* @param width the line width (>= 0.0f).
- * @param cap the line cap style (one of {@link #CAP_BUTT},
+ * @param cap the line cap style (one of {@link #CAP_BUTT},
* {@link #CAP_ROUND} or {@link #CAP_SQUARE}).
- * @param join the line join style (one of {@link #JOIN_ROUND},
+ * @param join the line join style (one of {@link #JOIN_ROUND},
* {@link #JOIN_BEVEL}, or {@link #JOIN_MITER}).
* @param miterlimit the limit to trim the miter join. The miterlimit must be
* greater than or equal to 1.0f.
- *
+ *
* @throws IllegalArgumentException If one input parameter doesn't meet
* its needs.
*/
@@ -208,11 +208,11 @@ public class BasicStroke implements Stroke
* The miter limit defaults to <code>10.0</code>.
*
* @param width the line width (>= 0.0f).
- * @param cap the line cap style (one of {@link #CAP_BUTT},
+ * @param cap the line cap style (one of {@link #CAP_BUTT},
* {@link #CAP_ROUND} or {@link #CAP_SQUARE}).
- * @param join the line join style (one of {@link #JOIN_ROUND},
+ * @param join the line join style (one of {@link #JOIN_ROUND},
* {@link #JOIN_BEVEL}, or {@link #JOIN_MITER}).
- *
+ *
* @throws IllegalArgumentException If one input parameter doesn't meet
* its needs.
*/
@@ -229,9 +229,9 @@ public class BasicStroke implements Stroke
* <li>line join style: {@link #JOIN_MITER};</li>
* <li>miter limit: <code>10.0f</code>.
* </ul>
- *
+ *
* @param width the line width (>= 0.0f).
- *
+ *
* @throws IllegalArgumentException If <code>width</code> is negative.
*/
public BasicStroke(float width)
@@ -252,11 +252,11 @@ public class BasicStroke implements Stroke
{
this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0);
}
-
+
/**
* Creates a shape representing the stroked outline of the given shape.
* THIS METHOD IS NOT YET IMPLEMENTED.
- *
+ *
* @param s the shape.
*/
public Shape createStrokedShape(Shape s)
@@ -271,7 +271,7 @@ public class BasicStroke implements Stroke
/**
* Returns the line width.
- *
+ *
* @return The line width.
*/
public float getLineWidth()
@@ -282,7 +282,7 @@ public class BasicStroke implements Stroke
/**
* Returns a code indicating the line cap style (one of {@link #CAP_BUTT},
* {@link #CAP_ROUND}, {@link #CAP_SQUARE}).
- *
+ *
* @return A code indicating the line cap style.
*/
public int getEndCap()
@@ -293,7 +293,7 @@ public class BasicStroke implements Stroke
/**
* Returns a code indicating the line join style (one of {@link #JOIN_BEVEL},
* {@link #JOIN_MITER} or {@link #JOIN_ROUND}).
- *
+ *
* @return A code indicating the line join style.
*/
public int getLineJoin()
@@ -303,7 +303,7 @@ public class BasicStroke implements Stroke
/**
* Returns the miter limit.
- *
+ *
* @return The miter limit.
*/
public float getMiterLimit()
@@ -312,10 +312,10 @@ public class BasicStroke implements Stroke
}
/**
- * Returns the dash array, which defines the length of alternate opaque and
- * transparent sections in lines drawn with this stroke. If
+ * Returns the dash array, which defines the length of alternate opaque and
+ * transparent sections in lines drawn with this stroke. If
* <code>null</code>, a continuous line will be drawn.
- *
+ *
* @return The dash array (possibly <code>null</code>).
*/
public float[] getDashArray()
@@ -325,9 +325,9 @@ public class BasicStroke implements Stroke
/**
* Returns the dash phase for the stroke. This is the offset from the start
- * of a path at which the pattern defined by {@link #getDashArray()} is
+ * of a path at which the pattern defined by {@link #getDashArray()} is
* rendered.
- *
+ *
* @return The dash phase.
*/
public float getDashPhase()
@@ -341,7 +341,7 @@ public class BasicStroke implements Stroke
* (converted to <code>int</code> first with
* <code>Float.floatToIntBits()</code> if the value is a
* <code>float</code>).
- *
+ *
* @return The hash code.
*/
public int hashCode()
@@ -350,10 +350,10 @@ public class BasicStroke implements Stroke
hash ^= cap;
hash ^= join;
hash ^= Float.floatToIntBits(limit);
-
+
if (dash != null)
for (int i = 0; i < dash.length; i++)
- hash ^= Float.floatToIntBits(dash[i]);
+ hash ^= Float.floatToIntBits(dash[i]);
hash ^= Float.floatToIntBits(phase);
@@ -361,16 +361,16 @@ public class BasicStroke implements Stroke
}
/**
- * Compares this <code>BasicStroke</code> for equality with an arbitrary
+ * Compares this <code>BasicStroke</code> for equality with an arbitrary
* object. This method returns <code>true</code> if and only if:
* <ul>
* <li><code>o</code> is an instanceof <code>BasicStroke</code>;</li>
* <li>this object has the same width, line cap style, line join style,
* miter limit, dash array and dash phase as <code>o</code>.</li>
* </ul>
- *
+ *
* @param o the object (<code>null</code> permitted).
- *
+ *
* @return <code>true</code> if this stroke is equal to <code>o</code> and
* <code>false</code> otherwise.
*/
@@ -401,7 +401,7 @@ public class BasicStroke implements Stroke
y0 = y = coords[1];
if( pathOpen )
{
- capEnds();
+ capEnds();
convertPath(output, start);
start = end = null;
pathOpen = false;
@@ -425,7 +425,7 @@ public class BasicStroke implements Stroke
break;
case PathIterator.SEG_QUADTO:
- p = (new QuadSegment(x, y, coords[0], coords[1], coords[2],
+ p = (new QuadSegment(x, y, coords[0], coords[1], coords[2],
coords[3])).getDisplacedSegments(width/2.0);
if( !pathOpen )
{
@@ -549,7 +549,7 @@ public class BasicStroke implements Stroke
{
spanBoundary = false;
}
-
+
// Otherwise, we need to split the segment in two, as this
// segment spans a dash boundry
else
@@ -671,23 +671,23 @@ public class BasicStroke implements Stroke
else if(v instanceof QuadSegment)
p.quadTo((float)((QuadSegment)v).cp.getX(),
(float)((QuadSegment)v).cp.getY(),
- (float)v.P2.getX(),
+ (float)v.P2.getX(),
(float)v.P2.getY());
else if(v instanceof CubicSegment)
p.curveTo((float)((CubicSegment)v).cp1.getX(),
(float)((CubicSegment)v).cp1.getY(),
(float)((CubicSegment)v).cp2.getX(),
(float)((CubicSegment)v).cp2.getY(),
- (float)v.P2.getX(),
+ (float)v.P2.getX(),
(float)v.P2.getY());
v = v.next;
} while(v != s && v != null);
p.closePath();
}
-
+
/**
- * Add the segments to start and end (the inner and outer edges of the stroke)
+ * Add the segments to start and end (the inner and outer edges of the stroke)
*/
private void addSegments(Segment[] segments)
{
@@ -707,26 +707,26 @@ public class BasicStroke implements Stroke
p = lineIntersection(p0[0],p0[1],p1[0],p1[1],
p2[0],p2[1],p3[0],p3[1], false);
- double det = (p1[0] - p0[0])*(p3[1] - p2[1]) -
+ double det = (p1[0] - p0[0])*(p3[1] - p2[1]) -
(p3[0] - p2[0])*(p1[1] - p0[1]);
if( det > 0 )
{
- // start and segment[0] form the 'inner' part of a join,
+ // start and segment[0] form the 'inner' part of a join,
// connect the overlapping segments
joinInnerSegments(start, segments[0], p);
joinOuterSegments(end, segments[1], p);
}
else
{
- // end and segment[1] form the 'inner' part
+ // end and segment[1] form the 'inner' part
joinInnerSegments(end, segments[1], p);
joinOuterSegments(start, segments[0], p);
}
}
/**
- * Make a cap between a and b segments,
+ * Make a cap between a and b segments,
* where a-->b is the direction of iteration.
*/
private void capEnd(Segment a, Segment b)
@@ -767,7 +767,7 @@ public class BasicStroke implements Stroke
dx = (2.0/3.0)*width*dx/l;
dy = (2.0/3.0)*width*dy/l;
}
-
+
c1 = new Point2D.Double(p1[0] + dx, p1[1] + dy);
c2 = new Point2D.Double(b.P1.getX() + dx, b.P1.getY() + dy);
a.add(new CubicSegment(a.last.P2, c1, c2, b.P1));
@@ -782,9 +782,9 @@ public class BasicStroke implements Stroke
* if the intersection must be within the given segments.
* @return a Point2D or null.
*/
- private Point2D lineIntersection(double X1, double Y1,
- double X2, double Y2,
- double X3, double Y3,
+ private Point2D lineIntersection(double X1, double Y1,
+ double X2, double Y2,
+ double X3, double Y3,
double X4, double Y4,
boolean infinite)
{
@@ -840,7 +840,7 @@ public class BasicStroke implements Stroke
{
a.add(new LineSegment(a.last.P2, p));
a.add(new LineSegment(p, b.P1));
- }
+ }
else
{
// outside miter limit, do a bevel join.
diff --git a/java/awt/BorderLayout.java b/java/awt/BorderLayout.java
index 50061ec67..c06eb834b 100644
--- a/java/awt/BorderLayout.java
+++ b/java/awt/BorderLayout.java
@@ -299,7 +299,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
}
/**
- * Adds a component to the layout in the specified constraint position,
+ * Adds a component to the layout in the specified constraint position,
* which must be one of the string constants defined in this class.
*
* @param component The component to add.
@@ -317,7 +317,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
}
/**
- * Adds a component to the layout in the specified constraint position,
+ * Adds a component to the layout in the specified constraint position,
* which must be one of the string constants defined in this class.
*
* @param constraints The constraint string.
@@ -462,7 +462,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
/**
* Lays out the specified container according to the constraints in this
* object.
- *
+ *
* @param target The container to lay out.
*/
public void layoutContainer(Container target)
@@ -538,7 +538,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
/**
* Returns a string representation of this layout manager.
- *
+ *
* @return A string representation of this object.
*/
public String toString()
@@ -634,11 +634,11 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
/**
* Return the component at the indicated location, or null if no component
- * is at that location. The constraints argument must be one of the
- * location constants specified by this class.
+ * is at that location. The constraints argument must be one of the
+ * location constants specified by this class.
* @param constraints the location
* @return the component at that location, or null
- * @throws IllegalArgumentException if the constraints argument is not
+ * @throws IllegalArgumentException if the constraints argument is not
* recognized
* @since 1.5
*/
@@ -662,7 +662,7 @@ public class BorderLayout implements LayoutManager2, java.io.Serializable
return firstItem;
if (constraints == LINE_END)
return lastItem;
- throw new IllegalArgumentException("constraint " + constraints
+ throw new IllegalArgumentException("constraint " + constraints
+ " is not recognized");
}
diff --git a/java/awt/BufferCapabilities.java b/java/awt/BufferCapabilities.java
index bba83dcb0..522fdf7f6 100644
--- a/java/awt/BufferCapabilities.java
+++ b/java/awt/BufferCapabilities.java
@@ -143,7 +143,7 @@ public class BufferCapabilities implements Cloneable
* null
*/
public BufferCapabilities(ImageCapabilities frontCaps,
- ImageCapabilities backCaps,
+ ImageCapabilities backCaps,
FlipContents flip)
{
if (frontCaps == null || backCaps == null)
diff --git a/java/awt/Button.java b/java/awt/Button.java
index 4c246c765..458a45e53 100644
--- a/java/awt/Button.java
+++ b/java/awt/Button.java
@@ -51,7 +51,7 @@ import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleValue;
/**
- * This class provides a button widget for the AWT.
+ * This class provides a button widget for the AWT.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@cygnus.com)
@@ -94,7 +94,7 @@ private transient ActionListener action_listeners;
* The number used to generate the name returned by getName.
*/
private static transient long next_button_number;
-
+
protected class AccessibleAWTButton extends AccessibleAWTComponent
implements AccessibleAction, AccessibleValue
{
@@ -138,17 +138,17 @@ private transient ActionListener action_listeners;
processActionEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
return true;
}
-
+
public String getAccessibleName()
{
return label;
}
-
+
public AccessibleAction getAccessibleAction()
{
return this;
}
-
+
public AccessibleValue getAccessibleValue()
{
return this;
@@ -188,7 +188,7 @@ private transient ActionListener action_listeners;
{
return new Integer(0);
}
-
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.PUSH_BUTTON;
@@ -315,7 +315,7 @@ addActionListener(ActionListener listener)
/**
* Removes the specified listener from the list of listeners that will
* receive action events from this button.
- *
+ *
* @param listener The listener to remove.
*/
public synchronized void
@@ -339,18 +339,18 @@ removeActionListener(ActionListener listener)
}
/**
- * Returns all registered EventListers of the given listenerType.
- * listenerType must be a subclass of EventListener, or a
+ * Returns all registered EventListers of the given listenerType.
+ * listenerType must be a subclass of EventListener, or a
* ClassClassException is thrown.
*
* @param listenerType the listener type to return
*
* @return an array of listeners
- *
+ *
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements @see java.util.EventListener.
*
- * @since 1.3
+ * @since 1.3
*/
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
{
@@ -412,10 +412,10 @@ processActionEvent(ActionEvent event)
void
dispatchEventImpl(AWTEvent e)
{
- if (e.id <= ActionEvent.ACTION_LAST
+ if (e.id <= ActionEvent.ACTION_LAST
&& e.id >= ActionEvent.ACTION_FIRST
- && (action_listeners != null
- || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
+ && (action_listeners != null
+ || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
processEvent(e);
else
super.dispatchEventImpl(e);
@@ -464,5 +464,4 @@ public AccessibleContext getAccessibleContext()
return next_button_number++;
}
-} // class Button
-
+} // class Button
diff --git a/java/awt/Canvas.java b/java/awt/Canvas.java
index 95db1f57e..ab7a8e3fa 100644
--- a/java/awt/Canvas.java
+++ b/java/awt/Canvas.java
@@ -68,7 +68,7 @@ public class Canvas
* Compatible with Sun's JDK.
*/
private static final long serialVersionUID = -2284879212465893870L;
-
+
/**
* The number used to generate the name returned by getName.
*/
@@ -82,8 +82,8 @@ public class Canvas
/**
* Initializes a new instance of <code>Canvas</code>.
*/
- public Canvas()
- {
+ public Canvas()
+ {
}
/**
@@ -109,7 +109,7 @@ public class Canvas
}
/**
- * Repaints the canvas window. This method should be overridden by
+ * Repaints the canvas window. This method should be overridden by
* a subclass to do something useful, as this method simply paints
* the window with the background color.
*
@@ -154,7 +154,7 @@ public class Canvas
{
return AccessibleRole.CANVAS;
}
-
+
}
/**
@@ -186,9 +186,9 @@ public class Canvas
CanvasBltBufferStrategy(int numBuffers, boolean accelerated)
{
super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(accelerated),
- new ImageCapabilities(accelerated),
- BufferCapabilities.FlipContents.COPIED));
+ new BufferCapabilities(new ImageCapabilities(accelerated),
+ new ImageCapabilities(accelerated),
+ BufferCapabilities.FlipContents.COPIED));
}
}
@@ -209,9 +209,9 @@ public class Canvas
throws AWTException
{
super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(true),
- new ImageCapabilities(true),
- BufferCapabilities.FlipContents.COPIED));
+ new BufferCapabilities(new ImageCapabilities(true),
+ new ImageCapabilities(true),
+ BufferCapabilities.FlipContents.COPIED));
}
}
@@ -242,18 +242,18 @@ public class Canvas
{
if (numBuffers < 1)
throw new IllegalArgumentException("Canvas.createBufferStrategy: number"
- + " of buffers is less than one");
+ + " of buffers is less than one");
if (!isDisplayable())
throw new IllegalStateException("Canvas.createBufferStrategy: canvas is"
- + " not displayable");
+ + " not displayable");
BufferStrategy newStrategy = null;
// try a flipping strategy
try
{
- newStrategy = new CanvasFlipBufferStrategy(numBuffers);
+ newStrategy = new CanvasFlipBufferStrategy(numBuffers);
}
catch (AWTException e)
{
@@ -290,11 +290,11 @@ public class Canvas
{
if (numBuffers < 1)
throw new IllegalArgumentException("Canvas.createBufferStrategy: number"
- + " of buffers is less than one");
+ + " of buffers is less than one");
if (caps == null)
throw new IllegalArgumentException("Canvas.createBufferStrategy:"
- + " capabilities object is null");
+ + " capabilities object is null");
// a flipping strategy was requested
if (caps.isPageFlipping())
@@ -336,7 +336,7 @@ public class Canvas
/* Call the paint method */
paint(graphics);
}
-
+
/**
* Generate a unique name for this <code>Canvas</code>.
*
diff --git a/java/awt/CardLayout.java b/java/awt/CardLayout.java
index 35380d237..c36daf482 100644
--- a/java/awt/CardLayout.java
+++ b/java/awt/CardLayout.java
@@ -85,7 +85,7 @@ public class CardLayout implements LayoutManager2, Serializable
*
* @param comp The component to add
* @param constraints The name by which the component can later be called
- *
+ *
* @exception IllegalArgumentException If `constraints' is not a
* <code>String</code>
*/
@@ -93,17 +93,17 @@ public class CardLayout implements LayoutManager2, Serializable
{
if (! (constraints instanceof String))
throw new IllegalArgumentException ("Object " + constraints
- + " is not a string");
+ + " is not a string");
addLayoutComponent ((String) constraints, comp);
}
/**
* Add a new component to the layout. The name can be used later
* to refer to the component.
- *
+ *
* @param name The name by which the component can later be called
* @param comp The component to add
- *
+ *
* @deprecated This method is deprecated in favor of
* <code>addLayoutComponent(Component, Object)</code>.
*/
@@ -137,7 +137,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Return this layout manager's x alignment. This method always
* returns Component.CENTER_ALIGNMENT.
- *
+ *
* @param parent Container using this layout manager instance
*
* @return the x-axis alignment
@@ -150,7 +150,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Returns this layout manager's y alignment. This method always
* returns Component.CENTER_ALIGNMENT.
- *
+ *
* @param parent Container using this layout manager instance
*
* @return the y-axis alignment
@@ -180,7 +180,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Cause the last component in the container to be displayed.
- *
+ *
* @param parent The parent container, not <code>null</code>.
*/
public void last (Container parent)
@@ -193,32 +193,32 @@ public class CardLayout implements LayoutManager2, Serializable
* to be the same size as the parent, less insets and gaps.
*
* @param parent The parent container.
- */
+ */
public void layoutContainer (Container parent)
{
synchronized (parent.getTreeLock ())
{
- int width = parent.width;
- int height = parent.height;
+ int width = parent.width;
+ int height = parent.height;
- Insets ins = parent.getInsets ();
+ Insets ins = parent.getInsets ();
- int num = parent.ncomponents;
- Component[] comps = parent.component;
+ int num = parent.ncomponents;
+ Component[] comps = parent.component;
- int x = ins.left + hgap;
- int y = ins.top + vgap;
- width = width - 2 * hgap - ins.left - ins.right;
- height = height - 2 * vgap - ins.top - ins.bottom;
+ int x = ins.left + hgap;
+ int y = ins.top + vgap;
+ width = width - 2 * hgap - ins.left - ins.right;
+ height = height - 2 * vgap - ins.top - ins.bottom;
- for (int i = 0; i < num; ++i)
- comps[i].setBounds (x, y, width, height);
+ for (int i = 0; i < num; ++i)
+ comps[i].setBounds (x, y, width, height);
}
}
/**
* Get the maximum layout size of the container.
- *
+ *
* @param target The parent container
*
* @return the maximum layout size
@@ -234,7 +234,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Get the minimum layout size of the container.
- *
+ *
* @param target The parent container
*
* @return the minimum layout size
@@ -248,7 +248,7 @@ public class CardLayout implements LayoutManager2, Serializable
* Cause the next component in the container to be displayed. If
* this current card is the last one in the deck, the first
* component is displayed.
- *
+ *
* @param parent The parent container, not <code>null</code>.
*/
public void next (Container parent)
@@ -258,7 +258,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Get the preferred layout size of the container.
- *
+ *
* @param parent The parent container
*
* @return the preferred layout size
@@ -272,7 +272,7 @@ public class CardLayout implements LayoutManager2, Serializable
* Cause the previous component in the container to be displayed.
* If this current card is the first one in the deck, the last
* component is displayed.
- *
+ *
* @param parent The parent container, not <code>null</code>.
*/
public void previous (Container parent)
@@ -282,7 +282,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Remove the indicated component from this layout manager.
- *
+ *
* @param comp The component to remove
*/
public void removeLayoutComponent (Component comp)
@@ -290,20 +290,20 @@ public class CardLayout implements LayoutManager2, Serializable
Enumeration e = tab.keys ();
while (e.hasMoreElements ())
{
- Object key = e.nextElement ();
- if (tab.get (key) == comp)
- {
- tab.remove (key);
- Container parent = comp.getParent();
- next(parent);
- break;
- }
+ Object key = e.nextElement ();
+ if (tab.get (key) == comp)
+ {
+ tab.remove (key);
+ Container parent = comp.getParent();
+ next(parent);
+ break;
+ }
}
}
/**
* Set this layout manager's horizontal gap.
- *
+ *
* @param hgap The new gap
*/
public void setHgap (int hgap)
@@ -313,7 +313,7 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Set this layout manager's vertical gap.
- *
+ *
* @param vgap The new gap
*/
public void setVgap (int vgap)
@@ -324,34 +324,34 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* Cause the named component to be shown. If the component name is
* unknown or <code>null</code>, this method does nothing.
- *
+ *
* @param parent The parent container, not <code>null</code>.
- * @param name The name of the component to show
+ * @param name The name of the component to show
*/
public void show (Container parent, String name)
{
if (name == null)
return;
-
+
if (parent.getLayout() != this)
throw new IllegalArgumentException("parent's layout is not this CardLayout");
-
+
Object target = tab.get (name);
if (target != null)
{
- int num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
- for (int i = 0; i < num; ++i)
- {
- if (comps[i].isVisible())
- {
- if (target == comps[i])
- return;
- comps[i].setVisible (false);
- }
- }
- ((Component) target).setVisible (true);
+ int num = parent.ncomponents;
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+ for (int i = 0; i < num; ++i)
+ {
+ if (comps[i].isVisible())
+ {
+ if (target == comps[i])
+ return;
+ comps[i].setVisible (false);
+ }
+ }
+ ((Component) target).setVisible (true);
parent.validate();
}
}
@@ -368,71 +368,71 @@ public class CardLayout implements LayoutManager2, Serializable
/**
* This implements first(), last(), next(), and previous().
- *
+ *
* @param parent The parent container
* @param what The type of goto: FIRST, LAST, NEXT or PREV
- *
- * @throws IllegalArgumentException if parent has not this
+ *
+ * @throws IllegalArgumentException if parent has not this
* CardLayout set as its layout.
*/
private void gotoComponent (Container parent, int what)
{
if (parent.getLayout() != this)
throw new IllegalArgumentException("parent's layout is not this CardLayout");
-
+
synchronized (parent.getTreeLock ())
{
- int num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- if (num == 1)
- {
- comps[0].setVisible(true);
- return;
- }
-
- int choice = -1;
-
- if (what == FIRST)
- choice = 0;
- else if (what == LAST)
- choice = num - 1;
-
- for (int i = 0; i < num; ++i)
- {
- if (comps[i].isVisible ())
- {
- if (choice == i)
- {
- // Do nothing if we're already looking at the right
+ int num = parent.ncomponents;
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+
+ if (num == 1)
+ {
+ comps[0].setVisible(true);
+ return;
+ }
+
+ int choice = -1;
+
+ if (what == FIRST)
+ choice = 0;
+ else if (what == LAST)
+ choice = num - 1;
+
+ for (int i = 0; i < num; ++i)
+ {
+ if (comps[i].isVisible ())
+ {
+ if (choice == i)
+ {
+ // Do nothing if we're already looking at the right
// component.
return;
- }
- else if (what == PREV)
- {
- choice = i - 1;
- if (choice < 0)
- choice = num - 1;
- }
- else if (what == NEXT)
- {
+ }
+ else if (what == PREV)
+ {
+ choice = i - 1;
+ if (choice < 0)
+ choice = num - 1;
+ }
+ else if (what == NEXT)
+ {
choice = i + 1;
if (choice == num)
choice = 0;
- }
- comps[i].setVisible (false);
-
- if (choice >= 0)
- break;
- } else
+ }
+ comps[i].setVisible (false);
+
+ if (choice >= 0)
+ break;
+ } else
{
comps[i].setVisible(true);
}
- }
+ }
- if (choice >= 0 && choice < num)
- comps[choice].setVisible (true);
+ if (choice >= 0 && choice < num)
+ comps[choice].setVisible (true);
}
}
@@ -441,35 +441,35 @@ public class CardLayout implements LayoutManager2, Serializable
{
synchronized (parent.getTreeLock ())
{
- int w = 0, h = 0, num = parent.ncomponents;
- Component[] comps = parent.component;
-
- for (int i = 0; i < num; ++i)
- {
- Dimension d;
-
- if (what == MIN)
- d = comps[i].getMinimumSize ();
- else if (what == MAX)
- d = comps[i].getMaximumSize ();
- else
- d = comps[i].getPreferredSize ();
-
- w = Math.max (d.width, w);
- h = Math.max (d.height, h);
- }
-
- Insets i = parent.getInsets ();
- w += 2 * hgap + i.right + i.left;
- h += 2 * vgap + i.bottom + i.top;
-
- // Handle overflow.
- if (w < 0)
- w = Integer.MAX_VALUE;
- if (h < 0)
- h = Integer.MAX_VALUE;
-
- return new Dimension (w, h);
+ int w = 0, h = 0, num = parent.ncomponents;
+ Component[] comps = parent.component;
+
+ for (int i = 0; i < num; ++i)
+ {
+ Dimension d;
+
+ if (what == MIN)
+ d = comps[i].getMinimumSize ();
+ else if (what == MAX)
+ d = comps[i].getMaximumSize ();
+ else
+ d = comps[i].getPreferredSize ();
+
+ w = Math.max (d.width, w);
+ h = Math.max (d.height, h);
+ }
+
+ Insets i = parent.getInsets ();
+ w += 2 * hgap + i.right + i.left;
+ h += 2 * vgap + i.bottom + i.top;
+
+ // Handle overflow.
+ if (w < 0)
+ w = Integer.MAX_VALUE;
+ if (h < 0)
+ h = Integer.MAX_VALUE;
+
+ return new Dimension (w, h);
}
}
diff --git a/java/awt/Checkbox.java b/java/awt/Checkbox.java
index eea443edf..dffb57da3 100644
--- a/java/awt/Checkbox.java
+++ b/java/awt/Checkbox.java
@@ -138,10 +138,10 @@ protected class AccessibleAWTCheckbox
public void itemStateChanged(ItemEvent event)
{
firePropertyChange(ACCESSIBLE_STATE_PROPERTY,
- state ? null : AccessibleState.CHECKED,
+ state ? null : AccessibleState.CHECKED,
state ? AccessibleState.CHECKED : null);
}
-
+
/**
* Returns an implementation of the <code>AccessibleAction</code>
* interface for this accessible object. In this case, the
@@ -156,7 +156,7 @@ protected class AccessibleAWTCheckbox
{
return this;
}
-
+
/**
* Returns an implementation of the <code>AccessibleValue</code>
* interface for this accessible object. In this case, the
@@ -171,8 +171,8 @@ protected class AccessibleAWTCheckbox
{
return this;
}
-
- /*
+
+ /*
* The following methods are implemented in the JDK (up to
* 1.5) as stubs. We do likewise here.
*/
@@ -277,7 +277,7 @@ protected class AccessibleAWTCheckbox
{
return null;
}
-
+
/**
* Returns the role of this accessible object.
*
@@ -285,11 +285,11 @@ protected class AccessibleAWTCheckbox
* which describes this object.
* @see javax.accessibility.AccessibleRole
*/
- public AccessibleRole getAccessibleRole()
+ public AccessibleRole getAccessibleRole()
{
return AccessibleRole.CHECK_BOX;
}
-
+
/**
* Returns the state set of this accessible object.
*
@@ -319,7 +319,7 @@ protected class AccessibleAWTCheckbox
* Initializes a new instance of <code>Checkbox</code> with no label,
* an initial state of off, and that is not part of any checkbox group.
*/
-public
+public
Checkbox()
{
this("", false, null);
@@ -464,10 +464,10 @@ setState(boolean state)
{
this.state = state;
if (peer != null)
- {
- CheckboxPeer cp = (CheckboxPeer) peer;
- cp.setState (state);
- }
+ {
+ CheckboxPeer cp = (CheckboxPeer) peer;
+ cp.setState (state);
+ }
}
}
@@ -608,9 +608,9 @@ dispatchEventImpl(AWTEvent e)
ItemEvent ie = (ItemEvent) e;
int itemState = ie.getStateChange();
setState(itemState == ItemEvent.SELECTED ? true : false);
- if (item_listeners != null
- || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0)
- processEvent(e);
+ if (item_listeners != null
+ || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0)
+ processEvent(e);
}
else
super.dispatchEventImpl(e);
diff --git a/java/awt/CheckboxGroup.java b/java/awt/CheckboxGroup.java
index 31b573e65..30f3e1635 100644
--- a/java/awt/CheckboxGroup.java
+++ b/java/awt/CheckboxGroup.java
@@ -106,14 +106,14 @@ getSelectedCheckbox()
*
* @return The selected checkbox.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>getSelectedCheckbox()</code>.
*/
public Checkbox
getCurrent()
{
return(selectedCheckbox);
-}
+}
/*************************************************************************/
@@ -169,5 +169,4 @@ toString()
return(getClass().getName() + "[selectedCheckbox=" + selectedCheckbox + "]");
}
-} // class CheckboxGroup
-
+} // class CheckboxGroup
diff --git a/java/awt/CheckboxMenuItem.java b/java/awt/CheckboxMenuItem.java
index c886fc672..597e1964b 100644
--- a/java/awt/CheckboxMenuItem.java
+++ b/java/awt/CheckboxMenuItem.java
@@ -287,10 +287,10 @@ dispatchEventImpl(AWTEvent e)
}
}
- if (e.id <= ItemEvent.ITEM_LAST
+ if (e.id <= ItemEvent.ITEM_LAST
&& e.id >= ItemEvent.ITEM_FIRST
- && (item_listeners != null
- || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
+ && (item_listeners != null
+ || (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
processEvent(e);
else
super.dispatchEventImpl(e);
@@ -307,7 +307,7 @@ public String
paramString()
{
return ("label=" + getLabel() + ",state=" + state
- + "," + super.paramString());
+ + "," + super.paramString());
}
/**
@@ -321,7 +321,7 @@ paramString()
public <T extends EventListener> T[] getListeners (Class<T> listenerType)
{
if (listenerType == ItemListener.class)
- return AWTEventMulticaster.getListeners (item_listeners, listenerType);
+ return AWTEventMulticaster.getListeners (item_listeners, listenerType);
return super.getListeners (listenerType);
}
@@ -340,10 +340,10 @@ paramString()
implements AccessibleAction, AccessibleValue
{
// I think the base class provides the necessary implementation
-
+
private static final long serialVersionUID = -1122642964303476L;
}
-
+
/**
* Gets the AccessibleContext associated with this <code>CheckboxMenuItem</code>.
* The context is created, if necessary.
@@ -357,7 +357,7 @@ paramString()
accessibleContext = new AccessibleAWTCheckboxMenuItem();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>CheckboxMenuItem</code>.
*
@@ -374,4 +374,3 @@ paramString()
}
} // class CheckboxMenuItem
-
diff --git a/java/awt/Choice.java b/java/awt/Choice.java
index ae89b9e99..5d2cfaf67 100644
--- a/java/awt/Choice.java
+++ b/java/awt/Choice.java
@@ -135,7 +135,7 @@ public class Choice extends Component
{
return AccessibleRole.COMBO_BOX;
}
-
+
/**
* Returns the number of actions associated with this accessible
* object. In this case, it is the number of choices available.
@@ -162,7 +162,7 @@ public class Choice extends Component
{
return (String) pItems.get(i);
}
-
+
/**
* Executes the action with the specified id. In this case,
* calling this method provides the same behaviour as would
@@ -175,8 +175,8 @@ public class Choice extends Component
public boolean doAccessibleAction(int i)
{
if (i < 0 || i >= pItems.size())
- return false;
-
+ return false;
+
Choice.this.select( i );
return true;
@@ -248,14 +248,14 @@ public class Choice extends Component
if (peer != null)
((ChoicePeer) peer).add(item, getItemCount() - 1);
- if (selectedIndex == -1)
+ if (selectedIndex == -1)
select( 0 );
}
/**
* Adds the specified item to this choice box.
*
- * This method is oboslete since Java 2 platform 1.1. Please use
+ * This method is oboslete since Java 2 platform 1.1. Please use
* {@link #add(String)} instead.
*
* @param item The item to add.
@@ -307,7 +307,7 @@ public class Choice extends Component
int index = pItems.indexOf(item);
if (index == -1)
throw new IllegalArgumentException ("item \""
- + item + "\" not found in Choice");
+ + item + "\" not found in Choice");
remove(index);
}
@@ -327,15 +327,15 @@ public class Choice extends Component
if( getItemCount() == 0 )
selectedIndex = -1;
- else
+ else
{
- if( selectedIndex > index )
- selectedIndex--;
- else if( selectedIndex == index )
- selectedIndex = 0;
+ if( selectedIndex > index )
+ selectedIndex--;
+ else if( selectedIndex == index )
+ selectedIndex = 0;
- if( peer != null )
- ((ChoicePeer)peer).select( selectedIndex );
+ if( peer != null )
+ ((ChoicePeer)peer).select( selectedIndex );
}
}
@@ -346,13 +346,13 @@ public class Choice extends Component
{
if (getItemCount() <= 0)
return;
-
+
pItems.removeAllElements ();
if (peer != null)
{
- ChoicePeer cp = (ChoicePeer) peer;
- cp.removeAll ();
+ ChoicePeer cp = (ChoicePeer) peer;
+ cp.removeAll ();
}
selectedIndex = -1;
@@ -367,8 +367,8 @@ public class Choice extends Component
public synchronized String getSelectedItem()
{
return (selectedIndex == -1
- ? null
- : ((String)pItems.elementAt(selectedIndex)));
+ ? null
+ : ((String)pItems.elementAt(selectedIndex)));
}
/**
@@ -409,11 +409,11 @@ public class Choice extends Component
if ((index < 0) || (index >= getItemCount()))
throw new IllegalArgumentException("Bad index: " + index);
- if( selectedIndex == index )
+ if( selectedIndex == index )
return;
selectedIndex = index;
- if( peer != null )
+ if( peer != null )
((ChoicePeer)peer).select( index );
}
@@ -482,9 +482,9 @@ public class Choice extends Component
{
super.dispatchEventImpl(e);
- if( e.id <= ItemEvent.ITEM_LAST && e.id >= ItemEvent.ITEM_FIRST &&
- ( item_listeners != null ||
- ( eventMask & AWTEvent.ITEM_EVENT_MASK ) != 0 ) )
+ if( e.id <= ItemEvent.ITEM_LAST && e.id >= ItemEvent.ITEM_FIRST &&
+ ( item_listeners != null ||
+ ( eventMask & AWTEvent.ITEM_EVENT_MASK ) != 0 ) )
processEvent(e);
}
@@ -551,7 +551,7 @@ public class Choice extends Component
accessibleContext = new AccessibleAWTChoice();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>Choice</code>.
*
@@ -566,4 +566,4 @@ public class Choice extends Component
{
return next_choice_number++;
}
-} // class Choice
+} // class Choice
diff --git a/java/awt/Color.java b/java/awt/Color.java
index c3d04c049..243a5e86f 100644
--- a/java/awt/Color.java
+++ b/java/awt/Color.java
@@ -538,7 +538,7 @@ public class Color implements Paint, Serializable
hues[0] = (value & RED_MASK) >> 16;
hues[1] = (value & GREEN_MASK) >> 8;
hues[2] = value & BLUE_MASK;
-
+
// (0,0,0) is a special case.
if (hues[0] == 0 && hues[1] == 0 && hues[2] ==0)
{
@@ -547,10 +547,10 @@ public class Color implements Paint, Serializable
hues[2] = 3;
}
else
- {
+ {
for (int index = 0; index < 3; index++)
{
-
+
if (hues[index] > 2)
hues[index] = (int) Math.min(255, hues[index]/0.7f);
if (hues[index] == 1 || hues[index] == 2)
diff --git a/java/awt/ColorPaintContext.java b/java/awt/ColorPaintContext.java
index 2996f899f..5ba688617 100644
--- a/java/awt/ColorPaintContext.java
+++ b/java/awt/ColorPaintContext.java
@@ -59,7 +59,7 @@ class ColorPaintContext implements PaintContext
private ColorRaster cachedRaster;
-
+
/**
* Create the context for a given color.
*
@@ -69,11 +69,11 @@ class ColorPaintContext implements PaintContext
{
this(ColorModel.getRGBdefault(), colorRGB);
}
-
+
/**
* Create the context for a given color.
*
- * @param cm The color model of this context.
+ * @param cm The color model of this context.
* @param colorRGB The solid color to use.
*/
ColorPaintContext(ColorModel cm,int colorRGB)
@@ -91,7 +91,7 @@ class ColorPaintContext implements PaintContext
}
/**
- * Return the color model of this context.
+ * Return the color model of this context.
*
* @return the context color model
*/
@@ -111,7 +111,7 @@ class ColorPaintContext implements PaintContext
*/
public Raster getRaster(int x, int y, int width, int height)
{
- if( cachedRaster == null
+ if( cachedRaster == null
|| cachedRaster.getWidth() < width
|| cachedRaster.getHeight() < height)
{
@@ -119,16 +119,16 @@ class ColorPaintContext implements PaintContext
}
return cachedRaster.createChild(0 ,0 ,width ,height ,0 ,0 , null);
}
-
+
/**
- * A ColorRaster is a raster that is completely filled with one color. The
+ * A ColorRaster is a raster that is completely filled with one color. The
* data layout is taken from the color model given to the constructor.
*/
private class ColorRaster extends Raster
{
-
+
/**
- * Create a raster that is compaltible with the given color model and
+ * Create a raster that is compaltible with the given color model and
* filled with the given color.
* @param cm The color model for this raster.
* @param x The smallest horizontal corrdinate in the raster.
@@ -146,9 +146,9 @@ class ColorPaintContext implements PaintContext
getSampleModel().setPixels(0, 0, width, height, d,
dataBuffer);
}
-
-
-
+
+
+
private Object multiplyData(Object src, Object dest, int factor)
{
Object from;
@@ -156,7 +156,7 @@ class ColorPaintContext implements PaintContext
if (src instanceof byte[])
{
srcLength = ((byte[])src).length;
-
+
if (dest == null) dest = new byte[factor * srcLength];
}
else if (src instanceof short[])
@@ -173,23 +173,23 @@ class ColorPaintContext implements PaintContext
{
throw new ClassCastException("Unknown data buffer type");
}
-
+
System.arraycopy(src,0,dest,0,srcLength);
-
+
int count = 1;
while(count*2 < factor)
{
System.arraycopy(dest, 0, dest, count * srcLength, count*srcLength);
- count *= 2;
+ count *= 2;
}
-
+
if(factor > count)
- System.arraycopy(dest,0, dest, count * srcLength,
+ System.arraycopy(dest,0, dest, count * srcLength,
(factor - count) * srcLength );
-
+
return dest;
}
-
+
}
-
+
} // class ColorPaintContext
diff --git a/java/awt/Component.java b/java/awt/Component.java
index 44676ba9d..d2878a9fd 100644
--- a/java/awt/Component.java
+++ b/java/awt/Component.java
@@ -158,7 +158,7 @@ public abstract class Component
{
// Word to the wise - this file is huge. Search for '\f' (^L) for logical
// sectioning by fields, public API, private API, and nested classes.
-
+
/**
* Compatible with JDK 1.0+.
@@ -223,7 +223,7 @@ public abstract class Component
/**
* The default maximum size.
*/
- private static final Dimension DEFAULT_MAX_SIZE
+ private static final Dimension DEFAULT_MAX_SIZE
= new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
// Serialized fields from the serialization spec.
@@ -444,19 +444,19 @@ public abstract class Component
* by a call to {@link #setMinimumSize(Dimension)} with a non-null value.
*/
boolean minSizeSet;
-
+
/**
* The maximum size for the component.
* @see #setMaximumSize(Dimension)
*/
Dimension maxSize;
-
+
/**
* A flag indicating whether the maximum size for the component has been set
* by a call to {@link #setMaximumSize(Dimension)} with a non-null value.
*/
boolean maxSizeSet;
-
+
/**
* Cached information on the preferred size. Should have been transient.
*
@@ -527,7 +527,7 @@ public abstract class Component
*/
AccessibleContext accessibleContext;
-
+
// Guess what - listeners are special cased in serialization. See
// readObject and writeObject.
@@ -627,7 +627,7 @@ public abstract class Component
incrementalDraw = Boolean.getBoolean ("awt.image.incrementalDraw");
redrawRate = Long.getLong ("awt.image.redrawrate");
}
-
+
// Public and protected API.
/**
@@ -704,7 +704,7 @@ public abstract class Component
public void setDropTarget(DropTarget dt)
{
this.dropTarget = dt;
-
+
if (peer != null)
dropTarget.addNotify(peer);
}
@@ -802,8 +802,8 @@ public abstract class Component
/**
* Tests if the component is displayable. It must be connected to a native
- * screen resource. This reduces to checking that peer is not null. A
- * containment hierarchy is made displayable when a window is packed or
+ * screen resource. This reduces to checking that peer is not null. A
+ * containment hierarchy is made displayable when a window is packed or
* made visible.
*
* @return true if the component is displayable
@@ -863,10 +863,10 @@ public abstract class Component
* events).
*
* @param enabled true to enable this component
- *
+ *
* @see #isEnabled()
* @see #isLightweight()
- *
+ *
* @since 1.1
*/
public void setEnabled(boolean enabled)
@@ -898,7 +898,7 @@ public abstract class Component
* Enables or disables this component.
*
* @param enabled true to enable this component
- *
+ *
* @deprecated use {@link #setEnabled(boolean)} instead
*/
public void enable(boolean enabled)
@@ -964,9 +964,9 @@ public abstract class Component
* not show the component, if a parent is invisible.
*
* @param visible true to make this component visible
- *
+ *
* @see #isVisible()
- *
+ *
* @since 1.1
*/
public void setVisible(boolean visible)
@@ -1037,7 +1037,7 @@ public abstract class Component
* Makes this component visible or invisible.
*
* @param visible true to make this component visible
- *
+ *
* @deprecated use {@link #setVisible(boolean)} instead
*/
public void show(boolean visible)
@@ -1124,7 +1124,7 @@ public abstract class Component
{
if (peer != null)
peer.setForeground(c);
-
+
Color previous = foreground;
foreground = c;
firePropertyChange("foreground", previous, c);
@@ -1231,7 +1231,7 @@ public abstract class Component
* property.
*
* @param f the new font for this component
- *
+ *
* @see #getFont()
*/
public void setFont(Font f)
@@ -1254,7 +1254,7 @@ public abstract class Component
ComponentPeer p = peer;
if (p != null)
{
- // The peer receives the real font setting, which can depend on
+ // The peer receives the real font setting, which can depend on
// the parent font when this component's font has been set to null.
f = getFont();
if (f != null)
@@ -1591,7 +1591,7 @@ public abstract class Component
int oldy = this.y;
int oldwidth = this.width;
int oldheight = this.height;
-
+
boolean resized = oldwidth != width || oldheight != height;
boolean moved = oldx != x || oldy != y;
@@ -1820,15 +1820,15 @@ public abstract class Component
}
/**
- * Sets the preferred size that will be returned by
- * {@link #getPreferredSize()} always, and sends a
- * {@link PropertyChangeEvent} (with the property name 'preferredSize') to
+ * Sets the preferred size that will be returned by
+ * {@link #getPreferredSize()} always, and sends a
+ * {@link PropertyChangeEvent} (with the property name 'preferredSize') to
* all registered listeners.
- *
+ *
* @param size the preferred size (<code>null</code> permitted).
- *
+ *
* @since 1.5
- *
+ *
* @see #getPreferredSize()
*/
public void setPreferredSize(Dimension size)
@@ -1838,21 +1838,21 @@ public abstract class Component
prefSizeSet = (size != null);
firePropertyChange("preferredSize", old, size);
}
-
+
/**
- * Returns <code>true</code> if the current preferred size is not
- * <code>null</code> and was set by a call to
+ * Returns <code>true</code> if the current preferred size is not
+ * <code>null</code> and was set by a call to
* {@link #setPreferredSize(Dimension)}, otherwise returns <code>false</code>.
- *
+ *
* @return A boolean.
- *
+ *
* @since 1.5
*/
public boolean isPreferredSizeSet()
{
return prefSizeSet;
}
-
+
/**
* Returns the component's preferred size.
*
@@ -1870,7 +1870,7 @@ public abstract class Component
* The actual calculation is pulled out of preferredSize() so that
* we can call it from Container.preferredSize() and avoid creating a
* new intermediate Dimension object.
- *
+ *
* @return the preferredSize of the component
*/
Dimension preferredSizeImpl()
@@ -1895,7 +1895,7 @@ public abstract class Component
/**
* Returns the component's minimum size.
- *
+ *
* @return the component's minimum size
* @see #getPreferredSize()
* @see #setMinimumSize(Dimension)
@@ -1910,11 +1910,11 @@ public abstract class Component
* Sets the minimum size that will be returned by {@link #getMinimumSize()}
* always, and sends a {@link PropertyChangeEvent} (with the property name
* 'minimumSize') to all registered listeners.
- *
+ *
* @param size the minimum size (<code>null</code> permitted).
- *
+ *
* @since 1.5
- *
+ *
* @see #getMinimumSize()
*/
public void setMinimumSize(Dimension size)
@@ -1924,21 +1924,21 @@ public abstract class Component
minSizeSet = (size != null);
firePropertyChange("minimumSize", old, size);
}
-
+
/**
- * Returns <code>true</code> if the current minimum size is not
- * <code>null</code> and was set by a call to
+ * Returns <code>true</code> if the current minimum size is not
+ * <code>null</code> and was set by a call to
* {@link #setMinimumSize(Dimension)}, otherwise returns <code>false</code>.
- *
+ *
* @return A boolean.
- *
+ *
* @since 1.5
*/
public boolean isMinimumSizeSet()
{
return minSizeSet;
}
-
+
/**
* Returns the component's minimum size.
*
@@ -1957,7 +1957,7 @@ public abstract class Component
* we can call it from Container.preferredSize() and
* Component.preferredSizeImpl and avoid creating a
* new intermediate Dimension object.
- *
+ *
* @return the minimum size of the component
*/
Dimension minimumSizeImpl()
@@ -2014,11 +2014,11 @@ public abstract class Component
* Sets the maximum size that will be returned by {@link #getMaximumSize()}
* always, and sends a {@link PropertyChangeEvent} (with the property name
* 'maximumSize') to all registered listeners.
- *
+ *
* @param size the maximum size (<code>null</code> permitted).
- *
+ *
* @since 1.5
- *
+ *
* @see #getMaximumSize()
*/
public void setMaximumSize(Dimension size)
@@ -2030,19 +2030,19 @@ public abstract class Component
}
/**
- * Returns <code>true</code> if the current maximum size is not
- * <code>null</code> and was set by a call to
+ * Returns <code>true</code> if the current maximum size is not
+ * <code>null</code> and was set by a call to
* {@link #setMaximumSize(Dimension)}, otherwise returns <code>false</code>.
- *
+ *
* @return A boolean.
- *
+ *
* @since 1.5
*/
public boolean isMaximumSizeSet()
{
return maxSizeSet;
}
-
+
/**
* Returns the preferred horizontal alignment of this component. The value
* returned will be between {@link #LEFT_ALIGNMENT} and
@@ -2313,7 +2313,7 @@ public abstract class Component
* Paints this entire component, including any sub-components.
*
* @param g the graphics context for this paint job
- *
+ *
* @see #paint(Graphics)
*/
public void paintAll(Graphics g)
@@ -2336,7 +2336,7 @@ public abstract class Component
* @see #repaint(long, int, int, int, int)
*/
public void repaint()
- {
+ {
repaint(0, 0, 0, width, height);
}
@@ -2406,7 +2406,7 @@ public abstract class Component
// region to this component.
if (parent != null)
{
- int px = this.x + Math.max(0, x);
+ int px = this.x + Math.max(0, x);
int py = this.y + Math.max(0, y);
int pw = Math.min(this.width, width);
int ph = Math.min(this.height, height);
@@ -2431,7 +2431,7 @@ public abstract class Component
* in this class simply calls the <code>paint()</code> method.
*
* @param g the graphics context of the print device
- *
+ *
* @see #paint(Graphics)
*/
public void print(Graphics g)
@@ -2440,10 +2440,10 @@ public abstract class Component
}
/**
- * Prints this component, including all sub-components.
+ * Prints this component, including all sub-components.
*
* @param g the graphics context of the print device
- *
+ *
* @see #paintAll(Graphics)
*/
public void printAll(Graphics g)
@@ -2485,18 +2485,18 @@ public abstract class Component
repaint();
else if ((flags & SOMEBITS) != 0)
{
- if (incrementalDraw)
- {
- if (redrawRate != null)
- {
- long tm = redrawRate.longValue();
- if (tm < 0)
- tm = 0;
+ if (incrementalDraw)
+ {
+ if (redrawRate != null)
+ {
+ long tm = redrawRate.longValue();
+ if (tm < 0)
+ tm = 0;
repaint(tm);
- }
- else
+ }
+ else
repaint(100);
- }
+ }
}
return (flags & (ALLBITS | ABORT | ERROR)) == 0;
}
@@ -2650,9 +2650,9 @@ public abstract class Component
boolean retval;
if (p != null)
- retval = p.prepareImage(image, width, height, observer);
+ retval = p.prepareImage(image, width, height, observer);
else
- retval = getToolkit().prepareImage(image, width, height, observer);
+ retval = getToolkit().prepareImage(image, width, height, observer);
return retval;
}
@@ -2855,14 +2855,14 @@ public abstract class Component
/**
* By default, no old mouse events should be ignored.
* This can be overridden by subclasses.
- *
+ *
* @return false, no mouse events are ignored.
*/
static boolean ignoreOldMouseEvents()
{
return false;
}
-
+
/**
* AWT 1.0 event handler.
*
@@ -3414,19 +3414,19 @@ public abstract class Component
}
/**
- * Returns all registered {@link EventListener}s of the given
+ * Returns all registered {@link EventListener}s of the given
* <code>listenerType</code>.
*
- * @param listenerType the class of listeners to filter (<code>null</code>
+ * @param listenerType the class of listeners to filter (<code>null</code>
* not permitted).
- *
+ *
* @return An array of registered listeners.
- *
+ *
* @throws ClassCastException if <code>listenerType</code> does not implement
* the {@link EventListener} interface.
- * @throws NullPointerException if <code>listenerType</code> is
+ * @throws NullPointerException if <code>listenerType</code> is
* <code>null</code>.
- *
+ *
* @see #getComponentListeners()
* @see #getFocusListeners()
* @see #getHierarchyListeners()
@@ -3819,8 +3819,8 @@ public abstract class Component
mouseListener.mouseClicked(e);
break;
case MouseEvent.MOUSE_ENTERED:
- if( isLightweight() )
- setCursor( getCursor() );
+ if( isLightweight() )
+ setCursor( getCursor() );
mouseListener.mouseEntered(e);
break;
case MouseEvent.MOUSE_EXITED:
@@ -3882,7 +3882,7 @@ public abstract class Component
{
mouseWheelListener.mouseWheelMoved(e);
e.consume();
- }
+ }
}
/**
@@ -3977,37 +3977,37 @@ public abstract class Component
{
switch (evt.id)
{
- // Handle key events.
+ // Handle key events.
case Event.KEY_ACTION:
case Event.KEY_PRESS:
- return keyDown (evt, evt.key);
+ return keyDown (evt, evt.key);
case Event.KEY_ACTION_RELEASE:
case Event.KEY_RELEASE:
- return keyUp (evt, evt.key);
+ return keyUp (evt, evt.key);
- // Handle mouse events.
+ // Handle mouse events.
case Event.MOUSE_DOWN:
- return mouseDown (evt, evt.x, evt.y);
+ return mouseDown (evt, evt.x, evt.y);
case Event.MOUSE_UP:
- return mouseUp (evt, evt.x, evt.y);
+ return mouseUp (evt, evt.x, evt.y);
case Event.MOUSE_MOVE:
- return mouseMove (evt, evt.x, evt.y);
+ return mouseMove (evt, evt.x, evt.y);
case Event.MOUSE_DRAG:
- return mouseDrag (evt, evt.x, evt.y);
+ return mouseDrag (evt, evt.x, evt.y);
case Event.MOUSE_ENTER:
- return mouseEnter (evt, evt.x, evt.y);
+ return mouseEnter (evt, evt.x, evt.y);
case Event.MOUSE_EXIT:
- return mouseExit (evt, evt.x, evt.y);
+ return mouseExit (evt, evt.x, evt.y);
- // Handle focus events.
+ // Handle focus events.
case Event.GOT_FOCUS:
- return gotFocus (evt, evt.arg);
+ return gotFocus (evt, evt.arg);
case Event.LOST_FOCUS:
- return lostFocus (evt, evt.arg);
+ return lostFocus (evt, evt.arg);
- // Handle action event.
+ // Handle action event.
case Event.ACTION_EVENT:
- return action (evt, evt.arg);
+ return action (evt, evt.arg);
}
// Unknown event.
return false;
@@ -4186,7 +4186,7 @@ public abstract class Component
// much.
invalidate();
- if (dropTarget != null)
+ if (dropTarget != null)
dropTarget.addNotify(peer);
// Fetch the peerFont for later installation in validate().
@@ -4354,7 +4354,7 @@ public abstract class Component
* @since 1.4
*/
public void setFocusTraversalKeys(int id,
- Set<? extends AWTKeyStroke> keystrokes)
+ Set<? extends AWTKeyStroke> keystrokes)
{
if (keystrokes == null)
{
@@ -4438,12 +4438,12 @@ public abstract class Component
* @return set of traversal keys
*
* @throws IllegalArgumentException if id is invalid
- *
+ *
* @see #setFocusTraversalKeys (int, Set)
* @see KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
* @see KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
* @see KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
- *
+ *
* @since 1.4
*/
public Set<AWTKeyStroke> getFocusTraversalKeys (int id)
@@ -4506,8 +4506,8 @@ public abstract class Component
public void setFocusTraversalKeysEnabled (boolean focusTraversalKeysEnabled)
{
firePropertyChange ("focusTraversalKeysEnabled",
- this.focusTraversalKeysEnabled,
- focusTraversalKeysEnabled);
+ this.focusTraversalKeysEnabled,
+ focusTraversalKeysEnabled);
this.focusTraversalKeysEnabled = focusTraversalKeysEnabled;
}
@@ -4670,7 +4670,7 @@ public abstract class Component
private boolean requestFocusImpl(boolean temporary, boolean focusWindow)
{
boolean retval = false;
-
+
// Don't try to focus non-focusable and non-visible components.
if (isFocusable() && isVisible())
{
@@ -4954,9 +4954,9 @@ public abstract class Component
* Adds the specified popup menu to this component.
*
* @param popup the popup menu to be added
- *
+ *
* @see #remove(MenuComponent)
- *
+ *
* @since 1.1
*/
public synchronized void add(PopupMenu popup)
@@ -5233,7 +5233,7 @@ p * <li>the set of backward traversal keys
Object newValue)
{
if (changeSupport != null)
- changeSupport.firePropertyChange(propertyName, oldValue, newValue);
+ changeSupport.firePropertyChange(propertyName, oldValue, newValue);
}
/**
@@ -5379,7 +5379,7 @@ p * <li>the set of backward traversal keys
*/
public void setComponentOrientation(ComponentOrientation o)
{
-
+
ComponentOrientation oldOrientation = componentOrientation;
componentOrientation = o;
firePropertyChange("componentOrientation", oldOrientation, o);
@@ -5426,7 +5426,7 @@ p * <li>the set of backward traversal keys
return null;
}
-
+
// Helper methods; some are package visible for use by subclasses.
/**
@@ -5463,13 +5463,13 @@ p * <li>the set of backward traversal keys
{
Object target = e.getSource ();
Event translated = null;
-
+
if (e instanceof WindowEvent)
{
WindowEvent we = (WindowEvent) e;
int id = we.id;
int newId = 0;
-
+
switch (id)
{
case WindowEvent.WINDOW_DEICONIFIED:
@@ -5666,22 +5666,22 @@ p * <li>the set of backward traversal keys
}
else if (e instanceof AdjustmentEvent)
{
- AdjustmentEvent ae = (AdjustmentEvent) e;
- int type = ae.getAdjustmentType();
- int oldType;
- if (type == AdjustmentEvent.BLOCK_DECREMENT)
- oldType = Event.SCROLL_PAGE_UP;
- else if (type == AdjustmentEvent.BLOCK_INCREMENT)
- oldType = Event.SCROLL_PAGE_DOWN;
- else if (type == AdjustmentEvent.TRACK)
- oldType = Event.SCROLL_ABSOLUTE;
- else if (type == AdjustmentEvent.UNIT_DECREMENT)
- oldType = Event.SCROLL_LINE_UP;
- else if (type == AdjustmentEvent.UNIT_INCREMENT)
- oldType = Event.SCROLL_LINE_DOWN;
- else
- oldType = type;
- translated = new Event(target, oldType, new Integer(ae.getValue()));
+ AdjustmentEvent ae = (AdjustmentEvent) e;
+ int type = ae.getAdjustmentType();
+ int oldType;
+ if (type == AdjustmentEvent.BLOCK_DECREMENT)
+ oldType = Event.SCROLL_PAGE_UP;
+ else if (type == AdjustmentEvent.BLOCK_INCREMENT)
+ oldType = Event.SCROLL_PAGE_DOWN;
+ else if (type == AdjustmentEvent.TRACK)
+ oldType = Event.SCROLL_ABSOLUTE;
+ else if (type == AdjustmentEvent.UNIT_DECREMENT)
+ oldType = Event.SCROLL_LINE_UP;
+ else if (type == AdjustmentEvent.UNIT_INCREMENT)
+ oldType = Event.SCROLL_LINE_DOWN;
+ else
+ oldType = type;
+ translated = new Event(target, oldType, new Integer(ae.getValue()));
}
else if (e instanceof ActionEvent)
translated = new Event (target, Event.ACTION_EVENT,
@@ -5760,14 +5760,14 @@ p * <li>the set of backward traversal keys
switch (type)
{
case HierarchyEvent.HIERARCHY_CHANGED:
- return (hierarchyListener != null
+ return (hierarchyListener != null
|| (eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0);
-
+
case HierarchyEvent.ANCESTOR_MOVED:
case HierarchyEvent.ANCESTOR_RESIZED:
- return (hierarchyBoundsListener != null
+ return (hierarchyBoundsListener != null
|| (eventMask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0);
-
+
case ComponentEvent.COMPONENT_HIDDEN:
case ComponentEvent.COMPONENT_MOVED:
case ComponentEvent.COMPONENT_RESIZED:
@@ -5795,7 +5795,7 @@ p * <li>the set of backward traversal keys
case MouseEvent.MOUSE_WHEEL:
return (mouseWheelListener != null
|| (eventMask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0);
-
+
case FocusEvent.FOCUS_GAINED:
case FocusEvent.FOCUS_LOST:
return (focusListener != null
@@ -5805,11 +5805,11 @@ p * <li>the set of backward traversal keys
case InputMethodEvent.CARET_POSITION_CHANGED:
return (inputMethodListener != null
|| (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0);
-
+
case PaintEvent.PAINT:
case PaintEvent.UPDATE:
return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0;
-
+
default:
return false;
}
@@ -5966,14 +5966,14 @@ p * <li>the set of backward traversal keys
s.writeObject(null);
}
-
+
// Nested classes.
-
+
/**
* This class fixes the bounds for a Heavyweight component that
* is placed inside a Lightweight container. When the lightweight is
* moved or resized, setBounds for the lightweight peer does nothing.
- * Therefore, it was never moved on the screen. This class is
+ * Therefore, it was never moved on the screen. This class is
* attached to the lightweight, and it adjusts the position and size
* of the peer when notified.
* This is the same for show and hide.
@@ -5981,20 +5981,20 @@ p * <li>the set of backward traversal keys
class HeavyweightInLightweightListener
implements ComponentListener
{
-
+
/**
* Constructor. Adds component listener to lightweight parent.
- *
+ *
* @param parent - the lightweight container.
*/
public HeavyweightInLightweightListener(Container parent)
{
parent.addComponentListener(this);
}
-
+
/**
* This method is called when the component is resized.
- *
+ *
* @param event the <code>ComponentEvent</code> indicating the resize
*/
public void componentResized(ComponentEvent event)
@@ -6004,7 +6004,7 @@ p * <li>the set of backward traversal keys
/**
* This method is called when the component is moved.
- *
+ *
* @param event the <code>ComponentEvent</code> indicating the move
*/
public void componentMoved(ComponentEvent event)
@@ -6015,7 +6015,7 @@ p * <li>the set of backward traversal keys
/**
* This method is called when the component is made visible.
- *
+ *
* @param event the <code>ComponentEvent</code> indicating the visibility
*/
public void componentShown(ComponentEvent event)
@@ -6026,7 +6026,7 @@ p * <li>the set of backward traversal keys
/**
* This method is called when the component is hidden.
- *
+ *
* @param event the <code>ComponentEvent</code> indicating the visibility
*/
public void componentHidden(ComponentEvent event)
@@ -6035,7 +6035,7 @@ p * <li>the set of backward traversal keys
peer.hide();
}
}
-
+
/**
* This class provides accessibility support for subclasses of container.
*
@@ -6732,13 +6732,13 @@ p * <li>the set of backward traversal keys
protected void createBackBuffers(int numBuffers)
{
GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
+ GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice().getDefaultConfiguration();
backBuffers = new VolatileImage[numBuffers];
for (int i = 0; i < numBuffers; i++)
- backBuffers[i] = c.createCompatibleVolatileImage(width, height);
+ backBuffers[i] = c.createCompatibleVolatileImage(width, height);
}
/**
@@ -6769,30 +6769,30 @@ p * <li>the set of backward traversal keys
public void show()
{
GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
+ GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice().getDefaultConfiguration();
// draw the front buffer.
getGraphics().drawImage(backBuffers[backBuffers.length - 1],
- width, height, null);
+ width, height, null);
BufferCapabilities.FlipContents f = getCapabilities().getFlipContents();
// blit the back buffers.
for (int i = backBuffers.length - 1; i > 0 ; i--)
- backBuffers[i] = backBuffers[i - 1];
+ backBuffers[i] = backBuffers[i - 1];
// create new backmost buffer.
if (f == BufferCapabilities.FlipContents.UNDEFINED)
- backBuffers[0] = c.createCompatibleVolatileImage(width, height);
+ backBuffers[0] = c.createCompatibleVolatileImage(width, height);
// create new backmost buffer and clear it to the background
// color.
if (f == BufferCapabilities.FlipContents.BACKGROUND)
- {
- backBuffers[0] = c.createCompatibleVolatileImage(width, height);
- backBuffers[0].getGraphics().clearRect(0, 0, width, height);
- }
+ {
+ backBuffers[0] = c.createCompatibleVolatileImage(width, height);
+ backBuffers[0].getGraphics().clearRect(0, 0, width, height);
+ }
// FIXME: set the backmost buffer to the prior contents of the
// front buffer. How do we retrieve the contents of the front
@@ -6802,7 +6802,7 @@ p * <li>the set of backward traversal keys
// set the backmost buffer to a copy of the new front buffer.
if (f == BufferCapabilities.FlipContents.COPIED)
- backBuffers[0] = backBuffers[backBuffers.length - 1];
+ backBuffers[0] = backBuffers[backBuffers.length - 1];
}
/**
@@ -6811,15 +6811,15 @@ p * <li>the set of backward traversal keys
protected void revalidate()
{
GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
+ GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice().getDefaultConfiguration();
for (int i = 0; i < backBuffers.length; i++)
- {
- int result = backBuffers[i].validate(c);
- if (result == VolatileImage.IMAGE_INCOMPATIBLE)
- backBuffers[i] = c.createCompatibleVolatileImage(width, height);
- }
+ {
+ int result = backBuffers[i].validate(c);
+ if (result == VolatileImage.IMAGE_INCOMPATIBLE)
+ backBuffers[i] = c.createCompatibleVolatileImage(width, height);
+ }
validatedContents = true;
}
@@ -6832,13 +6832,13 @@ p * <li>the set of backward traversal keys
public boolean contentsLost()
{
for (int i = 0; i < backBuffers.length; i++)
- {
- if (backBuffers[i].contentsLost())
- {
- validatedContents = false;
- return true;
- }
- }
+ {
+ if (backBuffers[i].contentsLost())
+ {
+ validatedContents = false;
+ return true;
+ }
+ }
// we know that the buffer resources are valid now because we
// just checked them
validatedContents = true;
@@ -6855,19 +6855,19 @@ p * <li>the set of backward traversal keys
public boolean contentsRestored()
{
GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
+ GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice().getDefaultConfiguration();
boolean imageRestored = false;
for (int i = 0; i < backBuffers.length; i++)
- {
- int result = backBuffers[i].validate(c);
- if (result == VolatileImage.IMAGE_RESTORED)
- imageRestored = true;
- else if (result == VolatileImage.IMAGE_INCOMPATIBLE)
- return false;
- }
+ {
+ int result = backBuffers[i].validate(c);
+ if (result == VolatileImage.IMAGE_RESTORED)
+ imageRestored = true;
+ else if (result == VolatileImage.IMAGE_INCOMPATIBLE)
+ return false;
+ }
// we know that the buffer resources are valid now because we
// just checked them
validatedContents = true;
@@ -6939,12 +6939,12 @@ p * <li>the set of backward traversal keys
height = getHeight();
if (numBuffers > 1)
- createBuffers(numBuffers, caps);
+ createBuffers(numBuffers, caps);
else
- {
- drawVBuffer = peer.createVolatileImage(width, height);
- drawBuffer = drawVBuffer;
- }
+ {
+ drawVBuffer = peer.createVolatileImage(width, height);
+ drawBuffer = drawVBuffer;
+ }
}
/**
@@ -6967,14 +6967,14 @@ p * <li>the set of backward traversal keys
throws AWTException
{
if (numBuffers <= 1)
- throw new IllegalArgumentException("FlipBufferStrategy.createBuffers:"
- + " numBuffers must be greater than"
- + " one.");
+ throw new IllegalArgumentException("FlipBufferStrategy.createBuffers:"
+ + " numBuffers must be greater than"
+ + " one.");
if (!caps.isPageFlipping())
- throw new IllegalArgumentException("FlipBufferStrategy.createBuffers:"
- + " flipping must be a specified"
- + " capability.");
+ throw new IllegalArgumentException("FlipBufferStrategy.createBuffers:"
+ + " flipping must be a specified"
+ + " capability.");
peer.createBuffers(numBuffers, caps);
}
@@ -7033,11 +7033,11 @@ p * <li>the set of backward traversal keys
protected void revalidate()
{
GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
+ GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice().getDefaultConfiguration();
if (drawVBuffer.validate(c) == VolatileImage.IMAGE_INCOMPATIBLE)
- drawVBuffer = peer.createVolatileImage(width, height);
+ drawVBuffer = peer.createVolatileImage(width, height);
validatedContents = true;
}
@@ -7050,10 +7050,10 @@ p * <li>the set of backward traversal keys
public boolean contentsLost()
{
if (drawVBuffer.contentsLost())
- {
- validatedContents = false;
- return true;
- }
+ {
+ validatedContents = false;
+ return true;
+ }
// we know that the buffer resources are valid now because we
// just checked them
validatedContents = true;
@@ -7070,17 +7070,17 @@ p * <li>the set of backward traversal keys
public boolean contentsRestored()
{
GraphicsConfiguration c =
- GraphicsEnvironment.getLocalGraphicsEnvironment()
- .getDefaultScreenDevice().getDefaultConfiguration();
+ GraphicsEnvironment.getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice().getDefaultConfiguration();
int result = drawVBuffer.validate(c);
boolean imageRestored = false;
if (result == VolatileImage.IMAGE_RESTORED)
- imageRestored = true;
+ imageRestored = true;
else if (result == VolatileImage.IMAGE_INCOMPATIBLE)
- return false;
+ return false;
// we know that the buffer resources are valid now because we
// just checked them
diff --git a/java/awt/Container.java b/java/awt/Container.java
index 263473511..7e596f10a 100644
--- a/java/awt/Container.java
+++ b/java/awt/Container.java
@@ -330,7 +330,7 @@ public class Container extends Component
if (component == null)
component = new Component[4]; // FIXME, better initial size?
-
+
// This isn't the most efficient implementation. We could do less
// copying when growing the array. It probably doesn't matter.
if (ncomponents >= component.length)
@@ -340,7 +340,7 @@ public class Container extends Component
System.arraycopy(component, 0, c, 0, ncomponents);
component = c;
}
-
+
if (index == -1)
component[ncomponents++] = comp;
else
@@ -379,8 +379,8 @@ public class Container extends Component
// Notify the layout manager.
if (layoutMgr != null)
{
- // If we have a LayoutManager2 the constraints are "real",
- // otherwise they are the "name" of the Component to add.
+ // If we have a LayoutManager2 the constraints are "real",
+ // otherwise they are the "name" of the Component to add.
if (layoutMgr instanceof LayoutManager2)
{
LayoutManager2 lm2 = (LayoutManager2) layoutMgr;
@@ -990,21 +990,21 @@ public class Container extends Component
}
/**
- * Returns all registered {@link EventListener}s of the given
+ * Returns all registered {@link EventListener}s of the given
* <code>listenerType</code>.
*
- * @param listenerType the class of listeners to filter (<code>null</code>
+ * @param listenerType the class of listeners to filter (<code>null</code>
* not permitted).
- *
+ *
* @return An array of registered listeners.
- *
+ *
* @throws ClassCastException if <code>listenerType</code> does not implement
* the {@link EventListener} interface.
- * @throws NullPointerException if <code>listenerType</code> is
+ * @throws NullPointerException if <code>listenerType</code> is
* <code>null</code>.
- *
+ *
* @see #getContainerListeners()
- *
+ *
* @since 1.3
*/
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
@@ -1080,11 +1080,11 @@ public class Container extends Component
* child component claims the point, the container itself is returned,
* unless the point does not exist within this container, in which
* case <code>null</code> is returned.
- *
+ *
* When components overlap, the first component is returned. The component
- * that is closest to (x, y), containing that location, is returned.
+ * that is closest to (x, y), containing that location, is returned.
* Heavyweight components take precedence of lightweight components.
- *
+ *
* This function does not ignore invisible components. If there is an invisible
* component at (x,y), it will be returned.
*
@@ -1133,14 +1133,14 @@ public class Container extends Component
* child component claims the point, the container itself is returned,
* unless the point does not exist within this container, in which
* case <code>null</code> is returned.
- *
+ *
* When components overlap, the first component is returned. The component
- * that is closest to (x, y), containing that location, is returned.
+ * that is closest to (x, y), containing that location, is returned.
* Heavyweight components take precedence of lightweight components.
- *
+ *
* This function does not ignore invisible components. If there is an invisible
* component at (x,y), it will be returned.
- *
+ *
* @param x The x position of the point to return the component at.
* @param y The y position of the point to return the component at.
*
@@ -1155,7 +1155,7 @@ public class Container extends Component
{
if (!contains (x, y))
return null;
-
+
// First find the component closest to (x,y) that is a heavyweight.
for (int i = 0; i < ncomponents; ++i)
{
@@ -1165,7 +1165,7 @@ public class Container extends Component
if (comp.contains (x2, y2) && !comp.isLightweight())
return comp;
}
-
+
// if a heavyweight component is not found, look for a lightweight
// closest to (x,y).
for (int i = 0; i < ncomponents; ++i)
@@ -1176,7 +1176,7 @@ public class Container extends Component
if (comp.contains (x2, y2) && comp.isLightweight())
return comp;
}
-
+
return this;
}
}
@@ -1190,12 +1190,12 @@ public class Container extends Component
* case <code>null</code> is returned.
*
* The top-most child component is returned in the case where components overlap.
- * This is determined by finding the component closest to (x,y) and contains
+ * This is determined by finding the component closest to (x,y) and contains
* that location. Heavyweight components take precedence of lightweight components.
- *
+ *
* This function does not ignore invisible components. If there is an invisible
* component at (x,y), it will be returned.
- *
+ *
* @param p The point to return the component at.
* @return The component containing the specified point, or <code>null</code>
* if there is no such point.
@@ -1206,19 +1206,19 @@ public class Container extends Component
}
/**
- * Locates the visible child component that contains the specified position.
+ * Locates the visible child component that contains the specified position.
* The top-most child component is returned in the case where there is overlap
* in the components. If the containing child component is a Container,
- * this method will continue searching for the deepest nested child
+ * this method will continue searching for the deepest nested child
* component. Components which are not visible are ignored during the search.
- *
- * findComponentAt differs from getComponentAt, because it recursively
+ *
+ * findComponentAt differs from getComponentAt, because it recursively
* searches a Container's children.
- *
+ *
* @param x - x coordinate
* @param y - y coordinate
- * @return null if the component does not contain the position.
- * If there is no child component at the requested point and the point is
+ * @return null if the component does not contain the position.
+ * If there is no child component at the requested point and the point is
* within the bounds of the container the container itself is returned.
*/
public Component findComponentAt(int x, int y)
@@ -1252,20 +1252,20 @@ public class Container extends Component
return this;
}
}
-
+
/**
- * Locates the visible child component that contains the specified position.
+ * Locates the visible child component that contains the specified position.
* The top-most child component is returned in the case where there is overlap
* in the components. If the containing child component is a Container,
- * this method will continue searching for the deepest nested child
+ * this method will continue searching for the deepest nested child
* component. Components which are not visible are ignored during the search.
- *
- * findComponentAt differs from getComponentAt, because it recursively
+ *
+ * findComponentAt differs from getComponentAt, because it recursively
* searches a Container's children.
- *
+ *
* @param p - the component's location
- * @return null if the component does not contain the position.
- * If there is no child component at the requested point and the point is
+ * @return null if the component does not contain the position.
+ * If there is no child component at the requested point and the point is
* within the bounds of the container the container itself is returned.
*/
public Component findComponentAt(Point p)
@@ -1324,10 +1324,10 @@ public class Container extends Component
while (true)
{
if (comp == null)
- return false;
+ return false;
comp = comp.getParent();
if (comp == this)
- return true;
+ return true;
}
}
}
@@ -1401,7 +1401,7 @@ public class Container extends Component
* @since 1.4
*/
public void setFocusTraversalKeys(int id,
- Set<? extends AWTKeyStroke> keystrokes)
+ Set<? extends AWTKeyStroke> keystrokes)
{
if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
@@ -1495,7 +1495,7 @@ public class Container extends Component
focusTraversalKeys[id] = keystrokes;
}
-
+
/**
* Returns the Set of focus traversal keys for a given traversal operation for
* this Container.
@@ -1619,14 +1619,14 @@ public class Container extends Component
{
Container ancestor = getFocusCycleRootAncestor ();
- if (ancestor != this && ancestor != null)
- return ancestor.getFocusTraversalPolicy ();
- else
- {
- KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
+ if (ancestor != this && ancestor != null)
+ return ancestor.getFocusTraversalPolicy ();
+ else
+ {
+ KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
- return manager.getDefaultFocusTraversalPolicy ();
- }
+ return manager.getDefaultFocusTraversalPolicy ();
+ }
}
else
return focusTraversalPolicy;
@@ -1692,7 +1692,7 @@ public class Container extends Component
* @param b <code>true</code> if this container provides a focus traversal
* policy, <code>false</code> when the root container's focus
* traversal policy should be used
- *
+ *
* @see #isFocusTraversalPolicyProvider()
*
* @since 1.5
@@ -1754,7 +1754,7 @@ public class Container extends Component
for (int i = 0; i < ncomponents; i++)
{
if (component[i] instanceof Container)
- ((Container) component[i]).applyComponentOrientation(orientation);
+ ((Container) component[i]).applyComponentOrientation(orientation);
else
component[i].setComponentOrientation(orientation);
}
@@ -1892,7 +1892,7 @@ public class Container extends Component
Component comp = component[i];
boolean applicable = comp.isVisible()
&& (comp.isLightweight() || ! lightweightOnly);
-
+
if (applicable)
visitChild(gfx, visitor, comp);
}
@@ -1916,7 +1916,7 @@ public class Container extends Component
Component comp)
{
Rectangle bounds = comp.getBounds();
-
+
if(!gfx.hitClip(bounds.x,bounds.y, bounds.width, bounds.height))
return;
Graphics g2 = gfx.create(bounds.x, bounds.y, bounds.width,
@@ -1939,7 +1939,7 @@ public class Container extends Component
*/
void dispatchEventImpl(AWTEvent e)
{
- LightweightDispatcher dispatcher = LightweightDispatcher.getInstance();
+ LightweightDispatcher dispatcher = LightweightDispatcher.getInstance();
if (! isLightweight() && dispatcher.dispatchEvent(e))
{
// Some lightweight descendent got this event dispatched. Consume
@@ -1980,11 +1980,11 @@ public class Container extends Component
*/
boolean eventTypeEnabled(int eventId)
{
- if(eventId <= ContainerEvent.CONTAINER_LAST
+ if(eventId <= ContainerEvent.CONTAINER_LAST
&& eventId >= ContainerEvent.CONTAINER_FIRST)
return containerListener != null
|| (eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0;
- else
+ else
return super.eventTypeEnabled(eventId);
}
@@ -2199,7 +2199,7 @@ public class Container extends Component
static class GfxPaintVisitor extends GfxVisitor
{
public static final GfxVisitor INSTANCE = new GfxPaintVisitor();
-
+
public void visit(Component c, Graphics gfx)
{
c.paint(gfx);
@@ -2209,7 +2209,7 @@ public class Container extends Component
static class GfxPrintVisitor extends GfxVisitor
{
public static final GfxVisitor INSTANCE = new GfxPrintVisitor();
-
+
public void visit(Component c, Graphics gfx)
{
c.print(gfx);
diff --git a/java/awt/ContainerOrderFocusTraversalPolicy.java b/java/awt/ContainerOrderFocusTraversalPolicy.java
index 14afd3648..3fa437db7 100644
--- a/java/awt/ContainerOrderFocusTraversalPolicy.java
+++ b/java/awt/ContainerOrderFocusTraversalPolicy.java
@@ -1,4 +1,4 @@
-/* ContainerOrderFocusTraversalPolicy.java --
+/* ContainerOrderFocusTraversalPolicy.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -108,21 +108,21 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
Container prevAncestor = ancestor;
while (ancestor != root)
{
- ancestor = current.getFocusCycleRootAncestor ();
- if (ancestor == prevAncestor)
- {
+ ancestor = current.getFocusCycleRootAncestor ();
+ if (ancestor == prevAncestor)
+ {
// We've reached the top focus cycle root ancestor. Check
// if it is root.
if (ancestor == null)
ancestor = root;
else if (ancestor != root)
- throw new IllegalArgumentException ("the given container is not"
- + " a focus cycle root of the"
- + " current component");
+ throw new IllegalArgumentException ("the given container is not"
+ + " a focus cycle root of the"
+ + " current component");
else
break;
- }
- prevAncestor = ancestor;
+ }
+ prevAncestor = ancestor;
}
// FIXME: is this the right thing to do here? It moves the context
@@ -151,7 +151,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
componentIndex = i;
}
- // Search forward for the next acceptable component.
+ // Search forward for the next acceptable component.
// Search through all components at least one time
// i.e. start at componentIndex + 1 --> nComponents -1 --> 0 ---> componentIndex
int i = componentIndex + 1;
@@ -159,24 +159,24 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
Component next = getNextAvailableComponent(components, i, end);
if (next != null)
return next;
-
+
// Now check remainder of components from 0 to componentIndex
i = 0;
end = componentIndex;
next = getNextAvailableComponent(components, i, end);
if (next != null)
- return next;
-
+ return next;
+
// No focusable components after current in its Container. So go
// to the next Component after current's Container (parent).
Component result = getComponentAfter (root, parent);
return result;
}
}
-
+
/**
* Gets the next available component in the array between the given range.
- *
+ *
* @param components - the array of components.
* @param start - where to start
* @param end - where to end
@@ -207,7 +207,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
/**
* Gets the previous available component in the array between the given range.
- *
+ *
* @param components - the array of components.
* @param start - where to start
* @param end - where to end
@@ -215,7 +215,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
*/
Component getPrevAvailableComponent(Component[] components, int start, int end)
{
- while (start >= end)
+ while (start >= end)
{
Component c = components[start];
if (c.visible && c.isDisplayable() && c.enabled && c.focusable)
@@ -238,7 +238,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
* Returns the Component that should receive the focus before
* <code>current</code>. <code>root</code> must be a focus cycle root of
* current.
- *
+ *
* @param root a focus cycle root of current
* @param current a (possibly indirect) child of root, or root itself
* @return the previous Component in the focus traversal order for root, or
@@ -260,21 +260,21 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
Container prevAncestor = ancestor;
while (ancestor != root)
{
- ancestor = current.getFocusCycleRootAncestor ();
- if (ancestor == prevAncestor)
- {
- // We've reached the top focus cycle root ancestor. Check
- // if it is root.
+ ancestor = current.getFocusCycleRootAncestor ();
+ if (ancestor == prevAncestor)
+ {
+ // We've reached the top focus cycle root ancestor. Check
+ // if it is root.
if (ancestor == null)
ancestor = root;
else if (ancestor != root)
- throw new IllegalArgumentException ("the given container is not"
- + " a focus cycle root of the"
- + " current component");
- else
- break;
- }
- prevAncestor = ancestor;
+ throw new IllegalArgumentException ("the given container is not"
+ + " a focus cycle root of the"
+ + " current component");
+ else
+ break;
+ }
+ prevAncestor = ancestor;
}
// FIXME: is this the right thing to do here? It moves the context
@@ -311,13 +311,13 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
Component prev = getPrevAvailableComponent(components, i, end);
if (prev != null)
return prev;
-
+
// Now check remainder of components
i = numComponents -1;
end = componentIndex;
prev = getPrevAvailableComponent(components, i, end);
if (prev != null)
- return prev;
+ return prev;
// No focusable components before current in its Container. So go
// to the previous Component before current's Container (parent).
@@ -369,7 +369,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
return first;
}
else if (accept(component))
- return component;
+ return component;
}
return null;
@@ -399,14 +399,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
return root;
Component[] componentArray = root.getComponents ();
-
+
for (int i = componentArray.length - 1; i >= 0; i--)
{
Component component = componentArray [i];
-
- if (component.visible && component.isDisplayable() && component.enabled
+
+ if (component.visible && component.isDisplayable() && component.enabled
&& component.focusable)
- return component;
+ return component;
if (component instanceof Container)
{
diff --git a/java/awt/Cursor.java b/java/awt/Cursor.java
index 4d339b721..69d0e87f5 100644
--- a/java/awt/Cursor.java
+++ b/java/awt/Cursor.java
@@ -125,7 +125,7 @@ public class Cursor implements java.io.Serializable
"North Resize Cursor", "South Resize Cursor",
"West Resize Cursor", "East Resize Cursor",
"Hand Cursor", "Move Cursor" };
-
+
public static final int CUSTOM_CURSOR = 0xFFFFFFFF;
private static final int PREDEFINED_COUNT = 14;
@@ -154,11 +154,11 @@ public class Cursor implements java.io.Serializable
this.type = type;
name = NAMES[type];
-
+
// FIXME: lookup?
}
- /** This constructor is used internally only.
+ /** This constructor is used internally only.
* Application code should call Toolkit.createCustomCursor().
*/
protected Cursor(String name)
@@ -233,7 +233,7 @@ public class Cursor implements java.io.Serializable
public String toString()
{
return (this.getClass()
- + "[type=" + getType()
- + ",name=" + getName() + "]");
+ + "[type=" + getType()
+ + ",name=" + getName() + "]");
}
}
diff --git a/java/awt/DefaultFocusTraversalPolicy.java b/java/awt/DefaultFocusTraversalPolicy.java
index a5cb7dad1..3f017c5a5 100644
--- a/java/awt/DefaultFocusTraversalPolicy.java
+++ b/java/awt/DefaultFocusTraversalPolicy.java
@@ -1,4 +1,4 @@
-/* DefaultFocusTraversalPolicy.java --
+/* DefaultFocusTraversalPolicy.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -90,14 +90,14 @@ public class DefaultFocusTraversalPolicy
protected boolean accept (Component comp)
{
if (comp.visible
- && comp.isDisplayable ()
- && comp.enabled)
+ && comp.isDisplayable ()
+ && comp.enabled)
{
- if (comp.isFocusTraversableOverridden != 0
- && (comp.isFocusTraversable () || comp.isFocusable()))
+ if (comp.isFocusTraversableOverridden != 0
+ && (comp.isFocusTraversable () || comp.isFocusable()))
return true;
-
- if (!(comp instanceof Canvas
+
+ if (!(comp instanceof Canvas
|| comp instanceof Panel
|| comp instanceof Label
|| comp instanceof ScrollPane
diff --git a/java/awt/DefaultKeyboardFocusManager.java b/java/awt/DefaultKeyboardFocusManager.java
index 325e3ac8d..f62e6e53e 100644
--- a/java/awt/DefaultKeyboardFocusManager.java
+++ b/java/awt/DefaultKeyboardFocusManager.java
@@ -1,4 +1,4 @@
-/* DefaultKeyboardFocusManager.java --
+/* DefaultKeyboardFocusManager.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -146,7 +146,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
*/
private AWTKeyStroke waitForKeyStroke = null;
- /** The {@link java.util.SortedSet} of current
+ /** The {@link java.util.SortedSet} of current
* {@link EventDelayRequest}s. */
private SortedSet delayRequests = new TreeSet ();
@@ -339,9 +339,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
Component focusOwner = getFocusOwner();
if (focusOwner == null)
focusOwner = getFocusedWindow();
-
+
if (focusOwner != null)
- redispatchEvent(focusOwner, e);
+ redispatchEvent(focusOwner, e);
// Loop through all registered KeyEventPostProcessors, giving
// each a chance to process this event.
@@ -358,7 +358,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
// MenuShortcut.
if (postProcessKeyEvent (e))
return true;
-
+
// Always return true.
return true;
}
@@ -469,26 +469,26 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
if (forwardKeystrokes.contains (eventKeystroke))
{
- waitForKeyStroke = oppositeKeystroke;
+ waitForKeyStroke = oppositeKeystroke;
focusNextComponent (comp);
e.consume ();
}
else if (backwardKeystrokes.contains (eventKeystroke))
{
- waitForKeyStroke = oppositeKeystroke;
+ waitForKeyStroke = oppositeKeystroke;
focusPreviousComponent (comp);
e.consume ();
}
else if (upKeystrokes.contains (eventKeystroke))
{
- waitForKeyStroke = oppositeKeystroke;
+ waitForKeyStroke = oppositeKeystroke;
upFocusCycle (comp);
e.consume ();
}
else if (comp instanceof Container
&& downKeystrokes.contains (eventKeystroke))
{
- waitForKeyStroke = oppositeKeystroke;
+ waitForKeyStroke = oppositeKeystroke;
downFocusCycle ((Container) comp);
e.consume ();
}
diff --git a/java/awt/Desktop.java b/java/awt/Desktop.java
index 227b8b192..1b4078823 100644
--- a/java/awt/Desktop.java
+++ b/java/awt/Desktop.java
@@ -53,11 +53,11 @@ import java.net.URI;
* specified file type. For example, opening an odf file results in launching
* OpenOffice. If an operation is not supported, or the application fails to
* launch, an exception is generated.
- *
+ *
* <strong>Implementation note: </strong>As this class is used to manage Desktop
* integration, we provide some extension to configure the behaviour of this
* class depending on the type of dektop that is detected.<br />
- *
+ *
* First of all, we support 5 system properties that can be used to define
* the application to launch in any given case. These properties are:<br />
* <br />
@@ -91,8 +91,8 @@ import java.net.URI;
* <br /><br />
* <code>
* gconftool-2 -g /apps/classpath/gnu/java/awt/peer/Desktop/html/command
- * </code>
- *
+ * </code>
+ *
* @author Mario Torre <neugens@limasoftware.net>
* @since 1.6
*/
@@ -100,11 +100,11 @@ public class Desktop
{
/**
* Represents an action type supported by a platform.
- *
+ *
* To determine if a given action is supported by the platform,
* use the <code>Desktop.isSupported(java.awt.Desktop.Action)</code>
* method.
- *
+ *
* @author Mario Torre <neugens@limasoftware.net>
*/
public enum Action
@@ -118,15 +118,15 @@ public class Desktop
{
/* nothing to be done */
}
-
+
/**
* Returns an instance of the Desktop Class.
- *
- * If this implementation does not support Desktop, an
+ *
+ * If this implementation does not support Desktop, an
* UnsupportedOperationException will be thrown.
* Also, an HeadlessException will be generated if
* GraphicsEnvironment.isHeadless() returns true.
- *
+ *
* @throws UnsupportedOperationException
* @throws HeadlessException
*/
@@ -135,23 +135,23 @@ public class Desktop
{
if (GraphicsEnvironment.isHeadless())
throw new HeadlessException();
-
+
if (!Desktop.isDesktopSupported())
throw new UnsupportedOperationException();
-
+
Desktop desktop = new Desktop();
desktop.peer = Toolkit.getDefaultToolkit().createDesktopPeer(desktop);
-
+
return desktop;
}
/**
* Check if this implementation supports Desktop.
* If true, use getDesktop to get an instance of this class.
- *
+ *
* This implementation will return false when GraphicsEnvironment.isHeadless
* returns true.
- *
+ *
* @return true if this class is supported on the current platform;
* false otherwise
*/
@@ -159,13 +159,13 @@ public class Desktop
{
if (GraphicsEnvironment.isHeadless())
return false;
-
+
return true;
}
-
+
/**
* Check if the given Action is supported by this implementation.
- *
+ *
* @param action
* @return
*/
@@ -173,14 +173,14 @@ public class Desktop
{
return peer.isSupported(action);
}
-
+
/**
* Launches the Desktop default browser to open the given <code>uri</code>.
- *
+ *
* If a security manager exists and denies
* AWTPermission("showWindowWithoutWarningBanner"),a SecurityException will
* be generated.
- *
+ *
* @param uri
* @throws IOException
*/
@@ -189,16 +189,16 @@ public class Desktop
{
peer.browse(uri);
}
-
+
/**
* Launch the edit command to edit this file.
- * File should already exist before the editing starts.
- *
+ * File should already exist before the editing starts.
+ *
* If a security manager exists and
* SecurityManager.checkRead(java.lang.String) method denies read access to
* the file, or SecurityManager.checkPrintJobAccess() method denies the
* permission to print the file, a SecurityException will be generated.
- *
+ *
* @param file
* @throws IOException
*/
@@ -207,10 +207,10 @@ public class Desktop
{
peer.edit(file);
}
-
+
/**
* Launches the Desktop default mailer.
- *
+ *
* If a security manager exists and denies
* AWTPermission("showWindowWithoutWarningBanner"), a SecurityException will
* be generated.
@@ -222,16 +222,16 @@ public class Desktop
{
peer.mail();
}
-
+
/**
* Launches the Desktop default mailer, with the given mailtoURI
* as agrument. The <code>mailtoURI</code> must conform to the
- * {@link http://www.ietf.org/rfc/rfc2368.txt The mailto URL scheme (RFC 2368)}
- *
+ * {@link http://www.ietf.org/rfc/rfc2368.txt The mailto URL scheme (RFC 2368)}
+ *
* If a security manager exists and denies
* AWTPermission("showWindowWithoutWarningBanner"), a SecurityException will
* be generated.
- *
+ *
* @param mailtoURI
* @throws IOException
*/
@@ -240,11 +240,11 @@ public class Desktop
{
peer.mail(mailtoURI);
}
-
+
/**
* Launches the Desktop default application to open the given File.
* If <code>file</code> is a directory, a file manager is launched.
- *
+ *
* @param file
* @throws IOException
*/
@@ -256,7 +256,7 @@ public class Desktop
/**
* Launch the print program to print this file.
- *
+ *
* @param file
* @throws IOException
*/
diff --git a/java/awt/Dialog.java b/java/awt/Dialog.java
index 83fb52d89..d12e1eb12 100644
--- a/java/awt/Dialog.java
+++ b/java/awt/Dialog.java
@@ -1,5 +1,5 @@
/* Dialog.java -- An AWT dialog box
- Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006
+ Copyright (C) 1999, 2000, 2001, 2002, 2005, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,15 +47,15 @@ import javax.accessibility.AccessibleState;
import javax.accessibility.AccessibleStateSet;
/**
- * <code>Dialog</code> provides a top-level window normally used to receive
+ * <code>Dialog</code> provides a top-level window normally used to receive
* user input in applications.
* <p>
* A dialog always has another top-level window as owner and is only visible
- * if this owner is visible to the user. The default layout of dialogs is the
+ * if this owner is visible to the user. The default layout of dialogs is the
* <code>BorderLayout</code>. Dialogs can be modal (blocks user input to other
* components) or non-modal (user input in other components are allowed).
- * </p>
- *
+ * </p>
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@redhat.com)
*/
@@ -106,7 +106,7 @@ public class Dialog extends Window
private boolean blocked = false;
/**
- * Secondary EventQueue to handle AWT events while we are blocked for
+ * Secondary EventQueue to handle AWT events while we are blocked for
* modality in show.
*/
private EventQueue eq2 = null;
@@ -119,10 +119,10 @@ public class Dialog extends Window
/**
* Initializes a new instance of <code>Dialog</code> with the specified
* parent, that is resizable and not modal, and which has no title.
- *
+ *
* @param parent The parent frame of this dialog box.
- * @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is
+ * @exception IllegalArgumentException If the owner's GraphicsConfiguration
+ * is not from a screen device, or if owner is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
*/
public Dialog(Frame parent)
@@ -133,13 +133,13 @@ public class Dialog extends Window
/**
* Initializes a new instance of <code>Dialog</code> with the specified
* parent and modality, that is resizable and which has no title.
- *
+ *
* @param parent The parent frame of this dialog box.
* @param modal <code>true</code> if this dialog box is modal,
* <code>false</code> otherwise.
- *
+ *
* @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exception is
+ * is not from a screen device, or if owner is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
*/
public Dialog(Frame parent, boolean modal)
@@ -149,14 +149,14 @@ public class Dialog extends Window
/**
* Initializes a new instance of <code>Dialog</code> with the specified
- * parent, that is resizable and not modal, and which has the specified
+ * parent, that is resizable and not modal, and which has the specified
* title.
- *
+ *
* @param parent The parent frame of this dialog box.
* @param title The title string for this dialog box.
- *
+ *
* @exception IllegalArgumentException If the owner's GraphicsConfiguration
- * is not from a screen device, or if owner is null. This exceptionnis
+ * is not from a screen device, or if owner is null. This exceptionnis
* always thrown when GraphicsEnvironment.isHeadless() returns true.
*/
public Dialog(Frame parent, String title)
@@ -167,12 +167,12 @@ public class Dialog extends Window
/**
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent, title, and modality, that is resizable.
- *
+ *
* @param parent The parent frame of this dialog box.
* @param title The title string for this dialog box.
* @param modal <code>true</code> if this dialog box is modal,
* <code>false</code> otherwise.
- *
+ *
* @exception IllegalArgumentException If owner is null or
* GraphicsEnvironment.isHeadless() returns true.
*/
@@ -185,15 +185,15 @@ public class Dialog extends Window
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent, title, modality and <code>GraphicsConfiguration</code>, that is
* resizable.
- *
+ *
* @param parent The parent frame of this dialog box.
* @param title The title string for this dialog box.
* @param modal <code>true</code> if this dialog box is modal,
* <code>false</code> otherwise.
- * @param gc The <code>GraphicsConfiguration</code> object to use. If
- * <code>null</code> the <code>GraphicsConfiguration</code> of the target
+ * @param gc The <code>GraphicsConfiguration</code> object to use. If
+ * <code>null</code> the <code>GraphicsConfiguration</code> of the target
* frame is used.
- *
+ *
* @exception IllegalArgumentException If owner is null, the
* GraphicsConfiguration is not a screen device or
* GraphicsEnvironment.isHeadless() returns true.
@@ -216,12 +216,12 @@ public class Dialog extends Window
/**
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent, that is resizable.
- *
+ *
* @param owner The parent frame of this dialog box.
- *
+ *
* @exception IllegalArgumentException If parent is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
- *
+ *
* @since 1.2
*/
public Dialog(Dialog owner)
@@ -232,10 +232,10 @@ public class Dialog extends Window
/**
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent and title, that is resizable.
- *
+ *
* @param owner The parent frame of this dialog box.
* @param title The title string for this dialog box.
- *
+ *
* @exception IllegalArgumentException If parent is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns
* true.
@@ -249,12 +249,12 @@ public class Dialog extends Window
/**
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent, title and modality, that is resizable.
- *
+ *
* @param owner The parent frame of this dialog box.
* @param title The title string for this dialog box.
* @param modal <code>true</code> if this dialog box is modal,
* <code>false</code> otherwise.
- *
+ *
* @exception IllegalArgumentException If parent is null. This exception is
* always thrown when GraphicsEnvironment.isHeadless() returns true.
* @since 1.2
@@ -268,19 +268,19 @@ public class Dialog extends Window
* Initializes a new instance of <code>Dialog</code> with the specified,
* parent, title, modality and <code>GraphicsConfiguration</code>, that is
* resizable.
- *
+ *
* @param parent The parent frame of this dialog box.
* @param title The title string for this dialog box.
* @param modal <code>true</code> if this dialog box is modal,
* <code>false</code> otherwise.
- * @param gc The <code>GraphicsConfiguration</code> object to use. If
- * <code>null</code> the <code>GraphicsConfiguration</code> of the target
+ * @param gc The <code>GraphicsConfiguration</code> object to use. If
+ * <code>null</code> the <code>GraphicsConfiguration</code> of the target
* frame is used.
- *
+ *
* @exception IllegalArgumentException If parent is null, the
- * GraphicsConfiguration is not a screen device or
+ * GraphicsConfiguration is not a screen device or
* GraphicsEnvironment.isHeadless() returns true.
- *
+ *
* @since 1.4
*/
public Dialog(Dialog parent, String title, boolean modal,
@@ -299,7 +299,7 @@ public class Dialog extends Window
/**
* Returns the title of this dialog box.
- *
+ *
* @return The title of this dialog box.
*/
public String getTitle()
@@ -309,7 +309,7 @@ public class Dialog extends Window
/**
* Sets the title of this dialog box to the specified string.
- *
+ *
* @param title the new title. If <code>null</code> an empty
* title will be set.
*/
@@ -327,7 +327,7 @@ public class Dialog extends Window
/**
* Tests whether or not this dialog box is modal.
- *
+ *
* @return <code>true</code> if this dialog box is modal, <code>false</code>
* otherwise.
*/
@@ -339,9 +339,9 @@ public class Dialog extends Window
/**
* Changes the modality of this dialog box. This can only be done before the
* peer is created.
- *
+ *
* @param modal <code>true</code> to make this dialog box modal,
- * <code>false</code> to make it non-modal.
+ * <code>false</code> to make it non-modal.
*/
public void setModal(boolean modal)
{
@@ -350,7 +350,7 @@ public class Dialog extends Window
/**
* Tests whether or not this dialog box is resizable.
- *
+ *
* @return <code>true</code> if this dialog is resizable,
* <code>false</code> otherwise.
*/
@@ -361,7 +361,7 @@ public class Dialog extends Window
/**
* Changes the resizability of this dialog box.
- *
+ *
* @param resizable <code>true</code> to make this dialog resizable,
* <code>false</code> to make it non-resizable.
*/
@@ -391,7 +391,7 @@ public class Dialog extends Window
* dialog is hidden by someone calling hide or dispose. If this is the event
* dispatching thread we must ensure that another event thread runs while the
* one which invoked this method is blocked.
- *
+ *
* @deprecated Use {@link Component#setVisible(boolean)} instead.
*/
public synchronized void show()
@@ -438,7 +438,7 @@ public class Dialog extends Window
/**
* Hides the Dialog and then causes show() to return if it is currently
* blocked.
- *
+ *
* @deprecated Use {@link Component#setVisible(boolean)} instead.
*/
public synchronized void hide()
@@ -467,7 +467,7 @@ public class Dialog extends Window
/**
* Returns a debugging string for this component.
- *
+ *
* @return A debugging string for this component.
*/
protected String paramString()
@@ -478,10 +478,10 @@ public class Dialog extends Window
/**
* Returns whether this frame is undecorated or not.
- *
+ *
* @return <code>true</code> if this dialog is undecorated,
* <code>false</code> otherwise.
- *
+ *
* @since 1.4
*/
public boolean isUndecorated()
@@ -492,10 +492,10 @@ public class Dialog extends Window
/**
* Disables or enables decorations for this frame. This method can only be
* called while the frame is not displayable.
- *
+ *
* @param undecorated <code>true</code> to disable dialog decorations,
* <code>false</code> otherwise.
- *
+ *
* @exception IllegalComponentStateException If this frame is displayable.
* @since 1.4
*/
@@ -517,7 +517,7 @@ public class Dialog extends Window
/**
* Gets the role of this object.
- * @return AccessibleRole.DIALOG
+ * @return AccessibleRole.DIALOG
*/
public AccessibleRole getAccessibleRole()
{
@@ -542,7 +542,7 @@ public class Dialog extends Window
/**
* Gets the AccessibleContext associated with this <code>Dialog</code>. The
* context is created, if necessary.
- *
+ *
* @return the associated context
*/
public AccessibleContext getAccessibleContext()
@@ -552,7 +552,7 @@ public class Dialog extends Window
accessibleContext = new AccessibleAWTDialog();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>Dialog</code>.
*
diff --git a/java/awt/DisplayMode.java b/java/awt/DisplayMode.java
index d41d4a87f..be2a1d118 100644
--- a/java/awt/DisplayMode.java
+++ b/java/awt/DisplayMode.java
@@ -147,9 +147,9 @@ public final class DisplayMode
public boolean equals (DisplayMode dm)
{
return (width == dm.width
- && height == dm.height
- && bitDepth == dm.bitDepth
- && refreshRate == dm.refreshRate);
+ && height == dm.height
+ && bitDepth == dm.bitDepth
+ && refreshRate == dm.refreshRate);
}
/**
diff --git a/java/awt/Event.java b/java/awt/Event.java
index 648139cc8..f2c98b9b0 100644
--- a/java/awt/Event.java
+++ b/java/awt/Event.java
@@ -115,10 +115,10 @@ public class Event implements java.io.Serializable
public Object arg;
public int clickCount;
- boolean consumed; // Required by serialization spec.
+ boolean consumed; // Required by serialization spec.
public Event evt;
public int id;
- public int key;
+ public int key;
public int modifiers;
public Object target;
public long when;
@@ -131,9 +131,9 @@ public class Event implements java.io.Serializable
this.target = target;
this.arg = arg;
}
-
- public Event (Object target, long when, int id, int x, int y, int key,
- int modifiers)
+
+ public Event (Object target, long when, int id, int x, int y, int key,
+ int modifiers)
{
this.target = target;
this.when = when;
@@ -144,8 +144,8 @@ public class Event implements java.io.Serializable
this.modifiers = modifiers;
}
- public Event (Object target, long when, int id, int x, int y, int key,
- int modifiers, Object arg)
+ public Event (Object target, long when, int id, int x, int y, int key,
+ int modifiers, Object arg)
{
this (target, when, id, x, y, key, modifiers);
this.arg = arg;
@@ -167,7 +167,7 @@ public class Event implements java.io.Serializable
+ ",target=" + target + ",arg=" + arg;
}
- public boolean shiftDown()
+ public boolean shiftDown()
{
return ((modifiers & SHIFT_MASK) == 0 ? false : true);
}
diff --git a/java/awt/EventDispatchThread.java b/java/awt/EventDispatchThread.java
index 9f81a7944..c2147f4c0 100644
--- a/java/awt/EventDispatchThread.java
+++ b/java/awt/EventDispatchThread.java
@@ -65,8 +65,8 @@ class EventDispatchThread extends Thread
System.getProperty("gnu.awt.dispatchthread.priority");
if (priorityString != null)
{
- priority = Integer.parseInt(priorityString);
- }
+ priority = Integer.parseInt(priorityString);
+ }
}
catch (NumberFormatException ex)
{
@@ -83,25 +83,25 @@ class EventDispatchThread extends Thread
while (true)
{
try
- {
- AWTEvent evt = queue.getNextEvent();
+ {
+ AWTEvent evt = queue.getNextEvent();
queue.dispatchEvent(evt);
- }
+ }
catch (ThreadDeath death)
{
// If someone wants to kill us, let them.
return;
}
- catch (InterruptedException ie)
- {
- // We are interrupted when we should finish executing
- return;
- }
- catch (Throwable x)
- {
- System.err.println("Exception during event dispatch:");
- x.printStackTrace(System.err);
- }
+ catch (InterruptedException ie)
+ {
+ // We are interrupted when we should finish executing
+ return;
+ }
+ catch (Throwable x)
+ {
+ System.err.println("Exception during event dispatch:");
+ x.printStackTrace(System.err);
+ }
}
}
}
diff --git a/java/awt/EventQueue.java b/java/awt/EventQueue.java
index eb17449a0..cb52ae013 100644
--- a/java/awt/EventQueue.java
+++ b/java/awt/EventQueue.java
@@ -51,8 +51,8 @@ import java.awt.peer.LightweightPeer;
import java.lang.reflect.InvocationTargetException;
import java.util.EmptyStackException;
-/* Written using on-line Java 2 Platform Standard Edition v1.3 API
- * Specification, as well as "The Java Class Libraries", 2nd edition
+/* Written using on-line Java 2 Platform Standard Edition v1.3 API
+ * Specification, as well as "The Java Class Libraries", 2nd edition
* (Addison-Wesley, 1998).
* Status: Believed complete, but untested.
*/
@@ -225,9 +225,9 @@ public class EventQueue
* is interrupted.
*
* @return The next event in the queue.
- * @specnote Does not block. Returns null if there are no events on the
- * queue.
- */
+ * @specnote Does not block. Returns null if there are no events on the
+ * queue.
+ */
public synchronized AWTEvent peekEvent()
{
if (next != null)
@@ -246,9 +246,9 @@ public class EventQueue
*
* @return The next event in the queue.
*
- * @specnote Does not block. Returns null if there are no matching events
- * on the queue.
- */
+ * @specnote Does not block. Returns null if there are no matching events
+ * on the queue.
+ */
public synchronized AWTEvent peekEvent(int id)
{
if (next != null)
@@ -306,7 +306,7 @@ public class EventQueue
* Actually performs the event posting. This is needed because the
* RI doesn't use the public postEvent() method when transferring events
* between event queues in push() and pop().
- *
+ *
* @param evt the event to post
* @param priority the priority of the event
*/
@@ -342,7 +342,7 @@ public class EventQueue
Object src = qevt.getSource();
if (qevt.id == evt.id && src == comp)
{
- // If there are, call coalesceEvents on the source component
+ // If there are, call coalesceEvents on the source component
// to see if they can be combined.
Component srccmp = (Component) src;
AWTEvent coalescedEvt = srccmp.coalesceEvents(qevt, evt);
@@ -414,7 +414,7 @@ public class EventQueue
if (isDispatchThread ())
throw new Error("Can't call invokeAndWait from event dispatch thread");
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
Object notifyObject = new Object();
InvocationEvent ie =
@@ -441,9 +441,9 @@ public class EventQueue
*/
public static void invokeLater(Runnable runnable)
{
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
- InvocationEvent ie =
+ InvocationEvent ie =
new InvocationEvent(eq, runnable, null, false);
eq.postEvent(ie);
@@ -456,8 +456,8 @@ public class EventQueue
public static boolean isDispatchThread()
{
EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
-
- /* Find last EventQueue in chain */
+
+ /* Find last EventQueue in chain */
while (eq.next != null)
eq = eq.next;
@@ -473,11 +473,11 @@ public class EventQueue
*/
public static AWTEvent getCurrentEvent()
{
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
Thread ct = Thread.currentThread();
-
+
/* Find out if this thread is the dispatch thread for any of the
- EventQueues in the chain */
+ EventQueues in the chain */
while (ct != eq.dispatchThread)
{
// Try next EventQueue, if any
@@ -490,7 +490,7 @@ public class EventQueue
}
/**
- * Allows a custom EventQueue implementation to replace this one.
+ * Allows a custom EventQueue implementation to replace this one.
* All pending events are transferred to the new queue. Calls to postEvent,
* getNextEvent, and peekEvent and others are forwarded to the pushed queue
* until it is removed with a pop().
@@ -650,7 +650,7 @@ public class EventQueue
*/
public static long getMostRecentEventTime()
{
- EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
+ EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
if (Thread.currentThread() != eq.dispatchThread)
return System.currentTimeMillis();
return eq.lastWhen;
diff --git a/java/awt/FileDialog.java b/java/awt/FileDialog.java
index 21117700d..c1bd08264 100644
--- a/java/awt/FileDialog.java
+++ b/java/awt/FileDialog.java
@@ -90,7 +90,7 @@ private String file;
private FilenameFilter filter;
/**
- * @serial The mode of this dialog, either <code>LOAD</code> or
+ * @serial The mode of this dialog, either <code>LOAD</code> or
* <code>SAVE</code>.
*/
private int mode;
@@ -109,41 +109,41 @@ private static transient long next_file_dialog_number;
/**
* Initializes a new instance of <code>FileDialog</code> with the specified
* parent. This dialog will have no title and will be for loading a file.
- *
+ *
* @param parent The parent dialog for this.
- *
+ *
* @since 1.5
*/
public FileDialog(Dialog parent)
{
this(parent, "", LOAD);
}
-
+
/**
* Initialized a new instance of <code>FileDialog</code> with the
* specified parent and title. This dialog will be for opening a file.
*
* @param parent The parent dialog for this.
* @param title The title for this dialog.
- *
+ *
* @since 1.5
*/
public FileDialog(Dialog parent, String title)
{
this(parent, title, LOAD);
}
-
+
/**
* Initialized a new instance of <code>FileDialog</code> with the specified
* parent, title, and mode.
- *
+ *
* @param parent The parent dialog for this.
* @param title The title for this dialog.
* @param mode The mode of the dialog, either <code>LOAD</code> or
* <code>SAVE</code>.
* @throws IllegalArgumentException - if illegal mode, if
* GraphicsEnvironment.isHeadless or if parent is null.
- *
+ *
* @since 1.5
*/
public FileDialog(Dialog parent, String title, int mode)
@@ -154,12 +154,12 @@ private static transient long next_file_dialog_number;
if (mode != LOAD && mode != SAVE)
throw new IllegalArgumentException (
"Mode argument must be either LOAD or SAVE");
-
+
setMode(mode);
}
/**
- * Initializes a new instance of <code>FileDialog</code> with the
+ * Initializes a new instance of <code>FileDialog</code> with the
* specified parent. This dialog will have no title and will be for
* loading a file.
*
@@ -204,7 +204,7 @@ public
FileDialog(Frame parent, String title, int mode)
{
super(parent, title, true);
-
+
if ((mode != LOAD) && (mode != SAVE))
throw new IllegalArgumentException (
"Mode argument must be either LOAD or SAVE");
@@ -309,7 +309,7 @@ setFile(String file)
this.file = null;
else
this.file = file;
-
+
if (peer != null)
{
FileDialogPeer f = (FileDialogPeer) peer;
@@ -372,7 +372,7 @@ protected String
paramString()
{
return ("dir=" + dir + ",file=" + file +
- ",mode=" + mode + "," + super.paramString());
+ ",mode=" + mode + "," + super.paramString());
}
/**
@@ -380,17 +380,16 @@ paramString()
*
* @return A unique name for this <code>FileDialog</code>.
*/
-String
+String
generateName()
{
return "filedlg" + getUniqueLong();
}
-private static synchronized long
+private static synchronized long
getUniqueLong()
{
return next_file_dialog_number++;
}
-} // class FileDialog
-
+} // class FileDialog
diff --git a/java/awt/FlowLayout.java b/java/awt/FlowLayout.java
index 70c98a29a..231d041b1 100644
--- a/java/awt/FlowLayout.java
+++ b/java/awt/FlowLayout.java
@@ -73,7 +73,7 @@ public class FlowLayout implements LayoutManager, Serializable
* does nothing.
*
* @param name the name
- * @param comp the component
+ * @param comp the component
*/
public void addLayoutComponent (String name, Component comp)
{
@@ -155,78 +155,78 @@ public class FlowLayout implements LayoutManager, Serializable
{
synchronized (parent.getTreeLock ())
{
- int num = parent.getComponentCount ();
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- Dimension d = parent.getSize ();
- Insets ins = parent.getInsets ();
-
- ComponentOrientation orient = parent.getComponentOrientation ();
- boolean left_to_right = orient.isLeftToRight ();
-
- int y = ins.top + vgap;
- int i = 0;
- while (i < num)
- {
- // Find the components which go in the current row.
- int new_w = ins.left + hgap + ins.right;
- int new_h = 0;
- int j;
- boolean found_one = false;
- for (j = i; j < num; ++j)
- {
- // Skip invisible items.
- if (! comps[j].visible)
- continue;
-
- Dimension c = comps[j].getPreferredSize ();
-
- int next_w = new_w + hgap + c.width;
- if (next_w <= d.width || ! found_one)
- {
- new_w = next_w;
- new_h = Math.max (new_h, c.height);
- found_one = true;
- }
- else
- {
- // Must start a new row, and we already found an item
- break;
- }
- }
-
- // Set the location of each component for this row.
- int x;
-
- int myalign = align;
- if (align == LEADING)
- myalign = left_to_right ? LEFT : RIGHT;
- else if (align == TRAILING)
- myalign = left_to_right ? RIGHT : LEFT;
-
- if (myalign == RIGHT)
- x = ins.left + (d.width - new_w) + hgap;
- else if (myalign == CENTER)
- x = ins.left + (d.width - new_w) / 2 + hgap;
- else // LEFT and all other values of align.
- x = ins.left + hgap;
-
- for (int k = i; k < j; ++k)
- {
- if (comps[k].visible)
- {
- Dimension c = comps[k].getPreferredSize ();
- comps[k].setBounds (x, y + (new_h - c.height) / 2,
- c.width, c.height);
- x += c.width + hgap;
- }
- }
-
- // Advance to next row.
- i = j;
- y += new_h + vgap;
- }
+ int num = parent.getComponentCount ();
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+
+ Dimension d = parent.getSize ();
+ Insets ins = parent.getInsets ();
+
+ ComponentOrientation orient = parent.getComponentOrientation ();
+ boolean left_to_right = orient.isLeftToRight ();
+
+ int y = ins.top + vgap;
+ int i = 0;
+ while (i < num)
+ {
+ // Find the components which go in the current row.
+ int new_w = ins.left + hgap + ins.right;
+ int new_h = 0;
+ int j;
+ boolean found_one = false;
+ for (j = i; j < num; ++j)
+ {
+ // Skip invisible items.
+ if (! comps[j].visible)
+ continue;
+
+ Dimension c = comps[j].getPreferredSize ();
+
+ int next_w = new_w + hgap + c.width;
+ if (next_w <= d.width || ! found_one)
+ {
+ new_w = next_w;
+ new_h = Math.max (new_h, c.height);
+ found_one = true;
+ }
+ else
+ {
+ // Must start a new row, and we already found an item
+ break;
+ }
+ }
+
+ // Set the location of each component for this row.
+ int x;
+
+ int myalign = align;
+ if (align == LEADING)
+ myalign = left_to_right ? LEFT : RIGHT;
+ else if (align == TRAILING)
+ myalign = left_to_right ? RIGHT : LEFT;
+
+ if (myalign == RIGHT)
+ x = ins.left + (d.width - new_w) + hgap;
+ else if (myalign == CENTER)
+ x = ins.left + (d.width - new_w) / 2 + hgap;
+ else // LEFT and all other values of align.
+ x = ins.left + hgap;
+
+ for (int k = i; k < j; ++k)
+ {
+ if (comps[k].visible)
+ {
+ Dimension c = comps[k].getPreferredSize ();
+ comps[k].setBounds (x, y + (new_h - c.height) / 2,
+ c.width, c.height);
+ x += c.width + hgap;
+ }
+ }
+
+ // Advance to next row.
+ i = j;
+ y += new_h + vgap;
+ }
}
}
@@ -278,7 +278,7 @@ public class FlowLayout implements LayoutManager, Serializable
/**
* Sets the horizontal gap between lines of components to the specified value.
* No Exception is thrown if hgap < 0.
- *
+ *
* @param hgap The new horizontal gap between components.
*/
public void setHgap (int hgap)
@@ -303,7 +303,7 @@ public class FlowLayout implements LayoutManager, Serializable
public String toString ()
{
return ("[" + getClass ().getName () + ",hgap=" + hgap + ",vgap=" + vgap
- + ",align=" + align + "]");
+ + ",align=" + align + "]");
}
// This method is used to compute the various sizes.
@@ -311,39 +311,39 @@ public class FlowLayout implements LayoutManager, Serializable
{
synchronized (parent.getTreeLock ())
{
- int w, h, num = parent.getComponentCount ();
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
+ int w, h, num = parent.getComponentCount ();
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
- w = 0;
- h = 0;
- for (int i = 0; i < num; ++i)
- {
- if (! comps[i].visible)
- continue;
+ w = 0;
+ h = 0;
+ for (int i = 0; i < num; ++i)
+ {
+ if (! comps[i].visible)
+ continue;
- // FIXME: can we just directly read the fields in Component?
- // Or will that not work with subclassing?
- Dimension d;
+ // FIXME: can we just directly read the fields in Component?
+ // Or will that not work with subclassing?
+ Dimension d;
- if (is_min)
- d = comps[i].getMinimumSize ();
- else
- d = comps[i].getPreferredSize ();
+ if (is_min)
+ d = comps[i].getMinimumSize ();
+ else
+ d = comps[i].getPreferredSize ();
- w += d.width;
- h = Math.max (d.height, h);
- }
+ w += d.width;
+ h = Math.max (d.height, h);
+ }
- Insets ins = parent.getInsets ();
+ Insets ins = parent.getInsets ();
if (num == 0)
w += 2 * hgap + ins.left + ins.right;
else
w += (num + 1) * hgap + ins.left + ins.right;
- h += 2 * vgap + ins.top + ins.bottom;
+ h += 2 * vgap + ins.top + ins.bottom;
- return new Dimension (w, h);
+ return new Dimension (w, h);
}
}
diff --git a/java/awt/FocusTraversalPolicy.java b/java/awt/FocusTraversalPolicy.java
index a7f1558dd..d9374eae8 100644
--- a/java/awt/FocusTraversalPolicy.java
+++ b/java/awt/FocusTraversalPolicy.java
@@ -1,4 +1,4 @@
-/* FocusTraversalPolicy.java --
+/* FocusTraversalPolicy.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/Font.java b/java/awt/Font.java
index 4e6e6bd34..89ff1f52a 100644
--- a/java/awt/Font.java
+++ b/java/awt/Font.java
@@ -101,7 +101,7 @@ public class Font implements Serializable
/**
* Constant indicating the baseline mode characteristic of Devanigri.
*/
- public static final int HANGING_BASELINE = 2;
+ public static final int HANGING_BASELINE = 2;
/**
@@ -117,11 +117,11 @@ public class Font implements Serializable
* @since 1.3
*/
public static final int TRUETYPE_FONT = 0;
-
+
/**
* Indicates to <code>createFont</code> that the supplied font data
* is in Type1 format.
- *
+ *
* @since 1.5
*/
public static final int TYPE1_FONT = 1;
@@ -249,15 +249,15 @@ public class Font implements Serializable
* The style should be one of BOLD, ITALIC, or BOLDITALIC. The default
* style if none is specified is PLAIN. The default size if none
* is specified is 12.
- *
- * @param fontspec a string specifying the required font (<code>null</code>
+ *
+ * @param fontspec a string specifying the required font (<code>null</code>
* permitted, interpreted as 'Dialog-PLAIN-12').
- *
+ *
* @return A font.
*/
public static Font decode(String fontspec)
{
- if (fontspec == null)
+ if (fontspec == null)
fontspec = "Dialog-PLAIN-12";
String name = null;
int style = PLAIN;
@@ -336,7 +336,7 @@ public class Font implements Serializable
* @param propname The name of the system property.
* @param defval Value to use if the property is not found.
*
- * @return The requested font, or <code>default</code> if the property
+ * @return The requested font, or <code>default</code> if the property
* not exist or is malformed.
*/
public static Font getFont(String propname, Font defval)
@@ -352,7 +352,7 @@ public class Font implements Serializable
*
* @param propname The name of the system property.
*
- * @return The requested font, or <code>null</code> if the property
+ * @return The requested font, or <code>null</code> if the property
* not exist or is malformed.
*/
public static Font getFont(String propname)
@@ -430,7 +430,7 @@ public class Font implements Serializable
/**
* Returns the size of the font, in typographics points (1/72 of an inch),
* rounded to an integer.
- *
+ *
* @return The font size
*/
public int getSize()
@@ -440,7 +440,7 @@ public class Font implements Serializable
/**
* Returns the size of the font, in typographics points (1/72 of an inch).
- *
+ *
* @return The font size
*/
public float getSize2D()
@@ -457,7 +457,7 @@ public class Font implements Serializable
*/
public boolean isPlain()
{
- return peer.isPlain(this);
+ return peer.isPlain(this);
}
/**
@@ -535,7 +535,7 @@ public class Font implements Serializable
}
/**
- * Checks how much of a given string can be mapped to glyphs in
+ * Checks how much of a given string can be mapped to glyphs in
* this font.
*
* @param s The string to check.
@@ -548,7 +548,7 @@ public class Font implements Serializable
*/
public int canDisplayUpTo(String s)
{
- return peer.canDisplayUpTo(this, new StringCharacterIterator(s),
+ return peer.canDisplayUpTo(this, new StringCharacterIterator(s),
0, s.length() - 1);
}
@@ -595,7 +595,7 @@ public class Font implements Serializable
*/
public int canDisplayUpTo(CharacterIterator i, int start, int limit)
{
- return peer.canDisplayUpTo(this, i, start, limit);
+ return peer.canDisplayUpTo(this, i, start, limit);
}
/**
@@ -717,7 +717,7 @@ public class Font implements Serializable
/**
* Extracts a sequence of glyphs from a font, returning a new {@link
- * GlyphVector} with a mapped glyph for each input glyph code.
+ * GlyphVector} with a mapped glyph for each input glyph code.
*
* @param ctx The rendering context used for precise glyph placement.
* @param glyphCodes Array of characters to convert to glyphs.
@@ -858,7 +858,7 @@ public class Font implements Serializable
}
/**
- * Returns an array of chracter attribute keys which this font understands.
+ * Returns an array of chracter attribute keys which this font understands.
*
* @return An array of chracter attribute keys which this font understands.
*
@@ -917,7 +917,7 @@ public class Font implements Serializable
*/
public String getFamily(Locale lc)
{
- return peer.getFamily(this, lc);
+ return peer.getFamily(this, lc);
}
/**
@@ -929,7 +929,7 @@ public class Font implements Serializable
*
* @since 1.2
*
- * @see java.awt.font.TextAttribute
+ * @see java.awt.font.TextAttribute
*/
public static Font getFont(Map<? extends AttributedCharacterIterator.Attribute, ?> attributes)
{
@@ -990,7 +990,7 @@ public class Font implements Serializable
/**
* Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
+ * text and {@link FontRenderContext}.
*
* @param text The string to calculate metrics from.
* @param begin Index of first character in <code>text</code> to measure.
@@ -1002,16 +1002,16 @@ public class Font implements Serializable
* @throws IndexOutOfBoundsException if the range [begin, limit] is
* invalid in <code>text</code>.
*/
- public LineMetrics getLineMetrics(String text, int begin,
+ public LineMetrics getLineMetrics(String text, int begin,
int limit, FontRenderContext rc)
{
- return peer.getLineMetrics(this, new StringCharacterIterator(text),
+ return peer.getLineMetrics(this, new StringCharacterIterator(text),
begin, limit, rc);
}
/**
* Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
+ * text and {@link FontRenderContext}.
*
* @param chars The string to calculate metrics from.
* @param begin Index of first character in <code>text</code> to measure.
@@ -1023,17 +1023,17 @@ public class Font implements Serializable
* @throws IndexOutOfBoundsException if the range [begin, limit] is
* invalid in <code>chars</code>.
*/
- public LineMetrics getLineMetrics(char[] chars, int begin,
+ public LineMetrics getLineMetrics(char[] chars, int begin,
int limit, FontRenderContext rc)
{
return peer.getLineMetrics(this,
- new StringCharacterIterator(new String(chars)),
+ new StringCharacterIterator(new String(chars)),
begin, limit, rc);
}
/**
* Returns a {@link LineMetrics} object constructed with the specified
- * text and {@link FontRenderContext}.
+ * text and {@link FontRenderContext}.
*
* @param ci The string to calculate metrics from.
* @param begin Index of first character in <code>text</code> to measure.
@@ -1045,7 +1045,7 @@ public class Font implements Serializable
* @throws IndexOutOfBoundsException if the range [begin, limit] is
* invalid in <code>ci</code>.
*/
- public LineMetrics getLineMetrics(CharacterIterator ci, int begin,
+ public LineMetrics getLineMetrics(CharacterIterator ci, int begin,
int limit, FontRenderContext rc)
{
return peer.getLineMetrics(this, ci, begin, limit, rc);
@@ -1086,7 +1086,7 @@ public class Font implements Serializable
* <code>[ 0, getNumGlyphs() - 1 ]</code>.
*
* @return The number of glyphs in this font.
- *
+ *
* @since 1.2
*/
public int getNumGlyphs()
@@ -1095,7 +1095,7 @@ public class Font implements Serializable
}
/**
- * Returns the PostScript Name of this font.
+ * Returns the PostScript Name of this font.
*
* @return The PostScript Name of this font.
*
@@ -1115,12 +1115,12 @@ public class Font implements Serializable
* font in the specified {@link FontRenderContext}. This box will include the
* glyph origin, ascent, advance, height, and leading, but may not include all
* diacritics or accents. To get the complete visual bounding box of all the
- * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
+ * glyphs in a run of text, use the {@link TextLayout#getBounds} method of
* {@link TextLayout}.
*
* @param str The string to measure.
* @param frc The context in which to make the precise glyph measurements.
- *
+ *
* @return A bounding box covering the logical bounds of the specified text.
*
* @see #createGlyphVector(FontRenderContext, String)
@@ -1143,7 +1143,7 @@ public class Font implements Serializable
* @param begin Index of the first character in <code>str</code> to measure.
* @param limit Index of the last character in <code>str</code> to measure.
* @param frc The context in which to make the precise glyph measurements.
- *
+ *
* @return A bounding box covering the logical bounds of the specified text.
*
* @throws IndexOutOfBoundsException if the range [begin, limit] is
@@ -1153,7 +1153,7 @@ public class Font implements Serializable
*
* @see #createGlyphVector(FontRenderContext, String)
*/
- public Rectangle2D getStringBounds(String str, int begin,
+ public Rectangle2D getStringBounds(String str, int begin,
int limit, FontRenderContext frc)
{
String sub = str.substring(begin, limit);
@@ -1172,7 +1172,7 @@ public class Font implements Serializable
* @param begin Index of the first character in <code>ci</code> to measure.
* @param limit Index of the last character in <code>ci</code> to measure.
* @param frc The context in which to make the precise glyph measurements.
- *
+ *
* @return A bounding box covering the logical bounds of the specified text.
*
* @throws IndexOutOfBoundsException if the range [begin, limit] is
@@ -1182,7 +1182,7 @@ public class Font implements Serializable
*
* @see #createGlyphVector(FontRenderContext, CharacterIterator)
*/
- public Rectangle2D getStringBounds(CharacterIterator ci, int begin,
+ public Rectangle2D getStringBounds(CharacterIterator ci, int begin,
int limit, FontRenderContext frc)
{
int start = ci.getBeginIndex();
@@ -1209,7 +1209,7 @@ public class Font implements Serializable
* @param begin Index of the first character in <code>ci</code> to measure.
* @param limit Index of the last character in <code>ci</code> to measure.
* @param frc The context in which to make the precise glyph measurements.
- *
+ *
* @return A bounding box covering the logical bounds of the specified text.
*
* @throws IndexOutOfBoundsException if the range [begin, limit] is
@@ -1219,7 +1219,7 @@ public class Font implements Serializable
*
* @see #createGlyphVector(FontRenderContext, char[])
*/
- public Rectangle2D getStringBounds(char[] chars, int begin,
+ public Rectangle2D getStringBounds(char[] chars, int begin,
int limit, FontRenderContext frc)
{
String str = new String(chars, begin, limit - begin);
@@ -1293,10 +1293,10 @@ public class Font implements Serializable
* @return A new {@link GlyphVector} representing the specified text.
*
* @throws IndexOutOfBoundsException if the range [begin, limit] is
- * invalid in <code>chars</code>.
+ * invalid in <code>chars</code>.
*/
- public GlyphVector layoutGlyphVector(FontRenderContext frc,
- char[] chars, int start,
+ public GlyphVector layoutGlyphVector(FontRenderContext frc,
+ char[] chars, int start,
int limit, int flags)
{
return peer.layoutGlyphVector(this, frc, chars, start, limit, flags);
@@ -1318,7 +1318,7 @@ public class Font implements Serializable
/**
* Returns a hash value for this font.
- *
+ *
* @return A hash for this font.
*/
public int hashCode()
@@ -1395,8 +1395,8 @@ public class Font implements Serializable
default:
styleString = "unknown";
}
-
- return getClass().getName()
+
+ return getClass().getName()
+ "[family=" + getFamily ()
+ ",name=" + getFontName ()
+ ",style=" + styleString
diff --git a/java/awt/FontMetrics.java b/java/awt/FontMetrics.java
index 91866462f..e483d28fc 100644
--- a/java/awt/FontMetrics.java
+++ b/java/awt/FontMetrics.java
@@ -362,7 +362,7 @@ public abstract class FontMetrics implements java.io.Serializable
rc = gRC;
return font.getLineMetrics(chars, begin, limit, rc);
}
-
+
/**
* Returns the bounds of the largest character in a Graphics context.
* @param context the Graphics context object.
diff --git a/java/awt/Frame.java b/java/awt/Frame.java
index 3cc8738c6..83bdb0947 100644
--- a/java/awt/Frame.java
+++ b/java/awt/Frame.java
@@ -336,10 +336,10 @@ public class Frame extends Window implements MenuContainer
this.menuBar = menuBar;
if (menuBar != null)
{
- MenuContainer parent = menuBar.getParent();
- if (parent != null)
- parent.remove(menuBar);
- menuBar.setParent(this);
+ MenuContainer parent = menuBar.getParent();
+ if (parent != null)
+ parent.remove(menuBar);
+ menuBar.setParent(this);
// Create local copy for thread safety.
FramePeer p = (FramePeer) peer;
@@ -355,7 +355,7 @@ public class Frame extends Window implements MenuContainer
}
/**
- * Tests whether or not this frame is resizable. This will be
+ * Tests whether or not this frame is resizable. This will be
* <code>true</code> by default.
*
* @return <code>true</code> if this frame is resizable, <code>false</code>
@@ -417,16 +417,16 @@ public class Frame extends Window implements MenuContainer
{
if (menu == menuBar)
{
- if (menuBar != null)
- {
- if (peer != null)
- {
- ((FramePeer) peer).setMenuBar(null);
- menuBar.removeNotify();
- }
- menuBar.setParent(null);
- }
- menuBar = null;
+ if (menuBar != null)
+ {
+ if (peer != null)
+ {
+ ((FramePeer) peer).setMenuBar(null);
+ menuBar.removeNotify();
+ }
+ menuBar.setParent(null);
+ }
+ menuBar = null;
}
else
super.remove(menu);
@@ -493,7 +493,7 @@ public class Frame extends Window implements MenuContainer
/**
* The death queue for all frames.
- */
+ */
private static ReferenceQueue weakFramesQueue =
new ReferenceQueue<Frame>();
@@ -560,7 +560,7 @@ public class Frame extends Window implements MenuContainer
if (state == NORMAL
&& (current_state & ICONIFIED) != 0)
setExtendedState(current_state | ICONIFIED);
-
+
if (state == ICONIFIED
&& (current_state & ~ICONIFIED) == 0)
setExtendedState(current_state & ~ICONIFIED);
@@ -618,7 +618,7 @@ public class Frame extends Window implements MenuContainer
/**
* Returns whether this frame is undecorated or not.
- *
+ *
* @since 1.4
*/
public boolean isUndecorated()
@@ -629,9 +629,9 @@ public class Frame extends Window implements MenuContainer
/**
* Disables or enables decorations for this frame. This method can only be
* called while the frame is not displayable.
- *
+ *
* @throws IllegalComponentStateException if this frame is displayable
- *
+ *
* @since 1.4
*/
public void setUndecorated(boolean undecorated)
@@ -656,7 +656,7 @@ public class Frame extends Window implements MenuContainer
{
return next_frame_number++;
}
-
+
/**
* Accessibility support for <code>Frame</code>.
*/
@@ -672,7 +672,7 @@ public class Frame extends Window implements MenuContainer
{
return AccessibleRole.FRAME;
}
-
+
/**
* Gets the state set of this object.
* @return The current state of this frame.
@@ -687,7 +687,7 @@ public class Frame extends Window implements MenuContainer
return states;
}
}
-
+
/**
* Gets the AccessibleContext associated with this <code>Frame</code>.
* The context is created, if necessary.
diff --git a/java/awt/GradientPaint.java b/java/awt/GradientPaint.java
index 74067f49e..0bb840755 100644
--- a/java/awt/GradientPaint.java
+++ b/java/awt/GradientPaint.java
@@ -1,4 +1,4 @@
-/* GradientPaint.java --
+/* GradientPaint.java --
Copyright (C) 2002, 2005, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.awt.image.ColorModel;
import gnu.java.awt.GradientPaintContext;
/**
- * A paint object that can be used to color a region by blending two colors.
+ * A paint object that can be used to color a region by blending two colors.
* Instances of this class are immutable.
*/
public class GradientPaint implements Paint
@@ -60,7 +60,7 @@ public class GradientPaint implements Paint
/**
* Creates a new acyclic <code>GradientPaint</code>.
- *
+ *
* @param x1 the x-coordinate of the anchor point for color 1.
* @param y1 the y-coordinate of the anchor point for color 1.
* @param c1 color 1 (<code>null</code> not permitted).
@@ -76,7 +76,7 @@ public class GradientPaint implements Paint
/**
* Creates a new acyclic <code>GradientPaint</code>.
- *
+ *
* @param p1 anchor point 1 (<code>null</code> not permitted).
* @param c1 color 1 (<code>null</code> not permitted).
* @param p2 anchor point 2 (<code>null</code> not permitted).
@@ -90,7 +90,7 @@ public class GradientPaint implements Paint
/**
* Creates a new cyclic or acyclic <code>GradientPaint</code>.
- *
+ *
* @param x1 the x-coordinate of the anchor point for color 1.
* @param y1 the y-coordinate of the anchor point for color 1.
* @param c1 color 1 (<code>null</code> not permitted).
@@ -116,7 +116,7 @@ public class GradientPaint implements Paint
/**
* Creates a new cyclic or acyclic <code>GradientPaint</code>.
- *
+ *
* @param p1 anchor point 1 (<code>null</code> not permitted).
* @param c1 color 1 (<code>null</code> not permitted).
* @param p2 anchor point 2 (<code>null</code> not permitted).
@@ -135,7 +135,7 @@ public class GradientPaint implements Paint
* Returns a point with the same coordinates as the anchor point for color 1.
* Note that if you modify this point, the <code>GradientPaint</code> remains
* unchanged.
- *
+ *
* @return A point with the same coordinates as the anchor point for color 1.
*/
public Point2D getPoint1()
@@ -145,7 +145,7 @@ public class GradientPaint implements Paint
/**
* Returns the first color.
- *
+ *
* @return The color (never <code>null</code>).
*/
public Color getColor1()
@@ -157,7 +157,7 @@ public class GradientPaint implements Paint
* Returns a point with the same coordinates as the anchor point for color 2.
* Note that if you modify this point, the <code>GradientPaint</code> remains
* unchanged.
- *
+ *
* @return A point with the same coordinates as the anchor point for color 2.
*/
public Point2D getPoint2()
@@ -167,7 +167,7 @@ public class GradientPaint implements Paint
/**
* Returns the second color.
- *
+ *
* @return The color (never <code>null</code>).
*/
public Color getColor2()
@@ -178,7 +178,7 @@ public class GradientPaint implements Paint
/**
* Returns <code>true</code> if this <code>GradientPaint</code> instance is
* cyclic, and <code>false</code> otherwise.
- *
+ *
* @return A boolean.
*/
public boolean isCyclic()
@@ -188,14 +188,14 @@ public class GradientPaint implements Paint
/**
* Returns the {@link PaintContext} used to generate the color pattern.
- *
- * @param cm the color model, used as a hint (ignored in this
+ *
+ * @param cm the color model, used as a hint (ignored in this
* implementation).
* @param deviceBounds the device space bounding box of the painted area.
* @param userBounds the user space bounding box of the painted area.
* @param xform the transformation from user space to device space.
* @param hints any hints for choosing between rendering alternatives.
- *
+ *
* @return The context for performing the paint
*/
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds,
@@ -205,17 +205,17 @@ public class GradientPaint implements Paint
{
Point2D xp1 = xform.transform(getPoint1(), null);
Point2D xp2 = xform.transform(getPoint2(), null);
- return new GradientPaintContext((float) xp1.getX(), (float) xp1.getY(), c1,
+ return new GradientPaintContext((float) xp1.getX(), (float) xp1.getY(), c1,
(float) xp2.getX(), (float) xp2.getY(), c2, cyclic);
}
/**
* Returns the transparency code for this <code>GradientPaint</code> instance.
* This is derived from the two {@link Color} objects used in creating this
- * object: if both colors are opaque, this method returns
- * {@link Transparency#OPAQUE}, otherwise it returns
+ * object: if both colors are opaque, this method returns
+ * {@link Transparency#OPAQUE}, otherwise it returns
* {@link Transparency#TRANSLUCENT}.
- *
+ *
* @return {@link Transparency#OPAQUE} or {@link Transparency#TRANSLUCENT}.
*/
public int getTransparency()
@@ -223,7 +223,7 @@ public class GradientPaint implements Paint
if (c1.getAlpha() == 255 && c2.getAlpha() == 255)
return Transparency.OPAQUE;
else
- return Transparency.TRANSLUCENT;
+ return Transparency.TRANSLUCENT;
}
-
+
} // class GradientPaint
diff --git a/java/awt/Graphics.java b/java/awt/Graphics.java
index 09bf7cacf..dfc772207 100644
--- a/java/awt/Graphics.java
+++ b/java/awt/Graphics.java
@@ -74,8 +74,8 @@ public abstract class Graphics
*
* @param x The new X coordinate of the clipping region rect.
* @param y The new Y coordinate of the clipping region rect.
- * @param width The width of the clipping region intersect rectangle.
- * @param height The height of the clipping region intersect rectangle.
+ * @param width The width of the clipping region intersect rectangle.
+ * @param height The height of the clipping region intersect rectangle.
*
* @return A copy of this object, modified as specified.
*/
@@ -122,12 +122,12 @@ public abstract class Graphics
/**
* Sets this context info "XOR" mode, where the targe pixles are
- * XOR-ed when drawn on.
+ * XOR-ed when drawn on.
*
* @param color The color to XOR against.
*/
public abstract void setXORMode(Color color);
-
+
/**
* Returns the current font for this graphics context.
*
@@ -162,7 +162,7 @@ public abstract class Graphics
public abstract FontMetrics getFontMetrics(Font font);
/**
- * Returns the bounding rectangle of the clipping region for this
+ * Returns the bounding rectangle of the clipping region for this
* graphics context.
*
* @return The bounding rectangle for the clipping region.
@@ -170,7 +170,7 @@ public abstract class Graphics
public abstract Rectangle getClipBounds();
/**
- * Returns the bounding rectangle of the clipping region for this
+ * Returns the bounding rectangle of the clipping region for this
* graphics context.
*
* @return The bounding rectangle for the clipping region.
@@ -313,19 +313,19 @@ public abstract class Graphics
Color color = getColor();
Color tl = color.brighter();
Color br = color.darker();
-
+
if (!raised)
{
Color tmp = tl;
tl = br;
br = tmp;
}
-
+
int x1 = x;
int y1 = y;
int x2 = x + width;
int y2 = y + height;
-
+
setColor(tl);
drawLine(x1, y1, x2, y1);
drawLine(x1, y2, x1, y1);
@@ -488,8 +488,8 @@ public abstract class Graphics
/**
* Draws all of the image that is available and returns. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
@@ -502,12 +502,12 @@ public abstract class Graphics
*/
public abstract boolean drawImage(Image image, int x, int y,
ImageObserver observer);
-
+
/**
* Draws all of the image that is available and returns. The image
* is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
@@ -522,11 +522,11 @@ public abstract class Graphics
*/
public abstract boolean drawImage(Image image, int x, int y, int width,
int height, ImageObserver observer);
-
+
/**
* Draws all of the image that is available and returns. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
@@ -540,12 +540,12 @@ public abstract class Graphics
*/
public abstract boolean drawImage(Image image, int x, int y, Color bgcolor,
ImageObserver observer);
-
+
/**
* Draws all of the image that is available and returns. The image
* is scaled to fit in the specified rectangle. If the image
- * is not completely loaded, <code>false</code> is returned and
- * the specified iamge observer is notified as more data becomes
+ * is not completely loaded, <code>false</code> is returned and
+ * the specified iamge observer is notified as more data becomes
* available.
*
* @param image The image to draw.
@@ -596,7 +596,7 @@ public abstract class Graphics
/**
* Returns a string representation of this object.
*
- * @return A string representation of this object.
+ * @return A string representation of this object.
*/
public String toString()
{
@@ -626,7 +626,7 @@ public abstract class Graphics
public Rectangle getClipBounds(Rectangle r)
{
Rectangle clipBounds = getClipBounds();
-
+
if (r == null)
return clipBounds;
diff --git a/java/awt/Graphics2D.java b/java/awt/Graphics2D.java
index e0a1b4756..7c9622aef 100644
--- a/java/awt/Graphics2D.java
+++ b/java/awt/Graphics2D.java
@@ -51,27 +51,27 @@ import java.text.AttributedCharacterIterator;
import java.util.Map;
/**
- * An abstract class defining a device independent two-dimensional vector
- * graphics API. Concrete subclasses implement this API for output of
+ * An abstract class defining a device independent two-dimensional vector
+ * graphics API. Concrete subclasses implement this API for output of
* vector graphics to:
* <p>
* <ul>
- * <li>a {@link javax.swing.JComponent} - in the
- * {@link javax.swing.JComponent#paint(Graphics)} method, the incoming
- * {@link Graphics} should always be an instance of
- * <code>Graphics2D</code>;</li>
- * <li>a {@link BufferedImage} - see
+ * <li>a {@link javax.swing.JComponent} - in the
+ * {@link javax.swing.JComponent#paint(Graphics)} method, the incoming
+ * {@link Graphics} should always be an instance of
+ * <code>Graphics2D</code>;</li>
+ * <li>a {@link BufferedImage} - see
* {@link BufferedImage#createGraphics()};</li>
- * <li>a {@link java.awt.print.PrinterJob} - in the
+ * <li>a {@link java.awt.print.PrinterJob} - in the
* {@link Printable#print(Graphics, PageFormat, int)} method, the incoming
- * {@link Graphics} should always be an instance of
+ * {@link Graphics} should always be an instance of
* <code>Graphics2D</code>.</li>
* </ul>
* <p>
- * Third party libraries provide support for output to other formats via this
+ * Third party libraries provide support for output to other formats via this
* API, including encapsulated postscript (EPS), portable document format (PDF),
* and scalable vector graphics (SVG).
- *
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public abstract class Graphics2D extends Graphics
@@ -80,68 +80,68 @@ public abstract class Graphics2D extends Graphics
protected Graphics2D()
{
}
-
+
public void draw3DRect(int x, int y, int width, int height,
- boolean raised)
+ boolean raised)
{
super.draw3DRect(x, y, width, height, raised);
}
-
+
public void fill3DRect(int x, int y, int width, int height,
- boolean raised)
+ boolean raised)
{
super.fill3DRect(x, y, width, height, raised);
}
/**
* Draws an outline around a shape using the current stroke and paint.
- *
+ *
* @param shape the shape (<code>null</code> not permitted).
- *
+ *
* @see #getStroke()
* @see #getPaint()
*/
public abstract void draw(Shape shape);
public abstract boolean drawImage(Image image, AffineTransform xform,
- ImageObserver obs);
+ ImageObserver obs);
public abstract void drawImage(BufferedImage image,
- BufferedImageOp op,
- int x,
- int y);
+ BufferedImageOp op,
+ int x,
+ int y);
public abstract void drawRenderedImage(RenderedImage image,
- AffineTransform xform);
+ AffineTransform xform);
public abstract void drawRenderableImage(RenderableImage image,
AffineTransform xform);
/**
* Draws a string at the specified location, using the current font.
- *
+ *
* @param text the string to draw.
* @param x the x-coordinate.
* @param y the y-coordinate.
- *
+ *
* @see Graphics#setFont(Font)
*/
public abstract void drawString(String text, int x, int y);
/**
* Draws a string at the specified location, using the current font.
- *
+ *
* @param text the string to draw.
* @param x the x-coordinate.
* @param y the y-coordinate.
- *
+ *
* @see Graphics#setFont(Font)
*/
public abstract void drawString(String text, float x, float y);
-
+
/**
* Draws an attributed string at the specified location.
- *
+ *
* @param iterator the source of the attributed text.
* @param x the x-coordinate.
* @param y the y-coordinate.
@@ -151,60 +151,60 @@ public abstract class Graphics2D extends Graphics
/**
* Draws an attributed string at the specified location.
- *
+ *
* @param iterator the source of the attributed text.
* @param x the x-coordinate.
* @param y the y-coordinate.
*/
public abstract void drawString(AttributedCharacterIterator iterator,
- float x, float y);
+ float x, float y);
/**
* Fills the interior of the specified <code>shape</code> using the current
* paint.
- *
+ *
* @param shape the shape to fill (<code>null</code> not permitted).
- *
+ *
* @see #draw(Shape)
* @see #getPaint()
*/
public abstract void fill(Shape shape);
-
+
public abstract boolean hit(Rectangle rect, Shape text,
- boolean onStroke);
+ boolean onStroke);
public abstract GraphicsConfiguration getDeviceConfiguration();
/**
* Sets the current compositing rule.
- *
+ *
* @param comp the composite.
- *
+ *
* @see #getComposite()
*/
public abstract void setComposite(Composite comp);
-
+
/**
* Sets the paint to be used for subsequent drawing operations.
- *
+ *
* @param paint the paint (<code>null</code> not permitted).
- *
+ *
* @see #getPaint()
*/
public abstract void setPaint(Paint paint);
/**
* Sets the stroke to be used for subsequent drawing operations.
- *
+ *
* @param stroke the stroke (<code>null</code> not permitted).
- *
+ *
* @see #getStroke()
*/
public abstract void setStroke(Stroke stroke);
/**
* Adds or updates a hint in the current rendering hints table.
- *
+ *
* @param hintKey the hint key.
* @param hintValue the hint value.
*/
@@ -213,32 +213,32 @@ public abstract class Graphics2D extends Graphics
/**
* Returns the current value of a rendering hint.
- *
+ *
* @param hintKey the key for the hint.
- *
+ *
* @return The value for the specified hint.
*/
public abstract Object getRenderingHint(RenderingHints.Key hintKey);
-
+
/**
* Replaces the current rendering hints with the supplied hints.
- *
+ *
* @param hints the hints.
- *
+ *
* @see #addRenderingHints(Map)
*/
public abstract void setRenderingHints(Map<?,?> hints);
/**
* Adds/updates the rendering hint.
- *
+ *
* @param hints the hints to add or update.
*/
public abstract void addRenderingHints(Map<?,?> hints);
/**
* Returns the current rendering hints.
- *
+ *
* @return The current rendering hints.
*/
public abstract RenderingHints getRenderingHints();
@@ -246,7 +246,7 @@ public abstract class Graphics2D extends Graphics
public abstract void translate(int x, int y);
public abstract void translate(double tx, double ty);
-
+
public abstract void rotate(double theta);
public abstract void rotate(double theta, double x, double y);
@@ -258,98 +258,98 @@ public abstract class Graphics2D extends Graphics
/**
* Sets the current transform to a concatenation of <code>transform</code>
* and the existing transform.
- *
+ *
* @param transform the transform.
*/
public abstract void transform(AffineTransform transform);
-
+
/**
* Sets the current transform. If the caller specifies a <code>null</code>
- * transform, this method should set the current transform to the
+ * transform, this method should set the current transform to the
* identity transform.
- *
+ *
* @param transform the transform (<code>null</code> permitted).
- *
+ *
* @see #getTransform()
*/
public abstract void setTransform(AffineTransform transform);
/**
* Returns the current transform.
- *
+ *
* @return The current transform.
- *
+ *
* @see #setTransform(AffineTransform)
*/
public abstract AffineTransform getTransform();
/**
* Returns the current paint.
- *
+ *
* @return The current paint.
- *
+ *
* @see #setPaint(Paint)
*/
public abstract Paint getPaint();
/**
* Returns the current compositing rule.
- *
+ *
* @return The current compositing rule.
- *
+ *
* @see #setComposite(Composite)
*/
public abstract Composite getComposite();
/**
- * Sets the background color (used by the
+ * Sets the background color (used by the
* {@link Graphics#clearRect(int, int, int, int)} method).
- *
+ *
* @param color the color.
- *
+ *
* @see #getBackground()
*/
public abstract void setBackground(Color color);
/**
- * Returns the color used by the
+ * Returns the color used by the
* {@link Graphics#clearRect(int, int, int, int)} method.
- *
+ *
* @return The background color.
- *
+ *
* @see #setBackground(Color)
*/
public abstract Color getBackground();
/**
* Returns the current stroke.
- *
+ *
* @return The current stroke.
- *
+ *
* @see #setStroke(Stroke)
*/
- public abstract Stroke getStroke();
+ public abstract Stroke getStroke();
/**
- * Sets the clip region to the intersection of the current clipping region
+ * Sets the clip region to the intersection of the current clipping region
* and <code>s</code>.
- *
+ *
* @param s the shape to intersect with the current clipping region.
- *
+ *
* @see Graphics#setClip(Shape)
*/
public abstract void clip(Shape s);
/**
* Returns the font render context.
- *
+ *
* @return The font render context.
*/
public abstract FontRenderContext getFontRenderContext();
/**
* Draws a glyph vector at the specified location.
- *
+ *
* @param g the glyph vector.
* @param x the x-coordinate.
* @param y the y-coordinate.
diff --git a/java/awt/GraphicsConfiguration.java b/java/awt/GraphicsConfiguration.java
index 3cf8b65db..bbd9820c9 100644
--- a/java/awt/GraphicsConfiguration.java
+++ b/java/awt/GraphicsConfiguration.java
@@ -63,13 +63,13 @@ import java.awt.image.VolatileImage;
*/
public abstract class GraphicsConfiguration
{
-
+
/** The cached image capabilities. */
private ImageCapabilities imageCapabilities;
-
+
/** The cached buffer capabilities. */
private BufferCapabilities bufferCapabilities;
-
+
/**
* The default constructor.
*
@@ -253,7 +253,7 @@ public abstract class GraphicsConfiguration
{
if (imageCapabilities == null)
getImageCapabilities();
-
+
if (bufferCapabilities == null)
bufferCapabilities = new BufferCapabilities(imageCapabilities,
imageCapabilities, null);
diff --git a/java/awt/GraphicsDevice.java b/java/awt/GraphicsDevice.java
index 95487a2a1..c99c14b1b 100644
--- a/java/awt/GraphicsDevice.java
+++ b/java/awt/GraphicsDevice.java
@@ -175,7 +175,7 @@ public abstract class GraphicsDevice
// Restore the previous window to normal mode and release the reference.
if (full_screen != null)
{
- full_screen.setBounds(fullScreenOldBounds);
+ full_screen.setBounds(fullScreenOldBounds);
}
full_screen = null;
@@ -183,12 +183,12 @@ public abstract class GraphicsDevice
// If w != null, make it full-screen.
if (w != null)
{
- fullScreenOldBounds = w.getBounds();
- full_screen = w;
- DisplayMode dMode = getDisplayMode();
- full_screen.setBounds(0, 0, dMode.getWidth(), dMode.getHeight());
- full_screen.requestFocus();
- full_screen.setLocationRelativeTo(null);
+ fullScreenOldBounds = w.getBounds();
+ full_screen = w;
+ DisplayMode dMode = getDisplayMode();
+ full_screen.setBounds(0, 0, dMode.getWidth(), dMode.getHeight());
+ full_screen.requestFocus();
+ full_screen.setLocationRelativeTo(null);
}
}
diff --git a/java/awt/GridBagConstraints.java b/java/awt/GridBagConstraints.java
index a6a64c3bb..823130058 100644
--- a/java/awt/GridBagConstraints.java
+++ b/java/awt/GridBagConstraints.java
@@ -191,14 +191,14 @@ public class GridBagConstraints implements Cloneable, Serializable
{
try
{
- GridBagConstraints g = (GridBagConstraints) super.clone ();
- g.insets = (Insets) insets.clone ();
- return g;
+ GridBagConstraints g = (GridBagConstraints) super.clone ();
+ g.insets = (Insets) insets.clone ();
+ return g;
}
catch (CloneNotSupportedException _)
{
- // Can't happen.
- return null;
+ // Can't happen.
+ return null;
}
}
@@ -226,10 +226,10 @@ public class GridBagConstraints implements Cloneable, Serializable
* parameters.
*/
public GridBagConstraints (int gridx, int gridy,
- int gridwidth, int gridheight,
- double weightx, double weighty,
- int anchor, int fill,
- Insets insets, int ipadx, int ipady)
+ int gridwidth, int gridheight,
+ double weightx, double weighty,
+ int anchor, int fill,
+ Insets insets, int ipadx, int ipady)
{
this.anchor = anchor;
this.fill = fill;
diff --git a/java/awt/GridBagLayout.java b/java/awt/GridBagLayout.java
index d016fd31a..224d53ff2 100644
--- a/java/awt/GridBagLayout.java
+++ b/java/awt/GridBagLayout.java
@@ -75,9 +75,9 @@ public class GridBagLayout
public GridBagLayout ()
{
- this.comptable = new Hashtable<Component,GridBagConstraints>();
- this.internalcomptable = new Hashtable<Component,GridBagConstraints>();
- this.defaultConstraints= new GridBagConstraints();
+ this.comptable = new Hashtable<Component,GridBagConstraints>();
+ this.internalcomptable = new Hashtable<Component,GridBagConstraints>();
+ this.defaultConstraints= new GridBagConstraints();
}
/**
@@ -85,12 +85,12 @@ public class GridBagLayout
*/
private int sumIntArray (int[] array, int upto)
{
- int result = 0;
+ int result = 0;
- for (int i = 0; i < upto; i++)
- result += array [i];
+ for (int i = 0; i < upto; i++)
+ result += array [i];
- return result;
+ return result;
}
/**
@@ -98,7 +98,7 @@ public class GridBagLayout
*/
private int sumIntArray (int[] array)
{
- return sumIntArray(array, array.length);
+ return sumIntArray(array, array.length);
}
/**
@@ -106,58 +106,58 @@ public class GridBagLayout
*/
private double sumDoubleArray (double[] array)
{
- double result = 0;
+ double result = 0;
- for (int i = 0; i < array.length; i++)
- result += array [i];
+ for (int i = 0; i < array.length; i++)
+ result += array [i];
- return result;
+ return result;
}
public void addLayoutComponent (String name, Component component)
{
- // do nothing here.
+ // do nothing here.
}
public void removeLayoutComponent (Component component)
{
- // do nothing here
+ // do nothing here
}
public void addLayoutComponent (Component component, Object constraints)
{
- if (constraints == null)
- return;
+ if (constraints == null)
+ return;
- if (!(constraints instanceof GridBagConstraints))
- throw new IllegalArgumentException("constraints "
- + constraints
- + " are not an instance of GridBagConstraints");
+ if (!(constraints instanceof GridBagConstraints))
+ throw new IllegalArgumentException("constraints "
+ + constraints
+ + " are not an instance of GridBagConstraints");
- setConstraints (component, (GridBagConstraints) constraints);
+ setConstraints (component, (GridBagConstraints) constraints);
}
public Dimension preferredLayoutSize (Container parent)
{
- if (parent == null)
- return new Dimension (0, 0);
-
- GridBagLayoutInfo li = getLayoutInfo (parent, PREFERREDSIZE);
- return getMinSize (parent, li);
+ if (parent == null)
+ return new Dimension (0, 0);
+
+ GridBagLayoutInfo li = getLayoutInfo (parent, PREFERREDSIZE);
+ return getMinSize (parent, li);
}
public Dimension minimumLayoutSize (Container parent)
{
- if (parent == null)
- return new Dimension (0, 0);
-
- GridBagLayoutInfo li = getLayoutInfo (parent, MINSIZE);
- return getMinSize (parent, li);
+ if (parent == null)
+ return new Dimension (0, 0);
+
+ GridBagLayoutInfo li = getLayoutInfo (parent, MINSIZE);
+ return getMinSize (parent, li);
}
public Dimension maximumLayoutSize (Container target)
{
- return new Dimension (Integer.MAX_VALUE, Integer.MAX_VALUE);
+ return new Dimension (Integer.MAX_VALUE, Integer.MAX_VALUE);
}
public void layoutContainer (Container parent)
@@ -167,72 +167,72 @@ public class GridBagLayout
public float getLayoutAlignmentX (Container target)
{
- return Component.CENTER_ALIGNMENT;
+ return Component.CENTER_ALIGNMENT;
}
public float getLayoutAlignmentY (Container target)
{
- return Component.CENTER_ALIGNMENT;
+ return Component.CENTER_ALIGNMENT;
}
public void invalidateLayout (Container target)
{
- this.layoutInfo = null;
+ this.layoutInfo = null;
}
public void setConstraints (Component component,
- GridBagConstraints constraints)
+ GridBagConstraints constraints)
{
- GridBagConstraints clone = (GridBagConstraints) constraints.clone();
-
- if (clone.gridx < 0)
- clone.gridx = GridBagConstraints.RELATIVE;
-
- if (clone.gridy < 0)
- clone.gridy = GridBagConstraints.RELATIVE;
-
- if (clone.gridwidth == 0)
- clone.gridwidth = GridBagConstraints.REMAINDER;
- else if (clone.gridwidth < 0)
- clone.gridwidth = 1;
-
- if (clone.gridheight == 0)
- clone.gridheight = GridBagConstraints.REMAINDER;
- else if (clone.gridheight < 0)
- clone.gridheight = 1;
-
- comptable.put (component, clone);
+ GridBagConstraints clone = (GridBagConstraints) constraints.clone();
+
+ if (clone.gridx < 0)
+ clone.gridx = GridBagConstraints.RELATIVE;
+
+ if (clone.gridy < 0)
+ clone.gridy = GridBagConstraints.RELATIVE;
+
+ if (clone.gridwidth == 0)
+ clone.gridwidth = GridBagConstraints.REMAINDER;
+ else if (clone.gridwidth < 0)
+ clone.gridwidth = 1;
+
+ if (clone.gridheight == 0)
+ clone.gridheight = GridBagConstraints.REMAINDER;
+ else if (clone.gridheight < 0)
+ clone.gridheight = 1;
+
+ comptable.put (component, clone);
}
public GridBagConstraints getConstraints (Component component)
{
- return (GridBagConstraints) (lookupConstraints (component).clone());
+ return (GridBagConstraints) (lookupConstraints (component).clone());
}
protected GridBagConstraints lookupConstraints (Component component)
{
- GridBagConstraints result = comptable.get (component);
-
- if (result == null)
- {
- setConstraints (component, defaultConstraints);
- result = comptable.get (component);
- }
-
- return result;
+ GridBagConstraints result = comptable.get (component);
+
+ if (result == null)
+ {
+ setConstraints (component, defaultConstraints);
+ result = comptable.get (component);
+ }
+
+ return result;
}
private GridBagConstraints lookupInternalConstraints (Component component)
{
- GridBagConstraints result = internalcomptable.get (component);
-
- if (result == null)
- {
- result = (GridBagConstraints) lookupConstraints(component).clone();
- internalcomptable.put (component, result);
- }
-
- return result;
+ GridBagConstraints result = internalcomptable.get (component);
+
+ if (result == null)
+ {
+ result = (GridBagConstraints) lookupConstraints(component).clone();
+ internalcomptable.put (component, result);
+ }
+
+ return result;
}
/**
@@ -240,10 +240,10 @@ public class GridBagLayout
*/
public Point getLayoutOrigin ()
{
- if (layoutInfo == null)
- return new Point (0, 0);
-
- return new Point (layoutInfo.pos_x, layoutInfo.pos_y);
+ if (layoutInfo == null)
+ return new Point (0, 0);
+
+ return new Point (layoutInfo.pos_x, layoutInfo.pos_y);
}
/**
@@ -251,38 +251,38 @@ public class GridBagLayout
*/
public int[][] getLayoutDimensions ()
{
- int[][] result = new int [2][];
- if (layoutInfo == null)
- {
- result[0] = new int[0];
- result[1] = new int[0];
-
- return result;
- }
-
- result [0] = new int [layoutInfo.cols];
- System.arraycopy (layoutInfo.colWidths, 0, result [0], 0, layoutInfo.cols);
- result [1] = new int [layoutInfo.rows];
- System.arraycopy (layoutInfo.rowHeights, 0, result [1], 0, layoutInfo.rows);
- return result;
+ int[][] result = new int [2][];
+ if (layoutInfo == null)
+ {
+ result[0] = new int[0];
+ result[1] = new int[0];
+
+ return result;
+ }
+
+ result [0] = new int [layoutInfo.cols];
+ System.arraycopy (layoutInfo.colWidths, 0, result [0], 0, layoutInfo.cols);
+ result [1] = new int [layoutInfo.rows];
+ System.arraycopy (layoutInfo.rowHeights, 0, result [1], 0, layoutInfo.rows);
+ return result;
}
public double[][] getLayoutWeights ()
{
- double[][] result = new double [2][];
- if (layoutInfo == null)
- {
- result[0] = new double[0];
- result[1] = new double[0];
-
- return result;
- }
-
- result [0] = new double [layoutInfo.cols];
- System.arraycopy (layoutInfo.colWeights, 0, result [0], 0, layoutInfo.cols);
- result [1] = new double [layoutInfo.rows];
- System.arraycopy (layoutInfo.rowWeights, 0, result [1], 0, layoutInfo.rows);
- return result;
+ double[][] result = new double [2][];
+ if (layoutInfo == null)
+ {
+ result[0] = new double[0];
+ result[1] = new double[0];
+
+ return result;
+ }
+
+ result [0] = new double [layoutInfo.cols];
+ System.arraycopy (layoutInfo.colWeights, 0, result [0], 0, layoutInfo.cols);
+ result [1] = new double [layoutInfo.rows];
+ System.arraycopy (layoutInfo.rowWeights, 0, result [1], 0, layoutInfo.rows);
+ return result;
}
/**
@@ -290,33 +290,33 @@ public class GridBagLayout
*/
public Point location (int x, int y)
{
- if (layoutInfo == null)
- return new Point (0, 0);
+ if (layoutInfo == null)
+ return new Point (0, 0);
- int col;
- int row;
- int pixel_x = layoutInfo.pos_x;
- int pixel_y = layoutInfo.pos_y;
+ int col;
+ int row;
+ int pixel_x = layoutInfo.pos_x;
+ int pixel_y = layoutInfo.pos_y;
- for (col = 0; col < layoutInfo.cols; col++)
- {
- int w = layoutInfo.colWidths [col];
- if (x < pixel_x + w)
- break;
+ for (col = 0; col < layoutInfo.cols; col++)
+ {
+ int w = layoutInfo.colWidths [col];
+ if (x < pixel_x + w)
+ break;
- pixel_x += w;
- }
+ pixel_x += w;
+ }
- for (row = 0; row < layoutInfo.rows; row++)
- {
- int h = layoutInfo.rowHeights [row];
- if (y < pixel_y + h)
- break;
+ for (row = 0; row < layoutInfo.rows; row++)
+ {
+ int h = layoutInfo.rowHeights [row];
+ if (y < pixel_y + h)
+ break;
- pixel_y += h;
- }
+ pixel_y += h;
+ }
- return new Point (col, row);
+ return new Point (col, row);
}
/**
@@ -328,7 +328,7 @@ public class GridBagLayout
{
return getClass().getName();
}
-
+
/**
* Move and resize a rectangle according to a set of grid bag
* constraints. The x, y, width and height fields of the
@@ -342,12 +342,12 @@ public class GridBagLayout
{
Insets insets = constraints.insets;
if (insets != null)
- {
- r.x += insets.left;
- r.y += insets.top;
- r.width -= insets.left + insets.right;
- r.height -= insets.top + insets.bottom;
- }
+ {
+ r.x += insets.left;
+ r.y += insets.top;
+ r.width -= insets.left + insets.right;
+ r.height -= insets.top + insets.bottom;
+ }
}
/**
@@ -385,13 +385,13 @@ public class GridBagLayout
Dimension dim = component.getPreferredSize();
GridBagConstraints constraints = lookupInternalConstraints(component);
-
+
if (lastComp != null
&& constraints.gridheight == GridBagConstraints.REMAINDER)
cell.y += cell.height;
else
cell.y = sumIntArray(info.rowHeights, constraints.gridy);
-
+
if (lastComp != null
&& constraints.gridwidth == GridBagConstraints.REMAINDER)
cell.x += cell.width;
@@ -402,9 +402,9 @@ public class GridBagLayout
+ constraints.gridwidth) - cell.x;
cell.height = sumIntArray(info.rowHeights, constraints.gridy
+ constraints.gridheight) - cell.y;
-
+
// Adjust for insets.
- AdjustForGravity( constraints, cell );
+ AdjustForGravity( constraints, cell );
// Note: Documentation says that padding is added on both sides, but
// visual inspection shows that the Sun implementation only adds it
@@ -492,7 +492,7 @@ public class GridBagLayout
Insets parentInsets = parent.getInsets ();
parentDim.width -= parentInsets.left + parentInsets.right;
parentDim.height -= parentInsets.top + parentInsets.bottom;
-
+
int current_y = 0;
int max_x = 0;
int max_y = 0;
@@ -508,13 +508,13 @@ public class GridBagLayout
// smallest to largest, with REMAINDER and RELATIVE at the end.
// These are useful when determining sizes and weights.
ArrayList<Component> sortedByWidth =
- new ArrayList<Component>(components.length);
+ new ArrayList<Component>(components.length);
ArrayList<Component> sortedByHeight =
- new ArrayList<Component>(components.length);
+ new ArrayList<Component>(components.length);
// STEP 1: first we figure out how many rows/columns
for (int i = 0; i < components.length; i++)
- {
+ {
Component component = components [i];
// If component is not visible we dont have to care about it.
if (!component.isVisible())
@@ -557,7 +557,7 @@ public class GridBagLayout
// Check the component that occupies the right-most spot in this
// row. We want to add this component after it.
// If this row is empty, add to the 0 position.
- if (!lastInRow.containsKey(new Integer(constraints.gridy)))
+ if (!lastInRow.containsKey(new Integer(constraints.gridy)))
x = 0;
else
{
@@ -588,7 +588,7 @@ public class GridBagLayout
// Check the component that occupies the bottom-most spot in
// this column. We want to add this component below it.
// If this column is empty, add to the 0 position.
- if (!lastInCol.containsKey(new Integer(constraints.gridx)))
+ if (!lastInCol.containsKey(new Integer(constraints.gridx)))
{
y = current_y;
}
@@ -616,7 +616,7 @@ public class GridBagLayout
}
// case 4: do nothing
- max_x = Math.max(max_x,
+ max_x = Math.max(max_x,
constraints.gridx + Math.max(1, constraints.gridwidth));
max_y = Math.max(max_y,
constraints.gridy + Math.max(1, constraints.gridheight));
@@ -626,11 +626,11 @@ public class GridBagLayout
// Update our reference points for RELATIVE gridx and gridy.
if(constraints.gridwidth == GridBagConstraints.REMAINDER)
- {
+ {
current_y = constraints.gridy + Math.max(1, constraints.gridheight);
- }
+ }
else if (constraints.gridwidth != GridBagConstraints.REMAINDER)
- {
+ {
for (int y = constraints.gridy; y < constraints.gridy + Math.max(1, constraints.gridheight); y++)
{
if(lastInRow.containsKey(new Integer(y)))
@@ -664,9 +664,9 @@ public class GridBagLayout
lastInCol.put(new Integer(x), component);
}
}
- }
- } // end of STEP 1
-
+ }
+ } // end of STEP 1
+
GridBagLayoutInfo info = new GridBagLayoutInfo(max_x, max_y);
// Check if column widths and row heights are overridden.
@@ -691,11 +691,11 @@ public class GridBagLayout
for (int i = 0; i < components.length; i++)
{
Component component = components [i];
-
+
// If component is not visible we dont have to care about it.
if (!component.isVisible())
continue;
-
+
GridBagConstraints constraints = lookupInternalConstraints (component);
if(constraints.gridwidth == GridBagConstraints.REMAINDER || constraints.gridwidth == GridBagConstraints.RELATIVE)
@@ -745,7 +745,7 @@ public class GridBagLayout
if (lastComponent != null)
{
GridBagConstraints lastConstraints = lookupInternalConstraints(lastComponent);
-
+
if (lastConstraints.gridheight == GridBagConstraints.RELATIVE)
{
constraints.gridy = max_y - 1;
@@ -776,7 +776,7 @@ public class GridBagLayout
for (int i = 0; i < sortedByWidth.size(); i++)
{
Component component = sortedByWidth.get(i);
-
+
// If component is not visible we dont have to care about it.
if (!component.isVisible())
continue;
@@ -793,7 +793,7 @@ public class GridBagLayout
width += constraints.ipadx;
distributeSizeAndWeight(width,
- constraints.weightx,
+ constraints.weightx,
constraints.gridx,
constraints.gridwidth,
info.colWidths,
@@ -804,7 +804,7 @@ public class GridBagLayout
for (int i = 0; i < sortedByHeight.size(); i++)
{
Component component = sortedByHeight.get(i);
-
+
// If component is not visible we dont have to care about it.
if (!component.isVisible())
continue;
@@ -819,9 +819,9 @@ public class GridBagLayout
height += constraints.insets.top + constraints.insets.bottom;
height += constraints.ipady;
-
+
distributeSizeAndWeight(height,
- constraints.weighty,
+ constraints.weighty,
constraints.gridy,
constraints.gridheight,
info.rowHeights,
@@ -890,7 +890,7 @@ public class GridBagLayout
* FIXME: Use a better sorting algorithm.
*/
private void sortBySpan (Component component, int span,
- ArrayList<Component> list, boolean sortByWidth)
+ ArrayList<Component> list, boolean sortByWidth)
{
if (span == GridBagConstraints.REMAINDER
|| span == GridBagConstraints.RELATIVE)
@@ -1005,7 +1005,7 @@ public class GridBagLayout
double extraWeight = diff * weights[k] / totalWeight;
weights[k] += extraWeight;
remaining -= extraWeight;
- }
+ }
if (remaining > 0.0 && weights[start + span - 1] != 0.0)
{
@@ -1044,42 +1044,42 @@ public class GridBagLayout
private void dumpLayoutInfo (GridBagLayoutInfo info)
{
- System.out.println ("GridBagLayoutInfo:");
- System.out.println ("cols: " + info.cols + ", rows: " + info.rows);
- System.out.print ("colWidths: ");
- dumpArray(info.colWidths);
- System.out.print ("rowHeights: ");
- dumpArray(info.rowHeights);
- System.out.print ("colWeights: ");
- dumpArray(info.colWeights);
- System.out.print ("rowWeights: ");
- dumpArray(info.rowWeights);
+ System.out.println ("GridBagLayoutInfo:");
+ System.out.println ("cols: " + info.cols + ", rows: " + info.rows);
+ System.out.print ("colWidths: ");
+ dumpArray(info.colWidths);
+ System.out.print ("rowHeights: ");
+ dumpArray(info.rowHeights);
+ System.out.print ("colWeights: ");
+ dumpArray(info.colWeights);
+ System.out.print ("rowWeights: ");
+ dumpArray(info.rowWeights);
}
private void dumpArray(int[] array)
{
- String sep = "";
- for(int i = 0; i < array.length; i++)
- {
- System.out.print(sep);
- System.out.print(array[i]);
- sep = ", ";
- }
- System.out.println();
+ String sep = "";
+ for(int i = 0; i < array.length; i++)
+ {
+ System.out.print(sep);
+ System.out.print(array[i]);
+ sep = ", ";
+ }
+ System.out.println();
}
private void dumpArray(double[] array)
{
- String sep = "";
- for(int i = 0; i < array.length; i++)
- {
- System.out.print(sep);
- System.out.print(array[i]);
- sep = ", ";
- }
- System.out.println();
+ String sep = "";
+ for(int i = 0; i < array.length; i++)
+ {
+ System.out.print(sep);
+ System.out.print(array[i]);
+ sep = ", ";
+ }
+ System.out.println();
}
-
+
/**
* @since 1.4
*/
diff --git a/java/awt/GridLayout.java b/java/awt/GridLayout.java
index 65e09aa59..a8b0189de 100644
--- a/java/awt/GridLayout.java
+++ b/java/awt/GridLayout.java
@@ -58,7 +58,7 @@ import java.io.Serializable;
public class GridLayout implements LayoutManager, Serializable
{
static final long serialVersionUID = -7411804673224730901L;
-
+
/** Add a new component to the layout. This particular implementation
* does nothing.
* @param name The name of the component to add.
@@ -154,63 +154,63 @@ public class GridLayout implements LayoutManager, Serializable
{
synchronized (parent.getTreeLock ())
{
- int num = parent.ncomponents;
-
- // There's no point, and handling this would mean adding special
- // cases.
- if (num == 0)
- return;
-
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- int real_rows = rows;
- int real_cols = cols;
- if (real_rows == 0)
- real_rows = (num + real_cols - 1) / real_cols;
- else
- real_cols = (num + real_rows - 1) / real_rows;
-
- // We might have less than a single row. In this case we expand
- // to fill.
- if (num < real_cols)
- real_cols = num;
-
- Dimension d = parent.getSize ();
- Insets ins = parent.getInsets ();
-
- // Compute width and height of each cell in the grid.
- int tw = d.width - ins.left - ins.right;
- tw = (tw - (real_cols - 1) * hgap) / real_cols;
- int th = d.height - ins.top - ins.bottom;
- th = (th - (real_rows - 1) * vgap) / real_rows;
-
- // If the cells are too small, still try to do something.
- if (tw < 0)
- tw = 1;
- if (th < 0)
- th = 1;
-
- int x = ins.left;
- int y = ins.top;
- int i = 0;
- int recount = 0;
-
- while (i < num)
- {
- comps[i].setBounds (x, y, tw, th);
-
- ++i;
- ++recount;
- if (recount == real_cols)
- {
- recount = 0;
- y += vgap + th;
- x = ins.left;
- }
- else
- x += hgap + tw;
- }
+ int num = parent.ncomponents;
+
+ // There's no point, and handling this would mean adding special
+ // cases.
+ if (num == 0)
+ return;
+
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+
+ int real_rows = rows;
+ int real_cols = cols;
+ if (real_rows == 0)
+ real_rows = (num + real_cols - 1) / real_cols;
+ else
+ real_cols = (num + real_rows - 1) / real_rows;
+
+ // We might have less than a single row. In this case we expand
+ // to fill.
+ if (num < real_cols)
+ real_cols = num;
+
+ Dimension d = parent.getSize ();
+ Insets ins = parent.getInsets ();
+
+ // Compute width and height of each cell in the grid.
+ int tw = d.width - ins.left - ins.right;
+ tw = (tw - (real_cols - 1) * hgap) / real_cols;
+ int th = d.height - ins.top - ins.bottom;
+ th = (th - (real_rows - 1) * vgap) / real_rows;
+
+ // If the cells are too small, still try to do something.
+ if (tw < 0)
+ tw = 1;
+ if (th < 0)
+ th = 1;
+
+ int x = ins.left;
+ int y = ins.top;
+ int i = 0;
+ int recount = 0;
+
+ while (i < num)
+ {
+ comps[i].setBounds (x, y, tw, th);
+
+ ++i;
+ ++recount;
+ if (recount == real_cols)
+ {
+ recount = 0;
+ y += vgap + th;
+ x = ins.left;
+ }
+ else
+ x += hgap + tw;
+ }
}
}
@@ -289,9 +289,9 @@ public class GridLayout implements LayoutManager, Serializable
public String toString ()
{
return (getClass ().getName () + "["
- + "hgap=" + hgap + ",vgap=" + vgap
- + ",rows=" + rows + ",cols=" + cols
- + "]");
+ + "hgap=" + hgap + ",vgap=" + vgap
+ + ",rows=" + rows + ",cols=" + cols
+ + "]");
}
// This method is used to compute the various sizes.
@@ -299,36 +299,36 @@ public class GridLayout implements LayoutManager, Serializable
{
synchronized (parent.getTreeLock ())
{
- int w = 0, h = 0, num = parent.ncomponents;
- // This is more efficient than calling getComponents().
- Component[] comps = parent.component;
-
- for (int i = 0; i < num; ++i)
- {
- Dimension d;
-
- if (is_min)
- d = comps[i].getMinimumSize ();
- else
- d = comps[i].getPreferredSize ();
-
- w = Math.max (d.width, w);
- h = Math.max (d.height, h);
- }
-
- int real_rows = rows;
- int real_cols = cols;
- if (real_rows == 0)
- real_rows = (num + real_cols - 1) / real_cols;
- else
- real_cols = (num + real_rows - 1) / real_rows;
-
- Insets ins = parent.getInsets ();
- // We subtract out an extra gap here because the gaps are only
- // between cells.
- w = ins.left + ins.right + real_cols * (w + hgap) - hgap;
- h = ins.top + ins.bottom + real_rows * (h + vgap) - vgap;
- return new Dimension (w, h);
+ int w = 0, h = 0, num = parent.ncomponents;
+ // This is more efficient than calling getComponents().
+ Component[] comps = parent.component;
+
+ for (int i = 0; i < num; ++i)
+ {
+ Dimension d;
+
+ if (is_min)
+ d = comps[i].getMinimumSize ();
+ else
+ d = comps[i].getPreferredSize ();
+
+ w = Math.max (d.width, w);
+ h = Math.max (d.height, h);
+ }
+
+ int real_rows = rows;
+ int real_cols = cols;
+ if (real_rows == 0)
+ real_rows = (num + real_cols - 1) / real_cols;
+ else
+ real_cols = (num + real_rows - 1) / real_rows;
+
+ Insets ins = parent.getInsets ();
+ // We subtract out an extra gap here because the gaps are only
+ // between cells.
+ w = ins.left + ins.right + real_cols * (w + hgap) - hgap;
+ h = ins.top + ins.bottom + real_rows * (h + vgap) - vgap;
+ return new Dimension (w, h);
}
}
diff --git a/java/awt/Image.java b/java/awt/Image.java
index 8a1cc0f00..7b2cee7ae 100644
--- a/java/awt/Image.java
+++ b/java/awt/Image.java
@@ -193,13 +193,13 @@ public abstract class Image
{
case SCALE_AREA_AVERAGING:
case SCALE_SMOOTH:
- filter = new AreaAveragingScaleFilter(width, height);
- break;
+ filter = new AreaAveragingScaleFilter(width, height);
+ break;
case SCALE_DEFAULT:
case SCALE_FAST:
case SCALE_REPLICATE:
default:
- filter = new ReplicateScaleFilter(width, height);
+ filter = new ReplicateScaleFilter(width, height);
}
ImageProducer producer = new FilteredImageSource(getSource(), filter);
@@ -215,7 +215,7 @@ public abstract class Image
/**
* Sets the acceleration priority of the image.
* This is a value from 0 (lowest) to 1 (highest), which may
- * be used as a hint for image acceleration.
+ * be used as a hint for image acceleration.
* E.g. higher priority images may be stored in video memory.
* @param priority - the priority
* @throws IllegalArgumentException if priority is not >= 0 and <= 1.
diff --git a/java/awt/Insets.java b/java/awt/Insets.java
index 762b6975b..1747cae6a 100644
--- a/java/awt/Insets.java
+++ b/java/awt/Insets.java
@@ -45,7 +45,7 @@ import java.io.Serializable;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Eric Blake (ebb9@email.byu.edu)
- * @status
+ * @status
*/
public class Insets implements Cloneable, Serializable
{
diff --git a/java/awt/JobAttributes.java b/java/awt/JobAttributes.java
index 9ffc04878..e84901d33 100644
--- a/java/awt/JobAttributes.java
+++ b/java/awt/JobAttributes.java
@@ -1,4 +1,4 @@
-/* JobAttributes.java --
+/* JobAttributes.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/KeyboardFocusManager.java b/java/awt/KeyboardFocusManager.java
index cd138269e..691351175 100644
--- a/java/awt/KeyboardFocusManager.java
+++ b/java/awt/KeyboardFocusManager.java
@@ -423,7 +423,7 @@ public abstract class KeyboardFocusManager
{
if (focusOwner == null || focusOwner.focusable)
setGlobalObject (currentPermanentFocusOwners, focusOwner,
- "permanentFocusOwner");
+ "permanentFocusOwner");
}
/**
@@ -556,8 +556,8 @@ public abstract class KeyboardFocusManager
* @see #DOWN_CYCLE_TRAVERSAL_KEYS
*/
public void setDefaultFocusTraversalKeys (int id,
- Set<? extends AWTKeyStroke>
- keystrokes)
+ Set<? extends AWTKeyStroke>
+ keystrokes)
{
if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS &&
id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS &&
@@ -668,7 +668,7 @@ public abstract class KeyboardFocusManager
* {@link java.lang.ThreadGroup}) and {@link
* #getGlobalCurrentFocusCycleRoot}. This method does not actually
* make <code>cycleRoot</code> the current focus cycle root.
- *
+ *
* @param cycleRoot the focus cycle root to return from
* getCurrentFocusCycleRoot and getGlobalCurrentFocusCycleRoot
*/
@@ -752,7 +752,7 @@ public abstract class KeyboardFocusManager
* Nothing occurs if a null listener is supplied. null is regarded as a valid property name.
*
* @param name the name of the property to handle change events for.
- * @param l the listener to register for changes to the specified property.
+ * @param l the listener to register for changes to the specified property.
* @see KeyboardFocusManager#addPropertyChangeListener(java.beans.PropertyChangeListener)
*/
public void addPropertyChangeListener(String name, PropertyChangeListener l)
@@ -819,7 +819,7 @@ public abstract class KeyboardFocusManager
*
* Nothing occurs if a null listener is supplied.
*
- * @param l the listener to register.
+ * @param l the listener to register.
* @see KeyboardFocusManager#addVetoableChangeListener(String, java.beans.VetoableChangeListener)
*/
public void addVetoableChangeListener(VetoableChangeListener l)
@@ -870,7 +870,7 @@ public abstract class KeyboardFocusManager
* Nothing occurs if a null listener is supplied. null is regarded as a valid property name.
*
* @param name the name of the property to handle change events for.
- * @param l the listener to register for changes to the specified property.
+ * @param l the listener to register for changes to the specified property.
* @see KeyboardFocusManager#addVetoableChangeListener(java.beans.VetoableChangeListener)
*/
public void addVetoableChangeListener(String name, VetoableChangeListener l)
@@ -1070,7 +1070,7 @@ public abstract class KeyboardFocusManager
* The actual dispatching is performed by calling
* <code>redispatchEvent()</code>. This avoids the infinite recursion
* of dispatch requests which may occur if this method is called on
- * the target component.
+ * the target component.
*
* @param e the event to dispatch.
* @return true if the event was dispatched.
@@ -1087,14 +1087,14 @@ public abstract class KeyboardFocusManager
* within this manager (<code>dispatchEvent()</code>) and
* the key event dispatchers should use this method to handle
* dispatching rather than the dispatch method of the target
- * component.
+ * component.
* <br />
* <br />
* <strong>
* This method is not intended for general consumption, and is
* only for the use of the aforementioned classes.
* </strong>
- *
+ *
* @param target the target component to which the event is
* dispatched.
* @param e the event to dispatch.
@@ -1229,9 +1229,9 @@ public abstract class KeyboardFocusManager
* However, in the case of a <code>Window</code>, the default
* focus component becomes the focus owner and the focus cycle
* root is not changed.
- *
+ *
* @param comp the component used as part of the focus traversal.
- */
+ */
public abstract void upFocusCycle(Component comp);
/**
@@ -1239,10 +1239,10 @@ public abstract class KeyboardFocusManager
* If the supplied container is a focus cycle root, then this
* becomes the current focus cycle root and the focus goes
* to the default component of the specified container.
- * Nothing happens for non-focus cycle root containers.
- *
+ * Nothing happens for non-focus cycle root containers.
+ *
* @param cont the container used as part of the focus traversal.
- */
+ */
public abstract void downFocusCycle(Container cont);
/**
@@ -1433,7 +1433,7 @@ public abstract class KeyboardFocusManager
}
}
-
+
/**
* Maps focus requests from heavyweight to lightweight components.
*/
diff --git a/java/awt/Label.java b/java/awt/Label.java
index 71614da64..1522dac36 100644
--- a/java/awt/Label.java
+++ b/java/awt/Label.java
@@ -1,5 +1,5 @@
/* Label.java -- Java label widget
- Copyright (C) 1999, 2000, 2002, 2004, 2005, 2006, Free Software
+ Copyright (C) 1999, 2000, 2002, 2004, 2005, 2006, Free Software
Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,7 +76,7 @@ public class Label extends Component implements Accessible
/**
* @serial Indicates the alignment of the text within this label's window.
- * This is one of the constants in this class. The default value is
+ * This is one of the constants in this class. The default value is
* <code>LEFT</code>.
*/
private int alignment;
@@ -211,7 +211,7 @@ public class Label extends Component implements Accessible
protected String paramString()
{
return ("text=" + getText() + ",alignment=" +
- getAlignment() + "," + super.paramString());
+ getAlignment() + "," + super.paramString());
}
/**
@@ -280,7 +280,7 @@ public class Label extends Component implements Accessible
{
return "label" + getUniqueLong();
}
-
+
/**
* The number used to generate the name returned by getName.
*/
@@ -292,4 +292,3 @@ public class Label extends Component implements Accessible
}
}
-
diff --git a/java/awt/LightweightDispatcher.java b/java/awt/LightweightDispatcher.java
index 39bdb887d..11b83d8bf 100644
--- a/java/awt/LightweightDispatcher.java
+++ b/java/awt/LightweightDispatcher.java
@@ -101,7 +101,7 @@ final class LightweightDispatcher
{
// Nothing to do here.
}
-
+
/**
* Receives notification if a mouse event passes along the eventqueue.
*
@@ -120,7 +120,7 @@ final class LightweightDispatcher
/**
* Handles all mouse events that are targetted at toplevel containers
* (Window instances) and dispatches them to the correct lightweight child.
- *
+ *
* @param ev the mouse event
* @return whether or not we found a lightweight that handled the event.
*/
diff --git a/java/awt/List.java b/java/awt/List.java
index df8bffa19..dc1199bbc 100644
--- a/java/awt/List.java
+++ b/java/awt/List.java
@@ -65,7 +65,7 @@ public class List extends Component
/**
* The number used to generate the name returned by getName.
*/
- private static transient long next_list_number;
+ private static transient long next_list_number;
// Serialization constant
private static final long serialVersionUID = -3304312411574666869L;
@@ -147,20 +147,20 @@ public class List extends Component
this.rows = 4;
else
this.rows = rows;
-
+
this.multipleMode = multipleMode;
selected = new int[0];
if (GraphicsEnvironment.isHeadless())
throw new HeadlessException();
-
+
}
/**
* Returns the number of items in this list.
*
* @return The number of items in this list.
- *
+ *
* @since 1.1
*/
public int getItemCount()
@@ -185,13 +185,13 @@ public class List extends Component
* Returns the complete list of items.
*
* @return The complete list of items in the list.
- *
+ *
* @since 1.1
*/
public synchronized String[] getItems()
{
String[] l_items = new String[getItemCount()];
-
+
items.copyInto(l_items);
return(l_items);
}
@@ -223,7 +223,7 @@ public class List extends Component
*
* @return <code>true</code> if multi-select mode is enabled,
* <code>false</code> otherwise.
- *
+ *
* @since 1.1
*/
public boolean isMultipleMode()
@@ -237,7 +237,7 @@ public class List extends Component
* @return <code>true</code> if multi-select mode is enabled,
* <code>false</code> otherwise.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>isMultipleMode()</code>.
*/
public boolean allowsMultipleSelections()
@@ -251,7 +251,7 @@ public class List extends Component
*
* @param multipleMode <code>true</code> to enable multiple mode,
* <code>false</code> otherwise.
- *
+ *
* @since 1.1
*/
public void setMultipleMode(boolean multipleMode)
@@ -269,20 +269,20 @@ public class List extends Component
* @deprecated
*/
public void setMultipleSelections(boolean multipleMode)
- {
+ {
this.multipleMode = multipleMode;
ListPeer peer = (ListPeer) getPeer();
if (peer != null)
peer.setMultipleMode(multipleMode);
-
+
}
/**
* Returns the minimum size of this component.
*
* @return The minimum size of this component.
- *
+ *
* @since 1.1
*/
public Dimension getMinimumSize()
@@ -310,7 +310,7 @@ public class List extends Component
* @param rows The number of rows to size for.
*
* @return The minimum size of this component.
- *
+ *
* @since 1.1
*/
public Dimension getMinimumSize(int rows)
@@ -326,7 +326,7 @@ public class List extends Component
*
* @return The minimum size of this component.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>getMinimumSize(int)</code>>
*/
public Dimension minimumSize(int rows)
@@ -342,7 +342,7 @@ public class List extends Component
* Returns the preferred size of this component.
*
* @return The preferred size of this component.
- *
+ *
* @since 1.1
*/
public Dimension getPreferredSize()
@@ -358,7 +358,7 @@ public class List extends Component
* @deprecated This method is deprecated in favor of
* <code>getPreferredSize</code>.
*/
- public Dimension preferredSize()
+ public Dimension preferredSize()
{
return preferredSize(getRows());
}
@@ -370,7 +370,7 @@ public class List extends Component
* @param rows The number of rows to size for.
*
* @return The preferred size of this component.
- *
+ *
* @since 1.1
*/
public Dimension getPreferredSize(int rows)
@@ -386,7 +386,7 @@ public class List extends Component
*
* @return The preferred size of this component.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>getPreferredSize(int)</code>>
*/
public Dimension preferredSize(int rows)
@@ -402,7 +402,7 @@ public class List extends Component
* This method adds the specified item to the end of the list.
*
* @param item The item to add to the list.
- *
+ *
* @since 1.1
*/
public void add(String item)
@@ -430,7 +430,7 @@ public class List extends Component
* @param item The item to add to the list.
* @param index The location in the list to add the item, or -1 to add
* to the end.
- *
+ *
* @since 1.1
*/
public void add(String item, int index)
@@ -452,11 +452,11 @@ public class List extends Component
public void addItem(String item, int index)
{
if (item == null)
- item = "";
-
+ item = "";
+
if (index < -1)
index = -1;
-
+
if ((index == -1) || (index >= items.size ()))
items.addElement (item);
else
@@ -482,11 +482,11 @@ public class List extends Component
if (isSelected(index))
{
selected = true;
- deselect(index);
+ deselect(index);
}
-
+
items.removeElementAt (index);
-
+
if (selected)
select(index);
@@ -501,7 +501,7 @@ public class List extends Component
* @param index The index of the item to delete.
*
* @exception IllegalArgumentException If the index is not valid
- *
+ *
* @since 1.1
*/
public void remove(int index) throws IllegalArgumentException
@@ -519,7 +519,7 @@ public class List extends Component
*
* @deprecated This method is deprecated for some unknown reason.
*/
- public synchronized void delItems(int start, int end)
+ public synchronized void delItems(int start, int end)
throws IllegalArgumentException
{
// We must run the loop in reverse direction.
@@ -538,7 +538,7 @@ public class List extends Component
* @param item The item to delete.
*
* @exception IllegalArgumentException If the specified item does not exist.
- *
+ *
* @since 1.1
*/
public synchronized void remove(String item) throws IllegalArgumentException
@@ -552,7 +552,7 @@ public class List extends Component
/**
* Deletes all of the items from the list.
- *
+ *
* @since 1.1
*/
public synchronized void removeAll()
@@ -562,7 +562,7 @@ public class List extends Component
/**
* Deletes all of the items from the list.
- *
+ *
* @deprecated This method is deprecated in favor of <code>removeAll()</code>.
*/
public void clear()
@@ -572,7 +572,7 @@ public class List extends Component
ListPeer peer = (ListPeer) getPeer();
if (peer != null)
peer.removeAll();
-
+
selected = new int[0];
}
@@ -584,7 +584,7 @@ public class List extends Component
*
* @exception ArrayIndexOutOfBoundsException If the index is not valid.
*/
- public synchronized void replaceItem(String item, int index)
+ public synchronized void replaceItem(String item, int index)
throws ArrayIndexOutOfBoundsException
{
if ((index < 0) || (index >= items.size()))
@@ -598,7 +598,7 @@ public class List extends Component
ListPeer l = (ListPeer) peer;
/* We add first and then remove so that the selected
- item remains the same */
+ item remains the same */
l.add (item, index + 1);
l.delItems (index, index);
}
@@ -620,12 +620,12 @@ public class List extends Component
if (selected == null || selected.length != 1)
return -1;
-
+
return selected[0];
}
/**
- * Returns an array containing the indexes of the rows that are
+ * Returns an array containing the indexes of the rows that are
* currently selected.
*
* @return A list of indexes of selected rows.
@@ -636,13 +636,13 @@ public class List extends Component
{
ListPeer l = (ListPeer) peer;
selected = l.getSelectedIndexes();
- }
-
+ }
+
return selected;
}
/**
- * Returns the item that is currently selected, or <code>null</code> if there
+ * Returns the item that is currently selected, or <code>null</code> if there
* is no item selected. FIXME: What happens if multiple items selected?
*
* @return The selected item, or <code>null</code> if there is no
@@ -703,7 +703,7 @@ public class List extends Component
*
* @return <code>true</code> if the index is selected, <code>false</code>
* otherwise.
- *
+ *
* @since 1.1
*/
public boolean isIndexSelected(int index)
@@ -738,7 +738,7 @@ public class List extends Component
*
* @param index The index of the item to be made visible.
*/
- public synchronized void makeVisible(int index)
+ public synchronized void makeVisible(int index)
throws IllegalArgumentException
{
visibleIndex = index;
@@ -753,7 +753,7 @@ public class List extends Component
* Returns the index of the last item that was made visible via the
* <code>makeVisible()</code> method.
*
- * @return The index of the last item made visible via the
+ * @return The index of the last item made visible via the
* <code>makeVisible()</code> method.
*/
public int getVisibleIndex()
@@ -771,7 +771,7 @@ public class List extends Component
ListPeer lp = (ListPeer) getPeer();
if (lp != null)
lp.select(index);
-
+
if (selected != null)
{
boolean found = false;
@@ -786,14 +786,14 @@ public class List extends Component
{
selected = new int[] { index };
return;
- }
+ }
int[] temp = new int[selected.length + 1];
System.arraycopy(selected, 0, temp, 0, selected.length);
temp[selected.length] = index;
selected = temp;
}
- }
- else
+ }
+ else
{
selected = new int[1];
selected[0] = index;
@@ -820,7 +820,7 @@ public class List extends Component
temp[i] = selected[i];
else
{
- System.arraycopy(selected, i + 1, temp, i,
+ System.arraycopy(selected, i + 1, temp, i,
selected.length - i - 1);
break;
}
@@ -852,7 +852,7 @@ public class List extends Component
* registered listeners for this object.
*
* @param listener The listener to add.
- *
+ *
* @since 1.1
*/
public synchronized void addActionListener(ActionListener listener)
@@ -865,7 +865,7 @@ public class List extends Component
* registers listeners for this object.
*
* @param listener The listener to remove.
- *
+ *
* @since 1.1
*/
public synchronized void removeActionListener(ActionListener listener)
@@ -878,7 +878,7 @@ public class List extends Component
* registered listeners for this object.
*
* @param listener The listener to add.
- *
+ *
* @since 1.1
*/
public synchronized void addItemListener(ItemListener listener)
@@ -891,7 +891,7 @@ public class List extends Component
* registers listeners for this object.
*
* @param listener The listener to remove.
- *
+ *
* @since 1.1
*/
public synchronized void removeItemListener(ItemListener listener)
@@ -908,7 +908,7 @@ public class List extends Component
* superclass method is called to process this event.
*
* @param event The event to process.
- *
+ *
* @since 1.1
*/
protected void processEvent(AWTEvent event)
@@ -929,7 +929,7 @@ public class List extends Component
* the <code>enableEvents()</code> method.
*
* @param event The event to process.
- *
+ *
* @since 1.1
*/
protected void processActionEvent(ActionEvent event)
@@ -946,7 +946,7 @@ public class List extends Component
* the <code>enableEvents()</code> method.
*
* @param event The event to process.
- *
+ *
* @since 1.1
*/
protected void processItemEvent(ItemEvent event)
@@ -959,12 +959,12 @@ public class List extends Component
{
if (e.id <= ItemEvent.ITEM_LAST
&& e.id >= ItemEvent.ITEM_FIRST
- && (item_listeners != null
+ && (item_listeners != null
|| (eventMask & AWTEvent.ITEM_EVENT_MASK) != 0))
processEvent(e);
- else if (e.id <= ActionEvent.ACTION_LAST
- && e.id >= ActionEvent.ACTION_FIRST
- && (action_listeners != null
+ else if (e.id <= ActionEvent.ACTION_LAST
+ && e.id >= ActionEvent.ACTION_FIRST
+ && (action_listeners != null
|| (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
processEvent(e);
else
@@ -983,12 +983,12 @@ public class List extends Component
/**
* Returns an array of all the objects currently registered as FooListeners
- * upon this <code>List</code>. FooListeners are registered using the
+ * upon this <code>List</code>. FooListeners are registered using the
* addFooListener method.
*
* @exception ClassCastException If listenerType doesn't specify a class or
* interface that implements java.util.EventListener.
- *
+ *
* @since 1.3
*/
public <T extends EventListener> T[] getListeners (Class<T> listenerType)
@@ -1004,25 +1004,25 @@ public class List extends Component
/**
* Returns all action listeners registered to this object.
- *
+ *
* @since 1.4
*/
public ActionListener[] getActionListeners ()
{
return (ActionListener[]) getListeners (ActionListener.class);
}
-
+
/**
* Returns all action listeners registered to this object.
- *
+ *
* @since 1.4
*/
public ItemListener[] getItemListeners ()
{
return (ItemListener[]) getListeners (ItemListener.class);
}
-
- // Accessibility internal class
+
+ // Accessibility internal class
protected class AccessibleAWTList extends AccessibleAWTComponent
implements AccessibleSelection, ItemListener, ActionListener
{
@@ -1032,11 +1032,11 @@ public class List extends Component
implements Accessible
{
private static final long serialVersionUID = 4412022926028300317L;
-
+
// Field names are fixed by serialization spec.
private List parent;
private int indexInParent;
-
+
public AccessibleAWTListChild(List parent, int indexInParent)
{
this.parent = parent;
@@ -1044,7 +1044,7 @@ public class List extends Component
if (parent == null)
this.indexInParent = -1;
}
-
+
/* (non-Javadoc)
* @see javax.accessibility.Accessible#getAccessibleContext()
*/
@@ -1052,12 +1052,12 @@ public class List extends Component
{
return this;
}
-
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.LIST_ITEM;
}
-
+
public AccessibleStateSet getAccessibleStateSet()
{
AccessibleStateSet states = super.getAccessibleStateSet();
@@ -1065,25 +1065,25 @@ public class List extends Component
states.add(AccessibleState.SELECTED);
return states;
}
-
+
public int getAccessibleIndexInParent()
{
return indexInParent;
}
}
-
+
public AccessibleAWTList()
{
addItemListener(this);
addActionListener(this);
}
-
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.LIST;
}
-
+
public AccessibleStateSet getAccessibleStateSet()
{
AccessibleStateSet states = super.getAccessibleStateSet();
@@ -1104,7 +1104,7 @@ public class List extends Component
return null;
return new AccessibleAWTListChild(List.this, i);
}
-
+
/* (non-Javadoc)
* @see javax.accessibility.AccessibleSelection#getAccessibleSelectionCount()
*/
@@ -1188,7 +1188,7 @@ public class List extends Component
public void actionPerformed(ActionEvent event)
{
}
-
+
}
/**
@@ -1204,7 +1204,7 @@ public class List extends Component
accessibleContext = new AccessibleAWTList();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>List</code>.
*
diff --git a/java/awt/MediaTracker.java b/java/awt/MediaTracker.java
index 8792e1d23..e69d23e8b 100644
--- a/java/awt/MediaTracker.java
+++ b/java/awt/MediaTracker.java
@@ -52,7 +52,7 @@ import java.util.ArrayList;
* means that you cannot say exactly which media object has which status,
* at most you can say that there <em>are</em> certain media objects with
* some certain status.
- *
+ *
* At the moment only images are supported by this class.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -85,7 +85,7 @@ public class MediaTracker implements java.io.Serializable
* This represents a media object that is tracked by a MediaTracker.
* It also implements a simple linked list.
*/
- // FIXME: The serialized form documentation says MediaEntry is a
+ // FIXME: The serialized form documentation says MediaEntry is a
// serializable field, but the serialized form of MediaEntry itself
// doesn't appear to be documented.
class MediaEntry implements ImageObserver
@@ -107,7 +107,7 @@ public class MediaTracker implements java.io.Serializable
/** The height of the image. */
int height;
-
+
/**
* Receives notification from an {@link java.awt.image.ImageProducer}
* that more data of the image is available.
@@ -125,7 +125,7 @@ public class MediaTracker implements java.io.Serializable
*
* @see java.awt.image.ImageObserver
*/
- public boolean imageUpdate(Image img, int flags, int x, int y,
+ public boolean imageUpdate(Image img, int flags, int x, int y,
int width, int height)
{
if ((flags & ABORT) != 0)
@@ -234,31 +234,31 @@ public class MediaTracker implements java.io.Serializable
{
MediaEntry e = head;
boolean result = true;
-
+
while (e != null)
{
if ((e.status & (COMPLETE | ERRORED | ABORTED)) == 0)
{
if (load && ((e.status & LOADING) == 0))
{
- if (target.prepareImage(e.image, e))
- e.status = COMPLETE;
- else
- {
- e.status = LOADING;
- int flags = target.checkImage(e.image, e);
- if ((flags & ImageObserver.ABORT) != 0)
- e.status = ABORTED;
- else if ((flags & ImageObserver.ERROR) != 0)
- e.status = ERRORED;
- else if ((flags & ImageObserver.ALLBITS) != 0)
- e.status = COMPLETE;
- }
- boolean complete = (e.status
- & (COMPLETE | ABORTED | ERRORED)) != 0;
- if (!complete)
- result = false;
- }
+ if (target.prepareImage(e.image, e))
+ e.status = COMPLETE;
+ else
+ {
+ e.status = LOADING;
+ int flags = target.checkImage(e.image, e);
+ if ((flags & ImageObserver.ABORT) != 0)
+ e.status = ABORTED;
+ else if ((flags & ImageObserver.ERROR) != 0)
+ e.status = ERRORED;
+ else if ((flags & ImageObserver.ALLBITS) != 0)
+ e.status = COMPLETE;
+ }
+ boolean complete = (e.status
+ & (COMPLETE | ABORTED | ERRORED)) != 0;
+ if (!complete)
+ result = false;
+ }
else
result = false;
}
@@ -277,7 +277,7 @@ public class MediaTracker implements java.io.Serializable
*/
public boolean isErrorAny()
{
- MediaEntry e = head;
+ MediaEntry e = head;
while (e != null)
{
if ((e.status & ERRORED) != 0)
@@ -385,16 +385,16 @@ public class MediaTracker implements java.io.Serializable
if (target.prepareImage(e.image, e))
e.status = COMPLETE;
else
- {
+ {
e.status = LOADING;
int flags = target.checkImage(e.image, e);
- if ((flags & ImageObserver.ABORT) != 0)
- e.status = ABORTED;
- else if ((flags & ImageObserver.ERROR) != 0)
- e.status = ERRORED;
- else if ((flags & ImageObserver.ALLBITS) != 0)
- e.status = COMPLETE;
- }
+ if ((flags & ImageObserver.ABORT) != 0)
+ e.status = ABORTED;
+ else if ((flags & ImageObserver.ERROR) != 0)
+ e.status = ERRORED;
+ else if ((flags & ImageObserver.ALLBITS) != 0)
+ e.status = COMPLETE;
+ }
}
result |= e.status;
e = e.next;
@@ -431,7 +431,7 @@ public class MediaTracker implements java.io.Serializable
{
MediaEntry e = head;
boolean result = true;
-
+
while (e != null)
{
if (e.id == id && ((e.status & (COMPLETE | ABORTED | ERRORED)) == 0))
@@ -439,22 +439,22 @@ public class MediaTracker implements java.io.Serializable
if (load && ((e.status & LOADING) == 0))
{
e.status = LOADING;
- if (target.prepareImage(e.image, e))
- e.status = COMPLETE;
- else
- {
- int flags = target.checkImage(e.image, e);
- if ((flags & ImageObserver.ABORT) != 0)
- e.status = ABORTED;
- else if ((flags & ImageObserver.ERROR) != 0)
- e.status = ERRORED;
- else if ((flags & ImageObserver.ALLBITS) != 0)
- e.status = COMPLETE;
- }
- boolean complete = (e.status
- & (COMPLETE | ABORTED | ERRORED)) != 0;
- if (!complete)
- result = false;
+ if (target.prepareImage(e.image, e))
+ e.status = COMPLETE;
+ else
+ {
+ int flags = target.checkImage(e.image, e);
+ if ((flags & ImageObserver.ABORT) != 0)
+ e.status = ABORTED;
+ else if ((flags & ImageObserver.ERROR) != 0)
+ e.status = ERRORED;
+ else if ((flags & ImageObserver.ALLBITS) != 0)
+ e.status = COMPLETE;
+ }
+ boolean complete = (e.status
+ & (COMPLETE | ABORTED | ERRORED)) != 0;
+ if (!complete)
+ result = false;
}
else
result = false;
@@ -475,7 +475,7 @@ public class MediaTracker implements java.io.Serializable
*/
public boolean isErrorID(int id)
{
- MediaEntry e = head;
+ MediaEntry e = head;
while (e != null)
{
if (e.id == id && ((e.status & ERRORED) != 0))
@@ -593,19 +593,19 @@ public class MediaTracker implements java.io.Serializable
{
if (load && e.status == 0)
{
- if (target.prepareImage(e.image, e))
+ if (target.prepareImage(e.image, e))
e.status = COMPLETE;
- else
- {
- e.status = LOADING;
- int flags = target.checkImage(e.image, e);
- if ((flags & ImageObserver.ABORT) != 0)
- e.status = ABORTED;
- else if ((flags & ImageObserver.ERROR) != 0)
- e.status = ERRORED;
- else if ((flags & ImageObserver.ALLBITS) != 0)
- e.status = COMPLETE;
- }
+ else
+ {
+ e.status = LOADING;
+ int flags = target.checkImage(e.image, e);
+ if ((flags & ImageObserver.ABORT) != 0)
+ e.status = ABORTED;
+ else if ((flags & ImageObserver.ERROR) != 0)
+ e.status = ERRORED;
+ else if ((flags & ImageObserver.ALLBITS) != 0)
+ e.status = COMPLETE;
+ }
}
result |= e.status;
}
diff --git a/java/awt/Menu.java b/java/awt/Menu.java
index cef04a38e..c640b5e85 100644
--- a/java/awt/Menu.java
+++ b/java/awt/Menu.java
@@ -163,10 +163,10 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
{
return items.size();
}
-
+
/**
* Returns the item at the specified index.
- *
+ *
* @param index the item index.
*
* @return The item at the specified index.
@@ -240,7 +240,7 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
MenuContainer parent = item.getParent();
if (parent != null)
parent.remove(item);
-
+
items.insertElementAt(item, index);
item.setParent(this);
@@ -263,8 +263,8 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
}
/**
- * Inserts an item with the specified label into this menu at the specified
- * index. If the index is greater than or equal to the number of items
+ * Inserts an item with the specified label into this menu at the specified
+ * index. If the index is greater than or equal to the number of items
* already in the menu, the new item is added as the last item in the menu.
*
* @param label The label of the item to add.
@@ -302,7 +302,7 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
* Deletes the item at the specified index from this menu.
*
* @param index The index of the item to remove.
- *
+ *
* @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
*/
public synchronized void remove(int index)
@@ -391,7 +391,7 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
public String paramString()
{
return (",tearOff=" + tearOff + ",isHelpMenu=" + isHelpMenu
- + super.paramString());
+ + super.paramString());
}
/**
@@ -405,7 +405,7 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
protected AccessibleAWTMenu()
{
}
-
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.MENU;
@@ -425,7 +425,7 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
accessibleContext = new AccessibleAWTMenu();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>Menu</code>.
*
@@ -440,5 +440,5 @@ public class Menu extends MenuItem implements MenuContainer, Serializable
{
return next_menu_number++;
}
-
+
} // class Menu
diff --git a/java/awt/MenuBar.java b/java/awt/MenuBar.java
index 6737d0419..3fc5622ac 100644
--- a/java/awt/MenuBar.java
+++ b/java/awt/MenuBar.java
@@ -67,7 +67,7 @@ public class MenuBar extends MenuComponent
* The number used to generate the name returned by getName.
*/
private static transient long next_menubar_number;
-
+
/**
* @serial The menu used for providing help information
*/
@@ -110,8 +110,8 @@ public class MenuBar extends MenuComponent
if (helpMenu != null)
{
- if (myPeer != null)
- helpMenu.removeNotify();
+ if (myPeer != null)
+ helpMenu.removeNotify();
helpMenu.setParent(null);
}
helpMenu = menu;
@@ -234,8 +234,8 @@ public class MenuBar extends MenuComponent
MenuBarPeer peer = (MenuBarPeer) getPeer();
if (peer == null)
{
- peer = getToolkit().createMenuBar(this);
- setPeer(peer);
+ peer = getToolkit().createMenuBar(this);
+ setPeer(peer);
}
Enumeration e = menus.elements();
@@ -243,7 +243,7 @@ public class MenuBar extends MenuComponent
{
Menu mi = (Menu)e.nextElement();
mi.addNotify();
- peer.addMenu(mi);
+ peer.addMenu(mi);
}
if (helpMenu != null)
@@ -336,7 +336,7 @@ public class MenuBar extends MenuComponent
accessibleContext = new AccessibleAWTMenuBar();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>MenuBar</code>.
*
@@ -360,7 +360,7 @@ public class MenuBar extends MenuComponent
protected class AccessibleAWTMenuBar
extends AccessibleAWTMenuComponent
{
-
+
/**
* Compatible with JDK 1.4.2 revision 5
*/
diff --git a/java/awt/MenuComponent.java b/java/awt/MenuComponent.java
index 163092685..fb0f14eb0 100644
--- a/java/awt/MenuComponent.java
+++ b/java/awt/MenuComponent.java
@@ -53,7 +53,7 @@ import javax.accessibility.AccessibleSelection;
import javax.accessibility.AccessibleStateSet;
/**
- * This is the superclass of all menu AWT widgets.
+ * This is the superclass of all menu AWT widgets.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
@@ -204,7 +204,7 @@ public abstract class MenuComponent implements Serializable
name = generateName();
return name;
}
-
+
/**
* Subclasses should override this to return unique component names like
* "menuitem0".
@@ -230,13 +230,13 @@ public abstract class MenuComponent implements Serializable
/**
* Returns the parent of this component.
- *
+ *
* @return the parent of this component
*/
public MenuContainer getParent()
{
return parent;
- }
+ }
/**
* Sets the parent of this component.
@@ -365,7 +365,7 @@ public abstract class MenuComponent implements Serializable
/**
* Processes the specified event. In this class, this method simply
* calls one of the more specific event handlers.
- *
+ *
* @param event the event to process
*/
protected void processEvent(AWTEvent event)
@@ -505,7 +505,7 @@ public abstract class MenuComponent implements Serializable
* Please note that this method depends on a correctly implemented
* version of the <code>getBounds()</code> method. Subclasses
* must provide the bounding rectangle via <code>getBounds()</code>
- * in order for this method to work.
+ * in order for this method to work.
*
* @param point the point to check against this component
* @return true if the point is within this component
@@ -530,7 +530,7 @@ public abstract class MenuComponent implements Serializable
* As the existence of children can not be determined from
* this abstract class, the implementation of this method
* is left to subclasses.
- *
+ *
* @param point the point at which the returned accessible
* is located
* @return null
@@ -901,7 +901,7 @@ public abstract class MenuComponent implements Serializable
* Please note that this method depends on a correctly implemented
* version of the <code>getBounds()</code> method. Subclasses
* must provide the bounding rectangle via <code>getBounds()</code>
- * in order for this method to work.
+ * in order for this method to work.
*
* @return the location of the component, relative to its parent
*
@@ -940,7 +940,7 @@ public abstract class MenuComponent implements Serializable
* Please note that this method depends on a correctly implemented
* version of the <code>getBounds()</code> method. Subclasses
* must provide the bounding rectangle via <code>getBounds()</code>
- * in order for this method to work.
+ * in order for this method to work.
*
* @return the size of the component
*
@@ -1103,7 +1103,7 @@ public abstract class MenuComponent implements Serializable
* which don't support multiple selections. Concrete implementations should
* override this with a more appopriate and efficient implementation, which
* properly takes into account the ability of the component to support multiple
- * selections.
+ * selections.
*/
public void selectAllAccessibleSelection()
{
@@ -1122,7 +1122,7 @@ public abstract class MenuComponent implements Serializable
* <br />
* This abstract class knows nothing about how the component
* is drawn on screen, so this method simply ignores the supplied
- * color and continues to use the default system color.
+ * color and continues to use the default system color.
* Concrete subclasses which handle the drawing of an onscreen
* menu component should override this method and provide
* the appropriate information.
@@ -1246,7 +1246,7 @@ public abstract class MenuComponent implements Serializable
* Please note that this method depends on a correctly implemented
* version of the <code>getBounds()</code> method. Subclasses
* must provide the bounding rectangle via <code>getBounds()</code>
- * in order for this method to work.
+ * in order for this method to work.
*
* @param point the location of the component, relative to its parent
*
@@ -1264,7 +1264,7 @@ public abstract class MenuComponent implements Serializable
* Please note that this method depends on a correctly implemented
* version of the <code>getBounds()</code> method. Subclasses
* must provide the bounding rectangle via <code>getBounds()</code>
- * in order for this method to work.
+ * in order for this method to work.
*
* @param size the new size of the component
*
diff --git a/java/awt/MenuItem.java b/java/awt/MenuItem.java
index b80ee4c1a..52d0b4ddf 100644
--- a/java/awt/MenuItem.java
+++ b/java/awt/MenuItem.java
@@ -63,7 +63,7 @@ public class MenuItem extends MenuComponent
/*
* Static Variables
*/
-
+
/**
* The number used to generate the name returned by getName.
@@ -121,24 +121,24 @@ private transient ActionListener action_listeners;
{
super();
}
-
-
-
+
+
+
public String getAccessibleName()
{
return label;
}
-
+
public AccessibleAction getAccessibleAction()
{
return this;
}
-
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.MENU_ITEM;
}
-
+
/* (non-Javadoc)
* @see javax.accessibility.AccessibleAction#getAccessibleActionCount()
*/
@@ -153,9 +153,9 @@ private transient ActionListener action_listeners;
public String getAccessibleActionDescription(int i)
{
if (i == 0)
- return label;
+ return label;
else
- return null;
+ return null;
}
/* (non-Javadoc)
@@ -164,7 +164,7 @@ private transient ActionListener action_listeners;
public boolean doAccessibleAction(int i)
{
if (i != 0)
- return false;
+ return false;
processActionEvent(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, actionCommand));
return true;
}
@@ -173,7 +173,7 @@ private transient ActionListener action_listeners;
{
return this;
}
-
+
/* (non-Javadoc)
* @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()
*/
@@ -191,7 +191,7 @@ private transient ActionListener action_listeners;
// this. is required by javac 1.3, otherwise it is confused with
// MenuItem.this.setEnabled.
this.setEnabled(result);
- return result;
+ return result;
}
/* (non-Javadoc)
@@ -209,7 +209,7 @@ private transient ActionListener action_listeners;
{
return new Integer(0);
}
-
+
}
@@ -236,7 +236,7 @@ MenuItem()
*
* @param label The label for this menu item.
*/
-public
+public
MenuItem(String label)
{
this.label = label;
@@ -311,7 +311,7 @@ isEnabled()
/**
* Sets the enabled status of this menu item.
- *
+ *
* @param enabled <code>true</code> to enable this menu item,
* <code>false</code> otherwise.
*/
@@ -325,7 +325,7 @@ setEnabled(boolean enabled)
/**
* Sets the enabled status of this menu item.
- *
+ *
* @param enabled <code>true</code> to enable this menu item,
* <code>false</code> otherwise.
*
@@ -449,7 +449,7 @@ setActionCommand(String actionCommand)
/*************************************************************************/
/**
- * Enables the specified events. This is done automatically when a
+ * Enables the specified events. This is done automatically when a
* listener is added and does not normally need to be done by
* application code.
*
@@ -460,7 +460,7 @@ protected final void
enableEvents(long events)
{
eventMask |= events;
- // TODO: see comment in Component.enableEvents().
+ // TODO: see comment in Component.enableEvents().
}
/*************************************************************************/
@@ -518,10 +518,10 @@ removeActionListener(ActionListener l)
ActionListener.class);
}
-/** Returns all registered EventListers of the given listenerType.
- * listenerType must be a subclass of EventListener, or a
+/** Returns all registered EventListers of the given listenerType.
+ * listenerType must be a subclass of EventListener, or a
* ClassClassException is thrown.
- * @since 1.3
+ * @since 1.3
*/
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
{
@@ -535,10 +535,10 @@ removeActionListener(ActionListener l)
void
dispatchEventImpl(AWTEvent e)
{
- if (e.id <= ActionEvent.ACTION_LAST
+ if (e.id <= ActionEvent.ACTION_LAST
&& e.id >= ActionEvent.ACTION_FIRST
&& (action_listeners != null
- || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
+ || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
processEvent(e);
// Send the event to the parent menu if it has not yet been
@@ -588,7 +588,7 @@ public String
paramString()
{
return ("label=" + label + ",enabled=" + enabled +
- ",actionCommand=" + actionCommand + "," + super.paramString());
+ ",actionCommand=" + actionCommand + "," + super.paramString());
}
/**
@@ -620,4 +620,4 @@ private static synchronized long getUniqueLong()
return next_menuitem_number++;
}
-} // class MenuItem
+} // class MenuItem
diff --git a/java/awt/MenuShortcut.java b/java/awt/MenuShortcut.java
index 5216d3474..4939438f1 100644
--- a/java/awt/MenuShortcut.java
+++ b/java/awt/MenuShortcut.java
@@ -170,7 +170,7 @@ equals(Object obj)
{
MenuShortcut ms = (MenuShortcut) obj;
return (ms.key == key && ms.usesShift == usesShift);
- }
+ }
return false;
}
@@ -211,7 +211,7 @@ paramString()
return "key=" + key + ",usesShift=" + usesShift;
}
-private void
+private void
setKeyName(int key)
{
if (key == '\n')
diff --git a/java/awt/MouseInfo.java b/java/awt/MouseInfo.java
index 8a853e153..62d7d3068 100644
--- a/java/awt/MouseInfo.java
+++ b/java/awt/MouseInfo.java
@@ -81,7 +81,7 @@ public class MouseInfo
GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().
getScreenDevices();
-
+
return new PointerInfo( gds[ screen ], p );
}
@@ -99,4 +99,4 @@ public class MouseInfo
return ((ClasspathToolkit)Toolkit.getDefaultToolkit()).
getMouseNumberOfButtons();
}
-}
+}
diff --git a/java/awt/PageAttributes.java b/java/awt/PageAttributes.java
index 38fb696e3..825d0feb3 100644
--- a/java/awt/PageAttributes.java
+++ b/java/awt/PageAttributes.java
@@ -1,4 +1,4 @@
-/* PageAttributes.java --
+/* PageAttributes.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -265,7 +265,7 @@ public final class PageAttributes implements Cloneable
}
} // class PrintQualityType
-
+
private ColorType color;
private MediaType media;
private OrientationRequestedType orientation;
diff --git a/java/awt/Point.java b/java/awt/Point.java
index 64bc07eaf..871202491 100644
--- a/java/awt/Point.java
+++ b/java/awt/Point.java
@@ -178,7 +178,7 @@ public class Point extends Point2D implements Serializable
/**
* Sets this object's coordinates to the specified values. This method
- * rounds to the nearest integer coordinates by adding 0.5 and calling
+ * rounds to the nearest integer coordinates by adding 0.5 and calling
* {@link Math#floor(double)}.
*
* @param x the new X coordinate
diff --git a/java/awt/PointerInfo.java b/java/awt/PointerInfo.java
index 14d44a69b..2bbd97677 100644
--- a/java/awt/PointerInfo.java
+++ b/java/awt/PointerInfo.java
@@ -81,4 +81,4 @@ public class PointerInfo
{
return p;
}
-}
+}
diff --git a/java/awt/Polygon.java b/java/awt/Polygon.java
index 403c336cd..03e91f8bd 100644
--- a/java/awt/Polygon.java
+++ b/java/awt/Polygon.java
@@ -175,13 +175,13 @@ public class Polygon implements Shape, Serializable
int i = npoints;
while (--i >= 0)
{
- xpoints[i] += dx;
- ypoints[i] += dy;
+ xpoints[i] += dx;
+ ypoints[i] += dy;
}
if (bounds != null)
{
- bounds.x += dx;
- bounds.y += dy;
+ bounds.x += dx;
+ bounds.y += dy;
}
}
@@ -196,43 +196,43 @@ public class Polygon implements Shape, Serializable
{
if (npoints + 1 > xpoints.length)
{
- int[] newx = new int[npoints + 1];
- System.arraycopy(xpoints, 0, newx, 0, npoints);
- xpoints = newx;
+ int[] newx = new int[npoints + 1];
+ System.arraycopy(xpoints, 0, newx, 0, npoints);
+ xpoints = newx;
}
if (npoints + 1 > ypoints.length)
{
- int[] newy = new int[npoints + 1];
- System.arraycopy(ypoints, 0, newy, 0, npoints);
- ypoints = newy;
+ int[] newy = new int[npoints + 1];
+ System.arraycopy(ypoints, 0, newy, 0, npoints);
+ ypoints = newy;
}
xpoints[npoints] = x;
ypoints[npoints] = y;
npoints++;
if (bounds != null)
{
- if (npoints == 1)
- {
- bounds.x = x;
- bounds.y = y;
- }
- else
- {
- if (x < bounds.x)
- {
- bounds.width += bounds.x - x;
- bounds.x = x;
- }
- else if (x > bounds.x + bounds.width)
- bounds.width = x - bounds.x;
- if (y < bounds.y)
- {
- bounds.height += bounds.y - y;
- bounds.y = y;
- }
- else if (y > bounds.y + bounds.height)
- bounds.height = y - bounds.y;
- }
+ if (npoints == 1)
+ {
+ bounds.x = x;
+ bounds.y = y;
+ }
+ else
+ {
+ if (x < bounds.x)
+ {
+ bounds.width += bounds.x - x;
+ bounds.x = x;
+ }
+ else if (x > bounds.x + bounds.width)
+ bounds.width = x - bounds.x;
+ if (y < bounds.y)
+ {
+ bounds.height += bounds.y - y;
+ bounds.y = y;
+ }
+ else if (y > bounds.y + bounds.height)
+ bounds.height = y - bounds.y;
+ }
}
}
@@ -263,27 +263,27 @@ public class Polygon implements Shape, Serializable
{
if (bounds == null)
{
- if (npoints == 0)
- return bounds = new Rectangle();
- int i = npoints - 1;
- int minx = xpoints[i];
- int maxx = minx;
- int miny = ypoints[i];
- int maxy = miny;
- while (--i >= 0)
- {
- int x = xpoints[i];
- int y = ypoints[i];
- if (x < minx)
- minx = x;
- else if (x > maxx)
- maxx = x;
- if (y < miny)
- miny = y;
- else if (y > maxy)
- maxy = y;
- }
- bounds = new Rectangle(minx, miny, maxx - minx, maxy - miny);
+ if (npoints == 0)
+ return bounds = new Rectangle();
+ int i = npoints - 1;
+ int minx = xpoints[i];
+ int maxx = minx;
+ int miny = ypoints[i];
+ int maxy = miny;
+ while (--i >= 0)
+ {
+ int x = xpoints[i];
+ int y = ypoints[i];
+ if (x < minx)
+ minx = x;
+ else if (x > maxx)
+ maxx = x;
+ if (y < miny)
+ miny = y;
+ else if (y > maxy)
+ maxy = y;
+ }
+ bounds = new Rectangle(minx, miny, maxx - minx, maxy - miny);
}
return bounds;
}
@@ -476,45 +476,45 @@ public class Polygon implements Shape, Serializable
{
return new PathIterator()
{
- /** The current vertex of iteration. */
- private int vertex;
-
- public int getWindingRule()
- {
- return WIND_EVEN_ODD;
- }
-
- public boolean isDone()
- {
- return vertex > npoints;
- }
-
- public void next()
- {
- vertex++;
- }
-
- public int currentSegment(float[] coords)
- {
- if (vertex >= npoints)
- return SEG_CLOSE;
- coords[0] = xpoints[vertex];
- coords[1] = ypoints[vertex];
- if (transform != null)
- transform.transform(coords, 0, coords, 0, 1);
- return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
- }
-
- public int currentSegment(double[] coords)
- {
- if (vertex >= npoints)
- return SEG_CLOSE;
- coords[0] = xpoints[vertex];
- coords[1] = ypoints[vertex];
- if (transform != null)
- transform.transform(coords, 0, coords, 0, 1);
- return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
- }
+ /** The current vertex of iteration. */
+ private int vertex;
+
+ public int getWindingRule()
+ {
+ return WIND_EVEN_ODD;
+ }
+
+ public boolean isDone()
+ {
+ return vertex > npoints;
+ }
+
+ public void next()
+ {
+ vertex++;
+ }
+
+ public int currentSegment(float[] coords)
+ {
+ if (vertex >= npoints)
+ return SEG_CLOSE;
+ coords[0] = xpoints[vertex];
+ coords[1] = ypoints[vertex];
+ if (transform != null)
+ transform.transform(coords, 0, coords, 0, 1);
+ return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
+ }
+
+ public int currentSegment(double[] coords)
+ {
+ if (vertex >= npoints)
+ return SEG_CLOSE;
+ coords[0] = xpoints[vertex];
+ coords[1] = ypoints[vertex];
+ if (transform != null)
+ transform.transform(coords, 0, coords, 0, 1);
+ return vertex == 0 ? SEG_MOVETO : SEG_LINETO;
+ }
};
}
@@ -560,17 +560,17 @@ public class Polygon implements Shape, Serializable
if (useYaxis)
{
- xp = ypoints;
- yp = xpoints;
- double swap;
- swap = y;
- y = x;
- x = swap;
+ xp = ypoints;
+ yp = xpoints;
+ double swap;
+ swap = y;
+ y = x;
+ x = swap;
}
else
{
- xp = xpoints;
- yp = ypoints;
+ xp = xpoints;
+ yp = ypoints;
}
/* Get a value which is small but not insignificant relative the path. */
@@ -580,19 +580,19 @@ public class Polygon implements Shape, Serializable
y0 = yp[0] - y;
for (int i = 1; i < npoints; i++)
{
- x1 = xp[i] - x;
- y1 = yp[i] - y;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (y0 * y1 < 0)
- if (Line2D.linesIntersect(x0, y0, x1, y1, epsilon, 0.0, distance, 0.0))
- ++crossings;
-
- x0 = xp[i] - x;
- y0 = yp[i] - y;
+ x1 = xp[i] - x;
+ y1 = yp[i] - y;
+
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y1 == 0.0)
+ y1 -= epsilon;
+ if (y0 * y1 < 0)
+ if (Line2D.linesIntersect(x0, y0, x1, y1, epsilon, 0.0, distance, 0.0))
+ ++crossings;
+
+ x0 = xp[i] - x;
+ y0 = yp[i] - y;
}
// end segment
@@ -604,9 +604,8 @@ public class Polygon implements Shape, Serializable
y1 -= epsilon;
if (y0 * y1 < 0)
if (Line2D.linesIntersect(x0, y0, x1, y1, epsilon, 0.0, distance, 0.0))
- ++crossings;
+ ++crossings;
return crossings;
}
} // class Polygon
-
diff --git a/java/awt/PopupMenu.java b/java/awt/PopupMenu.java
index 926867802..8595300f1 100644
--- a/java/awt/PopupMenu.java
+++ b/java/awt/PopupMenu.java
@@ -150,14 +150,14 @@ show(Component component, int x, int y)
protected AccessibleAWTPopupMenu()
{
}
-
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.POPUP_MENU;
}
-
+
}
-
+
/**
* Gets the AccessibleContext associated with this <code>PopupMenu</code>.
* The context is created, if necessary.
@@ -171,7 +171,7 @@ show(Component component, int x, int y)
accessibleContext = new AccessibleAWTPopupMenu();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>PopupMenu</code>.
*
@@ -188,4 +188,3 @@ show(Component component, int x, int y)
}
} // class PopupMenu
-
diff --git a/java/awt/Rectangle.java b/java/awt/Rectangle.java
index ac2494ee0..1d5a8da07 100644
--- a/java/awt/Rectangle.java
+++ b/java/awt/Rectangle.java
@@ -183,7 +183,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
* @param p the upper left corner of the rectangle
*/
public Rectangle(Point p)
- {
+ {
x = p.x;
y = p.y;
}
@@ -196,7 +196,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
* @param d the width and height of the rectangle
*/
public Rectangle(Dimension d)
- {
+ {
width = d.width;
height = d.height;
}
@@ -299,7 +299,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
/**
* Updates this rectangle to have the specified dimensions, rounded to the
* integer precision used by this class (the values are rounded "outwards" so
- * that the stored rectangle completely encloses the specified double
+ * that the stored rectangle completely encloses the specified double
* precision rectangle).
*
* @param x the new X coordinate of the upper left hand corner
diff --git a/java/awt/RenderingHints.java b/java/awt/RenderingHints.java
index e98a00c5b..5de6a608f 100644
--- a/java/awt/RenderingHints.java
+++ b/java/awt/RenderingHints.java
@@ -46,7 +46,7 @@ import java.util.Map;
import java.util.Set;
/**
- * A collection of (key, value) items that provide 'hints' for the
+ * A collection of (key, value) items that provide 'hints' for the
* {@link java.awt.Graphics2D} rendering pipeline. Because these
* items are hints only, they may be ignored by a particular
* {@link java.awt.Graphics2D} implementation.
@@ -66,7 +66,7 @@ public class RenderingHints
/**
* Creates a new key.
- *
+ *
* @param privateKey the private key.
*/
protected Key(int privateKey)
@@ -77,16 +77,16 @@ public class RenderingHints
/**
* Returns <code>true</code> if the specified value is compatible with
* this key, and <code>false</code> otherwise.
- *
+ *
* @param value the value (<code>null</code> permitted).
- *
+ *
* @return A boolean.
*/
public abstract boolean isCompatibleValue(Object value);
/**
* Returns the private key for this instance.
- *
+ *
* @return The private key.
*/
protected final int intKey()
@@ -96,7 +96,7 @@ public class RenderingHints
/**
* Returns a hash code for the key.
- *
+ *
* @return A hash code.
*/
public final int hashCode()
@@ -106,9 +106,9 @@ public class RenderingHints
/**
* Checks this key for equality with an arbitrary object.
- *
+ *
* @param other the object (<code>null</code> permitted)
- *
+ *
* @return A boolean.
*/
public final boolean equals(Object other)
@@ -137,9 +137,9 @@ public class RenderingHints
/**
* Returns <code>true</code> if the specified value is compatible with
* this key, and <code>false</code> otherwise.
- *
+ *
* @param value the value (<code>null</code> permitted).
- *
+ *
* @return A boolean.
*/
public boolean isCompatibleValue(Object value)
@@ -149,7 +149,7 @@ public class RenderingHints
/**
* Returns a string representation of the key.
- *
+ *
* @return A string.
*/
public String toString()
@@ -547,8 +547,8 @@ public class RenderingHints
/**
* Creates a new collection of hints containing all the (key, value) pairs
* in the specified map.
- *
- * @param init a map containing a collection of hints (<code>null</code>
+ *
+ * @param init a map containing a collection of hints (<code>null</code>
* permitted).
*/
public RenderingHints(Map<Key,?> init)
@@ -559,7 +559,7 @@ public class RenderingHints
/**
* Creates a new collection containing a single (key, value) pair.
- *
+ *
* @param key the key.
* @param value the value.
*/
@@ -570,7 +570,7 @@ public class RenderingHints
/**
* Returns the number of hints in the collection.
- *
+ *
* @return The number of hints.
*/
public int size()
@@ -581,7 +581,7 @@ public class RenderingHints
/**
* Returns <code>true</code> if there are no hints in the collection,
* and <code>false</code> otherwise.
- *
+ *
* @return A boolean.
*/
public boolean isEmpty()
@@ -592,11 +592,11 @@ public class RenderingHints
/**
* Returns <code>true</code> if the collection of hints contains the
* specified key, and <code>false</code> otherwise.
- *
+ *
* @param key the key (<code>null</code> not permitted).
- *
+ *
* @return A boolean.
- *
+ *
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws ClassCastException if <code>key</code> is not a {@link Key}.
*/
@@ -611,9 +611,9 @@ public class RenderingHints
/**
* Returns <code>true</code> if the collection of hints contains the
* specified value, and <code>false</code> otherwise.
- *
+ *
* @param value the value.
- *
+ *
* @return A boolean.
*/
public boolean containsValue(Object value)
@@ -624,13 +624,13 @@ public class RenderingHints
/**
* Returns the value associated with the specified key, or <code>null</code>
* if there is no value defined for the key.
- *
+ *
* @param key the key (<code>null</code> permitted).
- *
+ *
* @return The value (possibly <code>null</code>).
- *
+ *
* @throws ClassCastException if <code>key</code> is not a {@link Key}.
- *
+ *
* @see #containsKey(Object)
*/
public Object get(Object key)
@@ -641,12 +641,12 @@ public class RenderingHints
/**
* Adds a (key, value) pair to the collection of hints (if the
- * collection already contains the specified key, then the
+ * collection already contains the specified key, then the
* value is updated).
- *
+ *
* @param key the key.
* @param value the value.
- *
+ *
* @return the previous value of the key or <code>null</code> if the key
* didn't have a value yet.
*/
@@ -661,7 +661,7 @@ public class RenderingHints
/**
* Adds all the hints from a collection to this collection.
- *
+ *
* @param hints the hint collection.
*/
public void add(RenderingHints hints)
@@ -679,27 +679,27 @@ public class RenderingHints
/**
* Removes a hint from the collection.
- *
+ *
* @param key the key.
- *
- * @return The value that was associated with the key, or <code>null</code> if
+ *
+ * @return The value that was associated with the key, or <code>null</code> if
* the key was not part of the collection
- *
- * @throws ClassCastException if the key is not a subclass of
+ *
+ * @throws ClassCastException if the key is not a subclass of
* {@link RenderingHints.Key}.
*/
public Object remove(Object key)
{
// don't remove the (Key) cast, it is necessary to throw the exception
// required by the spec
- return hintMap.remove((Key) key);
+ return hintMap.remove((Key) key);
}
/**
* Adds a collection of (key, value) pairs to the collection.
- *
+ *
* @param m a map containing (key, value) items.
- *
+ *
* @throws ClassCastException if the map contains a key that is not
* a subclass of {@link RenderingHints.Key}.
* @throws IllegalArgumentException if the map contains a value that is
@@ -721,7 +721,7 @@ public class RenderingHints
/**
* Returns a set containing the keys from this collection.
- *
+ *
* @return A set of keys.
*/
public Set<Object> keySet()
@@ -731,9 +731,9 @@ public class RenderingHints
/**
* Returns a collection of the values from this hint collection. The
- * collection is backed by the <code>RenderingHints</code> instance,
+ * collection is backed by the <code>RenderingHints</code> instance,
* so updates to one will affect the other.
- *
+ *
* @return A collection of values.
*/
public Collection<Object> values()
@@ -743,7 +743,7 @@ public class RenderingHints
/**
* Returns a set of entries from the collection.
- *
+ *
* @return A set of entries.
*/
public Set<Map.Entry<Object,Object>> entrySet()
@@ -753,9 +753,9 @@ public class RenderingHints
/**
* Checks this collection for equality with an arbitrary object.
- *
+ *
* @param o the object (<code>null</code> permitted)
- *
+ *
* @return A boolean.
*/
public boolean equals(Object o)
@@ -765,7 +765,7 @@ public class RenderingHints
/**
* Returns a hash code for the collection of hints.
- *
+ *
* @return A hash code.
*/
public int hashCode()
@@ -775,7 +775,7 @@ public class RenderingHints
/**
* Creates a clone of this instance.
- *
+ *
* @return A clone.
*/
public Object clone()
@@ -794,7 +794,7 @@ public class RenderingHints
/**
* Returns a string representation of this instance.
- *
+ *
* @return A string.
*/
public String toString()
diff --git a/java/awt/Robot.java b/java/awt/Robot.java
index 485a14e1e..30de5ca84 100644
--- a/java/awt/Robot.java
+++ b/java/awt/Robot.java
@@ -92,7 +92,7 @@ public class Robot
// createRobot will throw AWTException if XTest is not supported.
peer = tk.createRobot (GraphicsEnvironment.getLocalGraphicsEnvironment ()
- .getDefaultScreenDevice ());
+ .getDefaultScreenDevice ());
}
/**
@@ -113,7 +113,7 @@ public class Robot
if (screen.getType () != GraphicsDevice.TYPE_RASTER_SCREEN)
throw new IllegalArgumentException ("Robot: graphics"
- + " device is not a screen");
+ + " device is not a screen");
SecurityManager sm = System.getSecurityManager ();
if (sm != null)
@@ -159,10 +159,10 @@ public class Robot
public void mousePress (int buttons)
{
if ((buttons & InputEvent.BUTTON1_MASK) == 0
- && (buttons & InputEvent.BUTTON2_MASK) == 0
- && (buttons & InputEvent.BUTTON3_MASK) == 0)
+ && (buttons & InputEvent.BUTTON2_MASK) == 0
+ && (buttons & InputEvent.BUTTON3_MASK) == 0)
throw new IllegalArgumentException ("Robot: mousePress:"
- + " invalid button mask");
+ + " invalid button mask");
peer.mousePress (buttons);
@@ -190,10 +190,10 @@ public class Robot
public void mouseRelease(int buttons)
{
if ((buttons & InputEvent.BUTTON1_MASK) == 0
- && (buttons & InputEvent.BUTTON2_MASK) == 0
- && (buttons & InputEvent.BUTTON3_MASK) == 0)
+ && (buttons & InputEvent.BUTTON2_MASK) == 0
+ && (buttons & InputEvent.BUTTON3_MASK) == 0)
throw new IllegalArgumentException ("Robot: mouseRelease:"
- + " invalid button mask");
+ + " invalid button mask");
peer.mouseRelease (buttons);
@@ -245,7 +245,7 @@ public class Robot
/**
* Release a key.
*
- * @param keycode key to release, a {@link java.awt.event.KeyEvent} VK_
+ * @param keycode key to release, a {@link java.awt.event.KeyEvent} VK_
* constant
*
* @exception IllegalArgumentException if keycode is not a valid key
@@ -304,10 +304,10 @@ public class Robot
BufferedImage bufferedImage =
new BufferedImage (screenRect.width, screenRect.height,
- BufferedImage.TYPE_INT_ARGB);
+ BufferedImage.TYPE_INT_ARGB);
bufferedImage.setRGB (0, 0, screenRect.width, screenRect.height,
- pixels, 0, screenRect.width);
+ pixels, 0, screenRect.width);
return bufferedImage;
}
@@ -377,11 +377,11 @@ public class Robot
try
{
- Thread.sleep (ms);
+ Thread.sleep (ms);
}
catch (InterruptedException e)
{
- System.err.println ("Robot: delay interrupted");
+ System.err.println ("Robot: delay interrupted");
}
}
@@ -393,19 +393,19 @@ public class Robot
{
if (EventQueue.isDispatchThread ())
throw new IllegalThreadStateException ("Robot: waitForIdle called from "
- + "the event dispatch thread");
+ + "the event dispatch thread");
try
{
- EventQueue.invokeAndWait (new Runnable () { public void run () { } });
+ EventQueue.invokeAndWait (new Runnable () { public void run () { } });
}
catch (InterruptedException e)
{
- System.err.println ("Robot: waitForIdle interrupted");
+ System.err.println ("Robot: waitForIdle interrupted");
}
catch (InvocationTargetException e)
{
- System.err.println ("Robot: waitForIdle cannot invoke target");
+ System.err.println ("Robot: waitForIdle cannot invoke target");
}
}
@@ -417,7 +417,7 @@ public class Robot
public String toString ()
{
return getClass ().getName ()
- + "[ autoDelay = " + autoDelay + ", autoWaitForIdle = "
- + waitForIdle + " ]";
+ + "[ autoDelay = " + autoDelay + ", autoWaitForIdle = "
+ + waitForIdle + " ]";
}
}
diff --git a/java/awt/ScrollPane.java b/java/awt/ScrollPane.java
index ec9746f93..14d15f648 100644
--- a/java/awt/ScrollPane.java
+++ b/java/awt/ScrollPane.java
@@ -48,7 +48,7 @@ import javax.accessibility.AccessibleRole;
/**
- * This widget provides a scrollable region that allows a single
+ * This widget provides a scrollable region that allows a single
* subcomponent to be viewed through a smaller window.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -227,7 +227,7 @@ getVAdjustable()
* @return The viewport size.
*/
public Dimension getViewportSize ()
-{
+{
Dimension viewsize = getSize ();
Insets insets = getInsets ();
@@ -237,9 +237,9 @@ public Dimension getViewportSize ()
Component[] list = getComponents();
if ((list == null) || (list.length <= 0))
return viewsize;
-
+
Dimension dim = list[0].getPreferredSize();
-
+
if (dim.width <= 0 && dim.height <= 0)
return viewsize;
@@ -282,7 +282,7 @@ public Dimension getViewportSize ()
needHorizontal = true;
else if (dim.width > (viewsize.width - vScrollbarWidth))
mayNeedHorizontal = true;
-
+
if (needVertical && mayNeedHorizontal)
needHorizontal = true;
@@ -294,7 +294,7 @@ public Dimension getViewportSize ()
if (needVertical)
viewsize.width -= vScrollbarWidth;
-
+
return viewsize;
}
@@ -338,7 +338,7 @@ getVScrollbarWidth()
* Returns the current scroll position of the viewport.
*
* @return The current scroll position of the viewport.
- *
+ *
* @throws NullPointerException if the scrollpane does have a child.
*/
public Point
@@ -346,7 +346,7 @@ getScrollPosition()
{
if (getComponentCount() == 0)
throw new NullPointerException();
-
+
int x = 0;
int y = 0;
@@ -386,7 +386,7 @@ setScrollPosition(Point scrollPosition) throws IllegalArgumentException
* @param y The new Y coordinate of the scroll position.
*
* @throws NullPointerException if scrollpane does not have a child.
- *
+ *
* @exception IllegalArgumentException If the specified value is outside
* the legal scrolling range.
*/
@@ -405,15 +405,15 @@ setScrollPosition(int x, int y)
x = 0;
if (y < 0)
y = 0;
-
+
Adjustable h = getHAdjustable();
Adjustable v = getVAdjustable();
-
+
if (h != null)
h.setValue(x);
if (v != null)
v.setValue(y);
-
+
ScrollPanePeer spp = (ScrollPanePeer)getPeer();
if (spp != null)
spp.setScrollPosition(x, y);
@@ -457,7 +457,7 @@ removeNotify()
/*************************************************************************/
/**
- * Adds the specified child component to this container. A
+ * Adds the specified child component to this container. A
* <code>ScrollPane</code> can have at most one child, so if a second
* one is added, then first one is removed.
*
@@ -467,7 +467,7 @@ removeNotify()
* in this implementation.
*/
protected final void addImpl (Component component, Object constraints,
- int index)
+ int index)
{
Component[] list = getComponents();
if ((list != null) && (list.length > 0))
@@ -507,14 +507,14 @@ layout()
Dimension vp = getViewportSize ();
if (dim.width < vp.width)
- dim.width = vp.width;
+ dim.width = vp.width;
if (dim.height < vp.height)
- dim.height = vp.height;
+ dim.height = vp.height;
ScrollPanePeer peer = (ScrollPanePeer) getPeer ();
if (peer != null)
- peer.childResized (dim.width, dim.height);
+ peer.childResized (dim.width, dim.height);
list[0].setSize (dim);
@@ -525,7 +525,7 @@ layout()
p.y = dim.height;
setScrollPosition (p);
-
+
list[0].setLocation(new Point());
}
}
@@ -538,7 +538,7 @@ layout()
* not have layout managers.
*
* @param layoutManager Ignored
- * @throws AWTError Always throws this error when called.
+ * @throws AWTError Always throws this error when called.
*/
public final void
setLayout(LayoutManager layoutManager)
@@ -575,7 +575,7 @@ paramString()
+ getY() + ","
+ getWidth() + "x" + getHeight() + ","
+ getIsValidString() + ","
- + "ScrollPosition=(" + scrollPosition.x + ","
+ + "ScrollPosition=(" + scrollPosition.x + ","
+ scrollPosition.y + "),"
+ "Insets=(" + insets.top + ","
+ insets.left + ","
@@ -596,7 +596,7 @@ getScrollbarDisplayPolicyString()
return "never";
}
-private String
+private String
getIsValidString()
{
if (isValid())
@@ -637,7 +637,7 @@ getIsValidString()
{
wheelScrollingEnabled = enable;
}
-
+
protected class AccessibleAWTScrollPane extends AccessibleAWTContainer
{
private static final long serialVersionUID = 6100703663886637L;
@@ -661,7 +661,7 @@ getIsValidString()
accessibleContext = new AccessibleAWTScrollPane();
return accessibleContext;
}
-
+
/**
* Generate a unique name for this <code>ScrollPane</code>.
*
@@ -676,6 +676,5 @@ getIsValidString()
{
return next_scrollpane_number++;
}
-
-} // class ScrollPane
+} // class ScrollPane
diff --git a/java/awt/ScrollPaneAdjustable.java b/java/awt/ScrollPaneAdjustable.java
index ca61801bf..0f2986d59 100644
--- a/java/awt/ScrollPaneAdjustable.java
+++ b/java/awt/ScrollPaneAdjustable.java
@@ -52,7 +52,7 @@ public class ScrollPaneAdjustable
implements Adjustable, Serializable
{
private static final long serialVersionUID = -3359745691033257079L;
-
+
ScrollPane sp;
int orientation;
int value;
@@ -70,7 +70,7 @@ public class ScrollPaneAdjustable
this.sp = sp;
this.orientation = orientation;
}
-
+
ScrollPaneAdjustable (ScrollPane sp, int orientation, int value, int minimum,
int maximum, int visibleAmount, int unitIncrement,
int blockIncrement)
@@ -84,21 +84,21 @@ public class ScrollPaneAdjustable
this.unitIncrement = unitIncrement;
this.blockIncrement = blockIncrement;
}
-
+
public void addAdjustmentListener (AdjustmentListener listener)
{
if (listener == null)
return;
adjustmentListener = AWTEventMulticaster.add (adjustmentListener, listener);
}
-
+
public void removeAdjustmentListener (AdjustmentListener listener)
{
if (listener == null)
return;
adjustmentListener = AWTEventMulticaster.remove (adjustmentListener, listener);
}
-
+
public AdjustmentListener[] getAdjustmentListeners ()
{
return (AdjustmentListener[]) AWTEventMulticaster.getListeners
@@ -129,7 +129,7 @@ public class ScrollPaneAdjustable
{
return unitIncrement;
}
-
+
public int getValue ()
{
return value;
@@ -144,10 +144,10 @@ public class ScrollPaneAdjustable
{
this.blockIncrement = blockIncrement;
}
-
+
/**
* This method should never be called.
- *
+ *
* @param maximum The maximum value to be set.
* @throws AWTError Always throws this error when called.
*/
@@ -158,7 +158,7 @@ public class ScrollPaneAdjustable
/**
* This method should never be called.
- *
+ *
* @param minimum The minimum value to be set.
* @throws AWTError Always throws this error when called.
*/
@@ -182,10 +182,10 @@ public class ScrollPaneAdjustable
if (value > maximum)
maximum = value;
}
-
+
/**
* This method should never be called.
- *
+ *
* @param visibleAmount The visible amount to be set.
* @throws AWTError Always throws this error when called.
*/
@@ -196,12 +196,12 @@ public class ScrollPaneAdjustable
public String paramString ()
{
- return paramStringHelper()
- + ",[" + getMinimum() + ".." + getMaximum()
- + "],val=" + getValue()
- + ",vis=" + getVisibleAmount()
+ return paramStringHelper()
+ + ",[" + getMinimum() + ".." + getMaximum()
+ + "],val=" + getValue()
+ + ",vis=" + getVisibleAmount()
+ ",unit=" + getUnitIncrement()
- + ",block=" + getBlockIncrement()
+ + ",block=" + getBlockIncrement()
+ ",isAdjusting=" + valueIsAdjusting;
}
@@ -212,7 +212,7 @@ public class ScrollPaneAdjustable
else
return "vertical";
}
-
+
public String toString()
{
return getClass().getName() + "[" + paramString() + "]";
@@ -237,6 +237,5 @@ public class ScrollPaneAdjustable
{
this.valueIsAdjusting = valueIsAdjusting;
}
-
-} // class ScrollPaneAdjustable
+} // class ScrollPaneAdjustable
diff --git a/java/awt/Scrollbar.java b/java/awt/Scrollbar.java
index 0cba512f6..4a9e36c31 100644
--- a/java/awt/Scrollbar.java
+++ b/java/awt/Scrollbar.java
@@ -343,7 +343,7 @@ public class Scrollbar extends Component implements Accessible, Adjustable
{
if (visibleAmount <= 0)
visibleAmount = 1;
-
+
if (maximum <= minimum)
maximum = minimum + 1;
@@ -352,7 +352,7 @@ public class Scrollbar extends Component implements Accessible, Adjustable
if (visibleAmount > maximum - minimum)
visibleAmount = maximum - minimum;
-
+
// According to documentation, the actual maximum
// value is (maximum - visibleAmount)
if (value > maximum - visibleAmount)
@@ -367,7 +367,7 @@ public class Scrollbar extends Component implements Accessible, Adjustable
this.value = value;
this.visibleAmount = visibleAmount;
this.minimum = minimum;
- this.maximum = maximum;
+ this.maximum = maximum;
}
/**
@@ -419,13 +419,13 @@ public class Scrollbar extends Component implements Accessible, Adjustable
{
if (lineIncrement < 0)
throw new IllegalArgumentException("Unit increment less than zero.");
-
+
if (lineIncrement == 0)
lineIncrement = 1;
-
+
if (lineIncrement == this.lineIncrement)
return;
-
+
this.lineIncrement = lineIncrement;
ScrollbarPeer peer = (ScrollbarPeer) getPeer();
@@ -485,7 +485,7 @@ public class Scrollbar extends Component implements Accessible, Adjustable
if (pageIncrement == 0)
pageIncrement = 1;
-
+
if (pageIncrement == this.pageIncrement)
return;
@@ -570,25 +570,25 @@ public class Scrollbar extends Component implements Accessible, Adjustable
*/
void dispatchEventImpl(AWTEvent e)
{
- if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST
- && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST)
+ if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST
+ && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST)
{
- AdjustmentEvent ae = (AdjustmentEvent) e;
- boolean adjusting = ae.getValueIsAdjusting();
- if (adjusting)
- setValueIsAdjusting(true);
- try
- {
- setValue(((AdjustmentEvent) e).getValue());
- if (adjustment_listeners != null
- || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0)
- processEvent(e);
- }
- finally
- {
- if (adjusting)
- setValueIsAdjusting(false);
- }
+ AdjustmentEvent ae = (AdjustmentEvent) e;
+ boolean adjusting = ae.getValueIsAdjusting();
+ if (adjusting)
+ setValueIsAdjusting(true);
+ try
+ {
+ setValue(((AdjustmentEvent) e).getValue());
+ if (adjustment_listeners != null
+ || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0)
+ processEvent(e);
+ }
+ finally
+ {
+ if (adjusting)
+ setValueIsAdjusting(false);
+ }
}
else
super.dispatchEventImpl(e);
@@ -710,11 +710,11 @@ public class Scrollbar extends Component implements Accessible, Adjustable
{
AccessibleStateSet states = super.getAccessibleStateSet();
if (getOrientation() == HORIZONTAL)
- states.add(AccessibleState.HORIZONTAL);
+ states.add(AccessibleState.HORIZONTAL);
else
- states.add(AccessibleState.VERTICAL);
+ states.add(AccessibleState.VERTICAL);
if (getValueIsAdjusting())
- states.add(AccessibleState.BUSY);
+ states.add(AccessibleState.BUSY);
return states;
}
@@ -809,7 +809,7 @@ public class Scrollbar extends Component implements Accessible, Adjustable
/* Create the context if this is the first request */
if (accessibleContext == null)
accessibleContext = new AccessibleAWTScrollBar();
-
+
return accessibleContext;
}
}
diff --git a/java/awt/Shape.java b/java/awt/Shape.java
index d76bbaba6..495a980cb 100644
--- a/java/awt/Shape.java
+++ b/java/awt/Shape.java
@@ -109,7 +109,7 @@ public interface Shape
* Test if a high-precision rectangle intersects the shape. This is true
* if any point in the rectangle is in the shape, with the caveat that the
* operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
* class can be used for more precise answers.
*
* @param x the x coordinate of the rectangle
@@ -126,7 +126,7 @@ public interface Shape
* Test if a high-precision rectangle intersects the shape. This is true
* if any point in the rectangle is in the shape, with the caveat that the
* operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
* class can be used for more precise answers.
*
* @param r the rectangle
@@ -141,7 +141,7 @@ public interface Shape
* Test if a high-precision rectangle lies completely in the shape. This is
* true if all points in the rectangle are in the shape, with the caveat
* that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
* class can be used for more precise answers.
*
* @param x the x coordinate of the rectangle
@@ -158,7 +158,7 @@ public interface Shape
* Test if a high-precision rectangle lies completely in the shape. This is
* true if all points in the rectangle are in the shape, with the caveat
* that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
* class can be used for more precise answers.
*
* @param r the rectangle
@@ -176,7 +176,7 @@ public interface Shape
* not required, that the Shape isolate iterations from future changes to
* the boundary, and document this fact.
*
- * @param transform an optional transform to apply to the
+ * @param transform an optional transform to apply to the
* iterator (<code>null</code> permitted).
* @return a new iterator over the boundary
* @since 1.2
@@ -195,11 +195,11 @@ public interface Shape
* use. It is recommended, but not required, that the Shape isolate
* iterations from future changes to the boundary, and document this fact.
*
- * @param transform an optional transform to apply to the
+ * @param transform an optional transform to apply to the
* iterator (<code>null</code> permitted).
* @param flatness the maximum distance for deviation from the real boundary
* @return a new iterator over the boundary
* @since 1.2
*/
PathIterator getPathIterator(AffineTransform transform, double flatness);
-}
+}
diff --git a/java/awt/SystemColor.java b/java/awt/SystemColor.java
index 2ead74a0d..95bcaa696 100644
--- a/java/awt/SystemColor.java
+++ b/java/awt/SystemColor.java
@@ -444,7 +444,7 @@ public final class SystemColor extends Color implements Serializable
if (context == null || color != context.color || !context.getColorModel().equals(cm))
context = new ColorPaintContext(cm,color);
return context;
- }
+ }
/**
* Returns a string describing this color. This is in the format
diff --git a/java/awt/TextArea.java b/java/awt/TextArea.java
index 30b278d0c..265f8c8b6 100644
--- a/java/awt/TextArea.java
+++ b/java/awt/TextArea.java
@@ -177,8 +177,8 @@ public class TextArea extends TextComponent implements java.io.Serializable
* contains the specified text. The TextArea can display the
* specified number of rows and columns of text, without the need to
* scroll. This constructor allows specification of the scroll bar
- * display policy. The TextArea initially contains the specified text.
- * If text specified as <code>null<code>, it will be set to "".
+ * display policy. The TextArea initially contains the specified text.
+ * If text specified as <code>null<code>, it will be set to "".
*
* @param text The text to display in this text area (<code>null</code> permitted).
* @param rows The number of rows in this text area.
@@ -200,7 +200,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
this.rows = 0;
else
this.rows = rows;
-
+
if (columns < 0)
this.columns = 0;
else
@@ -311,7 +311,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
/**
* Retrieve the minimum size for this text area.
- *
+ *
* @return The minimum size for this text area.
*
* @deprecated This method is deprecated in favor of
@@ -340,7 +340,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
{
if (isMinimumSizeSet())
return new Dimension(minSize);
-
+
TextAreaPeer peer = (TextAreaPeer) getPeer ();
if (peer == null)
return new Dimension (getWidth(), getHeight());
@@ -405,7 +405,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
{
if (isPreferredSizeSet())
return new Dimension(prefSize);
-
+
TextAreaPeer peer = (TextAreaPeer) getPeer ();
if (peer == null)
return new Dimension (getWidth(), getHeight());
@@ -459,7 +459,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
if (peer != null)
peer.insert (str, peer.getText().length ());
else
- setText(getText() + str);
+ setText(getText() + str);
}
/**
@@ -488,7 +488,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
{
String tmp1 = null;
String tmp2 = null;
-
+
TextAreaPeer peer = (TextAreaPeer) getPeer ();
if (peer != null)
@@ -562,17 +562,17 @@ public class TextArea extends TextComponent implements java.io.Serializable
switch (scrollbarVisibility)
{
case SCROLLBARS_BOTH:
- sbVisibility = "both";
- break;
+ sbVisibility = "both";
+ break;
case SCROLLBARS_VERTICAL_ONLY:
- sbVisibility = "vertical-only";
- break;
+ sbVisibility = "vertical-only";
+ break;
case SCROLLBARS_HORIZONTAL_ONLY:
- sbVisibility = "horizontal-only";
- break;
+ sbVisibility = "horizontal-only";
+ break;
case SCROLLBARS_NONE:
- sbVisibility = "none";
- break;
+ sbVisibility = "none";
+ break;
}
String editable = "";
@@ -600,7 +600,7 @@ public class TextArea extends TextComponent implements java.io.Serializable
{
return next_text_number++;
}
-
+
protected class AccessibleAWTTextArea extends AccessibleAWTTextComponent
{
private static final long serialVersionUID = 3472827823632144419L;
@@ -608,13 +608,13 @@ public class TextArea extends TextComponent implements java.io.Serializable
protected AccessibleAWTTextArea()
{
}
-
+
public AccessibleStateSet getAccessibleStateSet()
{
return super.getAccessibleStateSet();
}
}
-
+
/**
* Gets the AccessibleContext associated with this <code>TextArea</code>.
* The context is created, if necessary.
diff --git a/java/awt/TextComponent.java b/java/awt/TextComponent.java
index 8fdd94139..31ea3f5de 100644
--- a/java/awt/TextComponent.java
+++ b/java/awt/TextComponent.java
@@ -54,7 +54,7 @@ import javax.accessibility.AccessibleText;
import javax.swing.text.AttributeSet;
/**
- * This class provides common functionality for widgets than
+ * This class provides common functionality for widgets than
* contain text.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -106,12 +106,12 @@ public class TextComponent extends Component
{
TextComponent.this.addTextListener(this);
}
-
+
public AccessibleRole getAccessibleRole()
{
return AccessibleRole.TEXT;
}
-
+
public AccessibleStateSet getAccessibleStateSet()
{
// TODO: Docs say PropertyChangeEvent will fire if this state changes.
@@ -121,12 +121,12 @@ public class TextComponent extends Component
ss.add(AccessibleState.EDITABLE);
return ss;
}
-
+
public AccessibleText getAccessibleText()
{
return this;
}
-
+
/* (non-Javadoc)
* @see javax.accessibility.AccessibleText#getIndexAtPoint(java.awt.Point)
*/
@@ -169,26 +169,26 @@ public class TextComponent extends Component
BreakIterator it = null;
switch (part)
{
- case CHARACTER:
- return text.substring(index, index + 1);
- case WORD:
- it = BreakIterator.getWordInstance();
- break;
- case SENTENCE:
- it = BreakIterator.getSentenceInstance();
- break;
- default:
- return null;
+ case CHARACTER:
+ return text.substring(index, index + 1);
+ case WORD:
+ it = BreakIterator.getWordInstance();
+ break;
+ case SENTENCE:
+ it = BreakIterator.getSentenceInstance();
+ break;
+ default:
+ return null;
}
- it.setText(text);
- int start = index;
- if (!it.isBoundary(index))
- start = it.preceding(index);
- int end = it.following(index);
- if (end == -1)
- return text.substring(index);
- else
- return text.substring(index, end);
+ it.setText(text);
+ int start = index;
+ if (!it.isBoundary(index))
+ start = it.preceding(index);
+ int end = it.following(index);
+ if (end == -1)
+ return text.substring(index);
+ else
+ return text.substring(index, end);
}
/* (non-Javadoc)
@@ -200,30 +200,30 @@ public class TextComponent extends Component
BreakIterator it = null;
switch (part)
{
- case CHARACTER:
- return text.substring(index, index + 1);
- case WORD:
- it = BreakIterator.getWordInstance();
- break;
- case SENTENCE:
- it = BreakIterator.getSentenceInstance();
- break;
- default:
- return null;
+ case CHARACTER:
+ return text.substring(index, index + 1);
+ case WORD:
+ it = BreakIterator.getWordInstance();
+ break;
+ case SENTENCE:
+ it = BreakIterator.getSentenceInstance();
+ break;
+ default:
+ return null;
}
- it.setText(text);
- int start = index;
- if (!it.isBoundary(index))
- start = it.following(index);
- // Make sure there was a complete unit. I.e. if index is in the middle
- // of a word, return null if there is no word after the that one.
- if (start == -1)
- return null;
- int end = it.following(start);
- if (end == -1)
- return text.substring(index);
- else
- return text.substring(index, end);
+ it.setText(text);
+ int start = index;
+ if (!it.isBoundary(index))
+ start = it.following(index);
+ // Make sure there was a complete unit. I.e. if index is in the middle
+ // of a word, return null if there is no word after the that one.
+ if (start == -1)
+ return null;
+ int end = it.following(start);
+ if (end == -1)
+ return text.substring(index);
+ else
+ return text.substring(index, end);
}
/* (non-Javadoc)
@@ -236,30 +236,30 @@ public class TextComponent extends Component
BreakIterator it = null;
switch (part)
{
- case CHARACTER:
- return text.substring(index - 1, index);
- case WORD:
- it = BreakIterator.getWordInstance();
- break;
- case SENTENCE:
- it = BreakIterator.getSentenceInstance();
- break;
- default:
- return null;
+ case CHARACTER:
+ return text.substring(index - 1, index);
+ case WORD:
+ it = BreakIterator.getWordInstance();
+ break;
+ case SENTENCE:
+ it = BreakIterator.getSentenceInstance();
+ break;
+ default:
+ return null;
}
- it.setText(text);
- int end = index;
- if (!it.isBoundary(index))
- end = it.preceding(index);
- // Make sure there was a complete unit. I.e. if index is in the middle
- // of a word, return null if there is no word before that one.
- if (end == -1)
- return null;
- int start = it.preceding(end);
- if (start == -1)
- return text.substring(0, end);
- else
- return text.substring(start, end);
+ it.setText(text);
+ int end = index;
+ if (!it.isBoundary(index))
+ end = it.preceding(index);
+ // Make sure there was a complete unit. I.e. if index is in the middle
+ // of a word, return null if there is no word before that one.
+ if (end == -1)
+ return null;
+ int start = it.preceding(end);
+ if (start == -1)
+ return text.substring(0, end);
+ else
+ return text.substring(start, end);
}
/* (non-Javadoc)
@@ -304,9 +304,9 @@ public class TextComponent extends Component
public void textValueChanged(TextEvent event)
{
// TODO Auto-generated method stub
-
+
}
-
+
}
@@ -316,7 +316,7 @@ public class TextComponent extends Component
this.text = "";
else
this.text = text;
-
+
this.editable = true;
}
@@ -363,13 +363,13 @@ public class TextComponent extends Component
String alltext = getText();
int start = getSelectionStart();
int end = getSelectionEnd();
-
+
return(alltext.substring(start, end));
}
/**
* Returns the starting position of the selected text region.
- * If the text is not selected then caret position is returned.
+ * If the text is not selected then caret position is returned.
*
* @return The starting position of the selected text region.
*/
@@ -391,14 +391,14 @@ public class TextComponent extends Component
*/
public synchronized void setSelectionStart(int selectionStart)
{
- select(selectionStart,
- (getSelectionEnd() < selectionStart)
+ select(selectionStart,
+ (getSelectionEnd() < selectionStart)
? selectionStart : getSelectionEnd());
}
/**
* Returns the ending position of the selected text region.
- * If the text is not selected, then caret position is returned
+ * If the text is not selected, then caret position is returned
*
* @return The ending position of the selected text region.
*/
@@ -447,7 +447,7 @@ public class TextComponent extends Component
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
-
+
TextComponentPeer tcp = (TextComponentPeer) getPeer();
if (tcp != null)
tcp.select(selectionStart, selectionEnd);
@@ -489,7 +489,7 @@ public class TextComponent extends Component
{
if (caretPosition < 0)
throw new IllegalArgumentException();
-
+
TextComponentPeer tcp = (TextComponentPeer) getPeer();
if (tcp != null)
tcp.setCaretPosition(caretPosition);
@@ -539,7 +539,7 @@ public class TextComponent extends Component
{
textListener = AWTEventMulticaster.add(textListener, listener);
- enableEvents(AWTEvent.TEXT_EVENT_MASK);
+ enableEvents(AWTEvent.TEXT_EVENT_MASK);
}
/**
@@ -557,7 +557,7 @@ public class TextComponent extends Component
* Processes the specified event for this component. Text events are
* processed by calling the <code>processTextEvent()</code> method.
* All other events are passed to the superclass method.
- *
+ *
* @param event The event to process.
*/
protected void processEvent(AWTEvent event)
@@ -585,13 +585,13 @@ public class TextComponent extends Component
void dispatchEventImpl(AWTEvent e)
{
- if (e.id <= TextEvent.TEXT_LAST
+ if (e.id <= TextEvent.TEXT_LAST
&& e.id >= TextEvent.TEXT_FIRST
- && (textListener != null
- || (eventMask & AWTEvent.TEXT_EVENT_MASK) != 0))
+ && (textListener != null
+ || (eventMask & AWTEvent.TEXT_EVENT_MASK) != 0))
processEvent(e);
else
- super.dispatchEventImpl(e);
+ super.dispatchEventImpl(e);
}
/**
@@ -642,7 +642,7 @@ public class TextComponent extends Component
return accessibleContext;
}
-
+
// Provide AccessibleAWTTextComponent access to several peer functions that
// aren't publicly exposed. This is package-private to avoid an accessor
// method.
@@ -653,7 +653,7 @@ public class TextComponent extends Component
return tcp.getIndexAtPoint(p.x, p.y);
return -1;
}
-
+
synchronized Rectangle getCharacterBounds(int i)
{
TextComponentPeer tcp = (TextComponentPeer) getPeer();
@@ -661,11 +661,11 @@ public class TextComponent extends Component
return tcp.getCharacterBounds(i);
return null;
}
-
+
/**
* All old mouse events for this component should
* be ignored.
- *
+ *
* @return true to ignore all old mouse events.
*/
static boolean ignoreOldMouseEvents()
@@ -674,4 +674,3 @@ public class TextComponent extends Component
}
} // class TextComponent
-
diff --git a/java/awt/TextField.java b/java/awt/TextField.java
index b1df66f7c..5a58b440d 100644
--- a/java/awt/TextField.java
+++ b/java/awt/TextField.java
@@ -54,13 +54,13 @@ import javax.accessibility.AccessibleStateSet;
*/
public class TextField extends TextComponent
{
-
+
/**
* The number used to generate the name returned by getName.
*/
private static transient long next_textfield_number;
-
+
private static final long serialVersionUID = -2966288784432217853L;
@@ -127,7 +127,7 @@ public class TextField extends TextComponent
public TextField(String text, int columns)
{
super(text);
-
+
if (columns < 0)
this.columns = 0;
else
@@ -165,7 +165,7 @@ public class TextField extends TextComponent
}
/**
- * Returns the character that is echoed to the screen when a text
+ * Returns the character that is echoed to the screen when a text
* field is protected (such as when a password is being entered).
*
* @return The echo character for this text field.
@@ -192,7 +192,7 @@ public class TextField extends TextComponent
*
* @param echoChar The new echo character.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>setEchoChar()</code>
*/
public void setEchoCharacter(char echoChar)
@@ -259,14 +259,14 @@ public class TextField extends TextComponent
*
* @param columns The number of columns to get the minimum size for.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>getMinimumSize(int)</code>.
*/
public Dimension minimumSize(int columns)
{
if (isMinimumSizeSet())
return new Dimension(minSize);
-
+
TextFieldPeer peer = (TextFieldPeer) getPeer ();
if (peer == null)
return new Dimension(getWidth(), getHeight());
@@ -300,7 +300,7 @@ public class TextField extends TextComponent
*
* @return The preferred size for this text field.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>getPreferredSize()</code>.
*/
public Dimension preferredSize()
@@ -314,18 +314,18 @@ public class TextField extends TextComponent
*
* @param columns The number of columns to get the preferred size for.
*
- * @deprecated This method is deprecated in favor of
+ * @deprecated This method is deprecated in favor of
* <code>getPreferredSize(int)</code>.
*/
public Dimension preferredSize(int columns)
{
if (isPreferredSizeSet())
return new Dimension(prefSize);
-
+
TextFieldPeer peer = (TextFieldPeer) getPeer ();
if (peer == null)
return new Dimension (getWidth(), getHeight());
-
+
return peer.getPreferredSize (columns);
}
@@ -387,7 +387,7 @@ public class TextField extends TextComponent
* are enabled on this object. This will be true if any listeners
* are registered, or if action events were specifically enabled
* using <code>enableEvents()</code>.
- *
+ *
* @param event The event to process.
*/
protected void processActionEvent(ActionEvent event)
@@ -398,10 +398,10 @@ public class TextField extends TextComponent
void dispatchEventImpl(AWTEvent e)
{
- if (e.id <= ActionEvent.ACTION_LAST
+ if (e.id <= ActionEvent.ACTION_LAST
&& e.id >= ActionEvent.ACTION_FIRST
- && (action_listeners != null
- || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
+ && (action_listeners != null
+ || (eventMask & AWTEvent.ACTION_EVENT_MASK) != 0))
processEvent(e);
else
super.dispatchEventImpl(e);
@@ -446,7 +446,7 @@ public class TextField extends TextComponent
{
return (ActionListener[]) getListeners (ActionListener.class);
}
-
+
/**
* Generate a unique name for this <code>TextField</code>.
*
@@ -469,13 +469,13 @@ public class TextField extends TextComponent
protected AccessibleAWTTextField()
{
}
-
+
public AccessibleStateSet getAccessibleStateSet()
{
return super.getAccessibleStateSet();
}
}
-
+
public AccessibleContext getAccessibleContext()
{
return new AccessibleAWTTextField();
diff --git a/java/awt/TexturePaint.java b/java/awt/TexturePaint.java
index 387ccb0fd..f88e77b23 100644
--- a/java/awt/TexturePaint.java
+++ b/java/awt/TexturePaint.java
@@ -1,4 +1,4 @@
-/* TexturePaint.java --
+/* TexturePaint.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -53,10 +53,10 @@ public class TexturePaint implements Paint
{
private final BufferedImage texture;
private final Rectangle2D anchor;
-
+
/**
* Constructor.
- *
+ *
* @param texture - the texture
* @param anchor - the shape
*/
@@ -68,7 +68,7 @@ public class TexturePaint implements Paint
/**
* Gets the texture image.
- *
+ *
* @return the texture
*/
public BufferedImage getImage()
@@ -78,7 +78,7 @@ public class TexturePaint implements Paint
/**
* Gets the shape anchor.
- *
+ *
* @return the shape anchor
*/
public Rectangle2D getAnchorRect()
@@ -88,12 +88,12 @@ public class TexturePaint implements Paint
/**
* Creates the context used to paint the texture.
- *
+ *
* @param cm - the ColorModel that receives the Paint data. Used only as a hint.
* @param deviceBounds - the device space being rendered.
* @param userBounds - the user space being rendered
* @param xform - the AffineTransform from user space into device space
- * @param hints - a RenderingHints object that is used to specify how the
+ * @param hints - a RenderingHints object that is used to specify how the
* pattern is rendered
* @return the paint context used to paint the texture
*/
@@ -108,7 +108,7 @@ public class TexturePaint implements Paint
/**
* Returns the transparency mode.
- *
+ *
* @return the transparency mode.
*/
public int getTransparency()
diff --git a/java/awt/Toolkit.java b/java/awt/Toolkit.java
index b12e9e10d..6b1eb9d4b 100644
--- a/java/awt/Toolkit.java
+++ b/java/awt/Toolkit.java
@@ -124,7 +124,7 @@ public abstract class Toolkit
/** The toolkit properties. */
private static Properties props = new Properties();
- protected final Map<String,Object> desktopProperties =
+ protected final Map<String,Object> desktopProperties =
new Hashtable<String,Object>();
protected final PropertyChangeSupport desktopPropsSupport
@@ -150,19 +150,19 @@ public abstract class Toolkit
}
/**
- *
+ *
* @param target
* @return
* @throws HeadlessException
*/
protected abstract DesktopPeer createDesktopPeer(Desktop target)
throws HeadlessException;
-
+
/**
* Creates a peer object for the specified <code>Button</code>.
*
* @param target The <code>Button</code> to create the peer for.
- *
+ *
* @return The peer for the specified <code>Button</code> object.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
@@ -353,7 +353,7 @@ public abstract class Toolkit
protected abstract MenuItemPeer createMenuItem(MenuItem target);
/**
- * Returns a MouseInfoPeer.
+ * Returns a MouseInfoPeer.
* The default implementation of this method throws
* UnsupportedOperationException.
*
@@ -493,7 +493,7 @@ public abstract class Toolkit
* Returns the dimensions of the screen in pixels.
*
* @return The dimensions of the screen in pixels.
- *
+ *
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public abstract Dimension getScreenSize();
@@ -521,7 +521,7 @@ public abstract class Toolkit
* Returns the color model of the screen.
*
* @return The color model of the screen.
- *
+ *
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public abstract ColorModel getColorModel();
@@ -815,7 +815,7 @@ public abstract class Toolkit
{
if (AWTUtilities.isValidKey(keyCode))
throw new UnsupportedOperationException
- ("cannot get locking state of key code " + keyCode);
+ ("cannot get locking state of key code " + keyCode);
throw new IllegalArgumentException("invalid key code " + keyCode);
}
@@ -835,7 +835,7 @@ public abstract class Toolkit
&& keyCode != KeyEvent.VK_NUM_LOCK
&& keyCode != KeyEvent.VK_SCROLL_LOCK)
throw new IllegalArgumentException();
-
+
throw new UnsupportedOperationException();
}
@@ -915,7 +915,7 @@ public abstract class Toolkit
* Returns whether Toolkit supports this state for Frames.
*
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
- *
+ *
* @since 1.4
*/
public boolean isFrameStateSupported(int state)
diff --git a/java/awt/Window.java b/java/awt/Window.java
index 2a59375ce..986d1304a 100644
--- a/java/awt/Window.java
+++ b/java/awt/Window.java
@@ -73,7 +73,7 @@ public class Window extends Container implements Accessible
private String warningString = null;
private int windowSerializedDataVersion = 0; // FIXME
/** @since 1.2 */
- // private FocusManager focusMgr; // FIXME: what is this?
+ // private FocusManager focusMgr; // FIXME: what is this?
/** @since 1.2 */
private int state = 0;
/** @since 1.4 */
@@ -92,7 +92,7 @@ public class Window extends Container implements Accessible
// This is package-private to avoid an accessor method.
transient Component windowFocusOwner;
-
+
/*
* The number used to generate the name returned by getName.
*/
@@ -106,7 +106,7 @@ public class Window extends Container implements Accessible
{
return AccessibleRole.WINDOW;
}
-
+
public AccessibleStateSet getAccessibleStateSet()
{
AccessibleStateSet states = super.getAccessibleStateSet();
@@ -116,7 +116,7 @@ public class Window extends Container implements Accessible
}
}
- /**
+ /**
* This (package access) constructor is used by subclasses that want
* to build windows that do not have parents. Eg. toplevel
* application frames. Subclasses cannot call super(null), since
@@ -129,7 +129,7 @@ public class Window extends Container implements Accessible
// cycle roots.
focusCycleRoot = true;
setLayout(new BorderLayout());
-
+
GraphicsEnvironment g = GraphicsEnvironment.getLocalGraphicsEnvironment();
graphicsConfig = g.getDefaultScreenDevice().getDefaultConfiguration();
}
@@ -157,7 +157,7 @@ public class Window extends Container implements Accessible
/**
* Initializes a new instance of <code>Window</code> with the specified
- * parent. The window will initially be invisible.
+ * parent. The window will initially be invisible.
*
* @exception IllegalArgumentException If the owner's GraphicsConfiguration
* is not from a screen device, or if owner is null; this exception is always
@@ -169,10 +169,10 @@ public class Window extends Container implements Accessible
{
this (owner, owner.getGraphicsConfiguration ());
}
-
+
/**
* Initializes a new instance of <code>Window</code> with the specified
- * parent. The window will initially be invisible.
+ * parent. The window will initially be invisible.
*
* @exception IllegalArgumentException If owner is null or if gc is not from a
* screen device; this exception is always thrown when
@@ -186,10 +186,10 @@ public class Window extends Container implements Accessible
synchronized (getTreeLock())
{
- if (owner == null)
- throw new IllegalArgumentException ("owner must not be null");
+ if (owner == null)
+ throw new IllegalArgumentException ("owner must not be null");
- parent = owner;
+ parent = owner;
owner.ownedWindows.add(new WeakReference(this));
}
@@ -312,18 +312,18 @@ public class Window extends Container implements Accessible
// Hide visible owned windows.
synchronized (getTreeLock ())
{
- Iterator e = ownedWindows.iterator();
- while(e.hasNext())
- {
- Window w = (Window)(((Reference) e.next()).get());
- if (w != null)
- {
- if (w.isVisible() && w.getPeer() != null)
- w.getPeer().setVisible(false);
- }
- else
- e.remove();
- }
+ Iterator e = ownedWindows.iterator();
+ while(e.hasNext())
+ {
+ Window w = (Window)(((Reference) e.next()).get());
+ if (w != null)
+ {
+ if (w.isVisible() && w.getPeer() != null)
+ w.getPeer().setVisible(false);
+ }
+ else
+ e.remove();
+ }
}
super.hide();
}
@@ -338,30 +338,30 @@ public class Window extends Container implements Accessible
synchronized (getTreeLock ())
{
- Iterator e = ownedWindows.iterator();
- while(e.hasNext())
- {
- Window w = (Window)(((Reference) e.next()).get());
- if (w != null)
- w.dispose();
- else
- // Remove null weak reference from ownedWindows.
- e.remove();
- }
-
- for (int i = 0; i < ncomponents; ++i)
- component[i].removeNotify();
- this.removeNotify();
-
- // Post WINDOW_CLOSED from here.
- if (windowListener != null
- || (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0)
- {
- WindowEvent ev = new WindowEvent(this,
- WindowEvent.WINDOW_CLOSED);
- Toolkit tk = Toolkit.getDefaultToolkit();
- tk.getSystemEventQueue().postEvent(ev);
- }
+ Iterator e = ownedWindows.iterator();
+ while(e.hasNext())
+ {
+ Window w = (Window)(((Reference) e.next()).get());
+ if (w != null)
+ w.dispose();
+ else
+ // Remove null weak reference from ownedWindows.
+ e.remove();
+ }
+
+ for (int i = 0; i < ncomponents; ++i)
+ component[i].removeNotify();
+ this.removeNotify();
+
+ // Post WINDOW_CLOSED from here.
+ if (windowListener != null
+ || (eventMask & AWTEvent.WINDOW_EVENT_MASK) != 0)
+ {
+ WindowEvent ev = new WindowEvent(this,
+ WindowEvent.WINDOW_CLOSED);
+ Toolkit tk = Toolkit.getDefaultToolkit();
+ tk.getSystemEventQueue().postEvent(ev);
+ }
}
}
@@ -376,9 +376,9 @@ public class Window extends Container implements Accessible
{
if (peer != null)
{
- if( alwaysOnTop )
- setAlwaysOnTop( false );
- ( (WindowPeer) peer ).toBack();
+ if( alwaysOnTop )
+ setAlwaysOnTop( false );
+ ( (WindowPeer) peer ).toBack();
}
}
@@ -397,12 +397,12 @@ public class Window extends Container implements Accessible
*
* @return The toolkit used to create this window.
*
- * @specnote Unlike Component.getToolkit, this implementation always
+ * @specnote Unlike Component.getToolkit, this implementation always
* returns the value of Toolkit.getDefaultToolkit().
*/
public Toolkit getToolkit()
{
- return Toolkit.getDefaultToolkit();
+ return Toolkit.getDefaultToolkit();
}
/**
@@ -455,28 +455,28 @@ public class Window extends Container implements Accessible
Window [] trimmedList;
synchronized (getTreeLock ())
{
- // Windows with non-null weak references in ownedWindows.
- Window [] validList = new Window [ownedWindows.size()];
-
- Iterator e = ownedWindows.iterator();
- int numValid = 0;
- while (e.hasNext())
- {
- Window w = (Window)(((Reference) e.next()).get());
- if (w != null)
- validList[numValid++] = w;
- else
- // Remove null weak reference from ownedWindows.
- e.remove();
- }
-
- if (numValid != validList.length)
- {
- trimmedList = new Window [numValid];
- System.arraycopy (validList, 0, trimmedList, 0, numValid);
- }
- else
- trimmedList = validList;
+ // Windows with non-null weak references in ownedWindows.
+ Window [] validList = new Window [ownedWindows.size()];
+
+ Iterator e = ownedWindows.iterator();
+ int numValid = 0;
+ while (e.hasNext())
+ {
+ Window w = (Window)(((Reference) e.next()).get());
+ if (w != null)
+ validList[numValid++] = w;
+ else
+ // Remove null weak reference from ownedWindows.
+ e.remove();
+ }
+
+ if (numValid != validList.length)
+ {
+ trimmedList = new Window [numValid];
+ System.arraycopy (validList, 0, trimmedList, 0, numValid);
+ }
+ else
+ trimmedList = validList;
}
return trimmedList;
}
@@ -531,7 +531,7 @@ public class Window extends Container implements Accessible
AWTEventMulticaster.getListeners(windowFocusListener,
WindowFocusListener.class);
}
-
+
/**
* Returns an array of all the window state listeners registered on this
* window.
@@ -557,7 +557,7 @@ public class Window extends Container implements Accessible
wfl);
}
}
-
+
/**
* Adds the specified listener to this window.
*
@@ -569,10 +569,10 @@ public class Window extends Container implements Accessible
{
newEventsOnly = true;
windowStateListener = AWTEventMulticaster.add (windowStateListener,
- wsl);
+ wsl);
}
}
-
+
/**
* Removes the specified listener from this window.
*/
@@ -580,7 +580,7 @@ public class Window extends Container implements Accessible
{
windowFocusListener = AWTEventMulticaster.remove (windowFocusListener, wfl);
}
-
+
/**
* Removes the specified listener from this window.
*
@@ -697,7 +697,7 @@ public class Window extends Container implements Accessible
/**
* Identifies if this window is active. The active window is a Frame or
* Dialog that has focus or owns the active window.
- *
+ *
* @return true if active, else false.
* @since 1.4
*/
@@ -710,7 +710,7 @@ public class Window extends Container implements Accessible
/**
* Identifies if this window is focused. A window is focused if it is the
* focus owner or it contains the focus owner.
- *
+ *
* @return true if focused, else false.
* @since 1.4
*/
@@ -719,7 +719,7 @@ public class Window extends Container implements Accessible
KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager ();
return manager.getFocusedWindow() == this;
}
-
+
/**
* Returns the child window that has focus if this window is active.
* This method returns <code>null</code> if this window is not active
@@ -804,7 +804,7 @@ public class Window extends Container implements Accessible
{
int x = 0;
int y = 0;
-
+
if (c == null || !c.isShowing())
{
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
@@ -820,7 +820,7 @@ public class Window extends Container implements Accessible
x = c.getLocationOnScreen().x;
y = c.getLocationOnScreen().y;
-
+
// If bottom of component is cut off, window placed
// on the left or the right side of component
if ((y + cHeight) > screenSize.height)
@@ -853,7 +853,7 @@ public class Window extends Container implements Accessible
x = 0;
else
x += (cWidth - width) / 2;
-
+
y += (cHeight - height) / 2;
}
else
@@ -892,9 +892,9 @@ public class Window extends Container implements Accessible
WindowBltBufferStrategy(int numBuffers, boolean accelerated)
{
super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(accelerated),
- new ImageCapabilities(accelerated),
- BufferCapabilities.FlipContents.COPIED));
+ new BufferCapabilities(new ImageCapabilities(accelerated),
+ new ImageCapabilities(accelerated),
+ BufferCapabilities.FlipContents.COPIED));
}
}
@@ -915,9 +915,9 @@ public class Window extends Container implements Accessible
throws AWTException
{
super(numBuffers,
- new BufferCapabilities(new ImageCapabilities(true),
- new ImageCapabilities(true),
- BufferCapabilities.FlipContents.COPIED));
+ new BufferCapabilities(new ImageCapabilities(true),
+ new ImageCapabilities(true),
+ BufferCapabilities.FlipContents.COPIED));
}
}
@@ -948,18 +948,18 @@ public class Window extends Container implements Accessible
{
if (numBuffers < 1)
throw new IllegalArgumentException("Window.createBufferStrategy: number"
- + " of buffers is less than one");
+ + " of buffers is less than one");
if (!isDisplayable())
throw new IllegalStateException("Window.createBufferStrategy: window is"
- + " not displayable");
+ + " not displayable");
BufferStrategy newStrategy = null;
// try a flipping strategy
try
{
- newStrategy = new WindowFlipBufferStrategy(numBuffers);
+ newStrategy = new WindowFlipBufferStrategy(numBuffers);
}
catch (AWTException e)
{
@@ -996,11 +996,11 @@ public class Window extends Container implements Accessible
{
if (numBuffers < 1)
throw new IllegalArgumentException("Window.createBufferStrategy: number"
- + " of buffers is less than one");
+ + " of buffers is less than one");
if (caps == null)
throw new IllegalArgumentException("Window.createBufferStrategy:"
- + " capabilities object is null");
+ + " capabilities object is null");
// a flipping strategy was requested
if (caps.isPageFlipping())
@@ -1040,7 +1040,7 @@ public class Window extends Container implements Accessible
ResourceBundle rb = ResourceBundle.getBundle(rbName, Locale.getDefault(),
ClassLoader.getSystemClassLoader());
if (rb != null)
- applyResourceBundle(rb);
+ applyResourceBundle(rb);
}
/**
@@ -1057,7 +1057,7 @@ public class Window extends Container implements Accessible
return accessibleContext;
}
- /**
+ /**
* Get graphics configuration. The implementation for Window will
* not ask any parent containers, since Window is a toplevel
* window and not actually embedded in the parent component.
@@ -1083,17 +1083,17 @@ public class Window extends Container implements Accessible
case WindowEvent.WINDOW_GAINED_FOCUS:
windowFocusListener.windowGainedFocus (event);
break;
-
+
case WindowEvent.WINDOW_LOST_FOCUS:
windowFocusListener.windowLostFocus (event);
break;
-
+
default:
break;
}
}
}
-
+
/**
* @since 1.4
*/
@@ -1122,10 +1122,10 @@ public class Window extends Container implements Accessible
return false;
}
-
+
/**
* Returns the value of the focusableWindowState property.
- *
+ *
* @since 1.4
*/
public boolean getFocusableWindowState ()
@@ -1135,17 +1135,17 @@ public class Window extends Container implements Accessible
/**
* Sets the value of the focusableWindowState property.
- *
+ *
* @since 1.4
*/
public void setFocusableWindowState (boolean focusableWindowState)
{
this.focusableWindowState = focusableWindowState;
}
-
+
/**
* Check whether this Container is a focus cycle root.
- * Returns always <code>true</code> as Windows are the
+ * Returns always <code>true</code> as Windows are the
* root of the focus cycle.
*
* @return Always <code>true</code>.
@@ -1161,7 +1161,7 @@ public class Window extends Container implements Accessible
* Set whether or not this Container is the root of a focus
* traversal cycle. Windows are the root of the focus cycle
* and therefore this method does nothing.
- *
+ *
* @param focusCycleRoot ignored.
*
* @since 1.4
@@ -1201,7 +1201,7 @@ public class Window extends Container implements Accessible
* Sets the always-on-top state of this window (if supported).
*
* Setting a window to always-on-top means it will not be obscured
- * by any other windows (with the exception of other always-on-top
+ * by any other windows (with the exception of other always-on-top
* windows). Not all platforms may support this.
*
* If an window's always-on-top status is changed to false, the window
@@ -1220,14 +1220,14 @@ public class Window extends Container implements Accessible
if( this.alwaysOnTop == alwaysOnTop )
return;
-
+
if( alwaysOnTop )
toFront();
firePropertyChange("alwaysOnTop", this.alwaysOnTop, alwaysOnTop );
this.alwaysOnTop = alwaysOnTop;
- if (peer != null)
+ if (peer != null)
( (WindowPeer) peer).updateAlwaysOnTop();
else
System.out.println("Null peer?!");
diff --git a/java/awt/color/ICC_ColorSpace.java b/java/awt/color/ICC_ColorSpace.java
index b50048cf9..ac636fb26 100644
--- a/java/awt/color/ICC_ColorSpace.java
+++ b/java/awt/color/ICC_ColorSpace.java
@@ -212,7 +212,7 @@ public class ICC_ColorSpace extends ColorSpace
*/
public float getMinValue(int idx)
{
- // FIXME: Not 100% certain of this.
+ // FIXME: Not 100% certain of this.
if (type == ColorSpace.TYPE_Lab && (idx == 1 || idx == 2))
return -128f;
@@ -236,10 +236,10 @@ public class ICC_ColorSpace extends ColorSpace
return 1 + 32767 / 32768f;
else if (type == ColorSpace.TYPE_Lab)
{
- if (idx == 0)
- return 100;
- if (idx == 1 || idx == 2)
- return 127;
+ if (idx == 0)
+ return 100;
+ if (idx == 1 || idx == 2)
+ return 127;
}
if (idx < 0 || idx >= nComponents)
throw new IllegalArgumentException();
@@ -255,28 +255,28 @@ public class ICC_ColorSpace extends ColorSpace
switch (profile.isPredefined())
{
case CS_sRGB:
- converter = new SrgbConverter();
- break;
+ converter = new SrgbConverter();
+ break;
case CS_CIEXYZ:
- converter = new CieXyzConverter();
- break;
+ converter = new CieXyzConverter();
+ break;
case CS_GRAY:
- converter = new GrayScaleConverter();
- break;
+ converter = new GrayScaleConverter();
+ break;
case CS_LINEAR_RGB:
- converter = new LinearRGBConverter();
- break;
+ converter = new LinearRGBConverter();
+ break;
case CS_PYCC:
- converter = new PyccConverter();
- break;
+ converter = new PyccConverter();
+ break;
default:
- if (profile instanceof ICC_ProfileRGB)
- converter = new RgbProfileConverter((ICC_ProfileRGB) profile);
- else if (profile instanceof ICC_ProfileGray)
- converter = new GrayProfileConverter((ICC_ProfileGray) profile);
- else
- converter = new ClutProfileConverter(profile);
- break;
+ if (profile instanceof ICC_ProfileRGB)
+ converter = new RgbProfileConverter((ICC_ProfileRGB) profile);
+ else if (profile instanceof ICC_ProfileGray)
+ converter = new GrayProfileConverter((ICC_ProfileGray) profile);
+ else
+ converter = new ClutProfileConverter(profile);
+ break;
}
return converter;
}
@@ -293,8 +293,8 @@ public class ICC_ColorSpace extends ColorSpace
invDiffMinMax = diffMinMax = null;
for (int i = 0; i < nComponents; i++)
{
- minVal[i] = getMinValue(i);
- maxVal[i] = getMaxValue(i);
+ minVal[i] = getMinValue(i);
+ maxVal[i] = getMaxValue(i);
}
needScaleInit = true;
}
diff --git a/java/awt/color/ICC_Profile.java b/java/awt/color/ICC_Profile.java
index e2efb3a89..0eef22e49 100644
--- a/java/awt/color/ICC_Profile.java
+++ b/java/awt/color/ICC_Profile.java
@@ -114,7 +114,7 @@ public class ICC_Profile implements Serializable
/**
* Color space signatures
*/
- public static final int icSigXYZData = 0x58595A20; // 'XYZ '
+ public static final int icSigXYZData = 0x58595A20; // 'XYZ '
public static final int icSigLabData = 0x4C616220; // 'Lab '
public static final int icSigLuvData = 0x4C757620; // 'Luv '
public static final int icSigYCbCrData = 0x59436272; // 'YCbr'
@@ -151,50 +151,50 @@ public class ICC_Profile implements Serializable
/**
* Tag signatures
*/
- public static final int icSigAToB0Tag = 0x41324230; // 'A2B0'
- public static final int icSigAToB1Tag = 0x41324231; // 'A2B1'
- public static final int icSigAToB2Tag = 0x41324232; // 'A2B2'
- public static final int icSigBlueColorantTag = 0x6258595A; // 'bXYZ'
- public static final int icSigBlueTRCTag = 0x62545243; // 'bTRC'
- public static final int icSigBToA0Tag = 0x42324130; // 'B2A0'
- public static final int icSigBToA1Tag = 0x42324131; // 'B2A1'
- public static final int icSigBToA2Tag = 0x42324132; // 'B2A2'
- public static final int icSigCalibrationDateTimeTag = 0x63616C74; // 'calt'
- public static final int icSigCharTargetTag = 0x74617267; // 'targ'
- public static final int icSigCopyrightTag = 0x63707274; // 'cprt'
- public static final int icSigCrdInfoTag = 0x63726469; // 'crdi'
- public static final int icSigDeviceMfgDescTag = 0x646D6E64; // 'dmnd'
- public static final int icSigDeviceModelDescTag = 0x646D6464; // 'dmdd'
- public static final int icSigDeviceSettingsTag = 0x64657673; // 'devs'
- public static final int icSigGamutTag = 0x67616D74; // 'gamt'
- public static final int icSigGrayTRCTag = 0x6b545243; // 'kTRC'
- public static final int icSigGreenColorantTag = 0x6758595A; // 'gXYZ'
- public static final int icSigGreenTRCTag = 0x67545243; // 'gTRC'
- public static final int icSigLuminanceTag = 0x6C756d69; // 'lumi'
- public static final int icSigMeasurementTag = 0x6D656173; // 'meas'
- public static final int icSigMediaBlackPointTag = 0x626B7074; // 'bkpt'
- public static final int icSigMediaWhitePointTag = 0x77747074; // 'wtpt'
- public static final int icSigNamedColor2Tag = 0x6E636C32; // 'ncl2'
- public static final int icSigOutputResponseTag = 0x72657370; // 'resp'
- public static final int icSigPreview0Tag = 0x70726530; // 'pre0'
- public static final int icSigPreview1Tag = 0x70726531; // 'pre1'
- public static final int icSigPreview2Tag = 0x70726532; // 'pre2'
- public static final int icSigProfileDescriptionTag = 0x64657363; // 'desc'
- public static final int icSigProfileSequenceDescTag = 0x70736571; // 'pseq'
- public static final int icSigPs2CRD0Tag = 0x70736430; // 'psd0'
- public static final int icSigPs2CRD1Tag = 0x70736431; // 'psd1'
- public static final int icSigPs2CRD2Tag = 0x70736432; // 'psd2'
- public static final int icSigPs2CRD3Tag = 0x70736433; // 'psd3'
- public static final int icSigPs2CSATag = 0x70733273; // 'ps2s'
- public static final int icSigPs2RenderingIntentTag = 0x70733269; // 'ps2i'
- public static final int icSigRedColorantTag = 0x7258595A; // 'rXYZ'
- public static final int icSigRedTRCTag = 0x72545243; // 'rTRC'
- public static final int icSigScreeningDescTag = 0x73637264; // 'scrd'
- public static final int icSigScreeningTag = 0x7363726E; // 'scrn'
- public static final int icSigTechnologyTag = 0x74656368; // 'tech'
- public static final int icSigUcrBgTag = 0x62666420; // 'bfd '
- public static final int icSigViewingCondDescTag = 0x76756564; // 'vued'
- public static final int icSigViewingConditionsTag = 0x76696577; // 'view'
+ public static final int icSigAToB0Tag = 0x41324230; // 'A2B0'
+ public static final int icSigAToB1Tag = 0x41324231; // 'A2B1'
+ public static final int icSigAToB2Tag = 0x41324232; // 'A2B2'
+ public static final int icSigBlueColorantTag = 0x6258595A; // 'bXYZ'
+ public static final int icSigBlueTRCTag = 0x62545243; // 'bTRC'
+ public static final int icSigBToA0Tag = 0x42324130; // 'B2A0'
+ public static final int icSigBToA1Tag = 0x42324131; // 'B2A1'
+ public static final int icSigBToA2Tag = 0x42324132; // 'B2A2'
+ public static final int icSigCalibrationDateTimeTag = 0x63616C74; // 'calt'
+ public static final int icSigCharTargetTag = 0x74617267; // 'targ'
+ public static final int icSigCopyrightTag = 0x63707274; // 'cprt'
+ public static final int icSigCrdInfoTag = 0x63726469; // 'crdi'
+ public static final int icSigDeviceMfgDescTag = 0x646D6E64; // 'dmnd'
+ public static final int icSigDeviceModelDescTag = 0x646D6464; // 'dmdd'
+ public static final int icSigDeviceSettingsTag = 0x64657673; // 'devs'
+ public static final int icSigGamutTag = 0x67616D74; // 'gamt'
+ public static final int icSigGrayTRCTag = 0x6b545243; // 'kTRC'
+ public static final int icSigGreenColorantTag = 0x6758595A; // 'gXYZ'
+ public static final int icSigGreenTRCTag = 0x67545243; // 'gTRC'
+ public static final int icSigLuminanceTag = 0x6C756d69; // 'lumi'
+ public static final int icSigMeasurementTag = 0x6D656173; // 'meas'
+ public static final int icSigMediaBlackPointTag = 0x626B7074; // 'bkpt'
+ public static final int icSigMediaWhitePointTag = 0x77747074; // 'wtpt'
+ public static final int icSigNamedColor2Tag = 0x6E636C32; // 'ncl2'
+ public static final int icSigOutputResponseTag = 0x72657370; // 'resp'
+ public static final int icSigPreview0Tag = 0x70726530; // 'pre0'
+ public static final int icSigPreview1Tag = 0x70726531; // 'pre1'
+ public static final int icSigPreview2Tag = 0x70726532; // 'pre2'
+ public static final int icSigProfileDescriptionTag = 0x64657363; // 'desc'
+ public static final int icSigProfileSequenceDescTag = 0x70736571; // 'pseq'
+ public static final int icSigPs2CRD0Tag = 0x70736430; // 'psd0'
+ public static final int icSigPs2CRD1Tag = 0x70736431; // 'psd1'
+ public static final int icSigPs2CRD2Tag = 0x70736432; // 'psd2'
+ public static final int icSigPs2CRD3Tag = 0x70736433; // 'psd3'
+ public static final int icSigPs2CSATag = 0x70733273; // 'ps2s'
+ public static final int icSigPs2RenderingIntentTag = 0x70733269; // 'ps2i'
+ public static final int icSigRedColorantTag = 0x7258595A; // 'rXYZ'
+ public static final int icSigRedTRCTag = 0x72545243; // 'rTRC'
+ public static final int icSigScreeningDescTag = 0x73637264; // 'scrd'
+ public static final int icSigScreeningTag = 0x7363726E; // 'scrn'
+ public static final int icSigTechnologyTag = 0x74656368; // 'tech'
+ public static final int icSigUcrBgTag = 0x62666420; // 'bfd '
+ public static final int icSigViewingCondDescTag = 0x76756564; // 'vued'
+ public static final int icSigViewingConditionsTag = 0x76696577; // 'view'
public static final int icSigChromaticityTag = 0x6368726D; // 'chrm'
/**
@@ -430,10 +430,10 @@ public class ICC_Profile implements Serializable
int bytesLeft = totalBytes;
while (bytesLeft > 0)
{
- int read = in.read(data,
+ int read = in.read(data,
ProfileHeader.HEADERSIZE + (totalBytes - bytesLeft),
bytesLeft);
- bytesLeft -= read;
+ bytesLeft -= read;
}
return getInstance(data);
@@ -540,9 +540,9 @@ public class ICC_Profile implements Serializable
Enumeration e = tagTable.elements();
while (e.hasMoreElements())
{
- TagEntry tag = (TagEntry) e.nextElement();
- System.arraycopy(tag.getData(), 0,
- data, tag.getOffset(), tag.getSize());
+ TagEntry tag = (TagEntry) e.nextElement();
+ System.arraycopy(tag.getData(), 0,
+ data, tag.getOffset(), tag.getSize());
}
return data;
}
@@ -582,8 +582,8 @@ public class ICC_Profile implements Serializable
header = new ProfileHeader(data);
else
{
- TagEntry t = new TagEntry(tagSignature, data);
- tagTable.put(t.hashKey(), t);
+ TagEntry t = new TagEntry(tagSignature, data);
+ tagTable.put(t.hashKey(), t);
}
}
@@ -592,7 +592,7 @@ public class ICC_Profile implements Serializable
*/
public int getNumComponents()
{
- int[] lookup =
+ int[] lookup =
{
ColorSpace.TYPE_RGB, 3, ColorSpace.TYPE_CMY, 3,
ColorSpace.TYPE_CMYK, 4, ColorSpace.TYPE_GRAY, 1,
@@ -610,7 +610,7 @@ public class ICC_Profile implements Serializable
};
for (int i = 0; i < lookup.length; i += 2)
if (header.getColorSpace() == lookup[i])
- return lookup[i + 1];
+ return lookup[i + 1];
return 3; // should never happen.
}
@@ -640,24 +640,24 @@ public class ICC_Profile implements Serializable
if (data != null)
{
- header = new ProfileHeader(data);
- tagTable = createTagTable(data);
- profileID = -1; // Not a predefined color space
+ header = new ProfileHeader(data);
+ tagTable = createTagTable(data);
+ profileID = -1; // Not a predefined color space
}
if (predef != null)
{
- predef = predef.intern();
- if (predef.equals("CS_sRGB"))
- createProfile(ColorSpace.CS_sRGB);
- if (predef.equals("CS_LINEAR_RGB"))
- createProfile(ColorSpace.CS_LINEAR_RGB);
- if (predef.equals("CS_CIEXYZ"))
- createProfile(ColorSpace.CS_CIEXYZ);
- if (predef.equals("CS_GRAY"))
- createProfile(ColorSpace.CS_GRAY);
- if (predef.equals("CS_PYCC"))
- createProfile(ColorSpace.CS_PYCC);
+ predef = predef.intern();
+ if (predef.equals("CS_sRGB"))
+ createProfile(ColorSpace.CS_sRGB);
+ if (predef.equals("CS_LINEAR_RGB"))
+ createProfile(ColorSpace.CS_LINEAR_RGB);
+ if (predef.equals("CS_CIEXYZ"))
+ createProfile(ColorSpace.CS_CIEXYZ);
+ if (predef.equals("CS_GRAY"))
+ createProfile(ColorSpace.CS_GRAY);
+ if (predef.equals("CS_PYCC"))
+ createProfile(ColorSpace.CS_PYCC);
}
}
@@ -682,9 +682,9 @@ public class ICC_Profile implements Serializable
s.writeObject("CS_PYCC");
else
{
- s.writeObject(null); // null string
- s.writeObject(getData()); // data
- return;
+ s.writeObject(null); // null string
+ s.writeObject(getData()); // data
+ return;
}
s.writeObject(null); // null data
}
@@ -702,16 +702,16 @@ public class ICC_Profile implements Serializable
Hashtable tagTable = new Hashtable();
for (int i = 0; i < nTags; i++)
{
- TagEntry te = new TagEntry(buf.getInt(tagTableOffset
- + i * TagEntry.entrySize + 4),
- buf.getInt(tagTableOffset
- + i * TagEntry.entrySize + 8),
- buf.getInt(tagTableOffset
- + i * TagEntry.entrySize + 12),
- data);
-
- if (tagTable.put(te.hashKey(), te) != null)
- throw new IllegalArgumentException("Duplicate tag in profile:" + te);
+ TagEntry te = new TagEntry(buf.getInt(tagTableOffset
+ + i * TagEntry.entrySize + 4),
+ buf.getInt(tagTableOffset
+ + i * TagEntry.entrySize + 8),
+ buf.getInt(tagTableOffset
+ + i * TagEntry.entrySize + 12),
+ data);
+
+ if (tagTable.put(te.hashKey(), te) != null)
+ throw new IllegalArgumentException("Duplicate tag in profile:" + te);
}
return tagTable;
}
@@ -724,7 +724,7 @@ public class ICC_Profile implements Serializable
{
int totalSize = ProfileHeader.HEADERSIZE; // size of header
- int tagTableSize = 4 + tagTable.size() * TagEntry.entrySize; // size of tag table
+ int tagTableSize = 4 + tagTable.size() * TagEntry.entrySize; // size of tag table
if ((tagTableSize & 0x0003) != 0)
tagTableSize += 4 - (tagTableSize & 0x0003); // pad
totalSize += tagTableSize;
@@ -732,10 +732,10 @@ public class ICC_Profile implements Serializable
Enumeration e = tagTable.elements();
while (e.hasMoreElements())
{ // tag data
- int tagSize = ((TagEntry) e.nextElement()).getSize();
- if ((tagSize & 0x0003) != 0)
- tagSize += 4 - (tagSize & 0x0003); // pad
- totalSize += tagSize;
+ int tagSize = ((TagEntry) e.nextElement()).getSize();
+ if ((tagSize & 0x0003) != 0)
+ tagSize += 4 - (tagSize & 0x0003); // pad
+ totalSize += tagSize;
}
return totalSize;
}
@@ -747,7 +747,7 @@ public class ICC_Profile implements Serializable
{
int tagTableSize = 4 + tagTable.size() * TagEntry.entrySize;
if ((tagTableSize & 0x0003) != 0)
- tagTableSize += 4 - (tagTableSize & 0x0003); // pad
+ tagTableSize += 4 - (tagTableSize & 0x0003); // pad
int offset = 4;
int tagOffset = ProfileHeader.HEADERSIZE + tagTableSize;
@@ -757,16 +757,16 @@ public class ICC_Profile implements Serializable
Enumeration e = tagTable.elements();
while (e.hasMoreElements())
{
- TagEntry tag = (TagEntry) e.nextElement();
- buf.putInt(offset, tag.getSignature());
- buf.putInt(offset + 4, tagOffset);
- buf.putInt(offset + 8, tag.getSize());
- tag.setOffset(tagOffset);
- int tagSize = tag.getSize();
- if ((tagSize & 0x0003) != 0)
- tagSize += 4 - (tagSize & 0x0003); // pad
- tagOffset += tagSize;
- offset += 12;
+ TagEntry tag = (TagEntry) e.nextElement();
+ buf.putInt(offset, tag.getSignature());
+ buf.putInt(offset + 4, tagOffset);
+ buf.putInt(offset + 8, tag.getSize());
+ tag.setOffset(tagOffset);
+ int tagSize = tag.getSize();
+ if ((tagSize & 0x0003) != 0)
+ tagSize += 4 - (tagSize & 0x0003); // pad
+ tagOffset += tagSize;
+ offset += 12;
}
return buf.array();
}
@@ -838,15 +838,15 @@ public class ICC_Profile implements Serializable
int count = buf.getInt(8);
if (count == 0)
{
- curve = new short[1];
- curve[0] = 0x0100; // 1.00 in u8fixed8
- return curve;
+ curve = new short[1];
+ curve[0] = 0x0100; // 1.00 in u8fixed8
+ return curve;
}
if (count == 1)
{
- curve = new short[1];
- curve[0] = buf.getShort(12); // other u8fixed8 gamma
- return curve;
+ curve = new short[1];
+ curve[0] = buf.getShort(12); // other u8fixed8 gamma
+ return curve;
}
curve = new short[count];
for (int i = 0; i < count; i++)
@@ -917,11 +917,11 @@ public class ICC_Profile implements Serializable
byte[] data;
try
{
- data = text.getBytes("US-ASCII");
+ data = text.getBytes("US-ASCII");
}
catch (UnsupportedEncodingException e)
{
- data = new byte[length]; // shouldn't happen
+ data = new byte[length]; // shouldn't happen
}
buf.putInt(0, (int) 0x74657874); // 'text'
@@ -940,17 +940,17 @@ public class ICC_Profile implements Serializable
int length = text.length();
ByteBuffer buf = ByteBuffer.allocate(90 + length + 1);
buf.putInt(0, (int) 0x64657363); // 'desc'
- buf.putInt(4, 0); // reserved
+ buf.putInt(4, 0); // reserved
buf.putInt(8, length + 1); // ASCII length, including null termination
byte[] data;
try
{
- data = text.getBytes("US-ASCII");
+ data = text.getBytes("US-ASCII");
}
catch (UnsupportedEncodingException e)
{
- data = new byte[length]; // shouldn't happen
+ data = new byte[length]; // shouldn't happen
}
for (int i = 0; i < length; i++)
@@ -999,7 +999,7 @@ public class ICC_Profile implements Serializable
buf.putInt(4, 0); // reserved
buf.putInt(8, trc.length); // number of points
- // put the curve values
+ // put the curve values
for (int i = 0; i < trc.length; i++)
buf.putShort(12 + i * 2, (short) (trc[i] * 65535f));
@@ -1049,31 +1049,31 @@ public class ICC_Profile implements Serializable
for (int channel = 0; channel < 3; channel++)
for (int i = 0; i < nInEntries; i++)
{
- short n = (short) ((i << 8) | i); // assumes 256 entries
- buf.putShort(52 + (channel * nInEntries + i) * 2, n);
+ short n = (short) ((i << 8) | i); // assumes 256 entries
+ buf.putShort(52 + (channel * nInEntries + i) * 2, n);
}
int clutOffset = 52 + nInEntries * nIn * 2;
for (int x = 0; x < gridpoints; x++)
for (int y = 0; y < gridpoints; y++)
- for (int z = 0; z < gridpoints; z++)
- {
- int offset = clutOffset + z * 2 * nOut + y * gridpoints * 2 * nOut
- + x * gridpoints * gridpoints * 2 * nOut;
- double xf = ((double) x) / ((double) gridpoints - 1.0);
- double yf = ((double) y) / ((double) gridpoints - 1.0);
- double zf = ((double) z) / ((double) gridpoints - 1.0);
- buf.putShort(offset, (short) (xf * 65535.0));
- buf.putShort(offset + 2, (short) (yf * 65535.0));
- buf.putShort(offset + 4, (short) (zf * 65535.0));
- }
+ for (int z = 0; z < gridpoints; z++)
+ {
+ int offset = clutOffset + z * 2 * nOut + y * gridpoints * 2 * nOut
+ + x * gridpoints * gridpoints * 2 * nOut;
+ double xf = ((double) x) / ((double) gridpoints - 1.0);
+ double yf = ((double) y) / ((double) gridpoints - 1.0);
+ double zf = ((double) z) / ((double) gridpoints - 1.0);
+ buf.putShort(offset, (short) (xf * 65535.0));
+ buf.putShort(offset + 2, (short) (yf * 65535.0));
+ buf.putShort(offset + 4, (short) (zf * 65535.0));
+ }
for (int channel = 0; channel < 3; channel++)
for (int i = 0; i < nOutEntries; i++)
{
- short n = (short) ((i << 8) | i); // assumes 256 entries
- buf.putShort(clutOffset + clutSize + (channel * nOutEntries + i) * 2,
- n);
+ short n = (short) ((i << 8) | i); // assumes 256 entries
+ buf.putShort(clutOffset + clutSize + (channel * nOutEntries + i) * 2,
+ n);
}
return buf.array();
@@ -1091,22 +1091,22 @@ public class ICC_Profile implements Serializable
switch (colorSpace)
{
case ColorSpace.CS_sRGB:
- createRGBProfile();
- return;
+ createRGBProfile();
+ return;
case ColorSpace.CS_LINEAR_RGB:
- createLinearRGBProfile();
- return;
+ createLinearRGBProfile();
+ return;
case ColorSpace.CS_CIEXYZ:
- createCIEProfile();
- return;
+ createCIEProfile();
+ return;
case ColorSpace.CS_GRAY:
- createGrayProfile();
- return;
+ createGrayProfile();
+ return;
case ColorSpace.CS_PYCC:
- createPyccProfile();
- return;
+ createPyccProfile();
+ return;
default:
- throw new IllegalArgumentException("Not a predefined color space!");
+ throw new IllegalArgumentException("Not a predefined color space!");
}
}
@@ -1139,10 +1139,10 @@ public class ICC_Profile implements Serializable
float[] in = new float[3];
for (int i = 0; i < TRC_POINTS; i++)
{
- in[0] = in[1] = in[2] = ((float) i) / ((float) TRC_POINTS - 1);
- in = cs.fromRGB(in);
- // Note this value is the same for all components.
- points[i] = in[0];
+ in[0] = in[1] = in[2] = ((float) i) / ((float) TRC_POINTS - 1);
+ in = cs.fromRGB(in);
+ // Note this value is the same for all components.
+ points[i] = in[0];
}
setData(icSigRedColorantTag, makeXYZData(r));
diff --git a/java/awt/color/ICC_ProfileGray.java b/java/awt/color/ICC_ProfileGray.java
index 3b5948dc8..f85533cec 100644
--- a/java/awt/color/ICC_ProfileGray.java
+++ b/java/awt/color/ICC_ProfileGray.java
@@ -41,7 +41,7 @@ package java.awt.color;
/**
* ICC_ProfileGray - a special case of ICC_Profiles.
*
- * The ICC_Profile.getInstance() method will return an instance of the
+ * The ICC_Profile.getInstance() method will return an instance of the
* ICC_ProfileGray subclass when all the following conditions are met:
* The device color space of the profile is TYPE_GRAY.
* The profile contains a gray TRCTag.
@@ -52,7 +52,7 @@ package java.awt.color;
* linearGray = grayTRC[deviceGray]
*
* Note that if the profile contains a CLUT for the color space conversion,
- * it should be used instead, and the TRC information ignored.
+ * it should be used instead, and the TRC information ignored.
*
* @author Sven de Marothy
* @since 1.2
diff --git a/java/awt/color/ICC_ProfileRGB.java b/java/awt/color/ICC_ProfileRGB.java
index 00393328b..cfdbf6e54 100644
--- a/java/awt/color/ICC_ProfileRGB.java
+++ b/java/awt/color/ICC_ProfileRGB.java
@@ -41,7 +41,7 @@ package java.awt.color;
/**
* ICC_ProfileRGB - a special case of ICC_Profiles.
*
- * The ICC_Profile.getInstance() method will return an instance of the
+ * The ICC_Profile.getInstance() method will return an instance of the
* ICC_ProfileRGB subclass when all the following conditions are met:
* The device color space of the profile is TYPE_RGB.
* The profile contains red, green and blue ColorantTags.
@@ -54,17 +54,17 @@ package java.awt.color;
* linearG = greenTRC[deviceG]
* linearB = blueTRC[deviceB]
* TRC curves are either a single gamma value, or a 1-dimensional lookup table.
- *
+ *
* Followed by the matrix transform:
* PCS = M*linear
*
* Where PCS is the vector of profile color space (must be XYZ) coordinates,
- * linear is the vector of linear RGB coordinates, and the matrix M is
+ * linear is the vector of linear RGB coordinates, and the matrix M is
* constructed from the ColorantTags, where the columns are red, green and
* blue respectively, and the rows are X, Y and Z.
*
* Note that if the profile contains a CLUT for the color space conversion,
- * it should be used instead, and the TRC information ignored.
+ * it should be used instead, and the TRC information ignored.
*
* @author Sven de Marothy
* @since 1.2
@@ -131,7 +131,7 @@ public class ICC_ProfileRGB extends ICC_Profile
float[][] mat = new float[3][3];
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
- mat[i][j] = matrix[i][j];
+ mat[i][j] = matrix[i][j];
return mat;
}
@@ -146,16 +146,16 @@ public class ICC_ProfileRGB extends ICC_Profile
switch (component)
{
case REDCOMPONENT:
- data = getCurve(icSigRedTRCTag);
- break;
+ data = getCurve(icSigRedTRCTag);
+ break;
case GREENCOMPONENT:
- data = getCurve(icSigGreenTRCTag);
- break;
+ data = getCurve(icSigGreenTRCTag);
+ break;
case BLUECOMPONENT:
- data = getCurve(icSigBlueTRCTag);
- break;
+ data = getCurve(icSigBlueTRCTag);
+ break;
default:
- throw new IllegalArgumentException("Not a valid component");
+ throw new IllegalArgumentException("Not a valid component");
}
if (data == null)
throw new IllegalArgumentException("Error reading TRC");
@@ -181,16 +181,16 @@ public class ICC_ProfileRGB extends ICC_Profile
switch (component)
{
case REDCOMPONENT:
- data = getCurve(icSigRedTRCTag);
- break;
+ data = getCurve(icSigRedTRCTag);
+ break;
case GREENCOMPONENT:
- data = getCurve(icSigGreenTRCTag);
- break;
+ data = getCurve(icSigGreenTRCTag);
+ break;
case BLUECOMPONENT:
- data = getCurve(icSigBlueTRCTag);
- break;
+ data = getCurve(icSigBlueTRCTag);
+ break;
default:
- throw new IllegalArgumentException("Not a valid component");
+ throw new IllegalArgumentException("Not a valid component");
}
if (data == null)
throw new IllegalArgumentException("Error reading TRC");
@@ -218,9 +218,9 @@ public class ICC_ProfileRGB extends ICC_Profile
throw new IllegalArgumentException("Error reading colorant tags!");
for (int i = 0; i < 3; i++)
{
- mat[i][0] = r[i];
- mat[i][1] = g[i];
- mat[i][2] = b[i];
+ mat[i][0] = r[i];
+ mat[i][1] = g[i];
+ mat[i][2] = b[i];
}
return mat;
}
diff --git a/java/awt/datatransfer/Clipboard.java b/java/awt/datatransfer/Clipboard.java
index 2029e2c35..d0a1d3a3f 100644
--- a/java/awt/datatransfer/Clipboard.java
+++ b/java/awt/datatransfer/Clipboard.java
@@ -111,43 +111,43 @@ public class Clipboard
* @exception IllegalStateException If the clipboard is currently unavailable
*/
public synchronized void setContents(Transferable contents,
- ClipboardOwner owner)
+ ClipboardOwner owner)
{
Transferable oldContents = getContents(null);
this.contents = contents;
if (this.owner != owner)
{
- ClipboardOwner oldOwner = this.owner;
- this.owner = owner;
- if (oldOwner != null)
- oldOwner.lostOwnership(this, oldContents);
+ ClipboardOwner oldOwner = this.owner;
+ this.owner = owner;
+ if (oldOwner != null)
+ oldOwner.lostOwnership(this, oldContents);
}
FlavorListener[] fs = getFlavorListeners();
if (fs.length > 0)
{
- // We are a bit optimistic here. We assume DataFlavors will be
- // given in the same order. If the number of flavors is
- // different or the order of the DataFlavors in the list then
- // fire a change event.
- boolean newFlavors = ((contents != null && oldContents == null)
- || (contents == null && oldContents != null));
- if (!newFlavors && contents != null && oldContents != null)
- {
- DataFlavor[] df1 = contents.getTransferDataFlavors();
- DataFlavor[] df2 = oldContents.getTransferDataFlavors();
- newFlavors = df1.length != df2.length;
-
- for (int i = 0; !newFlavors && i < df1.length; i++)
- newFlavors = !df1[i].equals(df2[i]);
- }
-
- if (newFlavors)
- {
- FlavorEvent e = new FlavorEvent(this);
- for (int i = 0; i < fs.length; i++)
- fs[i].flavorsChanged(e);
- }
+ // We are a bit optimistic here. We assume DataFlavors will be
+ // given in the same order. If the number of flavors is
+ // different or the order of the DataFlavors in the list then
+ // fire a change event.
+ boolean newFlavors = ((contents != null && oldContents == null)
+ || (contents == null && oldContents != null));
+ if (!newFlavors && contents != null && oldContents != null)
+ {
+ DataFlavor[] df1 = contents.getTransferDataFlavors();
+ DataFlavor[] df2 = oldContents.getTransferDataFlavors();
+ newFlavors = df1.length != df2.length;
+
+ for (int i = 0; !newFlavors && i < df1.length; i++)
+ newFlavors = !df1[i].equals(df2[i]);
+ }
+
+ if (newFlavors)
+ {
+ FlavorEvent e = new FlavorEvent(this);
+ for (int i = 0; i < fs.length; i++)
+ fs[i].flavorsChanged(e);
+ }
}
}
@@ -165,7 +165,7 @@ public class Clipboard
DataFlavor[] fs = getAvailableDataFlavors();
for (int i = 0; i < fs.length; i++)
if (flavor.equals(fs[i]))
- return true;
+ return true;
return false;
}
@@ -187,7 +187,7 @@ public class Clipboard
synchronized(listeners)
{
- listeners.add(listener);
+ listeners.add(listener);
}
}
@@ -198,7 +198,7 @@ public class Clipboard
synchronized(listeners)
{
- listeners.remove(listener);
+ listeners.remove(listener);
}
}
@@ -206,8 +206,8 @@ public class Clipboard
{
synchronized(listeners)
{
- return (FlavorListener[])
- listeners.toArray(new FlavorListener[listeners.size()]);
+ return (FlavorListener[])
+ listeners.toArray(new FlavorListener[listeners.size()]);
}
}
}
diff --git a/java/awt/datatransfer/ClipboardOwner.java b/java/awt/datatransfer/ClipboardOwner.java
index df758254a..b98059a0e 100644
--- a/java/awt/datatransfer/ClipboardOwner.java
+++ b/java/awt/datatransfer/ClipboardOwner.java
@@ -52,6 +52,5 @@ public interface ClipboardOwner
* @param clipboard The clipboard for which ownership was lost.
* @param contents The contents of the clipboard which are no longer owned.
*/
- void lostOwnership (Clipboard clipboard, Transferable contents);
+ void lostOwnership (Clipboard clipboard, Transferable contents);
}
-
diff --git a/java/awt/datatransfer/DataFlavor.java b/java/awt/datatransfer/DataFlavor.java
index baaf43d85..e54770434 100644
--- a/java/awt/datatransfer/DataFlavor.java
+++ b/java/awt/datatransfer/DataFlavor.java
@@ -74,24 +74,24 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* @deprecated The charset unicode is platform specific and InputStream
* deals with bytes not chars. Use <code>getRederForText()</code>.
*/
- public static final DataFlavor plainTextFlavor =
+ public static final DataFlavor plainTextFlavor =
new DataFlavor("text/plain; charset=unicode; class=java.io.InputStream",
"plain unicode text");
/**
* This is the data flavor used for transferring Java strings. The
- * MIME type is "application/x-java-serialized-object" and the
+ * MIME type is "application/x-java-serialized-object" and the
* representation class is <code>java.lang.String</code>.
*/
- public static final DataFlavor stringFlavor =
+ public static final DataFlavor stringFlavor =
new DataFlavor(java.lang.String.class, "Java Unicode String");
/**
* This is a data flavor used for transferring lists of files. The
- * representation type is a <code>java.util.List</code>, with each
+ * representation type is a <code>java.util.List</code>, with each
* element of the list being a <code>java.io.File</code>.
*/
- public static final DataFlavor javaFileListFlavor =
+ public static final DataFlavor javaFileListFlavor =
new DataFlavor("application/x-java-file-list; class=java.util.List",
"Java File List");
@@ -99,7 +99,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* This is an image flavor used for transferring images. The
* representation type is a <code>java.awt.Image</code>.
*/
- public static final DataFlavor imageFlavor =
+ public static final DataFlavor imageFlavor =
new DataFlavor(java.awt.Image.class, "Java Image");
/**
@@ -127,20 +127,20 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
/*
* Instance Variables
*/
-
+
// The MIME type for this flavor
private MimeType mimeType;
-
+
// The representation class for this flavor
private Class<?> representationClass;
-
+
// The human readable name of this flavor
private String humanPresentableName;
/*
* Static Methods
*/
-
+
/**
* This method attempts to load the named class. The following class
* loaders are searched in order: the bootstrap class loader, the
@@ -154,7 +154,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* @exception ClassNotFoundException If the class cannot be loaded.
*/
protected static final Class<?> tryToLoadClass(String className,
- ClassLoader classLoader)
+ ClassLoader classLoader)
throws ClassNotFoundException
{
// Bootstrap
@@ -164,37 +164,37 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
}
catch(ClassNotFoundException cnfe)
{
- // Ignored.
+ // Ignored.
}
-
+
// System
try
{
- ClassLoader loader = ClassLoader.getSystemClassLoader();
+ ClassLoader loader = ClassLoader.getSystemClassLoader();
return Class.forName(className, true, loader);
}
catch(ClassNotFoundException cnfe)
{
- // Ignored.
+ // Ignored.
}
-
+
// Context
try
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
return Class.forName(className, true, loader);
}
catch(ClassNotFoundException cnfe)
{
- // Ignored.
+ // Ignored.
}
-
+
if (classLoader != null)
return Class.forName(className, true, classLoader);
throw new ClassNotFoundException(className);
}
-
+
/**
* XXX - Currently returns <code>plainTextFlavor</code>.
*/
@@ -202,7 +202,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
{
return plainTextFlavor;
}
-
+
/**
* Selects the best supported text flavor on this implementation.
* Returns <code>null</code> when none of the given flavors is liked.
@@ -213,19 +213,19 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* class which is (a subclass of) <code>InputStream</code> and has a
* primary MIME type of "text" and has an supported encoding.
*/
- public static final DataFlavor
+ public static final DataFlavor
selectBestTextFlavor(DataFlavor[] availableFlavors)
{
for(int i = 0; i < availableFlavors.length; i++)
{
DataFlavor df = availableFlavors[i];
Class c = df.representationClass;
-
+
// A Reader or String is good.
if ((Reader.class.isAssignableFrom(c))
|| (String.class.isAssignableFrom(c)))
return df;
-
+
// A InputStream is good if the mime primary type is "text"
if ((InputStream.class.isAssignableFrom(c))
&& ("text".equals(df.getPrimaryType())))
@@ -246,7 +246,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
return df;
}
}
-
+
// Nothing found
return null;
}
@@ -255,14 +255,14 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
/*
* Constructors
*/
-
+
/**
* Empty public constructor needed for externalization.
* Should not be used for normal instantiation.
*/
public DataFlavor()
{
- // Used for deserialization only, nothing to do here.
+ // Used for deserialization only, nothing to do here.
}
/**
@@ -312,7 +312,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* specified cannot be loaded.
* @exception ClassNotFoundException If the class is not loaded.
*/
- public DataFlavor(String mimeType, String humanPresentableName,
+ public DataFlavor(String mimeType, String humanPresentableName,
ClassLoader classLoader)
throws ClassNotFoundException
{
@@ -444,7 +444,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
public String getHumanPresentableName()
{
return(humanPresentableName);
- }
+ }
/**
* Returns the primary MIME type for this flavor.
@@ -478,7 +478,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
{
if ("humanPresentableName".equals(paramName))
return getHumanPresentableName();
-
+
return mimeType.getParameter(paramName);
}
@@ -529,7 +529,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
*
* @param flavor The flavor to test against.
*
- * @return <code>true</code> if the flavor's MIME type is equal to this
+ * @return <code>true</code> if the flavor's MIME type is equal to this
* object's MIME type, <code>false</code> otherwise.
*/
public final boolean isMimeTypeEqual(DataFlavor flavor)
@@ -619,9 +619,9 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
if (getPrimaryType().equals(javaFileListFlavor.getPrimaryType())
&& getSubType().equals(javaFileListFlavor.getSubType())
&& javaFileListFlavor.representationClass
- .isAssignableFrom(representationClass))
+ .isAssignableFrom(representationClass))
return true;
-
+
return false ;
}
@@ -681,19 +681,19 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
if (! isRepresentationClassCharBuffer()
&& ! isRepresentationClassReader()
&& representationClass != java.lang.String.class
- && ! (representationClass.isArray()
- && representationClass.getComponentType() == Character.TYPE))
- {
- String charset = getParameter("charset");
- String otherset = flavor.getParameter("charset");
- String defaultset = Charset.defaultCharset().name();
-
- if (charset == null || charset.equals(defaultset))
+ && ! (representationClass.isArray()
+ && representationClass.getComponentType() == Character.TYPE))
+ {
+ String charset = getParameter("charset");
+ String otherset = flavor.getParameter("charset");
+ String defaultset = Charset.defaultCharset().name();
+
+ if (charset == null || charset.equals(defaultset))
return (otherset == null || otherset.equals(defaultset));
- return charset.equals(otherset);
- }
-
+ return charset.equals(otherset);
+ }
+
return true;
}
@@ -718,7 +718,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
{
if (! (obj instanceof DataFlavor))
return false;
-
+
return equals((DataFlavor) obj);
}
@@ -780,7 +780,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* the MIME type string unchanged.
*
* @param type The MIME type.
- *
+ *
* @return The MIME type.
*
* @deprecated
@@ -797,7 +797,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
*
* @exception IOException If an error occurs.
*/
- public void writeExternal(ObjectOutput stream)
+ public void writeExternal(ObjectOutput stream)
throws IOException
{
if (mimeType != null)
@@ -821,7 +821,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* @exception ClassNotFoundException If the class for an object being restored
* cannot be found.
*/
- public void readExternal(ObjectInput stream)
+ public void readExternal(ObjectInput stream)
throws IOException, ClassNotFoundException
{
mimeType = (MimeType) stream.readObject();
@@ -913,13 +913,13 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
{
if (!transferable.isDataFlavorSupported(this))
throw new UnsupportedFlavorException(this);
-
+
if (Reader.class.isAssignableFrom(representationClass))
return (Reader)transferable.getTransferData(this);
-
+
if (String.class.isAssignableFrom(representationClass))
return new StringReader((String)transferable.getTransferData(this));
-
+
if (InputStream.class.isAssignableFrom(representationClass)
&& "text".equals(getPrimaryType()))
{
@@ -929,7 +929,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
encoding = "us-ascii";
return new InputStreamReader(in, encoding);
}
-
+
throw new UnsupportedFlavorException(this);
}
@@ -965,7 +965,7 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
{
return Reader.class.isAssignableFrom(representationClass);
}
-
+
/**
* Returns whether this <code>DataFlavor</code> is a valid text flavor for
* this implementation of the Java platform. Only flavors equivalent to
@@ -975,12 +975,12 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* If this flavor supports the charset parameter, it must be equivalent to
* <code>DataFlavor.stringFlavor</code>, or its representation must be
* <code>java.io.Reader</code>, <code>java.lang.String</code>,
- * <code>java.nio.CharBuffer</code>, <code>java.io.InputStream</code> or
+ * <code>java.nio.CharBuffer</code>, <code>java.io.InputStream</code> or
* <code>java.nio.ByteBuffer</code>,
- * If the representation is <code>java.io.InputStream</code> or
- * <code>java.nio.ByteBuffer</code>, then this flavor's <code>charset</code>
- * parameter must be supported by this implementation of the Java platform.
- * If a charset is not specified, then the platform default charset, which
+ * If the representation is <code>java.io.InputStream</code> or
+ * <code>java.nio.ByteBuffer</code>, then this flavor's <code>charset</code>
+ * parameter must be supported by this implementation of the Java platform.
+ * If a charset is not specified, then the platform default charset, which
* is always supported, is assumed.
* <p>
* If this flavor does not support the charset parameter, its
@@ -996,16 +996,16 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
* @since 1.4
*/
public boolean isFlavorTextType() {
- // FIXME: I'm not 100% sure if this implementation does the same like sun's does
+ // FIXME: I'm not 100% sure if this implementation does the same like sun's does
if(equals(DataFlavor.stringFlavor) || getPrimaryType().equals("text"))
{
String charset = getParameter("charset");
Class c = getRepresentationClass();
- if(charset != null)
- {
- if(Reader.class.isAssignableFrom(c)
- || CharBuffer.class.isAssignableFrom(c)
- || String.class.isAssignableFrom(c))
+ if(charset != null)
+ {
+ if(Reader.class.isAssignableFrom(c)
+ || CharBuffer.class.isAssignableFrom(c)
+ || String.class.isAssignableFrom(c))
{
return true;
}
@@ -1024,4 +1024,3 @@ public class DataFlavor implements java.io.Externalizable, Cloneable
return false;
}
} // class DataFlavor
-
diff --git a/java/awt/datatransfer/FlavorEvent.java b/java/awt/datatransfer/FlavorEvent.java
index 38b481871..8a292f850 100644
--- a/java/awt/datatransfer/FlavorEvent.java
+++ b/java/awt/datatransfer/FlavorEvent.java
@@ -45,7 +45,7 @@ import java.util.EventObject;
* Fired by a ClipBoard for registered FlavorListeners.
*
* @author Mark J. Wielaard (mark@klomp.org)
- *
+ *
* @since 1.5
*/
public class FlavorEvent extends EventObject
diff --git a/java/awt/datatransfer/FlavorListener.java b/java/awt/datatransfer/FlavorListener.java
index 31b164d6b..eb388aa84 100644
--- a/java/awt/datatransfer/FlavorListener.java
+++ b/java/awt/datatransfer/FlavorListener.java
@@ -1,4 +1,4 @@
-/* FlavorListener -- Interface for tagging an interest in FlavorEvents.
+/* FlavorListener -- Interface for tagging an interest in FlavorEvents.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/datatransfer/MimeType.java b/java/awt/datatransfer/MimeType.java
index 8d2dcc01d..143e8700b 100644
--- a/java/awt/datatransfer/MimeType.java
+++ b/java/awt/datatransfer/MimeType.java
@@ -124,7 +124,7 @@ class MimeType
* Returns the parameter for the <code>key</code>.
*
* @param key the parameter key
- *
+ *
* @return the parameter for the <code>key</code>
*/
String getParameter(String key)
diff --git a/java/awt/datatransfer/StringSelection.java b/java/awt/datatransfer/StringSelection.java
index b74f2fa64..4b64cda57 100644
--- a/java/awt/datatransfer/StringSelection.java
+++ b/java/awt/datatransfer/StringSelection.java
@@ -55,7 +55,7 @@ public class StringSelection implements Transferable, ClipboardOwner
// List of flavors we support
// XXX: DataFlavor.plainTextFlavor is deprecated.
-static final DataFlavor[] supported_flavors
+static final DataFlavor[] supported_flavors
= { DataFlavor.stringFlavor,
DataFlavor.plainTextFlavor };
@@ -154,5 +154,4 @@ lostOwnership(Clipboard clipboard, Transferable contents)
// FIXME: What does this do?
}
-} // class StringSelection
-
+} // class StringSelection
diff --git a/java/awt/datatransfer/SystemFlavorMap.java b/java/awt/datatransfer/SystemFlavorMap.java
index 7f296b594..65c14c1ba 100644
--- a/java/awt/datatransfer/SystemFlavorMap.java
+++ b/java/awt/datatransfer/SystemFlavorMap.java
@@ -67,30 +67,30 @@ import java.util.WeakHashMap;
public final class SystemFlavorMap implements FlavorMap, FlavorTable
{
/**
- * The map which maps the thread's <code>ClassLoaders</code> to
+ * The map which maps the thread's <code>ClassLoaders</code> to
* <code>SystemFlavorMaps</code>.
*/
private static final Map systemFlavorMaps = new WeakHashMap();
-
+
/**
* Constant which is used to prefix encode Java MIME types.
*/
private static final String GNU_JAVA_MIME_PREFIX = "gnu.java:";
-
+
/**
- * This map maps native <code>String</code>s to lists of
+ * This map maps native <code>String</code>s to lists of
* <code>DataFlavor</code>s
*/
private HashMap<String,List<DataFlavor>> nativeToFlavorMap =
new HashMap<String,List<DataFlavor>>();
-
+
/**
- * This map maps <code>DataFlavor</code>s to lists of native
+ * This map maps <code>DataFlavor</code>s to lists of native
* <code>String</code>s
*/
private HashMap<DataFlavor, List<String>> flavorToNativeMap =
new HashMap<DataFlavor, List<String>>();
-
+
/**
* Private constructor.
*/
@@ -152,7 +152,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
// Check valid mime type.
MimeType type = new MimeType(mime);
DataFlavor flav = new DataFlavor(mime);
-
+
List<DataFlavor> flavs = nativeToFlavorMap.get(nat);
if (flavs == null)
{
@@ -207,7 +207,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* @return A <code>Map</code> of data flavors to native type names.
*/
public Map<String, DataFlavor> getFlavorsForNatives (String[] natives)
- {
+ {
return new HashMap<String, DataFlavor>();
}
@@ -219,18 +219,18 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
{
ClassLoader classLoader = Thread.currentThread()
.getContextClassLoader();
-
- //if ContextClassLoader not set, use system default
+
+ //if ContextClassLoader not set, use system default
if (classLoader == null)
{
classLoader = ClassLoader.getSystemClassLoader();
}
-
+
synchronized(systemFlavorMaps)
{
- FlavorMap map = (FlavorMap)
+ FlavorMap map = (FlavorMap)
systemFlavorMaps.get(classLoader);
- if (map == null)
+ if (map == null)
{
map = new SystemFlavorMap();
systemFlavorMaps.put(classLoader, map);
@@ -268,7 +268,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
/**
* Encodes a <code>DataFlavor</code> for use as a <code>String</code>
- * native. The format of an encoded <code>DataFlavor</code> is
+ * native. The format of an encoded <code>DataFlavor</code> is
* implementation-dependent. The only restrictions are:
* <ul>
* <li>The encoded representation is <code>null</code> if and only if the
@@ -313,7 +313,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* Decodes a <code>String</code> native for use as a Java MIME type.
*
* @param name the <code>String</code> to decode
- * @return the decoded Java MIME type, or <code>null</code> if nat
+ * @return the decoded Java MIME type, or <code>null</code> if nat
* is not an encoded <code>String</code> native
*/
public static String decodeJavaMIMEType (String name)
@@ -322,7 +322,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
{
return name.substring(GNU_JAVA_MIME_PREFIX.length());
}
- else
+ else
return null;
}
@@ -334,27 +334,27 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
throws ClassNotFoundException
{
String javaMIMEType = decodeJavaMIMEType (name);
-
+
if (javaMIMEType != null)
return new DataFlavor (javaMIMEType);
else
return null;
}
- /**
- * Returns a List of <code>DataFlavors</code> to which the specified
- * <code>String</code> native can be translated by the data transfer
- * subsystem. The <code>List</code> will be sorted from best
- * <code>DataFlavor</code> to worst. That is, the first <code>DataFlavor
- * </code> will best reflect data in the specified native to a Java
- * application.
+ /**
+ * Returns a List of <code>DataFlavors</code> to which the specified
+ * <code>String</code> native can be translated by the data transfer
+ * subsystem. The <code>List</code> will be sorted from best
+ * <code>DataFlavor</code> to worst. That is, the first <code>DataFlavor
+ * </code> will best reflect data in the specified native to a Java
+ * application.
* <p>
- * If the specified native is previously unknown to the data transfer
- * subsystem, and that native has been properly encoded, then invoking
- * this method will establish a mapping in both directions between the
- * specified native and a DataFlavor whose MIME type is a decoded
+ * If the specified native is previously unknown to the data transfer
+ * subsystem, and that native has been properly encoded, then invoking
+ * this method will establish a mapping in both directions between the
+ * specified native and a DataFlavor whose MIME type is a decoded
* version of the native.
- */
+ */
public List<DataFlavor> getFlavorsForNative(String nat)
{
List<DataFlavor> ret = new ArrayList<DataFlavor>();
@@ -402,7 +402,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
}
return ret;
}
-
+
/**
* Adds a mapping from a single <code>String</code> native to a single
* <code>DataFlavor</code>. Unlike <code>getFlavorsForNative</code>, the
@@ -421,13 +421,13 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* @see #addUnencodedNativeForFlavor
* @since 1.4
*/
- public synchronized void addFlavorForUnencodedNative(String nativeStr,
+ public synchronized void addFlavorForUnencodedNative(String nativeStr,
DataFlavor flavor)
{
if ((nativeStr == null) || (flavor == null))
throw new NullPointerException();
List<DataFlavor> flavors = nativeToFlavorMap.get(nativeStr);
- if (flavors == null)
+ if (flavors == null)
{
flavors = new ArrayList<DataFlavor>();
nativeToFlavorMap.put(nativeStr, flavors);
@@ -438,7 +438,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
flavors.add(flavor);
}
}
-
+
/**
* Adds a mapping from the specified <code>DataFlavor</code> (and all
* <code>DataFlavor</code>s equal to the specified <code>DataFlavor</code>)
@@ -446,7 +446,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* Unlike <code>getNativesForFlavor</code>, the mapping will only be
* established in one direction, and the native will not be encoded. To
* establish a two-way mapping, call
- * <code>addFlavorForUnencodedNative</code> as well. The new mapping will
+ * <code>addFlavorForUnencodedNative</code> as well. The new mapping will
* be of lower priority than any existing mapping.
* This method has no effect if a mapping from the specified or equal
* <code>DataFlavor</code> to the specified <code>String</code> native
@@ -460,12 +460,12 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* @since 1.4
*/
public synchronized void addUnencodedNativeForFlavor(DataFlavor flavor,
- String nativeStr)
+ String nativeStr)
{
if ((nativeStr == null) || (flavor == null))
throw new NullPointerException();
List<String> natives = flavorToNativeMap.get(flavor);
- if (natives == null)
+ if (natives == null)
{
natives = new ArrayList<String>();
flavorToNativeMap.put(flavor, natives);
@@ -476,11 +476,11 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
natives.add(nativeStr);
}
}
-
+
/**
* Discards the current mappings for the specified <code>DataFlavor</code>
* and all <code>DataFlavor</code>s equal to the specified
- * <code>DataFlavor</code>, and creates new mappings to the
+ * <code>DataFlavor</code>, and creates new mappings to the
* specified <code>String</code> natives.
* Unlike <code>getNativesForFlavor</code>, the mappings will only be
* established in one direction, and the natives will not be encoded. To
@@ -492,7 +492,7 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* If the array contains several elements that reference equal
* <code>String</code> natives, this method will establish new mappings
* for the first of those elements and ignore the rest of them.
- * <p>
+ * <p>
* It is recommended that client code not reset mappings established by the
* data transfer subsystem. This method should only be used for
* application-level mappings.
@@ -506,18 +506,18 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* @since 1.4
*/
public synchronized void setNativesForFlavor(DataFlavor flavor,
- String[] natives)
+ String[] natives)
{
if ((natives == null) || (flavor == null))
throw new NullPointerException();
-
+
flavorToNativeMap.remove(flavor);
- for (int i = 0; i < natives.length; i++)
+ for (int i = 0; i < natives.length; i++)
{
addUnencodedNativeForFlavor(flavor, natives[i]);
}
}
-
+
/**
* Discards the current mappings for the specified <code>String</code>
* native, and creates new mappings to the specified
@@ -546,13 +546,13 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable
* @since 1.4
*/
public synchronized void setFlavorsForNative(String nativeStr,
- DataFlavor[] flavors)
+ DataFlavor[] flavors)
{
if ((nativeStr == null) || (flavors == null))
throw new NullPointerException();
-
+
nativeToFlavorMap.remove(nativeStr);
- for (int i = 0; i < flavors.length; i++)
+ for (int i = 0; i < flavors.length; i++)
{
addFlavorForUnencodedNative(nativeStr, flavors[i]);
}
diff --git a/java/awt/datatransfer/Transferable.java b/java/awt/datatransfer/Transferable.java
index 807539236..99239fcc6 100644
--- a/java/awt/datatransfer/Transferable.java
+++ b/java/awt/datatransfer/Transferable.java
@@ -80,4 +80,3 @@ public interface Transferable
throws UnsupportedFlavorException, IOException;
} // interface Transferable
-
diff --git a/java/awt/datatransfer/UnsupportedFlavorException.java b/java/awt/datatransfer/UnsupportedFlavorException.java
index 1c1da0348..0ca17b2e9 100644
--- a/java/awt/datatransfer/UnsupportedFlavorException.java
+++ b/java/awt/datatransfer/UnsupportedFlavorException.java
@@ -62,4 +62,4 @@ public class UnsupportedFlavorException extends Exception
{
super(flavor == null ? null : flavor.getHumanPresentableName());
}
-} // class UnsupportedFlavorException
+} // class UnsupportedFlavorException
diff --git a/java/awt/dnd/Autoscroll.java b/java/awt/dnd/Autoscroll.java
index ba4d4476c..094063ce1 100644
--- a/java/awt/dnd/Autoscroll.java
+++ b/java/awt/dnd/Autoscroll.java
@@ -67,4 +67,3 @@ public interface Autoscroll
void autoscroll (Point location);
} // interface Autoscroll
-
diff --git a/java/awt/dnd/DnDEventMulticaster.java b/java/awt/dnd/DnDEventMulticaster.java
index d9f5ec00f..30594c2c7 100644
--- a/java/awt/dnd/DnDEventMulticaster.java
+++ b/java/awt/dnd/DnDEventMulticaster.java
@@ -47,7 +47,7 @@ class DnDEventMulticaster extends AWTEventMulticaster
{
super (a, b);
}
-
+
public static DragSourceListener add (DragSourceListener a,
DragSourceListener b)
{
@@ -59,7 +59,7 @@ class DnDEventMulticaster extends AWTEventMulticaster
{
return (DragSourceMotionListener) addInternal (a, b);
}
-
+
public static DragSourceListener remove (DragSourceListener a,
DragSourceListener b)
{
diff --git a/java/awt/dnd/DragGestureEvent.java b/java/awt/dnd/DragGestureEvent.java
index 2a22abb12..e127a7dc1 100644
--- a/java/awt/dnd/DragGestureEvent.java
+++ b/java/awt/dnd/DragGestureEvent.java
@@ -87,67 +87,67 @@ public class DragGestureEvent extends EventObject
/**
* Returns the source casted as a DragGestureRecognizer.
- *
+ *
* @return the source casted as a DragGestureRecognizer.
*/
public DragGestureRecognizer getSourceAsDragGestureRecognizer()
{
return (DragGestureRecognizer) getSource();
}
-
+
/**
* Returns the Component corresponding to this.
- *
+ *
* @return the Component corresponding to this.
*/
public Component getComponent()
{
return component;
}
-
+
/**
* Gets the DragSource corresponding to this.
- *
+ *
* @return the DragSource corresponding to this.
*/
public DragSource getDragSource()
{
return dragSource;
}
-
+
/**
* Returns the origin of the drag.
- *
+ *
* @return the origin of the drag.
*/
public Point getDragOrigin()
{
return origin;
}
-
+
/**
* Gets an iterator representation of the List of events.
- *
+ *
* @return an iterator representation of the List of events.
*/
public Iterator<InputEvent> iterator()
{
return events.iterator();
}
-
+
/**
* Gets an array representation of the List of events.
- *
+ *
* @return an array representation of the List of events.
*/
public Object[] toArray()
{
return events.toArray();
}
-
+
/**
* Gets an array representation of the List of events.
- *
+ *
* @param array - the array to store the events in.
* @return an array representation of the List of events.
*/
@@ -158,17 +158,17 @@ public class DragGestureEvent extends EventObject
/**
* Gets the user's preferred action.
- *
+ *
* @return the user's preferred action.
*/
public int getDragAction()
{
return action;
}
-
+
/**
* Get the event that triggered this gesture.
- *
+ *
* @return the event that triggered this gesture.
*/
public InputEvent getTriggerEvent()
diff --git a/java/awt/dnd/DragGestureRecognizer.java b/java/awt/dnd/DragGestureRecognizer.java
index fb37b4fc7..c41402ca7 100644
--- a/java/awt/dnd/DragGestureRecognizer.java
+++ b/java/awt/dnd/DragGestureRecognizer.java
@@ -164,7 +164,7 @@ public abstract class DragGestureRecognizer implements Serializable
{
if(dragGestureListener != null)
dragGestureListener.dragGestureRecognized
- (new DragGestureEvent(this, dragAction, p, events));
+ (new DragGestureEvent(this, dragAction, p, events));
resetRecognizer();
}
diff --git a/java/awt/dnd/DragSource.java b/java/awt/dnd/DragSource.java
index cd4a93a3e..af8b37668 100644
--- a/java/awt/dnd/DragSource.java
+++ b/java/awt/dnd/DragSource.java
@@ -74,7 +74,7 @@ public class DragSource implements Serializable
private transient FlavorMap flavorMap = SystemFlavorMap.getDefaultFlavorMap ();
private transient DragSourceListener dragSourceListener;
private transient DragSourceMotionListener dragSourceMotionListener;
-
+
private static DragSource ds;
private DragSourceContextPeer peer;
private DragSourceContext context;
@@ -95,7 +95,7 @@ public class DragSource implements Serializable
/**
* Gets the default drag source.
- *
+ *
* @exception HeadlessException If GraphicsEnvironment.isHeadless() is true.
*/
public static DragSource getDefaultDragSource()
@@ -139,14 +139,14 @@ public class DragSource implements Serializable
// This function sends the same message to the context, which then forwards
// it to the peer, passing itself as a parameter. Now, the native system has
// access to the Transferable through the context.
-
+
try
{
flavorMap = map;
-
+
if (peer == null)
peer = Toolkit.getDefaultToolkit().createDragSourceContextPeer(trigger);
-
+
if (context == null)
context = createDragSourceContext(peer, trigger,
dragCursor,
@@ -210,7 +210,7 @@ public class DragSource implements Serializable
/**
* Creates the DragSourceContext to handle this drag.
*
- * @exception IllegalArgumentException
+ * @exception IllegalArgumentException
* @exception NullPointerException If dscp, dgl, dragImage or t is null.
*/
protected DragSourceContext
@@ -225,16 +225,16 @@ public class DragSource implements Serializable
{
return flavorMap;
}
-
+
public <T extends DragGestureRecognizer> T
- createDragGestureRecognizer(Class<T> recognizer,
- Component c,
- int actions,
- DragGestureListener dgl)
+ createDragGestureRecognizer(Class<T> recognizer,
+ Component c,
+ int actions,
+ DragGestureListener dgl)
{
return (T) Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer,
- this, c,
- actions, dgl);
+ this, c,
+ actions, dgl);
}
public DragGestureRecognizer createDefaultDragGestureRecognizer(Component c,
@@ -301,20 +301,20 @@ public class DragSource implements Serializable
{
if (listenerType == DragSourceListener.class)
return DnDEventMulticaster.getListeners (dragSourceListener,
- listenerType);
+ listenerType);
if (listenerType == DragSourceMotionListener.class)
return DnDEventMulticaster.getListeners (dragSourceMotionListener,
- listenerType);
+ listenerType);
// Return an empty EventListener array.
return (T[]) new EventListener [0];
}
-
+
/**
* TODO
* @return TODO
- *
+ *
* @since 1.5
*/
public static int getDragThreshold()
diff --git a/java/awt/dnd/DragSourceContext.java b/java/awt/dnd/DragSourceContext.java
index ed1cbaa44..e21b4fdae 100644
--- a/java/awt/dnd/DragSourceContext.java
+++ b/java/awt/dnd/DragSourceContext.java
@@ -72,7 +72,7 @@ public class DragSourceContext
private int sourceActions;
private Image image;
private Point offset;
-
+
/**
* Initializes a drag source context.
*
@@ -81,13 +81,13 @@ public class DragSourceContext
* or if the source actions for the DragGestureRecognizer associated with the
* trigger event are equal to DnDConstants.ACTION_NONE.
* @exception NullPointerException If peer, trans or trigger is null or if the
- * image is not null but the offset is.
+ * image is not null but the offset is.
*/
public DragSourceContext (DragSourceContextPeer peer,
DragGestureEvent trigger, Cursor cursor,
Image image, Point offset, Transferable trans,
DragSourceListener dsl)
- {
+ {
if (peer == null
|| trigger == null || trans == null
|| (image != null && offset == null))
@@ -108,7 +108,7 @@ public class DragSourceContext
this.transferable = trans;
this.dragSourceListener = dsl;
this.sourceActions = trigger.getSourceAsDragGestureRecognizer().getSourceActions();
-
+
setCursor(cursor);
updateCurrentCursor(trigger.getDragAction(), sourceActions, DEFAULT);
}
@@ -116,7 +116,7 @@ public class DragSourceContext
/**
* Returns the DragSource object associated with the
* DragGestureEvent.
- *
+ *
* @return the DragSource associated with the trigger.
*/
public DragSource getDragSource()
@@ -126,7 +126,7 @@ public class DragSourceContext
/**
* Returns the component associated with this.
- *
+ *
* @return the component associated with the trigger.
*/
public Component getComponent()
@@ -136,7 +136,7 @@ public class DragSourceContext
/**
* Gets the trigger associated with this.
- *
+ *
* @return the trigger.
*/
public DragGestureEvent getTrigger()
@@ -146,7 +146,7 @@ public class DragSourceContext
/**
* Returns the source actions for the DragGestureRecognizer.
- *
+ *
* @return the source actions for DragGestureRecognizer.
*/
public int getSourceActions()
@@ -158,7 +158,7 @@ public class DragSourceContext
/**
* Sets the cursor for this drag operation to the specified cursor.
- *
+ *
* @param cursor c - the Cursor to use, or null to use the default drag
* cursor.
*/
@@ -175,7 +175,7 @@ public class DragSourceContext
/**
* Returns the current cursor or null if the default
* drag cursor is used.
- *
+ *
* @return the current cursor or null.
*/
public Cursor getCursor()
@@ -215,57 +215,57 @@ public class DragSourceContext
/**
* Calls dragEnter on the listeners registered with this
* and with the DragSource.
- *
+ *
* @param e - the DragSourceDragEvent
*/
public void dragEnter(DragSourceDragEvent e)
{
if (dragSourceListener != null)
dragSourceListener.dragEnter(e);
-
+
DragSource ds = getDragSource();
DragSourceListener[] dsl = ds.getDragSourceListeners();
for (int i = 0; i < dsl.length; i++)
dsl[i].dragEnter(e);
-
+
updateCurrentCursor(e.getDropAction(), e.getTargetActions(), ENTER);
}
/**
* Calls dragOver on the listeners registered with this
* and with the DragSource.
- *
+ *
* @param e - the DragSourceDragEvent
*/
public void dragOver(DragSourceDragEvent e)
{
if (dragSourceListener != null)
dragSourceListener.dragOver(e);
-
+
DragSource ds = getDragSource();
DragSourceListener[] dsl = ds.getDragSourceListeners();
for (int i = 0; i < dsl.length; i++)
dsl[i].dragOver(e);
-
+
updateCurrentCursor(e.getDropAction(), e.getTargetActions(), OVER);
}
-
+
/**
* Calls dragExit on the listeners registered with this
* and with the DragSource.
- *
+ *
* @param e - the DragSourceEvent
*/
public void dragExit(DragSourceEvent e)
{
if (dragSourceListener != null)
dragSourceListener.dragExit(e);
-
+
DragSource ds = getDragSource();
DragSourceListener[] dsl = ds.getDragSourceListeners();
for (int i = 0; i < dsl.length; i++)
dsl[i].dragExit(e);
-
+
updateCurrentCursor(DnDConstants.ACTION_NONE, DnDConstants.ACTION_NONE,
DEFAULT);
}
@@ -273,33 +273,33 @@ public class DragSourceContext
/**
* Calls dropActionChanged on the listeners registered with this
* and with the DragSource.
- *
+ *
* @param e - the DragSourceDragEvent
*/
public void dropActionChanged(DragSourceDragEvent e)
{
if (dragSourceListener != null)
dragSourceListener.dropActionChanged(e);
-
+
DragSource ds = getDragSource();
DragSourceListener[] dsl = ds.getDragSourceListeners();
for (int i = 0; i < dsl.length; i++)
dsl[i].dropActionChanged(e);
-
+
updateCurrentCursor(e.getDropAction(), e.getTargetActions(), CHANGED);
}
/**
* Calls dragDropEnd on the listeners registered with this
* and with the DragSource.
- *
+ *
* @param e - the DragSourceDropEvent
*/
public void dragDropEnd(DragSourceDropEvent e)
{
if (dragSourceListener != null)
dragSourceListener.dragDropEnd(e);
-
+
DragSource ds = getDragSource();
DragSourceListener[] dsl = ds.getDragSourceListeners();
for (int i = 0; i < dsl.length; i++)
@@ -308,7 +308,7 @@ public class DragSourceContext
/**
* Calls dragMouseMoved on the listeners registered with the DragSource.
- *
+ *
* @param e - the DragSourceDragEvent
*/
public void dragMouseMoved(DragSourceDragEvent e)
@@ -321,7 +321,7 @@ public class DragSourceContext
/**
* Returns the Transferable set with this object.
- *
+ *
* @return the transferable.
*/
public Transferable getTransferable()
@@ -333,7 +333,7 @@ public class DragSourceContext
* This function sets the drag cursor for the specified operation, actions and
* status if the default drag cursor is active. Otherwise, the cursor is not
* updated in any way.
- *
+ *
* @param dropOp - the current operation.
* @param targetAct - the supported actions.
* @param status - the status of the cursor (constant).
@@ -370,7 +370,7 @@ public class DragSourceContext
newCursor = DragSource.DefaultCopyDrop;
}
}
-
+
if (cursor == null || ! cursor.equals(newCursor))
{
cursor = newCursor;
diff --git a/java/awt/dnd/DragSourceDropEvent.java b/java/awt/dnd/DragSourceDropEvent.java
index 7621262d8..4df984994 100644
--- a/java/awt/dnd/DragSourceDropEvent.java
+++ b/java/awt/dnd/DragSourceDropEvent.java
@@ -60,7 +60,7 @@ public class DragSourceDropEvent extends DragSourceEvent
this.dropAction = 0;
this.dropSuccess = false;
}
-
+
public DragSourceDropEvent (DragSourceContext context, int dropAction,
boolean dropSuccess)
{
diff --git a/java/awt/dnd/DragSourceEvent.java b/java/awt/dnd/DragSourceEvent.java
index c5cd42a4e..c9e18d712 100644
--- a/java/awt/dnd/DragSourceEvent.java
+++ b/java/awt/dnd/DragSourceEvent.java
@@ -50,7 +50,7 @@ public class DragSourceEvent extends EventObject
* Compatible with JDK 1.2+
*/
private static final long serialVersionUID = -763287114604032641L;
-
+
private final boolean locationSpecified;
private final int x;
private final int y;
diff --git a/java/awt/dnd/DropTarget.java b/java/awt/dnd/DropTarget.java
index 63be5ac04..e5180d074 100644
--- a/java/awt/dnd/DropTarget.java
+++ b/java/awt/dnd/DropTarget.java
@@ -1,4 +1,4 @@
-/* DropTarget.java --
+/* DropTarget.java --
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -164,7 +164,7 @@ public class DropTarget
private DropTargetListener dropTargetListener;
private DropTarget.DropTargetAutoScroller autoscroller;
private boolean active = true;
-
+
/**
* Creates a <code>DropTarget</code> object.
*
@@ -175,7 +175,7 @@ public class DropTarget
{
this (null, DnDConstants.ACTION_COPY_OR_MOVE, null, true, null);
}
-
+
/**
* Creates a <code>DropTarget</code> object.
*
@@ -186,7 +186,7 @@ public class DropTarget
{
this (c, DnDConstants.ACTION_COPY_OR_MOVE, dtl, true, null);
}
-
+
/**
* Creates a <code>DropTarget</code> object.
*
@@ -197,7 +197,7 @@ public class DropTarget
{
this (c, i, dtl, true, null);
}
-
+
/**
* Creates a <code>DropTarget</code> object.
*
@@ -208,7 +208,7 @@ public class DropTarget
{
this (c, i, dtl, b, null);
}
-
+
/**
* Creates a <code>DropTarget</code> object.
*
@@ -224,14 +224,14 @@ public class DropTarget
setComponent(c);
setDefaultActions(i);
dropTargetListener = dtl;
-
+
if (fm == null)
flavorMap = SystemFlavorMap.getDefaultFlavorMap();
else
flavorMap = fm;
-
+
setActive (b);
-
+
if (c != null)
c.setDropTarget(this);
}
@@ -284,7 +284,7 @@ public class DropTarget
/**
* Adds a new <code>DropTargetListener</code>.
- *
+ *
* @exception TooManyListenersException Sun's JDK does not, despite
* documentation, throw this exception here when you install an additional
* <code>DropTargetListener</code>. So to be compatible, we do the same
@@ -295,13 +295,13 @@ public class DropTarget
{
if (dtl == null)
return;
-
+
if (dtl.equals(this))
throw new IllegalArgumentException();
-
+
if (dropTargetListener != null)
throw new TooManyListenersException();
-
+
dropTargetListener = dtl;
}
@@ -397,7 +397,7 @@ public class DropTarget
{
if (dropTargetContext == null)
dropTargetContext = createDropTargetContext ();
-
+
return dropTargetContext;
}
@@ -405,7 +405,7 @@ public class DropTarget
{
if (dropTargetContext == null)
dropTargetContext = new DropTargetContext (this);
-
+
return dropTargetContext;
}
diff --git a/java/awt/dnd/DropTargetContext.java b/java/awt/dnd/DropTargetContext.java
index d970e2e08..4c21a6e8a 100644
--- a/java/awt/dnd/DropTargetContext.java
+++ b/java/awt/dnd/DropTargetContext.java
@@ -66,7 +66,7 @@ public class DropTargetContext implements Serializable
this.transferable = t;
this.isLocal = local;
}
-
+
public DataFlavor[] getTransferDataFlavors()
{
return transferable.getTransferDataFlavors();
@@ -156,7 +156,7 @@ public class DropTargetContext implements Serializable
protected void rejectDrop ()
{
if (dtcp != null)
- dtcp.rejectDrop();
+ dtcp.rejectDrop();
}
protected DataFlavor[] getCurrentDataFlavors ()
@@ -181,7 +181,7 @@ public class DropTargetContext implements Serializable
*
* @exception InvalidDnDOperationException If a drag is not outstanding.
*/
- protected Transferable getTransferable()
+ protected Transferable getTransferable()
throws InvalidDnDOperationException
{
// FIXME: Implement this
diff --git a/java/awt/dnd/DropTargetDragEvent.java b/java/awt/dnd/DropTargetDragEvent.java
index 58feb4387..21c9e2b35 100644
--- a/java/awt/dnd/DropTargetDragEvent.java
+++ b/java/awt/dnd/DropTargetDragEvent.java
@@ -89,10 +89,10 @@ public class DropTargetDragEvent extends DropTargetEvent
| DnDConstants.ACTION_COPY_OR_MOVE
| DnDConstants.ACTION_LINK
| DnDConstants.ACTION_REFERENCE;
-
+
if (~(srcActions ^ srcActionsMask) != 0)
throw new IllegalArgumentException ();
-
+
this.dropAction = dropAction;
this.srcActions = srcActions;
this.location = location;
@@ -107,12 +107,12 @@ public class DropTargetDragEvent extends DropTargetEvent
{
return context.getCurrentDataFlavors ();
}
-
+
public List<DataFlavor> getCurrentDataFlavorsAsList ()
{
return context.getCurrentDataFlavorsAsList ();
}
-
+
public int getDropAction()
{
return dropAction & ((DropTargetContext) source).getTargetActions();
@@ -137,12 +137,12 @@ public class DropTargetDragEvent extends DropTargetEvent
{
context.rejectDrag ();
}
-
+
/**
* TODO
- *
+ *
* @return
- *
+ *
* @since 1.5
*/
public Transferable getTransferable()
diff --git a/java/awt/dnd/DropTargetDropEvent.java b/java/awt/dnd/DropTargetDropEvent.java
index dd85ef712..333f8c6cc 100644
--- a/java/awt/dnd/DropTargetDropEvent.java
+++ b/java/awt/dnd/DropTargetDropEvent.java
@@ -56,7 +56,7 @@ public class DropTargetDropEvent extends DropTargetEvent
private final int actions;
private final Point location;
private final boolean isLocalTx;
-
+
/**
* Initializes a <code>DropTargetDropEvent</code>. By default this constructor
* assumes that the target is not int same JVM.
@@ -103,16 +103,16 @@ public class DropTargetDropEvent extends DropTargetEvent
| DnDConstants.ACTION_COPY_OR_MOVE
| DnDConstants.ACTION_LINK
| DnDConstants.ACTION_REFERENCE;
-
+
if (~(actions ^ actionsMask) != 0)
throw new IllegalArgumentException();
-
+
this.dropAction = dropAction;
this.actions = actions;
this.location = location;
this.isLocalTx = isLocalTx;
}
-
+
public Point getLocation()
{
return location;
diff --git a/java/awt/dnd/DropTargetEvent.java b/java/awt/dnd/DropTargetEvent.java
index cb2aec640..fc599a9e2 100644
--- a/java/awt/dnd/DropTargetEvent.java
+++ b/java/awt/dnd/DropTargetEvent.java
@@ -1,4 +1,4 @@
-/* DropTarget.java --
+/* DropTarget.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -54,7 +54,7 @@ public class DropTargetEvent extends EventObject
super (context);
this.context = context;
}
-
+
public DropTargetContext getDropTargetContext ()
{
return context;
diff --git a/java/awt/dnd/MouseDragGestureRecognizer.java b/java/awt/dnd/MouseDragGestureRecognizer.java
index 9a2a7bc4c..08a2ac085 100644
--- a/java/awt/dnd/MouseDragGestureRecognizer.java
+++ b/java/awt/dnd/MouseDragGestureRecognizer.java
@@ -45,7 +45,7 @@ import java.awt.event.MouseMotionListener;
/**
* @author Michael Koch (konqueror@gmx.de)
*/
-public abstract class MouseDragGestureRecognizer
+public abstract class MouseDragGestureRecognizer
extends DragGestureRecognizer
implements MouseListener, MouseMotionListener
{
@@ -53,7 +53,7 @@ public abstract class MouseDragGestureRecognizer
* Creates a <code>MouseDragGestureRecognizer</code> object.
*/
protected MouseDragGestureRecognizer (DragSource ds, Component c, int act,
- DragGestureListener dgl)
+ DragGestureListener dgl)
{
super (ds, c, act, dgl);
}
diff --git a/java/awt/dnd/peer/DropTargetContextPeer.java b/java/awt/dnd/peer/DropTargetContextPeer.java
index 6eae29b38..2f4da5ff3 100644
--- a/java/awt/dnd/peer/DropTargetContextPeer.java
+++ b/java/awt/dnd/peer/DropTargetContextPeer.java
@@ -45,11 +45,11 @@ import java.awt.dnd.InvalidDnDOperationException;
/**
- * Used to control state of recipient protocol from the
+ * Used to control state of recipient protocol from the
* <code>DropTargetListener</code>. Occurs when a <code>Component</code>
- * with an associated <code>DropTarget</code> and visible geometry is first
+ * with an associated <code>DropTarget</code> and visible geometry is first
* intersected by a logical cursor.
- *
+ *
* @author Michael Koch (konqueror@gmx.de)
*/
public interface DropTargetContextPeer
diff --git a/java/awt/event/AWTEventListener.java b/java/awt/event/AWTEventListener.java
index 079a91dd4..3f30df46e 100644
--- a/java/awt/event/AWTEventListener.java
+++ b/java/awt/event/AWTEventListener.java
@@ -62,4 +62,4 @@ public interface AWTEventListener extends EventListener
* @param event the AWTEvent that was dispatched
*/
void eventDispatched(AWTEvent event);
-} // interface AWTEventListener
+} // interface AWTEventListener
diff --git a/java/awt/event/ActionEvent.java b/java/awt/event/ActionEvent.java
index 937d2cf53..776ab04be 100644
--- a/java/awt/event/ActionEvent.java
+++ b/java/awt/event/ActionEvent.java
@@ -205,8 +205,8 @@ public class ActionEvent extends AWTEvent
public String paramString()
{
CPStringBuilder s = new CPStringBuilder(id == ACTION_PERFORMED
- ? "ACTION_PERFORMED,cmd="
- : "unknown type,cmd=");
+ ? "ACTION_PERFORMED,cmd="
+ : "unknown type,cmd=");
s.append(actionCommand).append(",when=").append(when).append(",modifiers");
int len = s.length();
s.setLength(len + 1);
@@ -225,4 +225,4 @@ public class ActionEvent extends AWTEvent
s.setCharAt(len, '=');
return s.toString();
}
-} // class ActionEvent
+} // class ActionEvent
diff --git a/java/awt/event/ComponentAdapter.java b/java/awt/event/ComponentAdapter.java
index 6b4893f0f..cb1c0dae9 100644
--- a/java/awt/event/ComponentAdapter.java
+++ b/java/awt/event/ComponentAdapter.java
@@ -94,4 +94,4 @@ public abstract class ComponentAdapter implements ComponentListener
public void componentHidden(ComponentEvent event)
{
}
-} // class ComponentAdapter
+} // class ComponentAdapter
diff --git a/java/awt/event/ComponentEvent.java b/java/awt/event/ComponentEvent.java
index 156a3e2ad..3fd86853b 100644
--- a/java/awt/event/ComponentEvent.java
+++ b/java/awt/event/ComponentEvent.java
@@ -117,12 +117,12 @@ public class ComponentEvent extends AWTEvent
public String paramString()
{
CPStringBuilder s = new CPStringBuilder();
-
+
// Unlike Sun, we don't throw NullPointerException or ClassCastException
// when source was illegally changed.
if (id == COMPONENT_MOVED)
s.append("COMPONENT_MOVED ");
- else if (id == COMPONENT_RESIZED)
+ else if (id == COMPONENT_RESIZED)
s.append("COMPONENT_RESIZED ");
else if (id == COMPONENT_SHOWN)
s.append("COMPONENT_SHOWN ");
@@ -138,5 +138,5 @@ public class ComponentEvent extends AWTEvent
return s.toString();
}
-
+
} // class ComponentEvent
diff --git a/java/awt/event/InputEvent.java b/java/awt/event/InputEvent.java
index b9dad3278..241630ca3 100644
--- a/java/awt/event/InputEvent.java
+++ b/java/awt/event/InputEvent.java
@@ -306,7 +306,7 @@ public abstract class InputEvent extends ComponentEvent
}
/**
- * This method returns the old-style modifiers in effect for this event.
+ * This method returns the old-style modifiers in effect for this event.
* Note that this is ambiguous between button2 and alt, and between
* button3 and meta. Also, code which generated these modifiers tends to
* only list the modifier that just changed, even if others were down at
diff --git a/java/awt/event/InputMethodEvent.java b/java/awt/event/InputMethodEvent.java
index e0be40d5a..1542bcc9f 100644
--- a/java/awt/event/InputMethodEvent.java
+++ b/java/awt/event/InputMethodEvent.java
@@ -278,7 +278,7 @@ public class InputMethodEvent extends AWTEvent
while (--j >= 0)
s.append(text.setIndex(i++));
s.append("\", ").append(committedCharacterCount)
- .append(" characters committed, caret: ");
+ .append(" characters committed, caret: ");
}
s.append(caret == null ? (Object) "no caret" : caret).append(", ")
.append(visiblePosition == null ? (Object) "no visible position"
diff --git a/java/awt/event/InvocationEvent.java b/java/awt/event/InvocationEvent.java
index 6f39d6b91..afa09de13 100644
--- a/java/awt/event/InvocationEvent.java
+++ b/java/awt/event/InvocationEvent.java
@@ -108,11 +108,11 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
/**
* This is the caught Throwable thrown in the <code>run()</code> method.
- * It is null if throwables are ignored, the run method hasn't completed,
+ * It is null if throwables are ignored, the run method hasn't completed,
* or there were no throwables thrown.
*/
private Throwable throwable;
-
+
/**
* The timestamp when this event was created.
*
@@ -202,9 +202,9 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
Object o = notifier;
if (o != null)
synchronized(o)
- {
- o.notifyAll();
- }
+ {
+ o.notifyAll();
+ }
}
/**
@@ -230,7 +230,7 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent
{
return throwable;
}
-
+
/**
* Gets the timestamp of when this event was created.
*
diff --git a/java/awt/event/KeyEvent.java b/java/awt/event/KeyEvent.java
index bb7ed4c2d..a2b1dc94c 100644
--- a/java/awt/event/KeyEvent.java
+++ b/java/awt/event/KeyEvent.java
@@ -1104,7 +1104,7 @@ public class KeyEvent extends InputEvent
*/
private boolean isProxyActive;
-
+
/**
* Initializes a new instance of <code>KeyEvent</code> with the specified
* information. Note that an invalid id leads to unspecified results.
diff --git a/java/awt/event/MouseEvent.java b/java/awt/event/MouseEvent.java
index 86a584c41..64142ecc6 100644
--- a/java/awt/event/MouseEvent.java
+++ b/java/awt/event/MouseEvent.java
@@ -293,8 +293,8 @@ public class MouseEvent extends InputEvent
// release event.
if (id == MOUSE_RELEASED)
this.modifiersEx &= ~(BUTTON1_DOWN_MASK
- | BUTTON2_DOWN_MASK
- | BUTTON3_DOWN_MASK);
+ | BUTTON2_DOWN_MASK
+ | BUTTON3_DOWN_MASK);
this.absX = absX;
this.absY = absY;
@@ -469,10 +469,10 @@ public class MouseEvent extends InputEvent
// FIXME: need a mauve test for this method
if (modifiersEx != 0)
s.append(",extModifiers=").append(getModifiersExText(modifiersEx));
-
+
s.append(",clickCount=").append(clickCount);
s.append(",consumed=").append(consumed);
-
+
return s.toString();
}
diff --git a/java/awt/event/MouseListener.java b/java/awt/event/MouseListener.java
index 4508019e1..735ca6b5a 100644
--- a/java/awt/event/MouseListener.java
+++ b/java/awt/event/MouseListener.java
@@ -85,7 +85,7 @@ public interface MouseListener extends EventListener
*/
void mouseEntered(MouseEvent event);
- /**
+ /**
* This method is called when the mouse exits a component.
*
* @param event the <code>MouseEvent</code> for the exit
diff --git a/java/awt/event/MouseWheelEvent.java b/java/awt/event/MouseWheelEvent.java
index d1d22d218..1ca946582 100644
--- a/java/awt/event/MouseWheelEvent.java
+++ b/java/awt/event/MouseWheelEvent.java
@@ -135,7 +135,7 @@ public class MouseWheelEvent extends MouseEvent
* @param wheelRotation the number of rotation "clicks"
* @throws IllegalArgumentException if source is null
* @see MouseEvent#MouseEvent(Component, int, long, int, int, int, int,
- * boolean)
+ * boolean)
*/
public MouseWheelEvent(Component source, int id, long when, int modifiers,
int x, int y, int clickCount, boolean popupTrigger,
diff --git a/java/awt/event/WindowEvent.java b/java/awt/event/WindowEvent.java
index 1298e1ad8..b52fefcdc 100644
--- a/java/awt/event/WindowEvent.java
+++ b/java/awt/event/WindowEvent.java
@@ -49,7 +49,7 @@ import java.awt.Window;
* are three listeners, for three types of events: WindowListeners deal with
* the lifecycle of a window, WindowStateListeners deal with window state
* like maximization, and WindowFocusListeners deal with focus switching to
- * or from a window.
+ * or from a window.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @see WindowAdapter
diff --git a/java/awt/font/FontRenderContext.java b/java/awt/font/FontRenderContext.java
index c25bae3ec..8d530ec5f 100644
--- a/java/awt/font/FontRenderContext.java
+++ b/java/awt/font/FontRenderContext.java
@@ -48,7 +48,7 @@ public class FontRenderContext
private AffineTransform affineTransform;
private boolean isAntiAliased;
private boolean usesFractionalMetrics;
-
+
/**
* Construct a new <code>FontRenderContext</code>.
*/
@@ -56,7 +56,7 @@ public class FontRenderContext
{
// Do nothing here.
}
-
+
/**
* Construct a new <code>FontRenderContext</code>.
*/
@@ -68,7 +68,7 @@ public class FontRenderContext
{
this.affineTransform = new AffineTransform (tx);
}
-
+
this.isAntiAliased = isAntiAliased;
this.usesFractionalMetrics = usesFractionalMetrics;
}
@@ -135,4 +135,3 @@ public class FontRenderContext
return usesFractionalMetrics;
}
}
-
diff --git a/java/awt/font/GlyphJustificationInfo.java b/java/awt/font/GlyphJustificationInfo.java
index 5f45fd584..cfa64f05e 100644
--- a/java/awt/font/GlyphJustificationInfo.java
+++ b/java/awt/font/GlyphJustificationInfo.java
@@ -47,7 +47,7 @@ public final class GlyphJustificationInfo
public static final int PRIORITY_WHITESPACE = 1;
public static final int PRIORITY_INTERCHAR = 2;
public static final int PRIORITY_NONE = 3;
-
+
public final float weight;
public final int growPriority;
public final boolean growAbsorb;
@@ -57,7 +57,7 @@ public final class GlyphJustificationInfo
public final boolean shrinkAbsorb;
public final float shrinkLeftLimit;
public final float shrinkRightLimit;
-
+
public GlyphJustificationInfo (float weight, boolean growAbsorb,
int growPriority, float growLeftLimit,
float growRightLimit, boolean shrinkAbsorb,
diff --git a/java/awt/font/GlyphMetrics.java b/java/awt/font/GlyphMetrics.java
index 0a78d3052..b41b7f45b 100644
--- a/java/awt/font/GlyphMetrics.java
+++ b/java/awt/font/GlyphMetrics.java
@@ -50,13 +50,13 @@ public final class GlyphMetrics
public static final byte LIGATURE = 1;
public static final byte STANDARD = 0;
public static final byte WHITESPACE = 4;
-
+
private boolean horizontal;
private float advanceX;
private float advanceY;
private Rectangle2D bounds;
private byte glyphType;
-
+
public GlyphMetrics (boolean horizontal, float advanceX, float advanceY,
Rectangle2D bounds, byte glyphType)
{
@@ -66,7 +66,7 @@ public final class GlyphMetrics
this.bounds = bounds;
this.glyphType = glyphType;
}
-
+
public GlyphMetrics (float advance, Rectangle2D bounds, byte glyphType)
{
this (true, advance, advance, bounds, glyphType);
diff --git a/java/awt/font/GlyphVector.java b/java/awt/font/GlyphVector.java
index f4cb01b95..4a87f4c62 100644
--- a/java/awt/font/GlyphVector.java
+++ b/java/awt/font/GlyphVector.java
@@ -69,12 +69,12 @@ public abstract class GlyphVector implements Cloneable
public abstract Font getFont ();
public abstract FontRenderContext getFontRenderContext ();
-
+
public int getGlyphCharIndex (int glyphIndex)
{
return glyphIndex;
}
-
+
public int[] getGlyphCharIndices(int beginGlyphIndex, int numEntries,
int[] codeReturn)
{
@@ -85,10 +85,10 @@ public abstract class GlyphVector implements Cloneable
int j = beginGlyphIndex;
while (j < numEntries)
codeReturn[i++] = getGlyphCharIndex(j++);
-
+
return codeReturn;
}
-
+
public abstract int getGlyphCode (int glyphIndex);
public abstract int[] getGlyphCodes (int beginGlyphIndex, int numEntries,
@@ -106,7 +106,7 @@ public abstract class GlyphVector implements Cloneable
public Shape getGlyphOutline(int glyphIndex, float x, float y)
{
Shape s = getGlyphOutline(glyphIndex);
-
+
// This is the only way to translate the origin of a shape
AffineTransform at = AffineTransform.getTranslateInstance(x, y);
return at.createTransformedShape(s);
@@ -117,12 +117,12 @@ public abstract class GlyphVector implements Cloneable
{
Rectangle bounds = new Rectangle();
Rectangle2D rect = getGlyphVisualBounds(index).getBounds2D();
-
+
bounds.x = (int) (rect.getX() + x);
bounds.y = (int) (rect.getY() + y);
bounds.width = (int) rect.getMaxX() - bounds.x;
bounds.height = (int) rect.getMaxY() - bounds.y;
-
+
return bounds;
}
@@ -144,7 +144,7 @@ public abstract class GlyphVector implements Cloneable
public abstract Rectangle2D getLogicalBounds ();
public abstract int getNumGlyphs ();
-
+
public abstract Shape getOutline ();
public abstract Shape getOutline (float x, float y);
@@ -154,12 +154,12 @@ public abstract class GlyphVector implements Cloneable
{
Rectangle bounds = new Rectangle();
Rectangle2D rect = getVisualBounds();
-
+
bounds.x = (int) (rect.getX() + x);
bounds.y = (int) (rect.getY() + y);
bounds.width = (int) rect.getMaxX() - bounds.x;
bounds.height = (int) rect.getMaxY() - bounds.y;
-
+
return bounds;
}
diff --git a/java/awt/font/GraphicAttribute.java b/java/awt/font/GraphicAttribute.java
index 19f781bcc..edf0c204d 100644
--- a/java/awt/font/GraphicAttribute.java
+++ b/java/awt/font/GraphicAttribute.java
@@ -43,7 +43,7 @@ import java.awt.geom.Rectangle2D;
/**
* This class represents a graphic embedded in text.
- *
+ *
* @author Michael Koch
* @author Lillian Angel (langel at redhat dot com)
*/
@@ -59,7 +59,7 @@ public abstract class GraphicAttribute
/**
* Constructor.
- *
+ *
* @param alignment - the alignment to use for the graphic
*/
protected GraphicAttribute(int alignment)
@@ -71,7 +71,7 @@ public abstract class GraphicAttribute
/**
* Draws the graphic.
- *
+ *
* @param graphics - the graphics configuration to use
* @param x - the x location
* @param y - the y location
@@ -81,7 +81,7 @@ public abstract class GraphicAttribute
/**
* Gets the distance from the origin of its graphic to the right side of the
* bounds of its graphic.
- *
+ *
* @return the advance
*/
public abstract float getAdvance();
@@ -89,21 +89,21 @@ public abstract class GraphicAttribute
/**
* Gets the positive distance from the origin of its graphic to the top of
* bounds.
- *
+ *
* @return the ascent
*/
public abstract float getAscent();
/**
* Gets the distance from the origin of its graphic to the bottom of the bounds.
- *
+ *
* @return the descent
*/
public abstract float getDescent();
/**
* Gets the alignment.
- *
+ *
* @return the alignment
*/
public final int getAlignment()
@@ -114,7 +114,7 @@ public abstract class GraphicAttribute
/**
* Returns a Rectangle2D that encloses the rendered area.
* Default bounds is the rectangle (0, -ascent, advance, ascent+descent).
- *
+ *
* @return the bounds of the rendered area
*/
public Rectangle2D getBounds()
@@ -125,7 +125,7 @@ public abstract class GraphicAttribute
/**
* Returns the justification information for this object.
- *
+ *
* @return the justification information
*/
public GlyphJustificationInfo getJustificationInfo()
diff --git a/java/awt/font/ImageGraphicAttribute.java b/java/awt/font/ImageGraphicAttribute.java
index 3e4fdcf73..63fff4101 100644
--- a/java/awt/font/ImageGraphicAttribute.java
+++ b/java/awt/font/ImageGraphicAttribute.java
@@ -45,7 +45,7 @@ import java.awt.geom.Rectangle2D;
/**
* This is an implementation of GraphicAttribute which draws images in a
* TextLayout.
- *
+ *
* @author Lillian Angel
* @author Michael Koch
*/
@@ -58,7 +58,7 @@ public final class ImageGraphicAttribute
/**
* Constucts an instance from the specified Image. The origin is at (0, 0).
- *
+ *
* @param image - image to construct from.
* @param alignment - the alignment
*/
@@ -70,7 +70,7 @@ public final class ImageGraphicAttribute
/**
* Constucts an instance from the specified Image. The origin is at (originX,
* originY).
- *
+ *
* @param image - image to construct from
* @param alignment - the alignment
* @param originX - x point of origin
@@ -88,10 +88,10 @@ public final class ImageGraphicAttribute
/**
* Draws the image at the specified location, relative to the
* origin.
- *
+ *
* @param g - the graphics to use to render the image
* @param x - the x location
- * @param y - the y location
+ * @param y - the y location
*/
public void draw(Graphics2D g, float x, float y)
{
@@ -100,7 +100,7 @@ public final class ImageGraphicAttribute
/**
* Compares this to the specified Object
- *
+ *
* @param obj - the object to compare
* @return true if the obj and this are equivalent
*/
@@ -115,7 +115,7 @@ public final class ImageGraphicAttribute
/**
* Compares this to the ImageGraphicAttribute given, by
* comparing all fields and values.
- *
+ *
* @param rhs - the ImageGraphicAttribute to compare
* @return true if the object given is equivalent to this
*/
@@ -128,13 +128,13 @@ public final class ImageGraphicAttribute
&& (this.getDescent() == rhs.getDescent())
&& (this.hashCode() == rhs.hashCode())
&& (this.image.equals(rhs.image))
- && (this.originX == rhs.originX)
+ && (this.originX == rhs.originX)
&& (this.originY == rhs.originY)));
}
/**
* Returns distance from the origin to the right edge of the image of this.
- *
+ *
* @return the advance
*/
public float getAdvance()
@@ -144,7 +144,7 @@ public final class ImageGraphicAttribute
/**
* Returns the the distance from the top of the image to the origin of this.
- *
+ *
* @return the ascent.
*/
public float getAscent()
@@ -154,7 +154,7 @@ public final class ImageGraphicAttribute
/**
* Gets the bounds of the object rendered, relative to the position.
- *
+ *
* @return the bounds of the object rendered, relative to the position.
*/
public Rectangle2D getBounds()
@@ -167,7 +167,7 @@ public final class ImageGraphicAttribute
/**
* Returns the distance from the origin to the bottom of the image.
- *
+ *
* @return the descent
*/
public float getDescent()
@@ -177,7 +177,7 @@ public final class ImageGraphicAttribute
/**
* Gets the hash code for this image.
- *
+ *
* @return the hash code
*/
public int hashCode()
diff --git a/java/awt/font/LineBreakMeasurer.java b/java/awt/font/LineBreakMeasurer.java
index 278bc8476..d11f20d1f 100644
--- a/java/awt/font/LineBreakMeasurer.java
+++ b/java/awt/font/LineBreakMeasurer.java
@@ -45,17 +45,17 @@ public final class LineBreakMeasurer
{
private AttributedCharacterIterator text;
private int position;
- private TextMeasurer tm;
+ private TextMeasurer tm;
private int numChars;
- public LineBreakMeasurer(AttributedCharacterIterator text,
- BreakIterator breakIter, FontRenderContext frc)
+ public LineBreakMeasurer(AttributedCharacterIterator text,
+ BreakIterator breakIter, FontRenderContext frc)
{
this( text, frc );
}
- public LineBreakMeasurer(AttributedCharacterIterator text,
- FontRenderContext frc)
+ public LineBreakMeasurer(AttributedCharacterIterator text,
+ FontRenderContext frc)
{
this.text = text;
position = 0;
@@ -63,15 +63,15 @@ public final class LineBreakMeasurer
tm = new TextMeasurer( text, frc );
}
- public void deleteChar(AttributedCharacterIterator newParagraph,
- int deletePos)
+ public void deleteChar(AttributedCharacterIterator newParagraph,
+ int deletePos)
{
tm.deleteChar( newParagraph, deletePos );
position = 0;
}
- public void insertChar(AttributedCharacterIterator newParagraph,
- int insertPos)
+ public void insertChar(AttributedCharacterIterator newParagraph,
+ int insertPos)
{
tm.insertChar( newParagraph, insertPos );
position = 0;
@@ -82,8 +82,8 @@ public final class LineBreakMeasurer
return nextLayout( wrappingWidth, numChars, false );
}
- public TextLayout nextLayout(float wrappingWidth, int offsetLimit,
- boolean requireNextWord)
+ public TextLayout nextLayout(float wrappingWidth, int offsetLimit,
+ boolean requireNextWord)
{
int next = nextOffset( wrappingWidth, offsetLimit, requireNextWord );
TextLayout tl = tm.getLayout( position, next );
@@ -96,8 +96,8 @@ public final class LineBreakMeasurer
return nextOffset( wrappingWidth, numChars, false );
}
- public int nextOffset(float wrappingWidth, int offsetLimit,
- boolean requireNextWord)
+ public int nextOffset(float wrappingWidth, int offsetLimit,
+ boolean requireNextWord)
{
int guessOffset = tm.getLineBreakIndex(position, wrappingWidth);
if( offsetLimit > numChars )
@@ -105,8 +105,8 @@ public final class LineBreakMeasurer
if( guessOffset > offsetLimit )
{
- text.setIndex( offsetLimit );
- return offsetLimit;
+ text.setIndex( offsetLimit );
+ return offsetLimit;
}
text.setIndex( guessOffset );
@@ -117,18 +117,18 @@ public final class LineBreakMeasurer
// Otherwise jump forward or backward to the last such char.
if( !requireNextWord )
- while( !Character.isWhitespace( text.previous() ) &&
- guessOffset > position )
- guessOffset--;
+ while( !Character.isWhitespace( text.previous() ) &&
+ guessOffset > position )
+ guessOffset--;
else
- while( !Character.isWhitespace( text.next() ) &&
- guessOffset < offsetLimit )
- guessOffset++;
-
+ while( !Character.isWhitespace( text.next() ) &&
+ guessOffset < offsetLimit )
+ guessOffset++;
+
if( guessOffset > offsetLimit )
{
- text.setIndex( offsetLimit );
- return offsetLimit;
+ text.setIndex( offsetLimit );
+ return offsetLimit;
}
text.setIndex( guessOffset );
@@ -146,4 +146,3 @@ public final class LineBreakMeasurer
return position;
}
}
-
diff --git a/java/awt/font/LineMetrics.java b/java/awt/font/LineMetrics.java
index 3c45ad19a..d43fd98bb 100644
--- a/java/awt/font/LineMetrics.java
+++ b/java/awt/font/LineMetrics.java
@@ -44,24 +44,24 @@ package java.awt.font;
public abstract class LineMetrics
{
public abstract float getAscent();
-
+
public abstract int getBaselineIndex();
-
+
public abstract float[] getBaselineOffsets();
-
+
public abstract float getDescent();
-
+
public abstract float getHeight();
-
+
public abstract float getLeading();
-
+
public abstract int getNumChars();
-
+
public abstract float getStrikethroughOffset();
-
+
public abstract float getStrikethroughThickness();
-
+
public abstract float getUnderlineOffset();
-
+
public abstract float getUnderlineThickness();
}
diff --git a/java/awt/font/MultipleMaster.java b/java/awt/font/MultipleMaster.java
index 57417ea60..1be44bd75 100644
--- a/java/awt/font/MultipleMaster.java
+++ b/java/awt/font/MultipleMaster.java
@@ -46,16 +46,16 @@ import java.awt.Font;
public interface MultipleMaster
{
Font deriveMMFont (float[] axes);
-
+
Font deriveMMFont (float[] glyphWidths, float avgStemWidth,
float typicalCapHeight, float typicalXHeight,
float italicAngle);
-
+
float[] getDesignAxisDefaults();
-
+
String[] getDesignAxisNames();
-
+
float[] getDesignAxisRanges();
-
+
int getNumDesignAxes();
}
diff --git a/java/awt/font/OpenType.java b/java/awt/font/OpenType.java
index ece3279cc..e992d0700 100644
--- a/java/awt/font/OpenType.java
+++ b/java/awt/font/OpenType.java
@@ -94,18 +94,18 @@ public interface OpenType
int TAG_VDMX = 1447316824;
int TAG_VHEA = 1986553185;
int TAG_VMTX = 1986884728;
-
+
byte[] getFontTable (int sfntTag);
-
+
byte[] getFontTable (int sfntTag, int offset, int count);
-
+
byte[] getFontTable (String strSfntTag);
-
+
byte[] getFontTable (String strSfntTag, int offset, int count);
-
+
int getFontTableSize (int sfntTag);
-
+
int getFontTableSize (String strSfntTag);
-
+
int getVersion ();
}
diff --git a/java/awt/font/ShapeGraphicAttribute.java b/java/awt/font/ShapeGraphicAttribute.java
index 06814972b..8d6891632 100644
--- a/java/awt/font/ShapeGraphicAttribute.java
+++ b/java/awt/font/ShapeGraphicAttribute.java
@@ -44,24 +44,24 @@ import java.awt.geom.Rectangle2D;
/**
* This is an implementation of GraphicAttribute that draws shapes in a TextLayout.
- *
+ *
* @author Lillian Angel (langel at redhat dot com)
*/
public final class ShapeGraphicAttribute extends GraphicAttribute
{
/** True if the shape should be filled. */
public static final boolean FILL = false;
-
+
/** True if the shape should be stroked with a 1-pixel wide stroke. */
public static final boolean STROKE = true;
private Shape shape;
private boolean stroke;
private Rectangle2D bounds;
-
+
/**
* Constructor.
- *
+ *
* @param shape - the Shape to render. The Shape is rendered with its origin.
* @param alignment - the alignment
* @param stroke - true if the Shape should be stroked; false if the Shape
@@ -77,7 +77,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
/**
* Draws the graphic at the given location.
- *
+ *
* @param graphics - the graphics to use.
* @param x - the x location to draw at.
* @param y - the y location to draw at.
@@ -94,7 +94,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
/**
* Compares this ShapeGraphicAttribute to obj.
- *
+ *
* @param obj - the object to compare.
*/
public boolean equals(Object obj)
@@ -107,7 +107,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
/**
* Compares this ShapeGraphicAttribute to rhs.
- *
+ *
* @param rhs - the ShapeGraphicAttribute to compare.
*/
public boolean equals(ShapeGraphicAttribute rhs)
@@ -118,14 +118,14 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
&& getAdvance() == rhs.getAdvance()
&& getAscent() == rhs.getAscent()
&& getBounds().equals(rhs.getBounds())
- && getDescent() == rhs.getDescent()
+ && getDescent() == rhs.getDescent()
&& hashCode() == rhs.hashCode()));
}
/**
* Gets the distance from the origin of its Shape to the right side of the
* bounds of its Shape.
- *
+ *
* @return the advance
*/
public float getAdvance()
@@ -136,7 +136,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
/**
* Gets the positive distance from the origin of its Shape to the top of
* bounds.
- *
+ *
* @return the ascent
*/
public float getAscent()
@@ -146,7 +146,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
/**
* Gets the distance from the origin of its Shape to the bottom of the bounds.
- *
+ *
* @return the descent
*/
public float getDescent()
@@ -156,7 +156,7 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
/**
* Returns a Rectangle2D that encloses all of the bits drawn by this shape.
- *
+ *
* @return the bounds of the shape.
*/
public Rectangle2D getBounds()
@@ -169,13 +169,13 @@ public final class ShapeGraphicAttribute extends GraphicAttribute
bounds.width++;
bounds.height++;
}
-
+
return bounds;
}
/**
* Gets the hash code.
- *
+ *
* @return the hash code.
*/
public int hashCode()
diff --git a/java/awt/font/TextAttribute.java b/java/awt/font/TextAttribute.java
index 6f5ed59f9..bfade21bb 100644
--- a/java/awt/font/TextAttribute.java
+++ b/java/awt/font/TextAttribute.java
@@ -48,197 +48,197 @@ import java.text.AttributedCharacterIterator;
public final class TextAttribute extends AttributedCharacterIterator.Attribute
{
private static final long serialVersionUID = 7744112784117861702L;
-
+
/** A key for the background paint attribute. */
public static final TextAttribute BACKGROUND =
new TextAttribute("background");
-
+
/** A key for the BIDI_EMBEDDING attribute. */
public static final TextAttribute BIDI_EMBEDDING =
new TextAttribute("bidi_embedding");
-
+
/** A key for the CHAR_REPLACEMENT attribute. */
public static final TextAttribute CHAR_REPLACEMENT =
new TextAttribute("char_replacement");
-
+
/** A key for the FAMILY attribute. */
public static final TextAttribute FAMILY = new TextAttribute("family");
-
+
/** A key for the font attribute. */
public static final TextAttribute FONT = new TextAttribute("font");
-
+
/** A key for the foreground paint attribute. */
- public static final TextAttribute FOREGROUND =
+ public static final TextAttribute FOREGROUND =
new TextAttribute("foreground");
-
+
/** A key for the INPUT_METHOD_HIGHLIGHT attribute. */
public static final TextAttribute INPUT_METHOD_HIGHLIGHT =
new TextAttribute("input method highlight");
-
+
/** A key for the INPUT_METHOD_UNDERLINE attribute. */
public static final TextAttribute INPUT_METHOD_UNDERLINE =
new TextAttribute("input method underline");
-
+
/** A key for the text justification attribute. */
public static final TextAttribute JUSTIFICATION =
new TextAttribute("justification");
-
- /**
+
+ /**
* A value that can be used with the {@link #JUSTIFICATION} attribute to
- * indicate full justification of the text.
+ * indicate full justification of the text.
*/
public static final Float JUSTIFICATION_FULL = new Float(1.0);
-
- /**
+
+ /**
* A value that can be used with the {@link #JUSTIFICATION} attribute to
- * indicate no justification of the text.
+ * indicate no justification of the text.
*/
public static final Float JUSTIFICATION_NONE = new Float(0.0);
-
+
/** A key for the NUMERIC_SHAPING attribute. */
public static final TextAttribute NUMERIC_SHAPING =
new TextAttribute("numeric_shaping");
-
+
/** A key for the POSTURE attribute. */
public static final TextAttribute POSTURE = new TextAttribute("posture");
-
+
/** A value that can be used with the {@link #POSTURE} attribute. */
public static final Float POSTURE_OBLIQUE = new Float(0.2);
-
+
/** A value that can be used with the {@link #POSTURE} attribute. */
public static final Float POSTURE_REGULAR = new Float(0.0);
-
+
/** A key for the RUN_DIRECTION attribute. */
public static final TextAttribute RUN_DIRECTION =
new TextAttribute("run_direction");
-
+
/** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
public static final Boolean RUN_DIRECTION_LTR = Boolean.FALSE;
-
+
/** A value that can be used with the {@link #RUN_DIRECTION} attribute. */
public static final Boolean RUN_DIRECTION_RTL = Boolean.TRUE;
-
+
/** A key for the text size attribute. */
public static final TextAttribute SIZE = new TextAttribute("size");
-
+
/** A key for the STRIKETHROUGH attribute. */
public static final TextAttribute STRIKETHROUGH =
new TextAttribute("strikethrough");
-
+
/** A value that can be used with the {@link #STRIKETHROUGH} attribute. */
public static final Boolean STRIKETHROUGH_ON = Boolean.TRUE;
-
+
/** A key for the SUPERSCRIPT attribute. */
public static final TextAttribute SUPERSCRIPT =
new TextAttribute("superscript");
-
+
/** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
public static final Integer SUPERSCRIPT_SUB = new Integer(-1);
-
+
/** A value that can be used with the {@link #SUPERSCRIPT} attribute. */
public static final Integer SUPERSCRIPT_SUPER = new Integer(1);
-
+
/** A key for the SWAP_COLORS attribute. */
public static final TextAttribute SWAP_COLORS =
new TextAttribute("swap_colors");
-
+
/** A value that can be used with the {@link #SWAP_COLORS} attribute. */
public static final Boolean SWAP_COLORS_ON = Boolean.TRUE;
-
+
/** A key for the TRANFORM attribute. */
public static final TextAttribute TRANSFORM = new TextAttribute("transform");
-
+
/** A key for the UNDERLINE attribute. */
public static final TextAttribute UNDERLINE = new TextAttribute("underline");
-
+
/** A value that can be used with the {@link #UNDERLINE} attribute. */
public static final Integer UNDERLINE_LOW_DASHED = new Integer(5);
-
+
/** A value that can be used with the {@link #UNDERLINE} attribute. */
public static final Integer UNDERLINE_LOW_DOTTED = new Integer(3);
-
+
/** A value that can be used with the {@link #UNDERLINE} attribute. */
public static final Integer UNDERLINE_LOW_GRAY = new Integer(4);
-
+
/** A value that can be used with the {@link #UNDERLINE} attribute. */
public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer(1);
-
+
/** A value that can be used with the {@link #UNDERLINE} attribute. */
public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer(2);
-
+
/** A value that can be used with the {@link #UNDERLINE} attribute. */
public static final Integer UNDERLINE_ON = new Integer(0);
-
+
/** A key for the WEIGHT attribute. */
public static final TextAttribute WEIGHT = new TextAttribute("weight");
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_BOLD = new Float(2.0);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_DEMIBOLD = new Float(1.75);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_DEMILIGHT = new Float(0.875);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_EXTRA_LIGHT = new Float(0.5);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_EXTRABOLD = new Float(2.5);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_HEAVY = new Float(2.25);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_LIGHT = new Float(0.75);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_MEDIUM = new Float(1.5);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_REGULAR = new Float(1.0);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_SEMIBOLD = new Float(1.25);
-
+
/** A value that can be used with the {@link #WEIGHT} attribute. */
public static final Float WEIGHT_ULTRABOLD = new Float(2.75);
-
+
/** A key for the WIDTH attribute. */
public static final TextAttribute WIDTH = new TextAttribute("width");
-
+
/** A value that can be used with the {@link #WIDTH} attribute. */
public static final Float WIDTH_CONDENSED = new Float(0.75);
-
+
/** A value that can be used with the {@link #WIDTH} attribute. */
public static final Float WIDTH_EXTENDED = new Float(1.5);
-
+
/** A value that can be used with the {@link #WIDTH} attribute. */
public static final Float WIDTH_REGULAR = new Float(1.0);
-
+
/** A value that can be used with the {@link #WIDTH} attribute. */
public static final Float WIDTH_SEMI_CONDENSED = new Float(0.875);
-
+
/** A value that can be used with the {@link #WIDTH} attribute. */
public static final Float WIDTH_SEMI_EXTENDED = new Float(1.25);
-
+
/**
* Creates a new attribute.
- *
+ *
* @param name the name.
*/
protected TextAttribute(String name)
{
super(name);
}
-
+
/**
* After deserialization, this method ensures that only one instance of
* each attribute is used.
- *
+ *
* @return The (single) attribute instance.
- *
+ *
* @throws InvalidObjectException if the attribute is not recognised.
*/
protected Object readResolve()
diff --git a/java/awt/font/TextHitInfo.java b/java/awt/font/TextHitInfo.java
index f6fee1add..17479b09e 100644
--- a/java/awt/font/TextHitInfo.java
+++ b/java/awt/font/TextHitInfo.java
@@ -1,4 +1,4 @@
-/* TextHitInfo.java --
+/* TextHitInfo.java --
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,13 +44,13 @@ public final class TextHitInfo
{
private int charIndex;
private boolean leadingEdge;
-
+
TextHitInfo (int charIndex, boolean leadingEdge)
{
this.charIndex = charIndex;
this.leadingEdge = leadingEdge;
}
-
+
public int getCharIndex()
{
return charIndex;
@@ -75,7 +75,7 @@ public final class TextHitInfo
{
if(obj instanceof TextHitInfo)
return this.equals((TextHitInfo) obj);
-
+
return false;
}
@@ -83,7 +83,7 @@ public final class TextHitInfo
{
if (hitInfo == null)
return false;
-
+
return (charIndex == hitInfo.getCharIndex ())
&& (leadingEdge == hitInfo.isLeadingEdge ());
}
diff --git a/java/awt/font/TextLayout.java b/java/awt/font/TextLayout.java
index 4346ab91d..c4f174245 100644
--- a/java/awt/font/TextLayout.java
+++ b/java/awt/font/TextLayout.java
@@ -134,7 +134,7 @@ public final class TextLayout implements Cloneable
* performance.
*/
private float totalAdvance = -1F;
-
+
/**
* The cached natural bounds.
*/
@@ -188,7 +188,7 @@ public final class TextLayout implements Cloneable
/**
* Constructs a TextLayout.
*/
- public TextLayout (String str, Font font, FontRenderContext frc)
+ public TextLayout (String str, Font font, FontRenderContext frc)
{
this.frc = frc;
string = str.toCharArray();
@@ -201,28 +201,28 @@ public final class TextLayout implements Cloneable
if (Bidi.requiresBidi(string, offset, offset + length))
{
- bidi = new Bidi(str, leftToRight ? Bidi.DIRECTION_LEFT_TO_RIGHT
+ bidi = new Bidi(str, leftToRight ? Bidi.DIRECTION_LEFT_TO_RIGHT
: Bidi.DIRECTION_RIGHT_TO_LEFT );
- int rc = bidi.getRunCount();
- byte[] table = new byte[ rc ];
- for(int i = 0; i < table.length; i++)
- table[i] = (byte)bidi.getRunLevel(i);
+ int rc = bidi.getRunCount();
+ byte[] table = new byte[ rc ];
+ for(int i = 0; i < table.length; i++)
+ table[i] = (byte)bidi.getRunLevel(i);
runs = new Run[rc];
- for(int i = 0; i < rc; i++)
- {
- int start = bidi.getRunStart(i);
- int end = bidi.getRunLimit(i);
- if(start != end) // no empty runs.
- {
- GlyphVector gv = font.layoutGlyphVector(frc,
+ for(int i = 0; i < rc; i++)
+ {
+ int start = bidi.getRunStart(i);
+ int end = bidi.getRunLimit(i);
+ if(start != end) // no empty runs.
+ {
+ GlyphVector gv = font.layoutGlyphVector(frc,
string, start, end,
((table[i] & 1) == 0) ? Font.LAYOUT_LEFT_TO_RIGHT
: Font.LAYOUT_RIGHT_TO_LEFT );
runs[i] = new Run(gv, font, start, end);
}
- }
- Bidi.reorderVisually( table, 0, runs, 0, runs.length );
+ }
+ Bidi.reorderVisually( table, 0, runs, 0, runs.length );
// Clean up null runs.
ArrayList cleaned = new ArrayList(rc);
for (int i = 0; i < rc; i++)
@@ -239,7 +239,7 @@ public final class TextLayout implements Cloneable
leftToRight ? Font.LAYOUT_LEFT_TO_RIGHT
: Font.LAYOUT_RIGHT_TO_LEFT );
Run run = new Run(gv, font, 0, length);
- runs = new Run[]{ run };
+ runs = new Run[]{ run };
}
setCharIndices();
setupMappings();
@@ -247,8 +247,8 @@ public final class TextLayout implements Cloneable
}
public TextLayout (String string,
- Map<? extends AttributedCharacterIterator.Attribute, ?> attributes,
- FontRenderContext frc)
+ Map<? extends AttributedCharacterIterator.Attribute, ?> attributes,
+ FontRenderContext frc)
{
this( string, new Font( attributes ), frc );
}
@@ -261,7 +261,7 @@ public final class TextLayout implements Cloneable
/**
* Package-private constructor to make a textlayout from an existing one.
- * This is used by TextMeasurer for returning sub-layouts, and it
+ * This is used by TextMeasurer for returning sub-layouts, and it
* saves a lot of time in not having to relayout the text.
*/
TextLayout(TextLayout t, int startIndex, int endIndex)
@@ -284,14 +284,14 @@ public final class TextLayout implements Cloneable
for( int i = 0; i < nRuns; i++ )
{
Run run = t.runs[i + startingRun];
- GlyphVector gv = run.glyphVector;
+ GlyphVector gv = run.glyphVector;
Font font = run.font;
- // Copy only the relevant parts of the first and last runs.
- int beginGlyphIndex = (i > 0) ? 0 : t.charIndices[startIndex][1];
- int numEntries = ( i < nRuns - 1) ? gv.getNumGlyphs() :
- 1 + t.charIndices[endIndex - 1][1] - beginGlyphIndex;
-
- int[] codes = gv.getGlyphCodes(beginGlyphIndex, numEntries, null);
+ // Copy only the relevant parts of the first and last runs.
+ int beginGlyphIndex = (i > 0) ? 0 : t.charIndices[startIndex][1];
+ int numEntries = ( i < nRuns - 1) ? gv.getNumGlyphs() :
+ 1 + t.charIndices[endIndex - 1][1] - beginGlyphIndex;
+
+ int[] codes = gv.getGlyphCodes(beginGlyphIndex, numEntries, null);
gv = font.createGlyphVector(frc, codes);
runs[i] = new Run(gv, font, run.runStart - startIndex,
run.runEnd - startIndex);
@@ -311,7 +311,7 @@ public final class TextLayout implements Cloneable
int currentChar = 0;
for(int run = 0; run < runs.length; run++)
{
- currentChar = -1;
+ currentChar = -1;
Run current = runs[run];
GlyphVector gv = current.glyphVector;
for( int gi = 0; gi < gv.getNumGlyphs(); gi++)
@@ -366,7 +366,7 @@ public final class TextLayout implements Cloneable
{
CPStringBuilder sb = new CPStringBuilder();
int idx = iter.getIndex();
- for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next())
+ for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next())
sb.append(c);
iter.setIndex( idx );
return sb.toString();
@@ -377,13 +377,13 @@ public final class TextLayout implements Cloneable
Font f = (Font)iter.getAttribute(TextAttribute.FONT);
if( f == null )
{
- int size;
- Float i = (Float)iter.getAttribute(TextAttribute.SIZE);
- if( i != null )
- size = (int)i.floatValue();
- else
- size = 14;
- f = new Font("Dialog", Font.PLAIN, size );
+ int size;
+ Float i = (Float)iter.getAttribute(TextAttribute.SIZE);
+ if( i != null )
+ size = (int)i.floatValue();
+ else
+ size = 14;
+ f = new Font("Dialog", Font.PLAIN, size );
}
return f;
}
@@ -400,21 +400,21 @@ public final class TextLayout implements Cloneable
leftToRight = true;
while( i < endOffs && !gotDirection )
switch( Character.getDirectionality(string[i++]) )
- {
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
- case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
- gotDirection = true;
- break;
-
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
- case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
- leftToRight = false;
- gotDirection = true;
- break;
- }
+ {
+ case Character.DIRECTIONALITY_LEFT_TO_RIGHT:
+ case Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING:
+ case Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE:
+ gotDirection = true;
+ break;
+
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT:
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC:
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING:
+ case Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE:
+ leftToRight = false;
+ gotDirection = true;
+ break;
+ }
determineWhiteSpace();
}
@@ -422,14 +422,14 @@ public final class TextLayout implements Cloneable
{
// Determine if there's whitespace in the thing.
// Ignore trailing chars.
- int i = offset + length - 1;
+ int i = offset + length - 1;
hasWhitespace = false;
while( i >= offset && Character.isWhitespace( string[i] ) )
i--;
// Check the remaining chars
while( i >= offset )
if( Character.isWhitespace( string[i--] ) )
- hasWhitespace = true;
+ hasWhitespace = true;
}
protected Object clone ()
@@ -437,8 +437,8 @@ public final class TextLayout implements Cloneable
return new TextLayout( this, 0, length);
}
- public void draw (Graphics2D g2, float x, float y)
- {
+ public void draw (Graphics2D g2, float x, float y)
+ {
for(int i = 0; i < runs.length; i++)
{
Run run = runs[i];
@@ -464,7 +464,7 @@ public final class TextLayout implements Cloneable
// Compare all glyph vectors.
for( int i = 0; i < runs.length; i++ )
if( !runs[i].equals( tl.runs[i] ) )
- return false;
+ return false;
return true;
}
@@ -501,46 +501,46 @@ public final class TextLayout implements Cloneable
public Shape getBlackBoxBounds (int firstEndpoint, int secondEndpoint)
{
if( secondEndpoint - firstEndpoint <= 0 )
- return new Rectangle2D.Float(); // Hmm?
+ return new Rectangle2D.Float(); // Hmm?
if( firstEndpoint < 0 || secondEndpoint > getCharacterCount())
return new Rectangle2D.Float();
GeneralPath gp = new GeneralPath();
-
+
int ri = charIndices[ firstEndpoint ][0];
int gi = charIndices[ firstEndpoint ][1];
double advance = 0;
-
+
for( int i = 0; i < ri; i++ )
{
Run run = runs[i];
GlyphVector gv = run.glyphVector;
advance += gv.getLogicalBounds().getWidth();
}
-
+
for( int i = ri; i <= charIndices[ secondEndpoint - 1 ][0]; i++ )
{
Run run = runs[i];
GlyphVector gv = run.glyphVector;
- int dg;
- if( i == charIndices[ secondEndpoint - 1 ][0] )
- dg = charIndices[ secondEndpoint - 1][1];
- else
- dg = gv.getNumGlyphs() - 1;
-
- for( int j = 0; j <= dg; j++ )
- {
- Rectangle2D r2 = (gv.getGlyphVisualBounds( j )).
- getBounds2D();
- Point2D p = gv.getGlyphPosition( j );
- r2.setRect( advance + r2.getX(), r2.getY(),
- r2.getWidth(), r2.getHeight() );
- gp.append(r2, false);
- }
-
- advance += gv.getLogicalBounds().getWidth();
+ int dg;
+ if( i == charIndices[ secondEndpoint - 1 ][0] )
+ dg = charIndices[ secondEndpoint - 1][1];
+ else
+ dg = gv.getNumGlyphs() - 1;
+
+ for( int j = 0; j <= dg; j++ )
+ {
+ Rectangle2D r2 = (gv.getGlyphVisualBounds( j )).
+ getBounds2D();
+ Point2D p = gv.getGlyphPosition( j );
+ r2.setRect( advance + r2.getX(), r2.getY(),
+ r2.getWidth(), r2.getHeight() );
+ gp.append(r2, false);
+ }
+
+ advance += gv.getLogicalBounds().getWidth();
}
return gp;
}
@@ -564,7 +564,7 @@ public final class TextLayout implements Cloneable
boolean leading = hit.isLeadingEdge();
// For the boundary cases we return the boundary runs.
Run run;
-
+
if (index >= length)
{
info[0] = getAdvance();
@@ -710,15 +710,15 @@ public final class TextLayout implements Cloneable
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint)
{
- return getLogicalHighlightShape( firstEndpoint, secondEndpoint,
- getBounds() );
+ return getLogicalHighlightShape( firstEndpoint, secondEndpoint,
+ getBounds() );
}
public Shape getLogicalHighlightShape (int firstEndpoint, int secondEndpoint,
Rectangle2D bounds)
{
if( secondEndpoint - firstEndpoint <= 0 )
- return new Rectangle2D.Float(); // Hmm?
+ return new Rectangle2D.Float(); // Hmm?
if( firstEndpoint < 0 || secondEndpoint > getCharacterCount())
return new Rectangle2D.Float();
@@ -728,7 +728,7 @@ public final class TextLayout implements Cloneable
int gi = charIndices[ firstEndpoint ][1];
double advance = 0;
-
+
for( int i = 0; i < ri; i++ )
advance += runs[i].glyphVector.getLogicalBounds().getWidth();
@@ -736,24 +736,24 @@ public final class TextLayout implements Cloneable
{
Run run = runs[i];
GlyphVector gv = run.glyphVector;
- int dg; // last index in this run to use.
- if( i == charIndices[ secondEndpoint - 1 ][0] )
- dg = charIndices[ secondEndpoint - 1][1];
- else
- dg = gv.getNumGlyphs() - 1;
-
- for(; gi <= dg; gi++ )
- {
- Rectangle2D r2 = (gv.getGlyphLogicalBounds( gi )).
- getBounds2D();
- if( r == null )
- r = r2;
- else
- r = r.createUnion(r2);
- }
- gi = 0; // reset glyph index into run for next run.
-
- advance += gv.getLogicalBounds().getWidth();
+ int dg; // last index in this run to use.
+ if( i == charIndices[ secondEndpoint - 1 ][0] )
+ dg = charIndices[ secondEndpoint - 1][1];
+ else
+ dg = gv.getNumGlyphs() - 1;
+
+ for(; gi <= dg; gi++ )
+ {
+ Rectangle2D r2 = (gv.getGlyphLogicalBounds( gi )).
+ getBounds2D();
+ if( r == null )
+ r = r2;
+ else
+ r = r.createUnion(r2);
+ }
+ gi = 0; // reset glyph index into run for next run.
+
+ advance += gv.getLogicalBounds().getWidth();
}
return r;
@@ -901,9 +901,9 @@ public final class TextLayout implements Cloneable
for(int i = 0; i < runs.length; i++)
{
GlyphVector gv = runs[i].glyphVector;
- gp.append( gv.getOutline( x, 0f ), false );
- Rectangle2D r = gv.getLogicalBounds();
- x += r.getWidth();
+ gp.append( gv.getOutline( x, 0f ), false );
+ Rectangle2D r = gv.getLogicalBounds();
+ x += r.getWidth();
}
if( tx != null )
gp.transform( tx );
@@ -935,22 +935,22 @@ public final class TextLayout implements Cloneable
int lastNonWSChar = j - lastRun;
j = 0;
while( runs[ runs.length - 1 ].glyphVector.getGlyphCharIndex( j )
- <= lastNonWSChar )
+ <= lastNonWSChar )
{
- totalAdvance += runs[ runs.length - 1 ].glyphVector
+ totalAdvance += runs[ runs.length - 1 ].glyphVector
.getGlyphLogicalBounds( j )
.getBounds2D().getWidth();
- j ++;
+ j ++;
}
-
+
return totalAdvance;
}
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
TextHitInfo secondEndpoint)
{
- return getVisualHighlightShape( firstEndpoint, secondEndpoint,
- getBounds() );
+ return getVisualHighlightShape( firstEndpoint, secondEndpoint,
+ getBounds() );
}
public Shape getVisualHighlightShape (TextHitInfo firstEndpoint,
@@ -1102,17 +1102,17 @@ public final class TextLayout implements Cloneable
{
Run current = runs[run];
for(int i = 0; i < current.glyphVector.getNumGlyphs(); i++ )
- {
- int cindex = current.runStart
+ {
+ int cindex = current.runStart
+ current.glyphVector.getGlyphCharIndex( i );
- if( Character.isWhitespace( string[cindex] ) )
- // && cindex < lastNWS )
- {
- wsglyphs[ nglyphs * 2 ] = run;
- wsglyphs[ nglyphs * 2 + 1] = i;
- nglyphs++;
- }
- }
+ if( Character.isWhitespace( string[cindex] ) )
+ // && cindex < lastNWS )
+ {
+ wsglyphs[ nglyphs * 2 ] = run;
+ wsglyphs[ nglyphs * 2 + 1] = i;
+ nglyphs++;
+ }
+ }
}
deltaW = deltaW / nglyphs; // Change in width per whitespace glyph
double w = 0;
@@ -1394,8 +1394,8 @@ public final class TextLayout implements Cloneable
}
public TextHitInfo getStrongCaret(TextHitInfo hit1,
- TextHitInfo hit2,
- TextLayout layout)
+ TextHitInfo hit2,
+ TextLayout layout)
{
byte l1 = layout.getCharacterLevel(hit1.getCharIndex());
byte l2 = layout.getCharacterLevel(hit2.getCharIndex());
@@ -1418,5 +1418,3 @@ public final class TextLayout implements Cloneable
}
}
}
-
-
diff --git a/java/awt/font/TextMeasurer.java b/java/awt/font/TextMeasurer.java
index f4430bf6d..e443e8bc7 100644
--- a/java/awt/font/TextMeasurer.java
+++ b/java/awt/font/TextMeasurer.java
@@ -43,7 +43,7 @@ import java.awt.Shape;
/**
* TextMeasurer is a small utility class for measuring the length of laid-out
- * text objects.
+ * text objects.
*
* @author Sven de Marothy
* @since 1.3
@@ -57,9 +57,9 @@ public final class TextMeasurer implements Cloneable
/**
* Creates a TextMeasurer from a given text in the form of an
- * <code>AttributedCharacterIterator</code> and a
+ * <code>AttributedCharacterIterator</code> and a
* <code>FontRenderContext</code>.
- */
+ */
public TextMeasurer (AttributedCharacterIterator text, FontRenderContext frc)
{
this.text = text;
@@ -139,22 +139,22 @@ public final class TextMeasurer implements Cloneable
*
* @param start - the starting index.
* @param maxAdvance - the maximum advance allowed.
- * @return the index of the first character beyond maxAdvance, or the
+ * @return the index of the first character beyond maxAdvance, or the
* index of the last character + 1.
*/
public int getLineBreakIndex (int start, float maxAdvance)
- {
+ {
if( start < 0 )
throw new IllegalArgumentException("Start parameter must be > 0.");
double remainingLength = getAdvanceBetween( start, numChars );
-
+
int guessOffset = (int)( ( (double)maxAdvance / (double)remainingLength)
- * ( (double)numChars - (double)start ) );
+ * ( (double)numChars - (double)start ) );
guessOffset += start;
if( guessOffset > numChars )
guessOffset = numChars;
-
+
double guessLength = getAdvanceBetween( start, guessOffset );
boolean makeSmaller = ( guessLength > maxAdvance );
int inc = makeSmaller ? -1 : 1;
@@ -162,19 +162,19 @@ public final class TextMeasurer implements Cloneable
do
{
- guessOffset = guessOffset + inc;
- if( guessOffset <= start || guessOffset > numChars )
- {
- keepGoing = false;
- }
- else
- {
- guessLength = getAdvanceBetween( start, guessOffset );
- if( makeSmaller && ( guessLength <= maxAdvance) )
- keepGoing = false;
- if( !makeSmaller && ( guessLength >= maxAdvance) )
- keepGoing = false;
- }
+ guessOffset = guessOffset + inc;
+ if( guessOffset <= start || guessOffset > numChars )
+ {
+ keepGoing = false;
+ }
+ else
+ {
+ guessLength = getAdvanceBetween( start, guessOffset );
+ if( makeSmaller && ( guessLength <= maxAdvance) )
+ keepGoing = false;
+ if( !makeSmaller && ( guessLength >= maxAdvance) )
+ keepGoing = false;
+ }
}
while( keepGoing );
diff --git a/java/awt/font/TransformAttribute.java b/java/awt/font/TransformAttribute.java
index 977cafa03..56d15bb0b 100644
--- a/java/awt/font/TransformAttribute.java
+++ b/java/awt/font/TransformAttribute.java
@@ -43,12 +43,12 @@ import java.io.Serializable;
/**
* This class provides a mechanism for using an {@link AffineTransform} as
- * an <i>immutable</i> attribute (for example, in the
- * {@link java.text.AttributedString} class). Any transform passed to
+ * an <i>immutable</i> attribute (for example, in the
+ * {@link java.text.AttributedString} class). Any transform passed to
* this class is copied before being stored, and any transform handed out
- * by this class is a copy of the stored transform. In this way, it is
+ * by this class is a copy of the stored transform. In this way, it is
* not possible to modify the stored transform.
- *
+ *
* @author Michael Koch
*/
public final class TransformAttribute implements Serializable
@@ -56,16 +56,16 @@ public final class TransformAttribute implements Serializable
private static final long serialVersionUID = 3356247357827709530L;
private AffineTransform affineTransform;
-
+
/**
* Creates a new attribute that contains a copy of the given transform.
- *
+ *
* @param transform the transform (<code>null</code> not permitted).
- *
- * @throws IllegalArgumentException if <code>transform</code> is
+ *
+ * @throws IllegalArgumentException if <code>transform</code> is
* <code>null</code>.
*/
- public TransformAttribute (AffineTransform transform)
+ public TransformAttribute (AffineTransform transform)
{
if (transform == null)
{
@@ -76,7 +76,7 @@ public final class TransformAttribute implements Serializable
/**
* Returns a copy of the transform contained by this attribute.
- *
+ *
* @return A copy of the transform.
*/
public AffineTransform getTransform ()
@@ -87,10 +87,10 @@ public final class TransformAttribute implements Serializable
/**
* Returns <code>true</code> if the transform contained by this attribute is
* an identity transform, and <code>false</code> otherwise.
- *
+ *
* @return <code>true</code> if the transform contained by this attribute is
* an identity transform, and <code>false</code> otherwise.
- *
+ *
* @since 1.4
*/
public boolean isIdentity ()
diff --git a/java/awt/geom/AffineTransform.java b/java/awt/geom/AffineTransform.java
index 5bc51ddee..42590efce 100644
--- a/java/awt/geom/AffineTransform.java
+++ b/java/awt/geom/AffineTransform.java
@@ -57,7 +57,7 @@ import java.io.Serializable;
* [ 1 ] [ 0 0 1 ] [ 1 ] [ 1 ]
* </pre>
* The bottom row of the matrix is constant, so a transform can be uniquely
- * represented (as in {@link #toString()}) by
+ * represented (as in {@link #toString()}) by
* "[[m00, m01, m02], [m10, m11, m12]]".
*
* @author Tom Tromey (tromey@cygnus.com)
@@ -450,7 +450,7 @@ public class AffineTransform implements Cloneable, Serializable
* tx.translate(-x, -y);
* </pre>
*
- * <p>The resulting matrix is:
+ * <p>The resulting matrix is:
* <pre>
* [ cos(theta) -sin(theta) x-x*cos+y*sin ]
* [ sin(theta) cos(theta) y-x*sin-y*cos ]
@@ -521,7 +521,7 @@ public class AffineTransform implements Cloneable, Serializable
* TYPE_*_ROTATIONs, and the mutually exclusive TYPE_*_SCALEs.
*
* @return The type.
- *
+ *
* @see #TYPE_IDENTITY
* @see #TYPE_TRANSLATION
* @see #TYPE_UNIFORM_SCALE
@@ -825,7 +825,7 @@ public class AffineTransform implements Cloneable, Serializable
* tx.translate(-x, -y);
* </pre>
*
- * <p>The resulting matrix is:
+ * <p>The resulting matrix is:
* <pre>
* [ cos(theta) -sin(theta) x-x*cos+y*sin ]
* [ sin(theta) cos(theta) y-x*sin-y*cos ]
@@ -1002,19 +1002,19 @@ public class AffineTransform implements Cloneable, Serializable
* if getDeterminant() has a non-zero value.
*
* The inverse is calculated as:
- *
+ *
* <pre>
*
* Let A be the matrix for which we want to find the inverse:
*
* A = [ m00 m01 m02 ]
* [ m10 m11 m12 ]
- * [ 0 0 1 ]
+ * [ 0 0 1 ]
*
*
- * 1
- * inverse (A) = --- x adjoint(A)
- * det
+ * 1
+ * inverse (A) = --- x adjoint(A)
+ * det
*
*
*
@@ -1043,14 +1043,14 @@ public class AffineTransform implements Cloneable, Serializable
double det = getDeterminant();
if (det == 0)
throw new NoninvertibleTransformException("can't invert transform");
-
+
double im00 = m11 / det;
double im10 = -m10 / det;
double im01 = -m01 / det;
double im11 = m00 / det;
double im02 = (m01 * m12 - m02 * m11) / det;
double im12 = (-m00 * m12 + m10 * m02) / det;
-
+
return new AffineTransform (im00, im10, im01, im11, im02, im12);
}
@@ -1335,13 +1335,13 @@ public class AffineTransform implements Cloneable, Serializable
* which only stores points in float precision.
*
* @param src the shape source to transform
- * @return the shape, transformed by this, <code>null</code> if src is
+ * @return the shape, transformed by this, <code>null</code> if src is
* <code>null</code>.
* @see GeneralPath#transform(AffineTransform)
*/
public Shape createTransformedShape(Shape src)
{
- if(src == null)
+ if(src == null)
return null;
GeneralPath p = new GeneralPath(src);
p.transform(this);
@@ -1413,12 +1413,12 @@ public class AffineTransform implements Cloneable, Serializable
*/
public int hashCode()
{
- long l = Double.doubleToLongBits(m00);
- l = l * 31 + Double.doubleToLongBits(m01);
- l = l * 31 + Double.doubleToLongBits(m02);
- l = l * 31 + Double.doubleToLongBits(m10);
- l = l * 31 + Double.doubleToLongBits(m11);
- l = l * 31 + Double.doubleToLongBits(m12);
+ long l = Double.doubleToLongBits(m00);
+ l = l * 31 + Double.doubleToLongBits(m01);
+ l = l * 31 + Double.doubleToLongBits(m02);
+ l = l * 31 + Double.doubleToLongBits(m10);
+ l = l * 31 + Double.doubleToLongBits(m11);
+ l = l * 31 + Double.doubleToLongBits(m12);
return (int) ((l >> 32) ^ l);
}
diff --git a/java/awt/geom/Arc2D.java b/java/awt/geom/Arc2D.java
index eb9a16093..928c5cfc8 100644
--- a/java/awt/geom/Arc2D.java
+++ b/java/awt/geom/Arc2D.java
@@ -254,9 +254,9 @@ public abstract class Arc2D extends RectangularShape
if ((p2.getX() - p1.getX()) * (p3.getY() - p1.getY())
- (p3.getX() - p1.getX()) * (p2.getY() - p1.getY()) > 0)
{
- Point2D p = p3;
- p3 = p1;
- p1 = p;
+ Point2D p = p3;
+ p3 = p1;
+ p1 = p;
}
// normalized tangent vectors
@@ -277,7 +277,7 @@ public abstract class Arc2D extends RectangularShape
if (theta2 < theta1)
theta2 += 2 * Math.PI;
- // Vectors of the lines, not normalized, note we change
+ // Vectors of the lines, not normalized, note we change
// the direction of line 2.
dx1 = p1.getX() - p2.getX();
dy1 = p1.getY() - p2.getY();
@@ -478,8 +478,8 @@ public abstract class Arc2D extends RectangularShape
if (extent < 0)
{
- end = start;
- start += extent;
+ end = start;
+ start += extent;
}
start %= 360;
@@ -539,15 +539,15 @@ public abstract class Arc2D extends RectangularShape
if (Math.abs(extent) > 180)
{
- if (containsAngle(angle))
- return true;
- return sgn > 0;
+ if (containsAngle(angle))
+ return true;
+ return sgn > 0;
}
else
{
- if (! containsAngle(angle))
- return false;
- return sgn < 0;
+ if (! containsAngle(angle))
+ return false;
+ return sgn < 0;
}
}
@@ -587,11 +587,11 @@ public abstract class Arc2D extends RectangularShape
if (getArcType() != CHORD)
{
- // check intersections against the pie radii
- if (rect.intersectsLine(mx, my, x1, y1))
- return true;
- if (rect.intersectsLine(mx, my, x2, y2))
- return true;
+ // check intersections against the pie radii
+ if (rect.intersectsLine(mx, my, x1, y1))
+ return true;
+ if (rect.intersectsLine(mx, my, x2, y2))
+ return true;
}
else// check the chord
if (rect.intersectsLine(x1, y1, x2, y2))
@@ -606,46 +606,46 @@ public abstract class Arc2D extends RectangularShape
dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
if (! java.lang.Double.isNaN(dx))
{
- if (mx + dx >= x && mx + dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (mx - dx >= x && mx - dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
- return true;
+ if (mx + dx >= x && mx + dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (mx - dx >= x && mx - dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
+ return true;
}
dy = (y + h) - my;
dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
if (! java.lang.Double.isNaN(dx))
{
- if (mx + dx >= x && mx + dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (mx - dx >= x && mx - dx <= x + w
- && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
- return true;
+ if (mx + dx >= x && mx + dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (mx - dx >= x && mx - dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
+ return true;
}
dx = x - mx;
dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
if (! java.lang.Double.isNaN(dy))
{
- if (my + dy >= y && my + dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (my - dy >= y && my - dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
- return true;
+ if (my + dy >= y && my + dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (my - dy >= y && my - dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
+ return true;
}
dx = (x + w) - mx;
dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
if (! java.lang.Double.isNaN(dy))
{
- if (my + dy >= y && my + dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
- return true;
- if (my - dy >= y && my - dy <= y + h
- && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
- return true;
+ if (my + dy >= y && my + dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (my - dy >= y && my - dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
+ return true;
}
// Check whether the arc is contained within the box
@@ -687,12 +687,12 @@ public abstract class Arc2D extends RectangularShape
double y2 = my - b * Math.sin(Math.toRadians(getAngleStart() + extent));
if (getArcType() != CHORD)
{
- // check intersections against the pie radii
- if (rect.intersectsLine(mx, my, x1, y1))
- return false;
+ // check intersections against the pie radii
+ if (rect.intersectsLine(mx, my, x1, y1))
+ return false;
- if (rect.intersectsLine(mx, my, x2, y2))
- return false;
+ if (rect.intersectsLine(mx, my, x2, y2))
+ return false;
}
else if (rect.intersectsLine(x1, y1, x2, y2))
return false;
@@ -782,17 +782,17 @@ public abstract class Arc2D extends RectangularShape
type = a.type;
if (w < 0 || h < 0)
- limit = -1;
+ limit = -1;
else if (extent == 0)
- limit = type;
+ limit = type;
else if (Math.abs(extent) <= Math.PI / 2.0)
- limit = type + 1;
+ limit = type + 1;
else if (Math.abs(extent) <= Math.PI)
- limit = type + 2;
+ limit = type + 2;
else if (Math.abs(extent) <= 3.0 * (Math.PI / 2.0))
- limit = type + 3;
+ limit = type + 3;
else
- limit = type + 4;
+ limit = type + 4;
}
/**
@@ -855,7 +855,7 @@ public abstract class Arc2D extends RectangularShape
double[] double_coords = new double[6];
int code = currentSegment(double_coords);
for (int i = 0; i < 6; ++i)
- coords[i] = (float) double_coords[i];
+ coords[i] = (float) double_coords[i];
return code;
}
@@ -875,27 +875,27 @@ public abstract class Arc2D extends RectangularShape
double ymid = y + ry;
if (current > limit)
- throw new NoSuchElementException("arc iterator out of bounds");
+ throw new NoSuchElementException("arc iterator out of bounds");
if (current == 0)
{
- coords[0] = xmid + rx * Math.cos(start);
- coords[1] = ymid - ry * Math.sin(start);
- if (xform != null)
- xform.transform(coords, 0, coords, 0, 1);
- return SEG_MOVETO;
+ coords[0] = xmid + rx * Math.cos(start);
+ coords[1] = ymid - ry * Math.sin(start);
+ if (xform != null)
+ xform.transform(coords, 0, coords, 0, 1);
+ return SEG_MOVETO;
}
if (type != OPEN && current == limit)
- return SEG_CLOSE;
+ return SEG_CLOSE;
if ((current == limit - 1) && (type == PIE))
{
- coords[0] = xmid;
- coords[1] = ymid;
- if (xform != null)
- xform.transform(coords, 0, coords, 0, 1);
- return SEG_LINETO;
+ coords[0] = xmid;
+ coords[1] = ymid;
+ if (xform != null)
+ xform.transform(coords, 0, coords, 0, 1);
+ return SEG_LINETO;
}
// note that this produces a cubic approximation of the arc segment,
@@ -916,7 +916,7 @@ public abstract class Arc2D extends RectangularShape
curr_begin = start - (current - 1) * quad;
curr_extent = Math.max((start + extent) - curr_begin, -quad);
}
-
+
double portion_of_a_quadrant = Math.abs(curr_extent / quad);
double x0 = xmid + rx * Math.cos(curr_begin);
@@ -942,7 +942,7 @@ public abstract class Arc2D extends RectangularShape
cvec[1] = len;
else
cvec[1] = -len;
-
+
trans.scale(rx, ry);
trans.rotate(angle);
trans.transform(cvec, 0, cvec, 0, 1);
@@ -956,7 +956,7 @@ public abstract class Arc2D extends RectangularShape
cvec[1] = -len;
else
cvec[1] = len;
-
+
trans.rotate(curr_extent);
trans.transform(cvec, 0, cvec, 0, 1);
coords[2] = x1 + cvec[0];
@@ -967,7 +967,7 @@ public abstract class Arc2D extends RectangularShape
coords[5] = y1;
if (xform != null)
- xform.transform(coords, 0, coords, 0, 3);
+ xform.transform(coords, 0, coords, 0, 3);
return SEG_CUBICTO;
}
diff --git a/java/awt/geom/Area.java b/java/awt/geom/Area.java
index ad20b535f..a1eaf63f3 100644
--- a/java/awt/geom/Area.java
+++ b/java/awt/geom/Area.java
@@ -126,9 +126,9 @@ public class Area implements Shape, Cloneable
* of non-self-intersecting subpaths, and any inner paths which
* are found redundant in accordance with the Shape's winding rule
* will not be included.
- *
+ *
* @param s the shape (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>s</code> is <code>null</code>.
*/
public Area(Shape s)
@@ -144,7 +144,7 @@ public class Area implements Shape, Cloneable
// delete empty paths
for (int i = 0; i < p.size(); i++)
if (((Segment) p.elementAt(i)).getSignedArea() == 0.0)
- p.remove(i--);
+ p.remove(i--);
/*
* Resolve self intersecting paths into non-intersecting
@@ -162,19 +162,19 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < p.size(); i++)
{
- Segment path = (Segment) p.elementAt(i);
- createNodesSelf(path);
+ Segment path = (Segment) p.elementAt(i);
+ createNodesSelf(path);
}
if (p.size() > 1)
{
- for (int i = 0; i < p.size() - 1; i++)
- for (int j = i + 1; j < p.size(); j++)
- {
- Segment path1 = (Segment) p.elementAt(i);
- Segment path2 = (Segment) p.elementAt(j);
- createNodes(path1, path2);
- }
+ for (int i = 0; i < p.size() - 1; i++)
+ for (int j = i + 1; j < p.size(); j++)
+ {
+ Segment path1 = (Segment) p.elementAt(i);
+ Segment path2 = (Segment) p.elementAt(j);
+ createNodes(path1, path2);
+ }
}
// we have intersecting points.
@@ -182,13 +182,13 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < p.size(); i++)
{
- Segment path = v = (Segment) p.elementAt(i);
- do
- {
- segments.add(v);
- v = v.next;
- }
- while (v != path);
+ Segment path = v = (Segment) p.elementAt(i);
+ do
+ {
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
}
paths = weilerAtherton(segments);
@@ -219,12 +219,12 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < pathA.size(); i++)
{
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
}
Vector paths = new Vector();
@@ -237,28 +237,28 @@ public class Area implements Shape, Cloneable
// segments of A oustide B and all B outside A
for (int i = 0; i < pathA.size(); i++)
{
- v = (Segment) pathA.elementAt(i);
- Segment path = v;
- do
- {
- if (v.isSegmentOutside(area))
- segments.add(v);
- v = v.next;
- }
- while (v != path);
+ v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ do
+ {
+ if (v.isSegmentOutside(area))
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
}
for (int i = 0; i < pathB.size(); i++)
{
- v = (Segment) pathB.elementAt(i);
- Segment path = v;
- do
- {
- if (v.isSegmentOutside(this))
- segments.add(v);
- v = v.next;
- }
- while (v != path);
+ v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ do
+ {
+ if (v.isSegmentOutside(this))
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
}
paths = weilerAtherton(segments);
@@ -277,8 +277,8 @@ public class Area implements Shape, Cloneable
if (equals(area))
{
- reset();
- return;
+ reset();
+ return;
}
Vector pathA = new Vector();
@@ -299,12 +299,12 @@ public class Area implements Shape, Cloneable
// create nodes
for (int i = 0; i < pathA.size(); i++)
{
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
}
Vector paths = new Vector();
@@ -318,43 +318,43 @@ public class Area implements Shape, Cloneable
// and the segments before and after any node
for (int i = 0; i < pathA.size(); i++)
{
- Segment v = (Segment) pathA.elementAt(i);
- Segment path = v;
- if (v.isSegmentOutside(area) && v.node == null)
- segments.add(v);
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (v.isSegmentOutside(area))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
+ Segment v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ if (v.isSegmentOutside(area) && v.node == null)
+ segments.add(v);
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (v.isSegmentOutside(area))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
}
for (int i = 0; i < pathB.size(); i++)
{
- Segment v = (Segment) pathB.elementAt(i);
- Segment path = v;
- if (! v.isSegmentOutside(this) && v.node == null)
- segments.add(v);
- v = v.next;
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (! v.isSegmentOutside(this))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
+ Segment v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ if (! v.isSegmentOutside(this) && v.node == null)
+ segments.add(v);
+ v = v.next;
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (! v.isSegmentOutside(this))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
}
paths = weilerAtherton(segments);
@@ -370,8 +370,8 @@ public class Area implements Shape, Cloneable
{
if (isEmpty() || area.isEmpty())
{
- reset();
- return;
+ reset();
+ return;
}
if (equals(area))
return;
@@ -390,12 +390,12 @@ public class Area implements Shape, Cloneable
// create nodes
for (int i = 0; i < pathA.size(); i++)
{
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
}
Vector paths = new Vector();
@@ -410,43 +410,43 @@ public class Area implements Shape, Cloneable
// and the segments before and after any node
for (int i = 0; i < pathA.size(); i++)
{
- Segment v = (Segment) pathA.elementAt(i);
- Segment path = v;
- if (! v.isSegmentOutside(area) && v.node == null)
- segments.add(v);
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (! v.isSegmentOutside(area))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
+ Segment v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ if (! v.isSegmentOutside(area) && v.node == null)
+ segments.add(v);
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (! v.isSegmentOutside(area))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
}
for (int i = 0; i < pathB.size(); i++)
{
- Segment v = (Segment) pathB.elementAt(i);
- Segment path = v;
- if (! v.isSegmentOutside(this) && v.node == null)
- segments.add(v);
- v = v.next;
- boolean node = false;
- do
- {
- if ((v.node != null || node))
- {
- node = (v.node != null);
- if (! v.isSegmentOutside(this))
- segments.add(v);
- }
- v = v.next;
- }
- while (v != path);
+ Segment v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ if (! v.isSegmentOutside(this) && v.node == null)
+ segments.add(v);
+ v = v.next;
+ boolean node = false;
+ do
+ {
+ if ((v.node != null || node))
+ {
+ node = (v.node != null);
+ if (! v.isSegmentOutside(this))
+ segments.add(v);
+ }
+ v = v.next;
+ }
+ while (v != path);
}
paths = weilerAtherton(segments);
@@ -465,15 +465,15 @@ public class Area implements Shape, Cloneable
if (isEmpty())
{
- Area B = (Area) area.clone();
- solids = B.solids;
- holes = B.holes;
- return;
+ Area B = (Area) area.clone();
+ solids = B.solids;
+ holes = B.holes;
+ return;
}
if (equals(area))
{
- reset();
- return;
+ reset();
+ return;
}
Vector pathA = new Vector();
@@ -493,12 +493,12 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < pathA.size(); i++)
{
- Segment a = (Segment) pathA.elementAt(i);
- for (int j = 0; j < pathB.size(); j++)
- {
- Segment b = (Segment) pathB.elementAt(j);
- nNodes += createNodes(a, b);
- }
+ Segment a = (Segment) pathA.elementAt(i);
+ for (int j = 0; j < pathB.size(); j++)
+ {
+ Segment b = (Segment) pathB.elementAt(j);
+ nNodes += createNodes(a, b);
+ }
}
Vector paths = new Vector();
@@ -510,26 +510,26 @@ public class Area implements Shape, Cloneable
// In an XOR operation, we operate on all segments
for (int i = 0; i < pathA.size(); i++)
{
- v = (Segment) pathA.elementAt(i);
- Segment path = v;
- do
- {
- segments.add(v);
- v = v.next;
- }
- while (v != path);
+ v = (Segment) pathA.elementAt(i);
+ Segment path = v;
+ do
+ {
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
}
for (int i = 0; i < pathB.size(); i++)
{
- v = (Segment) pathB.elementAt(i);
- Segment path = v;
- do
- {
- segments.add(v);
- v = v.next;
- }
- while (v != path);
+ v = (Segment) pathB.elementAt(i);
+ Segment path = v;
+ do
+ {
+ segments.add(v);
+ v = v.next;
+ }
+ while (v != path);
}
paths = weilerAtherton(segments);
@@ -573,10 +573,10 @@ public class Area implements Shape, Cloneable
{
for (int i = 0; i < holes.size(); i++)
if (! ((Segment) holes.elementAt(i)).isPolygonal())
- return false;
+ return false;
for (int i = 0; i < solids.size(); i++)
if (! ((Segment) solids.elementAt(i)).isPolygonal())
- return false;
+ return false;
return true;
}
@@ -607,23 +607,23 @@ public class Area implements Shape, Cloneable
Segment s = path;
do
{
- Segment s2 = s.next;
- double d1 = (s.P2.getX() - s.P1.getX())*(s2.P2.getX() - s2.P1.getX())/
- ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
- double d2 = (s.P2.getY() - s.P1.getY())*(s2.P2.getY() - s2.P1.getY())/
- ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
- double dotproduct = d1 + d2;
-
- // For some reason, only rectangles on the XY axis count.
- if (d1 != 0 && d2 != 0)
- return false;
-
- if (Math.abs(dotproduct) == 0) // 90 degree angle
- nCorners++;
- else if ((Math.abs(1.0 - dotproduct) > 0)) // 0 degree angle?
- return false; // if not, return false
-
- s = s.next;
+ Segment s2 = s.next;
+ double d1 = (s.P2.getX() - s.P1.getX())*(s2.P2.getX() - s2.P1.getX())/
+ ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
+ double d2 = (s.P2.getY() - s.P1.getY())*(s2.P2.getY() - s2.P1.getY())/
+ ((s.P1.distance(s.P2)) * (s2.P1.distance(s2.P2)));
+ double dotproduct = d1 + d2;
+
+ // For some reason, only rectangles on the XY axis count.
+ if (d1 != 0 && d2 != 0)
+ return false;
+
+ if (Math.abs(dotproduct) == 0) // 90 degree angle
+ nCorners++;
+ else if ((Math.abs(1.0 - dotproduct) > 0)) // 0 degree angle?
+ return false; // if not, return false
+
+ s = s.next;
}
while (s != path);
@@ -662,11 +662,11 @@ public class Area implements Shape, Cloneable
for (int path = 0; path < solids.size(); path++)
{
- Rectangle2D r = ((Segment) solids.elementAt(path)).getPathBounds();
- xmin = Math.min(r.getMinX(), xmin);
- ymin = Math.min(r.getMinY(), ymin);
- xmax = Math.max(r.getMaxX(), xmax);
- ymax = Math.max(r.getMaxY(), ymax);
+ Rectangle2D r = ((Segment) solids.elementAt(path)).getPathBounds();
+ xmin = Math.min(r.getMinX(), xmin);
+ ymin = Math.min(r.getMinY(), ymin);
+ xmax = Math.max(r.getMaxX(), xmax);
+ ymax = Math.max(r.getMaxY(), ymax);
}
return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
@@ -675,7 +675,7 @@ public class Area implements Shape, Cloneable
/**
* Returns the bounds of this object in Rectangle format.
* Please note that this may lead to loss of precision.
- *
+ *
* @return The bounds.
* @see #getBounds2D()
*/
@@ -694,22 +694,22 @@ public class Area implements Shape, Cloneable
{
try
{
- Area clone = new Area();
- for (int i = 0; i < solids.size(); i++)
- clone.solids.add(((Segment) solids.elementAt(i)).cloneSegmentList());
- for (int i = 0; i < holes.size(); i++)
- clone.holes.add(((Segment) holes.elementAt(i)).cloneSegmentList());
- return clone;
+ Area clone = new Area();
+ for (int i = 0; i < solids.size(); i++)
+ clone.solids.add(((Segment) solids.elementAt(i)).cloneSegmentList());
+ for (int i = 0; i < holes.size(); i++)
+ clone.holes.add(((Segment) holes.elementAt(i)).cloneSegmentList());
+ return clone;
}
catch (CloneNotSupportedException e)
{
- throw (Error) new InternalError().initCause(e); // Impossible
+ throw (Error) new InternalError().initCause(e); // Impossible
}
}
/**
* Compares two Areas.
- *
+ *
* @param area the area to compare against this area (<code>null</code>
* permitted).
* @return <code>true</code> if the areas are equal, and <code>false</code>
@@ -739,14 +739,14 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < nPaths; i++)
{
- for (int j = 0; j < nPaths; j++)
- {
- Segment p1 = (Segment) pathA.elementAt(i);
- Segment p2 = (Segment) pathB.elementAt(j);
- if (! match[0][i] && ! match[1][j])
- if (p1.pathEquals(p2))
- match[0][i] = match[1][j] = true;
- }
+ for (int j = 0; j < nPaths; j++)
+ {
+ Segment p1 = (Segment) pathA.elementAt(i);
+ Segment p2 = (Segment) pathB.elementAt(j);
+ if (! match[0][i] && ! match[1][j])
+ if (p1.pathEquals(p2))
+ match[0][i] = match[1][j] = true;
+ }
}
boolean result = true;
@@ -757,7 +757,7 @@ public class Area implements Shape, Cloneable
/**
* Transforms this area by the AffineTransform at.
- *
+ *
* @param at the transform.
*/
public void transform(AffineTransform at)
@@ -770,8 +770,8 @@ public class Area implements Shape, Cloneable
// Note that the orientation is not invariant under inversion
if ((at.getType() & AffineTransform.TYPE_FLIP) != 0)
{
- setDirection(holes, false);
- setDirection(solids, true);
+ setDirection(holes, false);
+ setDirection(solids, true);
}
}
@@ -801,11 +801,11 @@ public class Area implements Shape, Cloneable
int n = 0;
for (int i = 0; i < solids.size(); i++)
if (((Segment) solids.elementAt(i)).contains(x, y))
- n++;
+ n++;
for (int i = 0; i < holes.size(); i++)
if (((Segment) holes.elementAt(i)).contains(x, y))
- n--;
+ n--;
return (n != 0);
}
@@ -814,7 +814,7 @@ public class Area implements Shape, Cloneable
* Determines if the Point2D p is contained within this Area.
*
* @param p the point.
- * @return <code>true</code> if the point is contained, <code>false</code>
+ * @return <code>true</code> if the point is contained, <code>false</code>
* otherwise.
* @throws NullPointerException if <code>p</code> is <code>null</code>.
*/
@@ -830,7 +830,7 @@ public class Area implements Shape, Cloneable
*
* This method should always produce the correct results, unlike for other
* classes in geom.
- *
+ *
* @param x the x-coordinate of the rectangle.
* @param y the y-coordinate of the rectangle.
* @param w the width of the the rectangle.
@@ -850,39 +850,39 @@ public class Area implements Shape, Cloneable
// will mean the rectangle is not entirely contained.
for (int i = 0; i < 4; i++)
{
- for (int path = 0; path < solids.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) solids.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return false;
- v = v.next;
- }
- while (v != start);
- }
- for (int path = 0; path < holes.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) holes.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return false;
- v = v.next;
- }
- while (v != start);
- }
+ for (int path = 0; path < solids.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) solids.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return false;
+ v = v.next;
+ }
+ while (v != start);
+ }
+ for (int path = 0; path < holes.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) holes.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return false;
+ v = v.next;
+ }
+ while (v != start);
+ }
}
// Is any point inside?
if (! contains(x, y))
return false;
- // Final hoop: Is the rectangle non-intersecting and inside,
+ // Final hoop: Is the rectangle non-intersecting and inside,
// but encloses a hole?
Rectangle2D r = new Rectangle2D.Double(x, y, w, h);
for (int path = 0; path < holes.size(); path++)
@@ -898,10 +898,10 @@ public class Area implements Shape, Cloneable
*
* This method should always produce the correct results, unlike for other
* classes in geom.
- *
+ *
* @param r the rectangle.
* @return <code>true</code> if the rectangle is considered contained
- *
+ *
* @throws NullPointerException if <code>r</code> is <code>null</code>.
*/
public boolean contains(Rectangle2D r)
@@ -912,12 +912,12 @@ public class Area implements Shape, Cloneable
/**
* Determines if the rectangle specified by (x,y) as the upper-left
* and with width w and height h intersects any part of this Area.
- *
+ *
* @param x the x-coordinate for the rectangle.
* @param y the y-coordinate for the rectangle.
* @param w the width of the rectangle.
* @param h the height of the rectangle.
- * @return <code>true</code> if the rectangle intersects the area,
+ * @return <code>true</code> if the rectangle intersects the area,
* <code>false</code> otherwise.
*/
public boolean intersects(double x, double y, double w, double h)
@@ -934,32 +934,32 @@ public class Area implements Shape, Cloneable
// Return true on any intersection
for (int i = 0; i < 4; i++)
{
- for (int path = 0; path < solids.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) solids.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return true;
- v = v.next;
- }
- while (v != start);
- }
- for (int path = 0; path < holes.size(); path++)
- {
- Segment v;
- Segment start;
- start = v = (Segment) holes.elementAt(path);
- do
- {
- if (l[i].hasIntersections(v))
- return true;
- v = v.next;
- }
- while (v != start);
- }
+ for (int path = 0; path < solids.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) solids.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return true;
+ v = v.next;
+ }
+ while (v != start);
+ }
+ for (int path = 0; path < holes.size(); path++)
+ {
+ Segment v;
+ Segment start;
+ start = v = (Segment) holes.elementAt(path);
+ do
+ {
+ if (l[i].hasIntersections(v))
+ return true;
+ v = v.next;
+ }
+ while (v != start);
+ }
}
// Non-intersecting, Is any point inside?
@@ -978,7 +978,7 @@ public class Area implements Shape, Cloneable
* part of this Area.
* @param r the rectangle to test intersection with (<code>null</code>
* not permitted).
- * @return <code>true</code> if the rectangle intersects the area,
+ * @return <code>true</code> if the rectangle intersects the area,
* <code>false</code> otherwise.
* @throws NullPointerException if <code>r</code> is <code>null</code>.
*/
@@ -990,7 +990,7 @@ public class Area implements Shape, Cloneable
/**
* Returns a PathIterator object defining the contour of this Area,
* transformed by at.
- *
+ *
* @param at the transform.
* @return A path iterator.
*/
@@ -1002,7 +1002,7 @@ public class Area implements Shape, Cloneable
/**
* Returns a flattened PathIterator object defining the contour of this
* Area, transformed by at and with a defined flatness.
- *
+ *
* @param at the transform.
* @param flatness the flatness.
* @return A path iterator.
@@ -1013,7 +1013,7 @@ public class Area implements Shape, Cloneable
}
//---------------------------------------------------------------------
- // Non-public methods and classes
+ // Non-public methods and classes
/**
* Private pathiterator object.
@@ -1032,7 +1032,7 @@ public class Area implements Shape, Cloneable
IteratorSegment()
{
- coords = new double[6];
+ coords = new double[6];
}
}
@@ -1052,27 +1052,27 @@ public class Area implements Shape, Cloneable
for (int i = 0; i < allpaths.size(); i++)
{
- Segment v = (Segment) allpaths.elementAt(i);
- Segment start = v;
-
- IteratorSegment is = new IteratorSegment();
- is.type = SEG_MOVETO;
- is.coords[0] = start.P1.getX();
- is.coords[1] = start.P1.getY();
- segments.add(is);
-
- do
- {
- is = new IteratorSegment();
- is.type = v.pathIteratorFormat(is.coords);
- segments.add(is);
- v = v.next;
- }
- while (v != start);
-
- is = new IteratorSegment();
- is.type = SEG_CLOSE;
- segments.add(is);
+ Segment v = (Segment) allpaths.elementAt(i);
+ Segment start = v;
+
+ IteratorSegment is = new IteratorSegment();
+ is.type = SEG_MOVETO;
+ is.coords[0] = start.P1.getX();
+ is.coords[1] = start.P1.getY();
+ segments.add(is);
+
+ do
+ {
+ is = new IteratorSegment();
+ is.type = v.pathIteratorFormat(is.coords);
+ segments.add(is);
+ v = v.next;
+ }
+ while (v != start);
+
+ is = new IteratorSegment();
+ is.type = SEG_CLOSE;
+ segments.add(is);
}
}
@@ -1080,10 +1080,10 @@ public class Area implements Shape, Cloneable
{
IteratorSegment s = (IteratorSegment) segments.elementAt(index);
if (at != null)
- at.transform(s.coords, 0, coords, 0, 3);
+ at.transform(s.coords, 0, coords, 0, 3);
else
- for (int i = 0; i < 6; i++)
- coords[i] = s.coords[i];
+ for (int i = 0; i < 6; i++)
+ coords[i] = s.coords[i];
return (s.type);
}
@@ -1093,13 +1093,13 @@ public class Area implements Shape, Cloneable
double[] d = new double[6];
if (at != null)
{
- at.transform(s.coords, 0, d, 0, 3);
- for (int i = 0; i < 6; i++)
- coords[i] = (float) d[i];
+ at.transform(s.coords, 0, d, 0, 3);
+ for (int i = 0; i < 6; i++)
+ coords[i] = (float) d[i];
}
else
- for (int i = 0; i < 6; i++)
- coords[i] = (float) s.coords[i];
+ for (int i = 0; i < 6; i++)
+ coords[i] = (float) s.coords[i];
return (s.type);
}
@@ -1134,22 +1134,22 @@ public class Area implements Shape, Cloneable
Vector paths = new Vector();
while (segments.size() > 0)
{
- // Iterate over the path
- Segment start = (Segment) segments.elementAt(0);
- Segment s = start;
- do
- {
- segments.remove(s);
- if (s.node != null)
- { // switch over
- s.next = s.node;
- s.node = null;
- }
- s = s.next; // continue
- }
- while (s != start);
-
- paths.add(start);
+ // Iterate over the path
+ Segment start = (Segment) segments.elementAt(0);
+ Segment s = start;
+ do
+ {
+ segments.remove(s);
+ if (s.node != null)
+ { // switch over
+ s.next = s.node;
+ s.node = null;
+ }
+ s = s.next; // continue
+ }
+ while (s != start);
+
+ paths.add(start);
}
return paths;
}
@@ -1230,30 +1230,30 @@ public class Area implements Shape, Cloneable
if (flat1 && flat2)
{
- double xlk = c1.getP2().getX() - c1.getP1().getX();
- double ylk = c1.getP2().getY() - c1.getP1().getY();
-
- double xnm = c2.getP2().getX() - c2.getP1().getX();
- double ynm = c2.getP2().getY() - c2.getP1().getY();
-
- double xmk = c2.getP1().getX() - c1.getP1().getX();
- double ymk = c2.getP1().getY() - c1.getP1().getY();
- double det = xnm * ylk - ynm * xlk;
-
- if (det + 1.0 == 1.0)
- return;
-
- double detinv = 1.0 / det;
- double s = (xnm * ymk - ynm * xmk) * detinv;
- double t = (xlk * ymk - ylk * xmk) * detinv;
- if ((s < 0.0) || (s > 1.0) || (t < 0.0) || (t > 1.0))
- return;
-
- double[] temp = new double[2];
- temp[0] = t1 + s * w1;
- temp[1] = t2 + t * w1;
- cc_intersections.add(temp);
- return;
+ double xlk = c1.getP2().getX() - c1.getP1().getX();
+ double ylk = c1.getP2().getY() - c1.getP1().getY();
+
+ double xnm = c2.getP2().getX() - c2.getP1().getX();
+ double ynm = c2.getP2().getY() - c2.getP1().getY();
+
+ double xmk = c2.getP1().getX() - c1.getP1().getX();
+ double ymk = c2.getP1().getY() - c1.getP1().getY();
+ double det = xnm * ylk - ynm * xlk;
+
+ if (det + 1.0 == 1.0)
+ return;
+
+ double detinv = 1.0 / det;
+ double s = (xnm * ymk - ynm * xmk) * detinv;
+ double t = (xlk * ymk - ylk * xmk) * detinv;
+ if ((s < 0.0) || (s > 1.0) || (t < 0.0) || (t > 1.0))
+ return;
+
+ double[] temp = new double[2];
+ temp[0] = t1 + s * w1;
+ temp[1] = t2 + t * w1;
+ cc_intersections.add(temp);
+ return;
}
CubicCurve2D.Double c11 = new CubicCurve2D.Double();
@@ -1263,33 +1263,33 @@ public class Area implements Shape, Cloneable
if (! flat1 && ! flat2)
{
- depth1--;
- depth2--;
- w1 = w1 * 0.5;
- w2 = w2 * 0.5;
- c1.subdivide(c11, c12);
- c2.subdivide(c21, c22);
- if (c11.getBounds2D().intersects(c21.getBounds2D()))
- recursiveSubdivide(c11, c21, depth1, depth2, t1, t2, w1, w2);
- if (c11.getBounds2D().intersects(c22.getBounds2D()))
- recursiveSubdivide(c11, c22, depth1, depth2, t1, t2 + w2, w1, w2);
- if (c12.getBounds2D().intersects(c21.getBounds2D()))
- recursiveSubdivide(c12, c21, depth1, depth2, t1 + w1, t2, w1, w2);
- if (c12.getBounds2D().intersects(c22.getBounds2D()))
- recursiveSubdivide(c12, c22, depth1, depth2, t1 + w1, t2 + w2, w1, w2);
- return;
+ depth1--;
+ depth2--;
+ w1 = w1 * 0.5;
+ w2 = w2 * 0.5;
+ c1.subdivide(c11, c12);
+ c2.subdivide(c21, c22);
+ if (c11.getBounds2D().intersects(c21.getBounds2D()))
+ recursiveSubdivide(c11, c21, depth1, depth2, t1, t2, w1, w2);
+ if (c11.getBounds2D().intersects(c22.getBounds2D()))
+ recursiveSubdivide(c11, c22, depth1, depth2, t1, t2 + w2, w1, w2);
+ if (c12.getBounds2D().intersects(c21.getBounds2D()))
+ recursiveSubdivide(c12, c21, depth1, depth2, t1 + w1, t2, w1, w2);
+ if (c12.getBounds2D().intersects(c22.getBounds2D()))
+ recursiveSubdivide(c12, c22, depth1, depth2, t1 + w1, t2 + w2, w1, w2);
+ return;
}
if (! flat1)
{
- depth1--;
- c1.subdivide(c11, c12);
- w1 = w1 * 0.5;
- if (c11.getBounds2D().intersects(c2.getBounds2D()))
- recursiveSubdivide(c11, c2, depth1, depth2, t1, t2, w1, w2);
- if (c12.getBounds2D().intersects(c2.getBounds2D()))
- recursiveSubdivide(c12, c2, depth1, depth2, t1 + w1, t2, w1, w2);
- return;
+ depth1--;
+ c1.subdivide(c11, c12);
+ w1 = w1 * 0.5;
+ if (c11.getBounds2D().intersects(c2.getBounds2D()))
+ recursiveSubdivide(c11, c2, depth1, depth2, t1, t2, w1, w2);
+ if (c12.getBounds2D().intersects(c2.getBounds2D()))
+ recursiveSubdivide(c12, c2, depth1, depth2, t1 + w1, t2, w1, w2);
+ return;
}
depth2--;
@@ -1317,7 +1317,7 @@ public class Area implements Shape, Cloneable
* This is a reasonably accurate method, although the recursion depth
* is typically around 20, the bounding-box tests allow for significant
* pruning of the subdivision tree.
- *
+ *
* This is package-private to avoid an accessor method.
*/
Intersection[] cubicCubicIntersect(CubicSegment curve1, CubicSegment curve2)
@@ -1339,9 +1339,9 @@ public class Area implements Shape, Cloneable
Intersection[] results = new Intersection[cc_intersections.size()];
for (int i = 0; i < cc_intersections.size(); i++)
{
- double[] temp = (double[]) cc_intersections.elementAt(i);
- results[i] = new Intersection(curve1.evaluatePoint(temp[0]), temp[0],
- temp[1]);
+ double[] temp = (double[]) cc_intersections.elementAt(i);
+ results[i] = new Intersection(curve1.evaluatePoint(temp[0]), temp[0],
+ temp[1]);
}
cc_intersections = null;
return (results);
@@ -1390,21 +1390,21 @@ public class Area implements Shape, Cloneable
// line on y axis
if (dx == 0 || (dy / dx) > 1.0)
{
- double k = dx / dy;
- x[0] -= lx0;
- y[0] -= ly0;
- y[0] *= k;
- y[1] *= k;
- y[2] *= k;
+ double k = dx / dy;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ y[0] *= k;
+ y[1] *= k;
+ y[2] *= k;
}
else
{
- double k = dy / dx;
- x[0] -= lx0;
- y[0] -= ly0;
- x[0] *= k;
- x[1] *= k;
- x[2] *= k;
+ double k = dy / dx;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ x[0] *= k;
+ x[1] *= k;
+ x[2] *= k;
}
for (int i = 0; i < 3; i++)
@@ -1412,43 +1412,43 @@ public class Area implements Shape, Cloneable
if ((nRoots = QuadCurve2D.solveQuadratic(r)) > 0)
{
- Intersection[] temp = new Intersection[nRoots];
- int intersections = 0;
- for (int i = 0; i < nRoots; i++)
- {
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- Point2D p = c.evaluatePoint(t);
-
- // if the line is on an axis, snap the point to that axis.
- if (dx == 0)
- p.setLocation(lx0, p.getY());
- if (dy == 0)
- p.setLocation(p.getX(), ly0);
-
- if (p.getX() <= Math.max(lx0, lx1)
- && p.getX() >= Math.min(lx0, lx1)
- && p.getY() <= Math.max(ly0, ly1)
- && p.getY() >= Math.min(ly0, ly1))
- {
- double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
- temp[i] = new Intersection(p, lineparameter, t);
- intersections++;
- }
- }
- else
- temp[i] = null;
- }
- if (intersections == 0)
- return null;
-
- Intersection[] rValues = new Intersection[intersections];
-
- for (int i = 0; i < nRoots; i++)
- if (temp[i] != null)
- rValues[--intersections] = temp[i];
- return (rValues);
+ Intersection[] temp = new Intersection[nRoots];
+ int intersections = 0;
+ for (int i = 0; i < nRoots; i++)
+ {
+ double t = r[i];
+ if (t >= 0.0 && t <= 1.0)
+ {
+ Point2D p = c.evaluatePoint(t);
+
+ // if the line is on an axis, snap the point to that axis.
+ if (dx == 0)
+ p.setLocation(lx0, p.getY());
+ if (dy == 0)
+ p.setLocation(p.getX(), ly0);
+
+ if (p.getX() <= Math.max(lx0, lx1)
+ && p.getX() >= Math.min(lx0, lx1)
+ && p.getY() <= Math.max(ly0, ly1)
+ && p.getY() >= Math.min(ly0, ly1))
+ {
+ double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
+ temp[i] = new Intersection(p, lineparameter, t);
+ intersections++;
+ }
+ }
+ else
+ temp[i] = null;
+ }
+ if (intersections == 0)
+ return null;
+
+ Intersection[] rValues = new Intersection[intersections];
+
+ for (int i = 0; i < nRoots; i++)
+ if (temp[i] != null)
+ rValues[--intersections] = temp[i];
+ return (rValues);
}
return null;
}
@@ -1457,7 +1457,7 @@ public class Area implements Shape, Cloneable
* Returns the intersections between a line and a cubic segment
* This is done through combining the line's equation with the
* parametric form of the Bezier and solving the resulting quadratic.
- * This is package-private to avoid an accessor method.
+ * This is package-private to avoid an accessor method.
*/
Intersection[] lineCubicIntersect(LineSegment l, CubicSegment c)
{
@@ -1499,65 +1499,65 @@ public class Area implements Shape, Cloneable
// line on y axis
if (dx == 0 || (dy / dx) > 1.0)
{
- double k = dx / dy;
- x[0] -= lx0;
- y[0] -= ly0;
- y[0] *= k;
- y[1] *= k;
- y[2] *= k;
- y[3] *= k;
+ double k = dx / dy;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ y[0] *= k;
+ y[1] *= k;
+ y[2] *= k;
+ y[3] *= k;
}
else
{
- double k = dy / dx;
- x[0] -= lx0;
- y[0] -= ly0;
- x[0] *= k;
- x[1] *= k;
- x[2] *= k;
- x[3] *= k;
+ double k = dy / dx;
+ x[0] -= lx0;
+ y[0] -= ly0;
+ x[0] *= k;
+ x[1] *= k;
+ x[2] *= k;
+ x[3] *= k;
}
for (int i = 0; i < 4; i++)
r[i] = y[i] - x[i];
if ((nRoots = CubicCurve2D.solveCubic(r)) > 0)
{
- Intersection[] temp = new Intersection[nRoots];
- int intersections = 0;
- for (int i = 0; i < nRoots; i++)
- {
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- // if the line is on an axis, snap the point to that axis.
- Point2D p = c.evaluatePoint(t);
- if (dx == 0)
- p.setLocation(lx0, p.getY());
- if (dy == 0)
- p.setLocation(p.getX(), ly0);
-
- if (p.getX() <= Math.max(lx0, lx1)
- && p.getX() >= Math.min(lx0, lx1)
- && p.getY() <= Math.max(ly0, ly1)
- && p.getY() >= Math.min(ly0, ly1))
- {
- double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
- temp[i] = new Intersection(p, lineparameter, t);
- intersections++;
- }
- }
- else
- temp[i] = null;
- }
-
- if (intersections == 0)
- return null;
-
- Intersection[] rValues = new Intersection[intersections];
- for (int i = 0; i < nRoots; i++)
- if (temp[i] != null)
- rValues[--intersections] = temp[i];
- return (rValues);
+ Intersection[] temp = new Intersection[nRoots];
+ int intersections = 0;
+ for (int i = 0; i < nRoots; i++)
+ {
+ double t = r[i];
+ if (t >= 0.0 && t <= 1.0)
+ {
+ // if the line is on an axis, snap the point to that axis.
+ Point2D p = c.evaluatePoint(t);
+ if (dx == 0)
+ p.setLocation(lx0, p.getY());
+ if (dy == 0)
+ p.setLocation(p.getX(), ly0);
+
+ if (p.getX() <= Math.max(lx0, lx1)
+ && p.getX() >= Math.min(lx0, lx1)
+ && p.getY() <= Math.max(ly0, ly1)
+ && p.getY() >= Math.min(ly0, ly1))
+ {
+ double lineparameter = p.distance(l.P1) / l.P2.distance(l.P1);
+ temp[i] = new Intersection(p, lineparameter, t);
+ intersections++;
+ }
+ }
+ else
+ temp[i] = null;
+ }
+
+ if (intersections == 0)
+ return null;
+
+ Intersection[] rValues = new Intersection[intersections];
+ for (int i = 0; i < nRoots; i++)
+ if (temp[i] != null)
+ rValues[--intersections] = temp[i];
+ return (rValues);
}
return null;
}
@@ -1639,120 +1639,120 @@ public class Area implements Shape, Cloneable
while (! pi.isDone())
{
- Segment v;
- switch (pi.currentSegment(coords))
- {
- case PathIterator.SEG_MOVETO:
- if (subpath != null)
- { // close existing open path
- current.next = new LineSegment(cx, cy, subpathx, subpathy);
- current = current.next;
- current.next = subpath;
- }
- subpath = null;
- subpathx = cx = coords[0];
- subpathy = cy = coords[1];
- break;
-
- // replace 'close' with a line-to.
- case PathIterator.SEG_CLOSE:
- if (subpath != null && (subpathx != cx || subpathy != cy))
- {
- current.next = new LineSegment(cx, cy, subpathx, subpathy);
- current = current.next;
- current.next = subpath;
- cx = subpathx;
- cy = subpathy;
- subpath = null;
- }
- else if (subpath != null)
- {
- current.next = subpath;
- subpath = null;
- }
- break;
- case PathIterator.SEG_LINETO:
- if (cx != coords[0] || cy != coords[1])
- {
- v = new LineSegment(cx, cy, coords[0], coords[1]);
- if (subpath == null)
- {
- subpath = current = v;
- paths.add(subpath);
- }
- else
- {
- current.next = v;
- current = current.next;
- }
- cx = coords[0];
- cy = coords[1];
- }
- break;
- case PathIterator.SEG_QUADTO:
- v = new QuadSegment(cx, cy, coords[0], coords[1], coords[2],
- coords[3]);
- if (subpath == null)
- {
- subpath = current = v;
- paths.add(subpath);
- }
- else
- {
- current.next = v;
- current = current.next;
- }
- cx = coords[2];
- cy = coords[3];
- break;
- case PathIterator.SEG_CUBICTO:
- v = new CubicSegment(cx, cy, coords[0], coords[1], coords[2],
- coords[3], coords[4], coords[5]);
- if (subpath == null)
- {
- subpath = current = v;
- paths.add(subpath);
- }
- else
- {
- current.next = v;
- current = current.next;
- }
-
- // check if the cubic is self-intersecting
- double[] lpts = ((CubicSegment) v).getLoop();
- if (lpts != null)
- {
- // if it is, break off the loop into its own path.
- v.subdivideInsert(lpts[0]);
- v.next.subdivideInsert((lpts[1] - lpts[0]) / (1.0 - lpts[0]));
-
- CubicSegment loop = (CubicSegment) v.next;
- v.next = loop.next;
- loop.next = loop;
-
- v.P2 = v.next.P1 = loop.P2 = loop.P1; // snap points
- paths.add(loop);
- current = v.next;
- }
-
- cx = coords[4];
- cy = coords[5];
- break;
- }
- pi.next();
+ Segment v;
+ switch (pi.currentSegment(coords))
+ {
+ case PathIterator.SEG_MOVETO:
+ if (subpath != null)
+ { // close existing open path
+ current.next = new LineSegment(cx, cy, subpathx, subpathy);
+ current = current.next;
+ current.next = subpath;
+ }
+ subpath = null;
+ subpathx = cx = coords[0];
+ subpathy = cy = coords[1];
+ break;
+
+ // replace 'close' with a line-to.
+ case PathIterator.SEG_CLOSE:
+ if (subpath != null && (subpathx != cx || subpathy != cy))
+ {
+ current.next = new LineSegment(cx, cy, subpathx, subpathy);
+ current = current.next;
+ current.next = subpath;
+ cx = subpathx;
+ cy = subpathy;
+ subpath = null;
+ }
+ else if (subpath != null)
+ {
+ current.next = subpath;
+ subpath = null;
+ }
+ break;
+ case PathIterator.SEG_LINETO:
+ if (cx != coords[0] || cy != coords[1])
+ {
+ v = new LineSegment(cx, cy, coords[0], coords[1]);
+ if (subpath == null)
+ {
+ subpath = current = v;
+ paths.add(subpath);
+ }
+ else
+ {
+ current.next = v;
+ current = current.next;
+ }
+ cx = coords[0];
+ cy = coords[1];
+ }
+ break;
+ case PathIterator.SEG_QUADTO:
+ v = new QuadSegment(cx, cy, coords[0], coords[1], coords[2],
+ coords[3]);
+ if (subpath == null)
+ {
+ subpath = current = v;
+ paths.add(subpath);
+ }
+ else
+ {
+ current.next = v;
+ current = current.next;
+ }
+ cx = coords[2];
+ cy = coords[3];
+ break;
+ case PathIterator.SEG_CUBICTO:
+ v = new CubicSegment(cx, cy, coords[0], coords[1], coords[2],
+ coords[3], coords[4], coords[5]);
+ if (subpath == null)
+ {
+ subpath = current = v;
+ paths.add(subpath);
+ }
+ else
+ {
+ current.next = v;
+ current = current.next;
+ }
+
+ // check if the cubic is self-intersecting
+ double[] lpts = ((CubicSegment) v).getLoop();
+ if (lpts != null)
+ {
+ // if it is, break off the loop into its own path.
+ v.subdivideInsert(lpts[0]);
+ v.next.subdivideInsert((lpts[1] - lpts[0]) / (1.0 - lpts[0]));
+
+ CubicSegment loop = (CubicSegment) v.next;
+ v.next = loop.next;
+ loop.next = loop;
+
+ v.P2 = v.next.P1 = loop.P2 = loop.P1; // snap points
+ paths.add(loop);
+ current = v.next;
+ }
+
+ cx = coords[4];
+ cy = coords[5];
+ break;
+ }
+ pi.next();
}
if (subpath != null)
{ // close any open path
- if (subpathx != cx || subpathy != cy)
- {
- current.next = new LineSegment(cx, cy, subpathx, subpathy);
- current = current.next;
- current.next = subpath;
- }
- else
- current.next = subpath;
+ if (subpathx != cx || subpathy != cy)
+ {
+ current.next = new LineSegment(cx, cy, subpathx, subpathy);
+ current = current.next;
+ current.next = subpath;
+ }
+ else
+ current.next = subpath;
}
if (paths.size() == 0)
@@ -1775,14 +1775,14 @@ public class Area implements Shape, Cloneable
do
{
- do
- {
- nNodes += a.splitIntersections(b);
- b = b.next;
- }
- while (b != B);
-
- a = a.next; // move to the next segment
+ do
+ {
+ nNodes += a.splitIntersections(b);
+ b = b.next;
+ }
+ while (b != B);
+
+ a = a.next; // move to the next segment
}
while (a != A); // until one wrap.
@@ -1804,15 +1804,15 @@ public class Area implements Shape, Cloneable
do
{
- Segment b = a.next;
- do
- {
- if (b != a) // necessary
- nNodes += a.splitIntersections(b);
- b = b.next;
- }
- while (b != A);
- a = a.next; // move to the next segment
+ Segment b = a.next;
+ do
+ {
+ if (b != a) // necessary
+ nNodes += a.splitIntersections(b);
+ b = b.next;
+ }
+ while (b != A);
+ a = a.next; // move to the next segment
}
while (a != A); // until one wrap.
@@ -1841,39 +1841,39 @@ public class Area implements Shape, Cloneable
// Find which path contains which, assign winding numbers
for (int i = 0; i < npaths; i++)
{
- Segment pathA = (Segment) paths.elementAt(i);
- pathA.nullNodes(); // remove any now-redundant nodes, in case.
- int windingA = pathA.hasClockwiseOrientation() ? 1 : neg;
-
- for (int j = 0; j < npaths; j++)
- if (i != j)
- {
- Segment pathB = (Segment) paths.elementAt(j);
-
- // A contains B
- if (bb[i].intersects(bb[j]))
- {
- Segment s = pathB.next;
- while (s.P1.getY() == s.P2.getY() && s != pathB)
- s = s.next;
- Point2D p = s.getMidPoint();
- if (pathA.contains(p.getX(), p.getY()))
- contains[i][j] = windingA;
- }
- else
- // A does not contain B
- contains[i][j] = 0;
- }
- else
- contains[i][j] = windingA; // i == j
+ Segment pathA = (Segment) paths.elementAt(i);
+ pathA.nullNodes(); // remove any now-redundant nodes, in case.
+ int windingA = pathA.hasClockwiseOrientation() ? 1 : neg;
+
+ for (int j = 0; j < npaths; j++)
+ if (i != j)
+ {
+ Segment pathB = (Segment) paths.elementAt(j);
+
+ // A contains B
+ if (bb[i].intersects(bb[j]))
+ {
+ Segment s = pathB.next;
+ while (s.P1.getY() == s.P2.getY() && s != pathB)
+ s = s.next;
+ Point2D p = s.getMidPoint();
+ if (pathA.contains(p.getX(), p.getY()))
+ contains[i][j] = windingA;
+ }
+ else
+ // A does not contain B
+ contains[i][j] = 0;
+ }
+ else
+ contains[i][j] = windingA; // i == j
}
for (int i = 0; i < npaths; i++)
{
- windingNumbers[i][0] = 0;
- for (int j = 0; j < npaths; j++)
- windingNumbers[i][0] += contains[j][i];
- windingNumbers[i][1] = contains[i][i];
+ windingNumbers[i][0] = 0;
+ for (int j = 0; j < npaths; j++)
+ windingNumbers[i][0] += contains[j][i];
+ windingNumbers[i][1] = contains[i][i];
}
Vector solids = new Vector();
@@ -1881,25 +1881,25 @@ public class Area implements Shape, Cloneable
if (windingRule == PathIterator.WIND_NON_ZERO)
{
- for (int i = 0; i < npaths; i++)
- {
- if (windingNumbers[i][0] == 0)
- holes.add(paths.elementAt(i));
- else if (windingNumbers[i][0] - windingNumbers[i][1] == 0
- && Math.abs(windingNumbers[i][0]) == 1)
- solids.add(paths.elementAt(i));
- }
+ for (int i = 0; i < npaths; i++)
+ {
+ if (windingNumbers[i][0] == 0)
+ holes.add(paths.elementAt(i));
+ else if (windingNumbers[i][0] - windingNumbers[i][1] == 0
+ && Math.abs(windingNumbers[i][0]) == 1)
+ solids.add(paths.elementAt(i));
+ }
}
else
{
- windingRule = PathIterator.WIND_NON_ZERO;
- for (int i = 0; i < npaths; i++)
- {
- if ((windingNumbers[i][0] & 1) == 0)
- holes.add(paths.elementAt(i));
- else if ((windingNumbers[i][0] & 1) == 1)
- solids.add(paths.elementAt(i));
- }
+ windingRule = PathIterator.WIND_NON_ZERO;
+ for (int i = 0; i < npaths; i++)
+ {
+ if ((windingNumbers[i][0] & 1) == 0)
+ holes.add(paths.elementAt(i));
+ else if ((windingNumbers[i][0] & 1) == 1)
+ solids.add(paths.elementAt(i));
+ }
}
setDirection(holes, false);
@@ -1918,9 +1918,9 @@ public class Area implements Shape, Cloneable
Segment v;
for (int i = 0; i < paths.size(); i++)
{
- v = (Segment) paths.elementAt(i);
- if (clockwise != v.hasClockwiseOrientation())
- v.reverseAll();
+ v = (Segment) paths.elementAt(i);
+ if (clockwise != v.hasClockwiseOrientation())
+ v.reverseAll();
}
}
@@ -2013,9 +2013,9 @@ public class Area implements Shape, Cloneable
int crossings = 0;
do
{
- int n = v.rayCrossing(x, y);
- crossings += n;
- v = v.next;
+ int n = v.rayCrossing(x, y);
+ crossings += n;
+ v = v.next;
}
while (v != this);
return ((crossings & 1) == 1);
@@ -2029,8 +2029,8 @@ public class Area implements Shape, Cloneable
Segment v = this;
do
{
- v.node = null;
- v = v.next;
+ v.node = null;
+ v = v.next;
}
while (v != this);
}
@@ -2043,8 +2043,8 @@ public class Area implements Shape, Cloneable
Segment v = this;
do
{
- v.transform(at);
- v = v.next;
+ v.transform(at);
+ v = v.next;
}
while (v != this);
}
@@ -2073,12 +2073,12 @@ public class Area implements Shape, Cloneable
Segment v = this;
do
{
- Rectangle2D r = v.getBounds();
- xmin = Math.min(r.getMinX(), xmin);
- ymin = Math.min(r.getMinY(), ymin);
- xmax = Math.max(r.getMaxX(), xmax);
- ymax = Math.max(r.getMaxY(), ymax);
- v = v.next;
+ Rectangle2D r = v.getBounds();
+ xmin = Math.min(r.getMinX(), xmin);
+ ymin = Math.min(r.getMinY(), ymin);
+ xmax = Math.max(r.getMaxX(), xmax);
+ ymax = Math.max(r.getMaxY(), ymax);
+ v = v.next;
}
while (v != this);
@@ -2096,11 +2096,11 @@ public class Area implements Shape, Cloneable
s = this;
do
{
- area += s.curveArea();
+ area += s.curveArea();
- area += s.P1.getX() * s.next.P1.getY()
- - s.P1.getY() * s.next.P1.getX();
- s = s.next;
+ area += s.P1.getX() * s.next.P1.getY()
+ - s.P1.getY() * s.next.P1.getX();
+ s = s.next;
}
while (s != this);
@@ -2117,11 +2117,11 @@ public class Area implements Shape, Cloneable
Segment former = this;
while (v != this)
{
- v.reverseCoords();
- Segment vnext = v.next;
- v.next = former;
- former = v;
- v = vnext;
+ v.reverseCoords();
+ Segment vnext = v.next;
+ v.next = former;
+ former = v;
+ v = vnext;
}
next = former;
}
@@ -2144,9 +2144,9 @@ public class Area implements Shape, Cloneable
Segment v = this;
do
{
- if (! (v instanceof LineSegment))
- return false;
- v = v.next;
+ if (! (v instanceof LineSegment))
+ return false;
+ v = v.next;
}
while (v != this);
return true;
@@ -2162,16 +2162,16 @@ public class Area implements Shape, Cloneable
while (v != this)
{
- list.add(v);
- v = v.next;
+ list.add(v);
+ v = v.next;
}
Segment clone = (Segment) this.clone();
v = clone;
for (int i = 0; i < list.size(); i++)
{
- clone.next = (Segment) ((Segment) list.elementAt(i)).clone();
- clone = clone.next;
+ clone.next = (Segment) ((Segment) list.elementAt(i)).clone();
+ clone = clone.next;
}
clone.next = v;
return v;
@@ -2187,7 +2187,7 @@ public class Area implements Shape, Cloneable
Point2D p = i.p;
if ((pointEquals(P1, p) || pointEquals(P2, p))
&& (pointEquals(b.P1, p) || pointEquals(b.P2, p)))
- return 0;
+ return 0;
subdivideInsert(i.ta);
b.subdivideInsert(i.tb);
@@ -2212,69 +2212,69 @@ public class Area implements Shape, Cloneable
Vector v = new Vector();
for (int i = 0; i < x.length; i++)
{
- Point2D p = x[i].p;
- if (! ((pointEquals(P1, p) || pointEquals(P2, p))
- && (pointEquals(b.P1, p) || pointEquals(b.P2, p))))
- v.add(x[i]);
+ Point2D p = x[i].p;
+ if (! ((pointEquals(P1, p) || pointEquals(P2, p))
+ && (pointEquals(b.P1, p) || pointEquals(b.P2, p))))
+ v.add(x[i]);
}
int nNodes = v.size();
Intersection[] A = new Intersection[nNodes];
Intersection[] B = new Intersection[nNodes];
for (int i = 0; i < nNodes; i++)
- A[i] = B[i] = (Intersection) v.elementAt(i);
+ A[i] = B[i] = (Intersection) v.elementAt(i);
// Create two lists sorted by the parameter
// Bubble sort, OK I suppose, since the number of intersections
// cannot be larger than 9 (cubic-cubic worst case) anyway
for (int i = 0; i < nNodes - 1; i++)
{
- for (int j = i + 1; j < nNodes; j++)
- {
- if (A[i].ta > A[j].ta)
- {
- Intersection swap = A[i];
- A[i] = A[j];
- A[j] = swap;
- }
- if (B[i].tb > B[j].tb)
- {
- Intersection swap = B[i];
- B[i] = B[j];
- B[j] = swap;
- }
- }
+ for (int j = i + 1; j < nNodes; j++)
+ {
+ if (A[i].ta > A[j].ta)
+ {
+ Intersection swap = A[i];
+ A[i] = A[j];
+ A[j] = swap;
+ }
+ if (B[i].tb > B[j].tb)
+ {
+ Intersection swap = B[i];
+ B[i] = B[j];
+ B[j] = swap;
+ }
+ }
}
// subdivide a
Segment s = this;
for (int i = 0; i < nNodes; i++)
{
- s.subdivideInsert(A[i].ta);
+ s.subdivideInsert(A[i].ta);
- // renormalize the parameters
- for (int j = i + 1; j < nNodes; j++)
- A[j].ta = (A[j].ta - A[i].ta) / (1.0 - A[i].ta);
+ // renormalize the parameters
+ for (int j = i + 1; j < nNodes; j++)
+ A[j].ta = (A[j].ta - A[i].ta) / (1.0 - A[i].ta);
- A[i].seg = s;
- s = s.next;
+ A[i].seg = s;
+ s = s.next;
}
// subdivide b, set nodes
s = b;
for (int i = 0; i < nNodes; i++)
{
- s.subdivideInsert(B[i].tb);
+ s.subdivideInsert(B[i].tb);
- for (int j = i + 1; j < nNodes; j++)
- B[j].tb = (B[j].tb - B[i].tb) / (1.0 - B[i].tb);
+ for (int j = i + 1; j < nNodes; j++)
+ B[j].tb = (B[j].tb - B[i].tb) / (1.0 - B[i].tb);
- // set nodes
- B[i].seg.node = s.next; // node a -> b
- s.node = B[i].seg.next; // node b -> a
+ // set nodes
+ B[i].seg.node = s.next; // node a -> b
+ s.node = B[i].seg.next; // node b -> a
- // snap points
- B[i].seg.P2 = B[i].seg.next.P1 = s.P2 = s.next.P1 = B[i].p;
- s = s.next;
+ // snap points
+ B[i].seg.P2 = B[i].seg.next.P1 = s.P2 = s.next.P1 = B[i].p;
+ s = s.next;
}
return nNodes;
}
@@ -2286,7 +2286,7 @@ public class Area implements Shape, Cloneable
boolean pathEquals(Segment B)
{
if (! getPathBounds().equals(B.getPathBounds()))
- return false;
+ return false;
Segment startA = getTopLeft();
Segment startB = B.getTopLeft();
@@ -2294,16 +2294,16 @@ public class Area implements Shape, Cloneable
Segment b = startB;
do
{
- if (! a.equals(b))
- return false;
+ if (! a.equals(b))
+ return false;
- if (a instanceof LineSegment)
- a = ((LineSegment) a).lastCoLinear();
- if (b instanceof LineSegment)
- b = ((LineSegment) b).lastCoLinear();
+ if (a instanceof LineSegment)
+ a = ((LineSegment) a).lastCoLinear();
+ if (b instanceof LineSegment)
+ b = ((LineSegment) b).lastCoLinear();
- a = a.next;
- b = b.next;
+ a = a.next;
+ b = b.next;
}
while (a != startA && b != startB);
return true;
@@ -2318,14 +2318,14 @@ public class Area implements Shape, Cloneable
Segment tl = this;
do
{
- if (v.P1.getY() < tl.P1.getY())
- tl = v;
- else if (v.P1.getY() == tl.P1.getY())
- {
- if (v.P1.getX() < tl.P1.getX())
- tl = v;
- }
- v = v.next;
+ if (v.P1.getY() < tl.P1.getY())
+ tl = v;
+ else if (v.P1.getY() == tl.P1.getY())
+ {
+ if (v.P1.getX() < tl.P1.getX())
+ tl = v;
+ }
+ v = v.next;
}
while (v != this);
return tl;
@@ -2439,7 +2439,7 @@ public class Area implements Shape, Cloneable
double y4 = b.P2.getY();
if ((y1 - y3) * (x4 - x3) - (x1 - x3) * (y4 - y3) != 0.0)
- return false;
+ return false;
return ((x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3) == 0.0);
}
@@ -2455,13 +2455,13 @@ public class Area implements Shape, Cloneable
while (v instanceof LineSegment)
{
- if (isCoLinear((LineSegment) v))
- {
- prev = v;
- v = v.next;
- }
- else
- return prev;
+ if (isCoLinear((LineSegment) v))
+ {
+ prev = v;
+ v = v.next;
+ }
+ else
+ return prev;
}
return prev;
}
@@ -2474,12 +2474,12 @@ public class Area implements Shape, Cloneable
boolean equals(Segment b)
{
if (! (b instanceof LineSegment))
- return false;
+ return false;
Point2D p1 = P1;
Point2D p3 = b.P1;
if (! p1.equals(p3))
- return false;
+ return false;
Point2D p2 = lastCoLinear().P2;
Point2D p4 = ((LineSegment) b).lastCoLinear().P2;
@@ -2502,13 +2502,13 @@ public class Area implements Shape, Cloneable
boolean hasIntersections(Segment b)
{
if (b instanceof LineSegment)
- return (linesIntersect(this, (LineSegment) b) != null);
+ return (linesIntersect(this, (LineSegment) b) != null);
if (b instanceof QuadSegment)
- return (lineQuadIntersect(this, (QuadSegment) b) != null);
+ return (lineQuadIntersect(this, (QuadSegment) b) != null);
if (b instanceof CubicSegment)
- return (lineCubicIntersect(this, (CubicSegment) b) != null);
+ return (lineCubicIntersect(this, (CubicSegment) b) != null);
return false;
}
@@ -2521,27 +2521,27 @@ public class Area implements Shape, Cloneable
{
if (b instanceof LineSegment)
{
- Intersection i = linesIntersect(this, (LineSegment) b);
+ Intersection i = linesIntersect(this, (LineSegment) b);
- if (i == null)
- return 0;
+ if (i == null)
+ return 0;
- return createNode(b, i);
+ return createNode(b, i);
}
Intersection[] x = null;
if (b instanceof QuadSegment)
- x = lineQuadIntersect(this, (QuadSegment) b);
+ x = lineQuadIntersect(this, (QuadSegment) b);
if (b instanceof CubicSegment)
- x = lineCubicIntersect(this, (CubicSegment) b);
+ x = lineCubicIntersect(this, (CubicSegment) b);
if (x == null)
- return 0;
+ return 0;
if (x.length == 1)
- return createNode(b, (Intersection) x[0]);
+ return createNode(b, (Intersection) x[0]);
return createNodes(b, x);
}
@@ -2569,20 +2569,20 @@ public class Area implements Shape, Cloneable
double y1 = P2.getY() - y;
if (y0 * y1 > 0)
- return 0;
+ return 0;
if (x0 < 0 && x1 < 0)
- return 0;
+ return 0;
if (y0 == 0.0)
- y0 -= EPSILON;
+ y0 -= EPSILON;
if (y1 == 0.0)
- y1 -= EPSILON;
+ y1 -= EPSILON;
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- EPSILON, 0.0, Double.MAX_VALUE, 0.0))
- return 1;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ EPSILON, 0.0, Double.MAX_VALUE, 0.0))
+ return 1;
return 0;
}
} // class LineSegment
@@ -2652,7 +2652,7 @@ public class Area implements Shape, Cloneable
boolean equals(Segment b)
{
if (! (b instanceof QuadSegment))
- return false;
+ return false;
return (P1.equals(b.P1) && cp.equals(((QuadSegment) b).cp)
&& P2.equals(b.P2));
@@ -2700,25 +2700,25 @@ public class Area implements Shape, Cloneable
r1 = 2 * (y2 - 2 * y1 + y0);
if (r1 != 0.0)
{
- double t = -r0 / r1;
- if (t > 0.0 && t < 1.0)
- {
- double y = evaluatePoint(t).getY();
- ymax = Math.max(y, ymax);
- ymin = Math.min(y, ymin);
- }
+ double t = -r0 / r1;
+ if (t > 0.0 && t < 1.0)
+ {
+ double y = evaluatePoint(t).getY();
+ ymax = Math.max(y, ymax);
+ ymin = Math.min(y, ymin);
+ }
}
r0 = 2 * (x1 - x0);
r1 = 2 * (x2 - 2 * x1 + x0);
if (r1 != 0.0)
{
- double t = -r0 / r1;
- if (t > 0.0 && t < 1.0)
- {
- double x = evaluatePoint(t).getY();
- xmax = Math.max(x, xmax);
- xmin = Math.min(x, xmin);
- }
+ double t = -r0 / r1;
+ if (t > 0.0 && t < 1.0)
+ {
+ double x = evaluatePoint(t).getY();
+ xmax = Math.max(x, xmax);
+ xmin = Math.min(x, xmin);
+ }
}
return (new Rectangle2D.Double(xmin, ymin, xmax - xmin, ymax - ymin));
@@ -2785,23 +2785,23 @@ public class Area implements Shape, Cloneable
/* check if curve may intersect X+ axis. */
if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0) && (y0 * y1 <= 0 || y1 * y2 <= 0))
{
- if (y0 == 0.0)
- y0 -= EPSILON;
- if (y2 == 0.0)
- y2 -= EPSILON;
-
- r[0] = y0;
- r[1] = 2 * (y1 - y0);
- r[2] = (y2 - 2 * y1 + y0);
-
- nRoots = QuadCurve2D.solveQuadratic(r);
- for (int i = 0; i < nRoots; i++)
- if (r[i] > 0.0f && r[i] < 1.0f)
- {
- double t = r[i];
- if (t * t * (x2 - 2 * x1 + x0) + 2 * t * (x1 - x0) + x0 > 0.0)
- nCrossings++;
- }
+ if (y0 == 0.0)
+ y0 -= EPSILON;
+ if (y2 == 0.0)
+ y2 -= EPSILON;
+
+ r[0] = y0;
+ r[1] = 2 * (y1 - y0);
+ r[2] = (y2 - 2 * y1 + y0);
+
+ nRoots = QuadCurve2D.solveQuadratic(r);
+ for (int i = 0; i < nRoots; i++)
+ if (r[i] > 0.0f && r[i] < 1.0f)
+ {
+ double t = r[i];
+ if (t * t * (x2 - 2 * x1 + x0) + 2 * t * (x1 - x0) + x0 > 0.0)
+ nCrossings++;
+ }
}
return nCrossings;
}
@@ -2825,27 +2825,27 @@ public class Area implements Shape, Cloneable
int splitIntersections(Segment b)
{
if (b instanceof LineSegment)
- return (b.splitIntersections(this));
+ return (b.splitIntersections(this));
if (b instanceof CubicSegment)
- return (b.splitIntersections(this));
+ return (b.splitIntersections(this));
if (b instanceof QuadSegment)
{
- // Use the cubic-cubic intersection routine for quads as well,
- // Since a quadratic can be exactly described as a cubic, this
- // should not be a problem;
- // The recursion depth will be the same in any case.
- Intersection[] x = cubicCubicIntersect(getCubicSegment(),
- ((QuadSegment) b)
- .getCubicSegment());
- if (x == null)
- return 0;
-
- if (x.length == 1)
- return createNode(b, (Intersection) x[0]);
-
- return createNodes(b, x);
+ // Use the cubic-cubic intersection routine for quads as well,
+ // Since a quadratic can be exactly described as a cubic, this
+ // should not be a problem;
+ // The recursion depth will be the same in any case.
+ Intersection[] x = cubicCubicIntersect(getCubicSegment(),
+ ((QuadSegment) b)
+ .getCubicSegment());
+ if (x == null)
+ return 0;
+
+ if (x.length == 1)
+ return createNode(b, (Intersection) x[0]);
+
+ return createNodes(b, x);
}
return 0;
}
@@ -2959,7 +2959,7 @@ public class Area implements Shape, Cloneable
boolean equals(Segment b)
{
if (! (b instanceof CubicSegment))
- return false;
+ return false;
return (P1.equals(b.P1) && cp1.equals(((CubicSegment) b).cp1)
&& cp2.equals(((CubicSegment) b).cp2) && P2.equals(b.P2));
@@ -3015,13 +3015,13 @@ public class Area implements Shape, Cloneable
int n = QuadCurve2D.solveQuadratic(r);
for (int i = 0; i < n; i++)
{
- double t = r[i];
- if (t > 0 && t < 1.0)
- {
- double y = evaluatePoint(t).getY();
- ymax = Math.max(y, ymax);
- ymin = Math.min(y, ymin);
- }
+ double t = r[i];
+ if (t > 0 && t < 1.0)
+ {
+ double y = evaluatePoint(t).getY();
+ ymax = Math.max(y, ymax);
+ ymin = Math.min(y, ymin);
+ }
}
r[0] = 3 * (x1 - x0);
@@ -3030,13 +3030,13 @@ public class Area implements Shape, Cloneable
n = QuadCurve2D.solveQuadratic(r);
for (int i = 0; i < n; i++)
{
- double t = r[i];
- if (t > 0 && t < 1.0)
- {
- double x = evaluatePoint(t).getX();
- xmax = Math.max(x, xmax);
- xmin = Math.min(x, xmin);
- }
+ double t = r[i];
+ if (t > 0 && t < 1.0)
+ {
+ double x = evaluatePoint(t).getX();
+ xmax = Math.max(x, xmax);
+ xmin = Math.min(x, xmin);
+ }
}
return (new Rectangle2D.Double(xmin, ymin, (xmax - xmin), (ymax - ymin)));
}
@@ -3078,38 +3078,38 @@ public class Area implements Shape, Cloneable
// A qudratic
if (R == 0.0 && T == 0.0)
- return null;
+ return null;
// true cubic
if (R != 0.0 && T != 0.0)
{
- A = 3 * (x2 + x0 - 2 * x1) / R;
- B = 3 * (x1 - x0) / R;
+ A = 3 * (x2 + x0 - 2 * x1) / R;
+ B = 3 * (x1 - x0) / R;
- double P = 3 * (y2 + y0 - 2 * y1) / T;
- double Q = 3 * (y1 - y0) / T;
+ double P = 3 * (y2 + y0 - 2 * y1) / T;
+ double Q = 3 * (y1 - y0) / T;
- if (A == P || Q == B)
- return null;
+ if (A == P || Q == B)
+ return null;
- k = (Q - B) / (A - P);
+ k = (Q - B) / (A - P);
}
else
{
- if (R == 0.0)
- {
- // quadratic in x
- k = -(3 * (x1 - x0)) / (3 * (x2 + x0 - 2 * x1));
- A = 3 * (y2 + y0 - 2 * y1) / T;
- B = 3 * (y1 - y0) / T;
- }
- else
- {
- // quadratic in y
- k = -(3 * (y1 - y0)) / (3 * (y2 + y0 - 2 * y1));
- A = 3 * (x2 + x0 - 2 * x1) / R;
- B = 3 * (x1 - x0) / R;
- }
+ if (R == 0.0)
+ {
+ // quadratic in x
+ k = -(3 * (x1 - x0)) / (3 * (x2 + x0 - 2 * x1));
+ A = 3 * (y2 + y0 - 2 * y1) / T;
+ B = 3 * (y1 - y0) / T;
+ }
+ else
+ {
+ // quadratic in y
+ k = -(3 * (y1 - y0)) / (3 * (y2 + y0 - 2 * y1));
+ A = 3 * (x2 + x0 - 2 * x1) / R;
+ B = 3 * (x1 - x0) / R;
+ }
}
r[0] = -k * k * k - A * k * k - B * k;
@@ -3119,27 +3119,27 @@ public class Area implements Shape, Cloneable
int n = CubicCurve2D.solveCubic(r);
if (n != 3)
- return null;
+ return null;
// sort r
double t;
for (int i = 0; i < 2; i++)
- for (int j = i + 1; j < 3; j++)
- if (r[j] < r[i])
- {
- t = r[i];
- r[i] = r[j];
- r[j] = t;
- }
+ for (int j = i + 1; j < 3; j++)
+ if (r[j] < r[i])
+ {
+ t = r[i];
+ r[i] = r[j];
+ r[j] = t;
+ }
if (Math.abs(r[0] + r[2] - k) < 1E-13)
- if (r[0] >= 0.0 && r[0] <= 1.0 && r[2] >= 0.0 && r[2] <= 1.0)
- if (evaluatePoint(r[0]).distance(evaluatePoint(r[2])) < PE_EPSILON * 10)
- { // we snap the points anyway
- results[0] = r[0];
- results[1] = r[2];
- return (results);
- }
+ if (r[0] >= 0.0 && r[0] <= 1.0 && r[2] >= 0.0 && r[2] <= 1.0)
+ if (evaluatePoint(r[0]).distance(evaluatePoint(r[2])) < PE_EPSILON * 10)
+ { // we snap the points anyway
+ results[0] = r[0];
+ results[1] = r[2];
+ return (results);
+ }
return null;
}
@@ -3195,28 +3195,28 @@ public class Area implements Shape, Cloneable
if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0 || x3 > 0.0)
&& (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
{
- if (y0 == 0.0)
- y0 -= EPSILON;
- if (y3 == 0.0)
- y3 -= EPSILON;
-
- r[0] = y0;
- r[1] = 3 * (y1 - y0);
- r[2] = 3 * (y2 + y0 - 2 * y1);
- r[3] = y3 - 3 * y2 + 3 * y1 - y0;
-
- if ((nRoots = CubicCurve2D.solveCubic(r)) > 0)
- for (int i = 0; i < nRoots; i++)
- {
- if (r[i] > 0.0 && r[i] < 1.0)
- {
- double t = r[i];
- if (-(t * t * t) * (x0 - 3 * x1 + 3 * x2 - x3)
- + 3 * t * t * (x0 - 2 * x1 + x2) + 3 * t * (x1 - x0)
- + x0 > 0.0)
- nCrossings++;
- }
- }
+ if (y0 == 0.0)
+ y0 -= EPSILON;
+ if (y3 == 0.0)
+ y3 -= EPSILON;
+
+ r[0] = y0;
+ r[1] = 3 * (y1 - y0);
+ r[2] = 3 * (y2 + y0 - 2 * y1);
+ r[3] = y3 - 3 * y2 + 3 * y1 - y0;
+
+ if ((nRoots = CubicCurve2D.solveCubic(r)) > 0)
+ for (int i = 0; i < nRoots; i++)
+ {
+ if (r[i] > 0.0 && r[i] < 1.0)
+ {
+ double t = r[i];
+ if (-(t * t * t) * (x0 - 3 * x1 + 3 * x2 - x3)
+ + 3 * t * t * (x0 - 2 * x1 + x2) + 3 * t * (x1 - x0)
+ + x0 > 0.0)
+ nCrossings++;
+ }
+ }
}
return nCrossings;
}
@@ -3241,21 +3241,21 @@ public class Area implements Shape, Cloneable
int splitIntersections(Segment b)
{
if (b instanceof LineSegment)
- return (b.splitIntersections(this));
+ return (b.splitIntersections(this));
Intersection[] x = null;
if (b instanceof QuadSegment)
- x = cubicCubicIntersect(this, ((QuadSegment) b).getCubicSegment());
+ x = cubicCubicIntersect(this, ((QuadSegment) b).getCubicSegment());
if (b instanceof CubicSegment)
- x = cubicCubicIntersect(this, (CubicSegment) b);
+ x = cubicCubicIntersect(this, (CubicSegment) b);
if (x == null)
- return 0;
+ return 0;
if (x.length == 1)
- return createNode(b, x[0]);
+ return createNode(b, x[0]);
return createNodes(b, x);
}
diff --git a/java/awt/geom/CubicCurve2D.java b/java/awt/geom/CubicCurve2D.java
index d0d55984f..5cb11fe77 100644
--- a/java/awt/geom/CubicCurve2D.java
+++ b/java/awt/geom/CubicCurve2D.java
@@ -585,26 +585,26 @@ public abstract class CubicCurve2D implements Shape, Cloneable
if (left != null)
{
- left[leftOff] = left_P1_x;
- left[leftOff + 1] = left_P1_y;
- left[leftOff + 2] = left_C1_x;
- left[leftOff + 3] = left_C1_y;
- left[leftOff + 4] = left_C2_x;
- left[leftOff + 5] = left_C2_y;
- left[leftOff + 6] = Mid_x;
- left[leftOff + 7] = Mid_y;
+ left[leftOff] = left_P1_x;
+ left[leftOff + 1] = left_P1_y;
+ left[leftOff + 2] = left_C1_x;
+ left[leftOff + 3] = left_C1_y;
+ left[leftOff + 4] = left_C2_x;
+ left[leftOff + 5] = left_C2_y;
+ left[leftOff + 6] = Mid_x;
+ left[leftOff + 7] = Mid_y;
}
if (right != null)
{
- right[rightOff] = Mid_x;
- right[rightOff + 1] = Mid_y;
- right[rightOff + 2] = right_C1_x;
- right[rightOff + 3] = right_C1_y;
- right[rightOff + 4] = right_C2_x;
- right[rightOff + 5] = right_C2_y;
- right[rightOff + 6] = right_P2_x;
- right[rightOff + 7] = right_P2_y;
+ right[rightOff] = Mid_x;
+ right[rightOff + 1] = Mid_y;
+ right[rightOff + 2] = right_C1_x;
+ right[rightOff + 3] = right_C1_y;
+ right[rightOff + 4] = right_C2_x;
+ right[rightOff + 5] = right_C2_y;
+ right[rightOff + 6] = right_P2_x;
+ right[rightOff + 7] = right_P2_y;
}
}
@@ -710,7 +710,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
// The Java implementation is very similar to the GSL code, but
// not a strict one-to-one copy. For example, GSL would sort the
// result.
-
+
double a;
double b;
double c;
@@ -749,46 +749,46 @@ public abstract class CubicCurve2D implements Shape, Cloneable
if (R == 0 && Q == 0)
{
- // The GNU Scientific Library would return three identical
- // solutions in this case.
- res[0] = -a / 3;
- return 1;
+ // The GNU Scientific Library would return three identical
+ // solutions in this case.
+ res[0] = -a / 3;
+ return 1;
}
if (CR2 == CQ3)
{
- /* this test is actually R2 == Q3, written in a form suitable
- for exact computation with integers */
- /* Due to finite precision some double roots may be missed, and
- considered to be a pair of complex roots z = x +/- epsilon i
- close to the real axis. */
- double sqrtQ = Math.sqrt(Q);
-
- if (R > 0)
- {
- res[0] = -2 * sqrtQ - a / 3;
- res[1] = sqrtQ - a / 3;
- }
- else
- {
- res[0] = -sqrtQ - a / 3;
- res[1] = 2 * sqrtQ - a / 3;
- }
- return 2;
+ /* this test is actually R2 == Q3, written in a form suitable
+ for exact computation with integers */
+ /* Due to finite precision some double roots may be missed, and
+ considered to be a pair of complex roots z = x +/- epsilon i
+ close to the real axis. */
+ double sqrtQ = Math.sqrt(Q);
+
+ if (R > 0)
+ {
+ res[0] = -2 * sqrtQ - a / 3;
+ res[1] = sqrtQ - a / 3;
+ }
+ else
+ {
+ res[0] = -sqrtQ - a / 3;
+ res[1] = 2 * sqrtQ - a / 3;
+ }
+ return 2;
}
if (CR2 < CQ3) /* equivalent to R2 < Q3 */
{
- double sqrtQ = Math.sqrt(Q);
- double sqrtQ3 = sqrtQ * sqrtQ * sqrtQ;
- double theta = Math.acos(R / sqrtQ3);
- double norm = -2 * sqrtQ;
- res[0] = norm * Math.cos(theta / 3) - a / 3;
- res[1] = norm * Math.cos((theta + 2.0 * Math.PI) / 3) - a / 3;
- res[2] = norm * Math.cos((theta - 2.0 * Math.PI) / 3) - a / 3;
-
- // The GNU Scientific Library sorts the results. We don't.
- return 3;
+ double sqrtQ = Math.sqrt(Q);
+ double sqrtQ3 = sqrtQ * sqrtQ * sqrtQ;
+ double theta = Math.acos(R / sqrtQ3);
+ double norm = -2 * sqrtQ;
+ res[0] = norm * Math.cos(theta / 3) - a / 3;
+ res[1] = norm * Math.cos((theta + 2.0 * Math.PI) / 3) - a / 3;
+ res[2] = norm * Math.cos((theta - 2.0 * Math.PI) / 3) - a / 3;
+
+ // The GNU Scientific Library sorts the results. We don't.
+ return 3;
}
double sgnR = (R >= 0 ? 1 : -1);
@@ -862,7 +862,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
}
/**
- * Determines whether any part of a Rectangle2D is inside the area bounded
+ * Determines whether any part of a Rectangle2D is inside the area bounded
* by the curve and the straight line connecting its end points.
* @see #intersects(double, double, double, double)
*/
@@ -902,7 +902,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
}
/**
- * Determine whether a Rectangle2D is entirely inside the area that is
+ * Determine whether a Rectangle2D is entirely inside the area that is
* bounded by the curve and the straight line connecting its end points.
*
* <p><img src="doc-files/CubicCurve2D-5.png" width="350" height="180"
@@ -930,77 +930,77 @@ public abstract class CubicCurve2D implements Shape, Cloneable
{
return new PathIterator()
{
- /** Current coordinate. */
- private int current = 0;
-
- public int getWindingRule()
- {
- return WIND_NON_ZERO;
- }
-
- public boolean isDone()
- {
- return current >= 2;
- }
-
- public void next()
- {
- current++;
- }
-
- public int currentSegment(float[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = (float) getX1();
- coords[1] = (float) getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = (float) getCtrlX1();
- coords[1] = (float) getCtrlY1();
- coords[2] = (float) getCtrlX2();
- coords[3] = (float) getCtrlY2();
- coords[4] = (float) getX2();
- coords[5] = (float) getY2();
- result = SEG_CUBICTO;
- break;
- default:
- throw new NoSuchElementException("cubic iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 3);
- return result;
- }
-
- public int currentSegment(double[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = getX1();
- coords[1] = getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = getCtrlX1();
- coords[1] = getCtrlY1();
- coords[2] = getCtrlX2();
- coords[3] = getCtrlY2();
- coords[4] = getX2();
- coords[5] = getY2();
- result = SEG_CUBICTO;
- break;
- default:
- throw new NoSuchElementException("cubic iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 3);
- return result;
- }
+ /** Current coordinate. */
+ private int current = 0;
+
+ public int getWindingRule()
+ {
+ return WIND_NON_ZERO;
+ }
+
+ public boolean isDone()
+ {
+ return current >= 2;
+ }
+
+ public void next()
+ {
+ current++;
+ }
+
+ public int currentSegment(float[] coords)
+ {
+ int result;
+ switch (current)
+ {
+ case 0:
+ coords[0] = (float) getX1();
+ coords[1] = (float) getY1();
+ result = SEG_MOVETO;
+ break;
+ case 1:
+ coords[0] = (float) getCtrlX1();
+ coords[1] = (float) getCtrlY1();
+ coords[2] = (float) getCtrlX2();
+ coords[3] = (float) getCtrlY2();
+ coords[4] = (float) getX2();
+ coords[5] = (float) getY2();
+ result = SEG_CUBICTO;
+ break;
+ default:
+ throw new NoSuchElementException("cubic iterator out of bounds");
+ }
+ if (at != null)
+ at.transform(coords, 0, coords, 0, 3);
+ return result;
+ }
+
+ public int currentSegment(double[] coords)
+ {
+ int result;
+ switch (current)
+ {
+ case 0:
+ coords[0] = getX1();
+ coords[1] = getY1();
+ result = SEG_MOVETO;
+ break;
+ case 1:
+ coords[0] = getCtrlX1();
+ coords[1] = getCtrlY1();
+ coords[2] = getCtrlX2();
+ coords[3] = getCtrlY2();
+ coords[4] = getX2();
+ coords[5] = getY2();
+ result = SEG_CUBICTO;
+ break;
+ default:
+ throw new NoSuchElementException("cubic iterator out of bounds");
+ }
+ if (at != null)
+ at.transform(coords, 0, coords, 0, 3);
+ return result;
+ }
};
}
@@ -1018,11 +1018,11 @@ public abstract class CubicCurve2D implements Shape, Cloneable
{
try
{
- return super.clone();
+ return super.clone();
}
catch (CloneNotSupportedException e)
{
- throw (Error) new InternalError().initCause(e); // Impossible
+ throw (Error) new InternalError().initCause(e); // Impossible
}
}
@@ -1042,7 +1042,7 @@ public abstract class CubicCurve2D implements Shape, Cloneable
*
* A special-case not adressed in this code is self-intersections
* of the curve, e.g. if the axis intersects the self-itersection,
- * the degenerate roots of the polynomial will erroneously count as
+ * the degenerate roots of the polynomial will erroneously count as
* a single intersection of the curve, and not two.
*/
private int getAxisIntersections(double x, double y, boolean useYaxis,
@@ -1064,48 +1064,48 @@ public abstract class CubicCurve2D implements Shape, Cloneable
if (useYaxis)
{
- a0 = getY1() - y;
- a1 = getCtrlY1() - y;
- a2 = getCtrlY2() - y;
- a3 = getY2() - y;
- b0 = getX1() - x;
- b1 = getCtrlX1() - x;
- b2 = getCtrlX2() - x;
- b3 = getX2() - x;
+ a0 = getY1() - y;
+ a1 = getCtrlY1() - y;
+ a2 = getCtrlY2() - y;
+ a3 = getY2() - y;
+ b0 = getX1() - x;
+ b1 = getCtrlX1() - x;
+ b2 = getCtrlX2() - x;
+ b3 = getX2() - x;
}
else
{
- a0 = getX1() - x;
- a1 = getCtrlX1() - x;
- a2 = getCtrlX2() - x;
- a3 = getX2() - x;
- b0 = getY1() - y;
- b1 = getCtrlY1() - y;
- b2 = getCtrlY2() - y;
- b3 = getY2() - y;
+ a0 = getX1() - x;
+ a1 = getCtrlX1() - x;
+ a2 = getCtrlX2() - x;
+ a3 = getX2() - x;
+ b0 = getY1() - y;
+ b1 = getCtrlY1() - y;
+ b2 = getCtrlY2() - y;
+ b3 = getY2() - y;
}
- /* If the axis intersects a start/endpoint, shift it up by some small
+ /* If the axis intersects a start/endpoint, shift it up by some small
amount to guarantee the line is 'inside'
If this is not done, bad behaviour may result for points on that axis.*/
if (a0 == 0.0 || a3 == 0.0)
{
- double small = getFlatness() * EPSILON;
- if (a0 == 0.0)
- a0 -= small;
- if (a3 == 0.0)
- a3 -= small;
+ double small = getFlatness() * EPSILON;
+ if (a0 == 0.0)
+ a0 -= small;
+ if (a3 == 0.0)
+ a3 -= small;
}
if (useYaxis)
{
- if (Line2D.linesIntersect(b0, a0, b3, a3, EPSILON, 0.0, distance, 0.0))
- nCrossings++;
+ if (Line2D.linesIntersect(b0, a0, b3, a3, EPSILON, 0.0, distance, 0.0))
+ nCrossings++;
}
else
{
- if (Line2D.linesIntersect(a0, b0, a3, b3, 0.0, EPSILON, 0.0, distance))
- nCrossings++;
+ if (Line2D.linesIntersect(a0, b0, a3, b3, 0.0, EPSILON, 0.0, distance))
+ nCrossings++;
}
r[0] = a0;
@@ -1116,15 +1116,15 @@ public abstract class CubicCurve2D implements Shape, Cloneable
if ((nRoots = solveCubic(r)) != 0)
for (int i = 0; i < nRoots; i++)
{
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- double crossing = -(t * t * t) * (b0 - 3 * b1 + 3 * b2 - b3)
- + 3 * t * t * (b0 - 2 * b1 + b2)
- + 3 * t * (b1 - b0) + b0;
- if (crossing > 0.0 && crossing <= distance)
- nCrossings++;
- }
+ double t = r[i];
+ if (t >= 0.0 && t <= 1.0)
+ {
+ double crossing = -(t * t * t) * (b0 - 3 * b1 + 3 * b2 - b3)
+ + 3 * t * t * (b0 - 2 * b1 + b2)
+ + 3 * t * (b1 - b0) + b0;
+ if (crossing > 0.0 && crossing <= distance)
+ nCrossings++;
+ }
}
return (nCrossings);
diff --git a/java/awt/geom/Ellipse2D.java b/java/awt/geom/Ellipse2D.java
index e8830770f..3bbf2f010 100644
--- a/java/awt/geom/Ellipse2D.java
+++ b/java/awt/geom/Ellipse2D.java
@@ -101,7 +101,7 @@ public abstract class Ellipse2D extends RectangularShape
* Note: An ellipse cannot be represented exactly in PathIterator
* segments, the outline is thefore approximated with cubic
* Bezier segments.
- *
+ *
* @param at an optional transform.
* @return A path iterator.
*/
@@ -242,7 +242,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns <code>true</code> if the ellipse encloses no area, and
* <code>false</code> otherwise.
- *
+ *
* @return A boolean.
*/
public boolean isEmpty()
@@ -368,7 +368,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns <code>true</code> if the ellipse encloses no area, and
* <code>false</code> otherwise.
- *
+ *
* @return A boolean.
*/
public boolean isEmpty()
diff --git a/java/awt/geom/FlatteningPathIterator.java b/java/awt/geom/FlatteningPathIterator.java
index b06e6cc47..629936bf7 100644
--- a/java/awt/geom/FlatteningPathIterator.java
+++ b/java/awt/geom/FlatteningPathIterator.java
@@ -141,8 +141,8 @@ public class FlatteningPathIterator
*/
private int[] recLevel;
-
-
+
+
private final double[] scratch = new double[6];
@@ -387,7 +387,7 @@ public class FlatteningPathIterator
}
srcSegType = srcIter.currentSegment(scratch);
-
+
switch (srcSegType)
{
case PathIterator.SEG_CLOSE:
@@ -493,7 +493,7 @@ public class FlatteningPathIterator
&& (CubicCurve2D.getFlatnessSq(stack, sp) >= flatnessSq))
{
recLevel[stackSize] = recLevel[stackSize - 1] = ++level;
-
+
CubicCurve2D.subdivide(stack, sp, stack, sp - 6, stack, sp);
++stackSize;
sp -= 6;
diff --git a/java/awt/geom/GeneralPath.java b/java/awt/geom/GeneralPath.java
index fa27d1908..99f1905e2 100644
--- a/java/awt/geom/GeneralPath.java
+++ b/java/awt/geom/GeneralPath.java
@@ -61,11 +61,11 @@ import java.awt.Shape;
*
* <p>The NON_ZERO winding rule defines a point as inside a path if:
* The path intersects the ray in an equal number of opposite directions.
- * Point <b>A</b> in the image is outside (one intersection in the
+ * Point <b>A</b> in the image is outside (one intersection in the
* &#x2019;up&#x2019;
- * direction, one in the &#x2019;down&#x2019; direction) Point <b>B</b> in
+ * direction, one in the &#x2019;down&#x2019; direction) Point <b>B</b> in
* the image is inside (one intersection &#x2019;down&#x2019;)
- * Point <b>C</b> in the image is inside (two intersections in the
+ * Point <b>C</b> in the image is inside (two intersections in the
* &#x2019;down&#x2019; direction)
*
* @see Line2D
@@ -135,9 +135,9 @@ public final class GeneralPath implements Shape, Cloneable
/**
* Constructs a GeneralPath with a specific winding rule
* and the default initial capacity (20).
- * @param rule the winding rule ({@link #WIND_NON_ZERO} or
+ * @param rule the winding rule ({@link #WIND_NON_ZERO} or
* {@link #WIND_EVEN_ODD})
- *
+ *
* @throws IllegalArgumentException if <code>rule</code> is not one of the
* listed values.
*/
@@ -150,10 +150,10 @@ public final class GeneralPath implements Shape, Cloneable
* Constructs a GeneralPath with a specific winding rule
* and the initial capacity. The initial capacity should be
* the approximate number of path segments to be used.
- * @param rule the winding rule ({@link #WIND_NON_ZERO} or
+ * @param rule the winding rule ({@link #WIND_NON_ZERO} or
* {@link #WIND_EVEN_ODD})
* @param capacity the inital capacity, in path segments
- *
+ *
* @throws IllegalArgumentException if <code>rule</code> is not one of the
* listed values.
*/
@@ -172,9 +172,9 @@ public final class GeneralPath implements Shape, Cloneable
/**
* Constructs a GeneralPath from an arbitrary shape object.
* The Shapes PathIterator path and winding rule will be used.
- *
+ *
* @param s the shape (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>shape</code> is <code>null</code>.
*/
public GeneralPath(Shape s)
@@ -189,7 +189,7 @@ public final class GeneralPath implements Shape, Cloneable
/**
* Adds a new point to a path.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
*/
@@ -269,13 +269,13 @@ public final class GeneralPath implements Shape, Cloneable
}
/**
- * Appends the segments of a Shape to the path. If <code>connect</code> is
+ * Appends the segments of a Shape to the path. If <code>connect</code> is
* true, the new path segments are connected to the existing one with a line.
* The winding rule of the Shape is ignored.
- *
+ *
* @param s the shape (<code>null</code> not permitted).
* @param connect whether to connect the new shape to the existing path.
- *
+ *
* @throws NullPointerException if <code>s</code> is <code>null</code>.
*/
public void append(Shape s, boolean connect)
@@ -306,42 +306,42 @@ public final class GeneralPath implements Shape, Cloneable
float[] f = new float[6];
while (! iter.isDone())
{
- switch (iter.currentSegment(f))
- {
- case PathIterator.SEG_MOVETO:
- if (! connect || (index == 0))
- {
- moveTo(f[0], f[1]);
- break;
- }
- if ((index >= 1) && (types[index - 1] == PathIterator.SEG_CLOSE)
- && (f[0] == xpoints[index - 1])
- && (f[1] == ypoints[index - 1]))
- break;
-
- // Fall through.
- case PathIterator.SEG_LINETO:
- lineTo(f[0], f[1]);
- break;
- case PathIterator.SEG_QUADTO:
- quadTo(f[0], f[1], f[2], f[3]);
- break;
- case PathIterator.SEG_CUBICTO:
- curveTo(f[0], f[1], f[2], f[3], f[4], f[5]);
- break;
- case PathIterator.SEG_CLOSE:
- closePath();
- break;
- }
-
- connect = false;
- iter.next();
+ switch (iter.currentSegment(f))
+ {
+ case PathIterator.SEG_MOVETO:
+ if (! connect || (index == 0))
+ {
+ moveTo(f[0], f[1]);
+ break;
+ }
+ if ((index >= 1) && (types[index - 1] == PathIterator.SEG_CLOSE)
+ && (f[0] == xpoints[index - 1])
+ && (f[1] == ypoints[index - 1]))
+ break;
+
+ // Fall through.
+ case PathIterator.SEG_LINETO:
+ lineTo(f[0], f[1]);
+ break;
+ case PathIterator.SEG_QUADTO:
+ quadTo(f[0], f[1], f[2], f[3]);
+ break;
+ case PathIterator.SEG_CUBICTO:
+ curveTo(f[0], f[1], f[2], f[3], f[4], f[5]);
+ break;
+ case PathIterator.SEG_CLOSE:
+ closePath();
+ break;
+ }
+
+ connect = false;
+ iter.next();
}
}
/**
* Returns the path&#x2019;s current winding rule.
- *
+ *
* @return {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}.
*/
public int getWindingRule()
@@ -350,11 +350,11 @@ public final class GeneralPath implements Shape, Cloneable
}
/**
- * Sets the path&#x2019;s winding rule, which controls which areas are
- * considered &#x2019;inside&#x2019; or &#x2019;outside&#x2019; the path
- * on drawing. Valid rules are WIND_EVEN_ODD for an even-odd winding rule,
+ * Sets the path&#x2019;s winding rule, which controls which areas are
+ * considered &#x2019;inside&#x2019; or &#x2019;outside&#x2019; the path
+ * on drawing. Valid rules are WIND_EVEN_ODD for an even-odd winding rule,
* or WIND_NON_ZERO for a non-zero winding rule.
- *
+ *
* @param rule the rule ({@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}).
*/
public void setWindingRule(int rule)
@@ -366,7 +366,7 @@ public final class GeneralPath implements Shape, Cloneable
/**
* Returns the current appending point of the path.
- *
+ *
* @return The point.
*/
public Point2D getCurrentPoint()
@@ -387,7 +387,7 @@ public final class GeneralPath implements Shape, Cloneable
/**
* Applies a transform to the path.
- *
+ *
* @param xform the transform (<code>null</code> not permitted).
*/
public void transform(AffineTransform xform)
@@ -398,10 +398,10 @@ public final class GeneralPath implements Shape, Cloneable
xform.getMatrix(m);
for (int i = 0; i < index; i++)
{
- nx = m[0] * xpoints[i] + m[2] * ypoints[i] + m[4];
- ny = m[1] * xpoints[i] + m[3] * ypoints[i] + m[5];
- xpoints[i] = (float) nx;
- ypoints[i] = (float) ny;
+ nx = m[0] * xpoints[i] + m[2] * ypoints[i] + m[4];
+ ny = m[1] * xpoints[i] + m[3] * ypoints[i] + m[5];
+ xpoints[i] = (float) nx;
+ ypoints[i] = (float) ny;
}
}
@@ -437,18 +437,18 @@ public final class GeneralPath implements Shape, Cloneable
if (index > 0)
{
- x1 = x2 = xpoints[0];
- y1 = y2 = ypoints[0];
+ x1 = x2 = xpoints[0];
+ y1 = y2 = ypoints[0];
}
else
x1 = x2 = y1 = y2 = 0.0f;
for (int i = 0; i < index; i++)
{
- x1 = Math.min(xpoints[i], x1);
- y1 = Math.min(ypoints[i], y1);
- x2 = Math.max(xpoints[i], x2);
- y2 = Math.max(ypoints[i], y2);
+ x1 = Math.min(xpoints[i], x1);
+ y1 = Math.min(ypoints[i], y1);
+ x2 = Math.max(xpoints[i], x2);
+ y2 = Math.max(ypoints[i], y2);
}
return (new Rectangle2D.Float(x1, y1, x2 - x1, y2 - y1));
}
@@ -563,11 +563,11 @@ public final class GeneralPath implements Shape, Cloneable
/**
* The number of coordinate values for each segment type.
*/
- private static final int[] NUM_COORDS = {
- /* 0: SEG_MOVETO */ 1,
- /* 1: SEG_LINETO */ 1,
- /* 2: SEG_QUADTO */ 2,
- /* 3: SEG_CUBICTO */ 3,
+ private static final int[] NUM_COORDS = {
+ /* 0: SEG_MOVETO */ 1,
+ /* 1: SEG_LINETO */ 1,
+ /* 2: SEG_QUADTO */ 2,
+ /* 3: SEG_CUBICTO */ 3,
/* 4: SEG_CLOSE */ 0};
/**
@@ -630,9 +630,9 @@ public final class GeneralPath implements Shape, Cloneable
*/
seg = path.types[pos];
if (seg == SEG_CLOSE)
- pos++;
+ pos++;
else
- pos += NUM_COORDS[seg];
+ pos += NUM_COORDS[seg];
}
/**
@@ -647,17 +647,17 @@ public final class GeneralPath implements Shape, Cloneable
numCoords = NUM_COORDS[seg];
if (numCoords > 0)
{
- for (int i = 0; i < numCoords; i++)
- {
- coords[i << 1] = path.xpoints[pos + i];
- coords[(i << 1) + 1] = path.ypoints[pos + i];
- }
-
- if (transform != null)
- transform.transform( /* src */
- coords, /* srcOffset */
- 0, /* dest */ coords, /* destOffset */
- 0, /* numPoints */ numCoords);
+ for (int i = 0; i < numCoords; i++)
+ {
+ coords[i << 1] = path.xpoints[pos + i];
+ coords[(i << 1) + 1] = path.ypoints[pos + i];
+ }
+
+ if (transform != null)
+ transform.transform( /* src */
+ coords, /* srcOffset */
+ 0, /* dest */ coords, /* destOffset */
+ 0, /* numPoints */ numCoords);
}
return seg;
}
@@ -674,16 +674,16 @@ public final class GeneralPath implements Shape, Cloneable
numCoords = NUM_COORDS[seg];
if (numCoords > 0)
{
- for (int i = 0; i < numCoords; i++)
- {
- coords[i << 1] = (double) path.xpoints[pos + i];
- coords[(i << 1) + 1] = (double) path.ypoints[pos + i];
- }
- if (transform != null)
- transform.transform( /* src */
- coords, /* srcOffset */
- 0, /* dest */ coords, /* destOffset */
- 0, /* numPoints */ numCoords);
+ for (int i = 0; i < numCoords; i++)
+ {
+ coords[i << 1] = (double) path.xpoints[pos + i];
+ coords[(i << 1) + 1] = (double) path.ypoints[pos + i];
+ }
+ if (transform != null)
+ transform.transform( /* src */
+ coords, /* srcOffset */
+ 0, /* dest */ coords, /* destOffset */
+ 0, /* numPoints */ numCoords);
}
return seg;
}
@@ -710,7 +710,7 @@ public final class GeneralPath implements Shape, Cloneable
}
/**
- * Creates a new shape of the same run-time type with the same contents
+ * Creates a new shape of the same run-time type with the same contents
* as this one.
*
* @return the clone
@@ -728,7 +728,7 @@ public final class GeneralPath implements Shape, Cloneable
/**
* Helper method - ensure the size of the data arrays,
* otherwise, reallocate new ones twice the size
- *
+ *
* @param size the minimum array size.
*/
private void ensureSize(int size)
@@ -749,7 +749,7 @@ public final class GeneralPath implements Shape, Cloneable
}
/**
- * Helper method - Get the total number of intersections from (x,y) along
+ * Helper method - Get the total number of intersections from (x,y) along
* a given axis, within a given distance.
*/
private int getAxisIntersections(double x, double y, boolean useYaxis,
@@ -763,21 +763,21 @@ public final class GeneralPath implements Shape, Cloneable
*/
private int getWindingNumber(double x, double y)
{
- /* Evaluate the crossings from x,y to infinity on the y axis (arbitrary
- choice). Note that we don't actually use Double.INFINITY, since that's
+ /* Evaluate the crossings from x,y to infinity on the y axis (arbitrary
+ choice). Note that we don't actually use Double.INFINITY, since that's
slower, and may cause problems. */
return (evaluateCrossings(x, y, true, true, BIG_VALUE));
}
/**
- * Helper method - evaluates the number of intersections on an axis from
+ * Helper method - evaluates the number of intersections on an axis from
* the point (x,y) to the point (x,y+distance) or (x+distance,y).
* @param x x coordinate.
* @param y y coordinate.
- * @param neg True if opposite-directed intersections should cancel,
+ * @param neg True if opposite-directed intersections should cancel,
* false to sum all intersections.
* @param useYaxis Use the Y axis, false uses the X axis.
- * @param distance Interval from (x,y) on the selected axis to find
+ * @param distance Interval from (x,y) on the selected axis to find
* intersections.
*/
private int evaluateCrossings(double x, double y, boolean neg,
@@ -808,186 +808,185 @@ public final class GeneralPath implements Shape, Cloneable
return (0);
if (useYaxis)
{
- float[] swap1;
- swap1 = ypoints;
- ypoints = xpoints;
- xpoints = swap1;
- double swap2;
- swap2 = y;
- y = x;
- x = swap2;
+ float[] swap1;
+ swap1 = ypoints;
+ ypoints = xpoints;
+ xpoints = swap1;
+ double swap2;
+ swap2 = y;
+ y = x;
+ x = swap2;
}
/* Get a value which is hopefully small but not insignificant relative
the path. */
epsilon = ypoints[0] * 1E-7;
- if(epsilon == 0)
+ if(epsilon == 0)
epsilon = 1E-7;
pos = 0;
while (pos < index)
{
- switch (types[pos])
- {
- case PathIterator.SEG_MOVETO:
- if (pathStarted) // close old path
- {
- x0 = cx;
- y0 = cy;
- x1 = firstx;
- y1 = firsty;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- epsilon, 0.0, distance, 0.0))
- windingNumber += (y1 < y0) ? 1 : negative;
-
- cx = firstx;
- cy = firsty;
- }
- cx = firstx = xpoints[pos] - (float) x;
- cy = firsty = ypoints[pos++] - (float) y;
- pathStarted = true;
- break;
- case PathIterator.SEG_CLOSE:
- x0 = cx;
- y0 = cy;
- x1 = firstx;
- y1 = firsty;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- epsilon, 0.0, distance, 0.0))
- windingNumber += (y1 < y0) ? 1 : negative;
-
- cx = firstx;
- cy = firsty;
- pos++;
- pathStarted = false;
- break;
- case PathIterator.SEG_LINETO:
- x0 = cx;
- y0 = cy;
- x1 = xpoints[pos] - (float) x;
- y1 = ypoints[pos++] - (float) y;
-
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y1 == 0.0)
- y1 -= epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1,
- epsilon, 0.0, distance, 0.0))
- windingNumber += (y1 < y0) ? 1 : negative;
-
- cx = xpoints[pos - 1] - (float) x;
- cy = ypoints[pos - 1] - (float) y;
- break;
- case PathIterator.SEG_QUADTO:
- x0 = cx;
- y0 = cy;
- x1 = xpoints[pos] - x;
- y1 = ypoints[pos++] - y;
- x2 = xpoints[pos] - x;
- y2 = ypoints[pos++] - y;
-
- /* check if curve may intersect X+ axis. */
- if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0)
- && (y0 * y1 <= 0 || y1 * y2 <= 0))
- {
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y2 == 0.0)
- y2 -= epsilon;
-
- r[0] = y0;
- r[1] = 2 * (y1 - y0);
- r[2] = (y2 - 2 * y1 + y0);
-
- /* degenerate roots (=tangent points) do not
- contribute to the winding number. */
- if ((nRoots = QuadCurve2D.solveQuadratic(r)) == 2)
- for (int i = 0; i < nRoots; i++)
- {
- float t = (float) r[i];
- if (t > 0.0f && t < 1.0f)
- {
- double crossing = t * t * (x2 - 2 * x1 + x0)
- + 2 * t * (x1 - x0) + x0;
- if (crossing >= 0.0 && crossing <= distance)
- windingNumber += (2 * t * (y2 - 2 * y1 + y0)
- + 2 * (y1 - y0) < 0) ? 1 : negative;
- }
- }
- }
-
- cx = xpoints[pos - 1] - (float) x;
- cy = ypoints[pos - 1] - (float) y;
- break;
- case PathIterator.SEG_CUBICTO:
- x0 = cx;
- y0 = cy;
- x1 = xpoints[pos] - x;
- y1 = ypoints[pos++] - y;
- x2 = xpoints[pos] - x;
- y2 = ypoints[pos++] - y;
- x3 = xpoints[pos] - x;
- y3 = ypoints[pos++] - y;
-
- /* check if curve may intersect X+ axis. */
- if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0 || x3 > 0.0)
- && (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
- {
- if (y0 == 0.0)
- y0 -= epsilon;
- if (y3 == 0.0)
- y3 -= epsilon;
-
- r[0] = y0;
- r[1] = 3 * (y1 - y0);
- r[2] = 3 * (y2 + y0 - 2 * y1);
- r[3] = y3 - 3 * y2 + 3 * y1 - y0;
-
- if ((nRoots = CubicCurve2D.solveCubic(r)) != 0)
- for (int i = 0; i < nRoots; i++)
- {
- float t = (float) r[i];
- if (t > 0.0 && t < 1.0)
- {
- double crossing = -(t * t * t) * (x0 - 3 * x1
- + 3 * x2 - x3)
- + 3 * t * t * (x0 - 2 * x1 + x2)
- + 3 * t * (x1 - x0) + x0;
- if (crossing >= 0 && crossing <= distance)
- windingNumber += (3 * t * t * (y3 + 3 * y1
- - 3 * y2 - y0)
- + 6 * t * (y0 - 2 * y1 + y2)
- + 3 * (y1 - y0) < 0) ? 1 : negative;
- }
- }
- }
-
- cx = xpoints[pos - 1] - (float) x;
- cy = ypoints[pos - 1] - (float) y;
- break;
- }
+ switch (types[pos])
+ {
+ case PathIterator.SEG_MOVETO:
+ if (pathStarted) // close old path
+ {
+ x0 = cx;
+ y0 = cy;
+ x1 = firstx;
+ y1 = firsty;
+
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y1 == 0.0)
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
+ windingNumber += (y1 < y0) ? 1 : negative;
+
+ cx = firstx;
+ cy = firsty;
+ }
+ cx = firstx = xpoints[pos] - (float) x;
+ cy = firsty = ypoints[pos++] - (float) y;
+ pathStarted = true;
+ break;
+ case PathIterator.SEG_CLOSE:
+ x0 = cx;
+ y0 = cy;
+ x1 = firstx;
+ y1 = firsty;
+
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y1 == 0.0)
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
+ windingNumber += (y1 < y0) ? 1 : negative;
+
+ cx = firstx;
+ cy = firsty;
+ pos++;
+ pathStarted = false;
+ break;
+ case PathIterator.SEG_LINETO:
+ x0 = cx;
+ y0 = cy;
+ x1 = xpoints[pos] - (float) x;
+ y1 = ypoints[pos++] - (float) y;
+
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y1 == 0.0)
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
+ windingNumber += (y1 < y0) ? 1 : negative;
+
+ cx = xpoints[pos - 1] - (float) x;
+ cy = ypoints[pos - 1] - (float) y;
+ break;
+ case PathIterator.SEG_QUADTO:
+ x0 = cx;
+ y0 = cy;
+ x1 = xpoints[pos] - x;
+ y1 = ypoints[pos++] - y;
+ x2 = xpoints[pos] - x;
+ y2 = ypoints[pos++] - y;
+
+ /* check if curve may intersect X+ axis. */
+ if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0)
+ && (y0 * y1 <= 0 || y1 * y2 <= 0))
+ {
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y2 == 0.0)
+ y2 -= epsilon;
+
+ r[0] = y0;
+ r[1] = 2 * (y1 - y0);
+ r[2] = (y2 - 2 * y1 + y0);
+
+ /* degenerate roots (=tangent points) do not
+ contribute to the winding number. */
+ if ((nRoots = QuadCurve2D.solveQuadratic(r)) == 2)
+ for (int i = 0; i < nRoots; i++)
+ {
+ float t = (float) r[i];
+ if (t > 0.0f && t < 1.0f)
+ {
+ double crossing = t * t * (x2 - 2 * x1 + x0)
+ + 2 * t * (x1 - x0) + x0;
+ if (crossing >= 0.0 && crossing <= distance)
+ windingNumber += (2 * t * (y2 - 2 * y1 + y0)
+ + 2 * (y1 - y0) < 0) ? 1 : negative;
+ }
+ }
+ }
+
+ cx = xpoints[pos - 1] - (float) x;
+ cy = ypoints[pos - 1] - (float) y;
+ break;
+ case PathIterator.SEG_CUBICTO:
+ x0 = cx;
+ y0 = cy;
+ x1 = xpoints[pos] - x;
+ y1 = ypoints[pos++] - y;
+ x2 = xpoints[pos] - x;
+ y2 = ypoints[pos++] - y;
+ x3 = xpoints[pos] - x;
+ y3 = ypoints[pos++] - y;
+
+ /* check if curve may intersect X+ axis. */
+ if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0 || x3 > 0.0)
+ && (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
+ {
+ if (y0 == 0.0)
+ y0 -= epsilon;
+ if (y3 == 0.0)
+ y3 -= epsilon;
+
+ r[0] = y0;
+ r[1] = 3 * (y1 - y0);
+ r[2] = 3 * (y2 + y0 - 2 * y1);
+ r[3] = y3 - 3 * y2 + 3 * y1 - y0;
+
+ if ((nRoots = CubicCurve2D.solveCubic(r)) != 0)
+ for (int i = 0; i < nRoots; i++)
+ {
+ float t = (float) r[i];
+ if (t > 0.0 && t < 1.0)
+ {
+ double crossing = -(t * t * t) * (x0 - 3 * x1
+ + 3 * x2 - x3)
+ + 3 * t * t * (x0 - 2 * x1 + x2)
+ + 3 * t * (x1 - x0) + x0;
+ if (crossing >= 0 && crossing <= distance)
+ windingNumber += (3 * t * t * (y3 + 3 * y1
+ - 3 * y2 - y0)
+ + 6 * t * (y0 - 2 * y1 + y2)
+ + 3 * (y1 - y0) < 0) ? 1 : negative;
+ }
+ }
+ }
+
+ cx = xpoints[pos - 1] - (float) x;
+ cy = ypoints[pos - 1] - (float) y;
+ break;
+ }
}
// swap coordinates back
if (useYaxis)
{
- float[] swap;
- swap = ypoints;
- ypoints = xpoints;
- xpoints = swap;
+ float[] swap;
+ swap = ypoints;
+ ypoints = xpoints;
+ xpoints = swap;
}
return (windingNumber);
}
} // class GeneralPath
-
diff --git a/java/awt/geom/Line2D.java b/java/awt/geom/Line2D.java
index e15e7cfe3..c92aab004 100644
--- a/java/awt/geom/Line2D.java
+++ b/java/awt/geom/Line2D.java
@@ -238,55 +238,55 @@ public abstract class Line2D implements Shape, Cloneable
/**
* Computes twice the (signed) area of the triangle defined by the three
* points. This method is used for intersection testing.
- *
+ *
* @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.
* @param x3 the x-coordinate of the third point.
* @param y3 the y-coordinate of the third point.
- *
+ *
* @return Twice the area.
*/
private static double area2(double x1, double y1,
double x2, double y2,
- double x3, double y3)
+ double x3, double y3)
{
- return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
+ return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1);
}
/**
* Returns <code>true</code> if (x3, y3) lies between (x1, y1) and (x2, y2),
- * and false otherwise, This test assumes that the three points are
+ * and false otherwise, This test assumes that the three points are
* collinear, and is used for intersection testing.
- *
+ *
* @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.
* @param x3 the x-coordinate of the third point.
* @param y3 the y-coordinate of the third point.
- *
+ *
* @return A boolean.
*/
- private static boolean between(double x1, double y1,
- double x2, double y2,
- double x3, double y3)
+ private static boolean between(double x1, double y1,
+ double x2, double y2,
+ double x3, double y3)
{
if (x1 != x2) {
- return (x1 <= x3 && x3 <= x2) || (x1 >= x3 && x3 >= x2);
+ return (x1 <= x3 && x3 <= x2) || (x1 >= x3 && x3 >= x2);
}
else {
- return (y1 <= y3 && y3 <= y2) || (y1 >= y3 && y3 >= y2);
+ return (y1 <= y3 && y3 <= y2) || (y1 >= y3 && y3 >= y2);
}
}
/**
- * Test if the line segment (x1,y1)-&gt;(x2,y2) intersects the line segment
+ * Test if the line segment (x1,y1)-&gt;(x2,y2) intersects the line segment
* (x3,y3)-&gt;(x4,y4).
*
* @param x1 the first x coordinate of the first segment
- * @param y1 the first y coordinate of the first segment
+ * @param y1 the first y coordinate of the first segment
* @param x2 the second x coordinate of the first segment
* @param y2 the second y coordinate of the first segment
* @param x3 the first x coordinate of the second segment
@@ -301,21 +301,21 @@ public abstract class Line2D implements Shape, Cloneable
double x4, double y4)
{
double a1, a2, a3, a4;
-
+
// deal with special cases
- if ((a1 = area2(x1, y1, x2, y2, x3, y3)) == 0.0)
+ if ((a1 = area2(x1, y1, x2, y2, x3, y3)) == 0.0)
{
// check if p3 is between p1 and p2 OR
// p4 is collinear also AND either between p1 and p2 OR at opposite ends
- if (between(x1, y1, x2, y2, x3, y3))
+ if (between(x1, y1, x2, y2, x3, y3))
{
return true;
}
- else
+ else
{
- if (area2(x1, y1, x2, y2, x4, y4) == 0.0)
+ if (area2(x1, y1, x2, y2, x4, y4) == 0.0)
{
- return between(x3, y3, x4, y4, x1, y1)
+ return between(x3, y3, x4, y4, x1, y1)
|| between (x3, y3, x4, y4, x2, y2);
}
else {
@@ -323,13 +323,13 @@ public abstract class Line2D implements Shape, Cloneable
}
}
}
- else if ((a2 = area2(x1, y1, x2, y2, x4, y4)) == 0.0)
+ else if ((a2 = area2(x1, y1, x2, y2, x4, y4)) == 0.0)
{
// check if p4 is between p1 and p2 (we already know p3 is not
// collinear)
return between(x1, y1, x2, y2, x4, y4);
}
-
+
if ((a3 = area2(x3, y3, x4, y4, x1, y1)) == 0.0) {
// check if p1 is between p3 and p4 OR
// p2 is collinear also AND either between p1 and p2 OR at opposite ends
@@ -338,7 +338,7 @@ public abstract class Line2D implements Shape, Cloneable
}
else {
if (area2(x3, y3, x4, y4, x2, y2) == 0.0) {
- return between(x1, y1, x2, y2, x3, y3)
+ return between(x1, y1, x2, y2, x3, y3)
|| between (x1, y1, x2, y2, x4, y4);
}
else {
@@ -353,7 +353,7 @@ public abstract class Line2D implements Shape, Cloneable
}
else { // test for regular intersection
return ((a1 > 0.0) ^ (a2 > 0.0)) && ((a3 > 0.0) ^ (a4 > 0.0));
- }
+ }
}
/**
diff --git a/java/awt/geom/QuadCurve2D.java b/java/awt/geom/QuadCurve2D.java
index d247c79a5..62c829d30 100644
--- a/java/awt/geom/QuadCurve2D.java
+++ b/java/awt/geom/QuadCurve2D.java
@@ -496,14 +496,14 @@ public abstract class QuadCurve2D implements Shape, Cloneable
if (left != null)
{
- left[leftOff] = x1;
- left[leftOff + 1] = y1;
+ left[leftOff] = x1;
+ left[leftOff + 1] = y1;
}
if (right != null)
{
- right[rightOff + 4] = x2;
- right[rightOff + 5] = y2;
+ right[rightOff + 4] = x2;
+ right[rightOff + 5] = y2;
}
x1 = (x1 + xc) / 2;
@@ -515,18 +515,18 @@ public abstract class QuadCurve2D implements Shape, Cloneable
if (left != null)
{
- left[leftOff + 2] = x1;
- left[leftOff + 3] = y1;
- left[leftOff + 4] = xc;
- left[leftOff + 5] = yc;
+ left[leftOff + 2] = x1;
+ left[leftOff + 3] = y1;
+ left[leftOff + 4] = xc;
+ left[leftOff + 5] = yc;
}
if (right != null)
{
- right[rightOff] = xc;
- right[rightOff + 1] = yc;
- right[rightOff + 2] = x2;
- right[rightOff + 3] = y2;
+ right[rightOff] = xc;
+ right[rightOff + 1] = yc;
+ right[rightOff + 2] = x2;
+ right[rightOff + 3] = y2;
}
}
@@ -643,11 +643,11 @@ public abstract class QuadCurve2D implements Shape, Cloneable
// for linear functions.
if (a == 0)
{
- if (b == 0)
- return -1;
+ if (b == 0)
+ return -1;
- res[0] = -c / b;
- return 1;
+ res[0] = -c / b;
+ return 1;
}
disc = b * b - 4 * a * c;
@@ -657,32 +657,32 @@ public abstract class QuadCurve2D implements Shape, Cloneable
if (disc == 0)
{
- // The GNU Scientific Library returns two identical results here.
- // We just return one.
- res[0] = -0.5 * b / a;
- return 1;
+ // The GNU Scientific Library returns two identical results here.
+ // We just return one.
+ res[0] = -0.5 * b / a;
+ return 1;
}
// disc > 0
if (b == 0)
{
- double r;
+ double r;
- r = Math.abs(0.5 * Math.sqrt(disc) / a);
- res[0] = -r;
- res[1] = r;
+ r = Math.abs(0.5 * Math.sqrt(disc) / a);
+ res[0] = -r;
+ res[1] = r;
}
else
{
- double sgnb;
- double temp;
+ double sgnb;
+ double temp;
- sgnb = (b > 0 ? 1 : -1);
- temp = -0.5 * (b + sgnb * Math.sqrt(disc));
+ sgnb = (b > 0 ? 1 : -1);
+ temp = -0.5 * (b + sgnb * Math.sqrt(disc));
- // The GNU Scientific Library sorts the result here. We don't.
- res[0] = temp / a;
- res[1] = c / temp;
+ // The GNU Scientific Library sorts the result here. We don't.
+ res[0] = temp / a;
+ res[1] = c / temp;
}
return 2;
}
@@ -750,7 +750,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable
}
/**
- * Determines whether any part of a Rectangle2D is inside the area bounded
+ * Determines whether any part of a Rectangle2D is inside the area bounded
* by the curve and the straight line connecting its end points.
* @see #intersects(double, double, double, double)
*/
@@ -790,7 +790,7 @@ public abstract class QuadCurve2D implements Shape, Cloneable
}
/**
- * Determines whether a Rectangle2D is entirely inside the area that is
+ * Determines whether a Rectangle2D is entirely inside the area that is
* bounded by the curve and the straight line connecting its end points.
* @see #contains(double, double, double, double)
*/
@@ -818,73 +818,73 @@ public abstract class QuadCurve2D implements Shape, Cloneable
{
return new PathIterator()
{
- /** Current coordinate. */
- private int current = 0;
-
- public int getWindingRule()
- {
- return WIND_NON_ZERO;
- }
-
- public boolean isDone()
- {
- return current >= 2;
- }
-
- public void next()
- {
- current++;
- }
-
- public int currentSegment(float[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = (float) getX1();
- coords[1] = (float) getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = (float) getCtrlX();
- coords[1] = (float) getCtrlY();
- coords[2] = (float) getX2();
- coords[3] = (float) getY2();
- result = SEG_QUADTO;
- break;
- default:
- throw new NoSuchElementException("quad iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 2);
- return result;
- }
-
- public int currentSegment(double[] coords)
- {
- int result;
- switch (current)
- {
- case 0:
- coords[0] = getX1();
- coords[1] = getY1();
- result = SEG_MOVETO;
- break;
- case 1:
- coords[0] = getCtrlX();
- coords[1] = getCtrlY();
- coords[2] = getX2();
- coords[3] = getY2();
- result = SEG_QUADTO;
- break;
- default:
- throw new NoSuchElementException("quad iterator out of bounds");
- }
- if (at != null)
- at.transform(coords, 0, coords, 0, 2);
- return result;
- }
+ /** Current coordinate. */
+ private int current = 0;
+
+ public int getWindingRule()
+ {
+ return WIND_NON_ZERO;
+ }
+
+ public boolean isDone()
+ {
+ return current >= 2;
+ }
+
+ public void next()
+ {
+ current++;
+ }
+
+ public int currentSegment(float[] coords)
+ {
+ int result;
+ switch (current)
+ {
+ case 0:
+ coords[0] = (float) getX1();
+ coords[1] = (float) getY1();
+ result = SEG_MOVETO;
+ break;
+ case 1:
+ coords[0] = (float) getCtrlX();
+ coords[1] = (float) getCtrlY();
+ coords[2] = (float) getX2();
+ coords[3] = (float) getY2();
+ result = SEG_QUADTO;
+ break;
+ default:
+ throw new NoSuchElementException("quad iterator out of bounds");
+ }
+ if (at != null)
+ at.transform(coords, 0, coords, 0, 2);
+ return result;
+ }
+
+ public int currentSegment(double[] coords)
+ {
+ int result;
+ switch (current)
+ {
+ case 0:
+ coords[0] = getX1();
+ coords[1] = getY1();
+ result = SEG_MOVETO;
+ break;
+ case 1:
+ coords[0] = getCtrlX();
+ coords[1] = getCtrlY();
+ coords[2] = getX2();
+ coords[3] = getY2();
+ result = SEG_QUADTO;
+ break;
+ default:
+ throw new NoSuchElementException("quad iterator out of bounds");
+ }
+ if (at != null)
+ at.transform(coords, 0, coords, 0, 2);
+ return result;
+ }
};
}
@@ -902,11 +902,11 @@ public abstract class QuadCurve2D implements Shape, Cloneable
{
try
{
- return super.clone();
+ return super.clone();
}
catch (CloneNotSupportedException e)
{
- throw (Error) new InternalError().initCause(e); // Impossible
+ throw (Error) new InternalError().initCause(e); // Impossible
}
}
@@ -940,34 +940,34 @@ public abstract class QuadCurve2D implements Shape, Cloneable
if (useYaxis)
{
- a0 = getY1() - y;
- a1 = getCtrlY() - y;
- a2 = getY2() - y;
- b0 = getX1() - x;
- b1 = getCtrlX() - x;
- b2 = getX2() - x;
+ a0 = getY1() - y;
+ a1 = getCtrlY() - y;
+ a2 = getY2() - y;
+ b0 = getX1() - x;
+ b1 = getCtrlX() - x;
+ b2 = getX2() - x;
}
else
{
- a0 = getX1() - x;
- a1 = getCtrlX() - x;
- a2 = getX2() - x;
- b0 = getY1() - y;
- b1 = getCtrlY() - y;
- b2 = getY2() - y;
+ a0 = getX1() - x;
+ a1 = getCtrlX() - x;
+ a2 = getX2() - x;
+ b0 = getY1() - y;
+ b1 = getCtrlY() - y;
+ b2 = getY2() - y;
}
- /* If the axis intersects a start/endpoint, shift it up by some small
+ /* If the axis intersects a start/endpoint, shift it up by some small
amount to guarantee the line is 'inside'
If this is not done,bad behaviour may result for points on that axis. */
if (a0 == 0.0 || a2 == 0.0)
{
- double small = getFlatness() * EPSILON;
- if (a0 == 0.0)
- a0 -= small;
+ double small = getFlatness() * EPSILON;
+ if (a0 == 0.0)
+ a0 -= small;
- if (a2 == 0.0)
- a2 -= small;
+ if (a2 == 0.0)
+ a2 -= small;
}
r[0] = a0;
@@ -977,26 +977,26 @@ public abstract class QuadCurve2D implements Shape, Cloneable
nRoots = solveQuadratic(r);
for (int i = 0; i < nRoots; i++)
{
- double t = r[i];
- if (t >= 0.0 && t <= 1.0)
- {
- double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0)
- + b0;
- /* single root is always doubly degenerate in quads */
- if (crossing > 0 && crossing < distance)
- nCrossings += (nRoots == 1) ? 2 : 1;
- }
+ double t = r[i];
+ if (t >= 0.0 && t <= 1.0)
+ {
+ double crossing = t * t * (b2 - 2 * b1 + b0) + 2 * t * (b1 - b0)
+ + b0;
+ /* single root is always doubly degenerate in quads */
+ if (crossing > 0 && crossing < distance)
+ nCrossings += (nRoots == 1) ? 2 : 1;
+ }
}
if (useYaxis)
{
- if (Line2D.linesIntersect(b0, a0, b2, a2, EPSILON, 0.0, distance, 0.0))
- nCrossings++;
+ if (Line2D.linesIntersect(b0, a0, b2, a2, EPSILON, 0.0, distance, 0.0))
+ nCrossings++;
}
else
{
- if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, EPSILON, 0.0, distance))
- nCrossings++;
+ if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, EPSILON, 0.0, distance))
+ nCrossings++;
}
return (nCrossings);
diff --git a/java/awt/geom/RectangularShape.java b/java/awt/geom/RectangularShape.java
index 3ee161541..68bc451cc 100644
--- a/java/awt/geom/RectangularShape.java
+++ b/java/awt/geom/RectangularShape.java
@@ -228,15 +228,15 @@ public abstract class RectangularShape implements Shape, Cloneable
{
if (x1 > x2)
{
- double t = x2;
- x2 = x1;
- x1 = t;
+ double t = x2;
+ x2 = x1;
+ x1 = t;
}
if (y1 > y2)
{
- double t = y2;
- y2 = y1;
- y1 = t;
+ double t = y2;
+ y2 = y1;
+ y1 = t;
}
setFrame(x1, y1, x2 - x1, y2 - y1);
}
diff --git a/java/awt/geom/RoundRectangle2D.java b/java/awt/geom/RoundRectangle2D.java
index ac4d89fff..19a7b4237 100644
--- a/java/awt/geom/RoundRectangle2D.java
+++ b/java/awt/geom/RoundRectangle2D.java
@@ -45,29 +45,29 @@ package java.awt.geom;
*/
public abstract class RoundRectangle2D extends RectangularShape
{
- /**
+ /**
* Return the arc height of this round rectangle. The arc height and width
* control the roundness of the corners of the rectangle.
- *
+ *
* @return The arc height.
- *
+ *
* @see #getArcWidth()
*/
public abstract double getArcHeight();
- /**
+ /**
* Return the arc width of this round rectangle. The arc width and height
* control the roundness of the corners of the rectangle.
- *
+ *
* @return The arc width.
- *
+ *
* @see #getArcHeight()
*/
public abstract double getArcWidth();
- /**
+ /**
* Set the values of this round rectangle.
- *
+ *
* @param x The x coordinate
* @param y The y coordinate
* @param w The width
@@ -78,7 +78,7 @@ public abstract class RoundRectangle2D extends RectangularShape
public abstract void setRoundRect(double x, double y, double w, double h,
double arcWidth, double arcHeight);
- /**
+ /**
* Create a RoundRectangle2D. This is protected because this class
* is abstract and cannot be instantiated.
*/
@@ -86,7 +86,7 @@ public abstract class RoundRectangle2D extends RectangularShape
{
}
- /**
+ /**
* Return true if this object contains the specified point.
* @param x The x coordinate
* @param y The y coordinate
@@ -123,7 +123,7 @@ public abstract class RoundRectangle2D extends RectangularShape
return dx * dx + dy * dy <= 1.0;
}
- /**
+ /**
* Return true if this object contains the specified rectangle
* @param x The x coordinate
* @param y The y coordinate
@@ -138,32 +138,32 @@ public abstract class RoundRectangle2D extends RectangularShape
&& contains(x + w, y));
}
- /**
+ /**
* Return a new path iterator which iterates over this rectangle.
- *
+ *
* @param at An affine transform to apply to the object
*/
- public PathIterator getPathIterator(final AffineTransform at)
+ public PathIterator getPathIterator(final AffineTransform at)
{
double arcW = Math.min(getArcWidth(), getWidth());
double arcH = Math.min(getArcHeight(), getHeight());
-
+
// check for special cases...
if (arcW <= 0 || arcH <= 0)
{
- Rectangle2D r = new Rectangle2D.Double(getX(), getY(), getWidth(),
+ Rectangle2D r = new Rectangle2D.Double(getX(), getY(), getWidth(),
getHeight());
return r.getPathIterator(at);
}
- else if (arcW >= getWidth() && arcH >= getHeight())
+ else if (arcW >= getWidth() && arcH >= getHeight())
{
- Ellipse2D e = new Ellipse2D.Double(getX(), getY(), getWidth(),
+ Ellipse2D e = new Ellipse2D.Double(getX(), getY(), getWidth(),
getHeight());
return e.getPathIterator(at);
}
-
+
// otherwise return the standard case...
- return new PathIterator()
+ return new PathIterator()
{
double x = getX();
double y = getY();
@@ -175,7 +175,7 @@ public abstract class RoundRectangle2D extends RectangularShape
PathIterator corner;
int step = -1;
- public int currentSegment(double[] coords)
+ public int currentSegment(double[] coords)
{
if (corner != null) // steps 1, 3, 5 and 7
{
@@ -184,7 +184,7 @@ public abstract class RoundRectangle2D extends RectangularShape
r = SEG_LINETO;
return r;
}
- if (step == -1)
+ if (step == -1)
{
// move to the start position
coords[0] = x + w - arcW / 2;
@@ -196,7 +196,7 @@ public abstract class RoundRectangle2D extends RectangularShape
coords[0] = x + arcW / 2;
coords[1] = y;
}
- else if (step == 2)
+ else if (step == 2)
{
// left line
coords[0] = x;
@@ -227,7 +227,7 @@ public abstract class RoundRectangle2D extends RectangularShape
r = SEG_LINETO;
return r;
}
- if (step == -1)
+ if (step == -1)
{
// move to the start position
coords[0] = (float) (x + w - arcW / 2);
@@ -239,7 +239,7 @@ public abstract class RoundRectangle2D extends RectangularShape
coords[0] = (float) (x + arcW / 2);
coords[1] = (float) y;
}
- else if (step == 2)
+ else if (step == 2)
{
// left line
coords[0] = (float) x;
@@ -270,7 +270,7 @@ public abstract class RoundRectangle2D extends RectangularShape
return step >= 8;
}
- public void next()
+ public void next()
{
if (corner != null)
{
@@ -284,7 +284,7 @@ public abstract class RoundRectangle2D extends RectangularShape
else
{
step++;
- if (step == 1)
+ if (step == 1)
{
// create top left corner
arc.setArc(x, y, arcW, arcH, 90, 90, Arc2D.OPEN);
@@ -292,21 +292,21 @@ public abstract class RoundRectangle2D extends RectangularShape
}
else if (step == 3)
{
- // create bottom left corner
- arc.setArc(x, y + h - arcH, arcW, arcH, 180, 90,
+ // create bottom left corner
+ arc.setArc(x, y + h - arcH, arcW, arcH, 180, 90,
Arc2D.OPEN);
corner = arc.getPathIterator(at);
}
else if (step == 5)
{
- // create bottom right corner
+ // create bottom right corner
arc.setArc(x + w - arcW, y + h - arcH, arcW, arcH, 270, 90,
Arc2D.OPEN);
corner = arc.getPathIterator(at);
}
else if (step == 7)
{
- // create top right corner
+ // create top right corner
arc.setArc(x + w - arcW, y, arcW, arcH, 0, 90, Arc2D.OPEN);
corner = arc.getPathIterator(at);
}
@@ -315,7 +315,7 @@ public abstract class RoundRectangle2D extends RectangularShape
};
}
- /**
+ /**
* Return true if the given rectangle intersects this shape.
* @param x The x coordinate
* @param y The y coordinate
@@ -329,7 +329,7 @@ public abstract class RoundRectangle2D extends RectangularShape
|| contains(x + w, y));
}
- /**
+ /**
* Set the boundary of this round rectangle.
* @param x The x coordinate
* @param y The y coordinate
@@ -342,7 +342,7 @@ public abstract class RoundRectangle2D extends RectangularShape
setRoundRect(x, y, w, h, getArcWidth(), getArcHeight());
}
- /**
+ /**
* Set the values of this round rectangle to be the same as those
* of the argument.
* @param rr The round rectangle to copy
@@ -353,9 +353,9 @@ public abstract class RoundRectangle2D extends RectangularShape
rr.getArcWidth(), rr.getArcHeight());
}
- /**
+ /**
* A subclass of RoundRectangle which keeps its parameters as
- * doubles.
+ * doubles.
*/
public static class Double extends RoundRectangle2D
{
@@ -377,14 +377,14 @@ public abstract class RoundRectangle2D extends RectangularShape
/** The height of this object. */
public double height;
- /**
- * Construct a new instance, with all parameters set to 0.
+ /**
+ * Construct a new instance, with all parameters set to 0.
*/
public Double()
{
}
- /**
+ /**
* Construct a new instance with the given arguments.
* @param x The x coordinate
* @param y The y coordinate
@@ -456,9 +456,9 @@ public abstract class RoundRectangle2D extends RectangularShape
}
} // class Double
- /**
+ /**
* A subclass of RoundRectangle which keeps its parameters as
- * floats.
+ * floats.
*/
public static class Float extends RoundRectangle2D
{
@@ -480,14 +480,14 @@ public abstract class RoundRectangle2D extends RectangularShape
/** The height of this object. */
public float height;
- /**
- * Construct a new instance, with all parameters set to 0.
+ /**
+ * Construct a new instance, with all parameters set to 0.
*/
public Float()
{
}
- /**
+ /**
* Construct a new instance with the given arguments.
* @param x The x coordinate
* @param y The y coordinate
@@ -549,14 +549,14 @@ public abstract class RoundRectangle2D extends RectangularShape
/**
* Sets the dimensions for this rounded rectangle.
- *
+ *
* @param x the x-coordinate of the top left corner.
* @param y the y-coordinate of the top left corner.
* @param w the width of the rectangle.
* @param h the height of the rectangle.
* @param arcWidth the arc width.
* @param arcHeight the arc height.
- *
+ *
* @see #setRoundRect(double, double, double, double, double, double)
*/
public void setRoundRect(float x, float y, float w, float h,
diff --git a/java/awt/im/InputContext.java b/java/awt/im/InputContext.java
index c2e09b6d1..8667272b8 100644
--- a/java/awt/im/InputContext.java
+++ b/java/awt/im/InputContext.java
@@ -146,7 +146,7 @@ public class InputContext
private InputMethod im;
/** Map of locales to the most recently selected input method. */
- private final HashMap<Locale,InputMethod> recent
+ private final HashMap<Locale,InputMethod> recent
= new HashMap<Locale,InputMethod>();
/** The list of acceptable character subsets. */
@@ -427,7 +427,7 @@ public class InputContext
* method. Clients have to compare the result against known input method
* control object types. If no input methods are available or the current
* input method does not provide an input method control object, then null
- * is returned.
+ * is returned.
*
* @return the control object, or null
*/
diff --git a/java/awt/im/spi/InputMethodDescriptor.java b/java/awt/im/spi/InputMethodDescriptor.java
index d234e5c57..ce40ab2b6 100644
--- a/java/awt/im/spi/InputMethodDescriptor.java
+++ b/java/awt/im/spi/InputMethodDescriptor.java
@@ -111,4 +111,3 @@ public interface InputMethodDescriptor
InputMethod createInputMethod() throws Exception;
} // interface InputMethodDescriptor
-
diff --git a/java/awt/image/AffineTransformOp.java b/java/awt/image/AffineTransformOp.java
index df9db7d96..460804f90 100644
--- a/java/awt/image/AffineTransformOp.java
+++ b/java/awt/image/AffineTransformOp.java
@@ -1,4 +1,4 @@
-/* AffineTransformOp.java -- This class performs affine
+/* AffineTransformOp.java -- This class performs affine
transformation between two images or rasters in 2 dimensions.
Copyright (C) 2004, 2006 Free Software Foundation
@@ -51,19 +51,19 @@ import java.util.Arrays;
/**
* AffineTransformOp performs matrix-based transformations (translations,
* scales, flips, rotations, and shears).
- *
+ *
* If interpolation is required, nearest neighbour, bilinear, and bicubic
* methods are available.
*
- * @author Olga Rodimina (rodimina@redhat.com)
+ * @author Olga Rodimina (rodimina@redhat.com)
* @author Francis Kung (fkung@redhat.com)
*/
public class AffineTransformOp implements BufferedImageOp, RasterOp
{
public static final int TYPE_NEAREST_NEIGHBOR = 1;
-
+
public static final int TYPE_BILINEAR = 2;
-
+
/**
* @since 1.5.0
*/
@@ -71,13 +71,13 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
private AffineTransform transform;
private RenderingHints hints;
-
+
/**
* Construct AffineTransformOp with the given xform and interpolationType.
* Interpolation type can be TYPE_BILINEAR, TYPE_BICUBIC or
* TYPE_NEAREST_NEIGHBOR.
*
- * @param xform AffineTransform that will applied to the source image
+ * @param xform AffineTransform that will applied to the source image
* @param interpolationType type of interpolation used
* @throws ImagingOpException if the transform matrix is noninvertible
*/
@@ -90,12 +90,12 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
switch (interpolationType)
{
case TYPE_BILINEAR:
- hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
+ hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
break;
case TYPE_BICUBIC:
- hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
- RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
+ RenderingHints.VALUE_INTERPOLATION_BICUBIC);
break;
default:
hints = new RenderingHints (RenderingHints.KEY_INTERPOLATION,
@@ -105,7 +105,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
/**
* Construct AffineTransformOp with the given xform and rendering hints.
- *
+ *
* @param xform AffineTransform that will applied to the source image
* @param hints rendering hints that will be used during transformation
* @throws ImagingOpException if the transform matrix is noninvertible
@@ -119,9 +119,9 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
}
/**
- * Creates a new BufferedImage with the size equal to that of the
- * transformed image and the correct number of bands. The newly created
- * image is created with the specified ColorModel.
+ * Creates a new BufferedImage with the size equal to that of the
+ * transformed image and the correct number of bands. The newly created
+ * image is created with the specified ColorModel.
* If a ColorModel is not specified, an appropriate ColorModel is used.
*
* @param src the source image.
@@ -149,7 +149,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
}
/**
- * Creates a new WritableRaster with the size equal to the transformed
+ * Creates a new WritableRaster with the size equal to the transformed
* source raster and correct number of bands .
*
* @param src the source raster.
@@ -159,18 +159,18 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
public WritableRaster createCompatibleDestRaster (Raster src)
{
Rectangle2D rect = getBounds2D(src);
-
- if (rect.getWidth() == 0 || rect.getHeight() == 0)
+
+ if (rect.getWidth() == 0 || rect.getHeight() == 0)
throw new RasterFormatException("width or height is 0");
- return src.createCompatibleWritableRaster((int) rect.getWidth(),
+ return src.createCompatibleWritableRaster((int) rect.getWidth(),
(int) rect.getHeight());
}
/**
* Transforms source image using transform specified at the constructor.
* The resulting transformed image is stored in the destination image if one
- * is provided; otherwise a new BufferedImage is created and returned.
+ * is provided; otherwise a new BufferedImage is created and returned.
*
* @param src source image
* @param dst destination image
@@ -218,7 +218,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
if (src.getNumBands() != dst.getNumBands())
throw new IllegalArgumentException("src and dst must have same number"
+ " of bands");
-
+
// Optimization for rasters that can be represented in the RGB colormodel:
// wrap the rasters in images, and let Cairo do the transformation
if (ColorModel.getRGBdefault().isCompatibleSampleModel(src.getSampleModel())
@@ -232,7 +232,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
src2, false, null);
BufferedImage iDst = new BufferedImage(ColorModel.getRGBdefault(), dst,
false, null);
-
+
return filter(iSrc, iDst).getRaster();
}
@@ -256,7 +256,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
// Use an inverse transform to map each point in the destination to
// a point in the source. Note that, while all points in the destination
// matrix are integers, this is not necessarily true for points in the
- // source (hence why interpolation is required)
+ // source (hence why interpolation is required)
try
{
AffineTransform inverseTx = transform.createInverse();
@@ -271,18 +271,18 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
// Different interpolation methods...
if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR))
filterNearest(src, dst, dstPts, srcPts);
-
+
else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
filterBilinear(src, dst, dstPts, srcPts);
-
+
else // bicubic
filterBicubic(src, dst, dstPts, srcPts);
- return dst;
+ return dst;
}
/**
- * Transforms source image using transform specified at the constructor and
+ * Transforms source image using transform specified at the constructor and
* returns bounds of the transformed image.
*
* @param src image to be transformed
@@ -292,7 +292,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
{
return getBounds2D (src.getRaster());
}
-
+
/**
* Returns bounds of the transformed raster.
*
@@ -313,18 +313,18 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
{
if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BILINEAR))
return TYPE_BILINEAR;
-
+
else if (hints.containsValue(RenderingHints.VALUE_INTERPOLATION_BICUBIC))
return TYPE_BICUBIC;
-
- else
+
+ else
return TYPE_NEAREST_NEIGHBOR;
}
- /**
- * Returns location of the transformed source point. The resulting point
+ /**
+ * Returns location of the transformed source point. The resulting point
* is stored in the dstPt if one is specified.
- *
+ *
* @param srcPt point to be transformed
* @param dstPt destination point
* @return the location of the transformed source point.
@@ -354,10 +354,10 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
{
return transform;
}
-
+
/**
* Perform nearest-neighbour filtering
- *
+ *
* @param src the source raster
* @param dst the destination raster
* @param dpts array of points on the destination raster
@@ -367,14 +367,14 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
double[] pts)
{
Rectangle srcbounds = src.getBounds();
-
+
// For all points on the destination raster, copy the value from the
// corrosponding (rounded) source point
for (int i = 0; i < dpts.length; i += 2)
{
int srcX = (int) Math.round(pts[i]) + src.getMinX();
int srcY = (int) Math.round(pts[i + 1]) + src.getMinY();
-
+
if (srcbounds.contains(srcX, srcY))
dst.setDataElements((int) dpts[i] + dst.getMinX(),
(int) dpts[i + 1] + dst.getMinY(),
@@ -384,7 +384,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
/**
* Perform bilinear filtering
- *
+ *
* @param src the source raster
* @param dst the destination raster
* @param dpts array of points on the destination raster
@@ -394,26 +394,26 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
double[] pts)
{
Rectangle srcbounds = src.getBounds();
-
+
Object xyarr = null;
Object xp1arr = null;
Object yp1arr = null;
Object xyp1arr = null;
-
+
double xy;
double xp1;
double yp1;
double xyp1;
double[] result = new double[src.getNumBands()];
-
+
// For all points in the destination raster, use bilinear interpolation
// to find the value from the corrosponding source points
for (int i = 0; i < dpts.length; i += 2)
{
int srcX = (int) Math.round(pts[i]) + src.getMinX();
int srcY = (int) Math.round(pts[i + 1]) + src.getMinY();
-
+
if (srcbounds.contains(srcX, srcY))
{
// Corner case at the bottom or right edge; use nearest neighbour
@@ -422,7 +422,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
dst.setDataElements((int) dpts[i] + dst.getMinX(),
(int) dpts[i + 1] + dst.getMinY(),
src.getDataElements(srcX, srcY, null));
-
+
// Standard case, apply the bilinear formula
else
{
@@ -448,11 +448,11 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
yp1arr = src.getPixel(x, y+1, (int[])yp1arr);
xyp1arr = src.getPixel(x+1, y+1, (int[])xyp1arr);
}
- // using
+ // using
// array[] pixels = src.getPixels(x, y, 2, 2, pixels);
// instead of doing four individual src.getPixel() calls
// should be faster, but benchmarking shows that it's not...
-
+
// Run interpolation for each band
for (int j = 0; j < src.getNumBands(); j++)
{
@@ -472,16 +472,16 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
yp1 = ((int[])yp1arr)[j];
xyp1 = ((int[])xyp1arr)[j];
}
-
- // If all four samples are identical, there's no need to
+
+ // If all four samples are identical, there's no need to
// calculate anything
if (xy == xp1 && xy == yp1 && xy == xyp1)
result[j] = xy;
-
+
// Run bilinear interpolation formula
else
- result[j] = (xy * (1-xdiff) + xp1 * xdiff)
- * (1-ydiff)
+ result[j] = (xy * (1-xdiff) + xp1 * xdiff)
+ * (1-ydiff)
+ (yp1 * (1-xdiff) + xyp1 * xdiff)
* ydiff;
}
@@ -497,7 +497,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
/**
* Perform bicubic filtering
* based on http://local.wasp.uwa.edu.au/~pbourke/colour/bicubic/
- *
+ *
* @param src the source raster
* @param dst the destination raster
* @param dpts array of points on the destination raster
@@ -522,7 +522,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
double dx = pts[i] + src.getMinX() - x;
double dy = pts[i + 1] + src.getMinY() - y;
Arrays.fill(result, 0);
-
+
for (int m = - 1; m < 3; m++)
for (int n = - 1; n < 3; n++)
{
@@ -597,7 +597,7 @@ public class AffineTransformOp implements BufferedImageOp, RasterOp
result[j] += ((int[])pixels)[j] * r1 * r2;
}
}
-
+
// Put it all together
dst.setPixel((int)dpts[i] + dst.getMinX(),
(int)dpts[i+1] + dst.getMinY(),
diff --git a/java/awt/image/AreaAveragingScaleFilter.java b/java/awt/image/AreaAveragingScaleFilter.java
index 491a2f519..db2335f1c 100644
--- a/java/awt/image/AreaAveragingScaleFilter.java
+++ b/java/awt/image/AreaAveragingScaleFilter.java
@@ -42,11 +42,11 @@ package java.awt.image;
* This filter should produce images which do not have image artifacts
* like broken lines which were originally unbroken. The cost is of
* course speed. Using bi-linear interpolation here against 4 pixel
- * points should give the desired results although Sun does not
+ * points should give the desired results although Sun does not
* specify what the exact algorithm should be.
* <br>
*
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public class AreaAveragingScaleFilter extends ReplicateScaleFilter
{
@@ -54,7 +54,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
* Construct an instance of <code>AreaAveragingScaleFilter</code> which
* should be used in conjunction with a <code>FilteredImageSource</code>
* object.
- *
+ *
* @param width the width of the destination image
* @param height the height of the destination image
*/
@@ -66,14 +66,14 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
* The <code>ImageProducer</code> should call this method with a
* bit mask of hints from any of <code>RANDOMPIXELORDER</code>,
* <code>TOPDOWNLEFTRIGHT</code>, <code>COMPLETESCANLINES</code>,
- * <code>SINGLEPASS</code>, <code>SINGLEFRAME</code> from the
+ * <code>SINGLEPASS</code>, <code>SINGLEFRAME</code> from the
* <code>ImageConsumer</code> interface.
* <br>
- * FIXME - more than likely Sun's implementation desires
+ * FIXME - more than likely Sun's implementation desires
* <code>TOPDOWNLEFTRIGHT</code> order and this method is overloaded here
* in order to assure that mask is part of the hints added to
* the consumer.
- *
+ *
* @param flags a bit mask of hints
* @see ImageConsumer
*/
@@ -86,7 +86,7 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as a <code>byte</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -97,8 +97,8 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize)
+ public void setPixels(int x, int y, int w, int h,
+ ColorModel model, byte[] pixels, int offset, int scansize)
{
double rx = ((double) srcWidth) / destWidth;
double ry = ((double) srcHeight) / destHeight;
@@ -106,19 +106,19 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
int destScansize = (int) Math.round(scansize / rx);
byte[] destPixels = averagePixels(x, y, w, h,
- model, pixels, offset, scansize,
- rx, ry, destScansize);
+ model, pixels, offset, scansize,
+ rx, ry, destScansize);
if (consumer != null)
consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
- (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
- model, destPixels, 0, destScansize);
+ (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
+ model, destPixels, 0, destScansize);
}
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as an <code>int</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -129,8 +129,8 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels, int offset, int scansize)
+ public void setPixels(int x, int y, int w, int h,
+ ColorModel model, int[] pixels, int offset, int scansize)
{
double rx = ((double) srcWidth) / destWidth;
double ry = ((double) srcHeight) / destHeight;
@@ -138,17 +138,17 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
int destScansize = (int) Math.round(scansize / rx);
int[] destPixels = averagePixels(x, y, w, h,
- model, pixels, offset, scansize,
- rx, ry, destScansize);
+ model, pixels, offset, scansize,
+ rx, ry, destScansize);
if (consumer != null)
consumer.setPixels((int) Math.floor(x/rx), (int) Math.floor(y/ry),
- (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
- model, destPixels, 0, destScansize);
+ (int) Math.ceil(w/rx), (int) Math.ceil(h/ry),
+ model, destPixels, 0, destScansize);
}
/**
- * This is a really terrible implementation,
+ * This is a really terrible implementation,
* since it uses the nearest-neighbor method. This filter is rarely used though.
*
* @param srcx, srcy - Source rectangle upper-left corner
@@ -161,9 +161,9 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
* @param destScansize - Destination array scanline size.
*/
private byte[] averagePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, byte[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
+ ColorModel model, byte[] srcPixels,
+ int srcOffset, int srcScansize,
+ double rx, double ry, int destScansize)
{
int destW = (int) Math.ceil(srcw/rx);
int destH = (int) Math.ceil(srch/ry);
@@ -175,40 +175,40 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
for(int x = 0; x < destW; x++)
for(int y = 0; y < destH; y++)
- {
- sx = (int) (x * rx);
- sy = (int) (y * ry);
-
- int r,g,b,a;
- r = g = b = a = 0;
-
- for(int i = 0; i < w; i++)
- {
- for(int j = 0; j < h; j++)
- {
- int idx = srcx + sx + i + (srcy + sy + j)*srcScansize;
- r += model.getRed(srcPixels[ idx ]);
- g += model.getGreen(srcPixels[ idx ]);
- b += model.getBlue(srcPixels[ idx ]);
- a += model.getAlpha(srcPixels[ idx ]);
- }
- }
-
- r = r / (w * h);
- g = g / (w * h);
- b = b / (w * h);
- a = a / (w * h);
-
- // Does this really work?
- destPixels[x + destScansize*y] = (byte)model.getDataElement
- (new int[]{r, g, b, a}, 0);
- }
+ {
+ sx = (int) (x * rx);
+ sy = (int) (y * ry);
+
+ int r,g,b,a;
+ r = g = b = a = 0;
+
+ for(int i = 0; i < w; i++)
+ {
+ for(int j = 0; j < h; j++)
+ {
+ int idx = srcx + sx + i + (srcy + sy + j)*srcScansize;
+ r += model.getRed(srcPixels[ idx ]);
+ g += model.getGreen(srcPixels[ idx ]);
+ b += model.getBlue(srcPixels[ idx ]);
+ a += model.getAlpha(srcPixels[ idx ]);
+ }
+ }
+
+ r = r / (w * h);
+ g = g / (w * h);
+ b = b / (w * h);
+ a = a / (w * h);
+
+ // Does this really work?
+ destPixels[x + destScansize*y] = (byte)model.getDataElement
+ (new int[]{r, g, b, a}, 0);
+ }
return destPixels;
}
/**
- * This is a really terrible implementation,
+ * This is a really terrible implementation,
* since it uses the nearest-neighbor method. This filter is rarely used though.
*
* @param srcx, srcy - Source rectangle upper-left corner
@@ -221,49 +221,48 @@ public class AreaAveragingScaleFilter extends ReplicateScaleFilter
* @param destScansize - Destination array scanline size.
*/
private int[] averagePixels(int srcx, int srcy, int srcw, int srch,
- ColorModel model, int[] srcPixels,
- int srcOffset, int srcScansize,
- double rx, double ry, int destScansize)
+ ColorModel model, int[] srcPixels,
+ int srcOffset, int srcScansize,
+ double rx, double ry, int destScansize)
{
int destW = (int) Math.ceil(srcw/rx);
int destH = (int) Math.ceil(srch/ry);
int[] destPixels = new int[ destW * destH ];
int sx, sy;
-
+
int w = (int)Math.ceil(rx);
int h = (int)Math.ceil(ry);
-
+
for(int x = 0; x < destW; x++)
for(int y = 0; y < destH; y++)
- {
- sx = (int) (x * rx);
- sy = (int) (y * ry);
-
- int r,g,b,a;
- r = g = b = a = 0;
-
- for(int i = 0; i < w; i++)
- {
- for(int j = 0; j < h; j++)
- {
- int idx = srcx + sx + i + (srcy + sy + j)*srcScansize;
- r += model.getRed(srcPixels[ idx ]);
- g += model.getGreen(srcPixels[ idx ]);
- b += model.getBlue(srcPixels[ idx ]);
- a += model.getAlpha(srcPixels[ idx ]);
- }
- }
-
- r = r / (w * h);
- g = g / (w * h);
- b = b / (w * h);
- a = a / (w * h);
-
- destPixels[x + destScansize*y] = model.getDataElement
- (new int[]{r, g, b, a}, 0);
- }
-
+ {
+ sx = (int) (x * rx);
+ sy = (int) (y * ry);
+
+ int r,g,b,a;
+ r = g = b = a = 0;
+
+ for(int i = 0; i < w; i++)
+ {
+ for(int j = 0; j < h; j++)
+ {
+ int idx = srcx + sx + i + (srcy + sy + j)*srcScansize;
+ r += model.getRed(srcPixels[ idx ]);
+ g += model.getGreen(srcPixels[ idx ]);
+ b += model.getBlue(srcPixels[ idx ]);
+ a += model.getAlpha(srcPixels[ idx ]);
+ }
+ }
+
+ r = r / (w * h);
+ g = g / (w * h);
+ b = b / (w * h);
+ a = a / (w * h);
+
+ destPixels[x + destScansize*y] = model.getDataElement
+ (new int[]{r, g, b, a}, 0);
+ }
+
return destPixels;
}
}
-
diff --git a/java/awt/image/BandCombineOp.java b/java/awt/image/BandCombineOp.java
index d9ce16fad..f3a6c5756 100644
--- a/java/awt/image/BandCombineOp.java
+++ b/java/awt/image/BandCombineOp.java
@@ -44,29 +44,29 @@ import java.util.Arrays;
/**
* Filter Raster pixels by applying a matrix.
- *
+ *
* BandCombineOp applies a matrix to each pixel to produce new pixel values.
* The width of the matrix must be the same or one more than the number of
* bands in the source Raster. If one more, the pixels in the source are
* assumed to contain an implicit 1.0 at the end.
- *
+ *
* The rows of the matrix are multiplied by the pixel to produce the values
* for the destination. Therefore the destination Raster must contain the
* same number of bands as the number of rows in the filter matrix.
- *
+ *
* This Op assumes that samples are integers; floating point sample types will
* be rounded to their nearest integer value during filtering.
- *
+ *
* @author Jerry Quinn (jlquinn@optonline.net)
*/
public class BandCombineOp implements RasterOp
{
private RenderingHints hints;
private float[][] matrix;
-
+
/**
* Construct a BandCombineOp.
- *
+ *
* @param matrix The matrix to filter pixels with.
* @param hints Rendering hints to apply. Ignored.
* @throws ArrayIndexOutOfBoundsException if the matrix is invalid
@@ -96,7 +96,7 @@ public class BandCombineOp implements RasterOp
* by 1, i.e. added to the sum for that dest component. If dest is null, a
* suitable Raster is created. This implementation uses
* createCompatibleDestRaster.
- *
+ *
* @param src The source Raster.
* @param dest The destination Raster, or null.
* @throws IllegalArgumentException if the destination raster is incompatible
@@ -122,7 +122,7 @@ public class BandCombineOp implements RasterOp
// In case matrix rows have implicit translation
spix[spix.length - 1] = 1;
src.getPixel(x, y, spix);
-
+
// Do not re-calculate if pixel is identical to the last one
// (ie, blocks of the same colour)
if (!Arrays.equals(spix, spix2))
@@ -154,7 +154,7 @@ public class BandCombineOp implements RasterOp
* Op. The number of bands in the source raster must equal the number of rows
* in the op matrix, which must also be equal to either the number of columns
* or (columns - 1) in the matrix.
- *
+ *
* @param src The source raster.
* @return A compatible raster.
* @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
@@ -181,18 +181,18 @@ public class BandCombineOp implements RasterOp
/**
* Return corresponding destination point for source point. Because this is
* not a geometric operation, it simply returns a copy of the source.
- *
+ *
* @param src The source point.
* @param dst The destination point.
* @return dst The destination point.
* @see java.awt.image.RasterOp#getPoint2D(java.awt.geom.Point2D,
- *java.awt.geom.Point2D)
+ *java.awt.geom.Point2D)
*/
public final Point2D getPoint2D(Point2D src, Point2D dst)
{
if (dst == null)
return (Point2D)src.clone();
-
+
dst.setLocation(src);
return dst;
}
@@ -204,7 +204,7 @@ public class BandCombineOp implements RasterOp
{
return hints;
}
-
+
/**
* Return the matrix used in this operation.
*
diff --git a/java/awt/image/BandedSampleModel.java b/java/awt/image/BandedSampleModel.java
index 94dbd8d46..7df6c8548 100644
--- a/java/awt/image/BandedSampleModel.java
+++ b/java/awt/image/BandedSampleModel.java
@@ -55,7 +55,7 @@ public final class BandedSampleModel extends ComponentSampleModel
private int numberOfBits;
private int numElems;
- private static int[] createBankArray(int size)
+ private static int[] createBankArray(int size)
{
int[] result = new int[size];
for (int i = 0; i < size; i++)
@@ -65,7 +65,7 @@ public final class BandedSampleModel extends ComponentSampleModel
/**
* Creates a new <code>BandedSampleModel</code>.
- *
+ *
* @param dataType the data buffer type.
* @param w the width (in pixels).
* @param h the height (in pixels).
@@ -78,24 +78,24 @@ public final class BandedSampleModel extends ComponentSampleModel
/**
* Creates a new <code>BandedSampleModel</code>.
- *
+ *
* @param dataType the data buffer type.
* @param w the width (in pixels).
* @param h the height (in pixels).
- * @param scanlineStride the number of data elements from a pixel in one
+ * @param scanlineStride the number of data elements from a pixel in one
* row to the corresponding pixel in the next row.
* @param bankIndices the bank indices.
* @param bandOffsets the band offsets.
*/
public BandedSampleModel(int dataType, int w, int h, int scanlineStride,
- int[] bankIndices, int[] bandOffsets)
+ int[] bankIndices, int[] bandOffsets)
{
super(dataType, w, h, 1, scanlineStride, bankIndices, bandOffsets);
}
-
+
/**
* Creates a new data buffer that is compatible with this sample model.
- *
+ *
* @return The new data buffer.
*/
public DataBuffer createDataBuffer()
@@ -107,15 +107,15 @@ public final class BandedSampleModel extends ComponentSampleModel
/**
* Creates a new <code>SampleModel</code> that is compatible with this
* model and has the specified width and height.
- *
+ *
* @param w the width (in pixels, must be greater than zero).
* @param h the height (in pixels, must be greater than zero).
- *
+ *
* @return The new sample model.
- *
+ *
* @throws IllegalArgumentException if <code>w</code> or <code>h</code> is
* not greater than zero.
- * @throws IllegalArgumentException if <code>w * h</code> exceeds
+ * @throws IllegalArgumentException if <code>w * h</code> exceeds
* <code>Integer.MAX_VALUE</code>.
*/
public SampleModel createCompatibleSampleModel(int w, int h)
@@ -150,7 +150,7 @@ public final class BandedSampleModel extends ComponentSampleModel
newoffsets[order[i]] = offset;
offset += w * scanlineStride;
}
-
+
return new BandedSampleModel(dataType, w, h, w, bankIndices, newoffsets);
}
@@ -159,19 +159,19 @@ public final class BandedSampleModel extends ComponentSampleModel
{
if (bands.length > bankIndices.length)
throw new
- RasterFormatException("BandedSampleModel createSubsetSampleModel too"
- +" many bands");
+ RasterFormatException("BandedSampleModel createSubsetSampleModel too"
+ +" many bands");
int[] newoff = new int[bands.length];
int[] newbanks = new int[bands.length];
for (int i = 0; i < bands.length; i++)
{
- int b = bands[i];
- newoff[i] = bandOffsets[b];
- newbanks[i] = bankIndices[b];
+ int b = bands[i];
+ newoff[i] = bandOffsets[b];
+ newbanks[i] = bankIndices[b];
}
return new BandedSampleModel(dataType, width, height, scanlineStride,
- newbanks, newoff);
+ newbanks, newoff);
}
/**
@@ -180,15 +180,15 @@ public final class BandedSampleModel extends ComponentSampleModel
* Extracts the pixel at x, y from data and stores samples into the array
* obj. If obj is null, a new array of getTransferType() is created.
*
- * @param x The x-coordinate of the pixel rectangle to store in
+ * @param x The x-coordinate of the pixel rectangle to store in
* <code>obj</code>.
- * @param y The y-coordinate of the pixel rectangle to store in
+ * @param y The y-coordinate of the pixel rectangle to store in
* <code>obj</code>.
- * @param obj The primitive array to store the pixels into or null to force
+ * @param obj The primitive array to store the pixels into or null to force
* creation.
* @param data The DataBuffer that is the source of the pixel data.
* @return The primitive array containing the pixel data.
- * @see java.awt.image.SampleModel#getDataElements(int, int,
+ * @see java.awt.image.SampleModel#getDataElements(int, int,
* java.lang.Object, java.awt.image.DataBuffer)
*/
public Object getDataElements(int x, int y, Object obj, DataBuffer data)
@@ -201,45 +201,45 @@ public final class BandedSampleModel extends ComponentSampleModel
{
case DataBuffer.TYPE_BYTE:
{
- byte[] b = (byte[]) obj;
- if (b == null) b = new byte[numBands];
- for (int i = 0; i < numBands; i++)
- b[i] = (byte)getSample(x, y, i, data);
- return b;
+ byte[] b = (byte[]) obj;
+ if (b == null) b = new byte[numBands];
+ for (int i = 0; i < numBands; i++)
+ b[i] = (byte)getSample(x, y, i, data);
+ return b;
}
case DataBuffer.TYPE_SHORT:
case DataBuffer.TYPE_USHORT:
{
- short[] b = (short[]) obj;
- if (b == null) b = new short[numBands];
- for (int i = 0; i < numBands; i++)
- b[i] = (short)getSample(x, y, i, data);
- return b;
+ short[] b = (short[]) obj;
+ if (b == null) b = new short[numBands];
+ for (int i = 0; i < numBands; i++)
+ b[i] = (short)getSample(x, y, i, data);
+ return b;
}
case DataBuffer.TYPE_INT:
{
- int[] b = (int[]) obj;
- if (b == null) b = new int[numBands];
- for (int i = 0; i < numBands; i++)
- b[i] = getSample(x, y, i, data);
- return b;
+ int[] b = (int[]) obj;
+ if (b == null) b = new int[numBands];
+ for (int i = 0; i < numBands; i++)
+ b[i] = getSample(x, y, i, data);
+ return b;
}
case DataBuffer.TYPE_FLOAT:
{
- float[] b = (float[]) obj;
- if (b == null) b = new float[numBands];
- for (int i = 0; i < numBands; i++)
- b[i] = getSampleFloat(x, y, i, data);
- return b;
+ float[] b = (float[]) obj;
+ if (b == null) b = new float[numBands];
+ for (int i = 0; i < numBands; i++)
+ b[i] = getSampleFloat(x, y, i, data);
+ return b;
}
case DataBuffer.TYPE_DOUBLE:
{
- double[] b = (double[]) obj;
- if (b == null)
+ double[] b = (double[]) obj;
+ if (b == null)
b = new double[numBands];
- for (int i = 0; i < numBands; i++)
- b[i] = getSample(x, y, i, data);
- return b;
+ for (int i = 0; i < numBands; i++)
+ b[i] = getSample(x, y, i, data);
+ return b;
}
default:
@@ -251,26 +251,26 @@ public final class BandedSampleModel extends ComponentSampleModel
/**
* Returns all the samples for the pixel at location <code>(x, y)</code>
* stored in the specified data buffer.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param iArray an array that will be populated with the sample values and
- * returned as the result. The size of this array should be equal to the
+ * returned as the result. The size of this array should be equal to the
* number of bands in the model. If the array is <code>null</code>, a new
* array is created.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The samples for the specified pixel.
- *
+ *
* @see #setPixel(int, int, int[], DataBuffer)
*/
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
{
- if (iArray == null)
+ if (iArray == null)
iArray = new int[numBands];
for (int i = 0; i < numBands; i++)
iArray[i] = getSample(x, y, i, data);
-
+
return iArray;
}
@@ -296,43 +296,43 @@ public final class BandedSampleModel extends ComponentSampleModel
* @return The primitive array containing the pixel data.
*/
public int[] getPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
if (x < 0 || y < 0)
throw new ArrayIndexOutOfBoundsException(
"x and y must not be less than 0.");
- if (iArray == null)
+ if (iArray == null)
iArray = new int[w * h * numBands];
int outOffset = 0;
int maxX = x + w;
int maxY = y + h;
for (int yy = x; yy < maxY; yy++)
{
- for (int xx = x; xx < maxX; xx++)
- {
- for (int b = 0; b < numBands; b++)
- {
- int offset = bandOffsets[b] + yy * scanlineStride + xx;
- iArray[outOffset++] =
- data.getElem(bankIndices[b], offset);
- }
- }
+ for (int xx = x; xx < maxX; xx++)
+ {
+ for (int b = 0; b < numBands; b++)
+ {
+ int offset = bandOffsets[b] + yy * scanlineStride + xx;
+ iArray[outOffset++] =
+ data.getElem(bankIndices[b], offset);
+ }
+ }
}
- return iArray;
+ return iArray;
}
/**
- * Returns a sample value for the pixel at (x, y) in the specified data
+ * Returns a sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int getSample(int x, int y, int b, DataBuffer data)
@@ -340,21 +340,21 @@ public final class BandedSampleModel extends ComponentSampleModel
int offset = bandOffsets[b] + y * scanlineStride + x;
return data.getElem(bankIndices[b], offset);
}
-
+
/**
- * Returns a sample value for the pixel at (x, y) in the specified data
+ * Returns a sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
- *
+ *
* @see #getSample(int, int, int, DataBuffer)
*/
public float getSampleFloat(int x, int y, int b, DataBuffer data)
@@ -362,21 +362,21 @@ public final class BandedSampleModel extends ComponentSampleModel
int offset = bandOffsets[b] + y * scanlineStride + x;
return data.getElemFloat(bankIndices[b], offset);
}
-
+
/**
- * Returns the sample value for the pixel at (x, y) in the specified data
+ * Returns the sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
- *
+ *
* @see #getSample(int, int, int, DataBuffer)
*/
public double getSampleDouble(int x, int y, int b, DataBuffer data)
@@ -384,7 +384,7 @@ public final class BandedSampleModel extends ComponentSampleModel
int offset = bandOffsets[b] + y * scanlineStride + x;
return data.getElemDouble(bankIndices[b], offset);
}
-
+
/**
* Copy one band's samples from a region into an array.
*
@@ -406,26 +406,26 @@ public final class BandedSampleModel extends ComponentSampleModel
* @return The primitive array containing the pixel data.
*/
public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
if (x < 0 || y < 0)
throw new ArrayIndexOutOfBoundsException(
"x and y must not be less than 0.");
- if (iArray == null)
+ if (iArray == null)
iArray = new int[w * h];
int outOffset = 0;
int maxX = x + w;
int maxY = y + h;
for (int yy = y; yy < maxY; yy++)
{
- for (int xx = x; xx < maxX; xx++)
- {
- int offset = bandOffsets[b] + yy * scanlineStride + xx;
- iArray[outOffset++] =
- data.getElem(bankIndices[b], offset);
- }
+ for (int xx = x; xx < maxX; xx++)
+ {
+ int offset = bandOffsets[b] + yy * scanlineStride + xx;
+ iArray[outOffset++] =
+ data.getElem(bankIndices[b], offset);
+ }
}
- return iArray;
+ return iArray;
}
/**
@@ -443,186 +443,186 @@ public final class BandedSampleModel extends ComponentSampleModel
int transferType = getTransferType();
if (getTransferType() != data.getDataType())
{
- throw new IllegalArgumentException("transfer type ("+
- getTransferType()+"), "+
- "does not match data "+
- "buffer type (" +
- data.getDataType() +
- ").");
+ throw new IllegalArgumentException("transfer type ("+
+ getTransferType()+"), "+
+ "does not match data "+
+ "buffer type (" +
+ data.getDataType() +
+ ").");
}
int offset = y * scanlineStride + x;
-
+
try
{
- switch (transferType)
- {
- case DataBuffer.TYPE_BYTE:
- {
- DataBufferByte out = (DataBufferByte) data;
- byte[] in = (byte[]) obj;
- for (int i = 0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
- return;
- }
- case DataBuffer.TYPE_SHORT:
- {
- DataBufferShort out = (DataBufferShort) data;
- short[] in = (short[]) obj;
- for (int i = 0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
- return;
- }
- case DataBuffer.TYPE_USHORT:
- {
- DataBufferUShort out = (DataBufferUShort) data;
- short[] in = (short[]) obj;
- for (int i = 0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
- return;
- }
- case DataBuffer.TYPE_INT:
- {
- DataBufferInt out = (DataBufferInt) data;
- int[] in = (int[]) obj;
- for (int i = 0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
- return;
- }
- case DataBuffer.TYPE_FLOAT:
- {
- DataBufferFloat out = (DataBufferFloat) data;
- float[] in = (float[]) obj;
- for (int i = 0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
- return;
- }
- case DataBuffer.TYPE_DOUBLE:
- {
- DataBufferDouble out = (DataBufferDouble) data;
- double[] in = (double[]) obj;
- for (int i = 0; i < numBands; i++)
- out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
- return;
- }
- default:
- throw new ClassCastException("Unsupported data type");
- }
+ switch (transferType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] in = (byte[]) obj;
+ for (int i = 0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
+ return;
+ }
+ case DataBuffer.TYPE_SHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] in = (short[]) obj;
+ for (int i = 0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
+ return;
+ }
+ case DataBuffer.TYPE_USHORT:
+ {
+ DataBufferUShort out = (DataBufferUShort) data;
+ short[] in = (short[]) obj;
+ for (int i = 0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
+ return;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] in = (int[]) obj;
+ for (int i = 0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
+ return;
+ }
+ case DataBuffer.TYPE_FLOAT:
+ {
+ DataBufferFloat out = (DataBufferFloat) data;
+ float[] in = (float[]) obj;
+ for (int i = 0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
+ return;
+ }
+ case DataBuffer.TYPE_DOUBLE:
+ {
+ DataBufferDouble out = (DataBufferDouble) data;
+ double[] in = (double[]) obj;
+ for (int i = 0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[i];
+ return;
+ }
+ default:
+ throw new ClassCastException("Unsupported data type");
+ }
}
catch (ArrayIndexOutOfBoundsException aioobe)
{
- String msg = "While writing data elements"
- + ", x=" + x + ", y=" + y
- + ", width=" + width + ", height=" + height
- + ", scanlineStride=" + scanlineStride
- + ", offset=" + offset
- + ", data.getSize()=" + data.getSize()
- + ", data.getOffset()=" + data.getOffset()
+ String msg = "While writing data elements"
+ + ", x=" + x + ", y=" + y
+ + ", width=" + width + ", height=" + height
+ + ", scanlineStride=" + scanlineStride
+ + ", offset=" + offset
+ + ", data.getSize()=" + data.getSize()
+ + ", data.getOffset()=" + data.getOffset()
+ ": " + aioobe;
- throw new ArrayIndexOutOfBoundsException(msg);
+ throw new ArrayIndexOutOfBoundsException(msg);
}
}
/**
* Sets the samples for the pixel at (x, y) in the specified data buffer to
- * the specified values.
- *
+ * the specified values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param iArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
{
for (int b = 0; b < numBands; b++)
data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x,
- iArray[b]);
+ iArray[b]);
}
/**
- * Sets the sample values for the pixels in the region specified by
+ * Sets the sample values for the pixels in the region specified by
* (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on).
- *
+ * on).
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
* @param iArray the pixel sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
int inOffset = 0;
for (int hh = 0; hh < h; hh++)
{
- for (int ww = 0; ww < w; ww++)
- {
- int offset = y * scanlineStride + (x + ww);
- for (int b = 0; b < numBands; b++)
- data.setElem(bankIndices[b], bandOffsets[b] + offset,
- iArray[inOffset++]);
- }
- y++;
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = y * scanlineStride + (x + ww);
+ for (int b = 0; b < numBands; b++)
+ data.setElem(bankIndices[b], bandOffsets[b] + offset,
+ iArray[inOffset++]);
+ }
+ y++;
}
}
/**
* Sets the sample value for band <code>b</code> of the pixel at location
* <code>(x, y)</code> in the specified data buffer.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param b the band index.
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @see #getSample(int, int, int, DataBuffer)
*/
public void setSample(int x, int y, int b, int s, DataBuffer data)
{
data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
}
-
+
/**
- * Sets the sample value for a band for the pixel at (x, y) in the
- * specified data buffer.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the
+ * specified data buffer.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public void setSample(int x, int y, int b, float s, DataBuffer data)
{
- data.setElemFloat(bankIndices[b], bandOffsets[b] + y * scanlineStride + x,
+ data.setElemFloat(bankIndices[b], bandOffsets[b] + y * scanlineStride + x,
s);
}
-
+
/**
- * Sets the sample value for a band for the pixel at (x, y) in the
- * specified data buffer.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the
+ * specified data buffer.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public void setSample(int x, int y, int b, double s, DataBuffer data)
@@ -630,25 +630,25 @@ public final class BandedSampleModel extends ComponentSampleModel
data.setElemDouble(bankIndices[b], bandOffsets[b] + y * scanlineStride + x,
s);
}
-
+
/**
- * Sets the sample values for one band for the pixels in the region
- * specified by (x, y, w, h) in the specified data buffer.
- *
+ * Sets the sample values for one band for the pixels in the region
+ * specified by (x, y, w, h) in the specified data buffer.
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
* @param iArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setSamples(int x, int y, int w, int h, int b, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
if (x < 0 || y < 0)
throw new ArrayIndexOutOfBoundsException(
@@ -658,81 +658,81 @@ public final class BandedSampleModel extends ComponentSampleModel
switch (getTransferType())
{
case DataBuffer.TYPE_BYTE:
- {
- DataBufferByte out = (DataBufferByte) data;
- byte[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = (byte)iArray[inOffset++];
- }
- y++;
- }
- return;
- }
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (byte)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
case DataBuffer.TYPE_SHORT:
- {
- DataBufferShort out = (DataBufferShort) data;
- short[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = (short)iArray[inOffset++];
- }
- y++;
- }
- return;
- }
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (short)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
case DataBuffer.TYPE_USHORT:
- {
- DataBufferShort out = (DataBufferShort) data;
- short[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = (short)iArray[inOffset++];
- }
- y++;
- }
- return;
- }
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (short)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
case DataBuffer.TYPE_INT:
- {
- DataBufferInt out = (DataBufferInt) data;
- int[] bank = out.getData(bankIndices[b]);
- for (int hh = 0; hh < h; hh++)
- {
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- bank[offset] = iArray[inOffset++];
- }
- y++;
- }
- return;
- }
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
case DataBuffer.TYPE_FLOAT:
case DataBuffer.TYPE_DOUBLE:
- break;
+ break;
default:
- throw new ClassCastException("Unsupported data type");
+ throw new ClassCastException("Unsupported data type");
}
// Default implementation probably slower for float and double
for (int hh = 0; hh < h; hh++)
{
- for (int ww = 0; ww < w; ww++)
- {
- int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
- data.setElem(bankIndices[b], offset, iArray[inOffset++]);
- }
- y++;
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ data.setElem(bankIndices[b], offset, iArray[inOffset++]);
+ }
+ y++;
}
}
@@ -752,7 +752,7 @@ public final class BandedSampleModel extends ComponentSampleModel
result.append(", mask[").append(i).append("]=0x").append(
Integer.toHexString(bitMasks[i]));
}
-
+
result.append("]");
return result.toString();
}
diff --git a/java/awt/image/BufferedImage.java b/java/awt/image/BufferedImage.java
index 260d254fd..094c71dd1 100644
--- a/java/awt/image/BufferedImage.java
+++ b/java/awt/image/BufferedImage.java
@@ -61,7 +61,7 @@ import java.util.Vector;
* the image consists of one large tile (0,0) with the width and
* height of the image. This tile is always considered to be checked
* out.
- *
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class BufferedImage extends Image
@@ -81,12 +81,12 @@ public class BufferedImage extends Image
TYPE_USHORT_GRAY = 11,
TYPE_BYTE_BINARY = 12,
TYPE_BYTE_INDEXED = 13;
-
+
/**
* Vector of TileObservers (or null)
*/
Vector<TileObserver> tileObservers;
-
+
/**
* The image's WritableRaster
*/
@@ -115,7 +115,7 @@ public class BufferedImage extends Image
/**
* Creates a new <code>BufferedImage</code> with the specified width, height
* and type. Valid <code>type</code> values are:
- *
+ *
* <ul>
* <li>{@link #TYPE_INT_RGB}</li>
* <li>{@link #TYPE_INT_ARGB}</li>
@@ -131,11 +131,11 @@ public class BufferedImage extends Image
* <li>{@link #TYPE_BYTE_BINARY}</li>
* <li>{@link #TYPE_BYTE_INDEXED}</li>
* </ul>
- *
+ *
* @param width the width (must be > 0).
* @param height the height (must be > 0).
* @param type the image type (see the list of valid types above).
- *
+ *
* @throws IllegalArgumentException if <code>width</code> or
* <code>height</code> is less than or equal to zero.
* @throws IllegalArgumentException if <code>type</code> is not one of the
@@ -151,18 +151,18 @@ public class BufferedImage extends Image
switch( type )
{
case BufferedImage.TYPE_INT_RGB:
- sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_INT,
+ sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_INT,
width, height,
- new int[]{ 0x00FF0000,
- 0x0000FF00,
+ new int[]{ 0x00FF0000,
+ 0x0000FF00,
0x000000FF } ) ;
cm = new DirectColorModel( 24, 0xff0000, 0xff00, 0xff );
break;
-
+
case BufferedImage.TYPE_3BYTE_BGR:
sm = new PixelInterleavedSampleModel( DataBuffer.TYPE_BYTE,
width, height,
- 3, width * 3,
+ 3, width * 3,
new int[]{ 2, 1, 0 } );
cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
false, false,
@@ -172,11 +172,11 @@ public class BufferedImage extends Image
case BufferedImage.TYPE_INT_ARGB:
case BufferedImage.TYPE_INT_ARGB_PRE:
- sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_INT,
+ sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_INT,
width, height,
- new int[]{ 0x00FF0000,
- 0x0000FF00,
- 0x000000FF,
+ new int[]{ 0x00FF0000,
+ 0x0000FF00,
+ 0x000000FF,
0xFF000000 } );
if (premultiplied)
cm = new DirectColorModel( ColorSpace.getInstance(ColorSpace.CS_sRGB),
@@ -185,12 +185,12 @@ public class BufferedImage extends Image
Buffers.smallestAppropriateTransferType(32));
else
cm = new DirectColorModel( 32, 0xff0000, 0xff00, 0xff, 0xff000000 );
-
+
break;
case BufferedImage.TYPE_4BYTE_ABGR:
case BufferedImage.TYPE_4BYTE_ABGR_PRE:
- sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
+ sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE,
width, height,
4, 4*width,
new int[]{3, 2, 1, 0});
@@ -201,10 +201,10 @@ public class BufferedImage extends Image
break;
case BufferedImage.TYPE_INT_BGR:
- sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_INT,
+ sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_INT,
width, height,
- new int[]{ 0x000000FF,
- 0x0000FF00,
+ new int[]{ 0x000000FF,
+ 0x0000FF00,
0x00FF0000 } ) ;
cm = new DirectColorModel( 24, 0xff, 0xff00, 0xff0000 );
break;
@@ -212,17 +212,17 @@ public class BufferedImage extends Image
case BufferedImage.TYPE_USHORT_565_RGB:
sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_USHORT,
width, height,
- new int[]{ 0xF800,
- 0x7E0,
+ new int[]{ 0xF800,
+ 0x7E0,
0x1F } ) ;
cm = new DirectColorModel( 16, 0xF800, 0x7E0, 0x1F );
break;
-
+
case BufferedImage.TYPE_USHORT_555_RGB:
sm = new SinglePixelPackedSampleModel( DataBuffer.TYPE_USHORT,
width, height,
- new int[]{ 0x7C00,
- 0x3E0,
+ new int[]{ 0x7C00,
+ 0x3E0,
0x1F } ) ;
cm = new DirectColorModel( 15, 0x7C00, 0x3E0, 0x1F );
break;
@@ -244,7 +244,7 @@ public class BufferedImage extends Image
case BufferedImage.TYPE_BYTE_BINARY:
cm = createDefaultIndexedColorModel( true );
- sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ sm = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
width, height, 1);
break;
@@ -254,8 +254,8 @@ public class BufferedImage extends Image
if( sm == null )
throw new IllegalArgumentException("Unknown predefined image type.");
-
- if( cm == null ) // only for the grayscale types
+
+ if( cm == null ) // only for the grayscale types
{
int buftype;
int[] bits = new int[1];
@@ -270,22 +270,22 @@ public class BufferedImage extends Image
bits[0] = 16;
}
ColorSpace graySpace = ColorSpace.getInstance( ColorSpace.CS_GRAY );
-
- cm = new ComponentColorModel( graySpace, bits, false, false,
+
+ cm = new ComponentColorModel( graySpace, bits, false, false,
Transparency.OPAQUE, buftype );
}
WritableRaster rst = null;
-
+
// Attempt to create an accelerated backend for this image
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (env instanceof ClasspathGraphicsEnvironment)
rst = ((ClasspathGraphicsEnvironment)env).createRaster(cm, sm);
-
+
// Default to a standard Java raster & databuffer if needed
if (rst == null)
rst = Raster.createWritableRaster(sm, new Point( 0, 0 ) );
-
+
init(cm, rst, premultiplied,
null, // no properties
type );
@@ -308,13 +308,13 @@ public class BufferedImage extends Image
}
public BufferedImage(ColorModel colormodel, WritableRaster writableraster,
- boolean premultiplied, Hashtable<?,?> properties)
+ boolean premultiplied, Hashtable<?,?> properties)
{
init(colormodel, writableraster, premultiplied, properties, TYPE_CUSTOM);
}
-
- private void init(ColorModel cm, WritableRaster writableraster,
+
+ private void init(ColorModel cm, WritableRaster writableraster,
boolean premultiplied, Hashtable properties, int type)
{
raster = writableraster;
@@ -330,7 +330,7 @@ public class BufferedImage extends Image
*
* @param binary - If <code>true</code>, a black and white palette,
* otherwise a default 256-color palette is returned.
- */
+ */
private IndexColorModel createDefaultIndexedColorModel( boolean binary )
{
if( binary )
@@ -342,7 +342,7 @@ public class BufferedImage extends Image
byte[] r = new byte[256];
byte[] g = new byte[256];
byte[] b = new byte[256];
-
+
int index = 0;
for( int i = 0; i < 6; i++ )
for( int j = 0; j < 6; j++ )
@@ -353,17 +353,17 @@ public class BufferedImage extends Image
b[ index ] = (byte)(k * 51);
index++;
}
-
+
while( index < 256 )
{
- r[ index ] = g[ index ] = b[ index ] =
+ r[ index ] = g[ index ] = b[ index ] =
(byte)(18 + (index - 216) * 6);
index++;
}
-
+
return new IndexColorModel( 8, 256, r, g, b );
}
-
+
public void coerceData(boolean premultiplied)
{
colorModel = colorModel.coerceData(raster, premultiplied);
@@ -380,17 +380,17 @@ public class BufferedImage extends Image
int y = dest.getMinY();
int w = dest.getWidth();
int h = dest.getHeight();
-
+
// create a src child that has the right bounds...
WritableRaster src =
raster.createWritableChild(x, y, w, h, x, y,
null); // same bands
-
+
if (src.getSampleModel () instanceof ComponentSampleModel
&& dest.getSampleModel () instanceof ComponentSampleModel)
// Refer to ComponentDataBlitOp for optimized data blitting:
ComponentDataBlitOp.INSTANCE.filter(src, dest);
-
+
else
{
// slower path
@@ -410,17 +410,17 @@ public class BufferedImage extends Image
public void flush()
{
}
-
+
public WritableRaster getAlphaRaster()
{
return colorModel.getAlphaRaster(raster);
}
-
+
public ColorModel getColorModel()
{
return colorModel;
}
-
+
public Raster getData()
{
return copyData(null);
@@ -434,7 +434,7 @@ public class BufferedImage extends Image
raster.createCompatibleWritableRaster(rectangle);
return copyData(dest);
}
-
+
public Graphics getGraphics()
{
return createGraphics();
@@ -444,17 +444,17 @@ public class BufferedImage extends Image
{
return raster.getHeight();
}
-
+
public int getHeight(ImageObserver imageobserver)
{
return getHeight();
}
-
+
public int getMinTileX()
{
return 0;
}
-
+
public int getMinTileY()
{
return 0;
@@ -462,14 +462,14 @@ public class BufferedImage extends Image
public int getMinX()
{
- return 0;
+ return 0;
}
- public int getMinY()
+ public int getMinY()
{
return 0;
}
-
+
public int getNumXTiles()
{
return 1;
@@ -477,17 +477,17 @@ public class BufferedImage extends Image
public int getNumYTiles()
{
- return 1;
+ return 1;
}
/**
- * Returns the value of the specified property, or
+ * Returns the value of the specified property, or
* {@link Image#UndefinedProperty} if the property is not defined.
- *
+ *
* @param string the property key (<code>null</code> not permitted).
- *
+ *
* @return The property value.
- *
+ *
* @throws NullPointerException if <code>string</code> is <code>null</code>.
*/
public Object getProperty(String string)
@@ -511,7 +511,7 @@ public class BufferedImage extends Image
/**
* Returns <code>null</code> always.
- *
+ *
* @return <code>null</code> always.
*/
public String[] getPropertyNames()
@@ -526,29 +526,29 @@ public class BufferedImage extends Image
Object rgbElem = raster.getDataElements(x, y, null);
return colorModel.getRGB(rgbElem);
}
-
+
public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray,
int offset, int scanlineStride)
{
if (rgbArray == null)
{
/*
- 000000000000000000
- 00000[#######----- [ = start
- -----########----- ] = end
- -----#######]00000
- 000000000000000000
+ 000000000000000000
+ 00000[#######----- [ = start
+ -----########----- ] = end
+ -----#######]00000
+ 000000000000000000
*/
int size = (h-1)*scanlineStride + w;
rgbArray = new int[size];
}
-
+
int endX = startX + w;
int endY = startY + h;
-
+
/* *TODO*:
Opportunity for optimization by examining color models...
-
+
Perhaps wrap the rgbArray up in a WritableRaster with packed
sRGB color model and perform optimized rendering into the
array. */
@@ -573,12 +573,12 @@ public class BufferedImage extends Image
{
return raster;
}
-
+
public SampleModel getSampleModel()
{
return raster.getSampleModel();
}
-
+
public ImageProducer getSource()
{
return new ImageProducer()
@@ -609,8 +609,8 @@ public class BufferedImage extends Image
int height = getHeight();
int stride = width;
int offset = 0;
- int[] pixels = getRGB(x, y,
- width, height,
+ int[] pixels = getRGB(x, y,
+ width, height,
(int[])null, offset, stride);
// We already convert the color to RGB in the getRGB call, so
// we pass a simple RGB color model to the consumers.
@@ -636,17 +636,17 @@ public class BufferedImage extends Image
};
}
-
+
public Vector<RenderedImage> getSources()
{
return null;
}
-
+
public BufferedImage getSubimage(int x, int y, int w, int h)
{
- WritableRaster subRaster =
+ WritableRaster subRaster =
getRaster().createWritableChild(x, y, w, h, 0, 0, null);
-
+
return new BufferedImage(getColorModel(), subRaster, isPremultiplied,
properties);
}
@@ -655,7 +655,7 @@ public class BufferedImage extends Image
{
return getWritableTile(tileX, tileY);
}
-
+
public int getTileGridXOffset()
{
return 0; // according to javadocs
@@ -698,7 +698,7 @@ public class BufferedImage extends Image
}
private static final Point[] tileIndices = { new Point() };
-
+
public Point[] getWritableTileIndices()
{
return tileIndices;
@@ -708,7 +708,7 @@ public class BufferedImage extends Image
{
return true;
}
-
+
public boolean isAlphaPremultiplied()
{
return isPremultiplied;
@@ -734,7 +734,7 @@ public class BufferedImage extends Image
int y = src.getMinY();
int w = src.getWidth();
int h = src.getHeight();
-
+
// create a dest child that has the right bounds...
WritableRaster dest =
raster.createWritableChild(x, y, w, h, x, y, null);
@@ -757,13 +757,13 @@ public class BufferedImage extends Image
Object rgbElem = colorModel.getDataElements(argb, null);
raster.setDataElements(x, y, rgbElem);
}
-
+
public void setRGB(int startX, int startY, int w, int h,
- int[] argbArray, int offset, int scanlineStride)
+ int[] argbArray, int offset, int scanlineStride)
{
int endX = startX + w;
int endY = startY + h;
-
+
Object rgbElem = null;
for (int y=startY; y<endY; y++)
{
@@ -774,10 +774,10 @@ public class BufferedImage extends Image
rgbElem = colorModel.getDataElements(argb, rgbElem);
raster.setDataElements(x, y, rgbElem);
}
- offset += scanlineStride;
+ offset += scanlineStride;
}
}
-
+
public String toString()
{
CPStringBuilder buf;
@@ -806,10 +806,10 @@ public class BufferedImage extends Image
{
if (tileObservers == null)
tileObservers = new Vector<TileObserver>();
-
+
tileObservers.add (to);
}
-
+
/**
* Removes a tile observer. If the observer was not registered,
* nothing happens. If the observer was registered for multiple
@@ -821,7 +821,7 @@ public class BufferedImage extends Image
{
if (tileObservers == null)
return;
-
+
tileObservers.remove (to);
}
diff --git a/java/awt/image/BufferedImageFilter.java b/java/awt/image/BufferedImageFilter.java
index 50d627d66..04b6672c6 100644
--- a/java/awt/image/BufferedImageFilter.java
+++ b/java/awt/image/BufferedImageFilter.java
@@ -40,10 +40,10 @@ import java.awt.Point;
/**
* The BufferedImageFilter class wraps BufferedImageOp objects in a Filter.
- *
+ *
* When pixels are pushed through the filter, we create a BufferedImage,
* apply the BufferedImageOp, and pass the filtered pixels to the base class.
- *
+ *
* @author jlquinn@optonline.net
*/
public class BufferedImageFilter extends ImageFilter implements Cloneable
@@ -51,17 +51,17 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable
private BufferedImageOp op;
/**
- *
+ *
*/
public BufferedImageFilter(BufferedImageOp op)
{
super();
if (op == null)
throw new NullPointerException("BufferedImageFilter null"
- + " op in constructor");
+ + " op in constructor");
this.op = op;
}
-
+
/**
* @return Returns the contained BufferedImageOp.
*/
@@ -74,7 +74,7 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable
// create a compatible sample model that incorporates scansize != w. I
// asume off is handled by the db itself.
public void setPixels(int x, int y, int w, int h, ColorModel model,
- byte[] pixels, int off, int scansize)
+ byte[] pixels, int off, int scansize)
{
// Create an input BufferedImage
DataBufferByte db = new DataBufferByte(pixels, scansize * h + off, off);
@@ -84,16 +84,16 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable
new BufferedImage(model, wr, model.isAlphaPremultiplied(), null);
BufferedImage out = op.createCompatibleDestImage(in, model);
op.filter(in, out);
- DataBuffer dbout = out.getRaster().getDataBuffer();
+ DataBuffer dbout = out.getRaster().getDataBuffer();
super.setPixels(0, 0, w, h, model, ((DataBufferByte)dbout).getData(), 0,
- scansize);
+ scansize);
}
// FIXME: Definitely not sure this is the right thing. I'm not sure how
// to create a compatible sample model that incorporates
// scansize != w. I asume off is handled by the db itself.
public void setPixels(int x, int y, int w, int h, ColorModel model,
- int[] pixels, int off, int scansize)
+ int[] pixels, int off, int scansize)
{
// Create an input BufferedImage
DataBufferInt db = new DataBufferInt(pixels, scansize * h + off, off);
@@ -103,8 +103,8 @@ public class BufferedImageFilter extends ImageFilter implements Cloneable
new BufferedImage(model, wr, model.isAlphaPremultiplied(), null);
BufferedImage out = op.createCompatibleDestImage(in, model);
op.filter(in, out);
- DataBuffer dbout = out.getRaster().getDataBuffer();
+ DataBuffer dbout = out.getRaster().getDataBuffer();
super.setPixels(0, 0, w, h, model, ((DataBufferInt)dbout).getData(), 0,
- scansize);
+ scansize);
}
}
diff --git a/java/awt/image/BufferedImageOp.java b/java/awt/image/BufferedImageOp.java
index f6a24c976..1aba4bb09 100644
--- a/java/awt/image/BufferedImageOp.java
+++ b/java/awt/image/BufferedImageOp.java
@@ -1,4 +1,4 @@
-/* BufferedImageOp.java --
+/* BufferedImageOp.java --
Copyright (C) 2002, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,65 +43,65 @@ import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
/**
- * An operation that is performed on one <code>BufferedImage</code> (the
+ * An operation that is performed on one <code>BufferedImage</code> (the
* source) producing a new <code>BufferedImage</code> (the destination).
*/
public interface BufferedImageOp
{
/**
* Performs an operation on the source image, returning the result in a
- * <code>BufferedImage</code>. If <code>dest</code> is <code>null</code>, a
+ * <code>BufferedImage</code>. If <code>dest</code> is <code>null</code>, a
* new <code>BufferedImage</code> will be created by calling the
* {@link #createCompatibleDestImage} method. If <code>dest</code>
- * is not <code>null</code>, the result is written to <code>dest</code> then
- * returned (this avoids creating a new <code>BufferedImage</code> each
+ * is not <code>null</code>, the result is written to <code>dest</code> then
+ * returned (this avoids creating a new <code>BufferedImage</code> each
* time this method is called).
- *
+ *
* @param src the source image.
* @param dst the destination image (<code>null</code> permitted).
- *
+ *
* @return The filterd image.
*/
BufferedImage filter(BufferedImage src, BufferedImage dst);
-
+
/**
* Returns the bounds of the destination image on the basis of this
* <code>BufferedImageOp</code> being applied to the specified source image.
- *
+ *
* @param src the source image.
- *
+ *
* @return The destination bounds.
*/
Rectangle2D getBounds2D(BufferedImage src);
-
+
/**
- * Returns a new <code>BufferedImage</code> that can be used by this
- * <code>BufferedImageOp</code> as the destination image when filtering
+ * Returns a new <code>BufferedImage</code> that can be used by this
+ * <code>BufferedImageOp</code> as the destination image when filtering
* the specified source image.
- *
+ *
* @param src the source image.
* @param dstCM the color model for the destination image.
- *
+ *
* @return A new image that can be used as the destination image.
*/
BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM);
-
+
/**
* Returns the point on the destination image that corresponds to the given
* point on the source image.
- *
+ *
* @param src the source point.
* @param dst the destination point (<code>null</code> permitted).
- *
+ *
* @return The destination point.
*/
Point2D getPoint2D(Point2D src, Point2D dst);
-
+
/**
* Returns the rendering hints for this operation.
- *
+ *
* @return The rendering hints.
*/
RenderingHints getRenderingHints();
-
-}
+
+}
diff --git a/java/awt/image/ByteLookupTable.java b/java/awt/image/ByteLookupTable.java
index ecc0023af..89804c55b 100644
--- a/java/awt/image/ByteLookupTable.java
+++ b/java/awt/image/ByteLookupTable.java
@@ -58,7 +58,7 @@ public class ByteLookupTable extends LookupTable
* Offset is subtracted from pixel values when looking up in the translation
* tables. If data.length is one, the same table is applied to all pixel
* components.
- *
+ *
* @param offset Offset to be subtracted.
* @param data Array of lookup tables (<code>null</code> not permitted).
* @exception IllegalArgumentException if offset &lt; 0 or data.length &lt; 1.
@@ -67,9 +67,9 @@ public class ByteLookupTable extends LookupTable
throws IllegalArgumentException
{
super(offset, data.length);
-
+
// tests show that Sun's implementation creates a new array to store the
- // references from the incoming 'data' array - not sure why, but we'll
+ // references from the incoming 'data' array - not sure why, but we'll
// match that behaviour just in case it matters...
this.data = new byte[data.length][];
for (int i = 0; i < data.length; i++)
@@ -81,9 +81,9 @@ public class ByteLookupTable extends LookupTable
*
* Offset is subtracted from pixel values when looking up in the translation
* table. The same table is applied to all pixel components.
- *
+ *
* @param offset Offset to be subtracted.
- * @param data Lookup table for all components (<code>null</code> not
+ * @param data Lookup table for all components (<code>null</code> not
* permitted).
* @exception IllegalArgumentException if offset &lt; 0.
*/
@@ -131,11 +131,11 @@ public class ByteLookupTable extends LookupTable
if (data.length == 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 < src.length; i++)
- dst[i] = data[i][src[i] - offset];
-
+ dst[i] = data[i][src[i] - offset];
+
return dst;
}
@@ -164,11 +164,11 @@ public class ByteLookupTable extends LookupTable
if (data.length == 1)
for (int i=0; i < src.length; i++)
- dst[i] = data[0][((int)src[i]) - offset];
+ dst[i] = data[0][((int)src[i]) - offset];
else
for (int i=0; i < src.length; i++)
- dst[i] = data[i][((int)src[i]) - offset];
-
+ dst[i] = data[i][((int)src[i]) - offset];
+
return dst;
}
diff --git a/java/awt/image/ColorConvertOp.java b/java/awt/image/ColorConvertOp.java
index e6c85412d..b1d6f857d 100644
--- a/java/awt/image/ColorConvertOp.java
+++ b/java/awt/image/ColorConvertOp.java
@@ -51,17 +51,17 @@ import java.awt.geom.Rectangle2D;
/**
* ColorConvertOp is a filter for converting images or rasters between
- * colorspaces, either through a sequence of colorspaces or just from source to
+ * colorspaces, either through a sequence of colorspaces or just from source to
* destination.
- *
+ *
* Color conversion is done on the color components without alpha. Thus
* if a BufferedImage has alpha premultiplied, this is divided out before
* color conversion, and premultiplication applied if the destination
* requires it.
- *
+ *
* Color rendering and dithering hints may be applied if specified. This is
* likely platform-dependent.
- *
+ *
* @author jlquinn@optonline.net
*/
public class ColorConvertOp implements BufferedImageOp, RasterOp
@@ -69,16 +69,16 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
private RenderingHints hints;
private ICC_Profile[] profiles = null;
private ColorSpace[] spaces;
-
+
/**
* Convert a BufferedImage through a ColorSpace.
- *
+ *
* Objects created with this constructor can be used to convert
* BufferedImage's to a destination ColorSpace. Attempts to convert Rasters
* with this constructor will result in an IllegalArgumentException when the
- * filter(Raster, WritableRaster) method is called.
- *
+ * filter(Raster, WritableRaster) method is called.
+ *
* @param cspace The target color space.
* @param hints Rendering hints to use in conversion, if any (may be null)
* @throws NullPointerException if the ColorSpace is null.
@@ -90,53 +90,53 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
spaces = new ColorSpace[]{cspace};
this.hints = hints;
}
-
+
/**
* Convert from a source colorspace to a destination colorspace.
- *
+ *
* This constructor takes two ColorSpace arguments as the source and
* destination color spaces. It is usually used with the
- * filter(Raster, WritableRaster) method, in which case the source colorspace
- * is assumed to correspond to the source Raster, and the destination
+ * filter(Raster, WritableRaster) method, in which case the source colorspace
+ * is assumed to correspond to the source Raster, and the destination
* colorspace with the destination Raster.
- *
- * If used with BufferedImages that do not match the source or destination
- * colorspaces specified here, there is an implicit conversion from the
- * source image to the source ColorSpace, or the destination ColorSpace to
+ *
+ * If used with BufferedImages that do not match the source or destination
+ * colorspaces specified here, there is an implicit conversion from the
+ * source image to the source ColorSpace, or the destination ColorSpace to
* the destination image.
- *
+ *
* @param srcCspace The source ColorSpace.
* @param dstCspace The destination ColorSpace.
* @param hints Rendering hints to use in conversion, if any (may be null).
* @throws NullPointerException if any ColorSpace is null.
*/
public ColorConvertOp(ColorSpace srcCspace, ColorSpace dstCspace,
- RenderingHints hints)
+ RenderingHints hints)
{
if (srcCspace == null || dstCspace == null)
throw new NullPointerException();
spaces = new ColorSpace[]{srcCspace, dstCspace};
- this.hints = hints;
+ this.hints = hints;
}
/**
* Convert from a source colorspace to a destinatino colorspace.
- *
+ *
* This constructor builds a ColorConvertOp from an array of ICC_Profiles.
* The source will be converted through the sequence of color spaces
* defined by the profiles. If the sequence of profiles doesn't give a
* well-defined conversion, an IllegalArgumentException is thrown.
- *
- * If used with BufferedImages that do not match the source or destination
- * colorspaces specified here, there is an implicit conversion from the
- * source image to the source ColorSpace, or the destination ColorSpace to
+ *
+ * If used with BufferedImages that do not match the source or destination
+ * colorspaces specified here, there is an implicit conversion from the
+ * source image to the source ColorSpace, or the destination ColorSpace to
* the destination image.
- *
+ *
* For Rasters, the first and last profiles must have the same number of
* bands as the source and destination Rasters, respectively. If this is
* not the case, or there fewer than 2 profiles, an IllegalArgumentException
- * will be thrown.
- *
+ * will be thrown.
+ *
* @param profiles An array of ICC_Profile's to convert through.
* @param hints Rendering hints to use in conversion, if any (may be null).
* @throws NullPointerException if the profile array is null.
@@ -147,10 +147,10 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
{
if (profiles == null)
throw new NullPointerException();
-
- this.hints = hints;
+
+ this.hints = hints;
this.profiles = profiles;
-
+
// Create colorspace array with space for src and dest colorspace
// Note that the ICC_ColorSpace constructor will throw an
// IllegalArgumentException if the profile is invalid; thus we check
@@ -159,17 +159,17 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
for (int i = 0; i < profiles.length; i++)
spaces[i] = new ICC_ColorSpace(profiles[i]);
}
-
+
/**
* Convert from source color space to destination color space.
- *
+ *
* Only valid for BufferedImage objects, this Op converts from the source
* image's color space to the destination image's color space.
- *
- * The destination in the filter(BufferedImage, BufferedImage) method cannot
+ *
+ * The destination in the filter(BufferedImage, BufferedImage) method cannot
* be null for this operation, and it also cannot be used with the
* filter(Raster, WritableRaster) method.
- *
+ *
* @param hints Rendering hints to use in conversion, if any (may be null).
*/
public ColorConvertOp(RenderingHints hints)
@@ -177,12 +177,12 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
this.hints = hints;
spaces = new ColorSpace[0];
}
-
+
/**
* Converts the source image using the conversion path specified in the
* constructor. The resulting image is stored in the destination image if one
- * is provided; otherwise a new BufferedImage is created and returned.
- *
+ * is provided; otherwise a new BufferedImage is created and returned.
+ *
* The source and destination BufferedImage (if one is supplied) must have
* the same dimensions.
*
@@ -196,7 +196,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
{
// TODO: The plan is to create a scanline buffer for intermediate buffers.
// For now we just suck it up and create intermediate buffers.
-
+
if (dst == null && spaces.length == 0)
throw new IllegalArgumentException("Not enough color space information "
+ "to complete conversion.");
@@ -245,12 +245,12 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
* Converts the source raster using the conversion path specified in the
* constructor. The resulting raster is stored in the destination raster if
* one is provided; otherwise a new WritableRaster is created and returned.
- *
+ *
* This operation is not valid with every constructor of this class; see
* the constructors for details. Further, the source raster must have the
* same number of bands as the source ColorSpace, and the destination raster
* must have the same number of bands as the destination ColorSpace.
- *
+ *
* The source and destination raster (if one is supplied) must also have the
* same dimensions.
*
@@ -303,7 +303,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
/**
* Creates an empty BufferedImage with the size equal to the source and the
- * correct number of bands for the conversion defined in this Op. The newly
+ * correct number of bands for the conversion defined in this Op. The newly
* created image is created with the specified ColorModel, or if no ColorModel
* is supplied, an appropriate one is chosen.
*
@@ -332,11 +332,11 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
dstCM.getTransferType()),
src.isPremultiplied, null);
}
-
+
/**
* Creates a new WritableRaster with the size equal to the source and the
* correct number of bands.
- *
+ *
* Note, the new Raster will always use a BYTE storage size, regardless of
* the color model or defined destination; this is for compatibility with
* the reference implementation.
@@ -361,7 +361,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
/**
* Returns the array of ICC_Profiles used to create this Op, or null if the
* Op was created using ColorSpace arguments.
- *
+ *
* @return The array of ICC_Profiles, or null.
*/
public final ICC_Profile[] getICC_Profiles()
@@ -371,7 +371,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
/**
* Returns the rendering hints for this op.
- *
+ *
* @return The rendering hints for this Op, or null.
*/
public final RenderingHints getRenderingHints()
@@ -383,7 +383,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
* Returns the corresponding destination point for a source point.
* Because this is not a geometric operation, the destination and source
* points will be identical.
- *
+ *
* @param src The source point.
* @param dst The transformed destination point.
* @return The transformed destination point.
@@ -392,7 +392,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
{
if (dst == null)
return (Point2D)src.clone();
-
+
dst.setLocation(src);
return dst;
}
@@ -401,7 +401,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
* Returns the corresponding destination boundary of a source boundary.
* Because this is not a geometric operation, the destination and source
* boundaries will be identical.
- *
+ *
* @param src The source boundary.
* @return The boundaries of the destination.
*/
@@ -414,7 +414,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
* Returns the corresponding destination boundary of a source boundary.
* Because this is not a geometric operation, the destination and source
* boundaries will be identical.
- *
+ *
* @param src The source boundary.
* @return The boundaries of the destination.
*/
@@ -424,9 +424,9 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
}
/**
- * Copy a source image to a destination image, respecting their colorspaces
- * and performing colorspace conversions if necessary.
- *
+ * Copy a source image to a destination image, respecting their colorspaces
+ * and performing colorspace conversions if necessary.
+ *
* @param src The source image.
* @param dst The destination image.
*/
@@ -434,21 +434,21 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
{
// This is done using Graphics2D in order to respect the rendering hints.
Graphics2D gg = dst.createGraphics();
-
+
// If no hints are set there is no need to call
// setRenderingHints on the Graphics2D object.
if (hints != null)
gg.setRenderingHints(hints);
-
+
gg.drawImage(src, 0, 0, null);
gg.dispose();
}
-
+
/**
* Copy a source raster to a destination raster, performing a colorspace
* conversion between the two. The conversion will respect the
* KEY_COLOR_RENDERING rendering hint if one is present.
- *
+ *
* @param src The source raster.
* @param scs The colorspace of the source raster.
* @dst The destination raster.
@@ -457,7 +457,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
private void copyraster(Raster src, ColorSpace scs, WritableRaster dst, ColorSpace dcs)
{
float[] sbuf = new float[src.getNumBands()];
-
+
if (hints != null
&& hints.get(RenderingHints.KEY_COLOR_RENDERING) ==
RenderingHints.VALUE_COLOR_RENDER_QUALITY)
@@ -466,7 +466,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
dst.setPixel(x, y,
- dcs.fromCIEXYZ(scs.toCIEXYZ(src.getPixel(x, y, sbuf))));
+ dcs.fromCIEXYZ(scs.toCIEXYZ(src.getPixel(x, y, sbuf))));
}
else
{
@@ -474,7 +474,7 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
dst.setPixel(x, y,
- dcs.fromRGB(scs.toRGB(src.getPixel(x, y, sbuf))));
+ dcs.fromRGB(scs.toRGB(src.getPixel(x, y, sbuf))));
}
}
@@ -482,31 +482,31 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
* This method creates a color model with the same colorspace and alpha
* settings as the source image. The created color model will always be a
* ComponentColorModel and have a BYTE transfer type.
- *
+ *
* @param img The source image.
* @param cs The ColorSpace to use.
* @return A color model compatible with the source image.
- */
+ */
private ColorModel createCompatibleColorModel(BufferedImage img, ColorSpace cs)
{
// The choice of ComponentColorModel and DataBuffer.TYPE_BYTE is based on
// Mauve testing of the reference implementation.
return new ComponentColorModel(cs,
- img.getColorModel().hasAlpha(),
+ img.getColorModel().hasAlpha(),
img.isAlphaPremultiplied(),
img.getColorModel().getTransparency(),
- DataBuffer.TYPE_BYTE);
+ DataBuffer.TYPE_BYTE);
}
/**
* This method creates a compatible Raster, given a source raster, colorspace,
* alpha value, and transfer type.
- *
+ *
* @param src The source raster.
* @param cs The ColorSpace to use.
* @param hasAlpha Whether the raster should include a component for an alpha.
* @param transferType The size of a single data element.
- * @return A compatible WritableRaster.
+ * @return A compatible WritableRaster.
*/
private WritableRaster createCompatibleDestRaster(Raster src, ColorSpace cs,
boolean hasAlpha,
@@ -514,11 +514,11 @@ public class ColorConvertOp implements BufferedImageOp, RasterOp
{
// The use of a PixelInterleavedSampleModel weas determined using mauve
// tests, based on the reference implementation
-
+
int numComponents = cs.getNumComponents();
if (hasAlpha)
numComponents++;
-
+
int[] offsets = new int[numComponents];
for (int i = 0; i < offsets.length; i++)
offsets[i] = i;
diff --git a/java/awt/image/ColorModel.java b/java/awt/image/ColorModel.java
index 005b8d45f..ede9e31d8 100644
--- a/java/awt/image/ColorModel.java
+++ b/java/awt/image/ColorModel.java
@@ -64,7 +64,7 @@ import java.util.Arrays;
*
* <li>sRGB pixel int value: a pixel in sRGB color space, encoded in
* default 0xAARRGGBB format, assumed not alpha premultiplied.</li>
- *
+ *
* <li>single [0, 255] scaled int samples from default sRGB color
* space. These are always assumed to be alpha non-premultiplied.</li>
*
@@ -109,10 +109,10 @@ public abstract class ColorModel implements Transparency
byte[] array = new byte[times];
java.util.Arrays.fill(array, value);
return array;
- }
+ }
/**
- * Constructs the default color model. The default color model
+ * Constructs the default color model. The default color model
* can be obtained by calling <code>getRGBdefault</code> of this
* class.
* @param bits the number of bits wide used for bit size of pixel values
@@ -120,12 +120,12 @@ public abstract class ColorModel implements Transparency
public ColorModel(int bits)
{
this(bits * 4, // total bits, sRGB, four channels
- nArray(bits, 4), // bits for each channel
- ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
- true, // has alpha
- false, // not premultiplied
- TRANSLUCENT,
- Buffers.smallestAppropriateTransferType(bits * 4));
+ nArray(bits, 4), // bits for each channel
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
+ true, // has alpha
+ false, // not premultiplied
+ TRANSLUCENT,
+ Buffers.smallestAppropriateTransferType(bits * 4));
}
/**
@@ -138,8 +138,8 @@ public abstract class ColorModel implements Transparency
* bits is less than 1 or if any of the elements in bits is less than 0.
*/
protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace,
- boolean hasAlpha, boolean isAlphaPremultiplied,
- int transparency, int transferType)
+ boolean hasAlpha, boolean isAlphaPremultiplied,
+ int transparency, int transferType)
{
int bits_sum = 0;
for (int i = 0; i < bits.length; i++)
@@ -149,7 +149,7 @@ public abstract class ColorModel implements Transparency
bits_sum |= bits [i];
}
-
+
if ((bits.length < cspace.getNumComponents())
|| (bits_sum < 1))
throw new IllegalArgumentException ();
@@ -162,7 +162,7 @@ public abstract class ColorModel implements Transparency
this.transparency = transparency;
this.transferType = transferType;
}
-
+
public void finalize()
{
// Do nothing here.
@@ -194,12 +194,12 @@ public abstract class ColorModel implements Transparency
{
return pixel_bits;
}
-
+
public int getComponentSize(int componentIdx)
{
return bits[componentIdx];
}
-
+
public int[] getComponentSize()
{
return bits;
@@ -240,7 +240,7 @@ public abstract class ColorModel implements Transparency
* @see #getRed(int)
*/
public abstract int getGreen(int pixel);
-
+
/**
* Converts pixel value to sRGB and extract blue int sample
* scaled to range [0, 255].
@@ -265,7 +265,7 @@ public abstract class ColorModel implements Transparency
*
* This method is typically overriden in subclasses to provide a
* more efficient implementation.
- *
+ *
* @param pixel pixel value that will be interpreted according to
* the color model.
*
@@ -273,13 +273,13 @@ public abstract class ColorModel implements Transparency
* 0xAARRGGBB format. */
public int getRGB(int pixel)
{
- return
+ return
((getAlpha(pixel) & 0xff) << 24) |
(( getRed(pixel) & 0xff) << 16) |
((getGreen(pixel) & 0xff) << 8) |
(( getBlue(pixel) & 0xff) << 0);
}
-
+
/**
* In this color model we know that the whole pixel value will
@@ -294,13 +294,13 @@ public abstract class ColorModel implements Transparency
return data.getElem(0);
}
- /**
+ /**
* Converts pixel in the given array to sRGB and extract blue int
* sample scaled to range [0-255].
*
* This method is typically overriden in subclasses to provide a
* more efficient implementation.
- *
+ *
* @param inData array of transferType containing a single pixel. The
* pixel should be encoded in the natural way of the color model.
*/
@@ -350,7 +350,7 @@ public abstract class ColorModel implements Transparency
*/
public int getRGB(Object inData)
{
- return
+ return
((getAlpha(inData) & 0xff) << 24) |
(( getRed(inData) & 0xff) << 16) |
((getGreen(inData) & 0xff) << 8) |
@@ -360,7 +360,7 @@ public abstract class ColorModel implements Transparency
/**
* Converts an sRGB pixel int value to an array containing a
* single pixel of the color space of the color model.
- *
+ *
* <p>This method performs the inverse function of
* <code>getRGB(Object inData)</code>.
*
@@ -379,7 +379,7 @@ public abstract class ColorModel implements Transparency
* <li>Scale the components to the correct number of bits.</li>
*
* <li>Arrange the components in the output array</li>
- *
+ *
* </ol>
*
* @param rgb The color to be converted to dataElements. A pixel
@@ -392,7 +392,7 @@ public abstract class ColorModel implements Transparency
*
* @return An array of transferType values representing the color,
* in the color model format. The color model defines whether the
- *
+ *
* @see #getRGB(Object)
*/
public Object getDataElements(int rgb, Object pixel)
@@ -404,11 +404,11 @@ public abstract class ColorModel implements Transparency
/**
* Fills an array with the unnormalized component samples from a
* pixel value. I.e. decompose the pixel, but not perform any
- * color conversion.
+ * color conversion.
*
* This method is typically overriden in subclasses to provide a
* more efficient implementation.
- *
+ *
* @param pixel pixel value encoded according to the color model.
*
* @return arrays of unnormalized component samples of single
@@ -421,7 +421,7 @@ public abstract class ColorModel implements Transparency
// subclasses has to implement this method.
throw new UnsupportedOperationException();
}
-
+
/**
* Fills an array with the unnormalized component samples from an
* array of transferType containing a single pixel. I.e. decompose
@@ -438,7 +438,7 @@ public abstract class ColorModel implements Transparency
* of the pixel. If this is null, a new array will be allocated
* @param offset index into the components array at which the result
* will be stored
- *
+ *
* @return arrays of unnormalized component samples of single
* pixel. The scale and multiplication state of the samples are
* according to the color model. Each component sample is stored
@@ -454,16 +454,16 @@ public abstract class ColorModel implements Transparency
* Convert normalized components to unnormalized components.
*/
public int[] getUnnormalizedComponents(float[] normComponents,
- int normOffset,
- int[] components,
- int offset)
+ int normOffset,
+ int[] components,
+ int offset)
{
int numComponents = getNumComponents();
if (components == null)
{
components = new int[offset + numComponents];
}
-
+
for (int i=0; i<numComponents; i++)
{
float in = normComponents[normOffset++];
@@ -477,9 +477,9 @@ public abstract class ColorModel implements Transparency
* Convert unnormalized components to normalized components.
*/
public float[] getNormalizedComponents(int[] components,
- int offset,
- float[] normComponents,
- int normOffset)
+ int offset,
+ float[] normComponents,
+ int normOffset)
{
int numComponents = getNumComponents();
if (normComponents == null)
@@ -513,10 +513,10 @@ public abstract class ColorModel implements Transparency
* Converts the unnormalized component samples from an array to a
* pixel value. I.e. composes the pixel from component samples, but
* does not perform any color conversion or scaling of the samples.
- *
+ *
* This method performs the inverse function of
* <code>getComponents(int pixel, int[] components,
- * int offset)</code>. I.e.
+ * int offset)</code>. I.e.
*
* <code>(pixel == cm.getDataElement(cm.getComponents(pixel, null,
* 0), 0))</code>.
@@ -542,7 +542,7 @@ public abstract class ColorModel implements Transparency
* Converts the normalized component samples from an array to a pixel
* value. I.e. composes the pixel from component samples, but does not
* perform any color conversion or scaling of the samples.
- *
+ *
* This method is typically overriden in subclasses to provide a
* more efficient implementation. The method provided by this abstract
* class converts the components to unnormalized form and returns
@@ -561,9 +561,9 @@ public abstract class ColorModel implements Transparency
{
return
getDataElement(getUnnormalizedComponents(components, offset, null, 0),
- 0);
+ 0);
}
-
+
public Object getDataElements(int[] components, int offset, Object obj)
{
// subclasses have to implement this method.
@@ -579,7 +579,7 @@ public abstract class ColorModel implements Transparency
* Otherwise the results are stored in obj and obj is returned. If obj is
* not long enough, ArrayIndexOutOfBounds is thrown. If obj is not an array
* of primitives, ClassCastException is thrown.
- *
+ *
* This method is typically overriden in subclasses to provide a
* more efficient implementation. The method provided by this abstract
* class converts the components to unnormalized form and returns
@@ -601,7 +601,7 @@ public abstract class ColorModel implements Transparency
{
return
getDataElements(getUnnormalizedComponents(components, offset, null, 0),
- 0, obj);
+ 0, obj);
}
public boolean equals(Object obj)
@@ -609,7 +609,7 @@ public abstract class ColorModel implements Transparency
if (!(obj instanceof ColorModel)) return false;
ColorModel o = (ColorModel) obj;
- return
+ return
(pixel_bits == o.pixel_bits) &&
(transferType == o.transferType) &&
(transparency == o.transparency) &&
@@ -632,7 +632,7 @@ public abstract class ColorModel implements Transparency
}
void coerceDataWorker(WritableRaster raster,
- boolean isAlphaPremultiplied)
+ boolean isAlphaPremultiplied)
{
int w = raster.getWidth();
int h = raster.getHeight();
@@ -659,12 +659,12 @@ public abstract class ColorModel implements Transparency
raster.setPixels(0, 0, w, h, pixels);
}
-
+
/**
* Checks if the given raster has a compatible data-layout (SampleModel).
* @param raster The Raster to test.
* @return true if raster is compatible.
- */
+ */
public boolean isCompatibleRaster(Raster raster)
{
SampleModel sampleModel = raster.getSampleModel();
@@ -675,7 +675,7 @@ public abstract class ColorModel implements Transparency
public WritableRaster createCompatibleWritableRaster(int w, int h)
{
return new WritableRaster(createCompatibleSampleModel(w, h),
- new Point(0, 0));
+ new Point(0, 0));
}
// Typically overridden
@@ -705,19 +705,19 @@ public abstract class ColorModel implements Transparency
public WritableRaster getAlphaRaster(WritableRaster raster)
{
return null;
-
+
/* It is a mystery to me why we couldn't use the following code...
-
-
+
+
if (!hasAlpha()) return null;
-
+
SampleModel sm = raster.getSampleModel();
int[] alphaBand = { sm.getNumBands() - 1 };
SampleModel alphaModel = sm.createSubsetSampleModel(alphaBand);
DataBuffer buffer = raster.getDataBuffer();
Point origin = new Point(0, 0);
return Raster.createWritableRaster(alphaModel, buffer, origin);
-
+
...here, and avoided overriding the method in subclasses,
but the Sun docs state that this method always will return
@@ -746,7 +746,7 @@ public abstract class ColorModel implements Transparency
private static class SRGBColorModel
extends DirectColorModel
{
-
+
SRGBColorModel()
{
super(32,0x00FF0000,0x0000FF00,0x000000FF,0xFF000000);
@@ -781,13 +781,13 @@ public abstract class ColorModel implements Transparency
{
if(pixel == null)
{
- pixel = new int[]{rgb};
+ pixel = new int[]{rgb};
}
else
{
- ((int[]) pixel)[0] = rgb;
+ ((int[]) pixel)[0] = rgb;
}
-
+
return pixel;
}
}
diff --git a/java/awt/image/ComponentColorModel.java b/java/awt/image/ComponentColorModel.java
index e1e85e191..ef0b84f00 100644
--- a/java/awt/image/ComponentColorModel.java
+++ b/java/awt/image/ComponentColorModel.java
@@ -54,7 +54,7 @@ public class ComponentColorModel extends ColorModel
sum += values[i];
return sum;
}
-
+
// Create an appropriate array of bits, given a colorspace (ie, number of
// bands), size of the storage data type, and presence of an alpha band.
private static int[] findBits(ColorSpace colorSpace, int transferType,
@@ -67,28 +67,28 @@ public class ComponentColorModel extends ColorModel
bits = new int[colorSpace.getNumComponents()];
Arrays.fill(bits, DataBuffer.getDataTypeSize(transferType));
-
+
return bits;
}
public ComponentColorModel(ColorSpace colorSpace, int[] bits,
- boolean hasAlpha,
- boolean isAlphaPremultiplied,
- int transparency, int transferType)
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied,
+ int transparency, int transferType)
{
super(sum(bits), bits, colorSpace, hasAlpha, isAlphaPremultiplied,
- transparency, transferType);
+ transparency, transferType);
}
/**
* Construct a new ComponentColorModel.
- *
+ *
* This constructor makes all bits of each sample significant, so for a
* transferType of DataBuffer.BYTE, the bits per sample is 8, etc. If
* both hasAlpha and isAlphaPremultiplied are true, color samples are
* assumed to be premultiplied by the alpha component. Transparency may be
- * one of OPAQUE, BITMASK, or TRANSLUCENT.
- *
+ * one of OPAQUE, BITMASK, or TRANSLUCENT.
+ *
* @param colorSpace The colorspace for this color model.
* @param hasAlpha True if there is an alpha component.
* @param isAlphaPremultiplied True if colors are already multiplied by
@@ -98,10 +98,10 @@ public class ComponentColorModel extends ColorModel
* @since 1.4
*/
public ComponentColorModel(ColorSpace colorSpace,
- boolean hasAlpha,
- boolean isAlphaPremultiplied,
- int transparency, int transferType)
- {
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied,
+ int transparency, int transferType)
+ {
this(colorSpace, findBits(colorSpace, transferType, hasAlpha), hasAlpha,
isAlphaPremultiplied, transparency, transferType);
}
@@ -117,7 +117,7 @@ public class ComponentColorModel extends ColorModel
if (getNumComponents()>1) throw new IllegalArgumentException();
return (int) getRGBFloat(pixel)[0];
}
-
+
public int getBlue(int pixel)
{
if (getNumComponents()>1) throw new IllegalArgumentException();
@@ -131,7 +131,7 @@ public class ComponentColorModel extends ColorModel
if (shift >= 0) return pixel << shift;
return pixel >> (-shift);
}
-
+
public int getRGB(int pixel)
{
float[] rgb = getRGBFloat(pixel);
@@ -143,7 +143,7 @@ public class ComponentColorModel extends ColorModel
/* Note, it's OK to pass a to large array to toRGB(). Extra
elements are ignored. */
-
+
private float[] getRGBFloat(int pixel)
{
float[] data = { pixel };
@@ -154,20 +154,20 @@ public class ComponentColorModel extends ColorModel
{
DataBuffer buffer =
Buffers.createBufferFromData(transferType, inData,
- getNumComponents());
+ getNumComponents());
int colors = getNumColorComponents();
float[] data = new float[colors];
-
+
// FIXME: unpremultiply data that is premultiplied
for (int i=0; i<colors; i++)
{
- float maxValue = (1<<getComponentSize(i))-1;
- data[i] = buffer.getElemFloat(i)/maxValue;
+ float maxValue = (1<<getComponentSize(i))-1;
+ data[i] = buffer.getElemFloat(i)/maxValue;
}
float[] rgb = cspace.toRGB(data);
return rgb;
}
-
+
public int getRed(Object inData)
{
return (int) getRGBFloat(inData)[0]*255;
@@ -187,7 +187,7 @@ public class ComponentColorModel extends ColorModel
{
DataBuffer buffer =
Buffers.createBufferFromData(transferType, inData,
- getNumComponents());
+ getNumComponents());
int shift = 8 - getComponentSize(getNumColorComponents());
int alpha = buffer.getElem(getNumColorComponents());
if (shift >= 0) return alpha << shift;
@@ -200,7 +200,7 @@ public class ComponentColorModel extends ColorModel
avoid bits spilling over from one bit field to
another. But, if we assume that floats are in the [0.0,
1.0] range, this will never happen anyway. */
-
+
/* Remember to multiply BEFORE casting to int, otherwise, decimal
point data will be lost. */
int ret =
@@ -234,30 +234,30 @@ public class ComponentColorModel extends ColorModel
// Convert from rgb to color space components.
float[] data = cspace.fromRGB(rgbFloats);
DataBuffer buffer = Buffers.createBuffer(transferType, pixel,
- getNumComponents());
+ getNumComponents());
int numColors = getNumColorComponents();
-
+
if (hasAlpha())
{
- float alpha = ((rgb >> 24)&0xff)/255.0F;
-
- /* If color model has alpha and should be premultiplied, multiply
- color space components with alpha value. */
- if (isAlphaPremultiplied()) {
- for (int i=0; i<numColors; i++)
- data[i] *= alpha;
- }
- // Scale the alpha sample to the correct number of bits.
- alpha *= (1<<(bits[numColors]-1));
- // Arrange the alpha sample in the output array.
- buffer.setElemFloat(numColors, alpha);
+ float alpha = ((rgb >> 24)&0xff)/255.0F;
+
+ /* If color model has alpha and should be premultiplied, multiply
+ color space components with alpha value. */
+ if (isAlphaPremultiplied()) {
+ for (int i=0; i<numColors; i++)
+ data[i] *= alpha;
+ }
+ // Scale the alpha sample to the correct number of bits.
+ alpha *= (1<<(bits[numColors]-1));
+ // Arrange the alpha sample in the output array.
+ buffer.setElemFloat(numColors, alpha);
}
for (int i=0; i<numColors; i++)
{
- // Scale the color samples to the correct number of bits.
- float value = data[i]*(1<<(bits[i]-1));
- // Arrange the color samples in the output array.
- buffer.setElemFloat(i, value);
+ // Scale the color samples to the correct number of bits.
+ float value = data[i]*(1<<(bits[i]-1));
+ // Arrange the color samples in the output array.
+ buffer.setElemFloat(i, value);
}
return Buffers.getData(buffer);
}
@@ -274,7 +274,7 @@ public class ComponentColorModel extends ColorModel
public int[] getComponents(Object pixel, int[] components, int offset)
{
DataBuffer buffer = Buffers.createBuffer(transferType, pixel,
- getNumComponents());
+ getNumComponents());
int numComponents = getNumComponents();
if (components == null)
@@ -295,7 +295,7 @@ public class ComponentColorModel extends ColorModel
public Object getDataElements(int[] components, int offset, Object obj)
{
DataBuffer buffer = Buffers.createBuffer(transferType, obj,
- getNumComponents());
+ getNumComponents());
int numComponents = getNumComponents();
for (int i=0; i<numComponents; i++)
@@ -305,7 +305,7 @@ public class ComponentColorModel extends ColorModel
}
public ColorModel coerceData(WritableRaster raster,
- boolean isAlphaPremultiplied) {
+ boolean isAlphaPremultiplied) {
if (this.isAlphaPremultiplied == isAlphaPremultiplied || !hasAlpha())
return this;
@@ -313,7 +313,7 @@ public class ComponentColorModel extends ColorModel
assumptions we can make due to the specific type of the
color model. */
coerceDataWorker(raster, isAlphaPremultiplied);
-
+
return new ComponentColorModel(cspace, hasAlpha, isAlphaPremultiplied,
transparency, transferType);
}
@@ -383,7 +383,7 @@ public class ComponentColorModel extends ColorModel
public boolean isCompatibleSampleModel(SampleModel sm)
{
- return
+ return
(sm instanceof ComponentSampleModel) &&
super.isCompatibleSampleModel(sm);
}
@@ -391,7 +391,7 @@ public class ComponentColorModel extends ColorModel
public WritableRaster getAlphaRaster(WritableRaster raster)
{
if (!hasAlpha()) return null;
-
+
SampleModel sm = raster.getSampleModel();
int[] alphaBand = { sm.getNumBands() - 1 };
SampleModel alphaModel = sm.createSubsetSampleModel(alphaBand);
@@ -399,7 +399,7 @@ public class ComponentColorModel extends ColorModel
Point origin = new Point(0, 0);
return Raster.createWritableRaster(alphaModel, buffer, origin);
}
-
+
public boolean equals(Object obj)
{
if (!(obj instanceof ComponentColorModel)) return false;
diff --git a/java/awt/image/ComponentSampleModel.java b/java/awt/image/ComponentSampleModel.java
index 73e7fb4d3..f32eae319 100644
--- a/java/awt/image/ComponentSampleModel.java
+++ b/java/awt/image/ComponentSampleModel.java
@@ -60,65 +60,65 @@ public class ComponentSampleModel extends SampleModel
{
/** The offsets to the first sample for each band. */
protected int[] bandOffsets;
-
+
/** The indices of the bank used to store each band in a data buffer. */
protected int[] bankIndices;
-
- /**
+
+ /**
* The number of bands in the image.
* @specnote This field shadows the protected numBands in SampleModel.
*/
protected int numBands;
-
+
/** Used when creating data buffers. */
protected int numBanks;
- /**
- * The number of data elements between a sample in one row and the
+ /**
+ * The number of data elements between a sample in one row and the
* corresponding sample in the next row.
*/
protected int scanlineStride;
-
+
/**
- * The number of data elements between a sample for one pixel and the
+ * The number of data elements between a sample for one pixel and the
* corresponding sample for the next pixel in the same row.
*/
protected int pixelStride;
/**
- * Creates a new sample model that assumes that all bands are stored in a
+ * Creates a new sample model that assumes that all bands are stored in a
* single bank of the {@link DataBuffer}.
* <p>
* Note that the <code>bandOffsets</code> array is copied to internal storage
* to prevent subsequent changes to the array from affecting this object.
- *
+ *
* @param dataType the data type (one of {@link DataBuffer#TYPE_BYTE},
* {@link DataBuffer#TYPE_USHORT}, {@link DataBuffer#TYPE_SHORT},
- * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT} or
+ * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT} or
* {@link DataBuffer#TYPE_DOUBLE}).
* @param w the width in pixels.
* @param h the height in pixels.
* @param pixelStride the number of data elements in the step from a sample
* in one pixel to the corresponding sample in the next pixel.
- * @param scanlineStride the number of data elements in the step from a
+ * @param scanlineStride the number of data elements in the step from a
* sample in a pixel to the corresponding sample in the pixel in the next
* row.
- * @param bandOffsets the offset to the first element for each band, with
+ * @param bandOffsets the offset to the first element for each band, with
* the size of the array defining the number of bands (<code>null</code>
* not permitted).
- *
+ *
* @throws IllegalArgumentException if <code>dataType</code> is not one of
* the specified values.
* @throws IllegalArgumentException if <code>w</code> is less than or equal
* to zero.
- * @throws IllegalArgumentException if <code>h</code> is less than or equal
+ * @throws IllegalArgumentException if <code>h</code> is less than or equal
* to zero.
* @throws IllegalArgumentException if <code>w * h</code> exceeds
* {@link Integer#MAX_VALUE}.
* @throws IllegalArgumentException if <code>pixelStride</code> is negative.
- * @throws IllegalArgumentException if <code>scanlineStride</code> is less
+ * @throws IllegalArgumentException if <code>scanlineStride</code> is less
* than or equal to zero.
- * @throws IllegalArgumentException if <code>bandOffsets</code> has zero
+ * @throws IllegalArgumentException if <code>bandOffsets</code> has zero
* length.
*/
public ComponentSampleModel(int dataType,
@@ -130,43 +130,43 @@ public class ComponentSampleModel extends SampleModel
this(dataType, w, h, pixelStride, scanlineStride,
new int[bandOffsets.length], bandOffsets);
}
-
+
/**
- * Creates a new sample model that assumes that all bands are stored in a
+ * Creates a new sample model that assumes that all bands are stored in a
* single bank of the {@link DataBuffer}.
- *
+ *
* @param dataType the data type (one of {@link DataBuffer#TYPE_BYTE},
* {@link DataBuffer#TYPE_USHORT}, {@link DataBuffer#TYPE_SHORT},
- * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT} or
+ * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT} or
* {@link DataBuffer#TYPE_DOUBLE}).
* @param w the width in pixels.
* @param h the height in pixels.
* @param pixelStride the number of data elements in the step from a sample
* in one pixel to the corresponding sample in the next pixel.
- * @param scanlineStride the number of data elements in the step from a
+ * @param scanlineStride the number of data elements in the step from a
* sample in a pixel to the corresponding sample in the pixel in the next
* row.
- * @param bankIndices the index of the bank in which each band is stored
+ * @param bankIndices the index of the bank in which each band is stored
* (<code>null</code> not permitted). This array is copied to internal
- * storage so that subsequent updates to the array do not affect the sample
+ * storage so that subsequent updates to the array do not affect the sample
* model.
- * @param bandOffsets the offset to the first element for each band, with
+ * @param bandOffsets the offset to the first element for each band, with
* the size of the array defining the number of bands (<code>null</code>
- * not permitted). This array is copied to internal storage so that
+ * not permitted). This array is copied to internal storage so that
* subsequent updates to the array do not affect the sample model.
- *
+ *
* @throws IllegalArgumentException if <code>dataType</code> is not one of
* the specified values.
* @throws IllegalArgumentException if <code>w</code> is less than or equal
* to zero.
- * @throws IllegalArgumentException if <code>h</code> is less than or equal
+ * @throws IllegalArgumentException if <code>h</code> is less than or equal
* to zero.
* @throws IllegalArgumentException if <code>w * h</code> exceeds
* {@link Integer#MAX_VALUE}.
* @throws IllegalArgumentException if <code>pixelStride</code> is negative.
- * @throws IllegalArgumentException if <code>scanlineStride</code> is less
+ * @throws IllegalArgumentException if <code>scanlineStride</code> is less
* than or equal to zero.
- * @throws IllegalArgumentException if <code>bandOffsets</code> has zero
+ * @throws IllegalArgumentException if <code>bandOffsets</code> has zero
* length.
*/
public ComponentSampleModel(int dataType,
@@ -177,15 +177,15 @@ public class ComponentSampleModel extends SampleModel
int[] bandOffsets)
{
super(dataType, w, h, bandOffsets.length);
-
+
// super permits DataBuffer.TYPE_UNDEFINED but this class doesn't...
if (dataType == DataBuffer.TYPE_UNDEFINED)
throw new IllegalArgumentException("Unsupported dataType.");
-
- if ((pixelStride < 0) || (scanlineStride < 0) || (bandOffsets.length < 1)
+
+ if ((pixelStride < 0) || (scanlineStride < 0) || (bandOffsets.length < 1)
|| (bandOffsets.length != bankIndices.length))
throw new IllegalArgumentException();
-
+
this.bandOffsets = (int[]) bandOffsets.clone();
this.bankIndices = (int[]) bankIndices.clone();
this.numBands = bandOffsets.length;
@@ -197,15 +197,15 @@ public class ComponentSampleModel extends SampleModel
this.scanlineStride = scanlineStride;
this.pixelStride = pixelStride;
- }
+ }
/**
* Creates a new sample model that is compatible with this one, but with the
* specified dimensions.
- *
+ *
* @param w the width (must be greater than zero).
* @param h the height (must be greater than zero).
- *
+ *
* @return A new sample model.
*/
public SampleModel createCompatibleSampleModel(int w, int h)
@@ -218,15 +218,15 @@ public class ComponentSampleModel extends SampleModel
/**
* Creates a new sample model that provides access to a subset of the bands
* that this sample model supports.
- *
+ *
* @param bands the bands (<code>null</code> not permitted).
- *
+ *
* @return The new sample model.
*/
public SampleModel createSubsetSampleModel(int[] bands)
{
int numBands = bands.length;
-
+
int[] bankIndices = new int[numBands];
int[] bandOffsets = new int[numBands];
for (int b = 0; b < numBands; b++)
@@ -242,7 +242,7 @@ public class ComponentSampleModel extends SampleModel
/**
* Creates a new data buffer that is compatible with this sample model.
- *
+ *
* @return The new data buffer.
*/
public DataBuffer createDataBuffer()
@@ -250,8 +250,8 @@ public class ComponentSampleModel extends SampleModel
// Maybe this value should be precalculated in the constructor?
int highestOffset = 0;
for (int b = 0; b < numBands; b++)
- highestOffset = Math.max(highestOffset, bandOffsets[b]);
- int size = pixelStride * (width - 1) + scanlineStride * (height - 1)
+ highestOffset = Math.max(highestOffset, bandOffsets[b]);
+ int size = pixelStride * (width - 1) + scanlineStride * (height - 1)
+ highestOffset + 1;
DataBuffer buffer = null;
@@ -283,12 +283,12 @@ public class ComponentSampleModel extends SampleModel
* Returns the offset of the sample in band 0 for the pixel at location
* <code>(x, y)</code>. This offset can be used to read a sample value from
* a {@link DataBuffer}.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
- *
+ *
* @return The offset.
- *
+ *
* @see #getOffset(int, int, int)
*/
public int getOffset(int x, int y)
@@ -300,11 +300,11 @@ public class ComponentSampleModel extends SampleModel
* Returns the offset of the sample in band <code>b</code> for the pixel at
* location <code>(x, y)</code>. This offset can be used to read a sample
* value from a {@link DataBuffer}.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param b the band index.
- *
+ *
* @return The offset.
*/
public int getOffset(int x, int y, int b)
@@ -316,9 +316,9 @@ public class ComponentSampleModel extends SampleModel
* Returns the size in bits for each sample (one per band). For this sample
* model, each band has the same sample size and this is determined by the
* data type for the sample model.
- *
+ *
* @return The sample sizes.
- *
+ *
* @see SampleModel#getDataType()
*/
public final int[] getSampleSize()
@@ -332,13 +332,13 @@ public class ComponentSampleModel extends SampleModel
/**
* Returns the size in bits for the samples in the specified band. In this
- * class, the sample size is the same for every band and is determined from
+ * class, the sample size is the same for every band and is determined from
* the data type for the model.
- *
+ *
* @param band the band index (ignored here).
- *
+ *
* @return The sample size in bits.
- *
+ *
* @see SampleModel#getDataType()
*/
public final int getSampleSize(int band)
@@ -347,10 +347,10 @@ public class ComponentSampleModel extends SampleModel
}
/**
- * Returns the indices of the bank(s) in the {@link DataBuffer} used to
+ * Returns the indices of the bank(s) in the {@link DataBuffer} used to
* store the samples for each band. The returned array is a copy, so that
* altering it will not impact the sample model.
- *
+ *
* @return The bank indices.
*/
public final int[] getBankIndices()
@@ -361,7 +361,7 @@ public class ComponentSampleModel extends SampleModel
/**
* Returns the offsets to the first sample in each band. The returned array
* is a copy, so that altering it will not impact the sample model.
- *
+ *
* @return The offsets.
*/
public final int[] getBandOffsets()
@@ -371,10 +371,10 @@ public class ComponentSampleModel extends SampleModel
/**
* Returns the distance (in terms of element indices) between the sample for
- * one pixel and the corresponding sample for the equivalent pixel in the
+ * one pixel and the corresponding sample for the equivalent pixel in the
* next row. This is used in the calculation of the element offset for
* retrieving samples from a {@link DataBuffer}.
- *
+ *
* @return The distance between pixel samples in consecutive rows.
*/
public final int getScanlineStride()
@@ -383,11 +383,11 @@ public class ComponentSampleModel extends SampleModel
}
/**
- * Returns the distance (in terms of element indices) between the sample for
- * one pixel and the corresponding sample for the next pixel in a row. This
- * is used in the calculation of the element offset for retrieving samples
+ * Returns the distance (in terms of element indices) between the sample for
+ * one pixel and the corresponding sample for the next pixel in a row. This
+ * is used in the calculation of the element offset for retrieving samples
* from a {@link DataBuffer}.
- *
+ *
* @return The distance between pixel samples in the same row.
*/
public final int getPixelStride()
@@ -396,10 +396,10 @@ public class ComponentSampleModel extends SampleModel
}
/**
- * Returns the number of data elements used to store the samples for one
+ * Returns the number of data elements used to store the samples for one
* pixel. In this model, this is the same as the number of bands.
- *
- * @return The number of data elements used to store the samples for one
+ *
+ * @return The number of data elements used to store the samples for one
* pixel.
*/
public final int getNumDataElements()
@@ -409,17 +409,17 @@ public class ComponentSampleModel extends SampleModel
/**
* Returns the samples for the pixel at location <code>(x, y)</code> in
- * a primitive array (the array type is determined by the data type for
+ * a primitive array (the array type is determined by the data type for
* this model). The <code>obj</code> argument provides an option to supply
* an existing array to hold the result, if this is <code>null</code> a new
* array will be allocated.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
- * @param obj a primitive array that, if not <code>null</code>, will be
+ * @param obj a primitive array that, if not <code>null</code>, will be
* used to store and return the sample values.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return An array of sample values for the specified pixel.
*/
public Object getDataElements(int x, int y, Object obj, DataBuffer data)
@@ -502,23 +502,23 @@ public class ComponentSampleModel extends SampleModel
/**
* Returns all the samples for the pixel at location <code>(x, y)</code>
* stored in the specified data buffer.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param iArray an array that will be populated with the sample values and
- * returned as the result. The size of this array should be equal to the
+ * returned as the result. The size of this array should be equal to the
* number of bands in the model. If the array is <code>null</code>, a new
* array is created.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The samples for the specified pixel.
- *
+ *
* @see #setPixel(int, int, int[], DataBuffer)
*/
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
{
if (x < 0 || x >= width || y < 0 || y >= height)
- throw new ArrayIndexOutOfBoundsException("Pixel (" + x + ", " + y
+ throw new ArrayIndexOutOfBoundsException("Pixel (" + x + ", " + y
+ ") is out of bounds.");
int offset = pixelStride * x + scanlineStride * y;
if (iArray == null)
@@ -532,22 +532,22 @@ public class ComponentSampleModel extends SampleModel
/**
* Returns the samples for all the pixels in a rectangular region.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param w the width.
* @param h the height.
- * @param iArray an array that if non-<code>null</code> will be populated
+ * @param iArray an array that if non-<code>null</code> will be populated
* with the sample values and returned as the result.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The samples for all the pixels in the rectangle.
*/
public int[] getPixels(int x, int y, int w, int h, int[] iArray,
DataBuffer data)
{
int offset = pixelStride * x + scanlineStride * y;
- if (iArray == null)
+ if (iArray == null)
iArray = new int[numBands * w * h];
int outOffset = 0;
for (y = 0; y < h; y++)
@@ -557,7 +557,7 @@ public class ComponentSampleModel extends SampleModel
{
for (int b = 0; b < numBands; b++)
{
- iArray[outOffset++]
+ iArray[outOffset++]
= data.getElem(bankIndices[b], lineOffset+bandOffsets[b]);
}
lineOffset += pixelStride;
@@ -566,41 +566,41 @@ public class ComponentSampleModel extends SampleModel
}
return iArray;
}
-
+
/**
- * Returns the sample for band <code>b</code> of the pixel at
+ * Returns the sample for band <code>b</code> of the pixel at
* <code>(x, y)</code> that is stored in the specified data buffer.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param b the band index.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
- * @throws ArrayIndexOutOfBoundsException if <code>(x, y)</code> is outside
+ *
+ * @throws ArrayIndexOutOfBoundsException if <code>(x, y)</code> is outside
* the bounds <code>[0, 0, width, height]</code>.
- *
+ *
* @see #setSample(int, int, int, int, DataBuffer)
*/
public int getSample(int x, int y, int b, DataBuffer data)
{
if (x < 0 || x >= width || y < 0 || y >= height)
- throw new ArrayIndexOutOfBoundsException("Sample (" + x + ", " + y
+ throw new ArrayIndexOutOfBoundsException("Sample (" + x + ", " + y
+ ") is out of bounds.");
return data.getElem(bankIndices[b], getOffset(x, y, b));
}
/**
- * Sets the samples for the pixel at location <code>(x, y)</code> from the
- * supplied primitive array (the array type must be consistent with the data
+ * Sets the samples for the pixel at location <code>(x, y)</code> from the
+ * supplied primitive array (the array type must be consistent with the data
* type for this model).
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param obj a primitive array containing the pixel's sample values.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @see #setDataElements(int, int, Object, DataBuffer)
*/
public void setDataElements(int x, int y, Object obj, DataBuffer data)
@@ -652,16 +652,16 @@ public class ComponentSampleModel extends SampleModel
break;
}
}
-
+
/**
* Sets the sample values for the pixel at location <code>(x, y)</code>
* stored in the specified data buffer.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param iArray the pixel sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @see #getPixel(int, int, int[], DataBuffer)
*/
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
@@ -670,24 +670,24 @@ public class ComponentSampleModel extends SampleModel
for (int b = 0; b < numBands; b++)
data.setElem(bankIndices[b], offset + bandOffsets[b], iArray[b]);
}
-
+
/**
* Sets the sample value for band <code>b</code> of the pixel at location
* <code>(x, y)</code> in the specified data buffer.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param b the band index.
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @see #getSample(int, int, int, DataBuffer)
*/
public void setSample(int x, int y, int b, int s, DataBuffer data)
{
data.setElem(bankIndices[b], getOffset(x, y, b), s);
}
-
+
/**
* Tests this sample model for equality with an arbitrary object. Returns
* <code>true</code> if and only if:
@@ -700,10 +700,10 @@ public class ComponentSampleModel extends SampleModel
* <code>scanlineStride</code>, <code>bandOffsets</code> and
* <code>bankIndices</code> fields.</li>
* </ul>
- *
+ *
* @param obj the object to test (<code>null</code> permitted).
- *
- * @return <code>true</code> if this sample model is equal to
+ *
+ * @return <code>true</code> if this sample model is equal to
* <code>obj</code>, and <code>false</code> otherwise.
*/
public boolean equals(Object obj)
@@ -730,10 +730,10 @@ public class ComponentSampleModel extends SampleModel
// couldn't find any difference, so...
return true;
}
-
+
/**
* Returns a hash code for this sample model.
- *
+ *
* @return The hash code.
*/
public int hashCode()
diff --git a/java/awt/image/ConvolveOp.java b/java/awt/image/ConvolveOp.java
index cf30e7625..10b85f446 100644
--- a/java/awt/image/ConvolveOp.java
+++ b/java/awt/image/ConvolveOp.java
@@ -44,58 +44,58 @@ import java.awt.geom.Rectangle2D;
/**
* Convolution filter.
- *
+ *
* ConvolveOp convolves the source image with a Kernel to generate a
* destination image. This involves multiplying each pixel and its neighbors
* with elements in the kernel to compute a new pixel.
- *
+ *
* Each band in a Raster is convolved and copied to the destination Raster.
- * For BufferedImages, convolution is applied to all components. Color
+ * For BufferedImages, convolution is applied to all components. Color
* conversion will be applied if needed.
- *
+ *
* Note that this filter ignores whether the source or destination is alpha
* premultiplied. The reference spec states that data will be premultiplied
* prior to convolving and divided back out afterwards (if needed), but testing
* has shown that this is not the case with their implementation.
- *
+ *
* @author jlquinn@optonline.net
*/
public class ConvolveOp implements BufferedImageOp, RasterOp
{
/** Edge pixels are set to 0. */
public static final int EDGE_ZERO_FILL = 0;
-
+
/** Edge pixels are copied from the source. */
public static final int EDGE_NO_OP = 1;
-
+
private Kernel kernel;
private int edge;
private RenderingHints hints;
/**
* Construct a ConvolveOp.
- *
+ *
* The edge condition specifies that pixels outside the area that can be
* filtered are either set to 0 or copied from the source image.
- *
+ *
* @param kernel The kernel to convolve with.
* @param edgeCondition Either EDGE_ZERO_FILL or EDGE_NO_OP.
* @param hints Rendering hints for color conversion, or null.
*/
public ConvolveOp(Kernel kernel,
- int edgeCondition,
- RenderingHints hints)
+ int edgeCondition,
+ RenderingHints hints)
{
this.kernel = kernel;
edge = edgeCondition;
this.hints = hints;
}
-
+
/**
* Construct a ConvolveOp.
- *
+ *
* The edge condition defaults to EDGE_ZERO_FILL.
- *
+ *
* @param kernel The kernel to convolve with.
*/
public ConvolveOp(Kernel kernel)
@@ -108,8 +108,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
/**
* Converts the source image using the kernel specified in the
* constructor. The resulting image is stored in the destination image if one
- * is provided; otherwise a new BufferedImage is created and returned.
- *
+ * is provided; otherwise a new BufferedImage is created and returned.
+ *
* The source and destination BufferedImage (if one is supplied) must have
* the same dimensions.
*
@@ -124,10 +124,10 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
if (src == dst)
throw new IllegalArgumentException("Source and destination images " +
"cannot be the same.");
-
+
if (dst == null)
dst = createCompatibleDestImage(src, src.getColorModel());
-
+
// Make sure source image is premultiplied
BufferedImage src1 = src;
// The spec says we should do this, but mauve testing shows that Sun's
@@ -146,15 +146,15 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
dst1 = createCompatibleDestImage(src, src.getColorModel());
filter(src1.getRaster(), dst1.getRaster());
-
+
// Since we don't coerceData above, we don't need to divide it back out.
// This is wrong (one mauve test specifically tests converting a non-
// premultiplied image to a premultiplied image, and it shows that Sun
// simply ignores the premultipled flag, contrary to the spec), but we
// mimic it for compatibility.
/*
- if (! dst.isAlphaPremultiplied())
- dst1.coerceData(false);
+ if (! dst.isAlphaPremultiplied())
+ dst1.coerceData(false);
*/
// Convert between color models if needed
@@ -166,7 +166,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
/**
* Creates an empty BufferedImage with the size equal to the source and the
- * correct number of bands. The new image is created with the specified
+ * correct number of bands. The new image is created with the specified
* ColorModel, or if no ColorModel is supplied, an appropriate one is chosen.
*
* @param src The source image.
@@ -191,17 +191,17 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
{
return hints;
}
-
+
/**
* Get the edge condition for this Op.
- *
+ *
* @return The edge condition.
*/
public int getEdgeCondition()
{
return edge;
}
-
+
/**
* Returns (a clone of) the convolution kernel.
*
@@ -213,13 +213,13 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
}
/**
- * Converts the source raster using the kernel specified in the constructor.
- * The resulting raster is stored in the destination raster if one is
+ * Converts the source raster using the kernel specified in the constructor.
+ * The resulting raster is stored in the destination raster if one is
* provided; otherwise a new WritableRaster is created and returned.
- *
+ *
* If the convolved value for a sample is outside the range of [0-255], it
* will be clipped.
- *
+ *
* The source and destination raster (if one is supplied) cannot be the same,
* and must also have the same dimensions.
*
@@ -233,7 +233,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
{
if (src == dest)
throw new IllegalArgumentException("src == dest is not allowed.");
- if (kernel.getWidth() > src.getWidth()
+ if (kernel.getWidth() > src.getWidth()
|| kernel.getHeight() > src.getHeight())
throw new ImagingOpException("The kernel is too large.");
if (dest == null)
@@ -248,12 +248,12 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
int right = Math.max(kWidth - left - 1, 0);
int top = kernel.getYOrigin();
int bottom = Math.max(kHeight - top - 1, 0);
-
+
// Calculate max sample values for clipping
int[] maxValue = src.getSampleModel().getSampleSize();
for (int i = 0; i < maxValue.length; i++)
maxValue[i] = (int)Math.pow(2, maxValue[i]) - 1;
-
+
// process the region that is reachable...
int regionW = src.width - left - right;
int regionH = src.height - top - bottom;
@@ -271,8 +271,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
src.getSamples(x, y, kWidth, kHeight, b, tmp);
for (int i = 0; i < tmp.length; i++)
v += tmp[tmp.length - i - 1] * kvals[i];
- // FIXME: in the above line, I've had to reverse the order of
- // the samples array to make the tests pass. I haven't worked
+ // FIXME: in the above line, I've had to reverse the order of
+ // the samples array to make the tests pass. I haven't worked
// out why this is necessary.
// This clipping is is undocumented, but determined by testing.
@@ -281,34 +281,34 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
else if (v < 0)
v = 0;
- dest.setSample(x + kernel.getXOrigin(), y + kernel.getYOrigin(),
+ dest.setSample(x + kernel.getXOrigin(), y + kernel.getYOrigin(),
b, v);
}
}
}
-
+
// fill in the top border
fillEdge(src, dest, 0, 0, src.width, top, edge);
-
+
// fill in the bottom border
fillEdge(src, dest, 0, src.height - bottom, src.width, bottom, edge);
-
+
// fill in the left border
fillEdge(src, dest, 0, top, left, regionH, edge);
-
+
// fill in the right border
fillEdge(src, dest, src.width - right, top, right, regionH, edge);
-
- return dest;
+
+ return dest;
}
-
+
/**
* Fills a range of pixels (typically at the edge of a raster) with either
- * zero values (if <code>edgeOp</code> is <code>EDGE_ZERO_FILL</code>) or the
+ * zero values (if <code>edgeOp</code> is <code>EDGE_ZERO_FILL</code>) or the
* corresponding pixel values from the source raster (if <code>edgeOp</code>
- * is <code>EDGE_NO_OP</code>). This utility method is called by the
+ * is <code>EDGE_NO_OP</code>). This utility method is called by the
* {@link #fillEdge(Raster, WritableRaster, int, int, int, int, int)} method.
- *
+ *
* @param src the source raster.
* @param dest the destination raster.
* @param x the x-coordinate of the top left pixel in the range.
@@ -318,8 +318,8 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
* @param edgeOp indicates how to determine the values for the range
* (either {@link #EDGE_ZERO_FILL} or {@link #EDGE_NO_OP}).
*/
- private void fillEdge(Raster src, WritableRaster dest, int x, int y, int w,
- int h, int edgeOp)
+ private void fillEdge(Raster src, WritableRaster dest, int x, int y, int w,
+ int h, int edgeOp)
{
if (w <= 0)
return;
@@ -328,7 +328,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
if (edgeOp == EDGE_ZERO_FILL) // fill region with zeroes
{
float[] zeros = new float[src.getNumBands() * w * h];
- dest.setPixels(x, y, w, h, zeros);
+ dest.setPixels(x, y, w, h, zeros);
}
else // copy pixels from source
{
@@ -366,7 +366,7 @@ public class ConvolveOp implements BufferedImageOp, RasterOp
* Returns the corresponding destination point for a source point. Because
* this is not a geometric operation, the destination and source points will
* be identical.
- *
+ *
* @param src The source point.
* @param dst The transformed destination point.
* @return The transformed destination point.
diff --git a/java/awt/image/CropImageFilter.java b/java/awt/image/CropImageFilter.java
index 53b415620..4d8fb624f 100644
--- a/java/awt/image/CropImageFilter.java
+++ b/java/awt/image/CropImageFilter.java
@@ -44,7 +44,7 @@ import java.util.Hashtable;
/**
* Currently this filter does almost nothing and needs to be implemented.
*
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public class CropImageFilter extends ImageFilter
{
@@ -62,10 +62,10 @@ public class CropImageFilter extends ImageFilter
* @param height the height of the cropped rectangle
*/
public CropImageFilter(int x, int y, int width, int height) {
- this.x = x;
- this.y = y;
- this.width = width;
- this.height = height;
+ this.x = x;
+ this.y = y;
+ this.width = width;
+ this.height = height;
}
/**
@@ -73,14 +73,14 @@ public class CropImageFilter extends ImageFilter
* being produced using this method. This filter overrides this
* method in order to set the dimentions to the size of the
* cropped rectangle instead of the size of the image.
- *
+ *
* @param width the width of the image
- * @param height the height of the image
+ * @param height the height of the image
*/
public void setDimensions(int width, int height)
{
if (consumer != null)
- consumer.setDimensions(this.width, this.height);
+ consumer.setDimensions(this.width, this.height);
}
/**
@@ -89,7 +89,7 @@ public class CropImageFilter extends ImageFilter
* <br>
* FIXME - What property is set for this class?
*
- * @param props the list of properties associated with this image
+ * @param props the list of properties associated with this image
*/
public void setProperties(Hashtable<?, ?> props)
{
@@ -102,7 +102,7 @@ public class CropImageFilter extends ImageFilter
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as a <code>byte</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -113,37 +113,37 @@ public class CropImageFilter extends ImageFilter
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize)
+ public void setPixels(int x, int y, int w, int h,
+ ColorModel model, byte[] pixels, int offset, int scansize)
{
- Rectangle filterBounds = new Rectangle(this.x, this.y,
- this.width, this.height);
- Rectangle pixelBounds = new Rectangle(x, y, w, h);
-
- if (filterBounds.intersects(pixelBounds))
- {
- Rectangle bounds = filterBounds.intersection(pixelBounds);
-
- byte[] cropped = new byte[bounds.width * bounds.height];
- for (int i = 0; i < bounds.height; i++)
- {
- int start = (bounds.y - pixelBounds.y + i) * scansize + offset;
-
- for (int j = 0; j < bounds.width; j++)
- cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
- }
-
- if (consumer != null)
- consumer.setPixels(0, 0,
- bounds.width, bounds.height,
- model, cropped, 0, bounds.width);
- }
+ Rectangle filterBounds = new Rectangle(this.x, this.y,
+ this.width, this.height);
+ Rectangle pixelBounds = new Rectangle(x, y, w, h);
+
+ if (filterBounds.intersects(pixelBounds))
+ {
+ Rectangle bounds = filterBounds.intersection(pixelBounds);
+
+ byte[] cropped = new byte[bounds.width * bounds.height];
+ for (int i = 0; i < bounds.height; i++)
+ {
+ int start = (bounds.y - pixelBounds.y + i) * scansize + offset;
+
+ for (int j = 0; j < bounds.width; j++)
+ cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
+ }
+
+ if (consumer != null)
+ consumer.setPixels(0, 0,
+ bounds.width, bounds.height,
+ model, cropped, 0, bounds.width);
+ }
}
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as an <code>int</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -154,32 +154,31 @@ public class CropImageFilter extends ImageFilter
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
+ public void setPixels(int x, int y, int w, int h,
ColorModel model, int[] pixels, int offset, int scansize)
{
- Rectangle filterBounds = new Rectangle(this.x, this.y,
- this.width, this.height);
- Rectangle pixelBounds = new Rectangle(x, y, w, h);
-
- if (filterBounds.intersects(pixelBounds))
- {
- Rectangle bounds = filterBounds.intersection(pixelBounds);
-
- int[] cropped = new int[bounds.width * bounds.height];
- for (int i = 0; i < bounds.height; i++)
- {
- int start = (bounds.y - pixelBounds.y + i) * scansize + offset;
-
- for (int j = 0; j < bounds.width; j++)
- cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
- }
-
- if (consumer != null)
- consumer.setPixels(0, 0,
- bounds.width, bounds.height,
- model, cropped, 0, bounds.width);
- }
+ Rectangle filterBounds = new Rectangle(this.x, this.y,
+ this.width, this.height);
+ Rectangle pixelBounds = new Rectangle(x, y, w, h);
+
+ if (filterBounds.intersects(pixelBounds))
+ {
+ Rectangle bounds = filterBounds.intersection(pixelBounds);
+
+ int[] cropped = new int[bounds.width * bounds.height];
+ for (int i = 0; i < bounds.height; i++)
+ {
+ int start = (bounds.y - pixelBounds.y + i) * scansize + offset;
+
+ for (int j = 0; j < bounds.width; j++)
+ cropped[i * bounds.width + j] = pixels[start + bounds.x + j];
+ }
+
+ if (consumer != null)
+ consumer.setPixels(0, 0,
+ bounds.width, bounds.height,
+ model, cropped, 0, bounds.width);
+ }
}
}
-
diff --git a/java/awt/image/DataBuffer.java b/java/awt/image/DataBuffer.java
index 5a2cfd3b0..78bc75ba5 100644
--- a/java/awt/image/DataBuffer.java
+++ b/java/awt/image/DataBuffer.java
@@ -36,7 +36,7 @@ exception statement from your version. */
package java.awt.image;
-/**
+/**
* Class that manages arrays of data elements. A data buffer consists
* of one or more banks. A bank is a continuous region of data
* elements.
@@ -52,31 +52,31 @@ public abstract class DataBuffer
public static final int TYPE_BYTE = 0;
/**
- * A constant representing a data type that uses <code>short</code>
+ * A constant representing a data type that uses <code>short</code>
* primitives as the storage unit.
*/
public static final int TYPE_USHORT = 1;
/**
- * A constant representing a data type that uses <code>short</code>
+ * A constant representing a data type that uses <code>short</code>
* primitives as the storage unit.
*/
public static final int TYPE_SHORT = 2;
/**
- * A constant representing a data type that uses <code>int</code>
+ * A constant representing a data type that uses <code>int</code>
* primitives as the storage unit.
*/
public static final int TYPE_INT = 3;
-
+
/**
- * A constant representing a data type that uses <code>float</code>
+ * A constant representing a data type that uses <code>float</code>
* primitives as the storage unit.
*/
public static final int TYPE_FLOAT = 4;
/**
- * A constant representing a data type that uses <code>double</code>
+ * A constant representing a data type that uses <code>double</code>
* primitives as the storage unit.
*/
public static final int TYPE_DOUBLE = 5;
@@ -85,30 +85,30 @@ public abstract class DataBuffer
* A constant representing an undefined data type.
*/
public static final int TYPE_UNDEFINED = 32;
-
+
/** The type of the data elements stored in the data buffer. */
protected int dataType;
-
+
/** The number of banks in this buffer. */
protected int banks = 1;
-
+
/** Offset into the default (0'th) bank). */
protected int offset; // FIXME: Is offsets[0] always mirrored in offset?
-
+
/** The size of the banks. */
protected int size;
-
+
/** Offset into each bank. */
protected int[] offsets;
-
+
/**
* Creates a new <code>DataBuffer</code> with the specified data type and
- * size. The <code>dataType</code> should be one of the constants
- * {@link #TYPE_BYTE}, {@link #TYPE_SHORT}, {@link #TYPE_USHORT},
+ * size. The <code>dataType</code> should be one of the constants
+ * {@link #TYPE_BYTE}, {@link #TYPE_SHORT}, {@link #TYPE_USHORT},
* {@link #TYPE_INT}, {@link #TYPE_FLOAT} and {@link #TYPE_DOUBLE}.
* <p>
* The physical (array-based) storage is allocated by a subclass.
- *
+ *
* @param dataType the data type.
* @param size the number of elements in the buffer.
*/
@@ -119,13 +119,13 @@ public abstract class DataBuffer
/**
* Creates a new <code>DataBuffer</code> with the specified data type,
- * size and number of banks. The <code>dataType</code> should be one of
- * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * size and number of banks. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
* {@link #TYPE_DOUBLE}.
* <p>
* The physical (array-based) storage is allocated by a subclass.
- *
+ *
* @param dataType the data type.
* @param size the number of elements in the buffer.
* @param numBanks the number of data banks.
@@ -137,13 +137,13 @@ public abstract class DataBuffer
/**
* Creates a new <code>DataBuffer</code> with the specified data type,
* size and number of banks. An offset (which applies to all banks) is
- * also specified. The <code>dataType</code> should be one of
- * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * also specified. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
* {@link #TYPE_DOUBLE}.
* <p>
* The physical (array-based) storage is allocated by a subclass.
- *
+ *
* @param dataType the data type.
* @param size the number of elements in the buffer.
* @param numBanks the number of data banks.
@@ -163,42 +163,42 @@ public abstract class DataBuffer
/**
* Creates a new <code>DataBuffer</code> with the specified data type,
* size and number of banks. An offset (which applies to all banks) is
- * also specified. The <code>dataType</code> should be one of
- * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * also specified. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
* {@link #TYPE_DOUBLE}.
* <p>
* The physical (array-based) storage is allocated by a subclass.
- *
+ *
* @param dataType the data type.
* @param size the number of elements in the buffer.
* @param numBanks the number of data banks.
* @param offsets the offsets to the first element for all banks.
- *
- * @throws ArrayIndexOutOfBoundsException if
+ *
+ * @throws ArrayIndexOutOfBoundsException if
* <code>numBanks != offsets.length</code>.
*/
protected DataBuffer(int dataType, int size, int numBanks, int[] offsets) {
- if (numBanks != offsets.length)
+ if (numBanks != offsets.length)
throw new ArrayIndexOutOfBoundsException();
this.dataType = dataType;
this.size = size;
banks = numBanks;
this.offsets = offsets;
-
+
offset = offsets[0];
}
-
+
/**
* Returns the size (number of bits) of the specified data type. Valid types
- * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
* {@link #TYPE_DOUBLE}.
- *
+ *
* @param dataType the data type.
* @return The number of bits for the specified data type.
- * @throws IllegalArgumentException if <code>dataType < 0</code> or
+ * @throws IllegalArgumentException if <code>dataType < 0</code> or
* <code>dataType > TYPE_DOUBLE</code>.
*/
public static int getDataTypeSize(int dataType) {
@@ -206,57 +206,57 @@ public abstract class DataBuffer
switch (dataType)
{
case TYPE_BYTE:
- return 8;
+ return 8;
case TYPE_USHORT:
case TYPE_SHORT:
- return 16;
+ return 16;
case TYPE_INT:
case TYPE_FLOAT:
- return 32;
+ return 32;
case TYPE_DOUBLE:
- return 64;
+ return 64;
default:
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException();
}
}
/**
* Returns the type of the data elements in the data buffer. Valid types
- * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
- * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
* {@link #TYPE_DOUBLE}.
- *
+ *
* @return The type.
*/
public int getDataType()
{
return dataType;
}
-
+
/**
* Returns the size of the data buffer.
- *
+ *
* @return The size.
*/
public int getSize()
{
return size;
}
-
+
/**
* Returns the element offset for the first data bank.
- *
+ *
* @return The element offset.
*/
public int getOffset()
{
return offset;
}
-
+
/**
- * Returns the offsets for all the data banks used by this
+ * Returns the offsets for all the data banks used by this
* <code>DataBuffer</code>.
- *
+ *
* @return The offsets.
*/
public int[] getOffsets()
@@ -281,9 +281,9 @@ public abstract class DataBuffer
/**
* Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -294,20 +294,20 @@ public abstract class DataBuffer
/**
* Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
*/
public abstract int getElem(int bank, int i);
-
+
/**
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -320,18 +320,18 @@ public abstract class DataBuffer
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
*/
public abstract void setElem(int bank, int i, int val);
-
+
/**
- * Returns an element from the first data bank, converted to a
- * <code>float</code>. The offset (specified in the constructor) is added
+ * Returns an element from the first data bank, converted to a
+ * <code>float</code>. The offset (specified in the constructor) is added
* to <code>i</code> before accessing the underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -339,12 +339,12 @@ public abstract class DataBuffer
{
return getElem(i);
}
-
+
/**
- * Returns an element from a particular data bank, converted to a
- * <code>float</code>. The offset (specified in the constructor) is
+ * Returns an element from a particular data bank, converted to a
+ * <code>float</code>. The offset (specified in the constructor) is
* added to <code>i</code> before accessing the underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -357,8 +357,8 @@ public abstract class DataBuffer
/**
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
- * data array.
- *
+ * data array.
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -371,7 +371,7 @@ public abstract class DataBuffer
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
@@ -382,10 +382,10 @@ public abstract class DataBuffer
}
/**
- * Returns an element from the first data bank, converted to a
+ * Returns an element from the first data bank, converted to a
* <code>double</code>. The offset (specified in the constructor) is added
* to <code>i</code> before accessing the underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -393,12 +393,12 @@ public abstract class DataBuffer
{
return getElem(i);
}
-
+
/**
- * Returns an element from a particular data bank, converted to a
- * <code>double</code>. The offset (specified in the constructor) is
+ * Returns an element from a particular data bank, converted to a
+ * <code>double</code>. The offset (specified in the constructor) is
* added to <code>i</code> before accessing the underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -411,8 +411,8 @@ public abstract class DataBuffer
/**
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
- * data array.
- *
+ * data array.
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -425,7 +425,7 @@ public abstract class DataBuffer
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
diff --git a/java/awt/image/DataBufferByte.java b/java/awt/image/DataBufferByte.java
index 1113ebb78..01364b07a 100644
--- a/java/awt/image/DataBufferByte.java
+++ b/java/awt/image/DataBufferByte.java
@@ -48,19 +48,19 @@ package java.awt.image;
/**
* A {@link DataBuffer} that uses an array of <code>byte</code> primitives
- * to represent each of its banks.
- *
+ * to represent each of its banks.
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferByte extends DataBuffer
{
private byte[] data;
private byte[][] bankData;
-
+
/**
- * Creates a new data buffer with a single data bank containing the
+ * Creates a new data buffer with a single data bank containing the
* specified number of <code>byte</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
*/
public DataBufferByte(int size)
@@ -72,9 +72,9 @@ public final class DataBufferByte extends DataBuffer
}
/**
- * Creates a new data buffer with the specified number of data banks,
+ * Creates a new data buffer with the specified number of data banks,
* each containing the specified number of <code>byte</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
* @param numBanks the number of data banks.
*/
@@ -88,10 +88,10 @@ public final class DataBufferByte extends DataBuffer
/**
* Creates a new data buffer backed by the specified data bank.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
*/
@@ -102,15 +102,15 @@ public final class DataBufferByte extends DataBuffer
data = dataArray;
bankData[0] = data;
}
-
+
/**
* Creates a new data buffer backed by the specified data bank, with
* the specified offset to the first element.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
* @param offset the offset to the first element in the array.
@@ -125,11 +125,11 @@ public final class DataBufferByte extends DataBuffer
/**
* Creates a new data buffer backed by the specified data banks.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferByte(byte[][] dataArray, int size)
@@ -142,12 +142,12 @@ public final class DataBufferByte extends DataBuffer
/**
* Creates a new data buffer backed by the specified data banks, with
* the specified offsets to the first element in each bank.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
* @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferByte(byte[][] dataArray, int size, int[] offsets)
@@ -159,40 +159,40 @@ public final class DataBufferByte extends DataBuffer
/**
* Returns the first data bank.
- *
+ *
* @return The first data bank.
*/
public byte[] getData()
{
return data;
}
-
+
/**
* Returns a data bank.
- *
+ *
* @param bank the bank index.
* @return A data bank.
*/
- public byte[] getData(int bank)
+ public byte[] getData(int bank)
{
return bankData[bank];
}
-
+
/**
* Returns the array underlying this <code>DataBuffer</code>.
- *
+ *
* @return The data banks.
*/
public byte[][] getBankData()
{
return bankData;
}
-
+
/**
* Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -200,12 +200,12 @@ public final class DataBufferByte extends DataBuffer
{
return data[i+offset] & 0xff; // get unsigned byte as int
}
-
+
/**
* Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -220,7 +220,7 @@ public final class DataBufferByte extends DataBuffer
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -233,7 +233,7 @@ public final class DataBufferByte extends DataBuffer
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
diff --git a/java/awt/image/DataBufferDouble.java b/java/awt/image/DataBufferDouble.java
index a8c4b9d05..31c5ebd8c 100644
--- a/java/awt/image/DataBufferDouble.java
+++ b/java/awt/image/DataBufferDouble.java
@@ -48,8 +48,8 @@ package java.awt.image;
/**
* A {@link DataBuffer} that uses an array of <code>double</code> primitives
- * to represent each of its banks.
- *
+ * to represent each of its banks.
+ *
* @since 1.4
*
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
@@ -60,11 +60,11 @@ public final class DataBufferDouble
{
private double[] data;
private double[][] bankData;
-
+
/**
- * Creates a new data buffer with a single data bank containing the
+ * Creates a new data buffer with a single data bank containing the
* specified number of <code>double</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
*/
public DataBufferDouble(int size)
@@ -76,9 +76,9 @@ public final class DataBufferDouble
}
/**
- * Creates a new data buffer with the specified number of data banks,
+ * Creates a new data buffer with the specified number of data banks,
* each containing the specified number of <code>double</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
* @param numBanks the number of data banks.
*/
@@ -92,10 +92,10 @@ public final class DataBufferDouble
/**
* Creates a new data buffer backed by the specified data bank.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
*/
@@ -106,15 +106,15 @@ public final class DataBufferDouble
data = dataArray;
bankData[0] = data;
}
-
+
/**
* Creates a new data buffer backed by the specified data bank, with
* the specified offset to the first element.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
* @param offset the offset to the first element in the array.
@@ -129,11 +129,11 @@ public final class DataBufferDouble
/**
* Creates a new data buffer backed by the specified data banks.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferDouble(double[][] dataArray, int size)
@@ -146,12 +146,12 @@ public final class DataBufferDouble
/**
* Creates a new data buffer backed by the specified data banks, with
* the specified offsets to the first element in each bank.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
* @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferDouble(double[][] dataArray, int size, int[] offsets)
@@ -163,17 +163,17 @@ public final class DataBufferDouble
/**
* Returns the first data bank.
- *
+ *
* @return The first data bank.
*/
public double[] getData()
{
return data;
}
-
+
/**
* Returns a data bank.
- *
+ *
* @param bank the bank index.
* @return A data bank.
*/
@@ -181,22 +181,22 @@ public final class DataBufferDouble
{
return bankData[bank];
}
-
+
/**
* Returns the array underlying this <code>DataBuffer</code>.
- *
+ *
* @return The data banks.
*/
public double[][] getBankData()
{
return bankData;
}
-
+
/**
* Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -207,9 +207,9 @@ public final class DataBufferDouble
/**
* Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -223,7 +223,7 @@ public final class DataBufferDouble
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -236,7 +236,7 @@ public final class DataBufferDouble
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
@@ -250,7 +250,7 @@ public final class DataBufferDouble
{
return (float) data[i+offset];
}
-
+
public float getElemFloat(int bank, int i)
{
return (float) bankData[bank][i+offsets[bank]];
@@ -270,7 +270,7 @@ public final class DataBufferDouble
{
return data[i + offset];
}
-
+
public double getElemDouble(int bank, int i)
{
return bankData[bank][i + offsets[bank]];
diff --git a/java/awt/image/DataBufferFloat.java b/java/awt/image/DataBufferFloat.java
index 9cf8784d7..44a0a3892 100644
--- a/java/awt/image/DataBufferFloat.java
+++ b/java/awt/image/DataBufferFloat.java
@@ -48,8 +48,8 @@ package java.awt.image;
/**
* A {@link DataBuffer} that uses an array of <code>float</code> primitives
- * to represent each of its banks.
- *
+ * to represent each of its banks.
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
* @author Sascha Brawer (brawer@dandelis.ch)
*/
@@ -58,11 +58,11 @@ public final class DataBufferFloat
{
private float[] data;
private float[][] bankData;
-
+
/**
- * Creates a new data buffer with a single data bank containing the
+ * Creates a new data buffer with a single data bank containing the
* specified number of <code>float</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
*/
public DataBufferFloat(int size)
@@ -74,9 +74,9 @@ public final class DataBufferFloat
}
/**
- * Creates a new data buffer with the specified number of data banks,
+ * Creates a new data buffer with the specified number of data banks,
* each containing the specified number of <code>float</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
* @param numBanks the number of data banks.
*/
@@ -90,10 +90,10 @@ public final class DataBufferFloat
/**
* Creates a new data buffer backed by the specified data bank.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
*/
@@ -104,15 +104,15 @@ public final class DataBufferFloat
data = dataArray;
bankData[0] = data;
}
-
+
/**
* Creates a new data buffer backed by the specified data bank, with
* the specified offset to the first element.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
* @param offset the offset to the first element in the array.
@@ -127,11 +127,11 @@ public final class DataBufferFloat
/**
* Creates a new data buffer backed by the specified data banks.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferFloat(float[][] dataArray, int size)
@@ -144,12 +144,12 @@ public final class DataBufferFloat
/**
* Creates a new data buffer backed by the specified data banks, with
* the specified offsets to the first element in each bank.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
* @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferFloat(float[][] dataArray, int size, int[] offsets)
@@ -161,17 +161,17 @@ public final class DataBufferFloat
/**
* Returns the first data bank.
- *
+ *
* @return The first data bank.
*/
public float[] getData()
{
return data;
}
-
+
/**
* Returns a data bank.
- *
+ *
* @param bank the bank index.
* @return A data bank.
*/
@@ -179,22 +179,22 @@ public final class DataBufferFloat
{
return bankData[bank];
}
-
+
/**
* Returns the array underlying this <code>DataBuffer</code>.
- *
+ *
* @return The data banks.
*/
public float[][] getBankData()
{
return bankData;
}
-
+
/**
* Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -205,9 +205,9 @@ public final class DataBufferFloat
/**
* Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -221,7 +221,7 @@ public final class DataBufferFloat
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -234,7 +234,7 @@ public final class DataBufferFloat
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
@@ -248,7 +248,7 @@ public final class DataBufferFloat
{
return data[i+offset];
}
-
+
public float getElemFloat(int bank, int i)
{
return bankData[bank][i+offsets[bank]];
@@ -268,7 +268,7 @@ public final class DataBufferFloat
{
return getElemFloat(i);
}
-
+
public double getElemDouble(int bank, int i)
{
return getElemFloat(bank, i);
diff --git a/java/awt/image/DataBufferInt.java b/java/awt/image/DataBufferInt.java
index 0aac94040..db9d5bc30 100644
--- a/java/awt/image/DataBufferInt.java
+++ b/java/awt/image/DataBufferInt.java
@@ -48,19 +48,19 @@ package java.awt.image;
/**
* A {@link DataBuffer} that uses an array of <code>int</code> primitives
- * to represent each of its banks.
- *
+ * to represent each of its banks.
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferInt extends DataBuffer
{
private int[] data;
private int[][] bankData;
-
+
/**
- * Creates a new data buffer with a single data bank containing the
+ * Creates a new data buffer with a single data bank containing the
* specified number of <code>int</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
*/
public DataBufferInt(int size)
@@ -72,9 +72,9 @@ public final class DataBufferInt extends DataBuffer
}
/**
- * Creates a new data buffer with the specified number of data banks,
+ * Creates a new data buffer with the specified number of data banks,
* each containing the specified number of <code>int</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
* @param numBanks the number of data banks.
*/
@@ -84,14 +84,14 @@ public final class DataBufferInt extends DataBuffer
bankData = new int[numBanks][size];
data = bankData[0];
}
-
+
/**
* Creates a new data buffer backed by the specified data bank.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
*/
@@ -102,15 +102,15 @@ public final class DataBufferInt extends DataBuffer
data = dataArray;
bankData[0] = data;
}
-
+
/**
* Creates a new data buffer backed by the specified data bank, with
* the specified offset to the first element.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
* @param offset the offset to the first element in the array.
@@ -122,14 +122,14 @@ public final class DataBufferInt extends DataBuffer
data = dataArray;
bankData[0] = data;
}
-
+
/**
* Creates a new data buffer backed by the specified data banks.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferInt(int[][] dataArray, int size)
@@ -138,16 +138,16 @@ public final class DataBufferInt extends DataBuffer
bankData = dataArray;
data = bankData[0];
}
-
+
/**
* Creates a new data buffer backed by the specified data banks, with
* the specified offsets to the first element in each bank.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
* @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferInt(int[][] dataArray, int size, int[] offsets)
@@ -159,17 +159,17 @@ public final class DataBufferInt extends DataBuffer
/**
* Returns the first data bank.
- *
+ *
* @return The first data bank.
*/
public int[] getData()
{
return data;
}
-
+
/**
* Returns a data bank.
- *
+ *
* @param bank the bank index.
* @return A data bank.
*/
@@ -177,21 +177,21 @@ public final class DataBufferInt extends DataBuffer
{
return bankData[bank];
}
-
+
/**
* Returns the array underlying this <code>DataBuffer</code>.
- *
+ *
* @return The data banks.
*/
public int[][] getBankData()
{
return bankData;
}
-
+
/**
* Returns an element from the first data bank. The <code>offset</code> is
* added to the specified index before accessing the underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -201,10 +201,10 @@ public final class DataBufferInt extends DataBuffer
}
/**
- * Returns an element from a particular data bank. The <code>offset</code>
- * is added to the specified index before accessing the underlying data
+ * Returns an element from a particular data bank. The <code>offset</code>
+ * is added to the specified index before accessing the underlying data
* array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -219,7 +219,7 @@ public final class DataBufferInt extends DataBuffer
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -227,12 +227,12 @@ public final class DataBufferInt extends DataBuffer
{
data[i+offset] = val;
}
-
+
/**
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
diff --git a/java/awt/image/DataBufferShort.java b/java/awt/image/DataBufferShort.java
index 5c67a8d3c..2156d7571 100644
--- a/java/awt/image/DataBufferShort.java
+++ b/java/awt/image/DataBufferShort.java
@@ -49,19 +49,19 @@ package java.awt.image;
/**
* A {@link DataBuffer} that uses an array of <code>short</code> primitives
- * to represent each of its banks.
- *
+ * to represent each of its banks.
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferShort extends DataBuffer
{
private short[] data;
private short[][] bankData;
-
+
/**
- * Creates a new data buffer with a single data bank containing the
+ * Creates a new data buffer with a single data bank containing the
* specified number of <code>short</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
*/
public DataBufferShort(int size)
@@ -73,9 +73,9 @@ public final class DataBufferShort extends DataBuffer
}
/**
- * Creates a new data buffer with the specified number of data banks,
+ * Creates a new data buffer with the specified number of data banks,
* each containing the specified number of <code>short</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
* @param numBanks the number of data banks.
*/
@@ -89,10 +89,10 @@ public final class DataBufferShort extends DataBuffer
/**
* Creates a new data buffer backed by the specified data bank.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
*/
@@ -103,15 +103,15 @@ public final class DataBufferShort extends DataBuffer
data = dataArray;
bankData[0] = data;
}
-
+
/**
* Creates a new data buffer backed by the specified data bank, with
* the specified offset to the first element.
* <p>
- * Note: there is no exception when <code>dataArray</code> is
+ * Note: there is no exception when <code>dataArray</code> is
* <code>null</code>, but in that case an exception will be thrown
* later if you attempt to access the data buffer.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
* @param offset the offset to the first element in the array.
@@ -126,11 +126,11 @@ public final class DataBufferShort extends DataBuffer
/**
* Creates a new data buffer backed by the specified data banks.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferShort(short[][] dataArray, int size)
@@ -143,12 +143,12 @@ public final class DataBufferShort extends DataBuffer
/**
* Creates a new data buffer backed by the specified data banks, with
* the specified offsets to the first element in each bank.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
* @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferShort(short[][] dataArray, int size, int[] offsets)
@@ -160,17 +160,17 @@ public final class DataBufferShort extends DataBuffer
/**
* Returns the first data bank.
- *
+ *
* @return The first data bank.
*/
public short[] getData()
{
return data;
}
-
+
/**
* Returns a data bank.
- *
+ *
* @param bank the bank index.
* @return A data bank.
*/
@@ -178,22 +178,22 @@ public final class DataBufferShort extends DataBuffer
{
return bankData[bank];
}
-
+
/**
* Returns the array underlying this <code>DataBuffer</code>.
- *
+ *
* @return The data banks.
*/
public short[][] getBankData()
{
return bankData;
}
-
+
/**
* Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -204,9 +204,9 @@ public final class DataBufferShort extends DataBuffer
/**
* Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -220,7 +220,7 @@ public final class DataBufferShort extends DataBuffer
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -233,7 +233,7 @@ public final class DataBufferShort extends DataBuffer
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
diff --git a/java/awt/image/DataBufferUShort.java b/java/awt/image/DataBufferUShort.java
index 981e9e9d2..d2cadcf0b 100644
--- a/java/awt/image/DataBufferUShort.java
+++ b/java/awt/image/DataBufferUShort.java
@@ -49,19 +49,19 @@ package java.awt.image;
/**
* A {@link DataBuffer} that uses an array of <code>short</code> primitives
- * to represent each of its banks.
- *
+ * to represent each of its banks.
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public final class DataBufferUShort extends DataBuffer
{
private short[] data;
private short[][] bankData;
-
+
/**
- * Creates a new data buffer with a single data bank containing the
+ * Creates a new data buffer with a single data bank containing the
* specified number of <code>short</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
*/
public DataBufferUShort(int size)
@@ -73,9 +73,9 @@ public final class DataBufferUShort extends DataBuffer
}
/**
- * Creates a new data buffer with the specified number of data banks,
+ * Creates a new data buffer with the specified number of data banks,
* each containing the specified number of <code>short</code> elements.
- *
+ *
* @param size the number of elements in the data bank.
* @param numBanks the number of data banks.
*/
@@ -88,7 +88,7 @@ public final class DataBufferUShort extends DataBuffer
/**
* Creates a new data buffer backed by the specified data bank.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
*
@@ -103,11 +103,11 @@ public final class DataBufferUShort extends DataBuffer
data = dataArray;
bankData[0] = data;
}
-
+
/**
* Creates a new data buffer backed by the specified data bank, with
* the specified offset to the first element.
- *
+ *
* @param dataArray the data bank.
* @param size the number of elements in the data bank.
* @param offset the offset to the first element in the array.
@@ -126,11 +126,11 @@ public final class DataBufferUShort extends DataBuffer
/**
* Creates a new data buffer backed by the specified data banks.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferUShort(short[][] dataArray, int size)
@@ -143,12 +143,12 @@ public final class DataBufferUShort extends DataBuffer
/**
* Creates a new data buffer backed by the specified data banks, with
* the specified offsets to the first element in each bank.
- *
+ *
* @param dataArray the data banks.
* @param size the number of elements in the data bank.
* @param offsets the offsets to the first element in each data bank.
- *
- * @throws NullPointerException if <code>dataArray</code> is
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
* <code>null</code>.
*/
public DataBufferUShort(short[][] dataArray, int size, int[] offsets)
@@ -160,17 +160,17 @@ public final class DataBufferUShort extends DataBuffer
/**
* Returns the first data bank.
- *
+ *
* @return The first data bank.
*/
public short[] getData()
{
return data;
}
-
+
/**
* Returns a data bank.
- *
+ *
* @param bank the bank index.
* @return A data bank.
*/
@@ -178,22 +178,22 @@ public final class DataBufferUShort extends DataBuffer
{
return bankData[bank];
}
-
+
/**
* Returns the array underlying this <code>DataBuffer</code>.
- *
+ *
* @return The data banks.
*/
public short[][] getBankData()
{
return bankData;
}
-
+
/**
* Returns an element from the first data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param i the element index.
* @return The element.
*/
@@ -204,9 +204,9 @@ public final class DataBufferUShort extends DataBuffer
/**
* Returns an element from a particular data bank. The offset (specified in
- * the constructor) is added to <code>i</code> before accessing the
+ * the constructor) is added to <code>i</code> before accessing the
* underlying data array.
- *
+ *
* @param bank the bank index.
* @param i the element index.
* @return The element.
@@ -221,7 +221,7 @@ public final class DataBufferUShort extends DataBuffer
* Sets an element in the first data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param i the element index.
* @param val the new element value.
*/
@@ -234,7 +234,7 @@ public final class DataBufferUShort extends DataBuffer
* Sets an element in a particular data bank. The offset (specified in the
* constructor) is added to <code>i</code> before updating the underlying
* data array.
- *
+ *
* @param bank the data bank index.
* @param i the element index.
* @param val the new element value.
diff --git a/java/awt/image/DirectColorModel.java b/java/awt/image/DirectColorModel.java
index 3d43c7642..a464fed30 100644
--- a/java/awt/image/DirectColorModel.java
+++ b/java/awt/image/DirectColorModel.java
@@ -57,19 +57,19 @@ public class DirectColorModel extends PackedColorModel
* Each mask should describe a fully contiguous set of bits in the
* most likely order of alpha, red, green, blue from the most significant
* byte to the least significant byte.
- *
+ *
* @param pixelBits the number of bits wide used for bit size of pixel values
* @param rmask the bits describing the red component of a pixel
* @param gmask the bits describing the green component of a pixel
- * @param bmask the bits describing the blue component of a pixel
+ * @param bmask the bits describing the blue component of a pixel
*/
public DirectColorModel(int pixelBits, int rmask, int gmask, int bmask)
{
this(ColorSpace.getInstance(ColorSpace.CS_sRGB), pixelBits,
- rmask, gmask, bmask, 0,
- false, // not alpha premultiplied
- Buffers.smallestAppropriateTransferType(pixelBits) // find type
- );
+ rmask, gmask, bmask, 0,
+ false, // not alpha premultiplied
+ Buffers.smallestAppropriateTransferType(pixelBits) // find type
+ );
}
/**
@@ -78,34 +78,34 @@ public class DirectColorModel extends PackedColorModel
* Each mask should describe a fully contiguous set of bits in the
* most likely order of red, green, blue from the most significant
* byte to the least significant byte.
- *
+ *
* @param pixelBits the number of bits wide used for bit size of pixel values
* @param rmask the bits describing the red component of a pixel
* @param gmask the bits describing the green component of a pixel
- * @param bmask the bits describing the blue component of a pixel
- * @param amask the bits describing the alpha component of a pixel
+ * @param bmask the bits describing the blue component of a pixel
+ * @param amask the bits describing the alpha component of a pixel
*/
public DirectColorModel(int pixelBits,
- int rmask, int gmask, int bmask, int amask)
+ int rmask, int gmask, int bmask, int amask)
{
this(ColorSpace.getInstance(ColorSpace.CS_sRGB), pixelBits,
- rmask, gmask, bmask, amask,
- false, // not alpha premultiplied
- Buffers.smallestAppropriateTransferType(pixelBits) // find type
- );
+ rmask, gmask, bmask, amask,
+ false, // not alpha premultiplied
+ Buffers.smallestAppropriateTransferType(pixelBits) // find type
+ );
}
public DirectColorModel(ColorSpace cspace, int pixelBits,
- int rmask, int gmask, int bmask, int amask,
- boolean isAlphaPremultiplied,
- int transferType)
+ int rmask, int gmask, int bmask, int amask,
+ boolean isAlphaPremultiplied,
+ int transferType)
{
super(cspace, pixelBits,
- rmask, gmask, bmask, amask, isAlphaPremultiplied,
- ((amask == 0) ? Transparency.OPAQUE : Transparency.TRANSLUCENT),
- transferType);
+ rmask, gmask, bmask, amask, isAlphaPremultiplied,
+ ((amask == 0) ? Transparency.OPAQUE : Transparency.TRANSLUCENT),
+ transferType);
}
-
+
public final int getRedMask()
{
return getMask(0);
@@ -143,7 +143,7 @@ public class DirectColorModel extends PackedColorModel
{
return extractAndNormalizeSample(pixel, 1);
}
-
+
/**
* Get the blue component of the given pixel.
* <br>
@@ -184,12 +184,12 @@ public class DirectColorModel extends PackedColorModel
/**
* Get the RGB color value of the given pixel using the default
- * RGB color model.
+ * RGB color model.
* <br>
*
* @param pixel a pixel value
*/
- public final int getRGB(int pixel)
+ public final int getRGB(int pixel)
{
/* FIXME: The Sun docs show that this method is overridden, but I
don't see any way to improve on the superclass
@@ -211,7 +211,7 @@ public class DirectColorModel extends PackedColorModel
{
return getBlue(getPixelFromArray(inData));
}
-
+
public int getAlpha(Object inData)
{
return getAlpha(getPixelFromArray(inData));
@@ -221,7 +221,7 @@ public class DirectColorModel extends PackedColorModel
{
return getRGB(getPixelFromArray(inData));
}
-
+
/**
* Converts a normalized pixel int value in the sRGB color
* space to an array containing a single pixel of the color space
@@ -231,7 +231,7 @@ public class DirectColorModel extends PackedColorModel
* <code>getRGB(Object inData)</code>.
*
* @param rgb pixel as a normalized sRGB, 0xAARRGGBB value.
- *
+ *
* @param pixel to avoid needless creation of arrays, an array to
* use to return the pixel can be given. If null, a suitable array
* will be created.
@@ -244,60 +244,60 @@ public class DirectColorModel extends PackedColorModel
public Object getDataElements(int rgb, Object pixel)
{
// FIXME: handle alpha multiply
-
+
int pixelValue = 0;
int a = 0;
if (hasAlpha()) {
a = (rgb >>> 24) & 0xff;
pixelValue = valueToField(a, 3, 8);
}
-
+
if (hasAlpha() && isAlphaPremultiplied())
{
- int r, g, b;
- /* if r=0xff and a=0xff, then resulting
- value will be (r*a)>>>8 == 0xfe... This seems wrong.
- We should divide by 255 rather than shifting >>>8 after
- multiplying.
-
- Too bad, shifting is probably less expensive.
- r = ((rgb >>> 16) & 0xff)*a;
- g = ((rgb >>> 8) & 0xff)*a;
- b = ((rgb >>> 0) & 0xff)*a; */
- /* The r, g, b values we calculate are 16 bit. This allows
- us to avoid discarding the lower 8 bits obtained if
- multiplying with the alpha band. */
-
- // using 16 bit values
- r = ((rgb >>> 8) & 0xff00)*a/255;
- g = ((rgb >>> 0) & 0xff00)*a/255;
- b = ((rgb << 8) & 0xff00)*a/255;
- pixelValue |=
- valueToField(r, 0, 16) | // Red
- valueToField(g, 1, 16) | // Green
- valueToField(b, 2, 16); // Blue
+ int r, g, b;
+ /* if r=0xff and a=0xff, then resulting
+ value will be (r*a)>>>8 == 0xfe... This seems wrong.
+ We should divide by 255 rather than shifting >>>8 after
+ multiplying.
+
+ Too bad, shifting is probably less expensive.
+ r = ((rgb >>> 16) & 0xff)*a;
+ g = ((rgb >>> 8) & 0xff)*a;
+ b = ((rgb >>> 0) & 0xff)*a; */
+ /* The r, g, b values we calculate are 16 bit. This allows
+ us to avoid discarding the lower 8 bits obtained if
+ multiplying with the alpha band. */
+
+ // using 16 bit values
+ r = ((rgb >>> 8) & 0xff00)*a/255;
+ g = ((rgb >>> 0) & 0xff00)*a/255;
+ b = ((rgb << 8) & 0xff00)*a/255;
+ pixelValue |=
+ valueToField(r, 0, 16) | // Red
+ valueToField(g, 1, 16) | // Green
+ valueToField(b, 2, 16); // Blue
}
else
{
- int r, g, b;
- // using 8 bit values
- r = (rgb >>> 16) & 0xff;
- g = (rgb >>> 8) & 0xff;
- b = (rgb >>> 0) & 0xff;
-
- pixelValue |=
- valueToField(r, 0, 8) | // Red
- valueToField(g, 1, 8) | // Green
- valueToField(b, 2, 8); // Blue
+ int r, g, b;
+ // using 8 bit values
+ r = (rgb >>> 16) & 0xff;
+ g = (rgb >>> 8) & 0xff;
+ b = (rgb >>> 0) & 0xff;
+
+ pixelValue |=
+ valueToField(r, 0, 8) | // Red
+ valueToField(g, 1, 8) | // Green
+ valueToField(b, 2, 8); // Blue
}
-
+
/* In this color model, the whole pixel fits in the first element
of the array. */
DataBuffer buffer = Buffers.createBuffer(transferType, pixel, 1);
buffer.setElem(0, pixelValue);
return Buffers.getData(buffer);
}
-
+
/**
* Converts a value to the correct field bits based on the
* information derived from the field masks.
@@ -307,13 +307,13 @@ public class DirectColorModel extends PackedColorModel
*/
private int valueToField(int val, int component, int highBit)
{
- int toFieldShift =
+ int toFieldShift =
getComponentSize(component) + shifts[component] - highBit;
int ret = (toFieldShift>0) ?
(val << toFieldShift) :
(val >>> (-toFieldShift));
return ret & getMask(component);
- }
+ }
/**
* Converts a 16 bit value to the correct field bits based on the
@@ -336,15 +336,15 @@ public class DirectColorModel extends PackedColorModel
{
int numComponents = getNumComponents();
if (components == null) components = new int[offset + numComponents];
-
+
for (int b=0; b<numComponents; b++)
components[offset++] = (pixel&getMask(b)) >>> shifts[b];
-
+
return components;
}
public final int[] getComponents(Object pixel, int[] components,
- int offset)
+ int offset)
{
return getComponents(getPixelFromArray(pixel), components, offset);
}
@@ -368,19 +368,19 @@ public class DirectColorModel extends PackedColorModel
SampleModel sm = createCompatibleSampleModel(w, h);
Point origin = new Point(0, 0);
- return Raster.createWritableRaster(sm, origin);
+ return Raster.createWritableRaster(sm, origin);
}
public int getDataElement(int[] components, int offset)
{
int numComponents = getNumComponents();
int pixelValue = 0;
-
+
for (int c=0; c<numComponents; c++)
pixelValue |= (components[offset++] << shifts[c]) & getMask(c);
return pixelValue;
- }
+ }
public Object getDataElements(int[] components, int offset, Object obj)
{
@@ -392,26 +392,26 @@ public class DirectColorModel extends PackedColorModel
buffer.setElem(0, pixelValue);
return Buffers.getData(buffer);
}
-
+
public final ColorModel coerceData (WritableRaster raster,
- boolean isAlphaPremultiplied)
+ boolean isAlphaPremultiplied)
{
if (this.isAlphaPremultiplied == isAlphaPremultiplied || !hasAlpha())
return this;
-
+
/* TODO: provide better implementation based on the
assumptions we can make due to the specific type of the
color model. */
coerceDataWorker(raster, isAlphaPremultiplied);
-
+
return new DirectColorModel(cspace, pixel_bits, getRedMask(),
getGreenMask(), getBlueMask(), getAlphaMask(),
isAlphaPremultiplied, transferType);
- }
+ }
public boolean isCompatibleRaster(Raster raster)
{
- /* FIXME: the Sun docs say this method is overridden here,
+ /* FIXME: the Sun docs say this method is overridden here,
but I don't see any way to improve upon the implementation
in ColorModel. */
return super.isCompatibleRaster(raster);
@@ -433,4 +433,3 @@ public class DirectColorModel extends PackedColorModel
return super.toString();
}
}
-
diff --git a/java/awt/image/FilteredImageSource.java b/java/awt/image/FilteredImageSource.java
index 8893e86a6..f56a93ad1 100644
--- a/java/awt/image/FilteredImageSource.java
+++ b/java/awt/image/FilteredImageSource.java
@@ -1,4 +1,4 @@
-/* FilteredImageSource.java -- Java class for providing image data
+/* FilteredImageSource.java -- Java class for providing image data
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,7 +43,7 @@ import java.util.Hashtable;
/**
*
* @see ImageConsumer
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public class FilteredImageSource implements ImageProducer
{
@@ -53,73 +53,72 @@ public class FilteredImageSource implements ImageProducer
/**
* The given filter is applied to the given image producer
- * to create a new image producer.
+ * to create a new image producer.
*/
public FilteredImageSource(ImageProducer ip, ImageFilter filter) {
- this.ip = ip;
- this.filter = filter;
+ this.ip = ip;
+ this.filter = filter;
}
/**
* Used to register an <code>ImageConsumer</code> with this
- * <code>ImageProducer</code>.
+ * <code>ImageProducer</code>.
*/
public synchronized void addConsumer(ImageConsumer ic) {
- if (consumers.containsKey(ic))
- return;
+ if (consumers.containsKey(ic))
+ return;
- ImageFilter f = filter.getFilterInstance(ic);
- consumers.put(ic, f);
- ip.addConsumer(f);
+ ImageFilter f = filter.getFilterInstance(ic);
+ consumers.put(ic, f);
+ ip.addConsumer(f);
}
/**
* Used to determine if the given <code>ImageConsumer</code> is
- * already registered with this <code>ImageProducer</code>.
+ * already registered with this <code>ImageProducer</code>.
*/
public synchronized boolean isConsumer(ImageConsumer ic) {
- ImageFilter f = (ImageFilter)consumers.get(ic);
- if (f != null)
- return ip.isConsumer(f);
- return false;
+ ImageFilter f = (ImageFilter)consumers.get(ic);
+ if (f != null)
+ return ip.isConsumer(f);
+ return false;
}
/**
* Used to remove an <code>ImageConsumer</code> from the list of
- * registered consumers for this <code>ImageProducer</code>.
+ * registered consumers for this <code>ImageProducer</code>.
*/
public synchronized void removeConsumer(ImageConsumer ic) {
- ImageFilter f = (ImageFilter)consumers.remove(ic);
- if (f != null)
- ip.removeConsumer(f);
+ ImageFilter f = (ImageFilter)consumers.remove(ic);
+ if (f != null)
+ ip.removeConsumer(f);
}
/**
* Used to register an <code>ImageConsumer</code> with this
* <code>ImageProducer</code> and then immediately start
* reconstruction of the image data to be delivered to all
- * registered consumers.
+ * registered consumers.
*/
public void startProduction(ImageConsumer ic) {
- ImageFilter f;
- if (!(consumers.containsKey(ic))) {
- f = filter.getFilterInstance(ic);
- consumers.put(ic, f);
- ip.addConsumer(f);
- } else {
- f = (ImageFilter)consumers.get( ic );
- }
- ip.startProduction(f);
+ ImageFilter f;
+ if (!(consumers.containsKey(ic))) {
+ f = filter.getFilterInstance(ic);
+ consumers.put(ic, f);
+ ip.addConsumer(f);
+ } else {
+ f = (ImageFilter)consumers.get( ic );
+ }
+ ip.startProduction(f);
}
/**
* Used to register an <code>ImageConsumer</code> with this
* <code>ImageProducer</code> and then request that this producer
- * resend the image data in the order top-down, left-right.
+ * resend the image data in the order top-down, left-right.
*/
public void requestTopDownLeftRightResend(ImageConsumer ic) {
- ImageFilter f = (ImageFilter)consumers.get(ic);
- ip.requestTopDownLeftRightResend(f);
+ ImageFilter f = (ImageFilter)consumers.get(ic);
+ ip.requestTopDownLeftRightResend(f);
}
}
-
diff --git a/java/awt/image/ImageConsumer.java b/java/awt/image/ImageConsumer.java
index 11f64f978..8f3c2b144 100644
--- a/java/awt/image/ImageConsumer.java
+++ b/java/awt/image/ImageConsumer.java
@@ -43,7 +43,7 @@ import java.util.Hashtable;
/**
* An object implementing the <code>ImageProducer</code> interface can
* use objects implementing this interface to deliver the image data.
- *
+ *
* @author C. Brian Jones (cbj@gnu.org)
*/
public interface ImageConsumer
@@ -52,7 +52,7 @@ public interface ImageConsumer
* The pixel order may be random. This should be
* the default assumption of the <code>ImageConsumer</code>.
*
- * @see #setHints
+ * @see #setHints
*/
int RANDOMPIXELORDER = 1;
@@ -75,7 +75,7 @@ public interface ImageConsumer
* most one call to <code>setPixels</code> for any single pixel.
*
* @see #setHints
- * @see #setPixels(int, int, int, int, ColorModel, int[], int, int)
+ * @see #setPixels(int, int, int, int, ColorModel, int[], int, int)
*/
int SINGLEPASS = 8;
@@ -87,9 +87,9 @@ public interface ImageConsumer
* changing such as with video then the end of each frame is
* marked by a similar call to <code>imageComplete</code> with the
* <code>SINGLEFRAMEDONE</code> flag.
- *
+ *
* @see #setHints
- * @see #imageComplete
+ * @see #imageComplete
*/
int SINGLEFRAME = 16;
@@ -102,7 +102,7 @@ public interface ImageConsumer
/**
* A single frame is complete but more will follow.
- *
+ *
* @see #imageComplete
*/
int SINGLEFRAMEDONE = 2;
@@ -124,9 +124,9 @@ public interface ImageConsumer
/**
* An <code>ImageProducer</code> indicates the size of the image
* being produced using this method.
- *
+ *
* @param width the width of the image
- * @param height the height of the image
+ * @param height the height of the image
*/
void setDimensions(int width, int height);
@@ -134,7 +134,7 @@ public interface ImageConsumer
* An <code>ImageProducer</code> can set a list of properties
* associated with this image by using this method.
*
- * @param props the list of properties associated with this image
+ * @param props the list of properties associated with this image
*/
void setProperties(Hashtable<?,?> props);
@@ -145,7 +145,7 @@ public interface ImageConsumer
* <code>ColorModel</code>.
*
* @param model the color model to be used most often by setPixels
- * @see ColorModel
+ * @see ColorModel
*/
void setColorModel(ColorModel model);
@@ -154,7 +154,7 @@ public interface ImageConsumer
* bit mask of hints from any of <code>RANDOMPIXELORDER</code>,
* <code>TOPDOWNLEFTRIGHT</code>, <code>COMPLETESCANLINES</code>,
* <code>SINGLEPASS</code>, <code>SINGLEFRAME</code>.
- *
+ *
* @param flags a bit mask of hints
*/
void setHints(int flags);
@@ -178,8 +178,8 @@ public interface ImageConsumer
* @param offset offset into pixels array
* @param scansize width of one row in the pixel block
*/
- void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize);
+ void setPixels(int x, int y, int w, int h,
+ ColorModel model, byte[] pixels, int offset, int scansize);
/**
* Deliver a subset of an ImageProducer's pixels to this ImageConsumer.
@@ -200,14 +200,14 @@ public interface ImageConsumer
* @param offset offset into pixels array
* @param scansize width of one row in the pixel block
*/
- void setPixels(int x, int y, int w, int h,
+ void setPixels(int x, int y, int w, int h,
ColorModel model, int[] pixels, int offset, int scansize);
/**
* The <code>ImageProducer</code> calls this method to indicate a
* single frame or the entire image is complete. The method is
* also used to indicate an error in loading or producing the
- * image.
+ * image.
*
* @param status the status of image production, represented by a
* bitwise OR of ImageConsumer flags
diff --git a/java/awt/image/ImageFilter.java b/java/awt/image/ImageFilter.java
index 0ead45a4a..10df82e25 100644
--- a/java/awt/image/ImageFilter.java
+++ b/java/awt/image/ImageFilter.java
@@ -45,24 +45,24 @@ import java.util.Hashtable;
* extended to provide different types of filters for an image. By
* default this class does nothing to an image passing through it.
*
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public class ImageFilter implements ImageConsumer, Cloneable
{
/**
* The consumer this filter is filtering an image data stream for.
- * It is initialized in the method <code>getFilterInstance</code>.
+ * It is initialized in the method <code>getFilterInstance</code>.
*/
protected ImageConsumer consumer = null;
/**
* The <code>ImageConsumer</code> can use this method to request
- * the pixels be delivered in top-down, left-right order.
- * <br>
- * The filter can respond in three different ways.
+ * the pixels be delivered in top-down, left-right order.
+ * <br>
+ * The filter can respond in three different ways.
* <ul>
- * <li>The default behavior is to forward the request to the
- * <code>ImageProducer</code>
+ * <li>The default behavior is to forward the request to the
+ * <code>ImageProducer</code>
* using the method <code>requestTopDownLeftRightResend</code>
* and using the filter as the consumer.</li>
* <li>The filter has the pixels and can retransmit them in the
@@ -77,7 +77,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
/**
* By default, returns a shallow copy of the object created by
- * <code>Object.clone()</code>
+ * <code>Object.clone()</code>
*
* @see java.lang.Object#clone ()
*/
@@ -98,7 +98,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
/**
* This is the only method which can set the
* <code>ImageConsumer</code> for this filter. By default a clone
- * of this filter with the appropriate consumer set is returned.
+ * of this filter with the appropriate consumer set is returned.
*
* @see #clone ()
*/
@@ -111,13 +111,13 @@ public class ImageFilter implements ImageConsumer, Cloneable
/**
* An <code>ImageProducer</code> indicates the size of the image
- * being produced using this method. A filter can override this
+ * being produced using this method. A filter can override this
* method to intercept these calls from the producer in order to
* change either the width or the height before in turn calling
* the consumer's <code>setDimensions</code> method.
- *
+ *
* @param width the width of the image
- * @param height the height of the image
+ * @param height the height of the image
*/
public void setDimensions(int width, int height)
{
@@ -128,7 +128,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
* An <code>ImageProducer</code> can set a list of properties
* associated with this image by using this method.
*
- * @param props the list of properties associated with this image
+ * @param props the list of properties associated with this image
*/
public void setProperties(Hashtable<?,?> props)
{
@@ -160,9 +160,9 @@ public class ImageFilter implements ImageConsumer, Cloneable
* The <code>ImageProducer</code> should call this method with a
* bit mask of hints from any of <code>RANDOMPIXELORDER</code>,
* <code>TOPDOWNLEFTRIGHT</code>, <code>COMPLETESCANLINES</code>,
- * <code>SINGLEPASS</code>, <code>SINGLEFRAME</code> from the
+ * <code>SINGLEPASS</code>, <code>SINGLEFRAME</code> from the
* <code>ImageConsumer</code> interface.
- *
+ *
* @param flags a bit mask of hints
* @see ImageConsumer
*/
@@ -174,7 +174,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as a <code>byte</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -185,7 +185,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
+ public void setPixels(int x, int y, int w, int h,
ColorModel model, byte[] pixels, int offset,
int scansize)
{
@@ -195,7 +195,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as an <code>int</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -206,7 +206,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
+ public void setPixels(int x, int y, int w, int h,
ColorModel model, int[] pixels, int offset,
int scansize)
{
@@ -217,7 +217,7 @@ public class ImageFilter implements ImageConsumer, Cloneable
* The <code>ImageProducer</code> calls this method to indicate a
* single frame or the entire image is complete. The method is
* also used to indicate an error in loading or producing the
- * image.
+ * image.
*/
public void imageComplete(int status)
{
diff --git a/java/awt/image/ImageObserver.java b/java/awt/image/ImageObserver.java
index 36dd013f4..e63d4bba1 100644
--- a/java/awt/image/ImageObserver.java
+++ b/java/awt/image/ImageObserver.java
@@ -46,7 +46,7 @@ import java.awt.Image;
* <code>ImageProducer</code> asynchronously.
*
* @see ImageProducer
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public interface ImageObserver
{
@@ -54,7 +54,7 @@ public interface ImageObserver
* The width of the image has been provided as the
* <code>width</code> argument to <code>imageUpdate</code>.
*
- * @see #imageUpdate
+ * @see #imageUpdate
*/
int WIDTH = 1;
@@ -62,7 +62,7 @@ public interface ImageObserver
* The height of the image has been provided as the
* <code>height</code> argument to <code>imageUpdate</code>.
*
- * @see #imageUpdate
+ * @see #imageUpdate
*/
int HEIGHT = 2;
@@ -78,7 +78,7 @@ public interface ImageObserver
* More pixels are now available for drawing a scaled variation of
* the image.
*
- * @see #imageUpdate
+ * @see #imageUpdate
*/
int SOMEBITS = 8;
@@ -86,7 +86,7 @@ public interface ImageObserver
* All the pixels needed to draw a complete frame of a multi-frame
* image are available.
*
- * @see #imageUpdate
+ * @see #imageUpdate
*/
int FRAMEBITS = 16;
@@ -121,9 +121,9 @@ public interface ImageObserver
* @param y the y coordinate of the image
* @param width the width of the image
* @param height the height of the image
- *
- * @see java.awt.Image
+ *
+ * @see java.awt.Image
*/
- boolean imageUpdate(Image image, int flags, int x,
- int y, int width, int height);
+ boolean imageUpdate(Image image, int flags, int x,
+ int y, int width, int height);
}
diff --git a/java/awt/image/ImageProducer.java b/java/awt/image/ImageProducer.java
index 49846685a..c0f9ad4c7 100644
--- a/java/awt/image/ImageProducer.java
+++ b/java/awt/image/ImageProducer.java
@@ -45,25 +45,25 @@ package java.awt.image;
* resizing the image.
*
* @see ImageConsumer
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public interface ImageProducer
{
/**
* Used to register an <code>ImageConsumer</code> with this
- * <code>ImageProducer</code>.
+ * <code>ImageProducer</code>.
*/
void addConsumer(ImageConsumer ic);
/**
* Used to determine if the given <code>ImageConsumer</code> is
- * already registered with this <code>ImageProducer</code>.
+ * already registered with this <code>ImageProducer</code>.
*/
boolean isConsumer(ImageConsumer ic);
/**
* Used to remove an <code>ImageConsumer</code> from the list of
- * registered consumers for this <code>ImageProducer</code>.
+ * registered consumers for this <code>ImageProducer</code>.
*/
void removeConsumer(ImageConsumer ic);
@@ -71,15 +71,14 @@ public interface ImageProducer
* Used to register an <code>ImageConsumer</code> with this
* <code>ImageProducer</code> and then immediately start
* reconstruction of the image data to be delivered to all
- * registered consumers.
+ * registered consumers.
*/
void startProduction(ImageConsumer ic);
/**
* Used to register an <code>ImageConsumer</code> with this
* <code>ImageProducer</code> and then request that this producer
- * resend the image data in the order top-down, left-right.
+ * resend the image data in the order top-down, left-right.
*/
void requestTopDownLeftRightResend(ImageConsumer ic);
}
-
diff --git a/java/awt/image/IndexColorModel.java b/java/awt/image/IndexColorModel.java
index d8a27d51f..340d38e89 100644
--- a/java/awt/image/IndexColorModel.java
+++ b/java/awt/image/IndexColorModel.java
@@ -49,9 +49,9 @@ import java.math.BigInteger;
* Thus, pixel values are indexes into the color map. Each color component is
* an 8-bit unsigned value.
* <br><br>
- * The <code>IndexColorModel</code> supports a map of valid pixels, allowing
- * the representation of holes in the the color map. The valid map is
- * represented as a {@link BigInteger} where each bit indicates the validity
+ * The <code>IndexColorModel</code> supports a map of valid pixels, allowing
+ * the representation of holes in the the color map. The valid map is
+ * represented as a {@link BigInteger} where each bit indicates the validity
* of the map entry with the same index.
* <br><br>
* Colors can have alpha components for transparency support. If alpha
@@ -59,11 +59,11 @@ import java.math.BigInteger;
* supports a reserved pixel value to represent completely transparent colors,
* no matter what the actual color component values are.
* <br><br>
- * <code>IndexColorModel</code> supports anywhere from 1 to 16 bit index
- * values. The allowed transfer types are {@link DataBuffer#TYPE_BYTE} and
+ * <code>IndexColorModel</code> supports anywhere from 1 to 16 bit index
+ * values. The allowed transfer types are {@link DataBuffer#TYPE_BYTE} and
* {@link DataBuffer#TYPE_USHORT}.
*
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public class IndexColorModel extends ColorModel
{
@@ -74,22 +74,22 @@ public class IndexColorModel extends ColorModel
private BigInteger validBits = BigInteger.ZERO;
/**
- * Creates a new indexed color model for <code>size</code> color elements
- * with no alpha component. Each array must contain at least
- * <code>size</code> elements. For each array, the i-th color is described
- * by reds[i], greens[i] and blues[i].
+ * Creates a new indexed color model for <code>size</code> color elements
+ * with no alpha component. Each array must contain at least
+ * <code>size</code> elements. For each array, the i-th color is described
+ * by reds[i], greens[i] and blues[i].
*
- * @param bits the number of bits needed to represent <code>size</code>
+ * @param bits the number of bits needed to represent <code>size</code>
* colors.
* @param size the number of colors in the color map.
* @param reds the red component of all colors.
* @param greens the green component of all colors.
* @param blues the blue component of all colors.
*
- * @throws IllegalArgumentException if <code>bits</code> &lt; 1 or
+ * @throws IllegalArgumentException if <code>bits</code> &lt; 1 or
* <code>bits</code> &gt; 16.
* @throws NullPointerException if any of the arrays is <code>null</code>.
- * @throws ArrayIndexOutOfBoundsException if <code>size</code> is greater
+ * @throws ArrayIndexOutOfBoundsException if <code>size</code> is greater
* than the length of the component arrays.
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
@@ -100,34 +100,34 @@ public class IndexColorModel extends ColorModel
/**
* Creates a new indexed color model for <code>size</code> color elements.
- * Each array must contain at least <code>size</code> elements. For each
- * array, the i-th color is described by reds[i], greens[i] and blues[i].
- * All the colors are opaque except for the transparent color.
+ * Each array must contain at least <code>size</code> elements. For each
+ * array, the i-th color is described by reds[i], greens[i] and blues[i].
+ * All the colors are opaque except for the transparent color.
*
- * @param bits the number of bits needed to represent <code>size</code>
+ * @param bits the number of bits needed to represent <code>size</code>
* colors
* @param size the number of colors in the color map
* @param reds the red component of all colors
* @param greens the green component of all colors
* @param blues the blue component of all colors
- * @param trans the index of the transparent color (use -1 for no
+ * @param trans the index of the transparent color (use -1 for no
* transparent color).
- *
- * @throws IllegalArgumentException if <code>bits</code> &lt; 1 or
+ *
+ * @throws IllegalArgumentException if <code>bits</code> &lt; 1 or
* <code>bits</code> &gt; 16.
* @throws NullPointerException if any of the arrays is <code>null</code>.
- * @throws ArrayIndexOutOfBoundsException if <code>size</code> is greater
+ * @throws ArrayIndexOutOfBoundsException if <code>size</code> is greater
* than the length of the component arrays.
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
byte[] blues, int trans)
{
- super(bits, nArray(8, (0 <= trans && trans < size) ? 4 : 3),
- ColorSpace.getInstance(ColorSpace.CS_sRGB),
- (0 <= trans && trans < size), // hasAlpha
- false, OPAQUE,
- Buffers.smallestAppropriateTransferType(bits));
- if (bits < 1)
+ super(bits, nArray(8, (0 <= trans && trans < size) ? 4 : 3),
+ ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ (0 <= trans && trans < size), // hasAlpha
+ false, OPAQUE,
+ Buffers.smallestAppropriateTransferType(bits));
+ if (bits < 1)
throw new IllegalArgumentException("bits < 1");
if (bits > 16)
throw new IllegalArgumentException("bits > 16");
@@ -150,35 +150,35 @@ public class IndexColorModel extends ColorModel
}
/**
- * Creates a new indexed color model for <code>size</code> color elements
- * including alpha. Each array must contain at least <code>size</code>
- * elements. For each array, the i-th color is described
- * by reds[i], greens[i], blues[i] and alphas[i].
+ * Creates a new indexed color model for <code>size</code> color elements
+ * including alpha. Each array must contain at least <code>size</code>
+ * elements. For each array, the i-th color is described
+ * by reds[i], greens[i], blues[i] and alphas[i].
*
- * @param bits the number of bits needed to represent <code>size</code>
+ * @param bits the number of bits needed to represent <code>size</code>
* colors.
* @param size the number of colors in the color map.
* @param reds the red component of all colors.
* @param greens the green component of all colors.
* @param blues the blue component of all colors.
- * @param alphas the alpha component of all colors (<code>null</code>
+ * @param alphas the alpha component of all colors (<code>null</code>
* permitted).
*
- * @throws IllegalArgumentException if <code>bits</code> &lt; 1 or
+ * @throws IllegalArgumentException if <code>bits</code> &lt; 1 or
* <code>bits</code> &gt; 16.
* @throws NullPointerException if <code>reds</code>, <code>greens</code> or
* <code>blues</code> is <code>null</code>.
- * @throws ArrayIndexOutOfBoundsException if <code>size</code> is greater
+ * @throws ArrayIndexOutOfBoundsException if <code>size</code> is greater
* than the length of the component arrays.
*/
public IndexColorModel(int bits, int size, byte[] reds, byte[] greens,
byte[] blues, byte[] alphas)
{
- super(bits, nArray(8, (alphas == null ? 3 : 4)),
- ColorSpace.getInstance(ColorSpace.CS_sRGB),
- (alphas != null), false, TRANSLUCENT,
- Buffers.smallestAppropriateTransferType(bits));
- if (bits < 1)
+ super(bits, nArray(8, (alphas == null ? 3 : 4)),
+ ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ (alphas != null), false, TRANSLUCENT,
+ Buffers.smallestAppropriateTransferType(bits));
+ if (bits < 1)
throw new IllegalArgumentException("bits < 1");
if (bits > 16)
throw new IllegalArgumentException("bits > 16");
@@ -201,11 +201,11 @@ public class IndexColorModel extends ColorModel
}
else
{
- byte alphaZero = (byte) 0x00;
+ byte alphaZero = (byte) 0x00;
byte alphaOne = (byte) 0xFF;
for (int i = 0; i < size; i++)
{
- alphaZero = (byte) (alphaZero | alphas[i]);
+ alphaZero = (byte) (alphaZero | alphas[i]);
alphaOne = (byte) (alphaOne & alphas[i]);
rgb[i] = ((alphas[i] & 0xff) << 24
| ((reds[i] & 0xff) << 16)
@@ -213,9 +213,9 @@ public class IndexColorModel extends ColorModel
| (blues[i] & 0xff));
}
if ((alphaZero == (byte) 0x00) || (alphaOne == (byte) 0xFF))
- transparency = BITMASK;
- else
- transparency = TRANSLUCENT;
+ transparency = BITMASK;
+ else
+ transparency = TRANSLUCENT;
}
// Generate a bigint with 1's for every pixel
@@ -223,22 +223,22 @@ public class IndexColorModel extends ColorModel
}
/**
- * Creates a new indexed color model using the color components in
+ * Creates a new indexed color model using the color components in
* <code>cmap</code>. If <code>hasAlpha</code> is <code>true</code> then
* <code>cmap</code> contains an alpha component after each of the red, green
* and blue components.
*
- * @param bits the number of bits needed to represent <code>size</code>
+ * @param bits the number of bits needed to represent <code>size</code>
* colors
* @param size the number of colors in the color map
* @param cmap packed color components
* @param start the offset of the first color component in <code>cmap</code>
* @param hasAlpha <code>cmap</code> has alpha values
- * @throws IllegalArgumentException if bits &lt; 1, bits &gt; 16, or size
+ * @throws IllegalArgumentException if bits &lt; 1, bits &gt; 16, or size
* &lt; 1.
* @throws NullPointerException if <code>cmap</code> is <code>null</code>.
*/
- public IndexColorModel(int bits, int size, byte[] cmap, int start,
+ public IndexColorModel(int bits, int size, byte[] cmap, int start,
boolean hasAlpha)
{
this(bits, size, cmap, start, hasAlpha, -1);
@@ -247,8 +247,8 @@ public class IndexColorModel extends ColorModel
/**
* Construct an IndexColorModel from an array of red, green, blue, and
* optional alpha components. The component values are interleaved as RGB(A).
- *
- * @param bits the number of bits needed to represent <code>size</code>
+ *
+ * @param bits the number of bits needed to represent <code>size</code>
* colors
* @param size the number of colors in the color map
* @param cmap interleaved color components
@@ -259,12 +259,12 @@ public class IndexColorModel extends ColorModel
* &lt; 1.
* @throws NullPointerException if <code>cmap</code> is <code>null</code>.
*/
- public IndexColorModel(int bits, int size, byte[] cmap, int start,
+ public IndexColorModel(int bits, int size, byte[] cmap, int start,
boolean hasAlpha, int trans)
{
- super(bits, nArray(8, hasAlpha || (0 <= trans && trans < size) ? 4 : 3),
+ super(bits, nArray(8, hasAlpha || (0 <= trans && trans < size) ? 4 : 3),
ColorSpace.getInstance(ColorSpace.CS_sRGB),
- hasAlpha || (0 <= trans && trans < size), false, OPAQUE,
+ hasAlpha || (0 <= trans && trans < size), false, OPAQUE,
Buffers.smallestAppropriateTransferType(bits));
if (bits < 1)
throw new IllegalArgumentException("bits < 1");
@@ -282,37 +282,37 @@ public class IndexColorModel extends ColorModel
int alphaZero = 0x00; // use to detect all zeros
int alphaOne = 0xff; // use to detect all ones
for (int i = 0; i < size; i++) {
- alpha = cmap[4 * i + 3 + start] & 0xff;
+ alpha = cmap[4 * i + 3 + start] & 0xff;
alphaZero = alphaZero | alpha;
alphaOne = alphaOne & alpha;
rgb[i] =
- ( alpha << 24
- // red
- | ((cmap[4 * i + start] & 0xff) << 16)
- // green
- | ((cmap[4 * i + 1 + start] & 0xff) << 8)
- // blue
- | (cmap[4 * i + 2 + start] & 0xff));
+ ( alpha << 24
+ // red
+ | ((cmap[4 * i + start] & 0xff) << 16)
+ // green
+ | ((cmap[4 * i + 1 + start] & 0xff) << 8)
+ // blue
+ | (cmap[4 * i + 2 + start] & 0xff));
}
- if (alphaZero == 0)
- transparency = BITMASK;
- else if (alphaOne == 255)
+ if (alphaZero == 0)
+ transparency = BITMASK;
+ else if (alphaOne == 255)
transparency = (trans != -1 ? BITMASK : OPAQUE);
else
- transparency = TRANSLUCENT;
+ transparency = TRANSLUCENT;
}
else
{
for (int i = 0; i < size; i++)
- rgb[i] = (0xff000000
- // red
- | ((cmap[3 * i + start] & 0xff) << 16)
- // green
- | ((cmap[3 * i + 1 + start] & 0xff) << 8)
- // blue
- | (cmap[3 * i + 2 + start] & 0xff));
+ rgb[i] = (0xff000000
+ // red
+ | ((cmap[3 * i + start] & 0xff) << 16)
+ // green
+ | ((cmap[3 * i + 1 + start] & 0xff) << 8)
+ // blue
+ | (cmap[3 * i + 2 + start] & 0xff));
if (trans != -1)
- transparency = BITMASK;
+ transparency = BITMASK;
}
setTransparentPixel(trans);
@@ -327,30 +327,30 @@ public class IndexColorModel extends ColorModel
* alpha values packed in order. If hasAlpha is false, then all the colors
* are opaque except for the transparent color.
*
- * @param bits the number of bits needed to represent <code>size</code>
+ * @param bits the number of bits needed to represent <code>size</code>
* colors
* @param size the number of colors in the color map
* @param cmap packed color components
* @param start the offset of the first color component in <code>cmap</code>
* @param hasAlpha <code>cmap</code> has alpha values
* @param trans the index of the transparent color
- * @param transferType {@link DataBuffer#TYPE_BYTE} or
+ * @param transferType {@link DataBuffer#TYPE_BYTE} or
{@link DataBuffer#TYPE_USHORT}.
* @throws IllegalArgumentException if bits &lt; 1, bits &gt; 16, or size
* &lt; 1.
* @throws IllegalArgumentException if <code>transferType</code> is something
- * other than {@link DataBuffer#TYPE_BYTE} or
+ * other than {@link DataBuffer#TYPE_BYTE} or
* {@link DataBuffer#TYPE_USHORT}.
*/
- public IndexColorModel(int bits, int size, int[] cmap, int start,
+ public IndexColorModel(int bits, int size, int[] cmap, int start,
boolean hasAlpha, int trans, int transferType)
{
- super(bits,
- nArray(8, 4), // bits for each channel
- ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
- true, // has alpha
- false, // not premultiplied
- TRANSLUCENT, transferType);
+ super(bits,
+ nArray(8, 4), // bits for each channel
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
+ true, // has alpha
+ false, // not premultiplied
+ TRANSLUCENT, transferType);
if (transferType != DataBuffer.TYPE_BYTE
&& transferType != DataBuffer.TYPE_USHORT)
throw new IllegalArgumentException();
@@ -363,7 +363,7 @@ public class IndexColorModel extends ColorModel
rgb = createColorMap(bits, size);
if (!hasAlpha)
for (int i = 0; i < size; i++)
- rgb[i] = cmap[i + start] | 0xff000000;
+ rgb[i] = cmap[i + start] | 0xff000000;
else
System.arraycopy(cmap, start, rgb, 0, size);
@@ -383,14 +383,14 @@ public class IndexColorModel extends ColorModel
* <br><br>
* This constructor permits indicating which colormap entries are valid,
* using the validBits argument. Each entry in cmap is valid if the
- * corresponding bit in validBits is set.
- *
- * @param bits the number of bits needed to represent <code>size</code>
+ * corresponding bit in validBits is set.
+ *
+ * @param bits the number of bits needed to represent <code>size</code>
* colors.
* @param size the number of colors in the color map.
* @param cmap packed color components.
* @param start the offset of the first color component in <code>cmap</code>.
- * @param transferType {@link DataBuffer#TYPE_BYTE} or
+ * @param transferType {@link DataBuffer#TYPE_BYTE} or
* {@link DataBuffer#TYPE_USHORT}.
* @param validBits a map of the valid entries in <code>cmap</code>.
* @throws IllegalArgumentException if bits &lt; 1, bits &gt; 16, or size
@@ -398,15 +398,15 @@ public class IndexColorModel extends ColorModel
* @throws IllegalArgumentException if transferType is something other than
* {@link DataBuffer#TYPE_BYTE} or {@link DataBuffer#TYPE_USHORT}.
*/
- public IndexColorModel(int bits, int size, int[] cmap, int start,
+ public IndexColorModel(int bits, int size, int[] cmap, int start,
int transferType, BigInteger validBits)
{
super(bits, // total bits, sRGB, four channels
- nArray(8, 4), // bits for each channel
- ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
- true, // has alpha
- false, // not premultiplied
- TRANSLUCENT, transferType);
+ nArray(8, 4), // bits for each channel
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
+ true, // has alpha
+ false, // not premultiplied
+ TRANSLUCENT, transferType);
if (transferType != DataBuffer.TYPE_BYTE
&& transferType != DataBuffer.TYPE_USHORT)
throw new IllegalArgumentException();
@@ -422,7 +422,7 @@ public class IndexColorModel extends ColorModel
rgb = createColorMap(bits, size);
if (!hasAlpha)
for (int i = 0; i < size; i++)
- rgb[i] = cmap[i + start] | 0xff000000;
+ rgb[i] = cmap[i + start] | 0xff000000;
else
System.arraycopy(cmap, start, rgb, 0, size);
}
@@ -440,7 +440,7 @@ public class IndexColorModel extends ColorModel
/**
* Get the index of the transparent color in this color model.
*
- * @return The index of the color that is considered transparent, or -1 if
+ * @return The index of the color that is considered transparent, or -1 if
* there is no transparent color.
*/
public final int getTransparentPixel()
@@ -449,13 +449,13 @@ public class IndexColorModel extends ColorModel
}
/**
- * Fills the supplied array with the red component of each color in the
+ * Fills the supplied array with the red component of each color in the
* lookup table.
*
* @param r an array that is at least as large as {@link #getMapSize()}.
* @throws NullPointerException if <code>r</code> is <code>null</code>.
- * @throws ArrayIndexOutOfBoundsException if <code>r</code> has less
- * than {@link #getMapSize()} elements.
+ * @throws ArrayIndexOutOfBoundsException if <code>r</code> has less
+ * than {@link #getMapSize()} elements.
*/
public final void getReds(byte[] r)
{
@@ -465,13 +465,13 @@ public class IndexColorModel extends ColorModel
}
/**
- * Fills the supplied array with the green component of each color in the
+ * Fills the supplied array with the green component of each color in the
* lookup table.
*
* @param g an array that is at least as large as {@link #getMapSize()}.
* @throws NullPointerException if <code>g</code> is <code>null</code>.
- * @throws ArrayIndexOutOfBoundsException if <code>g</code> has less
- * than {@link #getMapSize()} elements.
+ * @throws ArrayIndexOutOfBoundsException if <code>g</code> has less
+ * than {@link #getMapSize()} elements.
*/
public final void getGreens(byte[] g)
{
@@ -481,13 +481,13 @@ public class IndexColorModel extends ColorModel
}
/**
- * Fills the supplied array with the blue component of each color in the
+ * Fills the supplied array with the blue component of each color in the
* lookup table.
*
* @param b an array that is at least as large as {@link #getMapSize()}.
* @throws NullPointerException if <code>b</code> is <code>null</code>.
- * @throws ArrayIndexOutOfBoundsException if <code>b</code> has less
- * than {@link #getMapSize()} elements.
+ * @throws ArrayIndexOutOfBoundsException if <code>b</code> has less
+ * than {@link #getMapSize()} elements.
*/
public final void getBlues(byte[] b)
{
@@ -497,27 +497,27 @@ public class IndexColorModel extends ColorModel
}
/**
- * Fills the supplied array with the alpha component of each color in the
+ * Fills the supplied array with the alpha component of each color in the
* lookup table. If the model has a transparent pixel specified, the alpha
* for that pixel will be 0.
*
* @param a an array that is at least as large as {@link #getMapSize()}.
* @throws NullPointerException if <code>a</code> is <code>null</code>.
- * @throws ArrayIndexOutOfBoundsException if <code>a</code> has less
- * than {@link #getMapSize()} elements.
+ * @throws ArrayIndexOutOfBoundsException if <code>a</code> has less
+ * than {@link #getMapSize()} elements.
*/
public final void getAlphas(byte[] a)
{
int i;
for (i = 0; i < map_size; i++)
- if (i == trans)
- a[i] = (byte) 0;
- else
+ if (i == trans)
+ a[i] = (byte) 0;
+ else
a[i] = (byte) ((0xFF000000 & rgb[i]) >> 24);
}
/**
- * Returns the red component of the color in the lookup table for the
+ * Returns the red component of the color in the lookup table for the
* given pixel value.
*
* @param pixel the pixel lookup value.
@@ -529,12 +529,12 @@ public class IndexColorModel extends ColorModel
{
if (pixel < map_size)
return (0x00FF0000 & rgb[pixel]) >> 16;
-
+
return 0;
}
/**
- * Returns the green component of the color in the lookup table for the
+ * Returns the green component of the color in the lookup table for the
* given pixel value.
*
* @param pixel the pixel lookup value.
@@ -546,12 +546,12 @@ public class IndexColorModel extends ColorModel
{
if (pixel < map_size)
return (0x0000FF00 & rgb[pixel]) >> 8;
-
+
return 0;
}
/**
- * Returns the blue component of the color in the lookup table for the
+ * Returns the blue component of the color in the lookup table for the
* given pixel value.
*
* @param pixel the pixel lookup value.
@@ -563,12 +563,12 @@ public class IndexColorModel extends ColorModel
{
if (pixel < map_size)
return 0x000000FF & rgb[pixel];
-
+
return 0;
}
/**
- * Returns the alpha component of the color in the lookup table for the
+ * Returns the alpha component of the color in the lookup table for the
* given pixel value. If no alpha channel was specified when the color model
* was created, then 255 is returned for all pixels except the transparent
* pixel (if one is defined - see {@link #getTransparentPixel()}) which
@@ -576,7 +576,7 @@ public class IndexColorModel extends ColorModel
*
* @param pixel the pixel lookup value.
*
- * @return The alpha component of the color in the lookup table (in the
+ * @return The alpha component of the color in the lookup table (in the
* range 0 to 255).
* @throws ArrayIndexOutOfBoundsException if <code>pixel</code> is negative.
*/
@@ -587,7 +587,7 @@ public class IndexColorModel extends ColorModel
/**
* Get the RGB color value of the given pixel using the default
- * RGB color model.
+ * RGB color model.
*
* @param pixel the pixel lookup value.
* @return The RGB color value.
@@ -597,13 +597,13 @@ public class IndexColorModel extends ColorModel
{
if (pixel >= 0 && pixel < map_size)
return rgb[pixel];
-
+
return 0;
}
-
+
/**
* Get the RGB color values of all pixels in the map using the default
- * RGB color model.
+ * RGB color model.
*
* @param rgb The destination array.
*/
@@ -611,13 +611,13 @@ public class IndexColorModel extends ColorModel
{
System.arraycopy(this.rgb, 0, rgb, 0, map_size);
}
-
- /**
- * Return <code>true</code> if the lookup table contains valid data for
+
+ /**
+ * Return <code>true</code> if the lookup table contains valid data for
* <code>pixel</code>, and <code>false</code> otherwise.
*
* @param pixel the pixel value used to index the color lookup table.
- * @return <code>true</code> if <code>pixel</code> is valid,
+ * @return <code>true</code> if <code>pixel</code> is valid,
* <code>false</code> otherwise.
*/
public boolean isValid(int pixel)
@@ -626,12 +626,12 @@ public class IndexColorModel extends ColorModel
return validBits.testBit(pixel);
return false;
}
-
- /**
- * Return <code>true</code> if all pixels are valid, <code>false</code>
+
+ /**
+ * Return <code>true</code> if all pixels are valid, <code>false</code>
* otherwise.
*
- * @return <code>true</code> if all pixels are valid, <code>false</code>
+ * @return <code>true</code> if all pixels are valid, <code>false</code>
* otherwise.
*/
public boolean isValid()
@@ -642,28 +642,28 @@ public class IndexColorModel extends ColorModel
allbits = allbits.subtract(new BigInteger("1"));
return allbits.equals(validBits);
}
-
- /**
- * Returns a binary value ({@link BigInteger}) where each bit represents an
+
+ /**
+ * Returns a binary value ({@link BigInteger}) where each bit represents an
* entry in the color lookup table. If the bit is on, the entry is valid.
- *
+ *
* @return The binary value.
*/
public BigInteger getValidPixels()
{
return validBits;
}
-
+
/**
- * Construct a {@link BufferedImage} with rgb pixel values from a
+ * Construct a {@link BufferedImage} with rgb pixel values from a
* {@link Raster}.
- *
+ *
* Constructs a new BufferedImage in which each pixel is an RGBA int from
* a Raster with index-valued pixels. If this model has no alpha component
* or transparent pixel, the type of the new BufferedImage is TYPE_INT_RGB.
* Otherwise the type is TYPE_INT_ARGB. If forceARGB is true, the type is
* forced to be TYPE_INT_ARGB no matter what.
- *
+ *
* @param raster The source of pixel values.
* @param forceARGB True if type must be TYPE_INT_ARGB.
* @return New BufferedImage with RBGA int pixel values.
@@ -672,7 +672,7 @@ public class IndexColorModel extends ColorModel
{
int type = forceARGB ? BufferedImage.TYPE_INT_ARGB
: ((opaque && trans == -1) ? BufferedImage.TYPE_INT_RGB :
- BufferedImage.TYPE_INT_ARGB);
+ BufferedImage.TYPE_INT_ARGB);
// FIXME: assuming that raster has only 1 band since pixels are supposed
// to be int indexes.
diff --git a/java/awt/image/Kernel.java b/java/awt/image/Kernel.java
index 8361c0cf9..ae0ff1469 100644
--- a/java/awt/image/Kernel.java
+++ b/java/awt/image/Kernel.java
@@ -49,10 +49,10 @@ public class Kernel implements Cloneable
{
/** The kernel width. */
private final int width;
-
+
/** The kernel height. */
private final int height;
-
+
/** Internal storage for the kernel's values. */
private final float[] data;
@@ -64,10 +64,10 @@ public class Kernel implements Cloneable
* @param width the kernel width.
* @param height the kernel height.
* @param data the source data array (<code>null</code> not permitted).
- *
+ *
* @throws IllegalArgumentException if <code>data.length</code> is less than
* <code>width * height</code>.
- * @throws IllegalArgumentException if <code>width</code> or
+ * @throws IllegalArgumentException if <code>width</code> or
* <code>height</code> is less than zero.
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
@@ -83,9 +83,9 @@ public class Kernel implements Cloneable
}
/**
- * Returns the x-origin for the kernel, which is calculated as
+ * Returns the x-origin for the kernel, which is calculated as
* <code>(width - 1) / 2</code>.
- *
+ *
* @return The x-origin for the kernel.
*/
public final int getXOrigin()
@@ -96,7 +96,7 @@ public class Kernel implements Cloneable
/**
* Returns the y-origin for the kernel, which is calculated as
* <code>(height - 1) / 2</code>.
- *
+ *
* @return The y-origin for the kernel.
*/
public final int getYOrigin()
@@ -106,7 +106,7 @@ public class Kernel implements Cloneable
/**
* Returns the kernel width (as supplied to the constructor).
- *
+ *
* @return The kernel width.
*/
public final int getWidth()
@@ -116,7 +116,7 @@ public class Kernel implements Cloneable
/**
* Returns the kernel height (as supplied to the constructor).
- *
+ *
* @return The kernel height.
*/
public final int getHeight()
@@ -125,18 +125,18 @@ public class Kernel implements Cloneable
}
/**
- * Returns an array containing a copy of the kernel data. If the
+ * Returns an array containing a copy of the kernel data. If the
* <code>data</code> argument is non-<code>null</code>, the kernel values
* are copied into it and then <code>data</code> is returned as the result.
- * If the <code>data</code> argument is <code>null</code>, this method
+ * If the <code>data</code> argument is <code>null</code>, this method
* allocates a new array then populates and returns it.
*
- * @param data an array to copy the return values into (if
+ * @param data an array to copy the return values into (if
* <code>null</code>, a new array is allocated).
- *
+ *
* @return The array with copied values.
- *
- * @throws IllegalArgumentException if <code>data.length</code> is less than
+ *
+ * @throws IllegalArgumentException if <code>data.length</code> is less than
* the kernel's <code>width * height</code>.
*/
public final float[] getKernelData(float[] data)
@@ -154,7 +154,7 @@ public class Kernel implements Cloneable
/**
* Returns a clone of this kernel.
- *
+ *
* @return a clone of this Kernel.
*/
public Object clone()
diff --git a/java/awt/image/LookupOp.java b/java/awt/image/LookupOp.java
index 5b0cf7831..0bc79a00b 100644
--- a/java/awt/image/LookupOp.java
+++ b/java/awt/image/LookupOp.java
@@ -44,31 +44,31 @@ import java.awt.geom.Rectangle2D;
/**
* LookupOp is a filter that converts each pixel using a lookup table.
- *
+ *
* For filtering Rasters, the lookup table must have either one component
* that is applied to all bands, or one component for every band in the
* Rasters.
- *
+ *
* For BufferedImages, the lookup table may apply to both color and alpha
* components. If the lookup table contains one component, or if there are
* the same number of components as color components in the source, the table
* applies to all color components. Otherwise the table applies to all
* components including alpha. Alpha premultiplication is ignored during the
* lookup filtering.
- *
+ *
* After filtering, if color conversion is necessary, the conversion happens,
* taking alpha premultiplication into account.
- *
+ *
* @author jlquinn
*/
public class LookupOp implements BufferedImageOp, RasterOp
{
private LookupTable lut;
private RenderingHints hints;
-
+
/**
* Construct a new LookupOp using the given LookupTable.
- *
+ *
* @param lookup LookupTable to use.
* @param hints Rendering hints (can be null).
*/
@@ -77,12 +77,12 @@ public class LookupOp implements BufferedImageOp, RasterOp
lut = lookup;
this.hints = hints;
}
-
+
/**
* Converts the source image using the lookup table specified in the
* constructor. The resulting image is stored in the destination image if one
- * is provided; otherwise a new BufferedImage is created and returned.
- *
+ * is provided; otherwise a new BufferedImage is created and returned.
+ *
* The source image cannot use an IndexColorModel, and the destination image
* (if one is provided) must have the same size.
*
@@ -98,17 +98,17 @@ public class LookupOp implements BufferedImageOp, RasterOp
{
if (src.getColorModel() instanceof IndexColorModel)
throw new IllegalArgumentException("LookupOp.filter: IndexColorModel "
- + "not allowed");
-
+ + "not allowed");
+
if (lut.getNumComponents() != 1
&& lut.getNumComponents() != src.getColorModel().getNumComponents()
&& lut.getNumComponents() != src.getColorModel().getNumColorComponents())
throw new IllegalArgumentException("LookupOp.filter: Incompatible " +
"lookup table and source image");
-
+
if (dst == null)
dst = createCompatibleDestImage(src, null);
-
+
else if (src.getHeight() != dst.getHeight() || src.getWidth() != dst.getWidth())
throw new IllegalArgumentException("Source and destination images are " +
"different sizes.");
@@ -131,16 +131,16 @@ public class LookupOp implements BufferedImageOp, RasterOp
int[] dbuf = new int[src.getColorModel().getNumComponents()];
int tmpBands = src.getColorModel().getNumColorComponents();
int[] tmp = new int[tmpBands];
-
+
// Filter the pixels
for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
- {
+ {
// Filter only color components, but also copy alpha
sr.getPixel(x, y, dbuf);
System.arraycopy(dbuf, 0, tmp, 0, tmpBands);
dr.setPixel(x, y, lut.lookupPixel(tmp, dbuf));
-
+
/* The reference implementation does not use LookupTable.lookupPixel,
* but rather it seems to copy the table into a native array. The
* effect of this (a probable bug in their implementation) is that
@@ -148,7 +148,7 @@ public class LookupOp implements BufferedImageOp, RasterOp
* out of bounds exception, but will instead return random garbage.
* A bad lookup on a ShortLookupTable, however, will throw an
* exception.
- *
+ *
* Instead of mimicing this behaviour, we always throw an
* ArrayOutofBoundsException by virtue of using
* LookupTable.lookupPixle.
@@ -159,16 +159,16 @@ public class LookupOp implements BufferedImageOp, RasterOp
{
// No alpha to ignore
int[] dbuf = new int[src.getColorModel().getNumComponents()];
-
+
// Filter the pixels
for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
dr.setPixel(x, y, lut.lookupPixel(sr.getPixel(x, y, dbuf), dbuf));
}
-
+
if (tgt != dst)
new ColorConvertOp(hints).filter(tgt, dst);
-
+
return dst;
}
@@ -184,13 +184,13 @@ public class LookupOp implements BufferedImageOp, RasterOp
* @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
*/
public BufferedImage createCompatibleDestImage(BufferedImage src,
- ColorModel dstCM)
+ ColorModel dstCM)
{
if (dstCM != null)
return new BufferedImage(dstCM,
src.getRaster().createCompatibleWritableRaster(),
src.isAlphaPremultiplied(), null);
-
+
// This is a strange exception, done for compatibility with the reference
// (as demonstrated by a mauve testcase)
int imgType = src.getType();
@@ -202,9 +202,9 @@ public class LookupOp implements BufferedImageOp, RasterOp
/**
* Returns the corresponding destination point for a given source point.
- *
+ *
* This Op will return the source point unchanged.
- *
+ *
* @param src The source point.
* @param dst The destination point.
*/
@@ -219,7 +219,7 @@ public class LookupOp implements BufferedImageOp, RasterOp
/**
* Return the LookupTable for this op.
- *
+ *
* @return The lookup table.
*/
public final LookupTable getTable()
@@ -237,11 +237,11 @@ public class LookupOp implements BufferedImageOp, RasterOp
/**
* Filter a raster through a lookup table.
- *
+ *
* Applies the lookup table for this Rasterop to each pixel of src and
* puts the results in dest. If dest is null, a new Raster is created and
* returned.
- *
+ *
* @param src The source raster.
* @param dest The destination raster.
* @return The WritableRaster with the filtered pixels.
@@ -252,7 +252,7 @@ public class LookupOp implements BufferedImageOp, RasterOp
*/
public final WritableRaster filter(Raster src, WritableRaster dest)
{
- if (dest == null)
+ if (dest == null)
// Allocate a raster if needed
dest = createCompatibleDestRaster(src);
else
@@ -260,19 +260,19 @@ public class LookupOp implements BufferedImageOp, RasterOp
throw new IllegalArgumentException("Source and destination rasters " +
"are incompatible.");
- if (lut.getNumComponents() != 1
+ if (lut.getNumComponents() != 1
&& lut.getNumComponents() != src.getNumBands())
throw new IllegalArgumentException("Lookup table is incompatible with " +
"this raster.");
-
- // Allocate pixel storage.
+
+ // Allocate pixel storage.
int[] tmp = new int[src.getNumBands()];
-
+
// Filter the pixels
for (int y = src.getMinY(); y < src.getHeight() + src.getMinY(); y++)
for (int x = src.getMinX(); x < src.getWidth() + src.getMinX(); x++)
dest.setPixel(x, y, lut.lookupPixel(src.getPixel(x, y, tmp), tmp));
-
+
/* The reference implementation does not use LookupTable.lookupPixel,
* but rather it seems to copy the table into a native array. The
* effect of this (a probable bug in their implementation) is that
@@ -280,7 +280,7 @@ public class LookupOp implements BufferedImageOp, RasterOp
* out of bounds exception, but will instead return random garbage.
* A bad lookup on a ShortLookupTable, however, will throw an
* exception.
- *
+ *
* Instead of mimicing this behaviour, we always throw an
* ArrayOutofBoundsException by virtue of using
* LookupTable.lookupPixle.
diff --git a/java/awt/image/LookupTable.java b/java/awt/image/LookupTable.java
index f814b8e09..d104b2fd5 100644
--- a/java/awt/image/LookupTable.java
+++ b/java/awt/image/LookupTable.java
@@ -61,7 +61,7 @@ public abstract class LookupTable
*
* If numComponents is 1, the same translation table is used for all pixel
* components.
- *
+ *
* @param offset Offset to be subtracted.
* @param numComponents Number of image components.
* @exception IllegalArgumentException if offset < 0 or numComponents < 1.
@@ -87,7 +87,7 @@ public abstract class LookupTable
return offset;
}
-
+
/**
* Return translated values for a pixel.
*
diff --git a/java/awt/image/MemoryImageSource.java b/java/awt/image/MemoryImageSource.java
index 83a03ca44..e8780f6f5 100644
--- a/java/awt/image/MemoryImageSource.java
+++ b/java/awt/image/MemoryImageSource.java
@@ -77,7 +77,7 @@ public class MemoryImageSource implements ImageProducer
/**
* Constructs an ImageProducer from memory.
- *
+ *
* @param w the image width.
* @param h the image height.
* @param cm the color model.
@@ -85,7 +85,7 @@ public class MemoryImageSource implements ImageProducer
* @param off the offset to the first pixel in the array.
* @param scan the number of array elements from a pixel on one row to the
* corresponding pixel on the next row.
- * @param props image properties (<code>null</code> permitted).
+ * @param props image properties (<code>null</code> permitted).
*/
public MemoryImageSource(int w, int h, ColorModel cm, byte[] pix, int off,
int scan, Hashtable<?,?> props)
@@ -119,7 +119,7 @@ public class MemoryImageSource implements ImageProducer
/**
* Constructs an ImageProducer from memory
- *
+ *
* @param w the image width.
* @param h the image height.
* @param cm the color model.
@@ -127,7 +127,7 @@ public class MemoryImageSource implements ImageProducer
* @param off the offset to the first pixel in the array.
* @param scan the number of array elements from a pixel on one row to the
* corresponding pixel on the next row.
- * @param props image properties (<code>null</code> permitted).
+ * @param props image properties (<code>null</code> permitted).
*/
public MemoryImageSource(int w, int h, ColorModel cm, int[] pix, int off,
int scan, Hashtable<?,?> props)
@@ -144,14 +144,14 @@ public class MemoryImageSource implements ImageProducer
/**
* Constructs an ImageProducer from memory using the default RGB ColorModel.
- *
+ *
* @param w the image width.
* @param h the image height.
* @param pix the image data.
* @param off the offset to the first pixel in the array.
* @param scan the number of array elements from a pixel on one row to the
* corresponding pixel on the next row.
- * @param props image properties (<code>null</code> permitted).
+ * @param props image properties (<code>null</code> permitted).
*/
public MemoryImageSource(int w, int h, int[] pix, int off, int scan,
@@ -162,13 +162,13 @@ public class MemoryImageSource implements ImageProducer
/**
* Constructs an ImageProducer from memory using the default RGB ColorModel.
- *
+ *
* @param w the image width.
* @param h the image height.
* @param pix the image data.
* @param off the offset to the first pixel in the array.
* @param scan the number of array elements from a pixel on one row to the
- * corresponding pixel on the next row.
+ * corresponding pixel on the next row.
*/
public MemoryImageSource(int w, int h, int[] pix, int off, int scan)
{
@@ -178,7 +178,7 @@ public class MemoryImageSource implements ImageProducer
/**
* Used to register an <code>ImageConsumer</code> with this
* <code>ImageProducer</code>.
- *
+ *
* @param ic the image consumer.
*/
public synchronized void addConsumer(ImageConsumer ic)
@@ -192,7 +192,7 @@ public class MemoryImageSource implements ImageProducer
/**
* Used to determine if the given <code>ImageConsumer</code> is
* already registered with this <code>ImageProducer</code>.
- *
+ *
* @param ic the image consumer.
*/
public synchronized boolean isConsumer(ImageConsumer ic)
@@ -205,7 +205,7 @@ public class MemoryImageSource implements ImageProducer
/**
* Used to remove an <code>ImageConsumer</code> from the list of
* registered consumers for this <code>ImageProducer</code>.
- *
+ *
* @param ic the image consumer.
*/
public synchronized void removeConsumer(ImageConsumer ic)
@@ -227,12 +227,12 @@ public class MemoryImageSource implements ImageProducer
Vector list = (Vector) consumers.clone();
for (int i = 0; i < list.size(); i++)
{
- ic = (ImageConsumer) list.elementAt(i);
- sendPicture(ic);
- if (animated)
- ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
- else
- ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
+ ic = (ImageConsumer) list.elementAt(i);
+ sendPicture(ic);
+ if (animated)
+ ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
+ else
+ ic.imageComplete(ImageConsumer.STATICIMAGEDONE);
}
}
@@ -240,7 +240,7 @@ public class MemoryImageSource implements ImageProducer
* Used to register an <code>ImageConsumer</code> with this
* <code>ImageProducer</code> and then request that this producer
* resend the image data in the order top-down, left-right.
- *
+ *
* @param ic the image consumer.
*/
public void requestTopDownLeftRightResend(ImageConsumer ic)
@@ -278,14 +278,14 @@ public class MemoryImageSource implements ImageProducer
{
if (animated == true)
{
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for (int i = 0; i < list.size(); i++)
- {
- ic = (ImageConsumer) list.elementAt(i);
- sendPicture(ic);
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
- }
+ ImageConsumer ic;
+ Vector list = (Vector) consumers.clone();
+ for (int i = 0; i < list.size(); i++)
+ {
+ ic = (ImageConsumer) list.elementAt(i);
+ sendPicture(ic);
+ ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ }
}
}
@@ -305,7 +305,7 @@ public class MemoryImageSource implements ImageProducer
/**
* Send an animation frame to the image consumers containing the specified
* pixels unless setFullBufferUpdates is set.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param w the width.
@@ -315,38 +315,38 @@ public class MemoryImageSource implements ImageProducer
{
if (animated == true)
{
- if (fullbuffers)
- newPixels();
- else
- {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for (int i = 0; i < list.size(); i++)
- {
- ic = (ImageConsumer) list.elementAt(i);
- ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
- if (props != null)
- ic.setProperties(props);
- if (pixeli != null)
- {
- int[] pixelbuf = new int[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset,
- pixelbuf, 0, w * h);
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- else
- {
- byte[] pixelbuf = new byte[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset,
- pixelbuf, 0, w * h);
-
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
- }
- }
+ if (fullbuffers)
+ newPixels();
+ else
+ {
+ ImageConsumer ic;
+ Vector list = (Vector) consumers.clone();
+ for (int i = 0; i < list.size(); i++)
+ {
+ ic = (ImageConsumer) list.elementAt(i);
+ ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+ if (props != null)
+ ic.setProperties(props);
+ if (pixeli != null)
+ {
+ int[] pixelbuf = new int[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixeli, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ else
+ {
+ byte[] pixelbuf = new byte[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixelb, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ }
+ }
}
}
@@ -356,7 +356,7 @@ public class MemoryImageSource implements ImageProducer
*
* If framenotify is set then a notification is sent when the frame
* is sent otherwise no status is sent.
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
* @param w the width.
@@ -368,38 +368,38 @@ public class MemoryImageSource implements ImageProducer
{
if (animated == true)
{
- if (fullbuffers)
- newPixels();
- else
- {
- ImageConsumer ic;
- Vector list = (Vector) consumers.clone();
- for (int i = 0; i < list.size(); i++)
- {
- ic = (ImageConsumer) list.elementAt(i);
- ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
- if (props != null)
- ic.setProperties(props);
- if (pixeli != null)
- {
- int[] pixelbuf = new int[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixeli, row * scansize + x + offset,
- pixelbuf, 0, w * h);
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- else
- {
- byte[] pixelbuf = new byte[w * h];
- for (int row = y; row < y + h; row++)
- System.arraycopy(pixelb, row * scansize + x + offset,
- pixelbuf, 0, w * h);
- ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
- }
- if (framenotify == true)
- ic.imageComplete(ImageConsumer.SINGLEFRAME);
- }
- }
+ if (fullbuffers)
+ newPixels();
+ else
+ {
+ ImageConsumer ic;
+ Vector list = (Vector) consumers.clone();
+ for (int i = 0; i < list.size(); i++)
+ {
+ ic = (ImageConsumer) list.elementAt(i);
+ ic.setHints(ImageConsumer.TOPDOWNLEFTRIGHT);
+ if (props != null)
+ ic.setProperties(props);
+ if (pixeli != null)
+ {
+ int[] pixelbuf = new int[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixeli, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ else
+ {
+ byte[] pixelbuf = new byte[w * h];
+ for (int row = y; row < y + h; row++)
+ System.arraycopy(pixelb, row * scansize + x + offset,
+ pixelbuf, 0, w * h);
+ ic.setPixels(x, y, w, h, cm, pixelbuf, 0, w);
+ }
+ if (framenotify == true)
+ ic.imageComplete(ImageConsumer.SINGLEFRAME);
+ }
+ }
}
}
diff --git a/java/awt/image/MultiPixelPackedSampleModel.java b/java/awt/image/MultiPixelPackedSampleModel.java
index 8db26b52d..592611cbb 100644
--- a/java/awt/image/MultiPixelPackedSampleModel.java
+++ b/java/awt/image/MultiPixelPackedSampleModel.java
@@ -65,14 +65,14 @@ public class MultiPixelPackedSampleModel extends SampleModel
* <li>{@link DataBuffer#TYPE_USHORT};</li>
* <li>{@link DataBuffer#TYPE_INT};</li>
* </ul>
- *
+ *
* @param dataType the data type.
* @param w the width (in pixels).
* @param h the height (in pixels).
* @param numberOfBits the number of bits per pixel (must be a power of 2).
*/
public MultiPixelPackedSampleModel(int dataType, int w, int h,
- int numberOfBits)
+ int numberOfBits)
{
this(dataType, w, h, numberOfBits, 0, 0);
}
@@ -85,35 +85,35 @@ public class MultiPixelPackedSampleModel extends SampleModel
* <li>{@link DataBuffer#TYPE_USHORT};</li>
* <li>{@link DataBuffer#TYPE_INT};</li>
* </ul>
- *
+ *
* @param dataType the data type.
* @param w the width (in pixels).
* @param h the height (in pixels).
* @param numberOfBits the number of bits per pixel (must be a power of 2).
- * @param scanlineStride the number of data elements from a pixel on one
+ * @param scanlineStride the number of data elements from a pixel on one
* row to the corresponding pixel in the next row.
* @param dataBitOffset the offset to the first data bit.
*/
public MultiPixelPackedSampleModel(int dataType, int w, int h,
- int numberOfBits, int scanlineStride,
- int dataBitOffset)
+ int numberOfBits, int scanlineStride,
+ int dataBitOffset)
{
super(dataType, w, h, 1);
switch (dataType)
{
case DataBuffer.TYPE_BYTE:
- elemBits = 8;
- break;
+ elemBits = 8;
+ break;
case DataBuffer.TYPE_USHORT:
- elemBits = 16;
- break;
+ elemBits = 16;
+ break;
case DataBuffer.TYPE_INT:
- elemBits = 32;
- break;
+ elemBits = 32;
+ break;
default:
- throw new IllegalArgumentException("MultiPixelPackedSampleModel"
- + " unsupported dataType");
+ throw new IllegalArgumentException("MultiPixelPackedSampleModel"
+ + " unsupported dataType");
}
this.dataBitOffset = dataBitOffset;
@@ -121,13 +121,13 @@ public class MultiPixelPackedSampleModel extends SampleModel
this.numberOfBits = numberOfBits;
if (numberOfBits > elemBits)
throw new RasterFormatException("MultiPixelPackedSampleModel pixel size"
- + " larger than dataType");
+ + " larger than dataType");
switch (numberOfBits)
{
case 1: case 2: case 4: case 8: case 16: case 32: break;
default:
- throw new RasterFormatException("MultiPixelPackedSampleModel pixel"
- + " size not 2^n bits");
+ throw new RasterFormatException("MultiPixelPackedSampleModel pixel"
+ + " size not 2^n bits");
}
numElems = elemBits / numberOfBits;
@@ -136,7 +136,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
scanlineStride = ((dataBitOffset + w * numberOfBits) - 1) / elemBits + 1;
this.scanlineStride = scanlineStride;
-
+
sampleSize = new int[1];
sampleSize[0] = numberOfBits;
@@ -144,9 +144,9 @@ public class MultiPixelPackedSampleModel extends SampleModel
bitOffsets = new int[numElems];
for (int i=0; i < numElems; i++)
{
- bitOffsets[numElems - i- 1] = numberOfBits * i;
- bitMasks[numElems - i - 1] = ((1 << numberOfBits) - 1) <<
- bitOffsets[numElems - i - 1];
+ bitOffsets[numElems - i- 1] = numberOfBits * i;
+ bitMasks[numElems - i - 1] = ((1 << numberOfBits) - 1) <<
+ bitOffsets[numElems - i - 1];
}
}
@@ -154,10 +154,10 @@ public class MultiPixelPackedSampleModel extends SampleModel
* Creates a new <code>MultiPixelPackedSample</code> model with the same
* data type and bits per pixel as this model, but with the specified
* dimensions.
- *
+ *
* @param w the width (in pixels).
* @param h the height (in pixels).
- *
+ *
* @return The new sample model.
*/
public SampleModel createCompatibleSampleModel(int w, int h)
@@ -172,7 +172,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
* Creates a DataBuffer for holding pixel data in the format and
* layout described by this SampleModel. The returned buffer will
* consist of one single bank.
- *
+ *
* @return A new data buffer.
*/
public DataBuffer createDataBuffer()
@@ -186,7 +186,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
/**
* Returns the number of data elements required to transfer a pixel in the
* get/setDataElements() methods.
- *
+ *
* @return <code>1</code>.
*/
public int getNumDataElements()
@@ -195,29 +195,29 @@ public class MultiPixelPackedSampleModel extends SampleModel
}
/**
- * Returns an array containing the size (in bits) of the samples in each
+ * Returns an array containing the size (in bits) of the samples in each
* band. The <code>MultiPixelPackedSampleModel</code> class supports only
- * one band, so this method returns an array with length <code>1</code>.
- *
- * @return An array containing the size (in bits) of the samples in band zero.
- *
+ * one band, so this method returns an array with length <code>1</code>.
+ *
+ * @return An array containing the size (in bits) of the samples in band zero.
+ *
* @see #getSampleSize(int)
*/
public int[] getSampleSize()
{
return (int[]) sampleSize.clone();
}
-
+
/**
* Returns the size of the samples in the specified band. Note that the
* <code>MultiPixelPackedSampleModel</code> supports only one band -- this
* method ignored the <code>band</code> argument, and always returns the size
* of band zero.
- *
+ *
* @param band the band (this parameter is ignored).
- *
+ *
* @return The size of the samples in band zero.
- *
+ *
* @see #getSampleSize()
*/
public int getSampleSize(int band)
@@ -227,12 +227,12 @@ public class MultiPixelPackedSampleModel extends SampleModel
/**
* Returns the index in the data buffer that stores the pixel at (x, y).
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
- *
+ *
* @return The index in the data buffer that stores the pixel at (x, y).
- *
+ *
* @see #getBitOffset(int)
*/
public int getOffset(int x, int y)
@@ -241,11 +241,11 @@ public class MultiPixelPackedSampleModel extends SampleModel
}
/**
- * The bit offset (within an element in the data buffer) of the pixels with
+ * The bit offset (within an element in the data buffer) of the pixels with
* the specified x-coordinate.
- *
+ *
* @param x the x-coordinate.
- *
+ *
* @return The bit offset.
*/
public int getBitOffset(int x)
@@ -255,7 +255,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
/**
* Returns the offset to the first data bit.
- *
+ *
* @return The offset to the first data bit.
*/
public int getDataBitOffset()
@@ -266,7 +266,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
/**
* Returns the number of data elements from a pixel in one row to the
* corresponding pixel in the next row.
- *
+ *
* @return The scanline stride.
*/
public int getScanlineStride()
@@ -276,14 +276,14 @@ public class MultiPixelPackedSampleModel extends SampleModel
/**
* Returns the number of bits per pixel.
- *
+ *
* @return The number of bits per pixel.
*/
public int getPixelBitStride()
{
return numberOfBits;
}
-
+
/**
* Returns the transfer type, which is one of the following (depending on
* the number of bits per sample for this model):
@@ -292,7 +292,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
* <li>{@link DataBuffer#TYPE_USHORT};</li>
* <li>{@link DataBuffer#TYPE_INT};</li>
* </ul>
- *
+ *
* @return The transfer type.
*/
public int getTransferType()
@@ -310,12 +310,12 @@ public class MultiPixelPackedSampleModel extends SampleModel
* only supports a single band, this overridden implementation just returns
* a new instance of <code>MultiPixelPackedSampleModel</code>, with the same
* attributes as this instance.
- *
+ *
* @param bands the bands to include in the subset (this is ignored, except
* that if it is non-<code>null</code> a check is made to ensure that the
* array length is equal to <code>1</code>).
- *
- * @throws RasterFormatException if <code>bands</code> is not
+ *
+ * @throws RasterFormatException if <code>bands</code> is not
* <code>null</code> and <code>bands.length != 1</code>.
*/
public SampleModel createSubsetSampleModel(int[] bands)
@@ -323,7 +323,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
if (bands != null && bands.length != 1)
throw new RasterFormatException("MultiPixelPackedSampleModel only"
+ " supports one band");
- return new MultiPixelPackedSampleModel(dataType, width, height,
+ return new MultiPixelPackedSampleModel(dataType, width, height,
numberOfBits, scanlineStride, dataBitOffset);
}
@@ -334,15 +334,15 @@ public class MultiPixelPackedSampleModel extends SampleModel
* array obj, since there is only one band. If obj is null, a new array of
* getTransferType() is created.
*
- * @param x The x-coordinate of the pixel rectangle to store in
+ * @param x The x-coordinate of the pixel rectangle to store in
* <code>obj</code>.
- * @param y The y-coordinate of the pixel rectangle to store in
+ * @param y The y-coordinate of the pixel rectangle to store in
* <code>obj</code>.
- * @param obj The primitive array to store the pixels into or null to force
+ * @param obj The primitive array to store the pixels into or null to force
* creation.
* @param data The DataBuffer that is the source of the pixel data.
* @return The primitive array containing the pixel data.
- * @see java.awt.image.SampleModel#getDataElements(int, int, Object,
+ * @see java.awt.image.SampleModel#getDataElements(int, int, Object,
* DataBuffer)
*/
public Object getDataElements(int x, int y, Object obj, DataBuffer data)
@@ -351,17 +351,17 @@ public class MultiPixelPackedSampleModel extends SampleModel
switch (getTransferType())
{
case DataBuffer.TYPE_BYTE:
- if (obj == null)
+ if (obj == null)
obj = new byte[1];
((byte[]) obj)[0] = (byte) pixel;
return obj;
case DataBuffer.TYPE_USHORT:
- if (obj == null)
+ if (obj == null)
obj = new short[1];
((short[]) obj)[0] = (short) pixel;
return obj;
case DataBuffer.TYPE_INT:
- if (obj == null)
+ if (obj == null)
obj = new int[1];
((int[]) obj)[0] = pixel;
return obj;
@@ -372,42 +372,42 @@ public class MultiPixelPackedSampleModel extends SampleModel
}
/**
- * Returns an array (of length 1) containing the sample for the pixel at
- * (x, y) in the specified data buffer. If <code>iArray</code> is not
- * <code>null</code>, it will be populated with the sample value and
- * returned as the result of this function (this avoids allocating a new
+ * Returns an array (of length 1) containing the sample for the pixel at
+ * (x, y) in the specified data buffer. If <code>iArray</code> is not
+ * <code>null</code>, it will be populated with the sample value and
+ * returned as the result of this function (this avoids allocating a new
* array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return An array containing the pixel sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
{
- if (iArray == null)
+ if (iArray == null)
iArray = new int[1];
iArray[0] = getSample(x, y, 0, data);
return iArray;
}
/**
- * Returns the sample value for the pixel at (x, y) in the specified data
+ * Returns the sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int getSample(int x, int y, int b, DataBuffer data)
@@ -418,7 +418,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
int samples = data.getElem(offset);
return (samples & bitMasks[pos]) >>> bitOffsets[pos];
}
-
+
/**
* Set the pixel at x, y to the value in the first element of the primitive
* array obj.
@@ -472,17 +472,17 @@ public class MultiPixelPackedSampleModel extends SampleModel
}
/**
- * Sets the sample value for the pixel at (x, y) in the specified data
- * buffer to the specified value.
- *
+ * Sets the sample value for the pixel at (x, y) in the specified data
+ * buffer to the specified value.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param iArray the sample value (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
- *
+ *
* @see #setSample(int, int, int, int, DataBuffer)
*/
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
@@ -491,16 +491,16 @@ public class MultiPixelPackedSampleModel extends SampleModel
}
/**
- * Sets the sample value for a band for the pixel at (x, y) in the
- * specified data buffer.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the
+ * specified data buffer.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public void setSample(int x, int y, int b, int s, DataBuffer data)
@@ -516,13 +516,13 @@ public class MultiPixelPackedSampleModel extends SampleModel
sample |= s;
data.setElem(offset, sample);
}
-
+
/**
- * Tests this sample model for equality with an arbitrary object. This
+ * Tests this sample model for equality with an arbitrary object. This
* method returns <code>true</code> if and only if:
* <ul>
* <li><code>obj</code> is not <code>null</code>;
- * <li><code>obj</code> is an instance of
+ * <li><code>obj</code> is an instance of
* <code>MultiPixelPackedSampleModel</code>;
* <li>both models have the same:
* <ul>
@@ -535,17 +535,17 @@ public class MultiPixelPackedSampleModel extends SampleModel
* </ul>
* </li>
* </ul>
- *
+ *
* @param obj the object (<code>null</code> permitted)
- *
+ *
* @return <code>true</code> if this model is equal to <code>obj</code>, and
* <code>false</code> otherwise.
*/
- public boolean equals(Object obj)
+ public boolean equals(Object obj)
{
- if (this == obj)
+ if (this == obj)
return true;
- if (! (obj instanceof MultiPixelPackedSampleModel))
+ if (! (obj instanceof MultiPixelPackedSampleModel))
return false;
MultiPixelPackedSampleModel that = (MultiPixelPackedSampleModel) obj;
if (this.dataType != that.dataType)
@@ -562,10 +562,10 @@ public class MultiPixelPackedSampleModel extends SampleModel
return false;
return true;
}
-
+
/**
* Returns a hash code for this <code>MultiPixelPackedSampleModel</code>.
- *
+ *
* @return A hash code.
*/
public int hashCode()
@@ -580,7 +580,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
result = 37 * result + dataBitOffset;
return result;
}
-
+
/**
* Creates a String with some information about this SampleModel.
* @return A String describing this SampleModel.
@@ -596,7 +596,7 @@ public class MultiPixelPackedSampleModel extends SampleModel
{
result.append(", mask[").append(i).append("]=0x").append(Integer.toHexString(bitMasks[i]));
}
-
+
result.append("]");
return result.toString();
}
diff --git a/java/awt/image/PackedColorModel.java b/java/awt/image/PackedColorModel.java
index b60230fa7..a89d73b8c 100644
--- a/java/awt/image/PackedColorModel.java
+++ b/java/awt/image/PackedColorModel.java
@@ -48,44 +48,44 @@ import java.awt.color.ColorSpace;
public abstract class PackedColorModel extends ColorModel
{
private int masks[];
-
+
/* Package accessibility, the DirectColorModel needs this array */
int shifts[];
public PackedColorModel(ColorSpace cspace, int pixelBits,
- int[] colorMaskArray, int alphaMask,
- boolean isAlphaPremultiplied,
- int transparency,
- int transferType)
+ int[] colorMaskArray, int alphaMask,
+ boolean isAlphaPremultiplied,
+ int transparency,
+ int transferType)
{
super(pixelBits, calcBitsPerComponent(colorMaskArray, alphaMask),
- cspace, (alphaMask != 0), isAlphaPremultiplied, transparency,
- transferType);
+ cspace, (alphaMask != 0), isAlphaPremultiplied, transparency,
+ transferType);
initMasks(colorMaskArray, alphaMask);
if ((pixelBits<1) || (pixelBits>32)) {
throw new IllegalArgumentException("pixels per bits must be " +
- "in the range [1, 32]");
+ "in the range [1, 32]");
}
}
-
+
private static int[] calcBitsPerComponent(int[] colorMaskArray,
- int alphaMask)
+ int alphaMask)
{
int numComponents = colorMaskArray.length;
if (alphaMask != 0) numComponents++;
-
+
int[] bitsPerComponent = new int[numComponents];
-
+
BitMaskExtent extent = new BitMaskExtent();
for (int b=0; b<colorMaskArray.length; b++)
{
- extent.setMask(colorMaskArray[b]);
- bitsPerComponent[b] = extent.bitWidth;
+ extent.setMask(colorMaskArray[b]);
+ bitsPerComponent[b] = extent.bitWidth;
}
if (alphaMask != 0)
{
- extent.setMask(alphaMask);
- bitsPerComponent[numComponents-1] = extent.bitWidth;
+ extent.setMask(alphaMask);
+ bitsPerComponent[numComponents-1] = extent.bitWidth;
}
return bitsPerComponent;
}
@@ -96,38 +96,38 @@ public abstract class PackedColorModel extends ColorModel
int numComponents = colorMaskArray.length;
if (alphaMask == 0)
{
- masks = colorMaskArray;
+ masks = colorMaskArray;
}
else
{
- masks = new int[numComponents+1];
- System.arraycopy(colorMaskArray, 0,
- masks, 0,
- numComponents);
- masks[numComponents++] = alphaMask;
+ masks = new int[numComponents+1];
+ System.arraycopy(colorMaskArray, 0,
+ masks, 0,
+ numComponents);
+ masks[numComponents++] = alphaMask;
}
-
+
shifts = new int[numComponents];
-
+
// Bit field handling have been moved to a utility class
BitMaskExtent extent = new BitMaskExtent();
for (int b=0; b<numComponents; b++)
{
- extent.setMask(masks[b]);
- shifts[b] = extent.leastSignificantBit;
+ extent.setMask(masks[b]);
+ shifts[b] = extent.leastSignificantBit;
}
}
-
+
public PackedColorModel(ColorSpace cspace, int pixelBits,
- int rmask, int gmask, int bmask,
- int amask, boolean isAlphaPremultiplied,
- int transparency,
- int transferType)
+ int rmask, int gmask, int bmask,
+ int amask, boolean isAlphaPremultiplied,
+ int transparency,
+ int transferType)
{
this(cspace, pixelBits, makeColorMaskArray(rmask, gmask, bmask),
- amask, isAlphaPremultiplied, transparency, transferType);
+ amask, isAlphaPremultiplied, transparency, transferType);
}
-
+
/* TODO: If there is a alpha mask, it is inefficient to create a
color mask array that will be discarded when the alpha mask is
appended. We should probably create a private constructor that
@@ -138,13 +138,13 @@ public abstract class PackedColorModel extends ColorModel
{
int[] colorMaskArray = { rmask, gmask, bmask };
return colorMaskArray;
- }
+ }
public final int getMask(int index)
{
return masks[index];
}
-
+
public final int[] getMasks()
{
return masks;
@@ -154,12 +154,12 @@ public abstract class PackedColorModel extends ColorModel
{
return new SinglePixelPackedSampleModel(transferType, w, h, masks);
}
-
+
public boolean isCompatibleSampleModel(SampleModel sm)
{
if (!super.isCompatibleSampleModel(sm)) return false;
if (!(sm instanceof SinglePixelPackedSampleModel)) return false;
-
+
SinglePixelPackedSampleModel sppsm =
(SinglePixelPackedSampleModel) sm;
return java.util.Arrays.equals(sppsm.getBitMasks(), masks);
@@ -167,7 +167,7 @@ public abstract class PackedColorModel extends ColorModel
public WritableRaster getAlphaRaster(WritableRaster raster) {
if (!hasAlpha()) return null;
-
+
SampleModel sm = raster.getSampleModel();
int[] alphaBand = { sm.getNumBands() - 1 };
SampleModel alphaModel = sm.createSubsetSampleModel(alphaBand);
@@ -175,14 +175,14 @@ public abstract class PackedColorModel extends ColorModel
Point origin = new Point(0, 0);
return Raster.createWritableRaster(alphaModel, buffer, origin);
}
-
+
public boolean equals(Object obj)
{
if (!super.equals(obj)) return false;
if (!(obj instanceof PackedColorModel)) return false;
-
+
PackedColorModel other = (PackedColorModel) obj;
-
+
return java.util.Arrays.equals(masks, other.masks);
}
}
diff --git a/java/awt/image/PixelGrabber.java b/java/awt/image/PixelGrabber.java
index fc5e0efc0..b83fab571 100644
--- a/java/awt/image/PixelGrabber.java
+++ b/java/awt/image/PixelGrabber.java
@@ -95,7 +95,7 @@ public class PixelGrabber implements ImageConsumer
* pixels in the grab rectangle
*/
public PixelGrabber(Image img, int x, int y, int w, int h,
- int pix[], int off, int scansize)
+ int pix[], int off, int scansize)
{
this (img.getSource(), x, y, w, h, pix, off, scansize);
}
@@ -130,7 +130,7 @@ public class PixelGrabber implements ImageConsumer
* pixels in the grab rectangle
*/
public PixelGrabber(ImageProducer ip, int x, int y, int w, int h,
- int pix[], int off, int scansize)
+ int pix[], int off, int scansize)
{
this.ip = ip;
this.x = x;
@@ -175,9 +175,9 @@ public class PixelGrabber implements ImageConsumer
* region's pixel data to RGB
*/
public PixelGrabber(Image img,
- int x, int y,
- int w, int h,
- boolean forceRGB)
+ int x, int y,
+ int w, int h,
+ boolean forceRGB)
{
this.ip = img.getSource();
@@ -192,8 +192,8 @@ public class PixelGrabber implements ImageConsumer
// initialization until setDimensions is called back by ip.
if (width >= 0 && height >= 0)
{
- int_pixel_buffer = new int[width * height];
- byte_pixel_buffer = new byte[width * height];
+ int_pixel_buffer = new int[width * height];
+ byte_pixel_buffer = new byte[width * height];
}
this.forceRGB = forceRGB;
}
@@ -209,11 +209,11 @@ public class PixelGrabber implements ImageConsumer
// Make sure we're not already grabbing.
if (grabbing == false)
{
- grabbing = true;
- grabberThread = new Thread ()
- {
- public void run ()
- {
+ grabbing = true;
+ grabberThread = new Thread ()
+ {
+ public void run ()
+ {
try
{
ip.startProduction (PixelGrabber.this);
@@ -222,9 +222,9 @@ public class PixelGrabber implements ImageConsumer
{
imageComplete(ImageConsumer.IMAGEABORTED);
}
- }
- };
- grabberThread.start ();
+ }
+ };
+ grabberThread.start ();
}
}
@@ -235,12 +235,12 @@ public class PixelGrabber implements ImageConsumer
{
if (grabbing)
{
- // Interrupt the grabbing thread.
+ // Interrupt the grabbing thread.
Thread moribund = grabberThread;
grabberThread = null;
moribund.interrupt();
- imageComplete (ImageConsumer.IMAGEABORTED);
+ imageComplete (ImageConsumer.IMAGEABORTED);
}
}
@@ -282,7 +282,7 @@ public class PixelGrabber implements ImageConsumer
{
if (ms < 0)
return ((observerStatus & (ImageObserver.FRAMEBITS
- | ImageObserver.ALLBITS)) != 0);
+ | ImageObserver.ALLBITS)) != 0);
// Spawn a new ImageProducer thread to send us the image data via
// our ImageConsumer methods.
@@ -290,16 +290,16 @@ public class PixelGrabber implements ImageConsumer
if (ms > 0)
{
- long stop_time = System.currentTimeMillis() + ms;
- long time_remaining;
- while (grabbing)
- {
- time_remaining = stop_time - System.currentTimeMillis();
- if (time_remaining <= 0)
- break;
- wait (time_remaining);
- }
- abortGrabbing ();
+ long stop_time = System.currentTimeMillis() + ms;
+ long time_remaining;
+ while (grabbing)
+ {
+ time_remaining = stop_time - System.currentTimeMillis();
+ if (time_remaining <= 0)
+ break;
+ wait (time_remaining);
+ }
+ abortGrabbing ();
}
else
wait ();
@@ -310,7 +310,7 @@ public class PixelGrabber implements ImageConsumer
return setObserverStatus ();
return ((observerStatus & (ImageObserver.FRAMEBITS
- | ImageObserver.ALLBITS)) != 0);
+ | ImageObserver.ALLBITS)) != 0);
}
// Set observer status flags based on the current consumer status
@@ -328,14 +328,14 @@ public class PixelGrabber implements ImageConsumer
if ((consumerStatus & STATICIMAGEDONE) != 0)
{
- observerStatus |= ImageObserver.ALLBITS;
- retval = true;
+ observerStatus |= ImageObserver.ALLBITS;
+ retval = true;
}
if ((consumerStatus & SINGLEFRAMEDONE) != 0)
{
- observerStatus |= ImageObserver.FRAMEBITS;
- retval = true;
+ observerStatus |= ImageObserver.FRAMEBITS;
+ retval = true;
}
return retval;
@@ -402,7 +402,7 @@ public class PixelGrabber implements ImageConsumer
* ImageConsumer methods should be called by code that instantiates
* a PixelGrabber. They are only made public so they can be called
* by the PixelGrabber's ImageProducer.
- *
+ *
* @param width the width of the image
* @param height the height of the image
*/
@@ -472,7 +472,7 @@ public class PixelGrabber implements ImageConsumer
* bit mask of hints from any of <code>RANDOMPIXELORDER</code>,
* <code>TOPDOWNLEFTRIGHT</code>, <code>COMPLETESCANLINES</code>,
* <code>SINGLEPASS</code>, <code>SINGLEFRAME</code>.
- *
+ *
* setHints is an ImageConsumer method. None of PixelGrabber's
* ImageConsumer methods should be called by code that instantiates
* a PixelGrabber. They are only made public so they can be called
@@ -505,9 +505,9 @@ public class PixelGrabber implements ImageConsumer
* @param offset offset into pixels array
* @param scansize width of one row in the pixel block
*/
- public synchronized void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels,
- int offset, int scansize)
+ public synchronized void setPixels(int x, int y, int w, int h,
+ ColorModel model, byte[] pixels,
+ int offset, int scansize)
{
ColorModel currentModel;
if (model != null)
@@ -517,31 +517,31 @@ public class PixelGrabber implements ImageConsumer
for(int yp = y; yp < (y + h); yp++)
{
- for(int xp = x; xp < (x + w); xp++)
- {
- // Check if the coordinates (xp, yp) are within the
- // pixel block that we are grabbing.
- if(xp >= this.x
- && yp >= this.y
- && xp < (this.x + this.width)
- && yp < (this.y + this.height))
- {
- int i = (yp - this.y) * this.scansize + (xp - this.x) + this.offset;
- int p = (yp - y) * scansize + (xp - x) + offset;
- if (forceRGB)
- {
- ints_delivered = true;
-
- int_pixel_buffer[i] = currentModel.getRGB (pixels[p] & 0xFF);
- }
- else
- {
- bytes_delivered = true;
-
- byte_pixel_buffer[i] = pixels[p];
- }
- }
- }
+ for(int xp = x; xp < (x + w); xp++)
+ {
+ // Check if the coordinates (xp, yp) are within the
+ // pixel block that we are grabbing.
+ if(xp >= this.x
+ && yp >= this.y
+ && xp < (this.x + this.width)
+ && yp < (this.y + this.height))
+ {
+ int i = (yp - this.y) * this.scansize + (xp - this.x) + this.offset;
+ int p = (yp - y) * scansize + (xp - x) + offset;
+ if (forceRGB)
+ {
+ ints_delivered = true;
+
+ int_pixel_buffer[i] = currentModel.getRGB (pixels[p] & 0xFF);
+ }
+ else
+ {
+ bytes_delivered = true;
+
+ byte_pixel_buffer[i] = pixels[p];
+ }
+ }
+ }
}
}
@@ -565,9 +565,9 @@ public class PixelGrabber implements ImageConsumer
* @param offset offset into pixels array
* @param scansize width of one row in the pixel block
*/
- public synchronized void setPixels(int x, int y, int w, int h,
- ColorModel model, int[] pixels,
- int offset, int scansize)
+ public synchronized void setPixels(int x, int y, int w, int h,
+ ColorModel model, int[] pixels,
+ int offset, int scansize)
{
ColorModel currentModel;
if (model != null)
@@ -579,23 +579,23 @@ public class PixelGrabber implements ImageConsumer
for(int yp = y; yp < (y + h); yp++)
{
- for(int xp = x; xp < (x + w); xp++)
- {
- // Check if the coordinates (xp, yp) are within the
- // pixel block that we are grabbing.
- if(xp >= this.x
- && yp >= this.y
- && xp < (this.x + this.width)
- && yp < (this.y + this.height))
- {
- int i = (yp - this.y) * this.scansize + (xp - this.x) + this.offset;
- int p = (yp - y) * scansize + (xp - x) + offset;
- if (forceRGB)
- int_pixel_buffer[i] = currentModel.getRGB (pixels[p]);
- else
- int_pixel_buffer[i] = pixels[p];
- }
- }
+ for(int xp = x; xp < (x + w); xp++)
+ {
+ // Check if the coordinates (xp, yp) are within the
+ // pixel block that we are grabbing.
+ if(xp >= this.x
+ && yp >= this.y
+ && xp < (this.x + this.width)
+ && yp < (this.y + this.height))
+ {
+ int i = (yp - this.y) * this.scansize + (xp - this.x) + this.offset;
+ int p = (yp - y) * scansize + (xp - x) + offset;
+ if (forceRGB)
+ int_pixel_buffer[i] = currentModel.getRGB (pixels[p]);
+ else
+ int_pixel_buffer[i] = pixels[p];
+ }
+ }
}
}
diff --git a/java/awt/image/PixelInterleavedSampleModel.java b/java/awt/image/PixelInterleavedSampleModel.java
index 3a0d4152c..13134b413 100644
--- a/java/awt/image/PixelInterleavedSampleModel.java
+++ b/java/awt/image/PixelInterleavedSampleModel.java
@@ -58,7 +58,7 @@ public class PixelInterleavedSampleModel
bandOffsets);
}
-
+
/**
* Creates a new <code>SampleModel</code> that is like this one, but
* uses the specified width and height.
diff --git a/java/awt/image/RGBImageFilter.java b/java/awt/image/RGBImageFilter.java
index 3cd14239c..1354c3a80 100644
--- a/java/awt/image/RGBImageFilter.java
+++ b/java/awt/image/RGBImageFilter.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package java.awt.image;
/**
- * A filter designed to filter images in the default RGBColorModel regardless of
+ * A filter designed to filter images in the default RGBColorModel regardless of
* the ImageProducer's ColorModel.
*
* @author Mark Benvenuto (mcb54@columbia.edu)
@@ -49,7 +49,7 @@ public abstract class RGBImageFilter extends ImageFilter
protected ColorModel origmodel;
protected ColorModel newmodel;
-
+
/**
* Specifies whether to apply the filter to the index entries of the
* IndexColorModel. Subclasses should set this to true if the filter
@@ -60,7 +60,7 @@ public abstract class RGBImageFilter extends ImageFilter
/**
* Construct new RGBImageFilter.
*/
- public RGBImageFilter()
+ public RGBImageFilter()
{
}
@@ -75,7 +75,7 @@ public abstract class RGBImageFilter extends ImageFilter
*
* @see ColorModel
*/
- public void setColorModel(ColorModel model)
+ public void setColorModel(ColorModel model)
{
if ((model instanceof IndexColorModel) && canFilterIndexColorModel)
{
@@ -90,10 +90,10 @@ public abstract class RGBImageFilter extends ImageFilter
}
/**
- * Registers a new ColorModel to subsitute for the old ColorModel when
- * setPixels encounters the a pixel with the old ColorModel. The pixel
+ * Registers a new ColorModel to subsitute for the old ColorModel when
+ * setPixels encounters the a pixel with the old ColorModel. The pixel
* remains unchanged except for a new ColorModel.
- *
+ *
* @param oldcm the old ColorModel
* @param newcm the new ColorModel
*/
@@ -109,7 +109,7 @@ public abstract class RGBImageFilter extends ImageFilter
*
* @param icm an IndexColorModel to filter
*/
- public IndexColorModel filterIndexColorModel(IndexColorModel icm)
+ public IndexColorModel filterIndexColorModel(IndexColorModel icm)
{
int len = icm.getMapSize();
byte[] reds = new byte[len];
@@ -175,8 +175,8 @@ public abstract class RGBImageFilter extends ImageFilter
}
/**
- * If the ColorModel is the same ColorModel which as already converted
- * then it converts it the converted ColorModel. Otherwise it passes the
+ * If the ColorModel is the same ColorModel which as already converted
+ * then it converts it the converted ColorModel. Otherwise it passes the
* array of pixels through filterRGBpixels.
*
* @param x the x coordinate of the rectangle
@@ -217,7 +217,7 @@ public abstract class RGBImageFilter extends ImageFilter
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as an <code>int</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
diff --git a/java/awt/image/Raster.java b/java/awt/image/Raster.java
index 615155fb3..6d99c3683 100644
--- a/java/awt/image/Raster.java
+++ b/java/awt/image/Raster.java
@@ -46,44 +46,44 @@ import java.awt.Rectangle;
* A rectangular collection of pixels composed from a {@link DataBuffer} which
* stores the pixel values, and a {@link SampleModel} which is used to retrieve
* the pixel values.
- *
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class Raster
{
/** The sample model used to access the pixel values. */
protected SampleModel sampleModel;
-
+
/** The data buffer used to store the pixel values. */
protected DataBuffer dataBuffer;
-
+
/** The x-coordinate of the top left corner of the raster. */
protected int minX;
-
+
/** The y-coordinate of the top left corner of the raster. */
protected int minY;
-
+
/** The width of the raster. */
protected int width;
-
+
/** The height of the raster. */
protected int height;
-
+
protected int sampleModelTranslateX;
-
+
protected int sampleModelTranslateY;
-
+
/** The number of bands. */
protected int numBands;
-
+
protected int numDataElements;
-
+
/** The raster's parent. */
protected Raster parent;
-
+
/**
* Creates a new raster.
- *
+ *
* @param sampleModel the sample model.
* @param origin the origin.
*/
@@ -91,10 +91,10 @@ public class Raster
{
this(sampleModel, sampleModel.createDataBuffer(), origin);
}
-
+
/**
* Creates a new raster.
- *
+ *
* @param sampleModel the sample model.
* @param dataBuffer the data buffer.
* @param origin the origin.
@@ -108,7 +108,7 @@ public class Raster
/**
* Creates a new raster.
- *
+ *
* @param sampleModel the sample model.
* @param dataBuffer the data buffer.
* @param aRegion the raster's bounds.
@@ -124,7 +124,7 @@ public class Raster
this.minY = aRegion.y;
this.width = aRegion.width;
this.height = aRegion.height;
-
+
// If sampleModelTranslate is null, use (0,0). Methods such as
// Raster.createRaster are specified to allow for a null argument.
if (sampleModelTranslate != null)
@@ -137,16 +137,16 @@ public class Raster
this.numDataElements = sampleModel.getNumDataElements();
this.parent = parent;
}
-
+
/**
* Creates an interleaved raster using the specified data type.
- *
+ *
* @param dataType the data type.
* @param w the width.
* @param h the height.
* @param bands the number of bands.
* @param location
- *
+ *
* @return The new raster.
*/
public static WritableRaster createInterleavedRaster(int dataType,
@@ -154,9 +154,9 @@ public class Raster
{
int[] bandOffsets = new int[bands];
// TODO: Maybe not generate this every time.
- for (int b = 0; b < bands; b++)
+ for (int b = 0; b < bands; b++)
bandOffsets[b] = b;
-
+
int scanlineStride = bands * w;
return createInterleavedRaster(dataType, w, h, scanlineStride, bands,
bandOffsets, location);
@@ -164,20 +164,20 @@ public class Raster
/**
* Creates an interleaved raster.
- *
+ *
* @param dataType the data type.
* @param w the width.
* @param h the height.
- * @param scanlineStride the number of data elements from a sample on one
+ * @param scanlineStride the number of data elements from a sample on one
* row to the corresponding sample on the next row.
* @param pixelStride the number of elements from a sample in one pixel to
* the corresponding sample in the next pixel.
* @param bandOffsets the band offsets.
* @param location
- *
+ *
* @return The new raster.
*/
- public static WritableRaster createInterleavedRaster(int dataType,
+ public static WritableRaster createInterleavedRaster(int dataType,
int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets,
Point location)
{
@@ -188,16 +188,16 @@ public class Raster
/**
* Creates a new banded raster.
- *
+ *
* @param dataType the data type.
* @param w the width.
* @param h the height.
* @param bands the number of bands.
- * @param location
- *
+ * @param location
+ *
* @return The new raster.
*/
- public static WritableRaster createBandedRaster(int dataType, int w, int h,
+ public static WritableRaster createBandedRaster(int dataType, int w, int h,
int bands, Point location)
{
SampleModel sm = new BandedSampleModel(dataType, w, h, bands);
@@ -206,16 +206,16 @@ public class Raster
/**
* Creates a new banded raster.
- *
+ *
* @param dataType the data type.
* @param w the width.
* @param h the height.
- * @param scanlineStride the number of data elements from a sample on one
+ * @param scanlineStride the number of data elements from a sample on one
* row to the corresponding sample on the next row.
* @param bankIndices the index for each bank.
* @param bandOffsets the offset for each band.
* @param location
- *
+ *
* @return The new raster.
*/
public static WritableRaster createBandedRaster(int dataType, int w, int h,
@@ -225,16 +225,16 @@ public class Raster
bankIndices, bandOffsets);
return createWritableRaster(sm, location);
}
-
+
/**
* Creates a new packed raster.
- *
+ *
* @param dataType the data type.
* @param w the width.
* @param h the height.
* @param bandMasks the bit mask for each band.
- * @param location
- *
+ * @param location
+ *
* @return The new raster.
*/
public static WritableRaster createPackedRaster(int dataType, int w, int h,
@@ -247,14 +247,14 @@ public class Raster
/**
* Creates a new raster.
- *
+ *
* @param dataType the data type.
* @param w the width.
* @param h the height.
* @param bands the number of bands.
* @param bitsPerBand the number of bits per band.
* @param location
- *
+ *
* @return The new raster.
*/
public static WritableRaster createPackedRaster(int dataType,
@@ -278,7 +278,7 @@ public class Raster
bandMasks[i] = mask;
mask <<= bitsPerBand;
}
-
+
sm = new SinglePixelPackedSampleModel(dataType, w, h, bandMasks);
}
return createWritableRaster(sm, location);
@@ -286,21 +286,21 @@ public class Raster
/**
* Creates a new interleaved raster.
- *
+ *
* @param dataBuffer the data buffer.
* @param w the width.
* @param h the height.
- * @param scanlineStride the number of data elements from a sample on one
+ * @param scanlineStride the number of data elements from a sample on one
* row to the corresponding sample on the next row.
* @param pixelStride the number of elements from a sample in one pixel to
* the corresponding sample in the next pixel.
* @param bandOffsets the offset for each band.
* @param location
- *
+ *
* @return The new raster.
*/
- public static WritableRaster createInterleavedRaster(DataBuffer dataBuffer,
- int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets,
+ public static WritableRaster createInterleavedRaster(DataBuffer dataBuffer,
+ int w, int h, int scanlineStride, int pixelStride, int[] bandOffsets,
Point location)
{
SampleModel sm = new ComponentSampleModel(dataBuffer.getDataType(),
@@ -310,16 +310,16 @@ public class Raster
/**
* Creates a new banded raster.
- *
+ *
* @param dataBuffer the data buffer.
* @param w the width.
* @param h the height.
- * @param scanlineStride the number of data elements from a sample on one
+ * @param scanlineStride the number of data elements from a sample on one
* row to the corresponding sample on the next row.
* @param bankIndices the index for each bank.
* @param bandOffsets the band offsets.
* @param location
- *
+ *
* @return The new raster.
*/
public static WritableRaster createBandedRaster(DataBuffer dataBuffer,
@@ -330,18 +330,18 @@ public class Raster
w, h, scanlineStride, bankIndices, bandOffsets);
return createWritableRaster(sm, dataBuffer, location);
}
-
+
/**
* Creates a new packed raster.
- *
+ *
* @param dataBuffer the data buffer.
* @param w the width.
* @param h the height.
- * @param scanlineStride the number of data elements from a sample on one
+ * @param scanlineStride the number of data elements from a sample on one
* row to the corresponding sample on the next row.
* @param bandMasks the bit mask for each band.
* @param location
- *
+ *
* @return The new raster.
*/
public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
@@ -351,16 +351,16 @@ public class Raster
w, h, scanlineStride, bandMasks);
return createWritableRaster(sm, dataBuffer, location);
}
-
+
/**
* Creates a new packed raster.
- *
+ *
* @param dataBuffer the data buffer.
* @param w the width.
* @param h the height.
* @param bitsPerPixel the number of bits per pixel.
* @param location
- *
+ *
* @return The new raster.
*/
public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
@@ -370,14 +370,14 @@ public class Raster
w, h, bitsPerPixel);
return createWritableRaster(sm, dataBuffer, location);
}
-
+
/**
* Creates a new raster.
- *
+ *
* @param sm the sample model.
* @param db the data buffer.
* @param location
- *
+ *
* @return The new raster.
*/
public static Raster createRaster(SampleModel sm, DataBuffer db,
@@ -388,10 +388,10 @@ public class Raster
/**
* Creates a new writable raster.
- *
+ *
* @param sm the sample model.
* @param location
- *
+ *
* @return The new writable raster.
*/
public static WritableRaster createWritableRaster(SampleModel sm,
@@ -402,11 +402,11 @@ public class Raster
/**
* Creates a new writable raster.
- *
+ *
* @param sm the sample model.
* @param db the data buffer.
- * @param location
- *
+ * @param location
+ *
* @return The new writable raster.
*/
public static WritableRaster createWritableRaster(SampleModel sm,
@@ -417,7 +417,7 @@ public class Raster
/**
* Returns the raster's parent.
- *
+ *
* @return The raster's parent.
*/
public Raster getParent()
@@ -427,7 +427,7 @@ public class Raster
/**
* Returns the x-translation.
- *
+ *
* @return The x-translation.
*/
public final int getSampleModelTranslateX()
@@ -437,7 +437,7 @@ public class Raster
/**
* Returns the y-translation.
- *
+ *
* @return The y-translation.
*/
public final int getSampleModelTranslateY()
@@ -447,7 +447,7 @@ public class Raster
/**
* Creates a new writable raster that is compatible with this raster.
- *
+ *
* @return A new writable raster.
*/
public WritableRaster createCompatibleWritableRaster()
@@ -457,10 +457,10 @@ public class Raster
/**
* Creates a new writable raster that is compatible with this raster.
- *
+ *
* @param w the width.
* @param h the height.
- *
+ *
* @return A new writable raster.
*/
public WritableRaster createCompatibleWritableRaster(int w, int h)
@@ -471,9 +471,9 @@ public class Raster
/**
* Creates a new writable raster that is compatible with this raster, with
* the specified bounds.
- *
+ *
* @param rect the raster bounds.
- *
+ *
* @return A new writable raster.
*/
public WritableRaster createCompatibleWritableRaster(Rectangle rect)
@@ -485,12 +485,12 @@ public class Raster
/**
* Creates a new writable raster that is compatible with this raster, with
* the specified bounds.
- *
+ *
* @param x the x-coordinate of the top-left corner of the raster.
* @param y the y-coordinate of the top-left corner of the raster.
* @param w the raster width.
* @param h the raster height.
- *
+ *
* @return A new writable raster.
*/
public WritableRaster createCompatibleWritableRaster(int x, int y,
@@ -503,7 +503,7 @@ public class Raster
public Raster createTranslatedChild(int childMinX, int childMinY) {
int tcx = sampleModelTranslateX - minX + childMinX;
int tcy = sampleModelTranslateY - minY + childMinY;
-
+
return new Raster(sampleModel, dataBuffer,
new Rectangle(childMinX, childMinY, width, height),
new Point(tcx, tcy), this);
@@ -516,7 +516,7 @@ public class Raster
if (parentX < minX || parentX + width > minX + this.width
|| parentY < minY || parentY + height > minY + this.height)
throw new RasterFormatException("Child raster extends beyond parent");
-
+
SampleModel sm = (bandList == null) ?
sampleModel :
sampleModel.createSubsetSampleModel(bandList);
@@ -526,18 +526,18 @@ public class Raster
/
+-------------------------
|\. __ parent trans
- | \`.
+ | \`.
| \ `. parent origin
| \ `. /
| /\ +-------- - -
|trans\ /<\-- deltaTrans
- |child +-+-\---- - -
+ |child +-+-\---- - -
| /|`| \__ parent [x, y]
|child | |`. \
|origin| : `.\
| | / `\
| : / +
- | child [x, y]
+ | child [x, y]
parent_xy - parent_trans = child_xy - child_trans
@@ -553,7 +553,7 @@ public class Raster
/**
* Returns a new rectangle containing the bounds of this raster.
- *
+ *
* @return A new rectangle containing the bounds of this raster.
*/
public Rectangle getBounds()
@@ -563,7 +563,7 @@ public class Raster
/**
* Returns the x-coordinate of the top left corner of the raster.
- *
+ *
* @return The x-coordinate of the top left corner of the raster.
*/
public final int getMinX()
@@ -573,7 +573,7 @@ public class Raster
/**
* Returns the t-coordinate of the top left corner of the raster.
- *
+ *
* @return The t-coordinate of the top left corner of the raster.
*/
public final int getMinY()
@@ -583,7 +583,7 @@ public class Raster
/**
* Returns the width of the raster.
- *
+ *
* @return The width of the raster.
*/
public final int getWidth()
@@ -593,7 +593,7 @@ public class Raster
/**
* Returns the height of the raster.
- *
+ *
* @return The height of the raster.
*/
public final int getHeight()
@@ -603,23 +603,23 @@ public class Raster
/**
* Returns the number of bands for this raster.
- *
+ *
* @return The number of bands.
*/
public final int getNumBands()
{
return numBands;
}
-
+
public final int getNumDataElements()
{
return numDataElements;
}
-
+
/**
- * Returns the transfer type for the raster (this is determined by the
+ * Returns the transfer type for the raster (this is determined by the
* raster's sample model).
- *
+ *
* @return The transfer type.
*/
public final int getTransferType()
@@ -629,7 +629,7 @@ public class Raster
/**
* Returns the data buffer that stores the pixel data for this raster.
- *
+ *
* @return The data buffer.
*/
public DataBuffer getDataBuffer()
@@ -640,7 +640,7 @@ public class Raster
/**
* Returns the sample model that accesses the data buffer (to extract pixel
* data) for this raster.
- *
+ *
* @return The sample model.
*/
public SampleModel getSampleModel()
@@ -662,15 +662,15 @@ public class Raster
/**
* Returns an array containing the samples for the pixel at (x, y) in the
- * raster. If <code>iArray</code> is not <code>null</code>, it will be
+ * raster. If <code>iArray</code> is not <code>null</code>, it will be
* populated with the sample values and returned as the result of
* this function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The pixel sample values.
*/
public int[] getPixel(int x, int y, int[] iArray)
@@ -681,15 +681,15 @@ public class Raster
/**
* Returns an array containing the samples for the pixel at (x, y) in the
- * raster. If <code>fArray</code> is not <code>null</code>, it will be
+ * raster. If <code>fArray</code> is not <code>null</code>, it will be
* populated with the sample values and returned as the result of
* this function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param fArray an array to populate with the sample values and return as
+ * @param fArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The pixel sample values.
*/
public float[] getPixel(int x, int y, float[] fArray)
@@ -700,15 +700,15 @@ public class Raster
/**
* Returns an array containing the samples for the pixel at (x, y) in the
- * raster. If <code>dArray</code> is not <code>null</code>, it will be
+ * raster. If <code>dArray</code> is not <code>null</code>, it will be
* populated with the sample values and returned as the result of
* this function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param dArray an array to populate with the sample values and return as
+ * @param dArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The pixel sample values.
*/
public double[] getPixel(int x, int y, double[] dArray)
@@ -718,21 +718,21 @@ public class Raster
}
/**
- * Returns an array containing the samples for the pixels in the region
- * specified by (x, y, w, h) in the raster. The array is ordered by pixels
- * (that is, all the samples for the first pixel are grouped together,
- * followed by all the samples for the second pixel, and so on).
- * If <code>iArray</code> is not <code>null</code>, it will be populated
- * with the sample values and returned as the result of this function (this
+ * Returns an array containing the samples for the pixels in the region
+ * specified by (x, y, w, h) in the raster. The array is ordered by pixels
+ * (that is, all the samples for the first pixel are grouped together,
+ * followed by all the samples for the second pixel, and so on).
+ * If <code>iArray</code> is not <code>null</code>, it will be populated
+ * with the sample values and returned as the result of this function (this
* avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The pixel sample values.
*/
public int[] getPixels(int x, int y, int w, int h, int[] iArray)
@@ -742,21 +742,21 @@ public class Raster
}
/**
- * Returns an array containing the samples for the pixels in the region
- * specified by (x, y, w, h) in the raster. The array is ordered by pixels
- * (that is, all the samples for the first pixel are grouped together,
- * followed by all the samples for the second pixel, and so on).
- * If <code>fArray</code> is not <code>null</code>, it will be populated
- * with the sample values and returned as the result of this function (this
+ * Returns an array containing the samples for the pixels in the region
+ * specified by (x, y, w, h) in the raster. The array is ordered by pixels
+ * (that is, all the samples for the first pixel are grouped together,
+ * followed by all the samples for the second pixel, and so on).
+ * If <code>fArray</code> is not <code>null</code>, it will be populated
+ * with the sample values and returned as the result of this function (this
* avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param fArray an array to populate with the sample values and return as
+ * @param fArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The pixel sample values.
*/
public float[] getPixels(int x, int y, int w, int h, float[] fArray)
@@ -766,21 +766,21 @@ public class Raster
}
/**
- * Returns an array containing the samples for the pixels in the region
- * specified by (x, y, w, h) in the raster. The array is ordered by pixels
- * (that is, all the samples for the first pixel are grouped together,
- * followed by all the samples for the second pixel, and so on).
- * If <code>dArray</code> is not <code>null</code>, it will be populated
- * with the sample values and returned as the result of this function (this
+ * Returns an array containing the samples for the pixels in the region
+ * specified by (x, y, w, h) in the raster. The array is ordered by pixels
+ * (that is, all the samples for the first pixel are grouped together,
+ * followed by all the samples for the second pixel, and so on).
+ * If <code>dArray</code> is not <code>null</code>, it will be populated
+ * with the sample values and returned as the result of this function (this
* avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param dArray an array to populate with the sample values and return as
+ * @param dArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The pixel sample values.
*/
public double[] getPixels(int x, int y, int w, int h, double[] dArray)
@@ -791,12 +791,12 @@ public class Raster
/**
* Returns the sample value for the pixel at (x, y) in the raster.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
- *
+ *
* @return The sample value.
*/
public int getSample(int x, int y, int b)
@@ -807,14 +807,14 @@ public class Raster
/**
* Returns the sample value for the pixel at (x, y) in the raster.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
- *
+ *
* @return The sample value.
- *
+ *
* @see #getSample(int, int, int)
*/
public float getSampleFloat(int x, int y, int b)
@@ -825,14 +825,14 @@ public class Raster
/**
* Returns the sample value for the pixel at (x, y) in the raster.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
- *
+ *
* @return The sample value.
- *
+ *
* @see #getSample(int, int, int)
*/
public double getSampleDouble(int x, int y, int b)
@@ -842,21 +842,21 @@ public class Raster
}
/**
- * Returns an array containing the samples from one band for the pixels in
- * the region specified by (x, y, w, h) in the raster. If
- * <code>iArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * Returns an array containing the samples from one band for the pixels in
+ * the region specified by (x, y, w, h) in the raster. If
+ * <code>iArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The sample values.
*/
public int[] getSamples(int x, int y, int w, int h, int b,
@@ -867,23 +867,23 @@ public class Raster
}
/**
- * Returns an array containing the samples from one band for the pixels in
- * the region specified by (x, y, w, h) in the raster. If
- * <code>fArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * Returns an array containing the samples from one band for the pixels in
+ * the region specified by (x, y, w, h) in the raster. If
+ * <code>fArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
*
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
- * @param fArray an array to populate with the sample values and return as
+ * @param fArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The sample values.
- */
+ */
public float[] getSamples(int x, int y, int w, int h, int b, float[] fArray)
{
return sampleModel.getSamples(x - sampleModelTranslateX,
@@ -891,39 +891,39 @@ public class Raster
}
/**
- * Returns an array containing the samples from one band for the pixels in
- * the region specified by (x, y, w, h) in the raster. If
- * <code>dArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * Returns an array containing the samples from one band for the pixels in
+ * the region specified by (x, y, w, h) in the raster. If
+ * <code>dArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
- * @param dArray an array to populate with the sample values and return as
+ * @param dArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
- *
+ *
* @return The sample values.
*/
- public double[] getSamples(int x, int y, int w, int h, int b,
+ 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);
}
-
+
/**
* Create a String representing the state of this Raster.
- *
+ *
* @return A String representing the stat of this Raster.
*/
public String toString()
{
CPStringBuilder result = new CPStringBuilder();
-
+
result.append(getClass().getName());
result.append("[(");
result.append(minX).append(",").append(minY).append("), ");
@@ -931,12 +931,12 @@ public class Raster
result.append(sampleModel).append(",");
result.append(dataBuffer);
result.append("]");
-
+
return result.toString();
}
/**
- * Returns the number of bits used to represent the specified data type.
+ * Returns the number of bits used to represent the specified data type.
* Valid types are:
* <ul>
* <li>{@link DataBuffer#TYPE_BYTE};</li>
@@ -947,9 +947,9 @@ public class Raster
* <li>{@link DataBuffer#TYPE_DOUBLE};</li>
* </ul>
* This method returns 0 for invalid data types.
- *
+ *
* @param dataType the data type.
- *
+ *
* @return The number of bits used to represent the specified data type.
*/
private static int getTypeBits(int dataType)
diff --git a/java/awt/image/RasterOp.java b/java/awt/image/RasterOp.java
index 656370e8b..2b2c0731f 100644
--- a/java/awt/image/RasterOp.java
+++ b/java/awt/image/RasterOp.java
@@ -53,13 +53,13 @@ public interface RasterOp
* writable raster. If <code>dest</code> is <code>null</code>, a new
* <code>WritableRaster</code> will be created by calling the
* {@link #createCompatibleDestRaster(Raster)} method. If <code>dest</code>
- * is not <code>null</code>, the result is written to <code>dest</code> then
- * returned (this avoids creating a new <code>WritableRaster</code> each
+ * is not <code>null</code>, the result is written to <code>dest</code> then
+ * returned (this avoids creating a new <code>WritableRaster</code> each
* time this method is called).
- *
+ *
* @param src the source raster.
* @param dest the destination raster (<code>null</code> permitted).
- *
+ *
* @return The filtered raster.
*/
WritableRaster filter(Raster src, WritableRaster dest);
@@ -67,9 +67,9 @@ public interface RasterOp
/**
* Returns the bounds of the destination raster on the basis of this
* <code>RasterOp</code> being applied to the specified source raster.
- *
+ *
* @param src the source raster.
- *
+ *
* @return The destination bounds.
*/
Rectangle2D getBounds2D(Raster src);
@@ -77,9 +77,9 @@ public interface RasterOp
/**
* Returns a raster that can be used by this <code>RasterOp</code> as the
* destination raster when operating on the specified source raster.
- *
+ *
* @param src the source raster.
- *
+ *
* @return A new writable raster that can be used as the destination raster.
*/
WritableRaster createCompatibleDestRaster(Raster src);
@@ -87,19 +87,18 @@ public interface RasterOp
/**
* Returns the point on the destination raster that corresponds to the given
* point on the source raster.
- *
+ *
* @param srcPoint the source point.
* @param destPoint the destination point (<code>null</code> permitted).
- *
+ *
* @return The destination point.
*/
Point2D getPoint2D(Point2D srcPoint, Point2D destPoint);
/**
* Returns the rendering hints for this operation.
- *
+ *
* @return The rendering hints.
*/
RenderingHints getRenderingHints();
}
-
diff --git a/java/awt/image/RenderedImage.java b/java/awt/image/RenderedImage.java
index 067e9b98e..fd18871a9 100644
--- a/java/awt/image/RenderedImage.java
+++ b/java/awt/image/RenderedImage.java
@@ -1,4 +1,4 @@
-/* RenderedImage.java --
+/* RenderedImage.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/ReplicateScaleFilter.java b/java/awt/image/ReplicateScaleFilter.java
index 5ba03f182..94aad85dd 100644
--- a/java/awt/image/ReplicateScaleFilter.java
+++ b/java/awt/image/ReplicateScaleFilter.java
@@ -48,13 +48,13 @@ import java.util.Hashtable;
* <br>
* Currently this filter does nothing and needs to be implemented.
*
- * @author C. Brian Jones (cbj@gnu.org)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public class ReplicateScaleFilter extends ImageFilter
{
public ReplicateScaleFilter(int width, int height) {
- destHeight = height;
- destWidth = width;
+ destHeight = height;
+ destWidth = width;
}
/**
@@ -94,45 +94,45 @@ public class ReplicateScaleFilter extends ImageFilter
/**
* An <code>ImageProducer</code> indicates the size of the image
- * being produced using this method. A filter can override this
+ * being produced using this method. A filter can override this
* method to intercept these calls from the producer in order to
* change either the width or the height before in turn calling
* the consumer's <code>setDimensions</code> method.
- *
+ *
* @param width the width of the image
- * @param height the height of the image
+ * @param height the height of the image
*/
public void setDimensions(int width, int height)
{
- srcWidth = width;
- srcHeight = height;
+ srcWidth = width;
+ srcHeight = height;
- /* If either destHeight or destWidth is < 0, the image should
- maintain its original aspect ratio. When both are < 0,
- just maintain the original width and height. */
- if (destWidth < 0 && destHeight < 0)
+ /* If either destHeight or destWidth is < 0, the image should
+ maintain its original aspect ratio. When both are < 0,
+ just maintain the original width and height. */
+ if (destWidth < 0 && destHeight < 0)
+ {
+ destWidth = width;
+ destHeight = height;
+ }
+ else if (destWidth < 0)
{
- destWidth = width;
- destHeight = height;
- }
- else if (destWidth < 0)
- {
- destWidth = width * destHeight / srcHeight;
- }
- else if (destHeight < 0)
- {
- destHeight = height * destWidth / srcWidth;
- }
+ destWidth = width * destHeight / srcHeight;
+ }
+ else if (destHeight < 0)
+ {
+ destHeight = height * destWidth / srcWidth;
+ }
- if (consumer != null)
- consumer.setDimensions(destWidth, destHeight);
+ if (consumer != null)
+ consumer.setDimensions(destWidth, destHeight);
}
/**
* An <code>ImageProducer</code> can set a list of properties
* associated with this image by using this method.
*
- * @param props the list of properties associated with this image
+ * @param props the list of properties associated with this image
*/
public void setProperties(Hashtable<?, ?> props)
{
@@ -145,7 +145,7 @@ public class ReplicateScaleFilter extends ImageFilter
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as a <code>byte</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -156,8 +156,8 @@ public class ReplicateScaleFilter extends ImageFilter
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
- ColorModel model, byte[] pixels, int offset, int scansize)
+ public void setPixels(int x, int y, int w, int h,
+ ColorModel model, byte[] pixels, int offset, int scansize)
{
if (srcrows == null || srccols == null)
setupSources();
@@ -193,7 +193,7 @@ public class ReplicateScaleFilter extends ImageFilter
/**
* This function delivers a rectangle of pixels where any
* pixel(m,n) is stored in the array as an <code>int</code> at
- * index (n * scansize + m + offset).
+ * index (n * scansize + m + offset).
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
@@ -204,7 +204,7 @@ public class ReplicateScaleFilter extends ImageFilter
* @param offset the index of the first pixels in the <code>pixels</code> array
* @param scansize the width to use in extracting pixels from the <code>pixels</code> array
*/
- public void setPixels(int x, int y, int w, int h,
+ public void setPixels(int x, int y, int w, int h,
ColorModel model, int[] pixels, int offset, int scansize)
{
if (srcrows == null || srccols == null)
@@ -255,4 +255,3 @@ public class ReplicateScaleFilter extends ImageFilter
}
}
}
-
diff --git a/java/awt/image/RescaleOp.java b/java/awt/image/RescaleOp.java
index d56b12cb9..efab40b7e 100644
--- a/java/awt/image/RescaleOp.java
+++ b/java/awt/image/RescaleOp.java
@@ -44,20 +44,20 @@ import java.util.Arrays;
/**
* RescaleOp is a filter that changes each pixel by a scaling factor and offset.
- *
+ *
* For filtering Rasters, either one scaling factor and offset can be specified,
* which will be applied to all bands; or a scaling factor and offset can be
* specified for each band.
- *
+ *
* For BufferedImages, the scaling may apply to both color and alpha components.
* If only one scaling factor is provided, or if the number of factors provided
* equals the number of color components, the scaling is performed on all color
* components. Otherwise, the scaling is performed on all components including
* alpha. Alpha premultiplication is ignored.
- *
+ *
* After filtering, if color conversion is necessary, the conversion happens,
* taking alpha premultiplication into account.
- *
+ *
* @author Jerry Quinn (jlquinn@optonline.net)
* @author Francis Kung (fkung@redhat.com)
*/
@@ -66,47 +66,47 @@ public class RescaleOp implements BufferedImageOp, RasterOp
private float[] scale;
private float[] offsets;
private RenderingHints hints = null;
-
+
/**
* Create a new RescaleOp object using the given scale factors and offsets.
- *
+ *
* The length of the arrays must be equal to the number of bands (or number of
* data or color components) of the raster/image that this Op will be used on,
* otherwise an IllegalArgumentException will be thrown when calling the
* filter method.
- *
+ *
* @param scaleFactors an array of scale factors.
* @param offsets an array of offsets.
* @param hints any rendering hints to use (can be null).
* @throws NullPointerException if the scaleFactors or offsets array is null.
*/
public RescaleOp(float[] scaleFactors,
- float[] offsets,
- RenderingHints hints)
+ float[] offsets,
+ RenderingHints hints)
{
int length = Math.min(scaleFactors.length, offsets.length);
-
+
scale = new float[length];
System.arraycopy(scaleFactors, 0, this.scale, 0, length);
-
+
this.offsets = new float[length];
System.arraycopy(offsets, 0, this.offsets, 0, length);
-
+
this.hints = hints;
}
-
+
/**
* Create a new RescaleOp object using the given scale factor and offset.
- *
+ *
* The same scale factor and offset will be used on all bands/components.
- *
+ *
* @param scaleFactor the scale factor to use.
* @param offset the offset to use.
* @param hints any rendering hints to use (can be null).
*/
public RescaleOp(float scaleFactor,
- float offset,
- RenderingHints hints)
+ float offset,
+ RenderingHints hints)
{
scale = new float[]{ scaleFactor };
offsets = new float[]{offset};
@@ -115,10 +115,10 @@ public class RescaleOp implements BufferedImageOp, RasterOp
/**
* Returns the scaling factors. This method accepts an optional array, which
- * will be used to store the factors if not null (this avoids allocating a
+ * will be used to store the factors if not null (this avoids allocating a
* new array). If this array is too small to hold all the scaling factors,
* the array will be filled and the remaining factors discarded.
- *
+ *
* @param scaleFactors array to store the scaling factors in (can be null).
* @return an array of scaling factors.
*/
@@ -133,10 +133,10 @@ public class RescaleOp implements BufferedImageOp, RasterOp
/**
* Returns the offsets. This method accepts an optional array, which
- * will be used to store the offsets if not null (this avoids allocating a
- * new array). If this array is too small to hold all the offsets, the array
+ * will be used to store the offsets if not null (this avoids allocating a
+ * new array). If this array is too small to hold all the offsets, the array
* will be filled and the remaining factors discarded.
- *
+ *
* @param offsets array to store the offsets in (can be null).
* @return an array of offsets.
*/
@@ -151,7 +151,7 @@ public class RescaleOp implements BufferedImageOp, RasterOp
/**
* Returns the number of scaling factors / offsets.
- *
+ *
* @return the number of scaling factors / offsets.
*/
public final int getNumFactors()
@@ -168,13 +168,13 @@ public class RescaleOp implements BufferedImageOp, RasterOp
}
/**
- * Converts the source image using the scale factors and offsets specified in
- * the constructor. The resulting image is stored in the destination image if
- * one is provided; otherwise a new BufferedImage is created and returned.
- *
+ * Converts the source image using the scale factors and offsets specified in
+ * the constructor. The resulting image is stored in the destination image if
+ * one is provided; otherwise a new BufferedImage is created and returned.
+ *
* The source image cannot use an IndexColorModel, and the destination image
* (if one is provided) must have the same size.
- *
+ *
* If the final value of a sample is beyond the range of the color model, it
* will be clipped to the appropriate maximum / minimum.
*
@@ -264,16 +264,16 @@ public class RescaleOp implements BufferedImageOp, RasterOp
Arrays.fill(bands, true);
return filter(src, dest, bands);
}
-
+
/**
* Perform raster-based filtering on a selected number of bands.
- *
+ *
* The length of the bands array should equal the number of bands; a true
* element indicates filtering should happen on the corresponding band, while
* a false element will skip the band.
- *
+ *
* The rasters are assumed to be compatible and non-null.
- *
+ *
* @param src the source raster.
* @param dest the destination raster.
* @param bands an array indicating which bands to filter.
@@ -285,12 +285,12 @@ public class RescaleOp implements BufferedImageOp, RasterOp
{
int[] values = new int[src.getHeight() * src.getWidth()];
float scaleFactor, offset;
-
+
// Find max sample value, to be used for clipping later
int[] maxValue = src.getSampleModel().getSampleSize();
for (int i = 0; i < maxValue.length; i++)
maxValue[i] = (int)Math.pow(2, maxValue[i]) - 1;
-
+
// TODO: can this be optimized further?
// Filter all samples of all requested bands
for (int band = 0; band < bands.length; band++)
@@ -324,22 +324,22 @@ public class RescaleOp implements BufferedImageOp, RasterOp
dest.setSamples(dest.getMinX(), dest.getMinY(), dest.getWidth(),
dest.getHeight(), band, values);
}
-
+
return dest;
}
/*
* (non-Javadoc)
- *
+ *
* @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage,
* java.awt.image.ColorModel)
*/
public BufferedImage createCompatibleDestImage(BufferedImage src,
- ColorModel dstCM)
+ ColorModel dstCM)
{
if (dstCM == null)
return new BufferedImage(src.getWidth(), src.getHeight(), src.getType());
-
+
return new BufferedImage(dstCM,
src.getRaster().createCompatibleWritableRaster(),
src.isAlphaPremultiplied(), null);
@@ -352,7 +352,7 @@ public class RescaleOp implements BufferedImageOp, RasterOp
{
return src.createCompatibleWritableRaster();
}
-
+
/* (non-Javadoc)
* @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
*/
@@ -378,7 +378,7 @@ public class RescaleOp implements BufferedImageOp, RasterOp
dst = (Point2D) src.clone();
else
dst.setLocation(src);
-
+
return dst;
}
diff --git a/java/awt/image/SampleModel.java b/java/awt/image/SampleModel.java
index 506e78a9b..7e0b18c55 100644
--- a/java/awt/image/SampleModel.java
+++ b/java/awt/image/SampleModel.java
@@ -37,24 +37,24 @@ exception statement from your version. */
package java.awt.image;
/**
- * A <code>SampleModel</code> is used to access pixel data from a
+ * A <code>SampleModel</code> is used to access pixel data from a
* {@link DataBuffer}. This is used by the {@link Raster} class.
- *
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public abstract class SampleModel
{
/** Width of image described. */
protected int width;
-
+
/** Height of image described. */
protected int height;
-
+
/** Number of bands in the image described. Package-private here,
shadowed by ComponentSampleModel. */
protected int numBands;
- /**
+ /**
* The DataBuffer type that is used to store the data of the image
* described.
*/
@@ -62,20 +62,20 @@ public abstract class SampleModel
/**
* Creates a new sample model with the specified attributes.
- *
+ *
* @param dataType the data type (one of {@link DataBuffer#TYPE_BYTE},
* {@link DataBuffer#TYPE_USHORT}, {@link DataBuffer#TYPE_SHORT},
- * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT},
+ * {@link DataBuffer#TYPE_INT}, {@link DataBuffer#TYPE_FLOAT},
* {@link DataBuffer#TYPE_DOUBLE} or {@link DataBuffer#TYPE_UNDEFINED}).
* @param w the width in pixels (must be greater than zero).
* @param h the height in pixels (must be greater than zero).
* @param numBands the number of bands (must be greater than zero).
- *
- * @throws IllegalArgumentException if <code>dataType</code> is not one of
+ *
+ * @throws IllegalArgumentException if <code>dataType</code> is not one of
* the listed values.
* @throws IllegalArgumentException if <code>w</code> is less than or equal
* to zero.
- * @throws IllegalArgumentException if <code>h</code> is less than or equal
+ * @throws IllegalArgumentException if <code>h</code> is less than or equal
* to zero.
* @throws IllegalArgumentException if <code>w * h</code> is greater than
* {@link Integer#MAX_VALUE}.
@@ -85,30 +85,30 @@ public abstract class SampleModel
if (dataType != DataBuffer.TYPE_UNDEFINED)
if (dataType < DataBuffer.TYPE_BYTE || dataType > DataBuffer.TYPE_DOUBLE)
throw new IllegalArgumentException("Unrecognised 'dataType' argument.");
-
- if ((w <= 0) || (h <= 0))
+
+ if ((w <= 0) || (h <= 0))
throw new IllegalArgumentException((w <= 0 ? " width<=0" : " width is ok")
+ (h <= 0 ? " height<=0" : " height is ok"));
-
+
long area = (long) w * (long) h;
if (area > Integer.MAX_VALUE)
throw new IllegalArgumentException("w * h exceeds Integer.MAX_VALUE.");
if (numBands <= 0)
throw new IllegalArgumentException("Requires numBands > 0.");
-
+
this.dataType = dataType;
this.width = w;
this.height = h;
- this.numBands = numBands;
+ this.numBands = numBands;
}
-
+
/**
- * Returns the width of the pixel data accessible via this
+ * Returns the width of the pixel data accessible via this
* <code>SampleModel</code>.
- *
+ *
* @return The width.
- *
+ *
* @see #getHeight()
*/
public final int getWidth()
@@ -117,11 +117,11 @@ public abstract class SampleModel
}
/**
- * Returns the height of the pixel data accessible via this
+ * Returns the height of the pixel data accessible via this
* <code>SampleModel</code>.
- *
+ *
* @return The height.
- *
+ *
* @see #getWidth()
*/
public final int getHeight()
@@ -131,20 +131,20 @@ public abstract class SampleModel
/**
* Returns the number of bands for this <code>SampleModel</code>.
- *
+ *
* @return The number of bands.
*/
public final int getNumBands()
{
return numBands;
}
-
+
public abstract int getNumDataElements();
-
+
/**
- * Returns the type of the {@link DataBuffer} that this
+ * Returns the type of the {@link DataBuffer} that this
* <code>SampleModel</code> accesses.
- *
+ *
* @return The data buffer type.
*/
public final int getDataType()
@@ -163,26 +163,26 @@ public abstract class SampleModel
* specified data buffer. If <code>iArray</code> is not <code>null</code>,
* it will be populated with the sample values and returned as the result of
* this function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
{
- if (iArray == null)
+ if (iArray == null)
iArray = new int[numBands];
- for (int b = 0; b < numBands; b++)
+ for (int b = 0; b < numBands; b++)
iArray[b] = getSample(x, y, b, data);
return iArray;
}
-
+
/**
*
* This method is provided as a faster alternative to getPixel(),
@@ -199,14 +199,14 @@ public abstract class SampleModel
public abstract Object getDataElements(int x, int y, Object obj,
DataBuffer data);
-
+
public Object getDataElements(int x, int y, int w, int h, Object obj,
DataBuffer data)
{
int size = w * h;
int numDataElements = getNumDataElements();
int dataSize = numDataElements * size;
-
+
if (obj == null)
{
switch (getTransferType())
@@ -247,7 +247,7 @@ public abstract class SampleModel
Object obj, DataBuffer data)
{
int numDataElements = getNumDataElements();
-
+
Object pixelData;
switch (getTransferType())
{
@@ -292,22 +292,22 @@ public abstract class SampleModel
* specified data buffer. If <code>fArray</code> is not <code>null</code>,
* it will be populated with the sample values and returned as the result of
* this function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param fArray an array to populate with the sample values and return as
+ * @param fArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public float[] getPixel(int x, int y, float[] fArray, DataBuffer data)
{
- if (fArray == null)
+ if (fArray == null)
fArray = new float[numBands];
-
+
for (int b = 0; b < numBands; b++)
{
fArray[b] = getSampleFloat(x, y, b, data);
@@ -320,19 +320,19 @@ public abstract class SampleModel
* specified data buffer. If <code>dArray</code> is not <code>null</code>,
* it will be populated with the sample values and returned as the result of
* this function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param dArray an array to populate with the sample values and return as
+ * @param dArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public double[] getPixel(int x, int y, double[] dArray, DataBuffer data) {
- if (dArray == null)
+ if (dArray == null)
dArray = new double[numBands];
for (int b = 0; b < numBands; b++)
{
@@ -342,24 +342,24 @@ public abstract class SampleModel
}
/**
- * Returns an array containing the samples for the pixels in the region
+ * Returns an array containing the samples for the pixels in the region
* specified by (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on). If <code>iArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * on). If <code>iArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int[] getPixels(int x, int y, int w, int h, int[] iArray,
@@ -368,7 +368,7 @@ public abstract class SampleModel
int size = w * h;
int outOffset = 0;
int[] pixel = null;
- if (iArray == null)
+ if (iArray == null)
iArray = new int[w * h * numBands];
for (int yy = y; yy < (y + h); yy++)
{
@@ -383,24 +383,24 @@ public abstract class SampleModel
}
/**
- * Returns an array containing the samples for the pixels in the region
+ * Returns an array containing the samples for the pixels in the region
* specified by (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on). If <code>fArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * on). If <code>fArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param fArray an array to populate with the sample values and return as
+ * @param fArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public float[] getPixels(int x, int y, int w, int h, float[] fArray,
@@ -421,26 +421,26 @@ public abstract class SampleModel
}
return fArray;
}
-
+
/**
- * Returns an array containing the samples for the pixels in the region
+ * Returns an array containing the samples for the pixels in the region
* specified by (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on). If <code>dArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * on). If <code>dArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param dArray an array to populate with the sample values and return as
+ * @param dArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public double[] getPixels(int x, int y, int w, int h, double[] dArray,
@@ -449,7 +449,7 @@ public abstract class SampleModel
int size = w * h;
int outOffset = 0;
double[] pixel = null;
- if (dArray == null)
+ if (dArray == null)
dArray = new double[w * h * numBands];
for (int yy = y; yy < (y + h); yy++)
{
@@ -464,35 +464,35 @@ public abstract class SampleModel
}
/**
- * Returns the sample value for the pixel at (x, y) in the specified data
+ * Returns the sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public abstract int getSample(int x, int y, int b, DataBuffer data);
/**
- * Returns the sample value for the pixel at (x, y) in the specified data
+ * Returns the sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
- *
+ *
* @see #getSample(int, int, int, DataBuffer)
*/
public float getSampleFloat(int x, int y, int b, DataBuffer data)
@@ -501,19 +501,19 @@ public abstract class SampleModel
}
/**
- * Returns the sample value for the pixel at (x, y) in the specified data
+ * Returns the sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
- *
+ *
* @see #getSample(int, int, int, DataBuffer)
*/
public double getSampleDouble(int x, int y, int b, DataBuffer data)
@@ -522,24 +522,24 @@ public abstract class SampleModel
}
/**
- * Returns an array containing the samples from one band for the pixels in
- * the region specified by (x, y, w, h) in the specified data buffer. If
- * <code>iArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * Returns an array containing the samples from one band for the pixels in
+ * the region specified by (x, y, w, h) in the specified data buffer. If
+ * <code>iArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int[] getSamples(int x, int y, int w, int h, int b,
@@ -547,7 +547,7 @@ public abstract class SampleModel
{
int size = w * h;
int outOffset = 0;
- if (iArray == null)
+ if (iArray == null)
iArray = new int[size];
for (int yy = y; yy < (y + h); yy++)
{
@@ -560,24 +560,24 @@ public abstract class SampleModel
}
/**
- * Returns an array containing the samples from one band for the pixels in
- * the region specified by (x, y, w, h) in the specified data buffer. If
- * <code>fArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * Returns an array containing the samples from one band for the pixels in
+ * the region specified by (x, y, w, h) in the specified data buffer. If
+ * <code>fArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
- * @param fArray an array to populate with the sample values and return as
+ * @param fArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public float[] getSamples(int x, int y, int w, int h, int b,
@@ -585,7 +585,7 @@ public abstract class SampleModel
{
int size = w * h;
int outOffset = 0;
- if (fArray == null)
+ if (fArray == null)
fArray = new float[size];
for (int yy = y; yy < (y + h); yy++)
{
@@ -598,24 +598,24 @@ public abstract class SampleModel
}
/**
- * Returns an array containing the samples from one band for the pixels in
- * the region specified by (x, y, w, h) in the specified data buffer. If
- * <code>dArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * Returns an array containing the samples from one band for the pixels in
+ * the region specified by (x, y, w, h) in the specified data buffer. If
+ * <code>dArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
- * @param dArray an array to populate with the sample values and return as
+ * @param dArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public double[] getSamples(int x, int y, int w, int h, int b,
@@ -623,7 +623,7 @@ public abstract class SampleModel
{
int size = w * h;
int outOffset = 0;
- if (dArray == null)
+ if (dArray == null)
dArray = new double[size];
for (int yy = y; yy < (y + h); yy++)
{
@@ -634,76 +634,76 @@ public abstract class SampleModel
}
return dArray;
}
-
+
/**
* Sets the samples for the pixel at (x, y) in the specified data buffer to
- * the specified values.
- *
+ * the specified values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param iArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
{
- for (int b = 0; b < numBands; b++)
+ for (int b = 0; b < numBands; b++)
setSample(x, y, b, iArray[b], data);
}
/**
* Sets the samples for the pixel at (x, y) in the specified data buffer to
- * the specified values.
- *
+ * the specified values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param fArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>fArray</code> or
+ *
+ * @throws NullPointerException if either <code>fArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixel(int x, int y, float[] fArray, DataBuffer data)
{
- for (int b = 0; b < numBands; b++)
+ for (int b = 0; b < numBands; b++)
setSample(x, y, b, fArray[b], data);
}
/**
* Sets the samples for the pixel at (x, y) in the specified data buffer to
- * the specified values.
- *
+ * the specified values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param dArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>dArray</code> or
+ *
+ * @throws NullPointerException if either <code>dArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixel(int x, int y, double[] dArray, DataBuffer data)
{
- for (int b = 0; b < numBands; b++)
+ for (int b = 0; b < numBands; b++)
setSample(x, y, b, dArray[b], data);
}
/**
- * Sets the sample values for the pixels in the region specified by
+ * Sets the sample values for the pixels in the region specified by
* (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on).
- *
+ * on).
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
* @param iArray the pixel sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixels(int x, int y, int w, int h, int[] iArray,
@@ -723,20 +723,20 @@ public abstract class SampleModel
}
/**
- * Sets the sample values for the pixels in the region specified by
+ * Sets the sample values for the pixels in the region specified by
* (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on).
- *
+ * on).
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
* @param fArray the pixel sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>fArray</code> or
+ *
+ * @throws NullPointerException if either <code>fArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixels(int x, int y, int w, int h, float[] fArray,
@@ -756,20 +756,20 @@ public abstract class SampleModel
}
/**
- * Sets the sample values for the pixels in the region specified by
+ * Sets the sample values for the pixels in the region specified by
* (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on).
- *
+ * on).
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
* @param dArray the pixel sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>dArray</code> or
+ *
+ * @throws NullPointerException if either <code>dArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixels(int x, int y, int w, int h, double[] dArray,
@@ -789,32 +789,32 @@ public abstract class SampleModel
}
/**
- * Sets the sample value for a band for the pixel at (x, y) in the
- * specified data buffer.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the
+ * specified data buffer.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public abstract void setSample(int x, int y, int b, int s,
DataBuffer data);
/**
- * Sets the sample value for a band for the pixel at (x, y) in the
- * specified data buffer.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the
+ * specified data buffer.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public void setSample(int x, int y, int b, float s,
@@ -824,16 +824,16 @@ public abstract class SampleModel
}
/**
- * Sets the sample value for a band for the pixel at (x, y) in the
- * specified data buffer.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the
+ * specified data buffer.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public void setSample(int x, int y, int b, double s,
@@ -843,19 +843,19 @@ public abstract class SampleModel
}
/**
- * Sets the sample values for one band for the pixels in the region
- * specified by (x, y, w, h) in the specified data buffer.
- *
+ * Sets the sample values for one band for the pixels in the region
+ * specified by (x, y, w, h) in the specified data buffer.
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
* @param iArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setSamples(int x, int y, int w, int h, int b,
@@ -869,19 +869,19 @@ public abstract class SampleModel
}
/**
- * Sets the sample values for one band for the pixels in the region
- * specified by (x, y, w, h) in the specified data buffer.
- *
+ * Sets the sample values for one band for the pixels in the region
+ * specified by (x, y, w, h) in the specified data buffer.
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
* @param fArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setSamples(int x, int y, int w, int h, int b,
@@ -896,19 +896,19 @@ public abstract class SampleModel
}
/**
- * Sets the sample values for one band for the pixels in the region
- * specified by (x, y, w, h) in the specified data buffer.
- *
+ * Sets the sample values for one band for the pixels in the region
+ * specified by (x, y, w, h) in the specified data buffer.
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
* @param dArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setSamples(int x, int y, int w, int h, int b,
@@ -923,31 +923,31 @@ public abstract class SampleModel
/**
* Creates a new <code>SampleModel</code> that is compatible with this
* model and has the specified width and height.
- *
+ *
* @param w the width (in pixels).
* @param h the height (in pixels).
- *
+ *
* @return The new sample model.
*/
public abstract SampleModel createCompatibleSampleModel(int w, int h);
/**
* Return a SampleModel with a subset of the bands in this model.
- *
+ *
* Selects bands.length bands from this sample model. The bands chosen
* are specified in the indices of bands[]. This also permits permuting
* the bands as well as taking a subset. Thus, giving an array with
* 1, 2, 3, ..., numbands, will give an identical sample model.
- *
+ *
* @param bands Array with band indices to include.
* @return A new sample model
*/
public abstract SampleModel createSubsetSampleModel(int[] bands);
/**
- * Creates a new {@link DataBuffer} of the correct type and size for this
+ * Creates a new {@link DataBuffer} of the correct type and size for this
* <code>SampleModel</code>.
- *
+ *
* @return The data buffer.
*/
public abstract DataBuffer createDataBuffer();
@@ -955,19 +955,19 @@ public abstract class SampleModel
/**
* Returns an array containing the size (in bits) for each band accessed by
* the <code>SampleModel</code>.
- *
+ *
* @return An array.
- *
+ *
* @see #getSampleSize(int)
*/
public abstract int[] getSampleSize();
/**
* Returns the size (in bits) of the samples for the specified band.
- *
- * @param band the band (in the range <code>0</code> to
+ *
+ * @param band the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
- *
+ *
* @return The sample size (in bits).
*/
public abstract int getSampleSize(int band);
diff --git a/java/awt/image/ShortLookupTable.java b/java/awt/image/ShortLookupTable.java
index 858818cf2..3e276fe9f 100644
--- a/java/awt/image/ShortLookupTable.java
+++ b/java/awt/image/ShortLookupTable.java
@@ -58,7 +58,7 @@ public class ShortLookupTable extends LookupTable
* Offset is subtracted from pixel values when looking up in the translation
* tables. If data.length is one, the same table is applied to all pixel
* components.
- *
+ *
* @param offset Offset to be subtracted.
* @param data Array of lookup tables.
* @exception IllegalArgumentException if offset &lt; 0 or data.length &lt; 1.
@@ -67,9 +67,9 @@ public class ShortLookupTable extends LookupTable
throws IllegalArgumentException
{
super(offset, data.length);
-
+
// tests show that Sun's implementation creates a new array to store the
- // references from the incoming 'data' array - not sure why, but we'll
+ // references from the incoming 'data' array - not sure why, but we'll
// match that behaviour just in case it matters...
this.data = new short[data.length][];
for (int i = 0; i < data.length; i++)
@@ -81,9 +81,9 @@ public class ShortLookupTable extends LookupTable
*
* Offset is subtracted from pixel values when looking up in the translation
* table. The same table is applied to all pixel components.
- *
+ *
* @param offset Offset to be subtracted.
- * @param data Lookup table for all components (<code>null</code> not
+ * @param data Lookup table for all components (<code>null</code> not
* permitted).
* @exception IllegalArgumentException if offset &lt; 0.
*/
@@ -96,10 +96,10 @@ public class ShortLookupTable extends LookupTable
this.data = new short[][] {data};
}
- /**
+ /**
* Return the lookup tables. This is a reference to the actual table, so
- * modifying the contents of the returned array will modify the lookup table.
- *
+ * modifying the contents of the returned array will modify the lookup table.
+ *
* @return The lookup table.
*/
public final short[][] getTable()
@@ -136,7 +136,7 @@ public class ShortLookupTable extends LookupTable
else
for (int i = 0; i < src.length; i++)
dst[i] = data[i][src[i] - offset];
-
+
return dst;
}
@@ -170,7 +170,7 @@ public class ShortLookupTable extends LookupTable
else
for (int i = 0; i < src.length; i++)
dst[i] = data[i][((int) src[i]) - offset];
-
+
return dst;
}
diff --git a/java/awt/image/SinglePixelPackedSampleModel.java b/java/awt/image/SinglePixelPackedSampleModel.java
index 225138651..143581db9 100644
--- a/java/awt/image/SinglePixelPackedSampleModel.java
+++ b/java/awt/image/SinglePixelPackedSampleModel.java
@@ -43,9 +43,9 @@ import gnu.java.lang.CPStringBuilder;
/**
* A <code>SampleModel</code> used when all samples are stored in a single
- * data element in the {@link DataBuffer}, and each data element contains
+ * data element in the {@link DataBuffer}, and each data element contains
* samples for one pixel only.
- *
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class SinglePixelPackedSampleModel extends SampleModel
@@ -54,10 +54,10 @@ public class SinglePixelPackedSampleModel extends SampleModel
private int[] bitMasks;
private int[] bitOffsets;
private int[] sampleSize;
-
+
/**
* Creates a new <code>SinglePixelPackedSampleModel</code>.
- *
+ *
* @param dataType the data buffer type.
* @param w the width (in pixels).
* @param h the height (in pixels).
@@ -65,14 +65,14 @@ public class SinglePixelPackedSampleModel extends SampleModel
* sample value for each band.
*/
public SinglePixelPackedSampleModel(int dataType, int w, int h,
- int[] bitMasks)
+ int[] bitMasks)
{
this(dataType, w, h, w, bitMasks);
}
/**
* Creates a new <code>SinglePixelPackedSampleModel</code>.
- *
+ *
* @param dataType the data buffer type.
* @param w the width (in pixels).
* @param h the height (in pixels).
@@ -82,7 +82,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
* sample value for each band.
*/
public SinglePixelPackedSampleModel(int dataType, int w, int h,
- int scanlineStride, int[] bitMasks)
+ int scanlineStride, int[] bitMasks)
{
super(dataType, w, h, bitMasks.length);
@@ -91,18 +91,18 @@ public class SinglePixelPackedSampleModel extends SampleModel
case DataBuffer.TYPE_BYTE:
case DataBuffer.TYPE_USHORT:
case DataBuffer.TYPE_INT:
- break;
+ break;
default:
throw new IllegalArgumentException(
"SinglePixelPackedSampleModel unsupported dataType");
}
-
+
this.scanlineStride = scanlineStride;
this.bitMasks = bitMasks;
-
+
bitOffsets = new int[numBands];
sampleSize = new int[numBands];
-
+
BitMaskExtent extent = new BitMaskExtent();
for (int b = 0; b < numBands; b++)
{
@@ -116,7 +116,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
/**
* Returns the number of data elements.
- *
+ *
* @return <code>1</code>.
*/
public int getNumDataElements()
@@ -127,10 +127,10 @@ public class SinglePixelPackedSampleModel extends SampleModel
/**
* Creates a new <code>SampleModel</code> that is compatible with this
* model and has the specified width and height.
- *
+ *
* @param w the width (in pixels).
* @param h the height (in pixels).
- *
+ *
* @return The new sample model.
*/
public SampleModel createCompatibleSampleModel(int w, int h)
@@ -146,7 +146,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
* Creates a DataBuffer for holding pixel data in the format and
* layout described by this SampleModel. The returned buffer will
* consist of one single bank.
- *
+ *
* @return The data buffer.
*/
public DataBuffer createDataBuffer()
@@ -175,22 +175,22 @@ public class SinglePixelPackedSampleModel extends SampleModel
/**
* Returns an array containing the size (in bits) for each band accessed by
* the <code>SampleModel</code>.
- *
+ *
* @return An array.
- *
+ *
* @see #getSampleSize(int)
*/
public int[] getSampleSize()
{
return (int[]) sampleSize.clone();
}
-
+
/**
* Returns the size (in bits) of the samples for the specified band.
- *
- * @param band the band (in the range <code>0</code> to
+ *
+ * @param band the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
- *
+ *
* @return The sample size (in bits).
*/
public int getSampleSize(int band)
@@ -200,10 +200,10 @@ public class SinglePixelPackedSampleModel extends SampleModel
/**
* Returns the index in the data buffer that stores the pixel at (x, y).
- *
+ *
* @param x the x-coordinate.
* @param y the y-coordinate.
- *
+ *
* @return The index in the data buffer that stores the pixel at (x, y).
*/
public int getOffset(int x, int y)
@@ -224,7 +224,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
/**
* Returns the number of data elements from a pixel in one row to the
* corresponding pixel in the next row.
- *
+ *
* @return The scanline stride.
*/
public int getScanlineStride()
@@ -235,12 +235,12 @@ public class SinglePixelPackedSampleModel extends SampleModel
/**
* Creates a new <code>SinglePixelPackedSampleModel</code> that accesses
* the specified subset of bands.
- *
+ *
* @param bands an array containing band indices (<code>null</code> not
* permitted).
- *
+ *
* @return A new sample model.
- *
+ *
* @throws NullPointerException if <code>bands</code> is <code>null</code>.
* @throws RasterFormatException if <code>bands.length</code> is greater
* than the number of bands in this model.
@@ -249,20 +249,20 @@ public class SinglePixelPackedSampleModel extends SampleModel
{
if (bands.length > numBands)
throw new RasterFormatException("Too many bands.");
-
+
int numBands = bands.length;
-
+
int[] bitMasks = new int[numBands];
for (int b = 0; b < numBands; b++)
bitMasks[b] = this.bitMasks[bands[b]];
return new SinglePixelPackedSampleModel(dataType, width, height,
- scanlineStride, bitMasks);
+ scanlineStride, bitMasks);
}
public Object getDataElements(int x, int y, Object obj,
- DataBuffer data)
+ DataBuffer data)
{
int type = getTransferType();
Object ret = null;
@@ -298,21 +298,21 @@ public class SinglePixelPackedSampleModel extends SampleModel
}
return ret;
}
-
+
/**
* Returns an array containing the samples for the pixel at (x, y) in the
* specified data buffer. If <code>iArray</code> is not <code>null</code>,
* it will be populated with the sample values and returned as the result of
* this function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
@@ -323,63 +323,63 @@ public class SinglePixelPackedSampleModel extends SampleModel
for (int b = 0; b < numBands; b++)
iArray[b] = (samples & bitMasks[b]) >>> bitOffsets[b];
-
+
return iArray;
}
/**
- * Returns an array containing the samples for the pixels in the region
+ * Returns an array containing the samples for the pixels in the region
* specified by (x, y, w, h) in the specified data buffer. The array is
- * ordered by pixels (that is, all the samples for the first pixel are
+ * ordered by pixels (that is, all the samples for the first pixel are
* grouped together, followed by all the samples for the second pixel, and so
- * on). If <code>iArray</code> is not <code>null</code>, it will be
- * populated with the sample values and returned as the result of this
+ * on). If <code>iArray</code> is not <code>null</code>, it will be
+ * populated with the sample values and returned as the result of this
* function (this avoids allocating a new array instance).
- *
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param iArray an array to populate with the sample values and return as
+ * @param iArray an array to populate with the sample values and return as
* the result (if <code>null</code>, a new array will be allocated).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The pixel sample values.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int[] getPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
int offset = scanlineStride*y + x;
if (iArray == null) iArray = new int[numBands*w*h];
int outOffset = 0;
for (y = 0; y < h; y++)
{
- int lineOffset = offset;
- for (x = 0; x < w; x++)
- {
- int samples = data.getElem(lineOffset++);
- for (int b = 0; b < numBands; b++)
- iArray[outOffset++] = (samples & bitMasks[b]) >>> bitOffsets[b];
- }
- offset += scanlineStride;
+ int lineOffset = offset;
+ for (x = 0; x < w; x++)
+ {
+ int samples = data.getElem(lineOffset++);
+ for (int b = 0; b < numBands; b++)
+ iArray[outOffset++] = (samples & bitMasks[b]) >>> bitOffsets[b];
+ }
+ offset += scanlineStride;
}
- return iArray;
+ return iArray;
}
/**
- * Returns the sample value for the pixel at (x, y) in the specified data
+ * Returns the sample value for the pixel at (x, y) in the specified data
* buffer.
- *
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @return The sample value.
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public int getSample(int x, int y, int b, DataBuffer data)
@@ -388,7 +388,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
int samples = data.getElem(offset);
return (samples & bitMasks[b]) >>> bitOffsets[b];
}
-
+
public void setDataElements(int x, int y, Object obj, DataBuffer data)
{
int transferType = getTransferType();
@@ -417,20 +417,20 @@ public class SinglePixelPackedSampleModel extends SampleModel
/**
* Sets the samples for the pixel at (x, y) in the specified data buffer to
- * the specified values.
- *
+ * the specified values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param iArray the sample values (<code>null</code> not permitted).
* @param data the data buffer (<code>null</code> not permitted).
- *
- * @throws NullPointerException if either <code>iArray</code> or
+ *
+ * @throws NullPointerException if either <code>iArray</code> or
* <code>data</code> is <code>null</code>.
*/
public void setPixel(int x, int y, int[] iArray, DataBuffer data)
{
int offset = scanlineStride*y + x;
-
+
int samples = 0;
for (int b = 0; b < numBands; b++)
samples |= (iArray[b] << bitOffsets[b]) & bitMasks[b];
@@ -448,18 +448,18 @@ public class SinglePixelPackedSampleModel extends SampleModel
* @param h The height of the pixel rectangle in <code>obj</code>.
* @param iArray The primitive array containing the pixels to set.
* @param data The DataBuffer to store the pixels into.
- * @see java.awt.image.SampleModel#setPixels(int, int, int, int, int[],
+ * @see java.awt.image.SampleModel#setPixels(int, int, int, int, int[],
* java.awt.image.DataBuffer)
*/
public void setPixels(int x, int y, int w, int h, int[] iArray,
- DataBuffer data)
+ DataBuffer data)
{
int inOffset = 0;
for (int yy=y; yy<(y+h); yy++)
{
int offset = scanlineStride*yy + x;
for (int xx=x; xx<(x+w); xx++)
- {
+ {
int samples = 0;
for (int b = 0; b < numBands; b++)
samples |= (iArray[inOffset+b] << bitOffsets[b]) & bitMasks[b];
@@ -469,18 +469,18 @@ public class SinglePixelPackedSampleModel extends SampleModel
}
}
}
-
+
/**
- * Sets the sample value for a band for the pixel at (x, y) in the
- * specified data buffer.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the
+ * specified data buffer.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
* @param data the data buffer (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>data</code> is <code>null</code>.
*/
public void setSample(int x, int y, int b, int s, DataBuffer data)
@@ -492,13 +492,13 @@ public class SinglePixelPackedSampleModel extends SampleModel
samples |= (s << bitOffsets[b]) & bitMask;
data.setElem(offset, samples);
}
-
+
/**
- * Tests this sample model for equality with an arbitrary object. This
+ * Tests this sample model for equality with an arbitrary object. This
* method returns <code>true</code> if and only if:
* <ul>
* <li><code>obj</code> is not <code>null</code>;
- * <li><code>obj</code> is an instance of
+ * <li><code>obj</code> is an instance of
* <code>SinglePixelPackedSampleModel</code>;
* <li>both models have the same:
* <ul>
@@ -512,17 +512,17 @@ public class SinglePixelPackedSampleModel extends SampleModel
* </ul>
* </li>
* </ul>
- *
+ *
* @param obj the object (<code>null</code> permitted)
- *
+ *
* @return <code>true</code> if this model is equal to <code>obj</code>, and
* <code>false</code> otherwise.
*/
- public boolean equals(Object obj)
+ public boolean equals(Object obj)
{
- if (this == obj)
+ if (this == obj)
return true;
- if (! (obj instanceof SinglePixelPackedSampleModel))
+ if (! (obj instanceof SinglePixelPackedSampleModel))
return false;
SinglePixelPackedSampleModel that = (SinglePixelPackedSampleModel) obj;
if (this.dataType != that.dataType)
@@ -537,14 +537,14 @@ public class SinglePixelPackedSampleModel extends SampleModel
return false;
if (!Arrays.equals(this.bitMasks, that.bitMasks))
return false;
- if (!Arrays.equals(this.bitOffsets, that.bitOffsets))
+ if (!Arrays.equals(this.bitOffsets, that.bitOffsets))
return false;
return true;
}
-
+
/**
* Returns a hash code for this <code>SinglePixelPackedSampleModel</code>.
- *
+ *
* @return A hash code.
*/
public int hashCode()
@@ -562,7 +562,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
result = 37 * result + bitOffsets[i];
return result;
}
-
+
/**
* Creates a String with some information about this SampleModel.
* @return A String describing this SampleModel.
@@ -579,7 +579,7 @@ public class SinglePixelPackedSampleModel extends SampleModel
result.append(", mask[").append(i).append("]=0x").append(
Integer.toHexString(bitMasks[i]));
}
-
+
result.append("]");
return result.toString();
}
diff --git a/java/awt/image/TileObserver.java b/java/awt/image/TileObserver.java
index 99aafbce8..769888e40 100644
--- a/java/awt/image/TileObserver.java
+++ b/java/awt/image/TileObserver.java
@@ -1,4 +1,4 @@
-/* TileObserver.java --
+/* TileObserver.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/WritableRaster.java b/java/awt/image/WritableRaster.java
index 02789a3d1..68774f785 100644
--- a/java/awt/image/WritableRaster.java
+++ b/java/awt/image/WritableRaster.java
@@ -42,30 +42,30 @@ import java.awt.Rectangle;
/**
* A raster with methods to support updating pixel values.
- *
+ *
* @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class WritableRaster extends Raster
{
/**
* Creates a new <code>WritableRaster</code>.
- *
+ *
* @param sampleModel the sample model.
* @param origin the origin.
*/
- protected WritableRaster(SampleModel sampleModel, Point origin)
+ protected WritableRaster(SampleModel sampleModel, Point origin)
{
this(sampleModel, sampleModel.createDataBuffer(), origin);
}
-
+
/**
* Creates a new <code>WritableRaster</code> instance.
- *
+ *
* @param sampleModel the sample model.
* @param dataBuffer the data buffer.
* @param origin the origin.
*/
- protected WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer,
+ protected WritableRaster(SampleModel sampleModel, DataBuffer dataBuffer,
Point origin)
{
this(sampleModel, dataBuffer,
@@ -77,14 +77,14 @@ public class WritableRaster extends Raster
/**
* Creates a new <code>WritableRaster</code> instance.
- *
+ *
* @param sampleModel the sample model.
* @param dataBuffer the data buffer.
* @param aRegion the raster's bounds.
* @param sampleModelTranslate the translation.
* @param parent the parent.
*/
- protected WritableRaster(SampleModel sampleModel,
+ protected WritableRaster(SampleModel sampleModel,
DataBuffer dataBuffer,
Rectangle aRegion,
Point sampleModelTranslate,
@@ -95,14 +95,14 @@ public class WritableRaster extends Raster
/**
* Returns the raster's parent, cast as a {@link WritableRaster}.
- *
+ *
* @return The raster's parent.
*/
public WritableRaster getWritableParent()
{
return (WritableRaster) getParent();
}
-
+
/**
* @param childMinX
* @param childMinY
@@ -116,7 +116,7 @@ public class WritableRaster extends Raster
}
/**
- *
+ *
* @param parentX
* @param parentY
* @param w
@@ -130,11 +130,11 @@ public class WritableRaster extends Raster
int w, int h, int childMinX, int childMinY, int[] bandList)
{
// This mirrors the code from the super class
-
+
if (parentX < minX || parentX + w > minX + width
|| parentY < minY || parentY + h > minY + height)
throw new RasterFormatException("Child raster extends beyond parent");
-
+
SampleModel sm = (bandList == null) ?
sampleModel :
sampleModel.createSubsetSampleModel(bandList);
@@ -147,7 +147,7 @@ public class WritableRaster extends Raster
parentY),
this);
}
-
+
public Raster createChild(int parentX, int parentY, int width,
int height, int childMinX, int childMinY,
int[] bandList)
@@ -155,7 +155,7 @@ public class WritableRaster extends Raster
if (parentX < minX || parentX + width > minX + this.width
|| parentY < minY || parentY + height > minY + this.height)
throw new RasterFormatException("Child raster extends beyond parent");
-
+
SampleModel sm = (bandList == null) ?
sampleModel :
sampleModel.createSubsetSampleModel(bandList);
@@ -169,7 +169,7 @@ public class WritableRaster extends Raster
public void setDataElements(int x, int y, Object inData)
{
- sampleModel.setDataElements(x - sampleModelTranslateX,
+ sampleModel.setDataElements(x - sampleModelTranslateX,
y - sampleModelTranslateY, inData, dataBuffer);
}
@@ -187,7 +187,7 @@ public class WritableRaster extends Raster
}
/**
- *
+ *
* @param srcRaster
*/
public void setRect(Raster srcRaster)
@@ -196,31 +196,31 @@ public class WritableRaster extends Raster
}
/**
- *
+ *
* @param dx
* @param dy
* @param srcRaster
*/
- public void setRect(int dx, int dy, Raster srcRaster)
+ public void setRect(int dx, int dy, Raster srcRaster)
{
Rectangle targetUnclipped = new Rectangle(srcRaster.getMinX() + dx,
srcRaster.getMinY() + dy, srcRaster.getWidth(), srcRaster.getHeight());
-
+
Rectangle target = getBounds().intersection(targetUnclipped);
if (target.isEmpty()) return;
-
+
int sx = target.x - dx;
int sy = target.y - dy;
-
+
// FIXME: Do tests on rasters and use get/set data instead.
-
+
/* The JDK documentation seems to imply this implementation.
(the trucation of higher bits), but an implementation using
get/setDataElements would be more efficient. None of the
implementations would do anything sensible when the sample
models don't match.
-
+
But this is probably not the place to consider such
optimizations.*/
@@ -231,13 +231,13 @@ public class WritableRaster extends Raster
}
/**
- * Sets the samples for the pixel at (x, y) in the raster to the specified
- * values.
- *
+ * Sets the samples for the pixel at (x, y) in the raster to the specified
+ * values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param iArray the sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>iArray</code> is <code>null</code>.
*/
public void setPixel(int x, int y, int[] iArray)
@@ -247,13 +247,13 @@ public class WritableRaster extends Raster
}
/**
- * Sets the samples for the pixel at (x, y) in the raster to the specified
- * values.
- *
+ * Sets the samples for the pixel at (x, y) in the raster to the specified
+ * values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param fArray the sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>fArray</code> is <code>null</code>.
*/
public void setPixel(int x, int y, float[] fArray)
@@ -263,13 +263,13 @@ public class WritableRaster extends Raster
}
/**
- * Sets the samples for the pixel at (x, y) in the raster to the specified
- * values.
- *
+ * Sets the samples for the pixel at (x, y) in the raster to the specified
+ * values.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
* @param dArray the sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>dArray</code> is <code>null</code>.
*/
public void setPixel(int x, int y, double[] dArray)
@@ -279,17 +279,17 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample values for the pixels in the region specified by
- * (x, y, w, h) in the raster. The array is ordered by pixels (that is, all
- * the samples for the first pixel are grouped together, followed by all the
- * samples for the second pixel, and so on).
- *
+ * Sets the sample values for the pixels in the region specified by
+ * (x, y, w, h) in the raster. The array is ordered by pixels (that is, all
+ * the samples for the first pixel are grouped together, followed by all the
+ * samples for the second pixel, and so on).
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
* @param iArray the pixel sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>iArray</code> is <code>null</code>.
*/
public void setPixels(int x, int y, int w, int h, int[] iArray)
@@ -299,17 +299,17 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample values for the pixels in the region specified by
- * (x, y, w, h) in the raster. The array is ordered by pixels (that is, all
- * the samples for the first pixel are grouped together, followed by all the
- * samples for the second pixel, and so on).
- *
+ * Sets the sample values for the pixels in the region specified by
+ * (x, y, w, h) in the raster. The array is ordered by pixels (that is, all
+ * the samples for the first pixel are grouped together, followed by all the
+ * samples for the second pixel, and so on).
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
* @param fArray the pixel sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>fArray</code> is <code>null</code>.
*/
public void setPixels(int x, int y, int w, int h, float[] fArray)
@@ -319,17 +319,17 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample values for the pixels in the region specified by
- * (x, y, w, h) in the raster. The array is ordered by pixels (that is, all
- * the samples for the first pixel are grouped together, followed by all the
- * samples for the second pixel, and so on).
- *
+ * Sets the sample values for the pixels in the region specified by
+ * (x, y, w, h) in the raster. The array is ordered by pixels (that is, all
+ * the samples for the first pixel are grouped together, followed by all the
+ * samples for the second pixel, and so on).
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
* @param dArray the pixel sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>dArray</code> is <code>null</code>.
*/
public void setPixels(int x, int y, int w, int h, double[] dArray)
@@ -339,11 +339,11 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample value for a band for the pixel at (x, y) in the raster.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the raster.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
*/
@@ -354,11 +354,11 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample value for a band for the pixel at (x, y) in the raster.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the raster.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
*/
@@ -369,11 +369,11 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample value for a band for the pixel at (x, y) in the raster.
- *
+ * Sets the sample value for a band for the pixel at (x, y) in the raster.
+ *
* @param x the x-coordinate of the pixel.
* @param y the y-coordinate of the pixel.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* <code>getNumBands() - 1</code>).
* @param s the sample value.
*/
@@ -384,17 +384,17 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample values for one band for the pixels in the region
- * specified by (x, y, w, h) in the raster.
- *
+ * Sets the sample values for one band for the pixels in the region
+ * specified by (x, y, w, h) in the raster.
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
* @param iArray the sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>iArray</code> is <code>null</code>.
*/
public void setSamples(int x, int y, int w, int h, int b,
@@ -405,17 +405,17 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample values for one band for the pixels in the region
- * specified by (x, y, w, h) in the raster.
- *
+ * Sets the sample values for one band for the pixels in the region
+ * specified by (x, y, w, h) in the raster.
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
* @param fArray the sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>fArray</code> is <code>null</code>.
*/
public void setSamples(int x, int y, int w, int h, int b,
@@ -426,17 +426,17 @@ public class WritableRaster extends Raster
}
/**
- * Sets the sample values for one band for the pixels in the region
- * specified by (x, y, w, h) in the raster.
- *
+ * Sets the sample values for one band for the pixels in the region
+ * specified by (x, y, w, h) in the raster.
+ *
* @param x the x-coordinate of the top-left pixel.
* @param y the y-coordinate of the top-left pixel.
* @param w the width of the region of pixels.
* @param h the height of the region of pixels.
- * @param b the band (in the range <code>0</code> to
+ * @param b the band (in the range <code>0</code> to
* </code>getNumBands() - 1</code>).
* @param dArray the sample values (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>dArray</code> is <code>null</code>.
*/
public void setSamples(int x, int y, int w, int h, int b,
diff --git a/java/awt/image/WritableRenderedImage.java b/java/awt/image/WritableRenderedImage.java
index 4ed9f1013..9142fe004 100644
--- a/java/awt/image/WritableRenderedImage.java
+++ b/java/awt/image/WritableRenderedImage.java
@@ -1,4 +1,4 @@
-/* WritableRenderedImage.java --
+/* WritableRenderedImage.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/renderable/ContextualRenderedImageFactory.java b/java/awt/image/renderable/ContextualRenderedImageFactory.java
index 729d857ac..8852bef1c 100644
--- a/java/awt/image/renderable/ContextualRenderedImageFactory.java
+++ b/java/awt/image/renderable/ContextualRenderedImageFactory.java
@@ -1,4 +1,4 @@
-/* ContextualRenderedImageFactory.java --
+/* ContextualRenderedImageFactory.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/renderable/ParameterBlock.java b/java/awt/image/renderable/ParameterBlock.java
index e484d6b87..f38077816 100644
--- a/java/awt/image/renderable/ParameterBlock.java
+++ b/java/awt/image/renderable/ParameterBlock.java
@@ -1,4 +1,4 @@
-/* ParameterBlock.java --
+/* ParameterBlock.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/renderable/RenderContext.java b/java/awt/image/renderable/RenderContext.java
index 67f0b8adb..8017c1acf 100644
--- a/java/awt/image/renderable/RenderContext.java
+++ b/java/awt/image/renderable/RenderContext.java
@@ -1,4 +1,4 @@
-/* RenderContext.java --
+/* RenderContext.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/renderable/RenderableImage.java b/java/awt/image/renderable/RenderableImage.java
index c2f6ad8b0..31767af2c 100644
--- a/java/awt/image/renderable/RenderableImage.java
+++ b/java/awt/image/renderable/RenderableImage.java
@@ -1,4 +1,4 @@
-/* RenderableImage.java --
+/* RenderableImage.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.util.Vector;
public interface RenderableImage
{
String HINTS_OBSERVED = "HINTS_OBSERVED";
-
+
Vector<RenderableImage> getSources();
Object getProperty(String name);
String[] getPropertyNames();
@@ -59,4 +59,3 @@ public interface RenderableImage
RenderedImage createRendering(RenderContext context);
} // interface RenderableImage
-
diff --git a/java/awt/image/renderable/RenderableImageOp.java b/java/awt/image/renderable/RenderableImageOp.java
index b9d0cd39e..81e537cd5 100644
--- a/java/awt/image/renderable/RenderableImageOp.java
+++ b/java/awt/image/renderable/RenderableImageOp.java
@@ -1,4 +1,4 @@
-/* RenderableImageOp.java --
+/* RenderableImageOp.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/renderable/RenderableImageProducer.java b/java/awt/image/renderable/RenderableImageProducer.java
index d8cca6535..bd3b507cb 100644
--- a/java/awt/image/renderable/RenderableImageProducer.java
+++ b/java/awt/image/renderable/RenderableImageProducer.java
@@ -1,4 +1,4 @@
-/* RenderableImageProducer.java --
+/* RenderableImageProducer.java --
Copyright (C) 2002, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/image/renderable/RenderedImageFactory.java b/java/awt/image/renderable/RenderedImageFactory.java
index 6ff4cb031..ea2bd69f7 100644
--- a/java/awt/image/renderable/RenderedImageFactory.java
+++ b/java/awt/image/renderable/RenderedImageFactory.java
@@ -1,4 +1,4 @@
-/* RenderedImageFactory.java --
+/* RenderedImageFactory.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/awt/peer/ButtonPeer.java b/java/awt/peer/ButtonPeer.java
index a55fc2236..6e2510ff5 100644
--- a/java/awt/peer/ButtonPeer.java
+++ b/java/awt/peer/ButtonPeer.java
@@ -41,6 +41,5 @@ package java.awt.peer;
public interface ButtonPeer extends ComponentPeer
{
void setLabel (String label);
-
-} // interface ButtonPeer
+} // interface ButtonPeer
diff --git a/java/awt/peer/CanvasPeer.java b/java/awt/peer/CanvasPeer.java
index 4b33835a4..241a0e4e3 100644
--- a/java/awt/peer/CanvasPeer.java
+++ b/java/awt/peer/CanvasPeer.java
@@ -41,5 +41,4 @@ package java.awt.peer;
public interface CanvasPeer extends ComponentPeer
{
-} // interface CanvasPeer
-
+} // interface CanvasPeer
diff --git a/java/awt/peer/CheckboxMenuItemPeer.java b/java/awt/peer/CheckboxMenuItemPeer.java
index 5213dc906..3cc8f72a6 100644
--- a/java/awt/peer/CheckboxMenuItemPeer.java
+++ b/java/awt/peer/CheckboxMenuItemPeer.java
@@ -41,6 +41,5 @@ package java.awt.peer;
public interface CheckboxMenuItemPeer extends MenuItemPeer
{
void setState (boolean state);
-
-} // interface CheckboxMenuItemPeer
+} // interface CheckboxMenuItemPeer
diff --git a/java/awt/peer/CheckboxPeer.java b/java/awt/peer/CheckboxPeer.java
index 8b23b3f6f..639614891 100644
--- a/java/awt/peer/CheckboxPeer.java
+++ b/java/awt/peer/CheckboxPeer.java
@@ -49,4 +49,3 @@ public interface CheckboxPeer extends ComponentPeer
void setState (boolean state);
} // interface CheckboxPeer
-
diff --git a/java/awt/peer/ChoicePeer.java b/java/awt/peer/ChoicePeer.java
index 8ed11072e..3605a97ef 100644
--- a/java/awt/peer/ChoicePeer.java
+++ b/java/awt/peer/ChoicePeer.java
@@ -48,7 +48,6 @@ public interface ChoicePeer extends ComponentPeer
void removeAll();
- void select (int index);
-
-} // interface ChoicePeer
+ void select (int index);
+} // interface ChoicePeer
diff --git a/java/awt/peer/ComponentPeer.java b/java/awt/peer/ComponentPeer.java
index b498ddf66..736cdf376 100644
--- a/java/awt/peer/ComponentPeer.java
+++ b/java/awt/peer/ComponentPeer.java
@@ -77,7 +77,7 @@ public interface ComponentPeer
*
* @return a bitwise ORed set of ImageObserver flags
*/
- int checkImage(Image img, int width, int height,
+ int checkImage(Image img, int width, int height,
ImageObserver ob);
/**
@@ -187,7 +187,7 @@ public interface ComponentPeer
/**
* Handles the given event. This is called from
- * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to
+ * {@link Component#dispatchEvent(AWTEvent)} to give the peer a chance to
* react to events for the component.
*
* @param e the event
@@ -203,7 +203,7 @@ public interface ComponentPeer
/**
* Returns <code>true</code> if the component can receive keyboard input
* focus. This is called from {@link Component#isFocusTraversable()}.
- *
+ *
* @specnote Part of the earlier 1.1 API, replaced by isFocusable().
*/
boolean isFocusTraversable();
@@ -247,7 +247,7 @@ public interface ComponentPeer
* receives updates)
*/
boolean prepareImage(Image img, int width, int height,
- ImageObserver ob);
+ ImageObserver ob);
void print(Graphics graphics);
@@ -267,7 +267,7 @@ public interface ComponentPeer
* Requests that this component receives the focus. This is called from
* {@link Component#requestFocus()}.
*
- * @specnote Part of the earlier 1.1 API, apparently replaced by argument
+ * @specnote Part of the earlier 1.1 API, apparently replaced by argument
* form of the same method.
*/
void requestFocus();
@@ -369,7 +369,7 @@ public interface ComponentPeer
*/
void show();
- /**
+ /**
* Get the graphics configuration of the component. The color model
* of the component can be derived from the configuration.
*
@@ -476,10 +476,10 @@ public interface ComponentPeer
* @since 1.2
*/
void destroyBuffers();
-
+
/**
* Get the bounds of this component peer.
- *
+ *
* @return component peer bounds
* @since 1.5
*/
@@ -487,15 +487,15 @@ public interface ComponentPeer
/**
* Reparent this component under another container.
- *
+ *
* @param parent
* @since 1.5
*/
void reparent(ContainerPeer parent);
-
+
/**
* Set the bounds of this component peer.
- *
+ *
* @param x the new x co-ordinate
* @param y the new y co-ordinate
* @param width the new width
@@ -504,10 +504,10 @@ public interface ComponentPeer
* @since 1.5
*/
void setBounds (int x, int y, int width, int height, int z);
-
+
/**
* Check if this component supports being reparented.
- *
+ *
* @return true if this component can be reparented,
* false otherwise.
* @since 1.5
diff --git a/java/awt/peer/ContainerPeer.java b/java/awt/peer/ContainerPeer.java
index 76673a1df..497abdc32 100644
--- a/java/awt/peer/ContainerPeer.java
+++ b/java/awt/peer/ContainerPeer.java
@@ -54,10 +54,10 @@ public interface ContainerPeer extends ComponentPeer
void endLayout();
boolean isPaintPending();
-
+
/**
* Check if this container peer can be restacked.
- *
+ *
* @return true if this container peer supports being restacked, false otherwise
* @since 1.5
*/
@@ -65,7 +65,7 @@ public interface ContainerPeer extends ComponentPeer
/**
* Cancel a pending paint event on a region of this container.
- *
+ *
* @param x the x co-ordinate of the region
* @param y the y co-ordinate of the region
* @param width the width of the region
@@ -73,12 +73,11 @@ public interface ContainerPeer extends ComponentPeer
* @since 1.5
*/
void cancelPendingPaint(int x, int y, int width, int height);
-
+
/**
* Restack the component peers in this container peer.
- *
+ *
* @since 1.5
*/
void restack();
-} // interface ContainerPeer
-
+} // interface ContainerPeer
diff --git a/java/awt/peer/DesktopPeer.java b/java/awt/peer/DesktopPeer.java
index 355d293b3..626ea840e 100644
--- a/java/awt/peer/DesktopPeer.java
+++ b/java/awt/peer/DesktopPeer.java
@@ -55,10 +55,10 @@ public interface DesktopPeer
public boolean isSupported(Action action);
public void mail(URI mailtoURL) throws IOException;
-
+
public void mail() throws IOException;
public void open(File file) throws IOException;
-
+
public void print(File file) throws IOException;
}
diff --git a/java/awt/peer/DialogPeer.java b/java/awt/peer/DialogPeer.java
index e26d64ff9..b0963eceb 100644
--- a/java/awt/peer/DialogPeer.java
+++ b/java/awt/peer/DialogPeer.java
@@ -44,5 +44,4 @@ public interface DialogPeer extends WindowPeer
void setTitle (String title);
-} // interface DialogPeer
-
+} // interface DialogPeer
diff --git a/java/awt/peer/FileDialogPeer.java b/java/awt/peer/FileDialogPeer.java
index 7db179816..608b9c5d6 100644
--- a/java/awt/peer/FileDialogPeer.java
+++ b/java/awt/peer/FileDialogPeer.java
@@ -48,5 +48,4 @@ public interface FileDialogPeer extends DialogPeer
void setFilenameFilter (FilenameFilter ff);
-} // interface FileDialogPeer
-
+} // interface FileDialogPeer
diff --git a/java/awt/peer/FontPeer.java b/java/awt/peer/FontPeer.java
index f0ba6d830..388e56175 100644
--- a/java/awt/peer/FontPeer.java
+++ b/java/awt/peer/FontPeer.java
@@ -42,4 +42,3 @@ public interface FontPeer
{
} // interface FontPeer
-
diff --git a/java/awt/peer/FramePeer.java b/java/awt/peer/FramePeer.java
index 929791489..f00236819 100644
--- a/java/awt/peer/FramePeer.java
+++ b/java/awt/peer/FramePeer.java
@@ -51,19 +51,19 @@ public interface FramePeer extends WindowPeer
int getState();
void setState(int state);
void setMaximizedBounds(Rectangle r);
-
+
/**
* Check if this frame peer supports being restacked.
- *
+ *
* @return true if this frame peer can be restacked,
* false otherwise
* @since 1.5
*/
boolean isRestackSupported();
-
+
/**
* Sets the bounds of this frame peer.
- *
+ *
* @param x the new x co-ordinate
* @param y the new y co-ordinate
* @param width the new width
@@ -75,4 +75,3 @@ public interface FramePeer extends WindowPeer
Rectangle getBoundsPrivate();
} // interface FramePeer
-
diff --git a/java/awt/peer/LabelPeer.java b/java/awt/peer/LabelPeer.java
index d0fca462f..b0c5c346d 100644
--- a/java/awt/peer/LabelPeer.java
+++ b/java/awt/peer/LabelPeer.java
@@ -42,5 +42,4 @@ public interface LabelPeer extends ComponentPeer
{
void setAlignment(int alignment);
void setText(String text);
-} // interface LabelPeer
-
+} // interface LabelPeer
diff --git a/java/awt/peer/LightweightPeer.java b/java/awt/peer/LightweightPeer.java
index 93cad7a03..38333b0aa 100644
--- a/java/awt/peer/LightweightPeer.java
+++ b/java/awt/peer/LightweightPeer.java
@@ -42,4 +42,3 @@ public interface LightweightPeer extends ComponentPeer
{
} // interface LightweightPeer
-
diff --git a/java/awt/peer/ListPeer.java b/java/awt/peer/ListPeer.java
index c0f765d16..55ff92913 100644
--- a/java/awt/peer/ListPeer.java
+++ b/java/awt/peer/ListPeer.java
@@ -57,5 +57,4 @@ public interface ListPeer extends ComponentPeer
void setMultipleSelections(boolean multi);
Dimension getPreferredSize(int s);
Dimension getMinimumSize(int s);
-} // interface ListPeer
-
+} // interface ListPeer
diff --git a/java/awt/peer/MenuBarPeer.java b/java/awt/peer/MenuBarPeer.java
index 44e37e2d4..ae43af3cc 100644
--- a/java/awt/peer/MenuBarPeer.java
+++ b/java/awt/peer/MenuBarPeer.java
@@ -45,5 +45,4 @@ public interface MenuBarPeer extends MenuComponentPeer
void addMenu(Menu m);
void addHelpMenu(Menu menu);
void delMenu(int index);
-} // interface MenuBarPeer
-
+} // interface MenuBarPeer
diff --git a/java/awt/peer/MenuComponentPeer.java b/java/awt/peer/MenuComponentPeer.java
index bfd3414ec..7369aa52e 100644
--- a/java/awt/peer/MenuComponentPeer.java
+++ b/java/awt/peer/MenuComponentPeer.java
@@ -1,4 +1,4 @@
-/* MenuComponentPeer.java --
+/* MenuComponentPeer.java --
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,13 +43,12 @@ import java.awt.Font;
public interface MenuComponentPeer
{
void dispose();
-
+
/**
* Set the font on this menu component peer.
- *
+ *
* @param font the new font
* @since 1.5
*/
void setFont (Font font);
} // interface MenuComponentPeer
-
diff --git a/java/awt/peer/MenuItemPeer.java b/java/awt/peer/MenuItemPeer.java
index 3ba1027e5..bedbd9f9e 100644
--- a/java/awt/peer/MenuItemPeer.java
+++ b/java/awt/peer/MenuItemPeer.java
@@ -44,5 +44,4 @@ public interface MenuItemPeer extends MenuComponentPeer
void enable();
void setEnabled(boolean enabled);
void setLabel(String text);
-} // interface MenuItemPeer
-
+} // interface MenuItemPeer
diff --git a/java/awt/peer/MenuPeer.java b/java/awt/peer/MenuPeer.java
index 91d0f0d11..e1f7a90e2 100644
--- a/java/awt/peer/MenuPeer.java
+++ b/java/awt/peer/MenuPeer.java
@@ -46,4 +46,3 @@ public interface MenuPeer extends MenuItemPeer
void addSeparator ();
void delItem (int index);
}
-
diff --git a/java/awt/peer/MouseInfoPeer.java b/java/awt/peer/MouseInfoPeer.java
index e9923a653..71d294157 100644
--- a/java/awt/peer/MouseInfoPeer.java
+++ b/java/awt/peer/MouseInfoPeer.java
@@ -51,11 +51,11 @@ public interface MouseInfoPeer
/**
* Get the mouse pointer coordinates and store them in p (obviously non-null)
* returns the index of the current screen device of the mouse.
- */
+ */
public int fillPointWithCoords(Point p);
/**
* Returns whether a given Window is under the mouse.
- */
+ */
public boolean isWindowUnderMouse(Window w);
-}
+}
diff --git a/java/awt/peer/PanelPeer.java b/java/awt/peer/PanelPeer.java
index 192632e46..a72b16cac 100644
--- a/java/awt/peer/PanelPeer.java
+++ b/java/awt/peer/PanelPeer.java
@@ -42,4 +42,3 @@ public interface PanelPeer extends ContainerPeer
{
} // interface PanelPeer
-
diff --git a/java/awt/peer/PopupMenuPeer.java b/java/awt/peer/PopupMenuPeer.java
index 2e8f4bbed..e747a4de7 100644
--- a/java/awt/peer/PopupMenuPeer.java
+++ b/java/awt/peer/PopupMenuPeer.java
@@ -50,4 +50,3 @@ public interface PopupMenuPeer extends MenuPeer
void show (Event e);
} // interface PopupMenuPeer
-
diff --git a/java/awt/peer/RobotPeer.java b/java/awt/peer/RobotPeer.java
index a11bfc734..46c0086dc 100644
--- a/java/awt/peer/RobotPeer.java
+++ b/java/awt/peer/RobotPeer.java
@@ -53,4 +53,3 @@ public interface RobotPeer
void dispose();
} // interface RobotPeer
-
diff --git a/java/awt/peer/ScrollPanePeer.java b/java/awt/peer/ScrollPanePeer.java
index de4331e04..afbd2f861 100644
--- a/java/awt/peer/ScrollPanePeer.java
+++ b/java/awt/peer/ScrollPanePeer.java
@@ -49,4 +49,3 @@ public interface ScrollPanePeer extends ContainerPeer
void setUnitIncrement(Adjustable item, int inc);
void setValue(Adjustable item, int value);
} // interface ScollPanePeer
-
diff --git a/java/awt/peer/ScrollbarPeer.java b/java/awt/peer/ScrollbarPeer.java
index fe4f24d64..4191a39b7 100644
--- a/java/awt/peer/ScrollbarPeer.java
+++ b/java/awt/peer/ScrollbarPeer.java
@@ -43,5 +43,4 @@ public interface ScrollbarPeer extends ComponentPeer
void setLineIncrement(int inc);
void setPageIncrement(int inc);
void setValues(int value, int visible, int min, int max);
-} // interface ScrollbarPeer
-
+} // interface ScrollbarPeer
diff --git a/java/awt/peer/TextComponentPeer.java b/java/awt/peer/TextComponentPeer.java
index f80729974..57f0fd2eb 100644
--- a/java/awt/peer/TextComponentPeer.java
+++ b/java/awt/peer/TextComponentPeer.java
@@ -54,13 +54,12 @@ public interface TextComponentPeer extends ComponentPeer
int getIndexAtPoint(int x, int y);
Rectangle getCharacterBounds(int pos);
long filterEvents(long filter);
-
+
/**
* Retrieve this text component peer's input method requests.
- *
+ *
* @return the input method requests made by this text component peer
* @since 1.5
*/
InputMethodRequests getInputMethodRequests();
-} // interface TextComponentPeer
-
+} // interface TextComponentPeer
diff --git a/java/awt/peer/TextFieldPeer.java b/java/awt/peer/TextFieldPeer.java
index e68d6663f..55c673a2d 100644
--- a/java/awt/peer/TextFieldPeer.java
+++ b/java/awt/peer/TextFieldPeer.java
@@ -47,6 +47,5 @@ public interface TextFieldPeer extends TextComponentPeer
Dimension getMinimumSize(int len);
Dimension getPreferredSize(int len);
void setEchoChar(char echo_char);
- void setEchoCharacter(char echo_char);
-} // interface TextFieldPeer
-
+ void setEchoCharacter(char echo_char);
+} // interface TextFieldPeer
diff --git a/java/awt/peer/WindowPeer.java b/java/awt/peer/WindowPeer.java
index e8b7d7201..3ca13a20f 100644
--- a/java/awt/peer/WindowPeer.java
+++ b/java/awt/peer/WindowPeer.java
@@ -44,17 +44,17 @@ public interface WindowPeer extends ContainerPeer
{
void toBack();
void toFront();
-
+
/**
* Update the always-on-top status of the Window.
*
* @since 1.5
*/
void updateAlwaysOnTop();
-
+
/**
* Request that this window peer be given the window focus.
- *
+ *
* @return true if the window received focus, false otherwise
* @since 1.5
*/
@@ -66,5 +66,4 @@ public interface WindowPeer extends ContainerPeer
void updateMinimumSize();
void updateIconImages();
-} // interface WindowPeer
-
+} // interface WindowPeer
diff --git a/java/awt/print/Book.java b/java/awt/print/Book.java
index b084a1723..8b040b2d1 100644
--- a/java/awt/print/Book.java
+++ b/java/awt/print/Book.java
@@ -135,8 +135,8 @@ public class Book implements Pageable
{
for (int i = 0; i < num_pages; i++)
{
- printables.addElement(printable);
- page_formats.addElement(page_format);
+ printables.addElement(printable);
+ page_formats.addElement(page_format);
}
}
diff --git a/java/awt/print/PageFormat.java b/java/awt/print/PageFormat.java
index 0a8aa3ed0..86d8ba210 100644
--- a/java/awt/print/PageFormat.java
+++ b/java/awt/print/PageFormat.java
@@ -41,7 +41,7 @@ package java.awt.print;
/**
* This class contains information about the desired page format to use for
* printing a particular set of pages.
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class PageFormat
@@ -61,9 +61,9 @@ public class PageFormat
/**
* A constant for a reversed landscaped page orientation. This is the
- * orientation used by Macintosh's for landscape. The origin is in the
- * upper right hand corner instead of the upper left. The X and Y axes
- * are reversed. Used by <code>getOrientation</code> and
+ * orientation used by Macintosh's for landscape. The origin is in the
+ * upper right hand corner instead of the upper left. The X and Y axes
+ * are reversed. Used by <code>getOrientation</code> and
* <code>setOrientation</code>.
*/
public static final int REVERSE_LANDSCAPE = 2;
@@ -87,7 +87,7 @@ public class PageFormat
/**
* This method returns the width of the page, in 1/72nd's of an inch. The
* "width" measured depends on orientation.
- *
+ *
* @return The width of the page.
*/
public double getWidth()
@@ -98,7 +98,7 @@ public class PageFormat
/**
* This method returns the height of the page, in 1/72nd's of an inch. The
* "height" measured depends on the orientation.
- *
+ *
* @return The height of the page.
*/
public double getHeight()
@@ -109,7 +109,7 @@ public class PageFormat
/**
* This method returns the X coordinate value of the upper leftmost drawable
* area of the paper.
- *
+ *
* @return The upper leftmost imageable X coordinate.
*/
public double getImageableX()
@@ -120,7 +120,7 @@ public class PageFormat
/**
* This method returns the Y coordinate value of the upper leftmost drawable
* area of the paper.
- *
+ *
* @return The upper leftmost imageable Y coordinate.
*/
public double getImageableY()
@@ -131,7 +131,7 @@ public class PageFormat
/**
* This method returns the imageable width of the paper, in 1/72nd's of an
* inch.
- *
+ *
* @return The imageable width of the paper.
*/
public double getImageableWidth()
@@ -142,7 +142,7 @@ public class PageFormat
/**
* This method returns the imageable height of the paper, in 1/72nd's of an
* inch.
- *
+ *
* @return The imageable height of the paper.
*/
public double getImageableHeight()
@@ -153,7 +153,7 @@ public class PageFormat
/**
* Returns a copy of the <code>paper</code> object being used for this page
* format.
- *
+ *
* @return A copy of the <code>Paper</code> object for this format.
*/
public Paper getPaper()
@@ -163,7 +163,7 @@ public class PageFormat
/**
* Sets the <code>Paper</code> object to be used by this page format.
- *
+ *
* @param paper The new <code>Paper</code> object for this page format.
*/
public void setPaper(Paper paper)
@@ -174,7 +174,7 @@ public class PageFormat
/**
* This method returns the current page orientation. The value returned will
* be one of the page orientation constants from this class.
- *
+ *
* @return The current page orientation.
*/
public int getOrientation()
@@ -184,11 +184,11 @@ public class PageFormat
/**
* This method sets the page orientation for this format to the specified
- * value. It must be one of the page orientation constants from this class
+ * value. It must be one of the page orientation constants from this class
* or an exception will be thrown.
- *
+ *
* @param orientation The new page orientation.
- * @exception IllegalArgumentException If the specified page orientation
+ * @exception IllegalArgumentException If the specified page orientation
* value is not one of the constants from this class.
*/
public void setOrientation(int orientation) throws IllegalArgumentException
@@ -203,9 +203,9 @@ public class PageFormat
/**
* This method returns a matrix used for transforming user space coordinates
- * to page coordinates. The value returned will be six doubles as described
+ * to page coordinates. The value returned will be six doubles as described
* in <code>java.awt.geom.AffineTransform</code>.
- *
+ *
* @return The transformation matrix for this page format.
*/
public double[] getMatrix()
diff --git a/java/awt/print/Pageable.java b/java/awt/print/Pageable.java
index d61195a92..58e0885fb 100644
--- a/java/awt/print/Pageable.java
+++ b/java/awt/print/Pageable.java
@@ -40,7 +40,7 @@ package java.awt.print;
/**
* This interface represents pages that are to be printed.
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface Pageable
@@ -53,9 +53,9 @@ public interface Pageable
/**
* This method returns the number of pages this object contains, or
- * <code>UNKNOWN_NUMBER_OF_PAGES</code> if it cannot determine the number
+ * <code>UNKNOWN_NUMBER_OF_PAGES</code> if it cannot determine the number
* of pages to be printed.
- *
+ *
* @return The number of pages to be printed, or
* <code>UNKNOWN_NUMBER_OF_PAGES</code> if this is unknown.
*/
@@ -65,11 +65,11 @@ public interface Pageable
* This method returns the <code>PageFormat</code> instance for the
* specified page. Page numbers start at zero. An exception is thrown if the
* requested page does not exist.
- *
+ *
* @param pageIndex The index of the page to return the
* <code>PageFormat</code> for.
* @return The <code>PageFormat</code> for the requested page.
- * @exception IndexOutOfBoundsException If the requested page number does
+ * @exception IndexOutOfBoundsException If the requested page number does
* not exist.
*/
PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException;
@@ -78,11 +78,11 @@ public interface Pageable
* This method returns the <code>Printable</code> instance for the specified
* page. Page numbers start at zero. An exception is thrown if the requested
* page does not exist.
- *
- * @param pageIndex The index of the page to return the
+ *
+ * @param pageIndex The index of the page to return the
* <code>Printable</code> for.
* @return The <code>Printable</code> for the requested page.
- * @exception IndexOutOfBoundsException If the requested page number does
+ * @exception IndexOutOfBoundsException If the requested page number does
* not exist.
*/
Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException;
diff --git a/java/awt/print/Paper.java b/java/awt/print/Paper.java
index fb7ba9115..a80da2fea 100644
--- a/java/awt/print/Paper.java
+++ b/java/awt/print/Paper.java
@@ -40,7 +40,7 @@ package java.awt.print;
/**
* This class describes a particular type of paper.
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class Paper
@@ -79,7 +79,7 @@ public class Paper
/**
* This method returns the height of the paper in 1/72nds of an inch.
- *
+ *
* @return The height of the paper in 1/72nds of an inch.
*/
public double getHeight()
@@ -89,7 +89,7 @@ public class Paper
/**
* Returns the width of the paper in 1/72nds of an inch.
- *
+ *
* @return The width of the paper in 1/72nds of an inch.
*/
public double getWidth()
@@ -100,7 +100,7 @@ public class Paper
/**
* This method returns the X coordinate of the upper left hand corner of the
* imageable area of the paper.
- *
+ *
* @return The X coordinate of the upper left hand corner of the imageable
* area of the paper.
*/
@@ -112,7 +112,7 @@ public class Paper
/**
* This method returns the Y coordinate of the upper left hand corner of the
* imageable area of the paper.
- *
+ *
* @return The Y coordinate of the upper left hand corner of the imageable
* area of the paper.
*/
@@ -123,7 +123,7 @@ public class Paper
/**
* Returns the width of the imageable area of the paper.
- *
+ *
* @return The width of the imageable area of the paper.
*/
public double getImageableWidth()
@@ -133,7 +133,7 @@ public class Paper
/**
* Returns the height of the imageable area of the paper.
- *
+ *
* @return The height of the imageable area of the paper.
*/
public double getImageableHeight()
@@ -144,7 +144,7 @@ public class Paper
/**
* This method sets the size of the paper to the specified width and height,
* which are specified in 1/72nds of an inch.
- *
+ *
* @param width The width of the paper in 1/72nds of an inch.
* @param height The height of the paper in 1/72nds of an inch.
*/
@@ -156,9 +156,9 @@ public class Paper
/**
* This method sets the imageable area of the paper by specifying the
- * coordinates of the upper left hand corner of that area, and its length
+ * coordinates of the upper left hand corner of that area, and its length
* and height. All values are in 1/72nds of an inch.
- *
+ *
* @param imageableX The X coordinate of the upper left hand corner of the
* imageable area, in 1/72nds of an inch.
* @param imageableY The Y coordinate of the upper left hand corner of the
@@ -179,7 +179,7 @@ public class Paper
/**
* This method creates a copy of this object.
- *
+ *
* @return A copy of this object.
*/
public Object clone()
diff --git a/java/awt/print/PrinterGraphics.java b/java/awt/print/PrinterGraphics.java
index 62fde8406..c1f199c65 100644
--- a/java/awt/print/PrinterGraphics.java
+++ b/java/awt/print/PrinterGraphics.java
@@ -42,7 +42,7 @@ package java.awt.print;
* This interface is implemented by the <code>Graphics</code> instance that is
* used for rendering pages. It provides a hook to return the object that is
* controlling the print job.
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface PrinterGraphics
@@ -50,7 +50,7 @@ public interface PrinterGraphics
/**
* This method returns the instance of <code>PrinterJob</code> that is
* controlling this print job.
- *
+ *
* @return The <code>PrinterJob</code> that is controlling this print job.
*/
PrinterJob getPrinterJob();
diff --git a/java/awt/print/PrinterIOException.java b/java/awt/print/PrinterIOException.java
index c646acdec..2089af59e 100644
--- a/java/awt/print/PrinterIOException.java
+++ b/java/awt/print/PrinterIOException.java
@@ -71,7 +71,7 @@ public class PrinterIOException extends PrinterException
{
super(mException == null ? null : mException.toString());
initCause(mException);
- this.mException = mException;
+ this.mException = mException;
}
/**
@@ -95,4 +95,3 @@ public class PrinterIOException extends PrinterException
return mException;
}
} // class PrinterIOException
-
diff --git a/java/awt/print/PrinterJob.java b/java/awt/print/PrinterJob.java
index 3715dd235..1a4b8c8e2 100644
--- a/java/awt/print/PrinterJob.java
+++ b/java/awt/print/PrinterJob.java
@@ -68,7 +68,7 @@ public abstract class PrinterJob
}
/**
- * Initializes a new instance of <code>PrinterJob</code>.
+ * Initializes a new instance of <code>PrinterJob</code>.
*/
public PrinterJob()
{
@@ -163,7 +163,7 @@ public abstract class PrinterJob
// FIXME: Implement this for real.
return pageDialog((PageFormat) null);
}
-
+
/**
* Prints the pages.
*/
@@ -239,7 +239,7 @@ public abstract class PrinterJob
/**
* Find and return 2D image print services.
- *
+ *
* This is the same as calling PrintServiceLookup.lookupPrintServices()
* with Pageable service-specified DocFlavor.
* @return Array of PrintService objects, could be empty.
@@ -250,13 +250,13 @@ public abstract class PrinterJob
return PrintServiceLookup.lookupPrintServices
(
new DocFlavor("application/x-java-jvm-local-objectref",
- "java.awt.print.Pageable"),
+ "java.awt.print.Pageable"),
null);
}
/**
* Find and return 2D image stream print services.
- *
+ *
* This is the same as calling
* StreamPrintServiceFactory.lookupStreamPrintServices()
* with Pageable service-specified DocFlavor.
@@ -274,7 +274,7 @@ public abstract class PrinterJob
/**
* Return the printer for this job. If print services aren't supported by
* the subclass, returns null.
- *
+ *
* @return The associated PrintService.
* @since 1.4
*/
diff --git a/java/beans/AppletInitializer.java b/java/beans/AppletInitializer.java
index 69dc2cae5..3bc2534e1 100644
--- a/java/beans/AppletInitializer.java
+++ b/java/beans/AppletInitializer.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/beans/BeanDescriptor.java b/java/beans/BeanDescriptor.java
index b4bc6870d..6795d91b3 100644
--- a/java/beans/BeanDescriptor.java
+++ b/java/beans/BeanDescriptor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -48,42 +48,42 @@ package java.beans;
**/
public class BeanDescriptor extends FeatureDescriptor {
- Class<?> beanClass;
- Class<?> customizerClass;
-
- /** Create a new BeanDescriptor with the given beanClass and
- ** no customizer class.
- ** @param beanClass the class of the Bean.
- **/
- public BeanDescriptor(Class<?> beanClass) {
- this(beanClass,null);
- }
-
- /** Create a new BeanDescriptor with the given bean class and
- ** customizer class.
- ** @param beanClass the class of the Bean.
- ** @param customizerClass the class of the Bean's Customizer.
- **/
- public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
- this.beanClass = beanClass;
- this.customizerClass = customizerClass;
-
- // Set the FeatureDescriptor programmatic name.
- String name = beanClass.getName();
- int lastInd = name.lastIndexOf('.');
- if (lastInd != -1)
- name = name.substring(lastInd + 1);
-
- setName(name);
- }
-
- /** Get the Bean's class. **/
- public Class<?> getBeanClass() {
- return beanClass;
- }
-
- /** Get the Bean's customizer's class. **/
- public Class<?> getCustomizerClass() {
- return customizerClass;
- }
+ Class<?> beanClass;
+ Class<?> customizerClass;
+
+ /** Create a new BeanDescriptor with the given beanClass and
+ ** no customizer class.
+ ** @param beanClass the class of the Bean.
+ **/
+ public BeanDescriptor(Class<?> beanClass) {
+ this(beanClass,null);
+ }
+
+ /** Create a new BeanDescriptor with the given bean class and
+ ** customizer class.
+ ** @param beanClass the class of the Bean.
+ ** @param customizerClass the class of the Bean's Customizer.
+ **/
+ public BeanDescriptor(Class<?> beanClass, Class<?> customizerClass) {
+ this.beanClass = beanClass;
+ this.customizerClass = customizerClass;
+
+ // Set the FeatureDescriptor programmatic name.
+ String name = beanClass.getName();
+ int lastInd = name.lastIndexOf('.');
+ if (lastInd != -1)
+ name = name.substring(lastInd + 1);
+
+ setName(name);
+ }
+
+ /** Get the Bean's class. **/
+ public Class<?> getBeanClass() {
+ return beanClass;
+ }
+
+ /** Get the Bean's customizer's class. **/
+ public Class<?> getCustomizerClass() {
+ return customizerClass;
+ }
}
diff --git a/java/beans/BeanInfo.java b/java/beans/BeanInfo.java
index 525500a38..3c9bf1bcd 100644
--- a/java/beans/BeanInfo.java
+++ b/java/beans/BeanInfo.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -73,109 +73,109 @@ package java.beans;
**/
public interface BeanInfo {
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_COLOR_16x16 = 1;
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_COLOR_32x32 = 2;
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_MONO_16x16 = 3;
- /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
- int ICON_MONO_32x32 = 4;
-
- /** Get the general description of this Bean type.
- ** @return the BeanDescriptor for the Bean, or null if
- ** the BeanDescriptor should be obtained by
- ** Introspection.
- **/
- BeanDescriptor getBeanDescriptor();
-
- /** Get the events this Bean type fires.
- ** @return the EventDescriptors representing events this
- ** Bean fires. Returns <CODE>null</CODE> if the
- ** events are to be acquired by Introspection.
- **/
- EventSetDescriptor[] getEventSetDescriptors();
-
- /** Get the "default" event, basically the one a RAD tool
- ** user is most likely to select.
- ** @return the index into the getEventSetDescriptors()
- ** that the user is most likely to use. Returns
- ** <CODE>-1</CODE> if there is no default event.
- **/
- int getDefaultEventIndex();
-
- /** Get the properties (get/set method pairs) this Bean
- ** type supports.
- ** @return the PropertyDescriptors representing the
- ** properties this Bean type supports.
- ** Returns <CODE>null</CODE> if the properties
- ** are to be obtained by Introspection.
- **/
- PropertyDescriptor[] getPropertyDescriptors();
-
- /** Get the "default" property, basically the one a RAD
- ** tool user is most likely to select.
- ** @return the index into the getPropertyDescriptors()
- ** that the user is most likely to use. Returns
- ** <CODE>-1</CODE> if there is no default event.
- **/
- int getDefaultPropertyIndex();
-
- /** Get the methods this Bean type supports.
- ** @return the MethodDescriptors representing the
- ** methods this Bean type supports. Returns
- ** <CODE>null</CODE> if the methods are to be
- ** obtained by Introspection.
- **/
- MethodDescriptor[] getMethodDescriptors();
-
- /** Get additional BeanInfos representing this Bean.
- ** In this version of JavaBeans, this method is used so
- ** that space and time can be saved by reading a BeanInfo
- ** for each class in the hierarchy (super, super(super),
- ** and so on).<P>
- **
- ** The order of precedence when two pieces of BeanInfo
- ** conflict (such as two PropertyDescriptors that have
- ** the same name), in order from highest precedence to
- ** lowest, is:
- ** <OL>
- ** <LI>This BeanInfo object.</LI>
- ** <LI><CODE>getAdditionalBeanInfo()[getAdditionalBeanInfo().length]</CODE></LI>
- ** <LI> ... </LI>
- ** <LI><CODE>getAdditionalBeanInfo()[1]</CODE></LI>
- ** <LI><CODE>getAdditionalBeanInfo()[0]</CODE></LI>
- ** </OL><P>
- **
- ** <STRONG>Spec Note:</STRONG> It is possible that
- ** returning <CODE>null</CODE> from this method could
- ** stop Introspection in its tracks, but it is unclear
- ** from the spec whether this is the case.
- **
- ** @return additional BeanInfos representing this Bean.
- ** <CODE>null</CODE> may be returned (see Spec
- ** Note, above).
- **/
- BeanInfo[] getAdditionalBeanInfo();
-
- /** Get a visual icon for this Bean.
- ** A Bean does not have to support icons, and if it does
- ** support icons, it does not have to support every single
- ** type. Sun recommends that if you only support one
- ** type, you support 16x16 color. Sun also notes that you
- ** should try to use a type (like GIF) that allows for
- ** transparent pixels, so that the background of the RAD
- ** tool can show through.<P>
- **
- ** <STRONG>Spec Note:</STRONG> If you do not support the
- ** type of icon that is being asked for, but you do
- ** support another type, it is unclear whether you should
- ** return the other type or not. I would presume not.
- **
- ** @param iconType the type of icon to get (see the
- ** ICON_* constants in this class).
- ** @return the icon, or null if that type of icon is
- ** unsupported by this Bean.
- **/
- java.awt.Image getIcon(int iconType);
+ /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
+ int ICON_COLOR_16x16 = 1;
+ /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
+ int ICON_COLOR_32x32 = 2;
+ /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
+ int ICON_MONO_16x16 = 3;
+ /** Use this as a parameter for the getIcon() command to retrieve a certain type of icon. **/
+ int ICON_MONO_32x32 = 4;
+
+ /** Get the general description of this Bean type.
+ ** @return the BeanDescriptor for the Bean, or null if
+ ** the BeanDescriptor should be obtained by
+ ** Introspection.
+ **/
+ BeanDescriptor getBeanDescriptor();
+
+ /** Get the events this Bean type fires.
+ ** @return the EventDescriptors representing events this
+ ** Bean fires. Returns <CODE>null</CODE> if the
+ ** events are to be acquired by Introspection.
+ **/
+ EventSetDescriptor[] getEventSetDescriptors();
+
+ /** Get the "default" event, basically the one a RAD tool
+ ** user is most likely to select.
+ ** @return the index into the getEventSetDescriptors()
+ ** that the user is most likely to use. Returns
+ ** <CODE>-1</CODE> if there is no default event.
+ **/
+ int getDefaultEventIndex();
+
+ /** Get the properties (get/set method pairs) this Bean
+ ** type supports.
+ ** @return the PropertyDescriptors representing the
+ ** properties this Bean type supports.
+ ** Returns <CODE>null</CODE> if the properties
+ ** are to be obtained by Introspection.
+ **/
+ PropertyDescriptor[] getPropertyDescriptors();
+
+ /** Get the "default" property, basically the one a RAD
+ ** tool user is most likely to select.
+ ** @return the index into the getPropertyDescriptors()
+ ** that the user is most likely to use. Returns
+ ** <CODE>-1</CODE> if there is no default event.
+ **/
+ int getDefaultPropertyIndex();
+
+ /** Get the methods this Bean type supports.
+ ** @return the MethodDescriptors representing the
+ ** methods this Bean type supports. Returns
+ ** <CODE>null</CODE> if the methods are to be
+ ** obtained by Introspection.
+ **/
+ MethodDescriptor[] getMethodDescriptors();
+
+ /** Get additional BeanInfos representing this Bean.
+ ** In this version of JavaBeans, this method is used so
+ ** that space and time can be saved by reading a BeanInfo
+ ** for each class in the hierarchy (super, super(super),
+ ** and so on).<P>
+ **
+ ** The order of precedence when two pieces of BeanInfo
+ ** conflict (such as two PropertyDescriptors that have
+ ** the same name), in order from highest precedence to
+ ** lowest, is:
+ ** <OL>
+ ** <LI>This BeanInfo object.</LI>
+ ** <LI><CODE>getAdditionalBeanInfo()[getAdditionalBeanInfo().length]</CODE></LI>
+ ** <LI> ... </LI>
+ ** <LI><CODE>getAdditionalBeanInfo()[1]</CODE></LI>
+ ** <LI><CODE>getAdditionalBeanInfo()[0]</CODE></LI>
+ ** </OL><P>
+ **
+ ** <STRONG>Spec Note:</STRONG> It is possible that
+ ** returning <CODE>null</CODE> from this method could
+ ** stop Introspection in its tracks, but it is unclear
+ ** from the spec whether this is the case.
+ **
+ ** @return additional BeanInfos representing this Bean.
+ ** <CODE>null</CODE> may be returned (see Spec
+ ** Note, above).
+ **/
+ BeanInfo[] getAdditionalBeanInfo();
+
+ /** Get a visual icon for this Bean.
+ ** A Bean does not have to support icons, and if it does
+ ** support icons, it does not have to support every single
+ ** type. Sun recommends that if you only support one
+ ** type, you support 16x16 color. Sun also notes that you
+ ** should try to use a type (like GIF) that allows for
+ ** transparent pixels, so that the background of the RAD
+ ** tool can show through.<P>
+ **
+ ** <STRONG>Spec Note:</STRONG> If you do not support the
+ ** type of icon that is being asked for, but you do
+ ** support another type, it is unclear whether you should
+ ** return the other type or not. I would presume not.
+ **
+ ** @param iconType the type of icon to get (see the
+ ** ICON_* constants in this class).
+ ** @return the icon, or null if that type of icon is
+ ** unsupported by this Bean.
+ **/
+ java.awt.Image getIcon(int iconType);
}
diff --git a/java/beans/Beans.java b/java/beans/Beans.java
index 2f6e0a991..3066be7a5 100644
--- a/java/beans/Beans.java
+++ b/java/beans/Beans.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,7 +52,7 @@ import java.net.URL;
*
* @author John Keiser
* @author Robert Schuster
- *
+ *
* @since 1.1
* @status updated to 1.4
*
@@ -74,13 +74,13 @@ public class Beans
/** Creates a bean.
* <p>This is a convenience method that calls <code>instantiate(cl, beanName, null, null)</code>.</p>
- *
+ *
* @see instantiate(ClassLoader, String, BeanContext, AppletInitializer)
* @param cl ClassLoader to be used or <code>null</code> for the system classloader.
* @param beanName Name of a serialized bean or class name.
* @return A newly created bean.
* @throws IOException If access of an IO resource failed.
- * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
+ * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
*/
public static Object instantiate(ClassLoader cl, String beanName)
throws IOException, ClassNotFoundException
@@ -89,16 +89,16 @@ public class Beans
}
/** Creates a bean.
- *
+ *
* <p>This is a convenience method that calls <code>instantiate(cl, beanName, beanContext, null)</code>.</p>
- *
+ *
* @see instantiate(ClassLoader, String, BeanContext, AppletInitializer)
* @param cl ClassLoader to be used or <code>null</code> for the system classloader.
* @param beanName Name of a serialized bean or class name.
* @param beanContext Context to which the newly created Bean should be added.
* @return A newly created bean.
* @throws IOException If access of an IO resource failed.
- * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
+ * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
*/
public static Object instantiate(
ClassLoader cl,
@@ -110,38 +110,38 @@ public class Beans
}
/** Instantiates a bean according to Beans 1.0.
- *
+ *
* <p>In Beans 1.0 the instantiation scheme is as follows:</p>
* <p>The name should be dot-separated (e.g "place.for.beans.myBean") and indicate either a
* serialized object or a class name. In the first case all dots in the name are replaced with
* slashes ('/') and ".ser" is appended ("place.for.beans.myBean" becomes "place/for/beans/myBean.ser").
* The bean is then loaded as an application or system resource depending on whether a
* <code>ClassLoader</code> was provided.</p>
- *
+ *
* <p>If no such resource exists or if it contains no bean the name is interpreted as a class name of
* which an instance is then created.</p>
- *
+ *
* <p>If a <code>BeanContext</code> instance is available the created bean is added to it.</p>
- *
+ *
* <p>If the created Bean is an <code>Applet</code> or subclass and an <code>AppletInitializer</code>
* instance is available the applet is initialized and afterwards activated using the initializer. Additionally
* every instantiated <code>Applet</code> bean is initialized using the {@link Applet.init} method.
* Furthermore every applet gets a default <code>AppletStub</code>. The <code>Applet</code>'s
* document base is the location of the ".ser" file if it was deserialized or the location of its class
* file if it was instantiated.</p>
- *
+ *
* <p>A <code>ClassNotFoundException</code> is not only thrown when a class name was unknown
* but even when the class has public no-argument constructor
* (<code>IllegalAccessException</code> is wrapped) or an exception is thrown while
* invoking such a constructor (causing exception is wrapped).</p>
- *
+ *
* @param cl ClassLoader to be used or <code>null</code> for the system classloader.
* @param beanName Name of a serialized bean or class name.
* @param beanContext Context to which the newly created Bean should be added.
* @param initializer The AppletInitializer which is used for initializing <code>Applet</code> beans.
* @return A newly created bean.
* @throws IOException If access of an IO resource failed.
- * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
+ * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class.
*/
public static Object instantiate(
ClassLoader cl,
@@ -154,12 +154,12 @@ public class Beans
URL beanLocation = null;
URL classLocation = null;
- // Converts bean name into a resource name (eg. "a.b.c" -> "a/b/c").
+ // Converts bean name into a resource name (eg. "a.b.c" -> "a/b/c").
String resourceName = beanName.replace('.', '/');
/* Tries to get an input stream of the Bean, reading it as a system resource
* if no ClassLoader is present or as an application resource if a classloader
- * is given.
+ * is given.
*/
beanLocation =
(cl == null)
@@ -211,10 +211,10 @@ public class Beans
bean = beanClass.newInstance();
}
catch(Exception e) {
- /* Wraps all kinds of Exceptions in a ClassNotFoundException (this behavior
- * matches with official >= 1.5, this was different for <=1.4)
- */
- throw new ClassNotFoundException(null, e);
+ /* Wraps all kinds of Exceptions in a ClassNotFoundException (this behavior
+ * matches with official >= 1.5, this was different for <=1.4)
+ */
+ throw new ClassNotFoundException(null, e);
}
}
@@ -224,8 +224,8 @@ public class Beans
* - as every other Bean Applets are added to a BeanContext if one is available
* - each instantiated Applet is initialized using Applet.init() (this is not done for deserialized ones)
* - finally AppletS get activated using the AppletInitializerS activate-Method
- *
- * The order of operations is important for compatibility.
+ *
+ * The order of operations is important for compatibility.
*/
Applet applet = null;
if (bean instanceof Applet)
@@ -344,7 +344,7 @@ public class Beans
/**
* Sets whether the GUI is available to use.
- *
+ *
* @param guiAvailable whether the GUI is available to use.
*/
public static void setGuiAvailable(boolean guiAvailable)
diff --git a/java/beans/Customizer.java b/java/beans/Customizer.java
index b36c89f88..bb6b4e2dd 100644
--- a/java/beans/Customizer.java
+++ b/java/beans/Customizer.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -67,20 +67,20 @@ package java.beans;
**/
public interface Customizer {
- /** Set the object to Customize. This will always be a
- ** Bean that had a BeanDescriptor indicating this
- ** Customizer.
- ** @param bean the Bean to customize.
- **/
- void setObject(Object bean);
+ /** Set the object to Customize. This will always be a
+ ** Bean that had a BeanDescriptor indicating this
+ ** Customizer.
+ ** @param bean the Bean to customize.
+ **/
+ void setObject(Object bean);
- /** Add a PropertyChangeListener.
- ** @param l the PropertyChangeListener to add.
- **/
- void addPropertyChangeListener(PropertyChangeListener l);
+ /** Add a PropertyChangeListener.
+ ** @param l the PropertyChangeListener to add.
+ **/
+ void addPropertyChangeListener(PropertyChangeListener l);
- /** Remove a PropertyChangeListener.
- ** @param l the PropertyChangeListener to remove.
- **/
- void removePropertyChangeListener(PropertyChangeListener l);
+ /** Remove a PropertyChangeListener.
+ ** @param l the PropertyChangeListener to remove.
+ **/
+ void removePropertyChangeListener(PropertyChangeListener l);
}
diff --git a/java/beans/DefaultPersistenceDelegate.java b/java/beans/DefaultPersistenceDelegate.java
index c4328e030..3a4d86cca 100644
--- a/java/beans/DefaultPersistenceDelegate.java
+++ b/java/beans/DefaultPersistenceDelegate.java
@@ -44,7 +44,7 @@ import java.lang.reflect.Method;
/** <p><code>DefaultPersistenceDelegate</code> is a {@link PersistenceDelegate}
* implementation that can be used to serialize objects which adhere to the
* Java Beans naming convention.</p>
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
* @since 1.4
*/
@@ -62,11 +62,11 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate
/** This constructor allows to specify which Bean properties appear
* in the constructor.
- *
+ *
* <p>The implementation reads the mentioned properties from the Bean
* instance and applies it in the given order to a corresponding
* constructor.</p>
- *
+ *
* @param constructorPropertyNames The properties the Bean's constructor
* should be given to.
*/
@@ -167,13 +167,13 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate
// * PersistenceDelegate.initialize() is implemented in a way that it
// calls the initialize method of the superclass' persistence delegate.
super.initialize(type, oldInstance, newInstance, out);
-
+
// Suppresses the writing of property setting statements when this delegate
// is not used for the exact instance type. By doing so the following code
// is called only once per object.
if (type != oldInstance.getClass())
return;
-
+
try
{
PropertyDescriptor[] propertyDescs = Introspector.getBeanInfo(
diff --git a/java/beans/DesignMode.java b/java/beans/DesignMode.java
index 9897f022e..bc79361c1 100644
--- a/java/beans/DesignMode.java
+++ b/java/beans/DesignMode.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,7 +49,7 @@ package java.beans;
* @since JDK1.2
* @see java.beans.beancontext.BeanContextChild
*/
-public interface DesignMode
+public interface DesignMode
{
/**
diff --git a/java/beans/Encoder.java b/java/beans/Encoder.java
index 6dc36277f..b3d232a31 100644
--- a/java/beans/Encoder.java
+++ b/java/beans/Encoder.java
@@ -119,11 +119,11 @@ public class Encoder
pd = new CollectionPersistenceDelegate();
delegates.put(AbstractCollection.class, pd);
-
+
pd = new MapPersistenceDelegate();
delegates.put(java.util.AbstractMap.class, pd);
delegates.put(java.util.Hashtable.class, pd);
-
+
defaultPersistenceDelegate = new DefaultPersistenceDelegate();
delegates.put(Object.class, defaultPersistenceDelegate);
@@ -158,7 +158,7 @@ public class Encoder
accessCounter++;
pd.writeObject(o, this);
accessCounter--;
-
+
}
/**
@@ -169,8 +169,8 @@ public class Encoder
*/
public void setExceptionListener(ExceptionListener listener)
{
- exceptionListener = (listener != null)
- ? listener : DefaultExceptionListener.INSTANCE;
+ exceptionListener = (listener != null)
+ ? listener : DefaultExceptionListener.INSTANCE;
}
/**
@@ -261,7 +261,7 @@ public class Encoder
// String instances are handled in a special way.
// No one knows why this is not officially specified
// because this is a rather important design decision.
- return (oldInstance == null) ? null :
+ return (oldInstance == null) ? null :
(oldInstance.getClass() == String.class) ?
oldInstance : candidates.get(oldInstance);
}
@@ -338,8 +338,8 @@ public class Encoder
exceptionListener.exceptionThrown(e);
return;
}
-
-
+
+
newValue = get(value);
if (newValue == null)
@@ -369,15 +369,15 @@ public class Encoder
newArgs[i] = get(args[i]);
}
}
-
+
Expression newExpr = new Expression(newTarget, expr.getMethodName(),
newArgs);
-
+
// Fakes the result of Class.forName(<primitiveType>) to make it possible
// to hand such a type to the encoding process.
if (value instanceof Class && ((Class) value).isPrimitive())
newExpr.setValue(value);
-
+
// Instantiates the new object.
try
{
@@ -388,10 +388,10 @@ public class Encoder
catch (Exception e)
{
exceptionListener.exceptionThrown(e);
-
+
return;
}
-
+
writeObject(value);
}
@@ -404,10 +404,10 @@ public class Encoder
/** Returns whether the given class is an immutable
* type which has to be handled differently when serializing it.
- *
+ *
* <p>Immutable objects always have to be instantiated instead of
* modifying an existing instance.</p>
- *
+ *
* @param type The class to test.
* @return Whether the first argument is an immutable type.
*/
@@ -419,9 +419,9 @@ public class Encoder
|| type == Long.class || type == Float.class
|| type == Double.class;
}
-
+
/** Sets the stream candidate for a given object.
- *
+ *
* @param oldObject The object given to the encoder.
* @param newObject The object the encoder generated.
*/
@@ -429,5 +429,5 @@ public class Encoder
{
candidates.put(oldObject, newObject);
}
-
+
}
diff --git a/java/beans/EventHandler.java b/java/beans/EventHandler.java
index 5efbc8dc6..967ba8294 100644
--- a/java/beans/EventHandler.java
+++ b/java/beans/EventHandler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,14 +46,14 @@ import java.lang.reflect.Proxy;
/**
* <p>EventHandler forms a bridge between dynamically created listeners and
* arbitrary properties and methods.</p>
- *
+ *
* <p>You can use this class to easily create listener implementations for
* some basic interactions between an event source and its target. Using
* the three static methods named <code>create</code> you can create
* these listener implementations.</p>
- *
+ *
* <p>See the documentation of each method for usage examples.</p>
- *
+ *
* @author Jerry Quinn (jlquinn@optonline.net)
* @author Robert Schuster (thebohemian@gmx.net)
* @since 1.4
@@ -74,7 +74,7 @@ public class EventHandler implements InvocationHandler
// The target objects Class.
private Class targetClass;
-
+
// String class doesn't already have a capitalize routine.
private String capitalize(String s)
{
@@ -90,9 +90,9 @@ public class EventHandler implements InvocationHandler
* <p>This constructs an EventHandler that will connect the method
* listenerMethodName to target.action, extracting eventPropertyName from
* the first argument of listenerMethodName. and sending it to action.</p>
- *
+ *
* <p>Throws a <code>NullPointerException</code> if the <code>target</code>
- * argument is <code>null</code>.
+ * argument is <code>null</code>.
*
* @param target Object that will perform the action.
* @param action A property or method of the target.
@@ -100,17 +100,17 @@ public class EventHandler implements InvocationHandler
* @param listenerMethodName The listener method name triggering the action.
*/
public EventHandler(Object target, String action, String eventPropertyName,
- String listenerMethodName)
+ String listenerMethodName)
{
this.target = target;
-
+
// Retrieving the class is done for two reasons:
// 1) The class object is needed very frequently in the invoke() method.
// 2) The constructor should throw a NullPointerException if target is null.
targetClass = target.getClass();
-
- this.action = action; // Turn this into a method or do we wait till
- // runtime
+
+ this.action = action; // Turn this into a method or do we wait till
+ // runtime
property = eventPropertyName;
listenerMethod = listenerMethodName;
}
@@ -164,16 +164,16 @@ public class EventHandler implements InvocationHandler
String rest = null;
if ((pos = prop.indexOf('.')) != -1)
{
- rest = prop.substring(pos + 1);
- prop = prop.substring(0, pos);
+ rest = prop.substring(pos + 1);
+ prop = prop.substring(0, pos);
}
// Find a method named getProp. It could be isProp instead.
Method getter;
try
{
- // Look for boolean property getter isProperty
- getter = o.getClass().getMethod("is" + capitalize(prop));
+ // Look for boolean property getter isProperty
+ getter = o.getClass().getMethod("is" + capitalize(prop));
}
catch (NoSuchMethodException nsme1)
{
@@ -209,9 +209,9 @@ public class EventHandler implements InvocationHandler
/**
* Invokes the <code>EventHandler</code>.
- *
+ *
* <p>This method is normally called by the listener's proxy implementation.</p>
- *
+ *
* @param proxy The listener interface that is implemented using
* the proxy mechanism.
* @param method The method that was called on the proxy instance.
@@ -245,11 +245,11 @@ public class EventHandler implements InvocationHandler
// - need method and object to do the invoke and get return type
Object v[] = getProperty(event, property);
Object[] args = new Object[] { v[0] };
-
+
// Changes the class array that controls which method signature we are going
// to look up in the target object.
Class[] argTypes = new Class[] { initClass((Class) v[1]) };
-
+
// Tries to find a setter method to which we can apply the
while(argTypes[0] != null) {
try
@@ -263,16 +263,16 @@ public class EventHandler implements InvocationHandler
{
// If action as property didn't work, try as method later.
}
-
+
argTypes[0] = nextClass(argTypes[0]);
}
-
+
// We could not find a suitable setter method. Now we try again interpreting
// action as the method name itself.
- // Since we probably have changed the block local argTypes array
+ // Since we probably have changed the block local argTypes array
// we need to rebuild it.
argTypes = new Class[] { initClass((Class) v[1]) };
-
+
// Tries to find a setter method to which we can apply the
while(argTypes[0] != null) {
try
@@ -284,15 +284,15 @@ public class EventHandler implements InvocationHandler
catch (NoSuchMethodException e)
{
}
-
+
argTypes[0] = nextClass(argTypes[0]);
}
-
+
throw new RuntimeException("Method not called: Could not find a public method named '"
+ action + "' in target " + targetClass + " which takes a '"
+ v[1] + "' argument or a property of this type.");
- }
-
+ }
+
// If property was null we will search for a no-argument method here.
// Note: The ordering of method lookups is important because we want to prefer no-argument
// calls like the JDK does. This means if we have actionMethod() and actionMethod(Event) we will
@@ -312,25 +312,25 @@ public class EventHandler implements InvocationHandler
// else this can stay this way.
if(arguments != null && arguments.length >= 1/* && arguments[0] instanceof EventObject*/) {
Class[] targetArgTypes = new Class[] { initClass(arguments[0].getClass()) };
-
+
while(targetArgTypes[0] != null) {
try
{
// If no property exists we expect the first element of the arguments to be
// an EventObject which is then applied to the target method.
-
+
actionMethod = targetClass.getMethod(action, targetArgTypes);
-
+
return actionMethod.invoke(target, new Object[] { arguments[0] });
}
catch(NoSuchMethodException nsme2)
{
-
+
}
-
+
targetArgTypes[0] = nextClass(targetArgTypes[0]);
}
-
+
}
}
@@ -338,7 +338,7 @@ public class EventHandler implements InvocationHandler
// failed. The JDK throws an ArrayIndexOutOfBoundsException in this case.
if(actionMethod == null)
throw new ArrayIndexOutOfBoundsException(0);
-
+
// Invoke target.action(property)
return actionMethod.invoke(target);
} catch(InvocationTargetException ite) {
@@ -350,75 +350,75 @@ public class EventHandler implements InvocationHandler
throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae);
}
}
-
+
/**
* <p>Returns the primitive type for every wrapper class or the
* class itself if it is no wrapper class.</p>
- *
+ *
* <p>This is needed because to be able to find both kinds of methods:
* One that takes a wrapper class as the first argument and one that
* accepts a primitive instead.</p>
*/
private Class initClass(Class klass) {
if(klass == Boolean.class) {
- return Boolean.TYPE;
+ return Boolean.TYPE;
} else if(klass == Byte.class) {
- return Byte.TYPE;
+ return Byte.TYPE;
} else if(klass == Short.class) {
- return Short.TYPE;
+ return Short.TYPE;
} else if(klass == Integer.class) {
- return Integer.TYPE;
+ return Integer.TYPE;
} else if(klass == Long.class) {
- return Long.TYPE;
+ return Long.TYPE;
} else if(klass == Float.class) {
- return Float.TYPE;
+ return Float.TYPE;
} else if(klass == Double.class) {
- return Double.TYPE;
+ return Double.TYPE;
} else {
- return klass;
+ return klass;
}
}
/**
- *
- *
+ *
+ *
* @param klass
* @return
*/
private Class nextClass(Class klass) {
if(klass == Boolean.TYPE) {
- return Boolean.class;
+ return Boolean.class;
} else if(klass == Byte.TYPE) {
- return Byte.class;
+ return Byte.class;
} else if(klass == Short.TYPE) {
- return Short.class;
+ return Short.class;
} else if(klass == Integer.TYPE) {
- return Integer.class;
+ return Integer.class;
} else if(klass == Long.TYPE) {
- return Long.class;
+ return Long.class;
} else if(klass == Float.TYPE) {
- return Float.class;
+ return Float.class;
} else if(klass == Double.TYPE) {
- return Double.class;
+ return Double.class;
} else {
return klass.getSuperclass();
}
}
-
+
/**
* <p>Constructs an implementation of <code>listenerInterface</code>
* to dispatch events.</p>
- *
+ *
* <p>You can use such an implementation to simply call a public
* no-argument method of an arbitrary target object or to forward
* the first argument of the listener method to the target method.</p>
- *
+ *
* <p>Call this method like:</p>
* <code>
* button.addActionListener((ActionListener)
* EventHandler.create(ActionListener.class, target, "dispose"));
* </code>
- *
+ *
* <p>to achieve the following behavior:</p>
* <code>
* button.addActionListener(new ActionListener() {
@@ -427,11 +427,11 @@ public class EventHandler implements InvocationHandler
* }
* });
* </code>
- *
+ *
* <p>That means if you need a listener implementation that simply calls a
* a no-argument method on a given instance for <strong>each</strong>
* method of the listener interface.</p>
- *
+ *
* <p>Note: The <code>action</code> is interpreted as a method name. If your target object
* has no no-argument method of the given name the EventHandler tries to find
* a method with the same name but which can accept the first argument of the
@@ -444,15 +444,15 @@ public class EventHandler implements InvocationHandler
* to their wrapper class and vice versa. Furthermore it will call
* a target method if it accepts a superclass of the type of the
* first argument of the listener method.</p>
- *
+ *
* <p>In case that the method of the target object throws an exception
* it will be wrapped in a <code>RuntimeException</code> and thrown out
* of the listener method.</p>
- *
+ *
* <p>In case that the method of the target object cannot be found an
* <code>ArrayIndexOutOfBoundsException</code> will be thrown when the
* listener method is invoked.</p>
- *
+ *
* <p>A call to this method is equivalent to:
* <code>create(listenerInterface, target, action, null, null)</code></p>
*
@@ -462,7 +462,7 @@ public class EventHandler implements InvocationHandler
* @return A constructed proxy object.
*/
public static <T> T create(Class<T> listenerInterface, Object target,
- String action)
+ String action)
{
return create(listenerInterface, target, action, null, null);
}
@@ -476,27 +476,27 @@ public class EventHandler implements InvocationHandler
* and applies it to the target's property or method. This first argument
* of the listener is usually an event object but any other object is
* valid, too.</p>
- *
+ *
* <p>You can set the value of <code>eventPropertyName</code> to "prop"
* to denote the retrieval of a property named "prop" from the event
* object. In case that no such property exists the <code>EventHandler</code>
* will try to find a method with that name.</p>
- *
+ *
* <p>If you set <code>eventPropertyName</code> to a value like this "a.b.c"
* <code>EventHandler</code> will recursively evaluate the properties "a", "b"
* and "c". Again if no property can be found the <code>EventHandler</code>
* tries a method name instead. This allows mixing the names, too: "a.toString"
* will retrieve the property "a" from the event object and will then call
* the method "toString" on it.</p>
- *
+ *
* <p>An exception thrown in any of these methods will provoke a
* <code>RuntimeException</code> to be thrown which contains an
* <code>InvocationTargetException</code> containing the triggering exception.</p>
- *
+ *
* <p>If you set <code>eventPropertyName</code> to a non-null value the
* <code>action</code> parameter will be interpreted as a property name
* or a method name of the target object.</p>
- *
+ *
* <p>Any object retrieved from the event object and applied to the
* target will converted from primitives to their wrapper class or
* vice versa or applied to a method that accepts a superclass
@@ -512,35 +512,35 @@ public class EventHandler implements InvocationHandler
* }
* });
* </code>
- *
+ *
* <p>Can be expressed using the <code>EventHandler</code> like this:</p>
* <p>
* <code>button.addActionListener((ActionListener)
* EventHandler.create(ActionListener.class, textField, "text", "source.class.name");
* <code>
* </p>
- *
+ *
* <p>As said above you can specify the target as a method, too:</p>
* <p>
* <code>button.addActionListener((ActionListener)
* EventHandler.create(ActionListener.class, textField, "setText", "source.class.name");
* <code>
* </p>
- *
+ *
* <p>Furthermore you can use method names in the property:</p>
* <p>
* <code>button.addActionListener((ActionListener)
* EventHandler.create(ActionListener.class, textField, "setText", "getSource.getClass.getName");
* <code>
* </p>
- *
+ *
* <p>Finally you can mix names:</p>
* <p>
* <code>button.addActionListener((ActionListener)
* EventHandler.create(ActionListener.class, textField, "setText", "source.getClass.name");
* <code>
* </p>
- *
+ *
* <p>A call to this method is equivalent to:
* <code>create(listenerInterface, target, action, null, null)</code>
* </p>
@@ -552,7 +552,7 @@ public class EventHandler implements InvocationHandler
* @return A constructed proxy object.
*/
public static <T> T create(Class<T> listenerInterface, Object target,
- String action, String eventPropertyName)
+ String action, String eventPropertyName)
{
return create(listenerInterface, target, action, eventPropertyName, null);
}
@@ -566,7 +566,7 @@ public class EventHandler implements InvocationHandler
* to filter the listener method that should have an effect. Look at these
* method's documentation for more information about the <code>EventHandler</code>'s
* usage.</p>
- *
+ *
* <p>If you want to call <code>dispose</code> on a <code>JFrame</code> instance
* when the <code>WindowListener.windowClosing()</code> method was invoked use
* the following code:</p>
@@ -575,10 +575,10 @@ public class EventHandler implements InvocationHandler
* EventHandler.create(WindowListener.class, jframeInstance, "dispose", null, "windowClosing");
* </code>
* </p>
- *
+ *
* <p>A <code>NullPointerException</code> is thrown if the <code>listenerInterface</code>
* or <code>target</code> argument are <code>null</code>.
- *
+ *
* @param listenerInterface Listener interface to implement.
* @param target Object to invoke action on.
* @param action Target method name to invoke.
@@ -587,17 +587,17 @@ public class EventHandler implements InvocationHandler
* @return A constructed proxy object.
*/
public static <T> T create(Class<T> listenerInterface, Object target,
- String action, String eventPropertyName,
- String listenerMethodName)
+ String action, String eventPropertyName,
+ String listenerMethodName)
{
// Create EventHandler instance
EventHandler eh = new EventHandler(target, action, eventPropertyName,
- listenerMethodName);
+ listenerMethodName);
// Create proxy object passing in the event handler
Object proxy = Proxy.newProxyInstance(listenerInterface.getClassLoader(),
- new Class<?>[] {listenerInterface},
- eh);
+ new Class<?>[] {listenerInterface},
+ eh);
return (T) proxy;
}
diff --git a/java/beans/EventSetDescriptor.java b/java/beans/EventSetDescriptor.java
index 69c07423f..3f537c743 100644
--- a/java/beans/EventSetDescriptor.java
+++ b/java/beans/EventSetDescriptor.java
@@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -47,13 +47,13 @@ import java.util.Vector;
/**
* EventSetDescriptor describes the hookup between an event source class and
* an event listener class.
- *
+ *
* <p>EventSets have several attributes: the listener class,
* the events that can be fired to the listener (methods in the listener
* class), and an add and remove listener method from the event firer's
* class.
* </p>
- *
+ *
* <p>
* The methods have these constraints on them:
* <ul>
@@ -62,29 +62,29 @@ import java.util.Vector;
* package-protected. (Don't ask me why that is, I'm just following the spec.
* The only place it is even mentioned is in the Java Beans white paper, and
* there it is only implied.)</li>
- *
+ *
* <li>add listener method: must have <code>void</code> return value. Must
* take exactly one argument, of the listener class's type. May fire either
* zero exceptions, or one exception of type
* <code>java.util.TooManyListenersException</code>.
* Must be public.</li>
- *
+ *
* <li>remove listener method: must have <code>void</code> return value. Must
* take exactly one argument, of the listener class's type. May not fire any
* exceptions. Must be public.</li>
* </ul>
- *
+ *
* <p>
* A final constraint is that event listener classes must extend from
* EventListener.
* </p>
- *
+ *
* <p>
* There are also various design patterns associated with some of the methods
* of construction. Those are explained in more detail in the appropriate
* constructors.
* </p>
- *
+ *
* <p>
* <strong>Documentation Convention:</strong> for proper Internalization of
* Beans inside an RAD tool, sometimes there are two names for a property or
@@ -92,7 +92,7 @@ import java.util.Vector;
* anywhere, and a localized, display name, for ease of use. In the
* documentation I will specify different String values as either
* <em>programmatic</em> or <em>localized</em> to make this distinction clear.
- *
+ *
* @author John Keiser
* @author Robert Schuster (robertschuster@fsfe.org)
* @since 1.1
@@ -118,12 +118,12 @@ public class EventSetDescriptor extends FeatureDescriptor
/**
* Creates a new <code>EventSetDescriptor</code<.
- *
+ *
* <p>
* This version of the constructor enforces the rules imposed on the methods
* described at the top of this class, as well as searching for:
* </p>
- *
+ *
* <ol>
* <li>
* The event-firing method must be non-private with signature <code>void
@@ -140,7 +140,7 @@ public class EventSetDescriptor extends FeatureDescriptor
* should be chosen (they probably weren't thinking as pathologically as I
* was). I don't like arbitrarily choosing things. If your class has only one
* such signature, as most do, you'll have no problems.</li>
- *
+ *
* <li>The add and remove methods must be public and named <code>void
* add&lt;eventSetName&gt;Listener(&lt;listenerType&gt;)</code> and
* <code>void remove&lt;eventSetName&gt;Listener(&lt;listenerType&gt;)</code>
@@ -148,7 +148,7 @@ public class EventSetDescriptor extends FeatureDescriptor
* <code>&lt;eventSetName&gt;</code> will have its first letter capitalized.
* Standard exception rules (see class description) apply.</li>
* </ol>
- *
+ *
* @param eventSourceClass
* the class containing the add/remove listener methods.
* @param eventSetName
@@ -202,12 +202,12 @@ public class EventSetDescriptor extends FeatureDescriptor
/**
* Creates a new <code>EventSetDescriptor</code>.
- *
+ *
* <p>This form of the constructor allows you to specify the names of the
* methods and adds no new constraints on top of the rules already described
* at the top of the class.
* </p>
- *
+ *
* @param eventSourceClass
* the class containing the add and remove listener methods.
* @param eventSetName
@@ -251,7 +251,7 @@ public class EventSetDescriptor extends FeatureDescriptor
/**
* Creates a new <code>EventSetDescriptor</code>.
- *
+ *
* <p>
* This variant of the constructor allows you to specify the names of the
* methods and adds no new constraints on top of the rules already described
@@ -266,7 +266,7 @@ public class EventSetDescriptor extends FeatureDescriptor
* Note: The validity of the return value of the GetListener method is not
* checked.
* </p>
- *
+ *
* @param eventSourceClass
* the class containing the add and remove listener methods.
* @param eventSetName
@@ -301,13 +301,13 @@ public class EventSetDescriptor extends FeatureDescriptor
try
{
- newGetListenerMethod
+ newGetListenerMethod
= eventSourceClass.getMethod(getListenerMethodName,
new Class[] { Class.class });
}
catch (NoSuchMethodException nsme)
{
- throw (IntrospectionException)
+ throw (IntrospectionException)
new IntrospectionException("No method named " + getListenerMethodName
+ " in class " + listenerType
+ " which can be used as"
@@ -323,7 +323,7 @@ public class EventSetDescriptor extends FeatureDescriptor
/**
* Creates a new <code>EventSetDescriptor.</code>
- *
+ *
* <p>
* This variant of the constructor allows you to specify the names of the
* methods and adds no new constraints on top of the rules already described
@@ -338,7 +338,7 @@ public class EventSetDescriptor extends FeatureDescriptor
* Note: The validity of the return value of the GetListener method is not
* checked.
* </p>
- *
+ *
* @param eventSetName
* the programmatic name of the event set, generally starting with a
* lowercase letter (i.e. fooManChu instead of FooManChu).
@@ -381,12 +381,12 @@ public class EventSetDescriptor extends FeatureDescriptor
/**
* Creates a new <code>EventSetDescriptor</code>.
- *
+ *
* <p>This form of constructor allows you to explicitly say which methods
* do what, and no reflection is done by the <code>EventSetDescriptor</code>.
* The methods are, however, checked to ensure that they follow the rules
* set forth at the top of the class.
- *
+ *
* @param eventSetName
* the programmatic name of the event set, generally starting with a
* lowercase letter (i.e. fooManChu instead of FooManChu).
@@ -428,12 +428,12 @@ public class EventSetDescriptor extends FeatureDescriptor
}
/** Creates a new <code>EventSetDescriptor</code>.
- *
+ *
* <p>This form of constructor allows you to explicitly say which methods do
* what, and no reflection is done by the <code>EventSetDescriptor</code>.
* The methods are, however, checked to ensure that they follow the rules
* set forth at the top of the class.
- *
+ *
* @param eventSetName
* the programmatic name of the event set, generally starting with a
* lowercase letter (i.e. fooManChu instead of FooManChu).
@@ -504,14 +504,14 @@ public class EventSetDescriptor extends FeatureDescriptor
{
listenerMethodDescriptors
= new MethodDescriptor[listenerMethods.length];
-
+
for (int i = 0; i < listenerMethods.length; i++)
{
listenerMethodDescriptors[i]
= new MethodDescriptor(listenerMethods[i]);
}
}
-
+
return listenerMethodDescriptors;
}
@@ -539,7 +539,7 @@ public class EventSetDescriptor extends FeatureDescriptor
}
/** Sets whether or not multiple listeners may be added.
- *
+ *
* @param unicast
* whether or not multiple listeners may be added.
*/
@@ -557,7 +557,7 @@ public class EventSetDescriptor extends FeatureDescriptor
}
/** Sets whether or not this is in the default event set.
- *
+ *
* @param inDefaultEventSet
* whether this is in the default event set.
*/
@@ -759,5 +759,5 @@ public class EventSetDescriptor extends FeatureDescriptor
this.listenerMethods[i] = (Method) chosenMethods.elementAt(i);
}
}
-
+
}
diff --git a/java/beans/Expression.java b/java/beans/Expression.java
index b327864d9..d07c28b4a 100644
--- a/java/beans/Expression.java
+++ b/java/beans/Expression.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,13 +40,13 @@ package java.beans;
/**
* <p>An Expression captures the execution of an object method
* that returns a value.</p>
- *
+ *
* <p>It stores an object, the method to call, and the arguments to pass to
* the method.</p>
- *
+ *
* <p>While this class can generally be used to describe method calls it is
- * part of the XML serialization API.</p>
- *
+ * part of the XML serialization API.</p>
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
* @since 1.4
*/
@@ -63,7 +63,7 @@ public class Expression extends Statement
* Constructor Constructs an Expression representing the invocation of
* object.methodName(arg[0], arg[1], ...); However, it will never be executed.
* Instead, value will always be returned.
- *
+ *
* @param value
* The value to return.
* @param target
@@ -83,7 +83,7 @@ public class Expression extends Statement
/**
* Constructor Constructs an Expression representing the invocation of
* object.methodName(arg[0], arg[1], ...);
- *
+ *
* @param target
* The object to invoke the method on.
* @param methodName
@@ -102,7 +102,7 @@ public class Expression extends Statement
* been set, the method is executed in the same way as Statement.execute(),
* except that the value is cached, and then returned. If the value has been
* set, it is returned without executing the method again.
- *
+ *
* @return the result of executing the method.
* @exception Exception
* if an error occurs
@@ -116,7 +116,7 @@ public class Expression extends Statement
/**
* Set the cached value to be returned by getValue()
- *
+ *
* @param value
* the value to cache and return.
*/
diff --git a/java/beans/FeatureDescriptor.java b/java/beans/FeatureDescriptor.java
index 050885158..87e4a2fe7 100644
--- a/java/beans/FeatureDescriptor.java
+++ b/java/beans/FeatureDescriptor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/beans/IndexedPropertyChangeEvent.java b/java/beans/IndexedPropertyChangeEvent.java
index 1a7306d14..9c46e1fa1 100644
--- a/java/beans/IndexedPropertyChangeEvent.java
+++ b/java/beans/IndexedPropertyChangeEvent.java
@@ -71,7 +71,7 @@ public class IndexedPropertyChangeEvent extends PropertyChangeEvent
}
/**
- * Return the index of the changed property.
+ * Return the index of the changed property.
* @return the index
*/
public int getIndex()
diff --git a/java/beans/IndexedPropertyDescriptor.java b/java/beans/IndexedPropertyDescriptor.java
index 61c3f228d..b7914133a 100644
--- a/java/beans/IndexedPropertyDescriptor.java
+++ b/java/beans/IndexedPropertyDescriptor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -175,7 +175,7 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor
* Create a new PropertyDescriptor using explicit Methods.
* Note that the methods will be checked for conformance to standard
* Property method rules, as described above at the top of this class.
- *
+ *
* @param name the programmatic name of the property, usually
* starting with a lowercase letter (e.g. fooManChu
* instead of FooManChu).
diff --git a/java/beans/Introspector.java b/java/beans/Introspector.java
index 28df87f67..76412e022 100644
--- a/java/beans/Introspector.java
+++ b/java/beans/Introspector.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -94,7 +94,7 @@ import java.util.Vector;
*
*
* <STRONG>Properties:</STRONG><P>
- *
+ *
* <OL>
* <LI>If there is a <CODE>public boolean isXXX()</CODE>
* method, then XXX is a read-only boolean property.
@@ -167,7 +167,7 @@ import java.util.Vector;
* not the case in general.<P>
*
* <STRONG>Methods:</STRONG><P>
- *
+ *
* Any public methods (including those which were used
* for Properties or Events) are used as Methods.
*
@@ -176,18 +176,18 @@ import java.util.Vector;
* @see java.beans.BeanInfo
*/
public class Introspector {
-
+
public static final int USE_ALL_BEANINFO = 1;
public static final int IGNORE_IMMEDIATE_BEANINFO = 2;
public static final int IGNORE_ALL_BEANINFO = 3;
static String[] beanInfoSearchPath = {"gnu.java.beans.info"};
- static Hashtable<Class<?>,BeanInfo> beanInfoCache =
+ static Hashtable<Class<?>,BeanInfo> beanInfoCache =
new Hashtable<Class<?>,BeanInfo>();
-
+
private Introspector() {}
-
- /**
+
+ /**
* Get the BeanInfo for class <CODE>beanClass</CODE>,
* first by looking for explicit information, next by
* using standard design patterns to determine
@@ -196,32 +196,32 @@ public class Introspector {
* @param beanClass the class to get BeanInfo about.
* @return the BeanInfo object representing the class.
*/
- public static BeanInfo getBeanInfo(Class<?> beanClass)
- throws IntrospectionException
+ public static BeanInfo getBeanInfo(Class<?> beanClass)
+ throws IntrospectionException
{
BeanInfo cachedInfo;
- synchronized(beanClass)
+ synchronized(beanClass)
{
- cachedInfo = beanInfoCache.get(beanClass);
- if(cachedInfo != null)
- {
- return cachedInfo;
- }
- cachedInfo = getBeanInfo(beanClass,null);
- beanInfoCache.put(beanClass,cachedInfo);
- return cachedInfo;
+ cachedInfo = beanInfoCache.get(beanClass);
+ if(cachedInfo != null)
+ {
+ return cachedInfo;
+ }
+ cachedInfo = getBeanInfo(beanClass,null);
+ beanInfoCache.put(beanClass,cachedInfo);
+ return cachedInfo;
}
}
-
+
/**
* Returns a {@BeanInfo} instance for the given Bean class where a flag
* controls the usage of explicit BeanInfo class to retrieve that
* information.
- *
+ *
* <p>You have three options:</p>
* <p>With {@link #USE_ALL_BEANINFO} the result is the same as
* {@link #getBeanInfo(Class)}.</p>
- *
+ *
* <p>Calling the method with <code>flag</code> set to
* {@link #IGNORE_IMMEDIATE_BEANINFO} will let it use all
* explicit BeanInfo classes for the beans superclasses
@@ -232,17 +232,17 @@ public class Introspector {
* {@link BeanInfo.getEventSetDescriptors} and
* {@link BeanInfo.getPropertyDescriptors}.)
* </p>
- *
+ *
* <p>When the method is called with <code>flag</code< set to
* {@link #IGNORE_ALL_BEANINFO} all the bean data is retrieved
* by inspecting the class.</p>
- *
+ *
* <p>Note: Any unknown value for <code>flag</code> is interpreted
* as {@link #IGNORE_ALL_BEANINFO}</p>.
- *
+ *
* @param beanClass The class whose BeanInfo should be returned.
* @param flag Controls the usage of explicit <code>BeanInfo</code> classes.
- * @return A BeanInfo object describing the class.
+ * @return A BeanInfo object describing the class.
* @throws IntrospectionException If something goes wrong while retrieving
* the bean data.
*/
@@ -251,7 +251,7 @@ public class Introspector {
{
IntrospectionIncubator ii;
BeanInfoEmbryo infoEmbryo;
-
+
switch(flag)
{
case USE_ALL_BEANINFO:
@@ -259,24 +259,24 @@ public class Introspector {
case IGNORE_IMMEDIATE_BEANINFO:
Class superclass = beanClass.getSuperclass();
ExplicitInfo explicit = new ExplicitInfo(superclass, null);
-
+
ii = new IntrospectionIncubator();
if (explicit.explicitEventSetDescriptors != null)
ii.setEventStopClass(superclass);
-
+
if (explicit.explicitMethodDescriptors != null)
ii.setMethodStopClass(superclass);
-
+
if (explicit.explicitPropertyDescriptors != null)
ii.setPropertyStopClass(superclass);
-
+
ii.addMethods(beanClass.getMethods());
infoEmbryo = ii.getBeanInfoEmbryo();
merge(infoEmbryo, explicit);
infoEmbryo.setBeanDescriptor(new BeanDescriptor(beanClass, null));
-
+
return infoEmbryo.getBeanInfo();
case IGNORE_ALL_BEANINFO:
default:
@@ -284,7 +284,7 @@ public class Introspector {
ii.addMethods(beanClass.getMethods());
infoEmbryo = ii.getBeanInfoEmbryo();
infoEmbryo.setBeanDescriptor(new BeanDescriptor(beanClass, null));
-
+
return infoEmbryo.getBeanInfo();
}
}
@@ -298,11 +298,11 @@ public class Introspector {
{
beanInfoCache.clear();
- // Clears all the intermediate ExplicitInfo instances which
- // have been created.
- // This makes sure we have to retrieve stuff like BeanDescriptors
- // again. (Remember that FeatureDescriptor can be modified by the user.)
- ExplicitInfo.flushCaches();
+ // Clears all the intermediate ExplicitInfo instances which
+ // have been created.
+ // This makes sure we have to retrieve stuff like BeanDescriptors
+ // again. (Remember that FeatureDescriptor can be modified by the user.)
+ ExplicitInfo.flushCaches();
}
/**
@@ -317,62 +317,62 @@ public class Introspector {
{
synchronized (clz)
{
- beanInfoCache.remove(clz);
+ beanInfoCache.remove(clz);
}
}
/** Adds all explicity given bean info data to the introspected
* data.
- *
+ *
* @param infoEmbryo Bean info data retrieved by introspection.
* @param explicit Bean info data retrieved by BeanInfo classes.
*/
private static void merge(BeanInfoEmbryo infoEmbryo, ExplicitInfo explicit)
{
PropertyDescriptor[] p = explicit.explicitPropertyDescriptors;
- if(p!=null)
+ if(p!=null)
{
- for(int i=0;i<p.length;i++)
+ for(int i=0;i<p.length;i++)
{
- if(!infoEmbryo.hasProperty(p[i]))
+ if(!infoEmbryo.hasProperty(p[i]))
{
infoEmbryo.addProperty(p[i]);
}
}
-
+
// -1 should be used to denote a missing default property but
// for robustness reasons any value below zero is discarded.
// Not doing so would let Classpath fail where the JDK succeeds.
- if(explicit.defaultProperty > -1)
+ if(explicit.defaultProperty > -1)
{
infoEmbryo.setDefaultPropertyName(p[explicit.defaultProperty].getName());
}
}
EventSetDescriptor[] e = explicit.explicitEventSetDescriptors;
- if(e!=null)
+ if(e!=null)
{
- for(int i=0;i<e.length;i++)
+ for(int i=0;i<e.length;i++)
{
- if(!infoEmbryo.hasEvent(e[i]))
+ if(!infoEmbryo.hasEvent(e[i]))
{
infoEmbryo.addEvent(e[i]);
}
}
-
+
// -1 should be used to denote a missing default event but
// for robustness reasons any value below zero is discarded.
// Not doing so would let Classpath fail where the JDK succeeds.
- if(explicit.defaultEvent > -1)
+ if(explicit.defaultEvent > -1)
{
infoEmbryo.setDefaultEventName(e[explicit.defaultEvent].getName());
}
}
MethodDescriptor[] m = explicit.explicitMethodDescriptors;
- if(m!=null)
+ if(m!=null)
{
- for(int i=0;i<m.length;i++)
+ for(int i=0;i<m.length;i++)
{
- if(!infoEmbryo.hasMethod(m[i]))
+ if(!infoEmbryo.hasMethod(m[i]))
{
infoEmbryo.addMethod(m[i]);
}
@@ -381,10 +381,10 @@ public class Introspector {
infoEmbryo.setAdditionalBeanInfo(explicit.explicitBeanInfo);
infoEmbryo.setIcons(explicit.im);
-
+
}
-
- /**
+
+ /**
* Get the BeanInfo for class <CODE>beanClass</CODE>,
* first by looking for explicit information, next by
* using standard design patterns to determine
@@ -395,8 +395,8 @@ public class Introspector {
* @param stopClass the class to stop at.
* @return the BeanInfo object representing the class.
*/
- public static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass)
- throws IntrospectionException
+ public static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass)
+ throws IntrospectionException
{
ExplicitInfo explicit = new ExplicitInfo(beanClass, stopClass);
@@ -405,11 +405,11 @@ public class Introspector {
ii.setEventStopClass(explicit.eventStopClass);
ii.setMethodStopClass(explicit.methodStopClass);
ii.addMethods(beanClass.getMethods());
-
+
BeanInfoEmbryo currentInfo = ii.getBeanInfoEmbryo();
-
+
merge(currentInfo, explicit);
-
+
// Sets the info's BeanDescriptor to the one we extracted from the
// explicit BeanInfo instance(s) if they contained one. Otherwise we
// create the BeanDescriptor from scratch.
@@ -417,33 +417,33 @@ public class Introspector {
// the user to modify the instance while it is cached. However this is how
// the RI does it.
currentInfo.setBeanDescriptor(
- (explicit.explicitBeanDescriptor == null ?
+ (explicit.explicitBeanDescriptor == null ?
new BeanDescriptor(beanClass, null) :
- explicit.explicitBeanDescriptor));
+ explicit.explicitBeanDescriptor));
return currentInfo.getBeanInfo();
}
-
- /**
+
+ /**
* Get the search path for BeanInfo classes.
*
* @return the BeanInfo search path.
*/
- public static String[] getBeanInfoSearchPath()
+ public static String[] getBeanInfoSearchPath()
{
return beanInfoSearchPath;
}
-
- /**
+
+ /**
* Set the search path for BeanInfo classes.
* @param beanInfoSearchPath the new BeanInfo search
* path.
*/
- public static void setBeanInfoSearchPath(String[] beanInfoSearchPath)
+ public static void setBeanInfoSearchPath(String[] beanInfoSearchPath)
{
Introspector.beanInfoSearchPath = beanInfoSearchPath;
}
-
- /**
+
+ /**
* A helper method to convert a name to standard Java
* naming conventions: anything with two capitals as the
* first two letters remains the same, otherwise the
@@ -453,80 +453,80 @@ public class Introspector {
* @param name the name to decapitalize.
* @return the decapitalized name.
*/
- public static String decapitalize(String name)
+ public static String decapitalize(String name)
{
- try
+ try
{
- if(!Character.isUpperCase(name.charAt(0)))
- {
- return name;
- }
- else
- {
- try
- {
- if(Character.isUpperCase(name.charAt(1)))
- {
- return name;
- }
- else
- {
- char[] c = name.toCharArray();
- c[0] = Character.toLowerCase(c[0]);
- return new String(c);
- }
- }
- catch(StringIndexOutOfBoundsException E)
- {
- char[] c = new char[1];
- c[0] = Character.toLowerCase(name.charAt(0));
- return new String(c);
- }
- }
- }
- catch(StringIndexOutOfBoundsException E)
+ if(!Character.isUpperCase(name.charAt(0)))
+ {
+ return name;
+ }
+ else
+ {
+ try
+ {
+ if(Character.isUpperCase(name.charAt(1)))
+ {
+ return name;
+ }
+ else
+ {
+ char[] c = name.toCharArray();
+ c[0] = Character.toLowerCase(c[0]);
+ return new String(c);
+ }
+ }
+ catch(StringIndexOutOfBoundsException E)
+ {
+ char[] c = new char[1];
+ c[0] = Character.toLowerCase(name.charAt(0));
+ return new String(c);
+ }
+ }
+ }
+ catch(StringIndexOutOfBoundsException E)
{
- return name;
- }
- catch(NullPointerException E)
+ return name;
+ }
+ catch(NullPointerException E)
{
- return null;
+ return null;
}
}
- static BeanInfo copyBeanInfo(BeanInfo b)
+ static BeanInfo copyBeanInfo(BeanInfo b)
{
java.awt.Image[] icons = new java.awt.Image[4];
- for(int i=1;i<=4;i++)
+ for(int i=1;i<=4;i++)
{
- icons[i-1] = b.getIcon(i);
+ icons[i-1] = b.getIcon(i);
}
return new ExplicitBeanInfo(b.getBeanDescriptor(),
- b.getAdditionalBeanInfo(),
- b.getPropertyDescriptors(),
- b.getDefaultPropertyIndex(),
- b.getEventSetDescriptors(),
- b.getDefaultEventIndex(),
- b.getMethodDescriptors(),
- icons);
+ b.getAdditionalBeanInfo(),
+ b.getPropertyDescriptors(),
+ b.getDefaultPropertyIndex(),
+ b.getEventSetDescriptors(),
+ b.getDefaultEventIndex(),
+ b.getMethodDescriptors(),
+ icons);
}
}
-class ExplicitInfo
+class ExplicitInfo
{
BeanDescriptor explicitBeanDescriptor;
BeanInfo[] explicitBeanInfo;
-
+
PropertyDescriptor[] explicitPropertyDescriptors;
EventSetDescriptor[] explicitEventSetDescriptors;
MethodDescriptor[] explicitMethodDescriptors;
-
+
int defaultProperty;
int defaultEvent;
-
+
java.awt.Image[] im = new java.awt.Image[4];
-
+
Class propertyStopClass;
Class eventStopClass;
Class methodStopClass;
@@ -534,119 +534,119 @@ class ExplicitInfo
static Hashtable explicitBeanInfos = new Hashtable();
static Vector emptyBeanInfos = new Vector();
- ExplicitInfo(Class beanClass, Class stopClass)
+ ExplicitInfo(Class beanClass, Class stopClass)
{
- while(beanClass != null && !beanClass.equals(stopClass))
+ while(beanClass != null && !beanClass.equals(stopClass))
{
- BeanInfo explicit = findExplicitBeanInfo(beanClass);
-
-
- if(explicit != null)
- {
-
- if(explicitBeanDescriptor == null)
- {
- explicitBeanDescriptor = explicit.getBeanDescriptor();
- }
-
- if(explicitBeanInfo == null)
- {
- explicitBeanInfo = explicit.getAdditionalBeanInfo();
- }
-
- if(explicitPropertyDescriptors == null)
- {
- if(explicit.getPropertyDescriptors() != null)
- {
- explicitPropertyDescriptors = explicit.getPropertyDescriptors();
- defaultProperty = explicit.getDefaultPropertyIndex();
- propertyStopClass = beanClass;
- }
- }
-
- if(explicitEventSetDescriptors == null)
- {
- if(explicit.getEventSetDescriptors() != null)
- {
- explicitEventSetDescriptors = explicit.getEventSetDescriptors();
- defaultEvent = explicit.getDefaultEventIndex();
- eventStopClass = beanClass;
- }
- }
-
- if(explicitMethodDescriptors == null)
- {
- if(explicit.getMethodDescriptors() != null)
- {
- explicitMethodDescriptors = explicit.getMethodDescriptors();
- methodStopClass = beanClass;
- }
- }
-
- if(im[0] == null && im[1] == null
- && im[2] == null && im[3] == null)
- {
- im[0] = explicit.getIcon(0);
- im[1] = explicit.getIcon(1);
- im[2] = explicit.getIcon(2);
- im[3] = explicit.getIcon(3);
- }
- }
- beanClass = beanClass.getSuperclass();
+ BeanInfo explicit = findExplicitBeanInfo(beanClass);
+
+
+ if(explicit != null)
+ {
+
+ if(explicitBeanDescriptor == null)
+ {
+ explicitBeanDescriptor = explicit.getBeanDescriptor();
+ }
+
+ if(explicitBeanInfo == null)
+ {
+ explicitBeanInfo = explicit.getAdditionalBeanInfo();
+ }
+
+ if(explicitPropertyDescriptors == null)
+ {
+ if(explicit.getPropertyDescriptors() != null)
+ {
+ explicitPropertyDescriptors = explicit.getPropertyDescriptors();
+ defaultProperty = explicit.getDefaultPropertyIndex();
+ propertyStopClass = beanClass;
+ }
+ }
+
+ if(explicitEventSetDescriptors == null)
+ {
+ if(explicit.getEventSetDescriptors() != null)
+ {
+ explicitEventSetDescriptors = explicit.getEventSetDescriptors();
+ defaultEvent = explicit.getDefaultEventIndex();
+ eventStopClass = beanClass;
+ }
+ }
+
+ if(explicitMethodDescriptors == null)
+ {
+ if(explicit.getMethodDescriptors() != null)
+ {
+ explicitMethodDescriptors = explicit.getMethodDescriptors();
+ methodStopClass = beanClass;
+ }
+ }
+
+ if(im[0] == null && im[1] == null
+ && im[2] == null && im[3] == null)
+ {
+ im[0] = explicit.getIcon(0);
+ im[1] = explicit.getIcon(1);
+ im[2] = explicit.getIcon(2);
+ im[3] = explicit.getIcon(3);
+ }
+ }
+ beanClass = beanClass.getSuperclass();
}
- if(propertyStopClass == null)
+ if(propertyStopClass == null)
{
- propertyStopClass = stopClass;
+ propertyStopClass = stopClass;
}
- if(eventStopClass == null)
+ if(eventStopClass == null)
{
- eventStopClass = stopClass;
+ eventStopClass = stopClass;
}
- if(methodStopClass == null)
+ if(methodStopClass == null)
{
- methodStopClass = stopClass;
+ methodStopClass = stopClass;
}
}
-
+
/** Throws away all cached data and makes sure we re-instantiate things
* like BeanDescriptors again.
*/
static void flushCaches() {
- explicitBeanInfos.clear();
- emptyBeanInfos.clear();
+ explicitBeanInfos.clear();
+ emptyBeanInfos.clear();
}
-
- static BeanInfo findExplicitBeanInfo(Class beanClass)
+
+ static BeanInfo findExplicitBeanInfo(Class beanClass)
{
BeanInfo retval = (BeanInfo)explicitBeanInfos.get(beanClass);
- if(retval != null)
+ if(retval != null)
{
- return retval;
- }
- else if(emptyBeanInfos.indexOf(beanClass) != -1)
+ return retval;
+ }
+ else if(emptyBeanInfos.indexOf(beanClass) != -1)
{
- return null;
- }
- else
+ return null;
+ }
+ else
{
- retval = reallyFindExplicitBeanInfo(beanClass);
- if(retval != null)
- {
- explicitBeanInfos.put(beanClass,retval);
- }
- else
- {
- emptyBeanInfos.addElement(beanClass);
- }
- return retval;
+ retval = reallyFindExplicitBeanInfo(beanClass);
+ if(retval != null)
+ {
+ explicitBeanInfos.put(beanClass,retval);
+ }
+ else
+ {
+ emptyBeanInfos.addElement(beanClass);
+ }
+ return retval;
}
}
-
- static BeanInfo reallyFindExplicitBeanInfo(Class beanClass)
+
+ static BeanInfo reallyFindExplicitBeanInfo(Class beanClass)
{
ClassLoader beanClassLoader = beanClass.getClassLoader();
BeanInfo beanInfo;
@@ -654,25 +654,25 @@ class ExplicitInfo
beanInfo = getBeanInfo(beanClassLoader, beanClass.getName() + "BeanInfo");
if (beanInfo == null)
{
- String newName;
- newName = ClassHelper.getTruncatedClassName(beanClass) + "BeanInfo";
-
- for(int i = 0; i < Introspector.beanInfoSearchPath.length; i++)
- {
- if (Introspector.beanInfoSearchPath[i].equals(""))
- beanInfo = getBeanInfo(beanClassLoader, newName);
- else
- beanInfo = getBeanInfo(beanClassLoader,
- Introspector.beanInfoSearchPath[i] + "."
- + newName);
-
- // Returns the beanInfo if it exists and the described class matches
- // the one we searched.
- if (beanInfo != null && beanInfo.getBeanDescriptor() != null &&
- beanInfo.getBeanDescriptor().getBeanClass() == beanClass)
-
- return beanInfo;
- }
+ String newName;
+ newName = ClassHelper.getTruncatedClassName(beanClass) + "BeanInfo";
+
+ for(int i = 0; i < Introspector.beanInfoSearchPath.length; i++)
+ {
+ if (Introspector.beanInfoSearchPath[i].equals(""))
+ beanInfo = getBeanInfo(beanClassLoader, newName);
+ else
+ beanInfo = getBeanInfo(beanClassLoader,
+ Introspector.beanInfoSearchPath[i] + "."
+ + newName);
+
+ // Returns the beanInfo if it exists and the described class matches
+ // the one we searched.
+ if (beanInfo != null && beanInfo.getBeanDescriptor() != null &&
+ beanInfo.getBeanDescriptor().getBeanClass() == beanClass)
+
+ return beanInfo;
+ }
}
return beanInfo;
@@ -686,20 +686,20 @@ class ExplicitInfo
{
try
{
- return (BeanInfo) Class.forName(infoName, true, cl).newInstance();
+ return (BeanInfo) Class.forName(infoName, true, cl).newInstance();
}
catch (ClassNotFoundException cnfe)
{
- return null;
+ return null;
}
catch (IllegalAccessException iae)
{
- return null;
+ return null;
}
catch (InstantiationException ie)
{
- return null;
+ return null;
}
}
-
+
}
diff --git a/java/beans/MethodDescriptor.java b/java/beans/MethodDescriptor.java
index 123dba60c..0185fde81 100644
--- a/java/beans/MethodDescriptor.java
+++ b/java/beans/MethodDescriptor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,40 +49,39 @@ import java.lang.reflect.Method;
** @version 1.1.0, 26 Jul 1998
**/
public class MethodDescriptor extends FeatureDescriptor {
- private Method m;
- private ParameterDescriptor[] parameterDescriptors;
+ private Method m;
+ private ParameterDescriptor[] parameterDescriptors;
- /** Create a new MethodDescriptor.
- ** This method sets the name to the name of the method (Method.getName()).
- ** @param m the method it will represent.
- **/
- public MethodDescriptor(Method m) {
- setName(m.getName());
- this.m = m;
- }
+ /** Create a new MethodDescriptor.
+ ** This method sets the name to the name of the method (Method.getName()).
+ ** @param m the method it will represent.
+ **/
+ public MethodDescriptor(Method m) {
+ setName(m.getName());
+ this.m = m;
+ }
- /** Create a new MethodDescriptor.
- ** This method sets the name to the name of the method (Method.getName()).
- ** @param m the method it will represent.
- ** @param parameterDescriptors descriptions of the parameters (especially names).
- **/
- public MethodDescriptor(Method m, ParameterDescriptor[] parameterDescriptors) {
- setName(m.getName());
- this.m = m;
- this.parameterDescriptors = parameterDescriptors;
- }
+ /** Create a new MethodDescriptor.
+ ** This method sets the name to the name of the method (Method.getName()).
+ ** @param m the method it will represent.
+ ** @param parameterDescriptors descriptions of the parameters (especially names).
+ **/
+ public MethodDescriptor(Method m, ParameterDescriptor[] parameterDescriptors) {
+ setName(m.getName());
+ this.m = m;
+ this.parameterDescriptors = parameterDescriptors;
+ }
- /** Get the parameter descriptors from this method.
- ** Since MethodDescriptor has no way of determining what
- ** the parameter names were, this defaults to null.
- **/
- public ParameterDescriptor[] getParameterDescriptors() {
- return parameterDescriptors;
- }
+ /** Get the parameter descriptors from this method.
+ ** Since MethodDescriptor has no way of determining what
+ ** the parameter names were, this defaults to null.
+ **/
+ public ParameterDescriptor[] getParameterDescriptors() {
+ return parameterDescriptors;
+ }
- /** Get the method this MethodDescriptor represents. **/
- public Method getMethod() {
- return m;
- }
+ /** Get the method this MethodDescriptor represents. **/
+ public Method getMethod() {
+ return m;
+ }
}
-
diff --git a/java/beans/ParameterDescriptor.java b/java/beans/ParameterDescriptor.java
index 8ea93a9bd..148690066 100644
--- a/java/beans/ParameterDescriptor.java
+++ b/java/beans/ParameterDescriptor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -48,5 +48,5 @@ package java.beans;
** @version 1.1.0, 26 Jul 1998
**/
public class ParameterDescriptor extends FeatureDescriptor {
-
+
}
diff --git a/java/beans/PersistenceDelegate.java b/java/beans/PersistenceDelegate.java
index a6f715763..d4e777844 100644
--- a/java/beans/PersistenceDelegate.java
+++ b/java/beans/PersistenceDelegate.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,12 +40,12 @@ package java.beans;
/** <p>A <code>PersistenceDelegate</code> describes how a another object
* has to constructed and transformed in order to create a complete
* replicate.</p>
- *
+ *
* <p>For custom classes you will need to implement
* <code>PersistenceDelegate</code> in a way that is suitable for them.
* To make use of the implementation you have to register it with an
* {@link Encoder} using the {Encoder#setPersistenceDelegate} method.</p>
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
* @since 1.4
*/
@@ -60,7 +60,7 @@ public abstract class PersistenceDelegate
type = type.getSuperclass();
PersistenceDelegate pd = out.getPersistenceDelegate(type);
-
+
pd.initialize(type, oldInstance, newInstance, out);
}
}
diff --git a/java/beans/PropertyChangeSupport.java b/java/beans/PropertyChangeSupport.java
index ecadb146f..3f3f53d42 100644
--- a/java/beans/PropertyChangeSupport.java
+++ b/java/beans/PropertyChangeSupport.java
@@ -404,7 +404,7 @@ public class PropertyChangeSupport implements Serializable
/**
* Fire an indexed property change event. This will only fire
- * an event if the old and new values are not equal and not null.
+ * an event if the old and new values are not equal and not null.
* @param name the name of the property which changed
* @param index the index of the property which changed
* @param oldValue the old value of the property
diff --git a/java/beans/PropertyDescriptor.java b/java/beans/PropertyDescriptor.java
index 4b586d915..a74fa7b13 100644
--- a/java/beans/PropertyDescriptor.java
+++ b/java/beans/PropertyDescriptor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -100,7 +100,7 @@ public class PropertyDescriptor extends FeatureDescriptor
** starting with a lowercase letter (e.g. fooManChu
** instead of FooManChu).
** @param beanClass the class the get and set methods live in.
- ** @exception IntrospectionException if the methods are not found
+ ** @exception IntrospectionException if the methods are not found
** or invalid.
**/
public PropertyDescriptor(String name, Class<?> beanClass)
@@ -126,7 +126,7 @@ public class PropertyDescriptor extends FeatureDescriptor
"Cannot find a " + caps + " method");
}
- // finally check the methods compatibility
+ // finally check the methods compatibility
propertyType = checkMethods(getMethod, setMethod);
}
@@ -154,7 +154,7 @@ public class PropertyDescriptor extends FeatureDescriptor
** @param beanClass the class the get and set methods live in.
** @param getMethodName the name of the get method or <code>null</code> if the property is write-only.
** @param setMethodName the name of the set method or <code>null</code> if the property is read-only.
- ** @exception IntrospectionException if the methods are not found
+ ** @exception IntrospectionException if the methods are not found
** or invalid.
**/
public PropertyDescriptor(
@@ -188,13 +188,13 @@ public class PropertyDescriptor extends FeatureDescriptor
**<br>
** It is possible to call this method with both <code>Method</code> arguments
** being <code>null</code>. In such a case the property type is <code>null</code>.
- **
+ **
** @param name the programmatic name of the property, usually
** starting with a lowercase letter (e.g. fooManChu
** instead of FooManChu).
** @param readMethod the read method or <code>null</code> if the property is write-only.
** @param writeMethod the write method or <code>null</code> if the property is read-only.
- ** @exception IntrospectionException if the methods are not found
+ ** @exception IntrospectionException if the methods are not found
** or invalid.
**/
public PropertyDescriptor(
@@ -234,7 +234,7 @@ public class PropertyDescriptor extends FeatureDescriptor
* <br/>
* It is legal to set the read and the write method to <code>null</code>
* or provide method which have been declared in distinct classes.
- *
+ *
* @param readMethod The new method to be used or <code>null</code>.
* @throws IntrospectionException If the given method is invalid.
* @since 1.2
@@ -262,7 +262,7 @@ public class PropertyDescriptor extends FeatureDescriptor
* <br/>
* It is legal to set the read and the write method to <code>null</code>
* or provide method which have been declared in distinct classes.
- *
+ *
* @param writeMethod The new method to be used or <code>null</code>.
* @throws IntrospectionException If the given method is invalid.
* @since 1.2
@@ -338,7 +338,7 @@ public class PropertyDescriptor extends FeatureDescriptor
/** Set the PropertyEditor class. If the class does not implement
** the PropertyEditor interface, you will likely get an exception
** late in the game.
- ** @param propertyEditorClass the PropertyEditor class for this
+ ** @param propertyEditorClass the PropertyEditor class for this
** class to use.
**/
public void setPropertyEditorClass(Class<?> propertyEditorClass)
@@ -510,7 +510,7 @@ public class PropertyDescriptor extends FeatureDescriptor
* <br/>
* For compatibility this has to be noted:<br/>
* The two methods are allowed to be defined in two distinct classes and may both be null.
- *
+ *
* @param readMethod The new read method to check.
* @param writeMethod The new write method to check.
* @return The common property type of the two method.
@@ -566,7 +566,7 @@ public class PropertyDescriptor extends FeatureDescriptor
}
/* note: the check whether both method are defined in related classes makes sense but is not
- * done in the JDK.
+ * done in the JDK.
* I leave this code here in case someone at Sun decides to add that functionality in later versions (rschuster)
if ((!readMethod
.getDeclaringClass()
@@ -659,7 +659,7 @@ public class PropertyDescriptor extends FeatureDescriptor
{
return false;
}
-
+
}
}
diff --git a/java/beans/PropertyEditor.java b/java/beans/PropertyEditor.java
index d1c510341..5fba014ea 100644
--- a/java/beans/PropertyEditor.java
+++ b/java/beans/PropertyEditor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -109,101 +109,101 @@ package java.beans;
**/
public interface PropertyEditor {
- /** Called by the RAD tool to set the value of this property for the PropertyEditor.
- ** If the property type is native, it should be wrapped in the appropriate
- ** wrapper type.
- ** @param value the value to set this property to.
- **/
- void setValue(Object value);
-
- /** Accessor method to get the current value the PropertyEditor is working with.
- ** If the property type is native, it will be wrapped in the appropriate
- ** wrapper type.
- ** @return the current value of the PropertyEditor.
- **/
- Object getValue();
-
-
- /** Set the value of this property using a String.
- ** Whether or not this PropertyEditor is editing a String type, this converts
- ** the String into the type of the PropertyEditor.
- ** @param text the text to set it to.
- ** @exception IllegalArgumentException if the String is in the wrong format or setAsText() is not supported.
- **/
- void setAsText(String text) throws IllegalArgumentException;
-
- /** Get the value of this property in String format.
- ** Many times this can simply use Object.toString().<P>
- ** Return null if you do not support getAsText()/setAsText().
- ** <code>setAsText(getAsText())</code> should be valid; i.e. the stuff you spit out in
- ** getAsText() should be able to go into setAsText().
- ** @return the value of this property in String format.
- **/
- String getAsText();
-
- /** Get a list of possible Strings which this property type can have.
- ** The value of these will be used by the RAD tool to construct some sort
- ** of list box or to check text box input, and the resulting String passed
- ** to setAsText() should be one of these. Note, however, that like most things
- ** with this mammoth, unwieldy interface, this is not guaranteed. Thus, you
- ** must check the value in setAsText() anyway.
- ** @return the list of possible String values for this property type.
- **/
- String[] getTags();
-
-
- /** The RAD tool calls this to find out whether the PropertyEditor can paint itself.
- ** @return true if it can paint itself graphically, false if it cannot.
- **/
- boolean isPaintable();
-
- /** The RAD tool calls this to paint the actual value of the property.
- ** The Graphics context will have the same current font, color, etc. as the
- ** parent Container. You may safely change the font, color, etc. and not
- ** change them back.<P>
- ** This method should do a silent no-op if isPaintable() is false.
- ** @param g the Graphics context to paint on
- ** @param bounds the rectangle you have reserved to work in
- **/
- void paintValue(java.awt.Graphics g, java.awt.Rectangle bounds);
-
-
- /** The RAD tool calls this to find out whether the PropertyEditor supports a custom component to edit and display itself.
- ** @return true if getCustomEditor() will return a component, false if not.
- **/
- boolean supportsCustomEditor();
-
- /** The RAD tool calls this to grab the component that can edit this type.
- ** The component may be painted anywhere the RAD tool wants to paint it--
- ** even in its own window.<P>
- ** The component must hook up with the PropertyEditor and, whenever a
- ** change to the value is made, fire a PropertyChangeEvent to the source.<P>
- ** @return the custom editor for this property type.
- **/
- java.awt.Component getCustomEditor();
-
-
- /** Adds a property change listener to this PropertyEditor.
- ** @param listener the listener to add
- **/
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- /** Removes a property change listener from this PropertyEditor.
- ** @param listener the listener to remove
- **/
- void removePropertyChangeListener(PropertyChangeListener listener);
-
- /** Get a Java language-specific String which could be used to create an Object
- ** of the specified type. Every PropertyEditor must support this.<P>
- ** The reason for this is that while most RAD tools will serialize the Beans
- ** and deserialize them at runtime, some RAD tools will generate code that
- ** creates the Beans. Examples of Java initialization strings would be:<P>
- ** <OL>
- ** <LI><CODE>2</CODE></LI>
- ** <LI><CODE>"I am a String"</CODE></LI>
- ** <LI><CODE>new MyObject(2, "String", new StringBuffer())</CODE></LI>
- ** </OL>
- ** @return the initialization string for this object in Java.
- **/
- String getJavaInitializationString();
+ /** Called by the RAD tool to set the value of this property for the PropertyEditor.
+ ** If the property type is native, it should be wrapped in the appropriate
+ ** wrapper type.
+ ** @param value the value to set this property to.
+ **/
+ void setValue(Object value);
+
+ /** Accessor method to get the current value the PropertyEditor is working with.
+ ** If the property type is native, it will be wrapped in the appropriate
+ ** wrapper type.
+ ** @return the current value of the PropertyEditor.
+ **/
+ Object getValue();
+
+
+ /** Set the value of this property using a String.
+ ** Whether or not this PropertyEditor is editing a String type, this converts
+ ** the String into the type of the PropertyEditor.
+ ** @param text the text to set it to.
+ ** @exception IllegalArgumentException if the String is in the wrong format or setAsText() is not supported.
+ **/
+ void setAsText(String text) throws IllegalArgumentException;
+
+ /** Get the value of this property in String format.
+ ** Many times this can simply use Object.toString().<P>
+ ** Return null if you do not support getAsText()/setAsText().
+ ** <code>setAsText(getAsText())</code> should be valid; i.e. the stuff you spit out in
+ ** getAsText() should be able to go into setAsText().
+ ** @return the value of this property in String format.
+ **/
+ String getAsText();
+
+ /** Get a list of possible Strings which this property type can have.
+ ** The value of these will be used by the RAD tool to construct some sort
+ ** of list box or to check text box input, and the resulting String passed
+ ** to setAsText() should be one of these. Note, however, that like most things
+ ** with this mammoth, unwieldy interface, this is not guaranteed. Thus, you
+ ** must check the value in setAsText() anyway.
+ ** @return the list of possible String values for this property type.
+ **/
+ String[] getTags();
+
+
+ /** The RAD tool calls this to find out whether the PropertyEditor can paint itself.
+ ** @return true if it can paint itself graphically, false if it cannot.
+ **/
+ boolean isPaintable();
+
+ /** The RAD tool calls this to paint the actual value of the property.
+ ** The Graphics context will have the same current font, color, etc. as the
+ ** parent Container. You may safely change the font, color, etc. and not
+ ** change them back.<P>
+ ** This method should do a silent no-op if isPaintable() is false.
+ ** @param g the Graphics context to paint on
+ ** @param bounds the rectangle you have reserved to work in
+ **/
+ void paintValue(java.awt.Graphics g, java.awt.Rectangle bounds);
+
+
+ /** The RAD tool calls this to find out whether the PropertyEditor supports a custom component to edit and display itself.
+ ** @return true if getCustomEditor() will return a component, false if not.
+ **/
+ boolean supportsCustomEditor();
+
+ /** The RAD tool calls this to grab the component that can edit this type.
+ ** The component may be painted anywhere the RAD tool wants to paint it--
+ ** even in its own window.<P>
+ ** The component must hook up with the PropertyEditor and, whenever a
+ ** change to the value is made, fire a PropertyChangeEvent to the source.<P>
+ ** @return the custom editor for this property type.
+ **/
+ java.awt.Component getCustomEditor();
+
+
+ /** Adds a property change listener to this PropertyEditor.
+ ** @param listener the listener to add
+ **/
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ /** Removes a property change listener from this PropertyEditor.
+ ** @param listener the listener to remove
+ **/
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ /** Get a Java language-specific String which could be used to create an Object
+ ** of the specified type. Every PropertyEditor must support this.<P>
+ ** The reason for this is that while most RAD tools will serialize the Beans
+ ** and deserialize them at runtime, some RAD tools will generate code that
+ ** creates the Beans. Examples of Java initialization strings would be:<P>
+ ** <OL>
+ ** <LI><CODE>2</CODE></LI>
+ ** <LI><CODE>"I am a String"</CODE></LI>
+ ** <LI><CODE>new MyObject(2, "String", new StringBuffer())</CODE></LI>
+ ** </OL>
+ ** @return the initialization string for this object in Java.
+ **/
+ String getJavaInitializationString();
}
diff --git a/java/beans/PropertyEditorManager.java b/java/beans/PropertyEditorManager.java
index 0dd3b176d..253ddafe1 100644
--- a/java/beans/PropertyEditorManager.java
+++ b/java/beans/PropertyEditorManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -64,7 +64,7 @@ import java.awt.Font;
* package and then in the property editor search path.
*
* <p>Default property editors are provided for:</p>
- *
+ *
* <ol>
* <li>boolean, byte, short, int, long, float, and double</li>
* <li>java.lang.String</li>
@@ -143,13 +143,13 @@ public class PropertyEditorManager
return (PropertyEditor)found.newInstance();
}
- ClassLoader contextClassLoader
- = Thread.currentThread().getContextClassLoader();
+ ClassLoader contextClassLoader
+ = Thread.currentThread().getContextClassLoader();
try
{
found = Class.forName(editedClass.getName()+"Editor", true,
- contextClassLoader);
+ contextClassLoader);
registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance();
}
@@ -158,9 +158,9 @@ public class PropertyEditorManager
}
String appendName
- = "."
- + ClassHelper.getTruncatedClassName(editedClass)
- + "Editor";
+ = "."
+ + ClassHelper.getTruncatedClassName(editedClass)
+ + "Editor";
synchronized(editorSearchPath)
{
for(int i=0;i<editorSearchPath.length;i++)
@@ -168,7 +168,7 @@ public class PropertyEditorManager
try
{
found = Class.forName(editorSearchPath[i] + appendName,
- true, contextClassLoader);
+ true, contextClassLoader);
registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance();
}
@@ -184,7 +184,7 @@ public class PropertyEditorManager
catch(IllegalAccessException E)
{
}
-
+
return null;
}
diff --git a/java/beans/SimpleBeanInfo.java b/java/beans/SimpleBeanInfo.java
index 56b1f7aa7..d5216caf5 100644
--- a/java/beans/SimpleBeanInfo.java
+++ b/java/beans/SimpleBeanInfo.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -65,75 +65,75 @@ import java.net.URL;
**/
public class SimpleBeanInfo implements BeanInfo {
- /** Force Introspection of the general bean info.
- ** @return <CODE>null</CODE>.
- **/
- public BeanDescriptor getBeanDescriptor() {
- return null;
- }
-
- /** Force Introspection of the events this Bean type
- ** fires.
- ** @return <CODE>null</CODE>
- **/
- public EventSetDescriptor[] getEventSetDescriptors() {
- return null;
- }
-
- /** Say that there is no "default" event set.
- ** @return <CODE>-1</CODE>.
- **/
- public int getDefaultEventIndex() {
- return -1;
- }
-
- /** Force Introspection of the Bean properties.
- ** @return <CODE>null</CODE>.
- **/
- public PropertyDescriptor[] getPropertyDescriptors() {
- return null;
- }
-
- /** Say that there is no "default" property.
- ** @return <CODE>-1</CODE>.
- **/
- public int getDefaultPropertyIndex() {
- return -1;
- }
-
- /** Force Introspection of the Bean's methods.
- ** @return <CODE>null</CODE>.
- **/
- public MethodDescriptor[] getMethodDescriptors() {
- return null;
- }
-
- /** Tell the Introspector to go look for other BeanInfo
- ** itself.
- ** @return <CODE>null</CODE>.
- **/
- public BeanInfo[] getAdditionalBeanInfo() {
- return null;
- }
-
- /** Say that this Bean has no icons.
- ** @param iconType the type of icon
- ** @return <CODE>null</CODE>.
- **/
- public Image getIcon(int iconType) {
- return null;
- }
-
- /** Helper method to load an image using the Bean class
- ** getResource() method on the BeanInfo class (using
- ** getClass(), since you'll extend this class to get
- ** the BeanInfo). Basically it's assumed that the Bean
- ** and its BeanInfo are both loaded by the same
- ** ClassLoader, generally a reasonable assumption.
- ** @param location the URL relative
- ** @return the Image in question (possibly <code>null</code>).
- **/
- public Image loadImage(String location)
+ /** Force Introspection of the general bean info.
+ ** @return <CODE>null</CODE>.
+ **/
+ public BeanDescriptor getBeanDescriptor() {
+ return null;
+ }
+
+ /** Force Introspection of the events this Bean type
+ ** fires.
+ ** @return <CODE>null</CODE>
+ **/
+ public EventSetDescriptor[] getEventSetDescriptors() {
+ return null;
+ }
+
+ /** Say that there is no "default" event set.
+ ** @return <CODE>-1</CODE>.
+ **/
+ public int getDefaultEventIndex() {
+ return -1;
+ }
+
+ /** Force Introspection of the Bean properties.
+ ** @return <CODE>null</CODE>.
+ **/
+ public PropertyDescriptor[] getPropertyDescriptors() {
+ return null;
+ }
+
+ /** Say that there is no "default" property.
+ ** @return <CODE>-1</CODE>.
+ **/
+ public int getDefaultPropertyIndex() {
+ return -1;
+ }
+
+ /** Force Introspection of the Bean's methods.
+ ** @return <CODE>null</CODE>.
+ **/
+ public MethodDescriptor[] getMethodDescriptors() {
+ return null;
+ }
+
+ /** Tell the Introspector to go look for other BeanInfo
+ ** itself.
+ ** @return <CODE>null</CODE>.
+ **/
+ public BeanInfo[] getAdditionalBeanInfo() {
+ return null;
+ }
+
+ /** Say that this Bean has no icons.
+ ** @param iconType the type of icon
+ ** @return <CODE>null</CODE>.
+ **/
+ public Image getIcon(int iconType) {
+ return null;
+ }
+
+ /** Helper method to load an image using the Bean class
+ ** getResource() method on the BeanInfo class (using
+ ** getClass(), since you'll extend this class to get
+ ** the BeanInfo). Basically it's assumed that the Bean
+ ** and its BeanInfo are both loaded by the same
+ ** ClassLoader, generally a reasonable assumption.
+ ** @param location the URL relative
+ ** @return the Image in question (possibly <code>null</code>).
+ **/
+ public Image loadImage(String location)
{
if (location == null)
return null;
@@ -141,6 +141,5 @@ public class SimpleBeanInfo implements BeanInfo {
if (url == null)
return null;
return Toolkit.getDefaultToolkit().getImage(url);
- }
+ }
}
-
diff --git a/java/beans/Statement.java b/java/beans/Statement.java
index 5ecba37c8..d9cd304da 100644
--- a/java/beans/Statement.java
+++ b/java/beans/Statement.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -100,7 +100,7 @@ public class Statement
* <li>Static methods can be executed by providing the class as a
* target.</li>
*
- * <li>The method name new is reserved to call the constructor
+ * <li>The method name new is reserved to call the constructor
* new() will construct an object and return it. Not useful unless
* an expression :-)</li>
*
@@ -123,34 +123,34 @@ public class Statement
* declared in the source file.</p>
*
* @throws Exception if an exception occurs while locating or
- * invoking the method.
+ * invoking the method.
*/
public void execute() throws Exception
{
doExecute();
}
-
- private static Class wrappers[] =
+
+ private static Class wrappers[] =
{
Boolean.class, Byte.class, Character.class, Double.class, Float.class,
Integer.class, Long.class, Short.class
};
- private static Class natives[] =
+ private static Class natives[] =
{
Boolean.TYPE, Byte.TYPE, Character.TYPE, Double.TYPE, Float.TYPE,
Integer.TYPE, Long.TYPE, Short.TYPE
};
/** Given a wrapper class, return the native class for it.
- * <p>For example, if <code>c</code> is <code>Integer</code>,
+ * <p>For example, if <code>c</code> is <code>Integer</code>,
* <code>Integer.TYPE</code> is returned.</p>
*/
private Class unwrap(Class c)
{
for (int i = 0; i < wrappers.length; i++)
if (c == wrappers[i])
- return natives[i];
+ return natives[i];
return null;
}
@@ -168,16 +168,16 @@ public class Statement
// any type.
if (args[i] == null)
continue;
-
+
// Treat Integer like int if appropriate
- Class nativeType = unwrap(args[i]);
- if (nativeType != null && params[i].isPrimitive()
- && params[i].isAssignableFrom(nativeType))
- continue;
- if (params[i].isAssignableFrom(args[i]))
- continue;
-
- return false;
+ Class nativeType = unwrap(args[i]);
+ if (nativeType != null && params[i].isPrimitive()
+ && params[i].isAssignableFrom(nativeType))
+ continue;
+ if (params[i].isAssignableFrom(args[i]))
+ continue;
+
+ return false;
}
return true;
}
@@ -201,9 +201,9 @@ public class Statement
{
for (int j=0; j < first.length; j++)
{
- if (second[j].isAssignableFrom(first[j]))
- continue;
- return false;
+ if (second[j].isAssignableFrom(first[j]))
+ continue;
+ return false;
}
return true;
}
@@ -211,10 +211,10 @@ public class Statement
final Object doExecute() throws Exception
{
Class klazz = (target instanceof Class)
- ? (Class) target : target.getClass();
+ ? (Class) target : target.getClass();
Object args[] = (arguments == null) ? new Object[0] : arguments;
Class argTypes[] = new Class[args.length];
-
+
// Retrieve type or use null if the argument is null. The null argument
// type is later used in compatible().
for (int i = 0; i < args.length; i++)
@@ -222,18 +222,18 @@ public class Statement
if (target.getClass().isArray())
{
- // FIXME: invoke may have to be used. For now, cast to Number
- // and hope for the best. If caller didn't behave, we go boom
- // and throw the exception.
- if (methodName.equals("get") && argTypes.length == 1)
- return Array.get(target, ((Number)args[0]).intValue());
- if (methodName.equals("set") && argTypes.length == 2)
- {
- Object obj = Array.get(target, ((Number)args[0]).intValue());
- Array.set(target, ((Number)args[0]).intValue(), args[1]);
- return obj;
- }
- throw new NoSuchMethodException("No matching method for statement " + toString());
+ // FIXME: invoke may have to be used. For now, cast to Number
+ // and hope for the best. If caller didn't behave, we go boom
+ // and throw the exception.
+ if (methodName.equals("get") && argTypes.length == 1)
+ return Array.get(target, ((Number)args[0]).intValue());
+ if (methodName.equals("set") && argTypes.length == 2)
+ {
+ Object obj = Array.get(target, ((Number)args[0]).intValue());
+ Array.set(target, ((Number)args[0]).intValue(), args[1]);
+ return obj;
+ }
+ throw new NoSuchMethodException("No matching method for statement " + toString());
}
// If we already cached the method, just use it.
@@ -253,62 +253,62 @@ public class Statement
if (methodName.equals("new") && target instanceof Class)
{
- Constructor ctors[] = klazz.getConstructors();
- for (int i = 0; i < ctors.length; i++)
- {
- // Skip methods with wrong number of args.
- Class ptypes[] = ctors[i].getParameterTypes();
-
- if (ptypes.length != args.length)
- continue;
-
- // Check if method matches
- if (!compatible(ptypes, argTypes))
- continue;
-
- // Use method[i] if it is more specific.
- // FIXME: should this check both directions and throw if
- // neither is more specific?
- if (ctor == null)
- {
- ctor = ctors[i];
- continue;
- }
- Class mptypes[] = ctor.getParameterTypes();
- if (moreSpecific(ptypes, mptypes))
- ctor = ctors[i];
- }
- if (ctor == null)
- throw new InstantiationException("No matching constructor for statement " + toString());
- return ctor.newInstance(args);
+ Constructor ctors[] = klazz.getConstructors();
+ for (int i = 0; i < ctors.length; i++)
+ {
+ // Skip methods with wrong number of args.
+ Class ptypes[] = ctors[i].getParameterTypes();
+
+ if (ptypes.length != args.length)
+ continue;
+
+ // Check if method matches
+ if (!compatible(ptypes, argTypes))
+ continue;
+
+ // Use method[i] if it is more specific.
+ // FIXME: should this check both directions and throw if
+ // neither is more specific?
+ if (ctor == null)
+ {
+ ctor = ctors[i];
+ continue;
+ }
+ Class mptypes[] = ctor.getParameterTypes();
+ if (moreSpecific(ptypes, mptypes))
+ ctor = ctors[i];
+ }
+ if (ctor == null)
+ throw new InstantiationException("No matching constructor for statement " + toString());
+ return ctor.newInstance(args);
}
Method methods[] = klazz.getMethods();
for (int i = 0; i < methods.length; i++)
{
- // Skip methods with wrong name or number of args.
- if (!methods[i].getName().equals(methodName))
- continue;
- Class ptypes[] = methods[i].getParameterTypes();
- if (ptypes.length != args.length)
- continue;
-
- // Check if method matches
- if (!compatible(ptypes, argTypes))
- continue;
-
- // Use method[i] if it is more specific.
- // FIXME: should this check both directions and throw if
- // neither is more specific?
- if (method == null)
- {
- method = methods[i];
- continue;
- }
- Class mptypes[] = method.getParameterTypes();
- if (moreSpecific(ptypes, mptypes))
- method = methods[i];
+ // Skip methods with wrong name or number of args.
+ if (!methods[i].getName().equals(methodName))
+ continue;
+ Class ptypes[] = methods[i].getParameterTypes();
+ if (ptypes.length != args.length)
+ continue;
+
+ // Check if method matches
+ if (!compatible(ptypes, argTypes))
+ continue;
+
+ // Use method[i] if it is more specific.
+ // FIXME: should this check both directions and throw if
+ // neither is more specific?
+ if (method == null)
+ {
+ method = methods[i];
+ continue;
+ }
+ Class mptypes[] = method.getParameterTypes();
+ if (moreSpecific(ptypes, mptypes))
+ method = methods[i];
}
if (method == null)
throw new NoSuchMethodException("No matching method for statement " + toString());
@@ -329,7 +329,7 @@ public class Statement
return method.invoke(target, args);
} catch(IllegalArgumentException iae){
System.err.println("method: " + method);
-
+
for(int i=0;i<args.length;i++){
System.err.println("args[" + i + "]: " + args[i]);
}
@@ -337,7 +337,7 @@ public class Statement
}
}
-
+
/** Return the statement arguments. */
public Object[] getArguments() { return arguments; }
@@ -348,19 +348,19 @@ public class Statement
/** Return the statement object. */
public Object getTarget() { return target; }
- /**
- * Returns a string representation of this <code>Statement</code>.
- *
- * @return A string representation of this <code>Statement</code>.
+ /**
+ * Returns a string representation of this <code>Statement</code>.
+ *
+ * @return A string representation of this <code>Statement</code>.
*/
public String toString()
{
- CPStringBuilder result = new CPStringBuilder();
+ CPStringBuilder result = new CPStringBuilder();
String targetName;
if (target != null)
targetName = target.getClass().getSimpleName();
- else
+ else
targetName = "null";
result.append(targetName);
@@ -373,7 +373,7 @@ public class Statement
{
result.append(sep);
result.append(
- ( arguments[i] == null ) ? "null" :
+ ( arguments[i] == null ) ? "null" :
( arguments[i] instanceof String ) ? "\"" + arguments[i] + "\"" :
arguments[i].getClass().getSimpleName());
sep = ", ";
@@ -382,5 +382,5 @@ public class Statement
return result.toString();
}
-
+
}
diff --git a/java/beans/VetoableChangeSupport.java b/java/beans/VetoableChangeSupport.java
index f2b6a1df8..698e82d8f 100644
--- a/java/beans/VetoableChangeSupport.java
+++ b/java/beans/VetoableChangeSupport.java
@@ -1,5 +1,5 @@
/* VetoableChangeSupport.java -- support to manage vetoable change listeners
- Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006,
+ Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006,
Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/beans/Visibility.java b/java/beans/Visibility.java
index 428f3a207..338060181 100644
--- a/java/beans/Visibility.java
+++ b/java/beans/Visibility.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,32 +54,32 @@ package java.beans;
*/
public interface Visibility {
- /**
- * Tells whether the Bean can run without a GUI or not.
- * @return false if Bean can run without a GUI, else true.
- */
- boolean needsGui();
+ /**
+ * Tells whether the Bean can run without a GUI or not.
+ * @return false if Bean can run without a GUI, else true.
+ */
+ boolean needsGui();
- /**
- * Tells whether Bean is trying not to use the GUI.
- * If needsGui() is true, this method should always return false.
- * @return true if definitely not using GUI, otherwise false.
- */
- boolean avoidingGui();
+ /**
+ * Tells whether Bean is trying not to use the GUI.
+ * If needsGui() is true, this method should always return false.
+ * @return true if definitely not using GUI, otherwise false.
+ */
+ boolean avoidingGui();
- /**
- * Tells the Bean not to use GUI methods.
- * If needsGUI() is false, then after this method is called,
- * avoidingGui() should return true.
- */
- void dontUseGui();
+ /**
+ * Tells the Bean not to use GUI methods.
+ * If needsGUI() is false, then after this method is called,
+ * avoidingGui() should return true.
+ */
+ void dontUseGui();
- /**
- * Tells the Bean it may use the GUI.
- * The Bean is not required to use the GUI in this case, it is
- * merely being <EM>permitted</EM> to use it. If needsGui() is
- * false, avoidingGui() may return true or false after this method
- * is called.
- */
- void okToUseGui();
+ /**
+ * Tells the Bean it may use the GUI.
+ * The Bean is not required to use the GUI in this case, it is
+ * merely being <EM>permitted</EM> to use it. If needsGui() is
+ * false, avoidingGui() may return true or false after this method
+ * is called.
+ */
+ void okToUseGui();
}
diff --git a/java/beans/XMLDecoder.java b/java/beans/XMLDecoder.java
index 131cf3b04..26896393a 100644
--- a/java/beans/XMLDecoder.java
+++ b/java/beans/XMLDecoder.java
@@ -55,8 +55,8 @@ import java.util.NoSuchElementException;
* An example XML document might look like this:
* <code>
* &lt;java&gt;
- * &lt;string&gt;Hello World&lt;/string&gt;
- * &lt;int&gt;200&lt;/int&gt;
+ * &lt;string&gt;Hello World&lt;/string&gt;
+ * &lt;int&gt;200&lt;/int&gt;
* &lt;/java&gt;
* </code>
* <p>To read the <code>String</code> and the <code>Integer</code> instance the following can be used (assume
@@ -71,12 +71,12 @@ import java.util.NoSuchElementException;
* <p>An owner object can be set using the <code>setOwner</code> method which can then be accessed when
* decoding. This feature is only useful if the XML data is aware of the owner object. Such data may
* look like this (assume that the owner object is a JFrame instance):</p>
- * <code>
+ * <code>
* &lt;java&gt;
- * &lt;void method="getOwner"&gt;
- * &lt;void method="setVisible"&gt;
- * &lt;boolean&gt;true&lt;boolean&gt;
- * &lt;/void&gt;
+ * &lt;void method="getOwner"&gt;
+ * &lt;void method="setVisible"&gt;
+ * &lt;boolean&gt;true&lt;boolean&gt;
+ * &lt;/void&gt;
* &lt;/void&gt;
* &lt;/java&gt;
* </code>
@@ -98,210 +98,210 @@ import java.util.NoSuchElementException;
* the resulting <code>XMLDecoder</code> will be silently (without any exception) useless. Each call
* to <code>readObject</code> will return <code>null</code> and never throws an
* <code>ArrayIndexOutOfBoundsException</code>.</p>
- *
+ *
* @author Robert Schuster
* @since 1.4
* @status updated to 1.5
*/
public class XMLDecoder
{
- private Object owner;
-
- private ExceptionListener exceptionListener;
-
- private InputStream inputStream;
-
- private boolean isStreamClosed;
-
- private ClassLoader classLoader;
-
- private Iterator iterator;
-
- /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
- * Using this constructor no special ClassLoader, a default ExceptionListener
- * and no owner object is used.
- *
- * @param in InputStream to read XML data from.
- */
- public XMLDecoder(InputStream in)
- {
- this(in, null);
- }
-
- /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
- * Using this constructor no special ClassLoader and a default ExceptionListener
- * is used.
- *
- * @param in InputStream to read XML data from.
- * @param owner Owner object which can be accessed and modified while parsing.
- */
- public XMLDecoder(InputStream in, Object owner)
- {
- this(in, owner, null);
- }
-
- /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
- * If the ExceptionListener argument is null a default implementation is used.
- *
- * @param in InputStream to read XML data from.
- * @param owner Owner object which can be accessed and modified while parsing.
- * @param exceptionListener ExceptionListener instance to which exception notifications are send.
- */
- public XMLDecoder(
- InputStream in,
- Object owner,
- ExceptionListener exceptionListener)
- {
- this(
- in,
- owner,
- exceptionListener,
- Thread.currentThread().getContextClassLoader());
- }
-
- /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
- * If the ExceptionListener argument is null a default implementation is used.
- *
- * @param in InputStream to read XML data from.
- * @param owner Owner object which can be accessed and modified while parsing.
- * @param listener ExceptionListener instance to which exception notifications are send.
- * @param cl ClassLoader instance that is used for calls to <code>Class.forName(String, boolean, ClassLoader)</code>
- * @since 1.5
- */
- public XMLDecoder(
- InputStream in,
- Object owner,
- ExceptionListener listener,
- ClassLoader cl)
- {
- // initially here was a check for the validity of the InputStream argument but some
- // great engineers decided that this API should silently discard this and behave rather
- // odd: readObject will always return null ...
- inputStream = in;
-
- setExceptionListener(listener);
-
- // validity of this object is checked in Class.forName() and therefore may be null
- classLoader = cl;
-
- this.owner = owner;
- }
-
- /** Closes the stream associated with this decoder. This should be done after having read all
- * decoded objects.
- * <p>See the description of the {@link #readObject()} for the effect caused by <code>close</code>.</p>
- */
- public void close()
- {
- if (isStreamClosed)
- {
- return;
- }
-
- try
- {
- inputStream.close();
- isStreamClosed = true;
- }
- catch (IOException e)
- {
- // bad style forced by original API design ...
- }
- }
-
- /** Returns the ExceptionListener instance associated with this decoder.
- * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p>
- *
- * @return Current ExceptionListener of the decoder.
- */
- public ExceptionListener getExceptionListener()
- {
- return exceptionListener;
- }
-
- /** Returns the owner object of the decoder. This method is usually called
- * from within the parsed XML data.
- * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p>
- *
- * @return The owner object of this decoder.
- */
- public Object getOwner()
- {
- return owner;
- }
-
- /** Returns the next available decoded object.
- * <p>Note that the actual decoding takes place when the method is called for the first time.</p>
- * <p>If the <code>close</code> method was already called a <code>NoSuchElementException</code>
- * is thrown.</p>
- * <p>If the InputStream instance used in the constructors was <code>null</code> this method
- * will always return <code>null</code> itself.</p>
- *
- * @return The next object in a sequence decoded from XML data.
- * @throws ArrayIndexOutOfBoundsException When no more objects are available.
- */
- public Object readObject() throws ArrayIndexOutOfBoundsException
- {
- // note: the RI does it this way ...
- if(inputStream == null) {
- return null;
- }
-
- // note: the original API documentation says nothing on what to do
- // when the stream was closed before readObject is called but it actually
- // throws a NoSuchElementException - this behaviour is imitated here
- if (isStreamClosed)
- {
- throw new NoSuchElementException("Cannot read any objects - XMLDecoder was already closed.");
- }
-
- // creates the PersistenceParser (doing the parsing and decoding) and returns its
- // Iterator on first invocation
- if (iterator == null)
- {
- iterator =
- new PersistenceParser(
- inputStream,
- exceptionListener,
- classLoader,
- this)
- .iterator();
- }
-
- // note: done according to the official documentation
- if (!iterator.hasNext())
- {
- throw new ArrayIndexOutOfBoundsException("No more objects available from this XMLDecoder.");
- }
-
- // returns just the next object if there was no problem
- return iterator.next();
- }
-
- /** Sets the ExceptionListener instance to which notifications of exceptions are send
- * while parsing the XML data.
- * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p>
- *
- * @param listener
- */
- public void setExceptionListener(ExceptionListener listener)
- {
- // uses a default implementation when null
- if (listener == null)
- {
- listener = DefaultExceptionListener.INSTANCE;
- }
- exceptionListener = listener;
- }
-
- /** Sets the owner object which can be accessed from the parsed XML data.
- * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p>
- *
- * @param newOwner
- */
- public void setOwner(Object newOwner)
- {
- owner = newOwner;
- }
+ private Object owner;
+
+ private ExceptionListener exceptionListener;
+
+ private InputStream inputStream;
+
+ private boolean isStreamClosed;
+
+ private ClassLoader classLoader;
+
+ private Iterator iterator;
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * Using this constructor no special ClassLoader, a default ExceptionListener
+ * and no owner object is used.
+ *
+ * @param in InputStream to read XML data from.
+ */
+ public XMLDecoder(InputStream in)
+ {
+ this(in, null);
+ }
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * Using this constructor no special ClassLoader and a default ExceptionListener
+ * is used.
+ *
+ * @param in InputStream to read XML data from.
+ * @param owner Owner object which can be accessed and modified while parsing.
+ */
+ public XMLDecoder(InputStream in, Object owner)
+ {
+ this(in, owner, null);
+ }
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * If the ExceptionListener argument is null a default implementation is used.
+ *
+ * @param in InputStream to read XML data from.
+ * @param owner Owner object which can be accessed and modified while parsing.
+ * @param exceptionListener ExceptionListener instance to which exception notifications are send.
+ */
+ public XMLDecoder(
+ InputStream in,
+ Object owner,
+ ExceptionListener exceptionListener)
+ {
+ this(
+ in,
+ owner,
+ exceptionListener,
+ Thread.currentThread().getContextClassLoader());
+ }
+
+ /** Creates a XMLDecoder instance that parses the XML data of the given input stream.
+ * If the ExceptionListener argument is null a default implementation is used.
+ *
+ * @param in InputStream to read XML data from.
+ * @param owner Owner object which can be accessed and modified while parsing.
+ * @param listener ExceptionListener instance to which exception notifications are send.
+ * @param cl ClassLoader instance that is used for calls to <code>Class.forName(String, boolean, ClassLoader)</code>
+ * @since 1.5
+ */
+ public XMLDecoder(
+ InputStream in,
+ Object owner,
+ ExceptionListener listener,
+ ClassLoader cl)
+ {
+ // initially here was a check for the validity of the InputStream argument but some
+ // great engineers decided that this API should silently discard this and behave rather
+ // odd: readObject will always return null ...
+ inputStream = in;
+
+ setExceptionListener(listener);
+
+ // validity of this object is checked in Class.forName() and therefore may be null
+ classLoader = cl;
+
+ this.owner = owner;
+ }
+
+ /** Closes the stream associated with this decoder. This should be done after having read all
+ * decoded objects.
+ * <p>See the description of the {@link #readObject()} for the effect caused by <code>close</code>.</p>
+ */
+ public void close()
+ {
+ if (isStreamClosed)
+ {
+ return;
+ }
+
+ try
+ {
+ inputStream.close();
+ isStreamClosed = true;
+ }
+ catch (IOException e)
+ {
+ // bad style forced by original API design ...
+ }
+ }
+
+ /** Returns the ExceptionListener instance associated with this decoder.
+ * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p>
+ *
+ * @return Current ExceptionListener of the decoder.
+ */
+ public ExceptionListener getExceptionListener()
+ {
+ return exceptionListener;
+ }
+
+ /** Returns the owner object of the decoder. This method is usually called
+ * from within the parsed XML data.
+ * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p>
+ *
+ * @return The owner object of this decoder.
+ */
+ public Object getOwner()
+ {
+ return owner;
+ }
+
+ /** Returns the next available decoded object.
+ * <p>Note that the actual decoding takes place when the method is called for the first time.</p>
+ * <p>If the <code>close</code> method was already called a <code>NoSuchElementException</code>
+ * is thrown.</p>
+ * <p>If the InputStream instance used in the constructors was <code>null</code> this method
+ * will always return <code>null</code> itself.</p>
+ *
+ * @return The next object in a sequence decoded from XML data.
+ * @throws ArrayIndexOutOfBoundsException When no more objects are available.
+ */
+ public Object readObject() throws ArrayIndexOutOfBoundsException
+ {
+ // note: the RI does it this way ...
+ if(inputStream == null) {
+ return null;
+ }
+
+ // note: the original API documentation says nothing on what to do
+ // when the stream was closed before readObject is called but it actually
+ // throws a NoSuchElementException - this behaviour is imitated here
+ if (isStreamClosed)
+ {
+ throw new NoSuchElementException("Cannot read any objects - XMLDecoder was already closed.");
+ }
+
+ // creates the PersistenceParser (doing the parsing and decoding) and returns its
+ // Iterator on first invocation
+ if (iterator == null)
+ {
+ iterator =
+ new PersistenceParser(
+ inputStream,
+ exceptionListener,
+ classLoader,
+ this)
+ .iterator();
+ }
+
+ // note: done according to the official documentation
+ if (!iterator.hasNext())
+ {
+ throw new ArrayIndexOutOfBoundsException("No more objects available from this XMLDecoder.");
+ }
+
+ // returns just the next object if there was no problem
+ return iterator.next();
+ }
+
+ /** Sets the ExceptionListener instance to which notifications of exceptions are send
+ * while parsing the XML data.
+ * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p>
+ *
+ * @param listener
+ */
+ public void setExceptionListener(ExceptionListener listener)
+ {
+ // uses a default implementation when null
+ if (listener == null)
+ {
+ listener = DefaultExceptionListener.INSTANCE;
+ }
+ exceptionListener = listener;
+ }
+
+ /** Sets the owner object which can be accessed from the parsed XML data.
+ * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p>
+ *
+ * @param newOwner
+ */
+ public void setOwner(Object newOwner)
+ {
+ owner = newOwner;
+ }
}
diff --git a/java/beans/XMLEncoder.java b/java/beans/XMLEncoder.java
index 7242d0c69..40cb6dbfb 100644
--- a/java/beans/XMLEncoder.java
+++ b/java/beans/XMLEncoder.java
@@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,7 +46,7 @@ import java.io.OutputStream;
* This class uses the {@link PersistenceDelegate} and {@link Encoder}
* infrastructure to generate an XML representation of the objects it
* serializes.
- *
+ *
* @author Robert Schuster (robertschuster@fsfe.org)
* @since 1.4
*/
@@ -92,11 +92,11 @@ public class XMLEncoder extends Encoder
// I needed for a succesfull operation of XMLEncoder.
//
// The same is true for the writeStatement method.
-
+
// Silently ignore out of bounds calls.
if (accessCounter <= 0)
return;
-
+
scanEngine.writeExpression(expr);
@@ -113,8 +113,8 @@ public class XMLEncoder extends Encoder
getExceptionListener().exceptionThrown(e);
return;
}
-
-
+
+
newValue = get(value);
if (newValue == null)
@@ -144,15 +144,15 @@ public class XMLEncoder extends Encoder
newArgs[i] = get(args[i]);
}
}
-
+
Expression newExpr = new Expression(newTarget, expr.getMethodName(),
newArgs);
-
+
// Fakes the result of Class.forName(<primitiveType>) to make it possible
// to hand such a type to the encoding process.
if (value instanceof Class && ((Class) value).isPrimitive())
newExpr.setValue(value);
-
+
// Instantiates the new object.
try
{
@@ -163,15 +163,15 @@ public class XMLEncoder extends Encoder
catch (Exception e)
{
getExceptionListener().exceptionThrown(e);
-
+
// In Statement.writeExpression we had no possibility to flags
// an erroneous state to the ScanEngine without behaving different
- // to the JDK.
+ // to the JDK.
scanEngine.revoke();
-
+
return;
}
-
+
writeObject(value);
}
@@ -187,7 +187,7 @@ public class XMLEncoder extends Encoder
{
// In case of questions have a at the implementation note in
// writeExpression.
-
+
scanEngine.writeStatement(stmt);
// Silently ignore out of bounds calls.
@@ -234,7 +234,7 @@ public class XMLEncoder extends Encoder
// In Statement.writeStatement we had no possibility to flags
// an erroneous state to the ScanEngine without behaving different
- // to the JDK.
+ // to the JDK.
scanEngine.revoke();
return;
}
@@ -245,15 +245,15 @@ public class XMLEncoder extends Encoder
public void writeObject(Object o)
{
accessCounter++;
-
+
scanEngine.writeObject(o);
-
+
if (get(o) == null)
super.writeObject(o);
-
+
accessCounter--;
}
-
+
public void setOwner(Object o)
{
owner = o;
diff --git a/java/beans/beancontext/BeanContext.java b/java/beans/beancontext/BeanContext.java
index 02f4a1a40..803cb36ff 100644
--- a/java/beans/beancontext/BeanContext.java
+++ b/java/beans/beancontext/BeanContext.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -166,107 +166,107 @@ import java.util.Collection;
*/
public interface BeanContext
- extends Collection, BeanContextChild, Visibility, DesignMode {
+ extends Collection, BeanContextChild, Visibility, DesignMode {
- /**
- * The global lock on changing any BeanContext hierarchy.
- * It kinda sucks that there is only one lock, since there can be
- * multiple hierarchies. Oh well, I didn't design, I just code.
- * <P>
- *
- * Methods that must (or do) synchronize on the global lock:
- * <BR>
- * <UL>
- * <LI>
- * Implementors of <CODE>BeanContext.add()</CODE> and <code>addAll()</code>
- * </LI>
- * </UL>
- * @fixme fill in the rest of the methods which use the global lock.
- */
- Object globalHierarchyLock = new Object();
+ /**
+ * The global lock on changing any BeanContext hierarchy.
+ * It kinda sucks that there is only one lock, since there can be
+ * multiple hierarchies. Oh well, I didn't design, I just code.
+ * <P>
+ *
+ * Methods that must (or do) synchronize on the global lock:
+ * <BR>
+ * <UL>
+ * <LI>
+ * Implementors of <CODE>BeanContext.add()</CODE> and <code>addAll()</code>
+ * </LI>
+ * </UL>
+ * @fixme fill in the rest of the methods which use the global lock.
+ */
+ Object globalHierarchyLock = new Object();
- /**
- * Instantiate a Bean using this Bean's <code>ClassLoader</code>
- * and this <code>BeanContext</code> as the parent.
- * <P>
- *
- * This method exists mainly so that <code>BeanContext</code>
- * implementations can perform extra actions on Beans that are
- * created within them.
- *
- * @param beanName the name of the bean to instantiate
- * @return the created Bean
- *
- * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String)
- * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String,java.beans.beancontext.BeanContext)
- * @exception IOException if there is an I/O problem during
- * instantiation.
- * @exception ClassNotFoundException if a serialized Bean's class
- * is not found.
- */
- Object instantiateChild(String beanName)
+ /**
+ * Instantiate a Bean using this Bean's <code>ClassLoader</code>
+ * and this <code>BeanContext</code> as the parent.
+ * <P>
+ *
+ * This method exists mainly so that <code>BeanContext</code>
+ * implementations can perform extra actions on Beans that are
+ * created within them.
+ *
+ * @param beanName the name of the bean to instantiate
+ * @return the created Bean
+ *
+ * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String)
+ * @see java.beans.Beans#instantiate(java.lang.ClassLoader,java.lang.String,java.beans.beancontext.BeanContext)
+ * @exception IOException if there is an I/O problem during
+ * instantiation.
+ * @exception ClassNotFoundException if a serialized Bean's class
+ * is not found.
+ */
+ Object instantiateChild(String beanName)
throws IOException,
ClassNotFoundException;
- /**
- * Get a resource. The <code>BeanContext</code> will typically
- * call <code>ClassLoader.getResource()</code>, but may do it any
- * way it wants to. This allows a <code>BeanContext</code> to
- * have its own set of resources separate from the rest of the
- * system.
- * <P>
- *
- * Beans should call this method on their parent rather than the
- * associated <code>ClassLoader</code> method.
- * <P>
- *
- * I am assuming, but am not entirely sure, that if a
- * <code>BeanContext</code> cannot find a resource, its
- * responsibility is to call the <code>getResource</code> method
- * of its parent <code>BeanContext</code>.
- *
- * @return a URL to the requested resource.
- * @param resourceName the name of the resource requested.
- * @param requestor a reference to the child requesting the resource.
- * @see java.lang.ClassLoader#getResource(java.lang.String)
- */
- URL getResource(String resourceName, BeanContextChild requestor);
+ /**
+ * Get a resource. The <code>BeanContext</code> will typically
+ * call <code>ClassLoader.getResource()</code>, but may do it any
+ * way it wants to. This allows a <code>BeanContext</code> to
+ * have its own set of resources separate from the rest of the
+ * system.
+ * <P>
+ *
+ * Beans should call this method on their parent rather than the
+ * associated <code>ClassLoader</code> method.
+ * <P>
+ *
+ * I am assuming, but am not entirely sure, that if a
+ * <code>BeanContext</code> cannot find a resource, its
+ * responsibility is to call the <code>getResource</code> method
+ * of its parent <code>BeanContext</code>.
+ *
+ * @return a URL to the requested resource.
+ * @param resourceName the name of the resource requested.
+ * @param requestor a reference to the child requesting the resource.
+ * @see java.lang.ClassLoader#getResource(java.lang.String)
+ */
+ URL getResource(String resourceName, BeanContextChild requestor);
- /**
- * Get a resource as a stream. The <code>BeanContext</code> will
- * typically call <code>ClassLoader.getResourceAsStream()</code>,
- * but may do it any way it wants to. This allows a
- * <code>BeanContext</code>'s children to have their own set of
- * resources separate from the rest of the system.
- * <P>
- *
- * Beans should call this method on their parent rather than the
- * associated <code>ClassLoader</code> method.
- * <P>
- *
- * I am assuming, but am not entirely sure, that if a
- * <code>BeanContext</code> cannot find a resource, its
- * responsibility is to call the <code>getResourceAsStream</code>
- * method of its parent <code>BeanContext</code>.
- *
- * @return the requested resource as a stream.
- * @param resourceName the name of the resource requested.
- * @param requestor a reference to the child requesting the resource.
- * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)
- */
- InputStream getResourceAsStream(String resourceName, BeanContextChild requestor);
+ /**
+ * Get a resource as a stream. The <code>BeanContext</code> will
+ * typically call <code>ClassLoader.getResourceAsStream()</code>,
+ * but may do it any way it wants to. This allows a
+ * <code>BeanContext</code>'s children to have their own set of
+ * resources separate from the rest of the system.
+ * <P>
+ *
+ * Beans should call this method on their parent rather than the
+ * associated <code>ClassLoader</code> method.
+ * <P>
+ *
+ * I am assuming, but am not entirely sure, that if a
+ * <code>BeanContext</code> cannot find a resource, its
+ * responsibility is to call the <code>getResourceAsStream</code>
+ * method of its parent <code>BeanContext</code>.
+ *
+ * @return the requested resource as a stream.
+ * @param resourceName the name of the resource requested.
+ * @param requestor a reference to the child requesting the resource.
+ * @see java.lang.ClassLoader#getResourceAsStream(java.lang.String)
+ */
+ InputStream getResourceAsStream(String resourceName, BeanContextChild requestor);
- /**
- * Add a listener on changes to the membership of this
- * <code>BeanContext</code> object.
- * @param listener the listener to add.
- */
- void addBeanContextMembershipListener(BeanContextMembershipListener listener);
+ /**
+ * Add a listener on changes to the membership of this
+ * <code>BeanContext</code> object.
+ * @param listener the listener to add.
+ */
+ void addBeanContextMembershipListener(BeanContextMembershipListener listener);
- /**
- * Remove a listener on changes to the membership of this
- * <code>BeanContext</code> object.
- * @param listener the listener to remove.
- */
- void removeBeanContextMembershipListener(BeanContextMembershipListener listener);
+ /**
+ * Remove a listener on changes to the membership of this
+ * <code>BeanContext</code> object.
+ * @param listener the listener to remove.
+ */
+ void removeBeanContextMembershipListener(BeanContextMembershipListener listener);
}
diff --git a/java/beans/beancontext/BeanContextChild.java b/java/beans/beancontext/BeanContextChild.java
index d1115efac..e2bdcf336 100644
--- a/java/beans/beancontext/BeanContextChild.java
+++ b/java/beans/beancontext/BeanContextChild.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -77,98 +77,98 @@ import java.beans.VetoableChangeListener;
*/
public interface BeanContextChild {
- /**
- * Set the parent <code>BeanContext</code>.
- * <P>
- *
- * This method is called from <code>BeanContext.add()</code> and
- * should not be called directly.
- * <P>
- *
- * When this Object is being added to a new BeanContext or moved
- * from an old one, a non-null value will be passed in.
- * <P>
- *
- * When this Object is being removed from the current
- * <code>BeanContext</code>, <code>setBeanContext()</code> will
- * receive the parameter <code>null</code>.
- * <P>
- *
- * When being removed from the current <code>BeanContext</code>,
- * it is the <code>BeanContextChild</code>'s responsibility to
- * release all services it has obtained.
- * <P>
- *
- * This change should generate <code>PropertyChangeEvent</code>
- * and <code>VetoableChangeEvent</code>s with the property name
- * "beanContext". If the change is vetoed, it must re-throw the
- * exception and not change anything. In this way, the parent
- * <code>BeanContextChild</code>, who has registered himself with
- * you, will have a chance to remove this child from its
- * collection.
- * <P>
- *
- * If the Bean does not wish to change the parent or be removed
- * from one, it may throw the <code>PropertyVetoException</code>.
- * If you veto a <code>setBeanContext(null)</code> call, then you
- * should try your hardest to remedy whatever problem is keeping
- * you from being removed from the <code>BeanContext</code> so
- * that you can <em>not</em> veto it the next time.
- * Otherwise, nasty pathological recursion stuff could occur in
- * certain situations.
- * <P>
- *
- * If you do veto the change, you must first back out any changes
- * you made prior to the veto. Best not to make any such changes
- * prior to the veto in the first place.
- * <P>
- *
- * This method is called from <code>BeanContext.add()</code> and
- * should not be called directly.
- *
- * @param parent the new parent for the <code>BeanContextChild</code>,
- * or <code>null</code> to signify removal from a tree.
- * @exception PropertyVetoException if the
- * <code>BeanContextChild</code> implementor does not
- * wish to have its parent changed.
- */
- void setBeanContext(BeanContext parent)
- throws PropertyVetoException;
-
- /**
- * Get the parent <code>BeanContext</code>.
- * @return the parent <code>BeanContext</code>.
- */
- BeanContext getBeanContext();
-
- /**
- * Add a listener that will be notified when a specific property changes.
- * @param prop the name of the property to listen on
- * @param listener the listener to listen on the property.
- */
- void addPropertyChangeListener(String prop, PropertyChangeListener listener);
-
- /**
- * Remove a listener to a certain property.
- * @param prop the name of the property being listened on
- * @param listener the listener listening on the property.
- */
- void removePropertyChangeListener(String prop, PropertyChangeListener listener);
-
- /**
- * Add a listener that will be notified when a specific property
- * change is requested (a PropertyVetoException may be thrown) as
- * well as after the change is successfully made.
- *
- * @param prop the name of the property to listen on
- * @param listener the listener to listen on the property.
- */
- void addVetoableChangeListener(String prop, VetoableChangeListener listener);
-
- /**
- * Remove a listener to a certain property.
- * @param prop the name of the property being listened on
- * @param listener the listener listening on the property.
- */
- void removeVetoableChangeListener(String prop, VetoableChangeListener listener);
+ /**
+ * Set the parent <code>BeanContext</code>.
+ * <P>
+ *
+ * This method is called from <code>BeanContext.add()</code> and
+ * should not be called directly.
+ * <P>
+ *
+ * When this Object is being added to a new BeanContext or moved
+ * from an old one, a non-null value will be passed in.
+ * <P>
+ *
+ * When this Object is being removed from the current
+ * <code>BeanContext</code>, <code>setBeanContext()</code> will
+ * receive the parameter <code>null</code>.
+ * <P>
+ *
+ * When being removed from the current <code>BeanContext</code>,
+ * it is the <code>BeanContextChild</code>'s responsibility to
+ * release all services it has obtained.
+ * <P>
+ *
+ * This change should generate <code>PropertyChangeEvent</code>
+ * and <code>VetoableChangeEvent</code>s with the property name
+ * "beanContext". If the change is vetoed, it must re-throw the
+ * exception and not change anything. In this way, the parent
+ * <code>BeanContextChild</code>, who has registered himself with
+ * you, will have a chance to remove this child from its
+ * collection.
+ * <P>
+ *
+ * If the Bean does not wish to change the parent or be removed
+ * from one, it may throw the <code>PropertyVetoException</code>.
+ * If you veto a <code>setBeanContext(null)</code> call, then you
+ * should try your hardest to remedy whatever problem is keeping
+ * you from being removed from the <code>BeanContext</code> so
+ * that you can <em>not</em> veto it the next time.
+ * Otherwise, nasty pathological recursion stuff could occur in
+ * certain situations.
+ * <P>
+ *
+ * If you do veto the change, you must first back out any changes
+ * you made prior to the veto. Best not to make any such changes
+ * prior to the veto in the first place.
+ * <P>
+ *
+ * This method is called from <code>BeanContext.add()</code> and
+ * should not be called directly.
+ *
+ * @param parent the new parent for the <code>BeanContextChild</code>,
+ * or <code>null</code> to signify removal from a tree.
+ * @exception PropertyVetoException if the
+ * <code>BeanContextChild</code> implementor does not
+ * wish to have its parent changed.
+ */
+ void setBeanContext(BeanContext parent)
+ throws PropertyVetoException;
+
+ /**
+ * Get the parent <code>BeanContext</code>.
+ * @return the parent <code>BeanContext</code>.
+ */
+ BeanContext getBeanContext();
+
+ /**
+ * Add a listener that will be notified when a specific property changes.
+ * @param prop the name of the property to listen on
+ * @param listener the listener to listen on the property.
+ */
+ void addPropertyChangeListener(String prop, PropertyChangeListener listener);
+
+ /**
+ * Remove a listener to a certain property.
+ * @param prop the name of the property being listened on
+ * @param listener the listener listening on the property.
+ */
+ void removePropertyChangeListener(String prop, PropertyChangeListener listener);
+
+ /**
+ * Add a listener that will be notified when a specific property
+ * change is requested (a PropertyVetoException may be thrown) as
+ * well as after the change is successfully made.
+ *
+ * @param prop the name of the property to listen on
+ * @param listener the listener to listen on the property.
+ */
+ void addVetoableChangeListener(String prop, VetoableChangeListener listener);
+
+ /**
+ * Remove a listener to a certain property.
+ * @param prop the name of the property being listened on
+ * @param listener the listener listening on the property.
+ */
+ void removeVetoableChangeListener(String prop, VetoableChangeListener listener);
}
diff --git a/java/beans/beancontext/BeanContextChildComponentProxy.java b/java/beans/beancontext/BeanContextChildComponentProxy.java
index a8d6e3404..cb75d508d 100644
--- a/java/beans/beancontext/BeanContextChildComponentProxy.java
+++ b/java/beans/beancontext/BeanContextChildComponentProxy.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -51,10 +51,10 @@ import java.awt.Component;
*/
public interface BeanContextChildComponentProxy {
- /**
- * Get the <code>Component</code> associated with this <code>BeanContextChild</code>.
- * @return the <code>Component</code> associated with this
- * <code>BeanContextChild</code>.
- */
- Component getComponent();
+ /**
+ * Get the <code>Component</code> associated with this <code>BeanContextChild</code>.
+ * @return the <code>Component</code> associated with this
+ * <code>BeanContextChild</code>.
+ */
+ Component getComponent();
}
diff --git a/java/beans/beancontext/BeanContextChildSupport.java b/java/beans/beancontext/BeanContextChildSupport.java
index 4444ad713..8cd887d0c 100644
--- a/java/beans/beancontext/BeanContextChildSupport.java
+++ b/java/beans/beancontext/BeanContextChildSupport.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -64,121 +64,121 @@ public class BeanContextChildSupport
{
static final long serialVersionUID = 6328947014421475877L;
- /**
- * The peer on which to perform <code>set</code> actions.
- * This is here so that this class can be used as a peer.
- * <P>
- *
- * When extending this class, this variable will be set to
- * <code>this</code>.
- */
- public BeanContextChild beanContextChildPeer;
-
- /**
- * The parent <code>BeanContext</code>.
- */
- protected transient BeanContext beanContext;
-
- /**
- * If <code>setBeanContext()</code> was vetoed once before, this
- * is set to <code>true</code> so that the next time, vetoes will
- * be ignored.
- */
- protected transient boolean rejectedSetBCOnce;
-
- /**
- * Listeners are registered here and events are fired through here.
- */
- protected PropertyChangeSupport pcSupport;
-
- /**
- * Listeners are registered here and events are fired through here.
- */
- protected VetoableChangeSupport vcSupport;
-
- /**
- * Create a new <code>BeanContextChildSupport</code> with itself as the peer.
- * This is meant to be used when you subclass
- * <code>BeanContextChildSupport</code> to create your child.
- */
- public BeanContextChildSupport()
+ /**
+ * The peer on which to perform <code>set</code> actions.
+ * This is here so that this class can be used as a peer.
+ * <P>
+ *
+ * When extending this class, this variable will be set to
+ * <code>this</code>.
+ */
+ public BeanContextChild beanContextChildPeer;
+
+ /**
+ * The parent <code>BeanContext</code>.
+ */
+ protected transient BeanContext beanContext;
+
+ /**
+ * If <code>setBeanContext()</code> was vetoed once before, this
+ * is set to <code>true</code> so that the next time, vetoes will
+ * be ignored.
+ */
+ protected transient boolean rejectedSetBCOnce;
+
+ /**
+ * Listeners are registered here and events are fired through here.
+ */
+ protected PropertyChangeSupport pcSupport;
+
+ /**
+ * Listeners are registered here and events are fired through here.
+ */
+ protected VetoableChangeSupport vcSupport;
+
+ /**
+ * Create a new <code>BeanContextChildSupport</code> with itself as the peer.
+ * This is meant to be used when you subclass
+ * <code>BeanContextChildSupport</code> to create your child.
+ */
+ public BeanContextChildSupport()
{
- this (null);
- }
-
- /**
- * Create a new <code>BeanContextChildSupport</code> with the specified peer.
- * @param peer the peer to use, or <code>null</code> to specify
- * <code>this</code>.
- */
- public BeanContextChildSupport (BeanContextChild peer)
+ this (null);
+ }
+
+ /**
+ * Create a new <code>BeanContextChildSupport</code> with the specified peer.
+ * @param peer the peer to use, or <code>null</code> to specify
+ * <code>this</code>.
+ */
+ public BeanContextChildSupport (BeanContextChild peer)
{
- if (peer == null)
+ if (peer == null)
{
peer = this;
}
- beanContextChildPeer = peer;
- pcSupport = new PropertyChangeSupport (peer);
- vcSupport = new VetoableChangeSupport (peer);
- }
-
- /**
- * Set the parent <code>BeanContext</code>.
- * <P>
- *
- * When this Object is being added to a new BeanContext or moved
- * from an old one, a non-null value will be passed in.
- * <P>
- *
- * When this Object is being removed from the current
- * <code>BeanContext</code>, <code>setBeanContext()</code> will
- * receive the parameter <code>null</code>.
- * <P>
- *
- * Order of events:
- * <OL>
- * <LI>
- * If the new <code>BeanContext</code> is the same as the old
- * one, nothing happens.
- * </LI>
- * <LI>
- * If the change has not been rejected or vetoed before, call
- * <code>validatePendingSetBeanContext()</code>. If this call
- * returns <code>false</code>, the change is rejected and a
- * <code>PropertyVetoException</code> is thrown.
- * </LI>
- * <LI>
- * If the change has not been rejected or vetoed before,
- * <code>VetoableChangeEvent</code>s are fired with the name
- * <code>"beanContext"</code>, using the
- * <code>fireVetoableChange()</code> method. If a veto
- * occurs, reversion events are fired using the same method,
- * the change is rejected, and the veto is rethrown.
- * </LI>
- * <LI>
- * <code>releaseBeanContextResources()</code> is called.
- * </LI>
- * <LI>
- * The change is made.
- * </LI>
- * <LI>
- * <code>PropertyChangeEvent</code>s are fired using the
- * <code>firePropertyChange()</code> method.
- * </LI>
- * <LI>
- * <code>initializeBeanContextResources()</code> is called.
- * </LI>
- * </OL>
- * <P>
- *
- * @param newBeanContext the new parent for the
- * <code>BeanContextChild</code>, or <code>null</code> to
- * signify removal from a tree.
- * @exception PropertyVetoException if the
- * <code>BeanContextChild</code> implementor does not
- * wish to have its parent changed.
- */
+ beanContextChildPeer = peer;
+ pcSupport = new PropertyChangeSupport (peer);
+ vcSupport = new VetoableChangeSupport (peer);
+ }
+
+ /**
+ * Set the parent <code>BeanContext</code>.
+ * <P>
+ *
+ * When this Object is being added to a new BeanContext or moved
+ * from an old one, a non-null value will be passed in.
+ * <P>
+ *
+ * When this Object is being removed from the current
+ * <code>BeanContext</code>, <code>setBeanContext()</code> will
+ * receive the parameter <code>null</code>.
+ * <P>
+ *
+ * Order of events:
+ * <OL>
+ * <LI>
+ * If the new <code>BeanContext</code> is the same as the old
+ * one, nothing happens.
+ * </LI>
+ * <LI>
+ * If the change has not been rejected or vetoed before, call
+ * <code>validatePendingSetBeanContext()</code>. If this call
+ * returns <code>false</code>, the change is rejected and a
+ * <code>PropertyVetoException</code> is thrown.
+ * </LI>
+ * <LI>
+ * If the change has not been rejected or vetoed before,
+ * <code>VetoableChangeEvent</code>s are fired with the name
+ * <code>"beanContext"</code>, using the
+ * <code>fireVetoableChange()</code> method. If a veto
+ * occurs, reversion events are fired using the same method,
+ * the change is rejected, and the veto is rethrown.
+ * </LI>
+ * <LI>
+ * <code>releaseBeanContextResources()</code> is called.
+ * </LI>
+ * <LI>
+ * The change is made.
+ * </LI>
+ * <LI>
+ * <code>PropertyChangeEvent</code>s are fired using the
+ * <code>firePropertyChange()</code> method.
+ * </LI>
+ * <LI>
+ * <code>initializeBeanContextResources()</code> is called.
+ * </LI>
+ * </OL>
+ * <P>
+ *
+ * @param newBeanContext the new parent for the
+ * <code>BeanContextChild</code>, or <code>null</code> to
+ * signify removal from a tree.
+ * @exception PropertyVetoException if the
+ * <code>BeanContextChild</code> implementor does not
+ * wish to have its parent changed.
+ */
public void setBeanContext(BeanContext newBeanContext)
throws PropertyVetoException
{
@@ -195,7 +195,7 @@ public class BeanContextChildSupport
throw new PropertyVetoException ("validatePendingSetBeanContext() rejected change",
new PropertyChangeEvent(beanContextChildPeer, "beanContext", beanContext, newBeanContext));
}
-
+
try
{
fireVetoableChange ("beanContext", beanContext, newBeanContext);
@@ -207,175 +207,175 @@ public class BeanContextChildSupport
}
}
- releaseBeanContextResources ();
+ releaseBeanContextResources ();
- beanContext = newBeanContext;
- rejectedSetBCOnce = false;
+ beanContext = newBeanContext;
+ rejectedSetBCOnce = false;
- firePropertyChange ("beanContext", beanContext, newBeanContext);
+ firePropertyChange ("beanContext", beanContext, newBeanContext);
- initializeBeanContextResources ();
- }
- }
+ initializeBeanContextResources ();
+ }
+ }
- /**
- * Get the parent <code>BeanContext</code>.
- * @return the parent <code>BeanContext</code>.
- */
- public BeanContext getBeanContext()
+ /**
+ * Get the parent <code>BeanContext</code>.
+ * @return the parent <code>BeanContext</code>.
+ */
+ public BeanContext getBeanContext()
{
- return beanContext;
- }
-
- /**
- * Get the peer (or <code>this</code> if there is no peer).
- * @return the peer, or <code>this</code> if there is no peer.
- */
- public BeanContextChild getBeanContextChildPeer() {
- return beanContextChildPeer;
- }
-
- /**
- * Determine whether there is a peer.
- * This is true iff <code>getBeanContextChildPeer() == this</code>.
- * @return whether there is a peer.
- */
- public boolean isDelegated() {
- return beanContextChildPeer == this;
- }
-
- /**
- * Add a listener that will be notified when a specific property changes.
- * @param propertyName the name of the property to listen on.
- * @param listener the listener to listen on the property.
- */
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- pcSupport.addPropertyChangeListener(propertyName, listener);
- }
-
- /**
- * Remove a listener to a certain property.
- *
- * @param propertyName the name of the property being listened on.
- * @param listener the listener listening on the property.
- */
- public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- pcSupport.removePropertyChangeListener(propertyName, listener);
- }
-
- /**
- * Add a listener that will be notified when a specific property
- * change is requested (a PropertyVetoException may be thrown) as
- * well as after the change is successfully made.
- *
- * @param propertyName the name of the property to listen on.
- * @param listener the listener to listen on the property.
- */
- public void addVetoableChangeListener(String propertyName, VetoableChangeListener listener) {
- vcSupport.addVetoableChangeListener(propertyName, listener);
- }
-
- /**
- * Remove a listener to a certain property.
- *
- * @param propertyName the name of the property being listened on
- * @param listener the listener listening on the property.
- */
- public void removeVetoableChangeListener(String propertyName, VetoableChangeListener listener) {
- vcSupport.removeVetoableChangeListener(propertyName, listener);
- }
-
- /**
- * Fire a property change.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value of the property
- * @param newVal the new value of the property
- */
- public void firePropertyChange(String propertyName, Object oldVal, Object newVal) {
- pcSupport.firePropertyChange(propertyName, oldVal, newVal);
- }
-
- /**
- * Fire a vetoable property change.
- *
- * @param propertyName the name of the property that changed
- * @param oldVal the old value of the property
- * @param newVal the new value of the property
- * @exception PropertyVetoException if the change is vetoed.
- */
- public void fireVetoableChange(String propertyName, Object oldVal, Object newVal)
+ return beanContext;
+ }
+
+ /**
+ * Get the peer (or <code>this</code> if there is no peer).
+ * @return the peer, or <code>this</code> if there is no peer.
+ */
+ public BeanContextChild getBeanContextChildPeer() {
+ return beanContextChildPeer;
+ }
+
+ /**
+ * Determine whether there is a peer.
+ * This is true iff <code>getBeanContextChildPeer() == this</code>.
+ * @return whether there is a peer.
+ */
+ public boolean isDelegated() {
+ return beanContextChildPeer == this;
+ }
+
+ /**
+ * Add a listener that will be notified when a specific property changes.
+ * @param propertyName the name of the property to listen on.
+ * @param listener the listener to listen on the property.
+ */
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcSupport.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * Remove a listener to a certain property.
+ *
+ * @param propertyName the name of the property being listened on.
+ * @param listener the listener listening on the property.
+ */
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcSupport.removePropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * Add a listener that will be notified when a specific property
+ * change is requested (a PropertyVetoException may be thrown) as
+ * well as after the change is successfully made.
+ *
+ * @param propertyName the name of the property to listen on.
+ * @param listener the listener to listen on the property.
+ */
+ public void addVetoableChangeListener(String propertyName, VetoableChangeListener listener) {
+ vcSupport.addVetoableChangeListener(propertyName, listener);
+ }
+
+ /**
+ * Remove a listener to a certain property.
+ *
+ * @param propertyName the name of the property being listened on
+ * @param listener the listener listening on the property.
+ */
+ public void removeVetoableChangeListener(String propertyName, VetoableChangeListener listener) {
+ vcSupport.removeVetoableChangeListener(propertyName, listener);
+ }
+
+ /**
+ * Fire a property change.
+ *
+ * @param propertyName the name of the property that changed
+ * @param oldVal the old value of the property
+ * @param newVal the new value of the property
+ */
+ public void firePropertyChange(String propertyName, Object oldVal, Object newVal) {
+ pcSupport.firePropertyChange(propertyName, oldVal, newVal);
+ }
+
+ /**
+ * Fire a vetoable property change.
+ *
+ * @param propertyName the name of the property that changed
+ * @param oldVal the old value of the property
+ * @param newVal the new value of the property
+ * @exception PropertyVetoException if the change is vetoed.
+ */
+ public void fireVetoableChange(String propertyName, Object oldVal, Object newVal)
throws PropertyVetoException {
- vcSupport.fireVetoableChange(propertyName, oldVal, newVal);
- }
-
- /**
- * Called by <code>BeanContextServices.revokeService()</code> to indicate that a service has been revoked.
- * If you have a reference to such a service, it should be
- * discarded and may no longer function properly.
- * <code>getService()</code> will no longer work on the specified
- * service class after this event has been fired.
- * <P>
- *
- * <EM>This method is meant to be overriden.</EM>
- * <code>BeanContextChildSupport</code>'s implementation does
- * nothing.
- *
- * @param event the service revoked event.
- * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean)
- */
- public void serviceRevoked(BeanContextServiceRevokedEvent event) {
- }
-
- /**
- * Called by <code>BeanContextServices</code> whenever a service is made available.
- * <P>
- *
- * <EM>This method is meant to be overriden.</EM>
- * <code>BeanContextChildSupport</code>'s implementation does
- * nothing.
- *
- * @param event the service revoked event, with useful information
- * about the new service.
- */
- public void serviceAvailable(BeanContextServiceAvailableEvent event) {
- }
-
- /**
- * Called by <code>setBeanContext()</code> to determine whether the set should be rejected.
- * <P>
- *
- * <EM>This method is meant to be overriden.</EM>
- * <code>BeanContextChildSupport</code>'s implementation simply
- * returns <code>true</code>.
- *
- * @param newBeanContext the new parent.
- * @return whether to allow the parent to be changed to the new
- * value.
- */
- public boolean validatePendingSetBeanContext(BeanContext newBeanContext) {
- return true;
- }
-
- /**
- * Called by <code>setBeanContext()</code> to release resources of a what will soon no longer be the parent.
- * <P>
- *
- * <EM>This method is meant to be overriden.</EM>
- * <code>BeanContextChildSupport</code>'s implementation does
- * nothing.
- */
- protected void releaseBeanContextResources() {
- }
-
- /**
- * Called by <code>setBeanContext()</code> to grab resources when the parent has been set.
- * <P>
- *
- * <EM>This method is meant to be overriden.</EM>
- * <code>BeanContextChildSupport</code>'s implementation does
- * nothing.
- */
- protected void initializeBeanContextResources() {
- }
+ vcSupport.fireVetoableChange(propertyName, oldVal, newVal);
+ }
+
+ /**
+ * Called by <code>BeanContextServices.revokeService()</code> to indicate that a service has been revoked.
+ * If you have a reference to such a service, it should be
+ * discarded and may no longer function properly.
+ * <code>getService()</code> will no longer work on the specified
+ * service class after this event has been fired.
+ * <P>
+ *
+ * <EM>This method is meant to be overriden.</EM>
+ * <code>BeanContextChildSupport</code>'s implementation does
+ * nothing.
+ *
+ * @param event the service revoked event.
+ * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean)
+ */
+ public void serviceRevoked(BeanContextServiceRevokedEvent event) {
+ }
+
+ /**
+ * Called by <code>BeanContextServices</code> whenever a service is made available.
+ * <P>
+ *
+ * <EM>This method is meant to be overriden.</EM>
+ * <code>BeanContextChildSupport</code>'s implementation does
+ * nothing.
+ *
+ * @param event the service revoked event, with useful information
+ * about the new service.
+ */
+ public void serviceAvailable(BeanContextServiceAvailableEvent event) {
+ }
+
+ /**
+ * Called by <code>setBeanContext()</code> to determine whether the set should be rejected.
+ * <P>
+ *
+ * <EM>This method is meant to be overriden.</EM>
+ * <code>BeanContextChildSupport</code>'s implementation simply
+ * returns <code>true</code>.
+ *
+ * @param newBeanContext the new parent.
+ * @return whether to allow the parent to be changed to the new
+ * value.
+ */
+ public boolean validatePendingSetBeanContext(BeanContext newBeanContext) {
+ return true;
+ }
+
+ /**
+ * Called by <code>setBeanContext()</code> to release resources of a what will soon no longer be the parent.
+ * <P>
+ *
+ * <EM>This method is meant to be overriden.</EM>
+ * <code>BeanContextChildSupport</code>'s implementation does
+ * nothing.
+ */
+ protected void releaseBeanContextResources() {
+ }
+
+ /**
+ * Called by <code>setBeanContext()</code> to grab resources when the parent has been set.
+ * <P>
+ *
+ * <EM>This method is meant to be overriden.</EM>
+ * <code>BeanContextChildSupport</code>'s implementation does
+ * nothing.
+ */
+ protected void initializeBeanContextResources() {
+ }
}
diff --git a/java/beans/beancontext/BeanContextContainerProxy.java b/java/beans/beancontext/BeanContextContainerProxy.java
index 3df91038b..962cb5fc9 100644
--- a/java/beans/beancontext/BeanContextContainerProxy.java
+++ b/java/beans/beancontext/BeanContextContainerProxy.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,10 +54,10 @@ import java.awt.Container;
*/
public interface BeanContextContainerProxy {
- /**
- * Get the <code>Container</code> associated with this <code>BeanContext</code>.
- * @return the <code>Container</code> associated with this
- * <code>BeanContext</code>.
- */
- Container getContainer();
+ /**
+ * Get the <code>Container</code> associated with this <code>BeanContext</code>.
+ * @return the <code>Container</code> associated with this
+ * <code>BeanContext</code>.
+ */
+ Container getContainer();
}
diff --git a/java/beans/beancontext/BeanContextEvent.java b/java/beans/beancontext/BeanContextEvent.java
index f326541b0..959d54e58 100644
--- a/java/beans/beancontext/BeanContextEvent.java
+++ b/java/beans/beancontext/BeanContextEvent.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,7 +50,7 @@ import java.util.EventObject;
public abstract class BeanContextEvent extends EventObject
{
private static final long serialVersionUID = 7267998073569045052L;
-
+
/**
* The <code>BeanContext</code> that most recently passed this
* event on.
diff --git a/java/beans/beancontext/BeanContextMembershipEvent.java b/java/beans/beancontext/BeanContextMembershipEvent.java
index 9560889f8..77b1be43e 100644
--- a/java/beans/beancontext/BeanContextMembershipEvent.java
+++ b/java/beans/beancontext/BeanContextMembershipEvent.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -55,60 +55,60 @@ public class BeanContextMembershipEvent extends BeanContextEvent {
private static final long serialVersionUID = 3499346510334590959L;
/**
- * The children that were added or removed.
- */
- protected Collection children;
-
- /**
- * Create a new membership event.
- * @param context the event source.
- * @param children the children added to or removed from the source.
- */
- public BeanContextMembershipEvent(BeanContext context, Collection children) {
- super(context);
- this.children = children;
- }
-
- /**
- * Create a new membership event.
- * @param context the event source.
- * @param children the children added to or removed from the source.
- */
- public BeanContextMembershipEvent(BeanContext context, Object[] children) {
- super(context);
- this.children = Arrays.asList(children);
- }
-
- /**
- * The number of children removed or added.
- * @return the number of children removed or added.
- */
- public int size() {
- return children.size();
- }
-
- /**
- * An iterator that will step through all the children.
- * @return an iterator over all the children.
- */
- public Iterator iterator() {
- return children.iterator();
- }
-
- /**
- * An array of the children.
- * @return an array of the children.
- */
- public Object[] toArray() {
- return children.toArray();
- }
-
- /**
- * Tell whether the <code>Object</code> is one of the children added or removed.
- * @param child the child to check.
- * @return whether the <code>Object</code> is added or removed.
- */
- public boolean contains(Object child) {
- return children.contains(child);
- }
+ * The children that were added or removed.
+ */
+ protected Collection children;
+
+ /**
+ * Create a new membership event.
+ * @param context the event source.
+ * @param children the children added to or removed from the source.
+ */
+ public BeanContextMembershipEvent(BeanContext context, Collection children) {
+ super(context);
+ this.children = children;
+ }
+
+ /**
+ * Create a new membership event.
+ * @param context the event source.
+ * @param children the children added to or removed from the source.
+ */
+ public BeanContextMembershipEvent(BeanContext context, Object[] children) {
+ super(context);
+ this.children = Arrays.asList(children);
+ }
+
+ /**
+ * The number of children removed or added.
+ * @return the number of children removed or added.
+ */
+ public int size() {
+ return children.size();
+ }
+
+ /**
+ * An iterator that will step through all the children.
+ * @return an iterator over all the children.
+ */
+ public Iterator iterator() {
+ return children.iterator();
+ }
+
+ /**
+ * An array of the children.
+ * @return an array of the children.
+ */
+ public Object[] toArray() {
+ return children.toArray();
+ }
+
+ /**
+ * Tell whether the <code>Object</code> is one of the children added or removed.
+ * @param child the child to check.
+ * @return whether the <code>Object</code> is added or removed.
+ */
+ public boolean contains(Object child) {
+ return children.contains(child);
+ }
}
diff --git a/java/beans/beancontext/BeanContextMembershipListener.java b/java/beans/beancontext/BeanContextMembershipListener.java
index d39c36c4b..cdb47c811 100644
--- a/java/beans/beancontext/BeanContextMembershipListener.java
+++ b/java/beans/beancontext/BeanContextMembershipListener.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,21 +50,21 @@ import java.util.EventListener;
*/
public interface BeanContextMembershipListener extends EventListener {
- /**
- * When beans are added to a <code>BeanContext</code>,
- * this method is called to fire the event.
- *
- * @param event the event, including which children were added.
- * @see java.beans.beancontext.BeanContext#add(java.lang.Object)
- */
- void childrenAdded(BeanContextMembershipEvent event);
+ /**
+ * When beans are added to a <code>BeanContext</code>,
+ * this method is called to fire the event.
+ *
+ * @param event the event, including which children were added.
+ * @see java.beans.beancontext.BeanContext#add(java.lang.Object)
+ */
+ void childrenAdded(BeanContextMembershipEvent event);
- /**
- * When beans are removed from a <code>BeanContext</code>,
- * this method is called to fire the event.
- *
- * @param event the event, including which children were removed.
- * @see java.beans.beancontext.BeanContext#remove(java.lang.Object)
- */
- void childrenRemoved(BeanContextMembershipEvent event);
+ /**
+ * When beans are removed from a <code>BeanContext</code>,
+ * this method is called to fire the event.
+ *
+ * @param event the event, including which children were removed.
+ * @see java.beans.beancontext.BeanContext#remove(java.lang.Object)
+ */
+ void childrenRemoved(BeanContextMembershipEvent event);
}
diff --git a/java/beans/beancontext/BeanContextProxy.java b/java/beans/beancontext/BeanContextProxy.java
index 49dd7a77f..53632e86b 100644
--- a/java/beans/beancontext/BeanContextProxy.java
+++ b/java/beans/beancontext/BeanContextProxy.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,12 +54,12 @@ package java.beans.beancontext;
*/
public interface BeanContextProxy {
- /**
- * Return the <code>BeanContextChild</code> associated with this
- * <code>Object</code>.
- *
- * @return the <code>BeanContextChild</code> associated with this
- * <code>Object</code>.
- */
- BeanContextChild getBeanContextProxy();
+ /**
+ * Return the <code>BeanContextChild</code> associated with this
+ * <code>Object</code>.
+ *
+ * @return the <code>BeanContextChild</code> associated with this
+ * <code>Object</code>.
+ */
+ BeanContextChild getBeanContextProxy();
}
diff --git a/java/beans/beancontext/BeanContextServiceAvailableEvent.java b/java/beans/beancontext/BeanContextServiceAvailableEvent.java
index 6dc2c38ab..a2bdcdde7 100644
--- a/java/beans/beancontext/BeanContextServiceAvailableEvent.java
+++ b/java/beans/beancontext/BeanContextServiceAvailableEvent.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,46 +52,46 @@ public class BeanContextServiceAvailableEvent extends BeanContextEvent {
private static final long serialVersionUID = -5333985775656400778L;
/**
- * The <code>Class</code> representing the service which is now
- * available.
- */
- protected Class serviceClass;
-
- /**
- * Create a new service available event.
- * @param services the <code>BeanContextServices</code> through
- * which the service is available. This is also the source
- * of the event.
- * @param serviceClass the service class that is now available.
- */
- public BeanContextServiceAvailableEvent(BeanContextServices services, Class serviceClass) {
- super(services);
- this.serviceClass = serviceClass;
- }
-
- /**
- * Get the current service selectors of the service class.
- * This is identical to <code>getSourceAsBeanContextServices().getCurrentServiceSelectors(getServiceClass())</code>
- * @return the current service selectors of the service class.
- */
- public Iterator getCurrentServiceSelectors() {
- return getSourceAsBeanContextServices().getCurrentServiceSelectors(serviceClass);
- }
-
- /**
- * Get the newly available service class.
- * @return the service class.
- */
- public Class getServiceClass() {
- return serviceClass;
- }
-
- /**
- * Get the <code>BeanContextServices</code> through which the new service is available.
- * @return the <code>BeanContextServices</code> through which the
- * new service is available.
- */
- public BeanContextServices getSourceAsBeanContextServices() {
- return (BeanContextServices)getSource();
- }
+ * The <code>Class</code> representing the service which is now
+ * available.
+ */
+ protected Class serviceClass;
+
+ /**
+ * Create a new service available event.
+ * @param services the <code>BeanContextServices</code> through
+ * which the service is available. This is also the source
+ * of the event.
+ * @param serviceClass the service class that is now available.
+ */
+ public BeanContextServiceAvailableEvent(BeanContextServices services, Class serviceClass) {
+ super(services);
+ this.serviceClass = serviceClass;
+ }
+
+ /**
+ * Get the current service selectors of the service class.
+ * This is identical to <code>getSourceAsBeanContextServices().getCurrentServiceSelectors(getServiceClass())</code>
+ * @return the current service selectors of the service class.
+ */
+ public Iterator getCurrentServiceSelectors() {
+ return getSourceAsBeanContextServices().getCurrentServiceSelectors(serviceClass);
+ }
+
+ /**
+ * Get the newly available service class.
+ * @return the service class.
+ */
+ public Class getServiceClass() {
+ return serviceClass;
+ }
+
+ /**
+ * Get the <code>BeanContextServices</code> through which the new service is available.
+ * @return the <code>BeanContextServices</code> through which the
+ * new service is available.
+ */
+ public BeanContextServices getSourceAsBeanContextServices() {
+ return (BeanContextServices)getSource();
+ }
}
diff --git a/java/beans/beancontext/BeanContextServiceProvider.java b/java/beans/beancontext/BeanContextServiceProvider.java
index c09b5815f..7475a61bd 100644
--- a/java/beans/beancontext/BeanContextServiceProvider.java
+++ b/java/beans/beancontext/BeanContextServiceProvider.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -60,79 +60,79 @@ import java.util.Iterator;
*/
public interface BeanContextServiceProvider {
- /**
- * Get a service.
- * Called from <code>BeanContextServices.getService()</code>.
- *
- * <p>If the requested service class is not available, or if this
- * <code>BeanContextServiceProvider</code> chooses not honor the
- * request for some reason, then this method will return
- * <code>null</code>.</p>
- *
- * This method may throw unchecked exceptions, so watch out.
- *
- * @param services the <code>BeanContextServices</code> that wants
- * to get the service. Only weak references to this will
- * be retained, and it will never be changed, only queried
- * in a read-only manner.
- * @param requestor the actual requestor of the service. Only
- * weak references to this will be retained, and it will
- * never be changed, only queried in a read-only manner.
- * @param serviceClass the <code>Class</code> of the service being
- * requested.
- * @param serviceSelector a parameter to customize the service
- * returned with.
- * @return an instance of <code>serviceClass</code> (such that
- * <code>instanceof</code> serviceClass is true), or
- * <code>null</code>.
- * @see java.beans.beancontext.BeanContextServices#getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener)
- */
- Object getService(BeanContextServices services, Object requestor, Class serviceClass, Object serviceSelector);
+ /**
+ * Get a service.
+ * Called from <code>BeanContextServices.getService()</code>.
+ *
+ * <p>If the requested service class is not available, or if this
+ * <code>BeanContextServiceProvider</code> chooses not honor the
+ * request for some reason, then this method will return
+ * <code>null</code>.</p>
+ *
+ * This method may throw unchecked exceptions, so watch out.
+ *
+ * @param services the <code>BeanContextServices</code> that wants
+ * to get the service. Only weak references to this will
+ * be retained, and it will never be changed, only queried
+ * in a read-only manner.
+ * @param requestor the actual requestor of the service. Only
+ * weak references to this will be retained, and it will
+ * never be changed, only queried in a read-only manner.
+ * @param serviceClass the <code>Class</code> of the service being
+ * requested.
+ * @param serviceSelector a parameter to customize the service
+ * returned with.
+ * @return an instance of <code>serviceClass</code> (such that
+ * <code>instanceof</code> serviceClass is true), or
+ * <code>null</code>.
+ * @see java.beans.beancontext.BeanContextServices#getService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Class,java.lang.Object,java.beans.beancontext.BeanContextServiceRevokedListener)
+ */
+ Object getService(BeanContextServices services, Object requestor, Class serviceClass, Object serviceSelector);
- /**
- * Release the service.
- * <P>
- *
- * Called by <code>BeanContextServices.releaseService()</code>.
- * <P>
- *
- * Most <code>BeanContextServiceProvider</code>s won't have to do
- * anything here.
- *
- * @param services the <code>BeanContextServices</code> that wants
- * to release the service. Only weak references to this will
- * be retained, and it will never be changed, only queried
- * in a read-only manner.
- * @param requestor the original requestor of the service.
- * @param service the service to relinquish
- * @see java.beans.beancontext.BeanContextServices#releaseService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Object)
- */
- void releaseService(BeanContextServices services, Object requestor, Object service);
+ /**
+ * Release the service.
+ * <P>
+ *
+ * Called by <code>BeanContextServices.releaseService()</code>.
+ * <P>
+ *
+ * Most <code>BeanContextServiceProvider</code>s won't have to do
+ * anything here.
+ *
+ * @param services the <code>BeanContextServices</code> that wants
+ * to release the service. Only weak references to this will
+ * be retained, and it will never be changed, only queried
+ * in a read-only manner.
+ * @param requestor the original requestor of the service.
+ * @param service the service to relinquish
+ * @see java.beans.beancontext.BeanContextServices#releaseService(java.beans.beancontext.BeanContextChild,java.lang.Object,java.lang.Object)
+ */
+ void releaseService(BeanContextServices services, Object requestor, Object service);
- /**
- * Get a list of valid service selectors for the specified service class.
- * This method is called from
- * <code>BeanContextServices.getCurrentServiceSelectors()</code>.
- * <P>
- *
- * If the specified service class does not have a finite number of
- * valid service selectors, it should return <code>null</code>.
- * If it takes a general <code>Integer</code> parameter, for
- * example, you may as well return <code>null</code> or the poor
- * soul who called this method will be iterating all day.
- * <P>
- *
- * If it has no valid service selectors, it should still return an empty
- * <code>Iterator</code>.
- *
- * @param services the <code>BeanContextServices</code> that wants
- * to get the service selectors. Only weak references to this will
- * be retained, and it will never be changed, only queried
- * in a read-only manner.
- * @param serviceClass the service class to get selectors for.
- * @return a list of valid service selectors for the service
- * class, or <code>null</code>.
- * @see java.beans.beancontext.BeanContextServices#getCurrentServiceSelectors(java.lang.Class)
- */
- Iterator getCurrentServiceSelectors(BeanContextServices services, Class serviceClass);
+ /**
+ * Get a list of valid service selectors for the specified service class.
+ * This method is called from
+ * <code>BeanContextServices.getCurrentServiceSelectors()</code>.
+ * <P>
+ *
+ * If the specified service class does not have a finite number of
+ * valid service selectors, it should return <code>null</code>.
+ * If it takes a general <code>Integer</code> parameter, for
+ * example, you may as well return <code>null</code> or the poor
+ * soul who called this method will be iterating all day.
+ * <P>
+ *
+ * If it has no valid service selectors, it should still return an empty
+ * <code>Iterator</code>.
+ *
+ * @param services the <code>BeanContextServices</code> that wants
+ * to get the service selectors. Only weak references to this will
+ * be retained, and it will never be changed, only queried
+ * in a read-only manner.
+ * @param serviceClass the service class to get selectors for.
+ * @return a list of valid service selectors for the service
+ * class, or <code>null</code>.
+ * @see java.beans.beancontext.BeanContextServices#getCurrentServiceSelectors(java.lang.Class)
+ */
+ Iterator getCurrentServiceSelectors(BeanContextServices services, Class serviceClass);
}
diff --git a/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java b/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
index 690b94e2c..78bfc200d 100644
--- a/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
+++ b/java/beans/beancontext/BeanContextServiceProviderBeanInfo.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -52,9 +52,9 @@ import java.beans.BeanInfo;
* @since JDK1.2
*/
public interface BeanContextServiceProviderBeanInfo extends BeanInfo {
- /**
- * Get <code>BeanInfo</code>s for all of the service classes of this <code>BeanInfoServiceProvider</code>.
- * @return <code>BeanInfo</code>s for all provided service classes.
- */
- BeanInfo[] getServicesBeanInfo();
+ /**
+ * Get <code>BeanInfo</code>s for all of the service classes of this <code>BeanInfoServiceProvider</code>.
+ * @return <code>BeanInfo</code>s for all provided service classes.
+ */
+ BeanInfo[] getServicesBeanInfo();
}
diff --git a/java/beans/beancontext/BeanContextServiceRevokedEvent.java b/java/beans/beancontext/BeanContextServiceRevokedEvent.java
index 1f5ebd3cd..b4f2fa856 100644
--- a/java/beans/beancontext/BeanContextServiceRevokedEvent.java
+++ b/java/beans/beancontext/BeanContextServiceRevokedEvent.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,63 +50,63 @@ public class BeanContextServiceRevokedEvent extends BeanContextEvent {
private static final long serialVersionUID = -1295543154724961754L;
/**
- * The <code>Class</code> representing the service which is now
- * available.
- */
- protected Class serviceClass;
- private boolean invalidateRefs;
-
- /**
- * Create a new service revoked event.
- * @param services the <code>BeanContextServices</code> through
- * which the service was available. This is also the source
- * of the event.
- * @param serviceClass the service class that is now revoked.
- * @param revokeNow whether the revocation is immediate for all
- * classes or just a suggestion.
- */
- public BeanContextServiceRevokedEvent(BeanContextServices services, Class serviceClass, boolean revokeNow) {
- super(services);
- this.serviceClass = serviceClass;
- invalidateRefs = revokeNow;
- }
-
- /**
- * Get the revoked service class.
- * @return the service class.
- */
- public Class getServiceClass() {
- return serviceClass;
- }
-
- /**
- * Tell whether the revoked service class is the same as the specified class.
- * Identical to <code>getServiceClass().equals(c)</code>.
- * @param c the class to compare.
- * @return whether the clases are equal.
- */
- public boolean isServiceClass(Class c) {
- return serviceClass.equals(c);
- }
-
- /**
- * Get the <code>BeanContextServices</code> through which the service was available.
- * @return the <code>BeanContextServices</code> through which the
- * service was available.
- */
- public BeanContextServices getSourceAsBeanContextServices() {
- return (BeanContextServices)getSource();
- }
-
- /**
- * Tell whether current instances of the revoked service are usable or not.
- * This is determined by whether the service was revoked
- * immediately.
- *
- * @return whether current instances of the revoked service are
- * usable.
- */
- public boolean isCurrentServiceInvalidNow() {
- return invalidateRefs;
- }
+ * The <code>Class</code> representing the service which is now
+ * available.
+ */
+ protected Class serviceClass;
+ private boolean invalidateRefs;
+
+ /**
+ * Create a new service revoked event.
+ * @param services the <code>BeanContextServices</code> through
+ * which the service was available. This is also the source
+ * of the event.
+ * @param serviceClass the service class that is now revoked.
+ * @param revokeNow whether the revocation is immediate for all
+ * classes or just a suggestion.
+ */
+ public BeanContextServiceRevokedEvent(BeanContextServices services, Class serviceClass, boolean revokeNow) {
+ super(services);
+ this.serviceClass = serviceClass;
+ invalidateRefs = revokeNow;
+ }
+
+ /**
+ * Get the revoked service class.
+ * @return the service class.
+ */
+ public Class getServiceClass() {
+ return serviceClass;
+ }
+
+ /**
+ * Tell whether the revoked service class is the same as the specified class.
+ * Identical to <code>getServiceClass().equals(c)</code>.
+ * @param c the class to compare.
+ * @return whether the clases are equal.
+ */
+ public boolean isServiceClass(Class c) {
+ return serviceClass.equals(c);
+ }
+
+ /**
+ * Get the <code>BeanContextServices</code> through which the service was available.
+ * @return the <code>BeanContextServices</code> through which the
+ * service was available.
+ */
+ public BeanContextServices getSourceAsBeanContextServices() {
+ return (BeanContextServices)getSource();
+ }
+
+ /**
+ * Tell whether current instances of the revoked service are usable or not.
+ * This is determined by whether the service was revoked
+ * immediately.
+ *
+ * @return whether current instances of the revoked service are
+ * usable.
+ */
+ public boolean isCurrentServiceInvalidNow() {
+ return invalidateRefs;
+ }
}
diff --git a/java/beans/beancontext/BeanContextServiceRevokedListener.java b/java/beans/beancontext/BeanContextServiceRevokedListener.java
index 101e6e191..11b83dd65 100644
--- a/java/beans/beancontext/BeanContextServiceRevokedListener.java
+++ b/java/beans/beancontext/BeanContextServiceRevokedListener.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -48,15 +48,15 @@ import java.util.EventListener;
*/
public interface BeanContextServiceRevokedListener extends EventListener {
- /**
- * Called by <code>BeanContextServices.revokeService()</code> to indicate that a service has been revoked.
- * If you have a reference to such a service, it should be
- * discarded and may no longer function properly.
- * <code>getService()</code> will no longer work on the specified
- * service class after this event has been fired.
- *
- * @param event the service revoked event.
- * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean)
- */
- void serviceRevoked(BeanContextServiceRevokedEvent event);
+ /**
+ * Called by <code>BeanContextServices.revokeService()</code> to indicate that a service has been revoked.
+ * If you have a reference to such a service, it should be
+ * discarded and may no longer function properly.
+ * <code>getService()</code> will no longer work on the specified
+ * service class after this event has been fired.
+ *
+ * @param event the service revoked event.
+ * @see java.beans.beancontext.BeanContextServices#revokeService(java.lang.Class,java.beans.beancontext.BeanContextServiceProvider,boolean)
+ */
+ void serviceRevoked(BeanContextServiceRevokedEvent event);
}
diff --git a/java/beans/beancontext/BeanContextServices.java b/java/beans/beancontext/BeanContextServices.java
index cb1950360..787618ad5 100644
--- a/java/beans/beancontext/BeanContextServices.java
+++ b/java/beans/beancontext/BeanContextServices.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/beans/beancontext/BeanContextServicesListener.java b/java/beans/beancontext/BeanContextServicesListener.java
index becc7cdb6..2081080dd 100644
--- a/java/beans/beancontext/BeanContextServicesListener.java
+++ b/java/beans/beancontext/BeanContextServicesListener.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,11 +46,11 @@ package java.beans.beancontext;
*/
public interface BeanContextServicesListener extends BeanContextServiceRevokedListener {
- /**
- * Called by <code>BeanContextServices</code> whenever a service is made available.
- *
- * @param event the service revoked event, with useful information
- * about the new service.
- */
- void serviceAvailable(BeanContextServiceAvailableEvent event);
+ /**
+ * Called by <code>BeanContextServices</code> whenever a service is made available.
+ *
+ * @param event the service revoked event, with useful information
+ * about the new service.
+ */
+ void serviceAvailable(BeanContextServiceAvailableEvent event);
}
diff --git a/java/beans/beancontext/BeanContextServicesSupport.java b/java/beans/beancontext/BeanContextServicesSupport.java
index 725c2d468..30b4a6fbd 100644
--- a/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/java/beans/beancontext/BeanContextServicesSupport.java
@@ -66,7 +66,7 @@ public class BeanContextServicesSupport
implements BeanContextServices
{
private static final long serialVersionUID = -8494482757288719206L;
-
+
protected class BCSSChild
extends BeanContextSupport.BCSChild
{
@@ -103,7 +103,7 @@ public class BeanContextServicesSupport
Object serviceSelector)
{
return provider.getService(bcs, requestor, serviceClass,
- serviceSelector);
+ serviceSelector);
}
public void releaseService (BeanContextServices bcs,
@@ -116,7 +116,7 @@ public class BeanContextServicesSupport
public void serviceRevoked (BeanContextServiceRevokedEvent bcsre)
{
if (provider instanceof BeanContextServiceRevokedListener)
- ((BeanContextServiceRevokedListener) provider).serviceRevoked(bcsre);
+ ((BeanContextServiceRevokedListener) provider).serviceRevoked(bcsre);
}
}
@@ -130,7 +130,7 @@ public class BeanContextServicesSupport
private Class serviceClass;
private BCSSServiceProvider(Class serviceClass,
- BeanContextServiceProvider provider)
+ BeanContextServiceProvider provider)
{
this.serviceClass = serviceClass;
serviceProvider = provider;
@@ -167,10 +167,10 @@ public class BeanContextServicesSupport
public boolean equals(Object obj)
{
if (obj instanceof Request)
- {
- Request req = (Request) obj;
- return req.getRequestor().equals(requestor);
- }
+ {
+ Request req = (Request) obj;
+ return req.getRequestor().equals(requestor);
+ }
return false;
}
@@ -194,7 +194,7 @@ public class BeanContextServicesSupport
private BeanContextServiceRevokedListener listener;
public ServiceRequest(Object requestor,
- BeanContextServiceRevokedListener listener)
+ BeanContextServiceRevokedListener listener)
{
super(requestor);
this.listener = listener;
@@ -203,11 +203,11 @@ public class BeanContextServicesSupport
public boolean equals(Object obj)
{
if (obj instanceof ServiceRequest)
- {
- ServiceRequest sr = (ServiceRequest) obj;
- return (super.equals(obj) &&
- sr.getListener().equals(listener));
- }
+ {
+ ServiceRequest sr = (ServiceRequest) obj;
+ return (super.equals(obj) &&
+ sr.getListener().equals(listener));
+ }
return false;
}
@@ -238,11 +238,11 @@ public class BeanContextServicesSupport
public boolean equals(Object obj)
{
if (obj instanceof ServiceLease)
- {
- ServiceLease sl = (ServiceLease) obj;
- return (super.equals(obj) &&
- sl.getService().equals(service));
- }
+ {
+ ServiceLease sl = (ServiceLease) obj;
+ return (super.equals(obj) &&
+ sl.getService().equals(service));
+ }
return false;
}
@@ -257,7 +257,7 @@ public class BeanContextServicesSupport
* and revocation notifications.
*/
protected transient ArrayList bcsListeners;
-
+
protected transient BCSSProxyServiceProvider proxy;
/**
@@ -297,7 +297,7 @@ public class BeanContextServicesSupport
/**
* Construct a {@link BeanContextServicesSupport} instance.
- *
+ *
* @param peer the bean context services peer (<code>null</code> permitted).
*/
public BeanContextServicesSupport (BeanContextServices peer)
@@ -307,9 +307,9 @@ public class BeanContextServicesSupport
/**
* Construct a {@link BeanContextServicesSupport} instance.
- *
+ *
* @param peer the bean context peer (<code>null</code> permitted).
- * @param locale the locale (<code>null</code> permitted, equivalent to
+ * @param locale the locale (<code>null</code> permitted, equivalent to
* the default locale).
*/
public BeanContextServicesSupport(BeanContextServices peer, Locale locale)
@@ -319,9 +319,9 @@ public class BeanContextServicesSupport
/**
* Construct a {@link BeanContextServicesSupport} instance.
- *
+ *
* @param peer the bean context peer (<code>null</code> permitted).
- * @param locale the locale (<code>null</code> permitted, equivalent to
+ * @param locale the locale (<code>null</code> permitted, equivalent to
* the default locale).
* @param dtime a flag indicating whether or not the bean context is in
* design time mode.
@@ -334,9 +334,9 @@ public class BeanContextServicesSupport
/**
* Construct a {@link BeanContextServicesSupport} instance.
- *
+ *
* @param peer the bean context peer (<code>null</code> permitted).
- * @param locale the locale (<code>null</code> permitted, equivalent to
+ * @param locale the locale (<code>null</code> permitted, equivalent to
* the default locale).
* @param dtime a flag indicating whether or not the bean context is in
* design time mode.
@@ -347,7 +347,7 @@ public class BeanContextServicesSupport
{
super(peer, locale, dtime, visible);
}
-
+
/**
* Adds a new listener for service availability and
* revocation events.
@@ -403,21 +403,21 @@ public class BeanContextServicesSupport
{
synchronized (globalHierarchyLock)
{
- synchronized (services)
- {
- if (services.containsKey(serviceClass))
- return false;
- services.put(serviceClass,
- createBCSSServiceProvider(serviceClass, bcsp));
- if (bcsp instanceof Serializable)
- ++serializable;
- if (fireEvent)
- fireServiceAdded(serviceClass);
- return true;
- }
+ synchronized (services)
+ {
+ if (services.containsKey(serviceClass))
+ return false;
+ services.put(serviceClass,
+ createBCSSServiceProvider(serviceClass, bcsp));
+ if (bcsp instanceof Serializable)
+ ++serializable;
+ if (fireEvent)
+ fireServiceAdded(serviceClass);
+ return true;
+ }
}
}
-
+
/**
* Deserializes any service providers which are serializable. This
* method is called by the <code>readObject</code> method of
@@ -436,8 +436,8 @@ public class BeanContextServicesSupport
serializable = ois.readInt();
for (int a = 0; a < serializable; ++a)
{
- BCSSServiceProvider bcsssp = (BCSSServiceProvider) ois.readObject();
- addService(bcsssp.getServiceClass(), bcsssp.getServiceProvider());
+ BCSSServiceProvider bcsssp = (BCSSServiceProvider) ois.readObject();
+ addService(bcsssp.getServiceClass(), bcsssp.getServiceProvider());
}
}
@@ -451,19 +451,19 @@ public class BeanContextServicesSupport
* @param oos the stream to which data is being serialized.
* @throws IOException if an I/O error occurs.
*/
- protected void bcsPreSerializationHook (ObjectOutputStream oos)
+ protected void bcsPreSerializationHook (ObjectOutputStream oos)
throws IOException
{
oos.writeInt(serializable);
synchronized (services)
{
- Iterator i = services.values().iterator();
- while (i.hasNext())
- {
- BCSSServiceProvider bcsssp = (BCSSServiceProvider) i.next();
- if (bcsssp.getServiceProvider() instanceof Serializable)
- oos.writeObject(bcsssp);
- }
+ Iterator i = services.values().iterator();
+ while (i.hasNext())
+ {
+ BCSSServiceProvider bcsssp = (BCSSServiceProvider) i.next();
+ if (bcsssp.getServiceProvider() instanceof Serializable)
+ oos.writeObject(bcsssp);
+ }
}
}
@@ -476,17 +476,17 @@ public class BeanContextServicesSupport
*
* @param child the child being removed.
* @param bcsc the support object for the child.
- */
+ */
protected void childJustRemovedHook (Object child,
BeanContextSupport.BCSChild bcsc)
{
if (child instanceof BeanContextChild)
{
- BeanContextChild bcchild = (BeanContextChild) child;
- Iterator childServices = ((List) serviceUsers.get(bcchild)).iterator();
- while (childServices.hasNext())
- releaseService(bcchild, this, childServices.next());
- serviceUsers.remove(bcchild);
+ BeanContextChild bcchild = (BeanContextChild) child;
+ Iterator childServices = ((List) serviceUsers.get(bcchild)).iterator();
+ while (childServices.hasNext())
+ releaseService(bcchild, this, childServices.next());
+ serviceUsers.remove(bcchild);
}
}
@@ -570,16 +570,16 @@ public class BeanContextServicesSupport
= (BeanContextServicesListener) bcsListeners.get(i);
bcsl.serviceRevoked(event);
}
- List requests = (List) serviceRequests.get(event.getServiceClass());
- if (requests != null)
- {
- Iterator i = requests.iterator();
- while (i.hasNext())
- {
- ServiceRequest r = (ServiceRequest) i.next();
- r.getListener().serviceRevoked(event);
- }
- }
+ List requests = (List) serviceRequests.get(event.getServiceClass());
+ if (requests != null)
+ {
+ Iterator i = requests.iterator();
+ while (i.hasNext())
+ {
+ ServiceRequest r = (ServiceRequest) i.next();
+ r.getListener().serviceRevoked(event);
+ }
+ }
}
}
@@ -609,20 +609,20 @@ public class BeanContextServicesSupport
}
/**
- * Returns <code>child</code> as an instance of
- * {@link BeanContextServicesListener}, or <code>null</code> if
+ * Returns <code>child</code> as an instance of
+ * {@link BeanContextServicesListener}, or <code>null</code> if
* <code>child</code> does not implement that interface.
- *
+ *
* @param child the child (<code>null</code> permitted).
- *
+ *
* @return The child cast to {@link BeanContextServicesListener}.
*/
protected static final BeanContextServicesListener
getChildBeanContextServicesListener(Object child)
{
- if (child instanceof BeanContextServicesListener)
+ if (child instanceof BeanContextServicesListener)
return (BeanContextServicesListener) child;
- else
+ else
return null;
}
@@ -636,10 +636,10 @@ public class BeanContextServicesSupport
{
synchronized (globalHierarchyLock)
{
- synchronized (services)
- {
- return services.keySet().iterator();
- }
+ synchronized (services)
+ {
+ return services.keySet().iterator();
+ }
}
}
@@ -660,16 +660,16 @@ public class BeanContextServicesSupport
{
synchronized (globalHierarchyLock)
{
- synchronized (services)
- {
- BeanContextServiceProvider bcsp
- = ((BCSSServiceProvider)
- services.get(serviceClass)).getServiceProvider();
- if (bcsp == null)
- return null;
- else
- return bcsp.getCurrentServiceSelectors(this, serviceClass);
- }
+ synchronized (services)
+ {
+ BeanContextServiceProvider bcsp
+ = ((BCSSServiceProvider)
+ services.get(serviceClass)).getServiceProvider();
+ if (bcsp == null)
+ return null;
+ else
+ return bcsp.getCurrentServiceSelectors(this, serviceClass);
+ }
}
}
@@ -699,47 +699,47 @@ public class BeanContextServicesSupport
{
synchronized (globalHierarchyLock)
{
- synchronized (services)
- {
- Object service;
- BeanContextServiceProvider provider = ((BCSSServiceProvider)
- services.get(serviceClass)).getServiceProvider();
- if (provider != null)
- {
- service = provider.getService(this, requestor, serviceClass,
- serviceSelector);
- List childServices = (List) serviceUsers.get(child);
- if (childServices == null)
- {
- childServices = new ArrayList();
- serviceUsers.put(child, childServices);
- }
- childServices.add(serviceClass);
- }
- else
- {
- BeanContextServices peer = getBeanContextServicesPeer();
- if (peer != null)
- service = peer.getService(child, requestor, serviceClass,
- serviceSelector, bcsrl);
- else
- service = null;
- }
- if (service != null)
- {
- ServiceRequest request = new ServiceRequest(requestor, bcsrl);
- Set requests = (Set) serviceRequests.get(serviceClass);
- if (requests == null)
- {
- requests = new HashSet();
- serviceRequests.put(serviceClass, requests);
- }
- requests.add(request);
- ServiceLease lease = new ServiceLease(requestor, service);
- serviceLeases.put(lease, provider);
- }
- return service;
- }
+ synchronized (services)
+ {
+ Object service;
+ BeanContextServiceProvider provider = ((BCSSServiceProvider)
+ services.get(serviceClass)).getServiceProvider();
+ if (provider != null)
+ {
+ service = provider.getService(this, requestor, serviceClass,
+ serviceSelector);
+ List childServices = (List) serviceUsers.get(child);
+ if (childServices == null)
+ {
+ childServices = new ArrayList();
+ serviceUsers.put(child, childServices);
+ }
+ childServices.add(serviceClass);
+ }
+ else
+ {
+ BeanContextServices peer = getBeanContextServicesPeer();
+ if (peer != null)
+ service = peer.getService(child, requestor, serviceClass,
+ serviceSelector, bcsrl);
+ else
+ service = null;
+ }
+ if (service != null)
+ {
+ ServiceRequest request = new ServiceRequest(requestor, bcsrl);
+ Set requests = (Set) serviceRequests.get(serviceClass);
+ if (requests == null)
+ {
+ requests = new HashSet();
+ serviceRequests.put(serviceClass, requests);
+ }
+ requests.add(request);
+ ServiceLease lease = new ServiceLease(requestor, service);
+ serviceLeases.put(lease, provider);
+ }
+ return service;
+ }
}
}
@@ -753,10 +753,10 @@ public class BeanContextServicesSupport
{
synchronized (globalHierarchyLock)
{
- synchronized (services)
- {
- return services.containsKey(serviceClass);
- }
+ synchronized (services)
+ {
+ return services.containsKey(serviceClass);
+ }
}
}
@@ -784,7 +784,7 @@ public class BeanContextServicesSupport
* Relinquishes any resources obtained from the parent context.
* Specifically, those services obtained from the parent are revoked.
* Subclasses may override this method to deallocate resources
- * from the nesting bean context.
+ * from the nesting bean context.
*/
protected void releaseBeanContextResources()
{
@@ -806,21 +806,21 @@ public class BeanContextServicesSupport
{
synchronized (globalHierarchyLock)
{
- synchronized (services)
- {
- ServiceLease lease = new ServiceLease(requestor, service);
- BeanContextServiceProvider provider = (BeanContextServiceProvider)
- serviceLeases.get(lease);
- if (provider != null)
- provider.releaseService(this, requestor, service);
- else
- {
- BeanContextServices peer = getBeanContextServicesPeer();
- if (peer != null)
- peer.releaseService(child, requestor, service);
- }
- serviceLeases.remove(lease);
- }
+ synchronized (services)
+ {
+ ServiceLease lease = new ServiceLease(requestor, service);
+ BeanContextServiceProvider provider = (BeanContextServiceProvider)
+ serviceLeases.get(lease);
+ if (provider != null)
+ provider.releaseService(this, requestor, service);
+ else
+ {
+ BeanContextServices peer = getBeanContextServicesPeer();
+ if (peer != null)
+ peer.releaseService(child, requestor, service);
+ }
+ serviceLeases.remove(lease);
+ }
}
}
@@ -829,7 +829,7 @@ public class BeanContextServicesSupport
{
synchronized (bcsListeners)
{
- bcsListeners.remove(listener);
+ bcsListeners.remove(listener);
}
}
@@ -850,13 +850,13 @@ public class BeanContextServicesSupport
{
synchronized (globalHierarchyLock)
{
- synchronized (services)
- {
- fireServiceRevoked(serviceClass, revokeCurrentServicesNow);
- services.remove(serviceClass);
- if (bcsp instanceof Serializable)
- --serializable;
- }
+ synchronized (services)
+ {
+ fireServiceRevoked(serviceClass, revokeCurrentServicesNow);
+ services.remove(serviceClass);
+ if (bcsp instanceof Serializable)
+ --serializable;
+ }
}
}
diff --git a/java/beans/beancontext/BeanContextSupport.java b/java/beans/beancontext/BeanContextSupport.java
index 7572af3f0..fdae387d4 100644
--- a/java/beans/beancontext/BeanContextSupport.java
+++ b/java/beans/beancontext/BeanContextSupport.java
@@ -188,7 +188,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Construct a BeanContextSupport instance.
- *
+ *
* @param peer the bean context peer (<code>null</code> permitted).
*/
public BeanContextSupport(BeanContext peer)
@@ -198,9 +198,9 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Construct a BeanContextSupport instance.
- *
+ *
* @param peer the bean context peer (<code>null</code> permitted).
- * @param locale the locale (<code>null</code> permitted, equivalent to
+ * @param locale the locale (<code>null</code> permitted, equivalent to
* the default locale).
*/
public BeanContextSupport (BeanContext peer, Locale locale)
@@ -210,9 +210,9 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Construct a BeanContextSupport instance.
- *
+ *
* @param peer the bean context peer (<code>null</code> permitted).
- * @param locale the locale (<code>null</code> permitted, equivalent to
+ * @param locale the locale (<code>null</code> permitted, equivalent to
* the default locale).
* @param dtime a flag indicating whether or not the bean context is in
* design time mode.
@@ -224,9 +224,9 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Construct a BeanContextSupport instance.
- *
+ *
* @param peer the bean context peer (<code>null</code> permitted).
- * @param locale the locale (<code>null</code> permitted, equivalent to
+ * @param locale the locale (<code>null</code> permitted, equivalent to
* the default locale).
* @param dtime a flag indicating whether or not the bean context is in
* design time mode.
@@ -248,7 +248,7 @@ public class BeanContextSupport extends BeanContextChildSupport
* <p>
* Add a child to the bean context. A child can be a simple
* <code>Object</code>, a <code>BeanContextChild</code>
- * or another <code>BeanContext</code>.
+ * or another <code>BeanContext</code>.
* </p>
* <p>
* The children of a <code>BeanContext</code> form a set. As
@@ -272,7 +272,7 @@ public class BeanContextSupport extends BeanContextChildSupport
* then its ability to use a GUI is set based on that of
* this context.
* </p>
- * <p>
+ * <p>
* A <code>BeanContextMembershipEvent</code> is fired when the
* child is successfully added to the bean context.
* </p>
@@ -290,55 +290,55 @@ public class BeanContextSupport extends BeanContextChildSupport
{
synchronized (globalHierarchyLock)
{
- if (targetChild == null)
- throw new IllegalArgumentException();
-
- BCSChild child;
- synchronized (children)
- {
- if (children.containsKey(targetChild)
- || ! validatePendingAdd(targetChild))
- return false;
- child = createBCSChild(targetChild, beanContextChildPeer);
- children.put(targetChild, child);
- }
- synchronized (targetChild)
- {
- BeanContextChild bcChild = null;
- if (targetChild instanceof BeanContextChild)
- bcChild = (BeanContextChild) targetChild;
- if (targetChild instanceof BeanContextProxy)
- bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy();
- if (bcChild != null)
- try
- {
- bcChild.setBeanContext(this);
- bcChild.addVetoableChangeListener("beanContext", this);
- bcChild.addPropertyChangeListener("beanContext", this);
- }
- catch (PropertyVetoException e)
- {
- synchronized (children)
- {
- children.remove(targetChild);
- }
- throw new IllegalStateException("The child refused to " +
- "associate itself with " +
- "this context.", e);
- }
- if (targetChild instanceof Visibility)
- {
- Visibility visibleChild = (Visibility) targetChild;
- if (okToUseGui)
- visibleChild.okToUseGui();
- else
- visibleChild.dontUseGui();
- }
- childJustAddedHook(targetChild, child);
- }
- fireChildrenAdded(new BeanContextMembershipEvent(this,
- new Object[]{ targetChild }));
- return true;
+ if (targetChild == null)
+ throw new IllegalArgumentException();
+
+ BCSChild child;
+ synchronized (children)
+ {
+ if (children.containsKey(targetChild)
+ || ! validatePendingAdd(targetChild))
+ return false;
+ child = createBCSChild(targetChild, beanContextChildPeer);
+ children.put(targetChild, child);
+ }
+ synchronized (targetChild)
+ {
+ BeanContextChild bcChild = null;
+ if (targetChild instanceof BeanContextChild)
+ bcChild = (BeanContextChild) targetChild;
+ if (targetChild instanceof BeanContextProxy)
+ bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy();
+ if (bcChild != null)
+ try
+ {
+ bcChild.setBeanContext(this);
+ bcChild.addVetoableChangeListener("beanContext", this);
+ bcChild.addPropertyChangeListener("beanContext", this);
+ }
+ catch (PropertyVetoException e)
+ {
+ synchronized (children)
+ {
+ children.remove(targetChild);
+ }
+ throw new IllegalStateException("The child refused to " +
+ "associate itself with " +
+ "this context.", e);
+ }
+ if (targetChild instanceof Visibility)
+ {
+ Visibility visibleChild = (Visibility) targetChild;
+ if (okToUseGui)
+ visibleChild.okToUseGui();
+ else
+ visibleChild.dontUseGui();
+ }
+ childJustAddedHook(targetChild, child);
+ }
+ fireChildrenAdded(new BeanContextMembershipEvent(this,
+ new Object[]{ targetChild }));
+ return true;
}
}
@@ -415,7 +415,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Called when a child is deserialized.
- *
+ *
* @param child the deserialized child.
* @param bcsc the deserialized context wrapper for the child.
*/
@@ -489,16 +489,16 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
- * Deserializes objects (written by {@link #serialize(ObjectOutputStream,
+ * Deserializes objects (written by {@link #serialize(ObjectOutputStream,
* Collection)}) and adds them to the specified collection.
- *
+ *
* @param ois the input stream (<code>null</code> not permitted).
* @param coll the collection to add the objects to (<code>null</code> not
* permitted).
- *
+ *
* @throws ClassNotFoundException
* @throws IOException
- *
+ *
* @see #serialize(ObjectOutputStream, Collection)
*/
protected final void deserialize (ObjectInputStream ois, Collection coll)
@@ -548,9 +548,9 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Returns the bean context peer.
- *
+ *
* @return The bean context peer.
- *
+ *
* @see BeanContextChildSupport#beanContextChildPeer
*/
public BeanContext getBeanContextPeer()
@@ -560,11 +560,11 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Returns the {@link BeanContextChild} implementation for the given child.
- *
+ *
* @param child the child (<code>null</code> permitted).
- *
+ *
* @return The bean context child.
- *
+ *
* @throws IllegalArgumentException if <code>child</code> implements both
* the {@link BeanContextChild} and {@link BeanContextProxy} interfaces.
*/
@@ -573,7 +573,7 @@ public class BeanContextSupport extends BeanContextChildSupport
if (child == null)
return null;
if (child instanceof BeanContextChild && child instanceof BeanContextProxy)
- throw new IllegalArgumentException("Child cannot implement "
+ throw new IllegalArgumentException("Child cannot implement "
+ "BeanContextChild and BeanContextProxy simultaneously.");
if (child instanceof BeanContextChild)
return (BeanContextChild) child;
@@ -583,89 +583,89 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
- * Returns <code>child</code> as an instance of
- * {@link BeanContextMembershipListener}, or <code>null</code> if
+ * Returns <code>child</code> as an instance of
+ * {@link BeanContextMembershipListener}, or <code>null</code> if
* <code>child</code> does not implement that interface.
- *
+ *
* @param child the child (<code>null</code> permitted).
- *
+ *
* @return The child cast to {@link BeanContextMembershipListener}.
*/
- protected static final BeanContextMembershipListener
+ protected static final BeanContextMembershipListener
getChildBeanContextMembershipListener(Object child)
{
- if (child instanceof BeanContextMembershipListener)
+ if (child instanceof BeanContextMembershipListener)
return (BeanContextMembershipListener) child;
- else
+ else
return null;
}
/**
- * Returns <code>child</code> as an instance of
+ * Returns <code>child</code> as an instance of
* {@link PropertyChangeListener}, or <code>null</code> if <code>child</code>
* does not implement that interface.
- *
+ *
* @param child the child (<code>null</code> permitted).
- *
+ *
* @return The child cast to {@link PropertyChangeListener}.
*/
protected static final PropertyChangeListener getChildPropertyChangeListener(
Object child)
{
- if (child instanceof PropertyChangeListener)
+ if (child instanceof PropertyChangeListener)
return (PropertyChangeListener) child;
- else
+ else
return null;
}
/**
- * Returns <code>child</code> as an instance of {@link Serializable}, or
- * <code>null</code> if <code>child</code> does not implement that
+ * Returns <code>child</code> as an instance of {@link Serializable}, or
+ * <code>null</code> if <code>child</code> does not implement that
* interface.
- *
+ *
* @param child the child (<code>null</code> permitted).
- *
+ *
* @return The child cast to {@link Serializable}.
*/
protected static final Serializable getChildSerializable(Object child)
{
- if (child instanceof Serializable)
+ if (child instanceof Serializable)
return (Serializable) child;
- else
+ else
return null;
}
/**
- * Returns <code>child</code> as an instance of
+ * Returns <code>child</code> as an instance of
* {@link VetoableChangeListener}, or <code>null</code> if <code>child</code>
* does not implement that interface.
- *
+ *
* @param child the child (<code>null</code> permitted).
- *
+ *
* @return The child cast to {@link VetoableChangeListener}.
*/
protected static final VetoableChangeListener getChildVetoableChangeListener(
Object child)
{
- if (child instanceof VetoableChangeListener)
+ if (child instanceof VetoableChangeListener)
return (VetoableChangeListener) child;
- else
+ else
return null;
}
/**
* Returns <code>child</code> as an instance of {@link Visibility}, or
* <code>null</code> if <code>child</code> does not implement that interface.
- *
+ *
* @param child the child (<code>null</code> permitted).
- *
+ *
* @return The child cast to {@link Visibility}.
*/
protected static final Visibility getChildVisibility(Object child)
{
- if (child instanceof Visibility)
+ if (child instanceof Visibility)
return (Visibility) child;
- else
+ else
return null;
}
@@ -715,11 +715,11 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
- * Returns <code>true</code> if the <code>BeanContext</code> is in
+ * Returns <code>true</code> if the <code>BeanContext</code> is in
* design time mode, and <code>false</code> if it is in runtime mode.
- *
+ *
* @return A boolean.
- *
+ *
* @see #setDesignTime(boolean)
*/
public boolean isDesignTime()
@@ -810,15 +810,15 @@ public class BeanContextSupport extends BeanContextChildSupport
Iterator i = temp.iterator();
synchronized (globalHierarchyLock)
{
- synchronized (children)
- {
- while (i.hasNext())
- {
- BCSChild bcs = (BCSChild) i.next();
- childDeserializedHook(bcs.getTargetChild(), bcs);
- children.put(bcs.getTargetChild(), bcs);
- }
- }
+ synchronized (children)
+ {
+ while (i.hasNext())
+ {
+ BCSChild bcs = (BCSChild) i.next();
+ childDeserializedHook(bcs.getTargetChild(), bcs);
+ children.put(bcs.getTargetChild(), bcs);
+ }
+ }
}
}
@@ -854,7 +854,7 @@ public class BeanContextSupport extends BeanContextChildSupport
* <code>PropertyChangeListener</code> and
* <code>VetoableChangeListener</code> for "beanContext" events.
* </p>
- * <p>
+ * <p>
* A <code>BeanContextMembershipEvent</code> is fired when the
* child is successfully removed from the bean context.
* </p>
@@ -874,47 +874,47 @@ public class BeanContextSupport extends BeanContextChildSupport
{
synchronized (globalHierarchyLock)
{
- if (targetChild == null)
- throw new IllegalArgumentException();
-
- BCSChild child;
- synchronized (children)
- {
- if (!children.containsKey(targetChild)
- || !validatePendingRemove(targetChild))
- return false;
- child = (BCSChild) children.remove(targetChild);
- }
- synchronized (targetChild)
- {
- BeanContextChild bcChild = null;
- if (targetChild instanceof BeanContextChild)
- bcChild = (BeanContextChild) targetChild;
- if (targetChild instanceof BeanContextProxy)
- bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy();
- if (bcChild != null)
- try
- {
- if (callChildSetBC)
- bcChild.setBeanContext(null);
- bcChild.removeVetoableChangeListener("beanContext", this);
- bcChild.removePropertyChangeListener("beanContext", this);
- }
- catch (PropertyVetoException e)
- {
- synchronized (children)
- {
- children.put(targetChild, child);
- }
- throw new IllegalStateException("The child refused to " +
- "disassociate itself with " +
- "this context.", e);
- }
- childJustRemovedHook(targetChild, child);
- }
- fireChildrenRemoved(new BeanContextMembershipEvent(this,
- new Object[]{ targetChild }));
- return true;
+ if (targetChild == null)
+ throw new IllegalArgumentException();
+
+ BCSChild child;
+ synchronized (children)
+ {
+ if (!children.containsKey(targetChild)
+ || !validatePendingRemove(targetChild))
+ return false;
+ child = (BCSChild) children.remove(targetChild);
+ }
+ synchronized (targetChild)
+ {
+ BeanContextChild bcChild = null;
+ if (targetChild instanceof BeanContextChild)
+ bcChild = (BeanContextChild) targetChild;
+ if (targetChild instanceof BeanContextProxy)
+ bcChild = ((BeanContextProxy) targetChild).getBeanContextProxy();
+ if (bcChild != null)
+ try
+ {
+ if (callChildSetBC)
+ bcChild.setBeanContext(null);
+ bcChild.removeVetoableChangeListener("beanContext", this);
+ bcChild.removePropertyChangeListener("beanContext", this);
+ }
+ catch (PropertyVetoException e)
+ {
+ synchronized (children)
+ {
+ children.put(targetChild, child);
+ }
+ throw new IllegalStateException("The child refused to " +
+ "disassociate itself with " +
+ "this context.", e);
+ }
+ childJustRemovedHook(targetChild, child);
+ }
+ fireChildrenRemoved(new BeanContextMembershipEvent(this,
+ new Object[]{ targetChild }));
+ return true;
}
}
@@ -940,14 +940,14 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Writes the items in the collection to the specified output stream. Items
- * in the collection that are not instances of {@link Serializable}
+ * in the collection that are not instances of {@link Serializable}
* (this includes <code>null</code>) are simply ignored.
- *
+ *
* @param oos the output stream (<code>null</code> not permitted).
* @param coll the collection (<code>null</code> not permitted).
- *
+ *
* @throws IOException
- *
+ *
* @see #deserialize(ObjectInputStream, Collection)
*/
protected final void serialize(ObjectOutputStream oos, Collection coll)
@@ -969,15 +969,15 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
- * Sets the flag that indicates whether or not the
+ * Sets the flag that indicates whether or not the
* <code>BeanContext</code> is in design mode. If the flag changes
* value, a {@link PropertyChangeEvent} (with the property name 'designMode')
* is sent to registered listeners. Note that the property name used here
* does NOT match the specification in the {@link DesignMode} interface, we
* match the reference implementation instead - see bug parade entry 4295174.
- *
+ *
* @param dtime the new value for the flag.
- *
+ *
* @see #isDesignTime()
*/
public void setDesignTime(boolean dtime)
@@ -1011,7 +1011,7 @@ public class BeanContextSupport extends BeanContextChildSupport
/**
* Returns an array containing the children of this <code>BeanContext</code>.
- *
+ *
* @return An array containing the children.
*/
public Object[] toArray()
@@ -1023,11 +1023,11 @@ public class BeanContextSupport extends BeanContextChildSupport
}
/**
- * Populates, then returns, the supplied array with the children of this
- * <code>BeanContext</code>. If the array is too short to hold the
- * children, a new array is allocated and returned. If the array is too
+ * Populates, then returns, the supplied array with the children of this
+ * <code>BeanContext</code>. If the array is too short to hold the
+ * children, a new array is allocated and returned. If the array is too
* long, it is padded with <code>null</code> items at the end.
- *
+ *
* @param array an array to populate (<code>null</code> not permitted).
*/
public Object[] toArray(Object[] array)
@@ -1072,7 +1072,7 @@ public class BeanContextSupport extends BeanContextChildSupport
{
synchronized (children)
{
- serialize(oos, children.values());
+ serialize(oos, children.values());
}
}
diff --git a/java/io/BufferedInputStream.java b/java/io/BufferedInputStream.java
index 6fb024614..7013b0948 100644
--- a/java/io/BufferedInputStream.java
+++ b/java/io/BufferedInputStream.java
@@ -35,7 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
+
package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -43,11 +43,11 @@ package java.io;
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
-
+
/**
- * This subclass of <code>FilterInputStream</code> buffers input from an
+ * This subclass of <code>FilterInputStream</code> buffers input from an
* underlying implementation to provide a possibly more efficient read
- * mechanism. It maintains the buffer and buffer state in instance
+ * mechanism. It maintains the buffer and buffer state in instance
* variables that are available to subclasses. The default buffer size
* of 2048 bytes can be overridden by the creator of the stream.
* <p>
@@ -90,13 +90,13 @@ public class BufferedInputStream extends FilterInputStream
/**
* The value of <code>pos</code> when the <code>mark()</code> method was
- * called.
+ * called.
* This is set to -1 if there is no mark set.
*/
protected int markpos = -1;
/**
- * This is the maximum number of bytes than can be read after a
+ * This is the maximum number of bytes than can be read after a
* call to <code>mark()</code> before the mark can be discarded.
* After this may bytes are read, the <code>reset()</code> method
* may not be called successfully.
@@ -148,7 +148,7 @@ public class BufferedInputStream extends FilterInputStream
* stream before a read can block. A return of 0 indicates that blocking
* might (or might not) occur on the very next read attempt.
* <p>
- * The number of available bytes will be the number of read ahead bytes
+ * The number of available bytes will be the number of read ahead bytes
* stored in the internal buffer plus the number of available bytes in
* the underlying stream.
*
@@ -179,7 +179,7 @@ public class BufferedInputStream extends FilterInputStream
/**
* This method marks a position in the input to which the stream can be
* "reset" by calling the <code>reset()</code> method. The parameter
- * <code>readlimit</code> is the number of bytes that can be read from the
+ * <code>readlimit</code> is the number of bytes that can be read from the
* stream after setting the mark before the mark becomes invalid. For
* example, if <code>mark()</code> is called with a read limit of 10, then
* when 11 bytes of data are read from the stream before the
@@ -227,7 +227,7 @@ public class BufferedInputStream extends FilterInputStream
public synchronized int read() throws IOException
{
if (pos >= count && !refill())
- return -1; // EOF
+ return -1; // EOF
return buf[pos++] & 0xFF;
}
@@ -265,7 +265,7 @@ public class BufferedInputStream extends FilterInputStream
return 0;
if (pos >= count && !refill())
- return -1; // No bytes were read before EOF.
+ return -1; // No bytes were read before EOF.
int totalBytesRead = Math.min(count - pos, len);
System.arraycopy(buf, pos, b, off, totalBytesRead);
@@ -275,12 +275,12 @@ public class BufferedInputStream extends FilterInputStream
while (len > 0 && super.available() > 0 && refill())
{
- int remain = Math.min(count - pos, len);
- System.arraycopy(buf, pos, b, off, remain);
- pos += remain;
- off += remain;
- len -= remain;
- totalBytesRead += remain;
+ int remain = Math.min(count - pos, len);
+ System.arraycopy(buf, pos, b, off, remain);
+ pos += remain;
+ off += remain;
+ len -= remain;
+ totalBytesRead += remain;
}
return totalBytesRead;
@@ -327,12 +327,12 @@ public class BufferedInputStream extends FilterInputStream
while (n > 0L)
{
- if (pos >= count && !refill())
+ if (pos >= count && !refill())
break;
- int numread = (int) Math.min((long) (count - pos), n);
- pos += numread;
- n -= numread;
+ int numread = (int) Math.min((long) (count - pos), n);
+ pos += numread;
+ n -= numread;
}
return origN - n;
@@ -351,26 +351,26 @@ public class BufferedInputStream extends FilterInputStream
if (markpos == -1 || count - markpos >= marklimit)
{
- markpos = -1;
- pos = count = 0;
+ markpos = -1;
+ pos = count = 0;
}
else
{
- byte[] newbuf = buf;
- if (markpos < bufferSize)
- {
- newbuf = new byte[count - markpos + bufferSize];
- }
- System.arraycopy(buf, markpos, newbuf, 0, count - markpos);
- buf = newbuf;
- count -= markpos;
- pos -= markpos;
- markpos = 0;
+ byte[] newbuf = buf;
+ if (markpos < bufferSize)
+ {
+ newbuf = new byte[count - markpos + bufferSize];
+ }
+ System.arraycopy(buf, markpos, newbuf, 0, count - markpos);
+ buf = newbuf;
+ count -= markpos;
+ pos -= markpos;
+ markpos = 0;
}
int numread = super.read(buf, count, bufferSize);
- if (numread <= 0) // EOF
+ if (numread <= 0) // EOF
return false;
count += numread;
diff --git a/java/io/BufferedOutputStream.java b/java/io/BufferedOutputStream.java
index ce7ebc7e9..e6027cad6 100644
--- a/java/io/BufferedOutputStream.java
+++ b/java/io/BufferedOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -112,7 +112,7 @@ public class BufferedOutputStream extends FilterOutputStream
}
/**
- * This method flushes any remaining buffered bytes then closes the
+ * This method flushes any remaining buffered bytes then closes the
* underlying output stream. Any further attempts to write to this stream
* may throw an exception
*
@@ -124,7 +124,7 @@ public class BufferedOutputStream extends FilterOutputStream
*/
/**
- * This method runs when the object is garbage collected. It is
+ * This method runs when the object is garbage collected. It is
* responsible for ensuring that all buffered bytes are written and
* for closing the underlying stream.
*
@@ -156,8 +156,8 @@ public class BufferedOutputStream extends FilterOutputStream
}
/**
- * This method writes <code>len</code> bytes from the byte array
- * <code>buf</code> starting at position <code>offset</code> in the buffer.
+ * This method writes <code>len</code> bytes from the byte array
+ * <code>buf</code> starting at position <code>offset</code> in the buffer.
* These bytes will be written to the internal buffer. However, if this
* write operation fills the buffer, the buffer will be flushed to the
* underlying output stream.
@@ -168,7 +168,7 @@ public class BufferedOutputStream extends FilterOutputStream
*
* @exception IOException If an error occurs
*/
- public synchronized void write(byte[] buf, int offset, int len)
+ public synchronized void write(byte[] buf, int offset, int len)
throws IOException
{
// Buffer can hold everything. Note that the case where LEN < 0
@@ -188,5 +188,4 @@ public class BufferedOutputStream extends FilterOutputStream
}
}
-} // class BufferedOutputStream
-
+} // class BufferedOutputStream
diff --git a/java/io/BufferedReader.java b/java/io/BufferedReader.java
index 3dbe80b77..868fa3a94 100644
--- a/java/io/BufferedReader.java
+++ b/java/io/BufferedReader.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -47,9 +47,9 @@ import gnu.java.lang.CPStringBuilder;
*/
/**
- * This subclass of <code>FilterReader</code> buffers input from an
+ * This subclass of <code>FilterReader</code> buffers input from an
* underlying implementation to provide a possibly more efficient read
- * mechanism. It maintains the buffer and buffer state in instance
+ * mechanism. It maintains the buffer and buffer state in instance
* variables that are available to subclasses. The default buffer size
* of 8192 chars can be overridden by the creator of the stream.
* <p>
@@ -91,7 +91,7 @@ public class BufferedReader extends Reader
static final int DEFAULT_BUFFER_SIZE = 8192;
/**
- * Create a new <code>BufferedReader</code> that will read from the
+ * Create a new <code>BufferedReader</code> that will read from the
* specified subordinate stream with a default buffer size of 8192 chars.
*
* @param in The subordinate stream to read from
@@ -102,8 +102,8 @@ public class BufferedReader extends Reader
}
/**
- * Create a new <code>BufferedReader</code> that will read from the
- * specified subordinate stream with a buffer size that is specified by the
+ * Create a new <code>BufferedReader</code> that will read from the
+ * specified subordinate stream with a buffer size that is specified by the
* caller.
*
* @param in The subordinate stream to read from
@@ -130,15 +130,15 @@ public class BufferedReader extends Reader
{
synchronized (lock)
{
- if (in != null)
- in.close();
- in = null;
- buffer = null;
+ if (in != null)
+ in.close();
+ in = null;
+ buffer = null;
}
}
/**
- * Returns <code>true</code> to indicate that this class supports mark/reset
+ * Returns <code>true</code> to indicate that this class supports mark/reset
* functionality.
*
* @return <code>true</code>
@@ -151,11 +151,11 @@ public class BufferedReader extends Reader
/**
* Mark a position in the input to which the stream can be
* "reset" by calling the <code>reset()</code> method. The parameter
- * <code>readLimit</code> is the number of chars that can be read from the
+ * <code>readLimit</code> is the number of chars that can be read from the
* stream after setting the mark before the mark becomes invalid. For
- * example, if <code>mark()</code> is called with a read limit of 10, then
- * when 11 chars of data are read from the stream before the
- * <code>reset()</code> method is called, then the mark is invalid and the
+ * example, if <code>mark()</code> is called with a read limit of 10, then
+ * when 11 chars of data are read from the stream before the
+ * <code>reset()</code> method is called, then the mark is invalid and the
* stream object instance is not required to remember the mark.
* <p>
* Note that the number of chars that can be remembered by this method
@@ -163,7 +163,7 @@ public class BufferedReader extends Reader
* not dependent on the subordinate stream supporting mark/reset
* functionality.
*
- * @param readLimit The number of chars that can be read before the mark
+ * @param readLimit The number of chars that can be read before the mark
* becomes invalid
*
* @exception IOException If an error occurs
@@ -176,45 +176,45 @@ public class BufferedReader extends Reader
synchronized (lock)
{
- checkStatus();
- // In this method we need to be aware of the special case where
- // pos + 1 == limit. This indicates that a '\r' was the last char
- // in the buffer during a readLine. We'll want to maintain that
- // condition after we shift things around and if a larger buffer is
- // needed to track readLimit, we'll have to make it one element
- // larger to ensure we don't invalidate the mark too early, if the
- // char following the '\r' is NOT a '\n'. This is ok because, per
- // the spec, we are not required to invalidate when passing readLimit.
- //
- // Note that if 'pos > limit', then doing 'limit -= pos' will cause
- // limit to be negative. This is the only way limit will be < 0.
-
- if (pos + readLimit > limit)
- {
- char[] old_buffer = buffer;
- int extraBuffSpace = 0;
- if (pos > limit)
- extraBuffSpace = 1;
- if (readLimit + extraBuffSpace > limit)
- buffer = new char[readLimit + extraBuffSpace];
- limit -= pos;
- if (limit >= 0)
- {
- System.arraycopy(old_buffer, pos, buffer, 0, limit);
- pos = 0;
- }
- }
-
- if (limit < 0)
- {
- // Maintain the relationship of 'pos > limit'.
- pos = 1;
- limit = markPos = 0;
- }
- else
- markPos = pos;
- // Now pos + readLimit <= buffer.length. thus if we need to read
- // beyond buffer.length, then we are allowed to invalidate markPos.
+ checkStatus();
+ // In this method we need to be aware of the special case where
+ // pos + 1 == limit. This indicates that a '\r' was the last char
+ // in the buffer during a readLine. We'll want to maintain that
+ // condition after we shift things around and if a larger buffer is
+ // needed to track readLimit, we'll have to make it one element
+ // larger to ensure we don't invalidate the mark too early, if the
+ // char following the '\r' is NOT a '\n'. This is ok because, per
+ // the spec, we are not required to invalidate when passing readLimit.
+ //
+ // Note that if 'pos > limit', then doing 'limit -= pos' will cause
+ // limit to be negative. This is the only way limit will be < 0.
+
+ if (pos + readLimit > limit)
+ {
+ char[] old_buffer = buffer;
+ int extraBuffSpace = 0;
+ if (pos > limit)
+ extraBuffSpace = 1;
+ if (readLimit + extraBuffSpace > limit)
+ buffer = new char[readLimit + extraBuffSpace];
+ limit -= pos;
+ if (limit >= 0)
+ {
+ System.arraycopy(old_buffer, pos, buffer, 0, limit);
+ pos = 0;
+ }
+ }
+
+ if (limit < 0)
+ {
+ // Maintain the relationship of 'pos > limit'.
+ pos = 1;
+ limit = markPos = 0;
+ }
+ else
+ markPos = pos;
+ // Now pos + readLimit <= buffer.length. thus if we need to read
+ // beyond buffer.length, then we are allowed to invalidate markPos.
}
}
@@ -233,20 +233,20 @@ public class BufferedReader extends Reader
{
synchronized (lock)
{
- checkStatus();
- if (markPos < 0)
- throw new IOException("mark never set or invalidated");
-
- // Need to handle the extremely unlikely case where a readLine was
- // done with a '\r' as the last char in the buffer; which was then
- // immediately followed by a mark and a reset with NO intervening
- // read of any sort. In that case, setting pos to markPos would
- // lose that info and a subsequent read would thus not skip a '\n'
- // (if one exists). The value of limit in this rare case is zero.
- // We can assume that if limit is zero for other reasons, then
- // pos is already set to zero and doesn't need to be readjusted.
- if (limit > 0)
- pos = markPos;
+ checkStatus();
+ if (markPos < 0)
+ throw new IOException("mark never set or invalidated");
+
+ // Need to handle the extremely unlikely case where a readLine was
+ // done with a '\r' as the last char in the buffer; which was then
+ // immediately followed by a mark and a reset with NO intervening
+ // read of any sort. In that case, setting pos to markPos would
+ // lose that info and a subsequent read would thus not skip a '\n'
+ // (if one exists). The value of limit in this rare case is zero.
+ // We can assume that if limit is zero for other reasons, then
+ // pos is already set to zero and doesn't need to be readjusted.
+ if (limit > 0)
+ pos = markPos;
}
}
@@ -255,7 +255,7 @@ public class BufferedReader extends Reader
* this method returns <code>false</code> then this stream could (but is
* not guaranteed to) block on the next read attempt.
*
- * @return <code>true</code> if this stream is ready to be read,
+ * @return <code>true</code> if this stream is ready to be read,
* <code>false</code> otherwise
*
* @exception IOException If an error occurs
@@ -264,14 +264,14 @@ public class BufferedReader extends Reader
{
synchronized (lock)
{
- checkStatus();
- return pos < limit || in.ready();
+ checkStatus();
+ return pos < limit || in.ready();
}
}
/**
* This method read chars from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index
+ * supplied buffer. It starts storing the data at index
* <code>offset</code> into
* the buffer and attempts to read <code>len</code> chars. This method can
* return before reading the number of chars requested. The actual number
@@ -297,53 +297,53 @@ public class BufferedReader extends Reader
synchronized (lock)
{
- checkStatus();
- // Once again, we need to handle the special case of a readLine
- // that has a '\r' at the end of the buffer. In this case, we'll
- // need to skip a '\n' if it is the next char to be read.
- // This special case is indicated by 'pos > limit'.
- boolean retAtEndOfBuffer = false;
-
- int avail = limit - pos;
- if (count > avail)
- {
- if (avail > 0)
- count = avail;
- else // pos >= limit
- {
- if (limit == buffer.length)
- markPos = -1; // read too far - invalidate the mark.
- if (pos > limit)
- {
- // Set a boolean and make pos == limit to simplify things.
- retAtEndOfBuffer = true;
- --pos;
- }
- if (markPos < 0)
- {
- // Optimization: can read directly into buf.
- if (count >= buffer.length && !retAtEndOfBuffer)
- return in.read(buf, offset, count);
- pos = limit = 0;
- }
- avail = in.read(buffer, limit, buffer.length - limit);
- if (retAtEndOfBuffer && avail > 0 && buffer[limit] == '\n')
- {
- --avail;
- limit++;
- }
- if (avail < count)
- {
- if (avail <= 0)
- return avail;
- count = avail;
- }
- limit += avail;
- }
- }
- System.arraycopy(buffer, pos, buf, offset, count);
- pos += count;
- return count;
+ checkStatus();
+ // Once again, we need to handle the special case of a readLine
+ // that has a '\r' at the end of the buffer. In this case, we'll
+ // need to skip a '\n' if it is the next char to be read.
+ // This special case is indicated by 'pos > limit'.
+ boolean retAtEndOfBuffer = false;
+
+ int avail = limit - pos;
+ if (count > avail)
+ {
+ if (avail > 0)
+ count = avail;
+ else // pos >= limit
+ {
+ if (limit == buffer.length)
+ markPos = -1; // read too far - invalidate the mark.
+ if (pos > limit)
+ {
+ // Set a boolean and make pos == limit to simplify things.
+ retAtEndOfBuffer = true;
+ --pos;
+ }
+ if (markPos < 0)
+ {
+ // Optimization: can read directly into buf.
+ if (count >= buffer.length && !retAtEndOfBuffer)
+ return in.read(buf, offset, count);
+ pos = limit = 0;
+ }
+ avail = in.read(buffer, limit, buffer.length - limit);
+ if (retAtEndOfBuffer && avail > 0 && buffer[limit] == '\n')
+ {
+ --avail;
+ limit++;
+ }
+ if (avail < count)
+ {
+ if (avail <= 0)
+ return avail;
+ count = avail;
+ }
+ limit += avail;
+ }
+ }
+ System.arraycopy(buffer, pos, buf, offset, count);
+ pos += count;
+ return count;
}
}
@@ -360,7 +360,7 @@ public class BufferedReader extends Reader
if (pos > limit)
{
retAtEndOfBuffer = true;
- --pos;
+ --pos;
}
if (markPos >= 0 && limit == buffer.length)
@@ -373,26 +373,26 @@ public class BufferedReader extends Reader
if (retAtEndOfBuffer && buffer[pos] == '\n')
{
- --count;
- // If the mark was set to the location of the \n, then we
- // must change it to fully pretend that the \n does not
- // exist.
- if (markPos == pos)
- ++markPos;
- ++pos;
+ --count;
+ // If the mark was set to the location of the \n, then we
+ // must change it to fully pretend that the \n does not
+ // exist.
+ if (markPos == pos)
+ ++markPos;
+ ++pos;
}
return count;
}
-
+
public int read() throws IOException
{
synchronized (lock)
{
- checkStatus();
- if (pos >= limit && fill () <= 0)
- return -1;
- return buffer[pos++];
+ checkStatus();
+ if (pos >= limit && fill () <= 0)
+ return -1;
+ return buffer[pos++];
}
}
@@ -405,9 +405,9 @@ public class BufferedReader extends Reader
int i = pos;
for (; i < limit; i++)
{
- char ch = buffer[i];
- if (ch == '\n' || ch == '\r')
- break;
+ char ch = buffer[i];
+ if (ch == '\n' || ch == '\r')
+ break;
}
return i;
}
@@ -418,9 +418,9 @@ public class BufferedReader extends Reader
* an "\r\n" sequence. The system dependent line separator is not used.
* The line termination characters are not returned in the resulting
* <code>String</code>.
- *
+ *
* @return The line of text read, or <code>null</code> if end of stream.
- *
+ *
* @exception IOException If an error occurs
*/
public String readLine() throws IOException
@@ -432,25 +432,25 @@ public class BufferedReader extends Reader
// This special case is indicated by 'pos > limit'.
if (pos > limit)
{
- int ch = read();
- if (ch < 0)
- return null;
- if (ch != '\n')
- --pos;
+ int ch = read();
+ if (ch < 0)
+ return null;
+ if (ch != '\n')
+ --pos;
}
int i = lineEnd(limit);
if (i < limit)
{
- String str = String.valueOf(buffer, pos, i - pos);
- pos = i + 1;
- // If the last char in the buffer is a '\r', we must remember
- // to check if the next char to be read after the buffer is refilled
- // is a '\n'. If so, skip it. To indicate this condition, we set pos
- // to be limit + 1, which normally is never possible.
- if (buffer[i] == '\r')
- if (pos == limit || buffer[pos] == '\n')
- pos++;
- return str;
+ String str = String.valueOf(buffer, pos, i - pos);
+ pos = i + 1;
+ // If the last char in the buffer is a '\r', we must remember
+ // to check if the next char to be read after the buffer is refilled
+ // is a '\n'. If so, skip it. To indicate this condition, we set pos
+ // to be limit + 1, which normally is never possible.
+ if (buffer[i] == '\r')
+ if (pos == limit || buffer[pos] == '\n')
+ pos++;
+ return str;
}
CPStringBuilder sbuf = new CPStringBuilder(200);
sbuf.append(buffer, pos, i - pos);
@@ -462,33 +462,33 @@ public class BufferedReader extends Reader
boolean eof = false;
for (;;)
{
- // readLine should block. So we must not return until a -1 is reached.
- if (pos >= limit)
- {
- // here count == 0 isn't sufficient to give a failure.
- int count = fill();
- if (count < 0)
- {
- eof = true;
- break;
- }
- continue;
- }
- int ch = buffer[pos++];
- if (ch == '\n' || ch == '\r')
- {
- // Check here if a '\r' was the last char in the buffer; if so,
- // mark it as in the comment above to indicate future reads
- // should skip a newline that is the next char read after
- // refilling the buffer.
- if (ch == '\r')
- if (pos == limit || buffer[pos] == '\n')
- pos++;
- break;
- }
- i = lineEnd(limit);
- sbuf.append(buffer, pos - 1, i - (pos - 1));
- pos = i;
+ // readLine should block. So we must not return until a -1 is reached.
+ if (pos >= limit)
+ {
+ // here count == 0 isn't sufficient to give a failure.
+ int count = fill();
+ if (count < 0)
+ {
+ eof = true;
+ break;
+ }
+ continue;
+ }
+ int ch = buffer[pos++];
+ if (ch == '\n' || ch == '\r')
+ {
+ // Check here if a '\r' was the last char in the buffer; if so,
+ // mark it as in the comment above to indicate future reads
+ // should skip a newline that is the next char read after
+ // refilling the buffer.
+ if (ch == '\r')
+ if (pos == limit || buffer[pos] == '\n')
+ pos++;
+ break;
+ }
+ i = lineEnd(limit);
+ sbuf.append(buffer, pos - 1, i - (pos - 1));
+ pos = i;
}
return (sbuf.length() == 0 && eof) ? null : sbuf.toString();
}
@@ -499,7 +499,7 @@ public class BufferedReader extends Reader
* requested amount.
* <p>
* This method first discards chars in the buffer, then calls the
- * <code>skip</code> method on the underlying stream to skip the
+ * <code>skip</code> method on the underlying stream to skip the
* remaining chars.
*
* @param count The requested number of chars to skip
@@ -513,63 +513,63 @@ public class BufferedReader extends Reader
{
synchronized (lock)
{
- checkStatus();
- if (count < 0)
- throw new IllegalArgumentException("skip value is negative");
- if (count == 0)
- return 0;
- // Yet again, we need to handle the special case of a readLine
- // that has a '\r' at the end of the buffer. In this case, we need
- // to ignore a '\n' if it is the next char to be read.
- // This special case is indicated by 'pos > limit' (i.e. avail < 0).
- // To simplify things, if we're dealing with the special case for
- // readLine, just read the next char (since the fill method will
- // skip the '\n' for us). By doing this, we'll have to back up pos.
- // That's easier than trying to keep track of whether we've skipped
- // one element or not.
- if (pos > limit)
- {
- if (read() < 0)
- return 0;
- else
- --pos;
- }
-
- int avail = limit - pos;
-
- if (count < avail)
- {
- pos += count;
- return count;
- }
-
- pos = limit;
- long todo = count - avail;
- if (todo > buffer.length)
- {
- markPos = -1;
- todo -= in.skip(todo);
- }
- else
- {
- while (todo > 0)
- {
- avail = fill();
- if (avail <= 0)
- break;
- if (avail > todo)
- avail = (int) todo;
- pos += avail;
- todo -= avail;
- }
- }
- return count - todo;
+ checkStatus();
+ if (count < 0)
+ throw new IllegalArgumentException("skip value is negative");
+ if (count == 0)
+ return 0;
+ // Yet again, we need to handle the special case of a readLine
+ // that has a '\r' at the end of the buffer. In this case, we need
+ // to ignore a '\n' if it is the next char to be read.
+ // This special case is indicated by 'pos > limit' (i.e. avail < 0).
+ // To simplify things, if we're dealing with the special case for
+ // readLine, just read the next char (since the fill method will
+ // skip the '\n' for us). By doing this, we'll have to back up pos.
+ // That's easier than trying to keep track of whether we've skipped
+ // one element or not.
+ if (pos > limit)
+ {
+ if (read() < 0)
+ return 0;
+ else
+ --pos;
+ }
+
+ int avail = limit - pos;
+
+ if (count < avail)
+ {
+ pos += count;
+ return count;
+ }
+
+ pos = limit;
+ long todo = count - avail;
+ if (todo > buffer.length)
+ {
+ markPos = -1;
+ todo -= in.skip(todo);
+ }
+ else
+ {
+ while (todo > 0)
+ {
+ avail = fill();
+ if (avail <= 0)
+ break;
+ if (avail > todo)
+ avail = (int) todo;
+ pos += avail;
+ todo -= avail;
+ }
+ }
+ return count - todo;
}
}
-
+
private void checkStatus() throws IOException
{
if (in == null)
throw new IOException("Stream closed");
- }
+ }
}
diff --git a/java/io/BufferedWriter.java b/java/io/BufferedWriter.java
index 185a53440..ae6751c43 100644
--- a/java/io/BufferedWriter.java
+++ b/java/io/BufferedWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -53,7 +53,7 @@ package java.io;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@cygnus.com)
- * @date September 25, 1998
+ * @date September 25, 1998
*/
public class BufferedWriter extends Writer
{
@@ -110,7 +110,7 @@ public class BufferedWriter extends Writer
}
/**
- * This method flushes any remaining buffered chars then closes the
+ * This method flushes any remaining buffered chars then closes the
* underlying output stream. Any further attempts to write to this stream
* may throw an exception
*
@@ -120,11 +120,11 @@ public class BufferedWriter extends Writer
{
synchronized (lock)
{
- // It is safe to call localFlush even if the stream is already
- // closed.
- localFlush ();
- out.close();
- buffer = null;
+ // It is safe to call localFlush even if the stream is already
+ // closed.
+ localFlush ();
+ out.close();
+ buffer = null;
}
}
@@ -138,10 +138,10 @@ public class BufferedWriter extends Writer
{
synchronized (lock)
{
- if (buffer == null)
- throw new IOException ("Stream closed");
- localFlush ();
- out.flush();
+ if (buffer == null)
+ throw new IOException ("Stream closed");
+ localFlush ();
+ out.flush();
}
}
@@ -171,17 +171,17 @@ public class BufferedWriter extends Writer
{
synchronized (lock)
{
- if (buffer == null)
- throw new IOException ("Stream closed");
- buffer[count++] = (char) oneChar;
- if (count == buffer.length)
- localFlush ();
+ if (buffer == null)
+ throw new IOException ("Stream closed");
+ buffer[count++] = (char) oneChar;
+ if (count == buffer.length)
+ localFlush ();
}
}
/**
- * This method writes <code>len</code> chars from the char array
- * <code>buf</code> starting at position <code>offset</code> in the buffer.
+ * This method writes <code>len</code> chars from the char array
+ * <code>buf</code> starting at position <code>offset</code> in the buffer.
* These chars will be written to the internal buffer. However, if this
* write operation fills the buffer, the buffer will be flushed to the
* underlying output stream.
@@ -196,28 +196,28 @@ public class BufferedWriter extends Writer
{
synchronized (lock)
{
- if (buffer == null)
- throw new IOException ("Stream closed");
+ if (buffer == null)
+ throw new IOException ("Stream closed");
- // Bypass buffering if there is too much incoming data.
- if (count + len > buffer.length)
- {
- localFlush ();
- out.write(buf, offset, len);
- }
- else
- {
- System.arraycopy(buf, offset, buffer, count, len);
- count += len;
- if (count == buffer.length)
- localFlush ();
- }
+ // Bypass buffering if there is too much incoming data.
+ if (count + len > buffer.length)
+ {
+ localFlush ();
+ out.write(buf, offset, len);
+ }
+ else
+ {
+ System.arraycopy(buf, offset, buffer, count, len);
+ count += len;
+ if (count == buffer.length)
+ localFlush ();
+ }
}
}
/**
* This method writes <code>len</code> chars from the <code>String</code>
- * <code>str</code> starting at position <code>offset</code> in the string.
+ * <code>str</code> starting at position <code>offset</code> in the string.
* These chars will be written to the internal buffer. However, if this
* write operation fills the buffer, the buffer will be flushed to the
* underlying output stream.
@@ -232,21 +232,21 @@ public class BufferedWriter extends Writer
{
synchronized (lock)
{
- if (buffer == null)
- throw new IOException ("Stream closed");
+ if (buffer == null)
+ throw new IOException ("Stream closed");
- if (count + len > buffer.length)
- {
- localFlush ();
- out.write(str, offset, len);
- }
- else
- {
- str.getChars(offset, offset + len, buffer, count);
- count += len;
- if (count == buffer.length)
- localFlush ();
- }
+ if (count + len > buffer.length)
+ {
+ localFlush ();
+ out.write(str, offset, len);
+ }
+ else
+ {
+ str.getChars(offset, offset + len, buffer, count);
+ count += len;
+ if (count == buffer.length)
+ localFlush ();
+ }
}
}
@@ -255,8 +255,8 @@ public class BufferedWriter extends Writer
{
if (count > 0)
{
- out.write(buffer, 0, count);
- count = 0;
+ out.write(buffer, 0, count);
+ count = 0;
}
}
}
diff --git a/java/io/ByteArrayInputStream.java b/java/io/ByteArrayInputStream.java
index 2bbde95b7..f46ee3c0f 100644
--- a/java/io/ByteArrayInputStream.java
+++ b/java/io/ByteArrayInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.io;
*
* @author Warren Levy (warrenl@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
- */
+ */
public class ByteArrayInputStream extends InputStream
{
/**
@@ -78,9 +78,9 @@ public class ByteArrayInputStream extends InputStream
* of the array. It is identical to calling an overloaded constructor
* as <code>ByteArrayInputStream(buf, 0, buf.length)</code>.
* <p>
- * Note that this array is not copied. If its contents are changed
+ * Note that this array is not copied. If its contents are changed
* while this stream is being read, those changes will be reflected in the
- * bytes supplied to the reader. Please use caution in changing the
+ * bytes supplied to the reader. Please use caution in changing the
* contents of the buffer while this stream is open.
*
* @param buffer The byte array buffer this stream will read from.
@@ -100,9 +100,9 @@ public class ByteArrayInputStream extends InputStream
* The <code>length</code> value should be viewed as the array index
* one greater than the last position in the buffer to read.
* <p>
- * Note that this array is not copied. If its contents are changed
+ * Note that this array is not copied. If its contents are changed
* while this stream is being read, those changes will be reflected in the
- * bytes supplied to the reader. Please use caution in changing the
+ * bytes supplied to the reader. Please use caution in changing the
* contents of the buffer while this stream is open.
*
* @param buffer The byte array buffer this stream will read from.
@@ -129,7 +129,7 @@ public class ByteArrayInputStream extends InputStream
* stream. The value returned will be equal to <code>count - pos</code>.
*
* @return The number of bytes that can be read from this stream
- * before blocking, which is all of them
+ * before blocking, which is all of them
*/
public synchronized int available()
{
diff --git a/java/io/ByteArrayOutputStream.java b/java/io/ByteArrayOutputStream.java
index 4196523d2..9c1a86b7f 100644
--- a/java/io/ByteArrayOutputStream.java
+++ b/java/io/ByteArrayOutputStream.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -63,12 +63,12 @@ package java.io;
* <p>
* Note that this class also has methods that convert the byte array
* buffer to a <code>String</code> using either the system default or an
- * application specified character encoding. Thus it can handle
+ * application specified character encoding. Thus it can handle
* multibyte character encodings.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@cygnus.com)
- * @date September 24, 1998
+ * @date September 24, 1998
*/
public class ByteArrayOutputStream extends OutputStream
{
@@ -130,7 +130,7 @@ public class ByteArrayOutputStream extends OutputStream
* This method returns a byte array containing the bytes that have been
* written to this stream so far. This array is a copy of the valid
* bytes in the internal buffer and its length is equal to the number of
- * valid bytes, not necessarily to the the length of the current
+ * valid bytes, not necessarily to the the length of the current
* internal buffer. Note that since this method allocates a new array,
* it should be used with caution when the internal buffer is very large.
*/
@@ -158,7 +158,7 @@ public class ByteArrayOutputStream extends OutputStream
/**
* Returns the bytes in the internal array as a <code>String</code>. The
* bytes in the buffer are converted to characters using the specified
- * encoding.
+ * encoding.
*
* @param enc The name of the character encoding to use
*
@@ -184,7 +184,7 @@ public class ByteArrayOutputStream extends OutputStream
* methods which use a true character encoding.
*
* @param hibyte The high eight bits to use for each character in
- * the <code>String</code>
+ * the <code>String</code>
*
* @return A <code>String</code> containing the data written to this
* stream so far
@@ -201,12 +201,12 @@ public class ByteArrayOutputStream extends OutputStream
{
if (count + add > buf.length)
{
- int newlen = buf.length * 2;
- if (count + add > newlen)
- newlen = count + add;
- byte[] newbuf = new byte[newlen];
- System.arraycopy(buf, 0, newbuf, 0, count);
- buf = newbuf;
+ int newlen = buf.length * 2;
+ if (count + add > newlen)
+ newlen = count + add;
+ byte[] newbuf = new byte[newlen];
+ System.arraycopy(buf, 0, newbuf, 0, count);
+ buf = newbuf;
}
}
@@ -223,7 +223,7 @@ public class ByteArrayOutputStream extends OutputStream
}
/**
- * This method writes <code>len</code> bytes from the passed in array
+ * This method writes <code>len</code> bytes from the passed in array
* <code>buf</code> starting at index <code>offset</code> into the
* internal buffer.
*
@@ -276,7 +276,7 @@ public class ByteArrayOutputStream extends OutputStream
{
int r
= Integer.getInteger ("gnu.java.io.ByteArrayOutputStream.initialBufferSize",
- DEFAULT_INITIAL_BUFFER_SIZE).intValue ();
+ DEFAULT_INITIAL_BUFFER_SIZE).intValue ();
if (r <= 0)
r = DEFAULT_INITIAL_BUFFER_SIZE;
initial_buffer_size = r;
diff --git a/java/io/CharArrayReader.java b/java/io/CharArrayReader.java
index c14fa0775..8405f48f3 100644
--- a/java/io/CharArrayReader.java
+++ b/java/io/CharArrayReader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -35,7 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
+
package java.io;
/**
@@ -78,9 +78,9 @@ public class CharArrayReader extends Reader
* of the array. It is identical to calling an overloaded constructor
* as <code>CharArrayReader(buf, 0, buf.length)</code>.
* <p>
- * Note that this array is not copied. If its contents are changed
+ * Note that this array is not copied. If its contents are changed
* while this stream is being read, those changes will be reflected in the
- * chars supplied to the reader. Please use caution in changing the
+ * chars supplied to the reader. Please use caution in changing the
* contents of the buffer while this stream is open.
*
* @param buffer The char array buffer this stream will read from.
@@ -100,9 +100,9 @@ public class CharArrayReader extends Reader
* The <code>length</code> value should be viewed as the array index
* one greater than the last position in the buffer to read.
* <p>
- * Note that this array is not copied. If its contents are changed
+ * Note that this array is not copied. If its contents are changed
* while this stream is being read, those changes will be reflected in the
- * chars supplied to the reader. Please use caution in changing the
+ * chars supplied to the reader. Please use caution in changing the
* contents of the buffer while this stream is open.
*
* @param buffer The char array buffer this stream will read from.
@@ -114,13 +114,13 @@ public class CharArrayReader extends Reader
super();
if (offset < 0 || length < 0 || offset > buffer.length)
throw new IllegalArgumentException();
-
+
buf = buffer;
count = offset + length;
if (count > buf.length)
count = buf.length;
-
+
pos = offset;
markedPos = pos;
}
@@ -132,7 +132,7 @@ public class CharArrayReader extends Reader
{
synchronized (lock)
{
- buf = null;
+ buf = null;
}
}
@@ -155,10 +155,10 @@ public class CharArrayReader extends Reader
{
synchronized (lock)
{
- if (buf == null)
- throw new IOException("Stream closed");
- // readAheadLimit is ignored per Java Class Lib. book, p. 318.
- markedPos = pos;
+ if (buf == null)
+ throw new IOException("Stream closed");
+ // readAheadLimit is ignored per Java Class Lib. book, p. 318.
+ markedPos = pos;
}
}
@@ -189,15 +189,15 @@ public class CharArrayReader extends Reader
{
synchronized (lock)
{
- if (buf == null)
- throw new IOException("Stream closed");
+ if (buf == null)
+ throw new IOException("Stream closed");
- if (pos < 0)
- throw new ArrayIndexOutOfBoundsException(pos);
+ if (pos < 0)
+ throw new ArrayIndexOutOfBoundsException(pos);
- if (pos < count)
- return ((int) buf[pos++]) & 0xFFFF;
- return -1;
+ if (pos < count)
+ return ((int) buf[pos++]) & 0xFFFF;
+ return -1;
}
}
@@ -223,25 +223,25 @@ public class CharArrayReader extends Reader
{
synchronized (lock)
{
- if (buf == null)
- throw new IOException("Stream closed");
+ if (buf == null)
+ throw new IOException("Stream closed");
- /* Don't need to check pos value, arraycopy will check it. */
- if (off < 0 || len < 0 || off + len > b.length)
- throw new IndexOutOfBoundsException();
+ /* Don't need to check pos value, arraycopy will check it. */
+ if (off < 0 || len < 0 || off + len > b.length)
+ throw new IndexOutOfBoundsException();
- if (pos >= count)
- return -1;
+ if (pos >= count)
+ return -1;
- int numChars = Math.min(count - pos, len);
- System.arraycopy(buf, pos, b, off, numChars);
- pos += numChars;
- return numChars;
+ int numChars = Math.min(count - pos, len);
+ System.arraycopy(buf, pos, b, off, numChars);
+ pos += numChars;
+ return numChars;
}
}
/**
- * Return true if more characters are available to be read.
+ * Return true if more characters are available to be read.
*
* @return <code>true</code> to indicate that this stream is ready
* to be read.
@@ -268,10 +268,10 @@ public class CharArrayReader extends Reader
{
synchronized (lock)
{
- if (buf == null)
- throw new IOException("Stream closed");
+ if (buf == null)
+ throw new IOException("Stream closed");
- pos = markedPos;
+ pos = markedPos;
}
}
@@ -290,16 +290,16 @@ public class CharArrayReader extends Reader
{
synchronized (lock)
{
- if (buf == null)
- throw new IOException("Stream closed");
-
- // Even though the var numChars is a long, in reality it can never
- // be larger than an int since the result of subtracting 2 positive
- // ints will always fit in an int. Since we have to return a long
- // anyway, numChars might as well just be a long.
- long numChars = Math.min((long) (count - pos), n < 0 ? 0L : n);
- pos += numChars;
- return numChars;
+ if (buf == null)
+ throw new IOException("Stream closed");
+
+ // Even though the var numChars is a long, in reality it can never
+ // be larger than an int since the result of subtracting 2 positive
+ // ints will always fit in an int. Since we have to return a long
+ // anyway, numChars might as well just be a long.
+ long numChars = Math.min((long) (count - pos), n < 0 ? 0L : n);
+ pos += numChars;
+ return numChars;
}
}
}
diff --git a/java/io/CharArrayWriter.java b/java/io/CharArrayWriter.java
index 8cbc8aeac..dea727aa1 100644
--- a/java/io/CharArrayWriter.java
+++ b/java/io/CharArrayWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -116,7 +116,7 @@ public class CharArrayWriter extends Writer
{
synchronized (lock)
{
- count = 0;
+ count = 0;
}
}
@@ -141,17 +141,17 @@ public class CharArrayWriter extends Writer
* This method returns a char array containing the chars that have been
* written to this stream so far. This array is a copy of the valid
* chars in the internal buffer and its length is equal to the number of
- * valid chars, not necessarily to the the length of the current
+ * valid chars, not necessarily to the the length of the current
* internal buffer. Note that since this method allocates a new array,
* it should be used with caution when the internal buffer is very large.
*/
public char[] toCharArray ()
{
synchronized (lock)
- {
- char[] nc = new char[count];
- System.arraycopy(buf, 0, nc, 0, count);
- return nc;
+ {
+ char[] nc = new char[count];
+ System.arraycopy(buf, 0, nc, 0, count);
+ return nc;
}
}
@@ -168,7 +168,7 @@ public class CharArrayWriter extends Writer
{
synchronized (lock)
{
- return new String (buf, 0, count);
+ return new String (buf, 0, count);
}
}
@@ -182,13 +182,13 @@ public class CharArrayWriter extends Writer
{
synchronized (lock)
{
- resize (1);
- buf[count++] = (char) oneChar;
+ resize (1);
+ buf[count++] = (char) oneChar;
}
}
/**
- * This method writes <code>len</code> chars from the passed in array
+ * This method writes <code>len</code> chars from the passed in array
* <code>buf</code> starting at index <code>offset</code> into that buffer
*
* @param buffer The char array to write data from
@@ -199,10 +199,10 @@ public class CharArrayWriter extends Writer
{
synchronized (lock)
{
- if (len >= 0)
- resize (len);
- System.arraycopy(buffer, offset, buf, count, len);
- count += len;
+ if (len >= 0)
+ resize (len);
+ System.arraycopy(buffer, offset, buf, count, len);
+ count += len;
}
}
@@ -219,10 +219,10 @@ public class CharArrayWriter extends Writer
{
synchronized (lock)
{
- if (len >= 0)
- resize (len);
- str.getChars(offset, offset + len, buf, count);
- count += len;
+ if (len >= 0)
+ resize (len);
+ str.getChars(offset, offset + len, buf, count);
+ count += len;
}
}
@@ -238,17 +238,17 @@ public class CharArrayWriter extends Writer
{
synchronized (lock)
{
- out.write(buf, 0, count);
+ out.write(buf, 0, count);
}
}
- /**
+ /**
* Appends the Unicode character, <code>c</code>, to the output stream
* underlying this writer. This is equivalent to <code>write(c)</code>.
*
* @param c the character to append.
* @return a reference to this object.
- * @since 1.5
+ * @since 1.5
*/
public CharArrayWriter append(char c)
{
@@ -256,7 +256,7 @@ public class CharArrayWriter extends Writer
return this;
}
- /**
+ /**
* Appends the specified sequence of Unicode characters to the
* output stream underlying this writer. This is equivalent to
* appending the results of calling <code>toString()</code> on the
@@ -271,22 +271,22 @@ public class CharArrayWriter extends Writer
* then the string "null" (the string representation of null)
* is appended.
* @return a reference to this object.
- * @since 1.5
+ * @since 1.5
*/
public CharArrayWriter append(CharSequence cs)
{
try
{
- write(cs == null ? "null" : cs.toString());
+ write(cs == null ? "null" : cs.toString());
}
catch (IOException _)
{
- // Can't happen.
+ // Can't happen.
}
return this;
}
- /**
+ /**
* Appends the specified subsequence of Unicode characters to the
* output stream underlying this writer, starting and ending at the
* specified positions within the sequence. The behaviour of this
@@ -311,11 +311,11 @@ public class CharArrayWriter extends Writer
{
try
{
- write(cs == null ? "null" : cs.subSequence(start, end).toString());
+ write(cs == null ? "null" : cs.subSequence(start, end).toString());
}
catch (IOException _)
{
- // Can't happen.
+ // Can't happen.
}
return this;
}
@@ -331,12 +331,12 @@ public class CharArrayWriter extends Writer
{
if (count + len >= buf.length)
{
- int newlen = buf.length * 2;
- if (count + len > newlen)
- newlen = count + len;
- char[] newbuf = new char[newlen];
- System.arraycopy(buf, 0, newbuf, 0, count);
- buf = newbuf;
+ int newlen = buf.length * 2;
+ if (count + len > newlen)
+ newlen = count + len;
+ char[] newbuf = new char[newlen];
+ System.arraycopy(buf, 0, newbuf, 0, count);
+ buf = newbuf;
}
}
diff --git a/java/io/DataInput.java b/java/io/DataInput.java
index 45cb0c130..a713319cf 100644
--- a/java/io/DataInput.java
+++ b/java/io/DataInput.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,12 +40,12 @@ package java.io;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
+ * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct. */
/**
- * This interface is implemented by classes that can data from streams
- * into Java primitive types.
+ * This interface is implemented by classes that can data from streams
+ * into Java primitive types.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy (warrenl@cygnus.com)
@@ -65,7 +65,7 @@ public interface DataInput
*
* @return The <code>boolean</code> value read
*
- * @exception EOFException If end of file is reached before
+ * @exception EOFException If end of file is reached before
* reading the boolean
* @exception IOException If any other error occurs
*
@@ -78,7 +78,7 @@ public interface DataInput
* is in the range of -128 to 127.
* <p>
* This method can read a <code>byte</code> written by an object
- * implementing the
+ * implementing the
* <code>writeByte()</code> method in the <code>DataOutput</code> interface.
* <p>
* @return The <code>byte</code> value read
@@ -94,7 +94,7 @@ public interface DataInput
* This method reads 8 unsigned bits into a Java <code>int</code> value from
* the stream. The value returned is in the range of 0 to 255.
* <p>
- * This method can read an unsigned byte written by an object
+ * This method can read an unsigned byte written by an object
* implementing the
* <code>writeByte()</code> method in the <code>DataOutput</code>
* interface.
@@ -109,11 +109,11 @@ public interface DataInput
int readUnsignedByte() throws EOFException, IOException;
/**
- * This method reads a Java <code>char</code> value from an input stream.
- * It operates by reading two bytes from the stream and converting them to
+ * This method reads a Java <code>char</code> value from an input stream.
+ * It operates by reading two bytes from the stream and converting them to
* a single 16-bit Java <code>char</code>. The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
* As an example, if <code>byte1</code> and <code>byte2</code> represent the
* first and second byte read from the stream respectively, they will be
@@ -125,7 +125,7 @@ public interface DataInput
* the
* <code>writeChar()</code> method in the <code>DataOutput</code> interface.
*
- * @return The <code>char</code> value read
+ * @return The <code>char</code> value read
*
* @exception EOFException If end of file is reached before reading the char
* @exception IOException If any other error occurs
@@ -136,10 +136,10 @@ public interface DataInput
/**
* This method reads a signed 16-bit value into a Java in from the stream.
- * It operates by reading two bytes from the stream and converting them to
+ * It operates by reading two bytes from the stream and converting them to
* a single 16-bit Java <code>short</code>. The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
* As an example, if <code>byte1</code> and <code>byte2</code> represent the
* first and second byte read from the stream respectively, they will be
@@ -149,7 +149,7 @@ public interface DataInput
* <p>
* The value returned is in the range of -32768 to 32767.
* <p>
- * This method can read a <code>short</code> written by an object
+ * This method can read a <code>short</code> written by an object
* implementing
* the <code>writeShort()</code> method in the <code>DataOutput</code>
* interface.
@@ -165,10 +165,10 @@ public interface DataInput
/**
* This method reads 16 unsigned bits into a Java int value from the stream.
- * It operates by reading two bytes from the stream and converting them to
+ * It operates by reading two bytes from the stream and converting them to
* a single Java <code>int</code>. The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
* As an example, if <code>byte1</code> and <code>byte2</code> represent the
* first and second byte read from the stream respectively, they will be
@@ -179,13 +179,13 @@ public interface DataInput
* The value returned is in the range of 0 to 65535.
* <p>
* This method can read an unsigned short written by an object implementing
- * the <code>writeShort()</code> method in the
+ * the <code>writeShort()</code> method in the
* <code>DataOutput</code>
* interface.
*
* @return The unsigned short value read as a Java <code>int</code>.
*
- * @exception EOFException If end of file is reached before reading
+ * @exception EOFException If end of file is reached before reading
* the value
* @exception IOException If any other error occurs
*
@@ -195,22 +195,22 @@ public interface DataInput
/**
* This method reads a Java <code>int</code> value from an input stream
- * It operates by reading four bytes from the stream and converting them to
+ * It operates by reading four bytes from the stream and converting them to
* a single Java <code>int</code>. The bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
* As an example, if <code>byte1</code> through <code>byte4</code> represent
* the first four bytes read from the stream, they will be
* transformed to an <code>int</code> in the following manner:
* <p>
- * <code>(int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) +
+ * <code>(int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) +
* ((byte3 & 0xFF)<< 8) + (byte4 & 0xFF)))</code>
* <p>
* The value returned is in the range of -2147483648 to 2147483647.
* <p>
- * This method can read an <code>int</code> written by an object
- * implementing the <code>writeInt()</code> method in the
+ * This method can read an <code>int</code> written by an object
+ * implementing the <code>writeInt()</code> method in the
* <code>DataOutput</code> interface.
*
* @return The <code>int</code> value read
@@ -224,26 +224,26 @@ public interface DataInput
/**
* This method reads a Java <code>long</code> value from an input stream
- * It operates by reading eight bytes from the stream and converting them to
+ * It operates by reading eight bytes from the stream and converting them to
* a single Java <code>long</code>. The bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
* As an example, if <code>byte1</code> through <code>byte8</code> represent
* the first eight bytes read from the stream, they will be
* transformed to an <code>long</code> in the following manner:
* <p>
- * <code>(long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) +
- * ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) +
- * ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) +
+ * <code>(long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) +
+ * ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) +
+ * ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) +
* ((byte7 & 0xFF) << 8) + (byte8 & 0xFF)))
* </code>
* <p>
* The value returned is in the range of -9223372036854775808 to
* 9223372036854775807.
* <p>
- * This method can read an <code>long</code> written by an object
- * implementing the <code>writeLong()</code> method in the
+ * This method can read an <code>long</code> written by an object
+ * implementing the <code>writeLong()</code> method in the
* <code>DataOutput</code> interface.
*
* @return The <code>long</code> value read
@@ -263,14 +263,14 @@ public interface DataInput
* <code>intBitsToFloat</code> method in the class
* <code>java.lang.Float</code>.
* <p>
- * This method can read a <code>float</code> written by an object
+ * This method can read a <code>float</code> written by an object
* implementing
* the <code>writeFloat()</code> method in the <code>DataOutput</code>
* interface.
*
* @return The <code>float</code> value read
*
- * @exception EOFException If end of file is reached before reading the
+ * @exception EOFException If end of file is reached before reading the
* float
* @exception IOException If any other error occurs
*
@@ -293,7 +293,7 @@ public interface DataInput
*
* @return The <code>double</code> value read
*
- * @exception EOFException If end of file is reached before reading the
+ * @exception EOFException If end of file is reached before reading the
* double
* @exception IOException If any other error occurs
*
@@ -304,16 +304,16 @@ public interface DataInput
/**
* This method reads the next line of text data from an input stream.
- * It operates by reading bytes and converting those bytes to
+ * It operates by reading bytes and converting those bytes to
* <code>char</code>
* values by treating the byte read as the low eight bits of the
* <code>char</code> and using 0 as the high eight bits. Because of this,
* it does not support the full 16-bit Unicode character set.
* <P>
* The reading of bytes ends when either the end of file or a line terminator
- * is encountered. The bytes read are then returned as a
+ * is encountered. The bytes read are then returned as a
* <code>String</code>.
- * A line terminator is a byte sequence consisting of either
+ * A line terminator is a byte sequence consisting of either
* <code>\r</code>, <code>\n</code> or <code>\r\n</code>. These termination
* charaters are discarded and are not returned as part of the string.
* A line is also terminated by an end of file condition.
@@ -328,17 +328,17 @@ public interface DataInput
/**
* This method reads a <code>String</code> from an input stream that is
* encoded in a modified UTF-8 format. This format has a leading two byte
- * sequence that contains the remaining number of bytes to read.
+ * sequence that contains the remaining number of bytes to read.
* This two byte
* sequence is read using the <code>readUnsignedShort()</code> method of this
* interface.
*
* After the number of remaining bytes have been determined, these bytes
* are read an transformed into <code>char</code> values. These
- * <code>char</code> values are encoded in the stream using either a one,
+ * <code>char</code> values are encoded in the stream using either a one,
* two, or three byte format.
* The particular format in use can be determined by examining the first
- * byte read.
+ * byte read.
* <p>
* If the first byte has a high order bit of 0, then
* that character consists on only one byte. This character value consists
@@ -348,10 +348,10 @@ public interface DataInput
* <p>
* <code>(char)byte1</code>
* <p>
- * If the first byte has 110 as its high order bits, then the
+ * If the first byte has 110 as its high order bits, then the
* character consists of two bytes. The bits that make up the character
* value are in positions 0 through 4 of the first byte and bit positions
- * 0 through 5 of the second byte. (The second byte should have
+ * 0 through 5 of the second byte. (The second byte should have
* 10 as its high order bits). These values are in most significant
* byte first (i.e., "big endian") order.
* <p>
@@ -380,16 +380,16 @@ public interface DataInput
*
* Note that all characters are encoded in the method that requires the
* fewest number of bytes with the exception of the character with the
- * value of <code>\&lt;llll&gt;u0000</code> which is encoded as two bytes.
- * This is a modification of the UTF standard used to prevent C language
+ * value of <code>\&lt;llll&gt;u0000</code> which is encoded as two bytes.
+ * This is a modification of the UTF standard used to prevent C language
* style <code>NUL</code> values from appearing in the byte stream.
* <p>
* This method can read data that was written by an object implementing the
* <code>writeUTF()</code> method in <code>DataOutput</code>.
- *
+ *
* @return The <code>String</code> read
*
- * @exception EOFException If end of file is reached before reading the
+ * @exception EOFException If end of file is reached before reading the
* String
* @exception UTFDataFormatException If the data is not in UTF-8 format
* @exception IOException If any other error occurs
@@ -408,19 +408,19 @@ public interface DataInput
*
* @param buf The buffer into which to read the data
*
- * @exception EOFException If end of file is reached before filling the
+ * @exception EOFException If end of file is reached before filling the
* buffer
* @exception IOException If any other error occurs
*/
void readFully(byte[] buf) throws EOFException, IOException;
/**
- * This method reads raw bytes into the passed array <code>buf</code>
+ * This method reads raw bytes into the passed array <code>buf</code>
* starting
- * <code>offset</code> bytes into the buffer. The number of bytes read
+ * <code>offset</code> bytes into the buffer. The number of bytes read
* will be
- * exactly <code>len</code>. Note that this method blocks until the data is
- * available and throws an exception if there is not enough data left in
+ * exactly <code>len</code>. Note that this method blocks until the data is
+ * available and throws an exception if there is not enough data left in
* the stream to read <code>len</code> bytes. Note also that zero length
* buffers are permitted. In this case, the method will return immediately
* without reading any bytes from the stream.
@@ -429,11 +429,11 @@ public interface DataInput
* @param offset The offset into the buffer to start storing data
* @param len The number of bytes to read into the buffer
*
- * @exception EOFException If end of file is reached before filling the
+ * @exception EOFException If end of file is reached before filling the
* buffer
* @exception IOException If any other error occurs
*/
- void readFully(byte[] buf, int offset, int len)
+ void readFully(byte[] buf, int offset, int len)
throws EOFException, IOException;
/**
diff --git a/java/io/DataInputStream.java b/java/io/DataInputStream.java
index 51cf51a8e..518205b24 100644
--- a/java/io/DataInputStream.java
+++ b/java/io/DataInputStream.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -35,7 +35,7 @@ or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
+
package java.io;
import gnu.java.lang.CPStringBuilder;
@@ -45,7 +45,7 @@ import gnu.java.lang.CPStringBuilder;
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
-
+
/**
* This subclass of <code>FilteredInputStream</code> implements the
* <code>DataInput</code> interface that provides method for reading primitive
@@ -55,13 +55,13 @@ import gnu.java.lang.CPStringBuilder;
*
* @author Warren Levy (warrenl@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @date October 20, 1998.
+ * @date October 20, 1998.
*/
public class DataInputStream extends FilterInputStream implements DataInput
{
// Byte buffer, used to make primitive read calls more efficient.
byte[] buf = new byte [8];
-
+
/**
* This constructor initializes a new <code>DataInputStream</code>
* to read from the specified subordinate stream.
@@ -80,8 +80,8 @@ public class DataInputStream extends FilterInputStream implements DataInput
* read to fill the buffer.
*
* @param b The buffer into which bytes will be read.
- *
- * @return The actual number of bytes read, or -1 if end of stream reached
+ *
+ * @return The actual number of bytes read, or -1 if end of stream reached
* before reading any bytes.
*
* @exception IOException If an error occurs.
@@ -120,7 +120,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* <p>
* This method can read a <code>boolean</code> written by an object
* implementing the <code>writeBoolean()</code> method in the
- * <code>DataOutput</code> interface.
+ * <code>DataOutput</code> interface.
*
* @return The <code>boolean</code> value read
*
@@ -156,24 +156,24 @@ public class DataInputStream extends FilterInputStream implements DataInput
}
/**
- * This method reads a Java <code>char</code> value from an input stream.
- * It operates by reading two bytes from the stream and converting them to
+ * This method reads a Java <code>char</code> value from an input stream.
+ * It operates by reading two bytes from the stream and converting them to
* a single 16-bit Java <code>char</code>. The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
* As an example, if <code>byte1</code> and <code>byte2</code>
* represent the first and second byte read from the stream
* respectively, they will be transformed to a <code>char</code> in
- * the following manner:
+ * the following manner:
* <p>
* <code>(char)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF)</code>
* <p>
* This method can read a <code>char</code> written by an object
* implementing the <code>writeChar()</code> method in the
- * <code>DataOutput</code> interface.
+ * <code>DataOutput</code> interface.
*
- * @return The <code>char</code> value read
+ * @return The <code>char</code> value read
*
* @exception EOFException If end of file is reached before reading the char
* @exception IOException If any other error occurs
@@ -192,7 +192,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* <code>readLong()</code> method in this interface, then converts
* that <code>long</code> to a <code>double</code> using the
* <code>longBitsToDouble</code> method in the class
- * <code>java.lang.Double</code>
+ * <code>java.lang.Double</code>
* <p>
* This method can read a <code>double</code> written by an object
* implementing the <code>writeDouble()</code> method in the
@@ -229,7 +229,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* @exception EOFException If end of file is reached before reading the float
* @exception IOException If any other error occurs
*
- * @see DataOutput#writeFloat
+ * @see DataOutput#writeFloat
* @see java.lang.Float#intBitsToFloat
*/
public final float readFloat () throws IOException
@@ -279,15 +279,15 @@ public class DataInputStream extends FilterInputStream implements DataInput
{
if (len < 0)
throw new IndexOutOfBoundsException("Negative length: " + len);
-
+
while (len > 0)
{
- // in.read will block until some data is available.
- int numread = in.read (buf, offset, len);
- if (numread < 0)
- throw new EOFException ();
- len -= numread;
- offset += numread;
+ // in.read will block until some data is available.
+ int numread = in.read (buf, offset, len);
+ if (numread < 0)
+ throw new EOFException ();
+ len -= numread;
+ offset += numread;
}
}
@@ -357,11 +357,11 @@ public class DataInputStream extends FilterInputStream implements DataInput
while (true)
{
int c = in.read();
- if (c == -1) // got an EOF
- return strb.length() > 0 ? strb.toString() : null;
- if (c == '\r')
- {
- int next_c = in.read();
+ if (c == -1) // got an EOF
+ return strb.length() > 0 ? strb.toString() : null;
+ if (c == '\r')
+ {
+ int next_c = in.read();
if (next_c != '\n' && next_c != -1)
{
if (!(in instanceof PushbackInputStream))
@@ -369,10 +369,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
((PushbackInputStream) in).unread(next_c);
}
break;
- }
+ }
if (c == '\n')
break;
- strb.append((char) c);
+ strb.append((char) c);
}
return strb.length() > 0 ? strb.toString() : "";
@@ -447,7 +447,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
readFully (buf, 0, 2);
return convertToShort (buf);
}
-
+
/**
* This method reads 8 unsigned bits into a Java <code>int</code>
* value from the stream. The value returned is in the range of 0 to
@@ -471,10 +471,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
/**
* This method reads 16 unsigned bits into a Java int value from the stream.
- * It operates by reading two bytes from the stream and converting them to
+ * It operates by reading two bytes from the stream and converting them to
* a single Java <code>int</code> The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
* As an example, if <code>byte1</code> and <code>byte2</code>
* represent the first and second byte read from the stream
@@ -523,10 +523,10 @@ public class DataInputStream extends FilterInputStream implements DataInput
* <p>
* <code>(char)byte1</code>
* <p>
- * If the first byte has 110 as its high order bits, then the
+ * If the first byte has 110 as its high order bits, then the
* character consists of two bytes. The bits that make up the character
* value are in positions 0 through 4 of the first byte and bit positions
- * 0 through 5 of the second byte. (The second byte should have
+ * 0 through 5 of the second byte. (The second byte should have
* 10 as its high order bits). These values are in most significant
* byte first (i.e., "big endian") order.
* <p>
@@ -551,7 +551,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* character encoding, then they would be converted to a Java
* <code>char</code> like so:
* <p>
- * <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
+ * <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
* (byte3 & 0x3F))</code>
* <p>
* Note that all characters are encoded in the method that requires
@@ -563,7 +563,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* <p>
* This method can read data that was written by an object implementing the
* <code>writeUTF()</code> method in <code>DataOutput</code>
- *
+ *
* @return The <code>String</code> read
*
* @exception EOFException If end of file is reached before reading
@@ -579,7 +579,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
}
/**
- * This method reads a String encoded in UTF-8 format from the
+ * This method reads a String encoded in UTF-8 format from the
* specified <code>DataInput</code> source.
*
* @param in The <code>DataInput</code> source to read from
@@ -593,7 +593,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
public static final String readUTF(DataInput in) throws IOException
{
final int UTFlen = in.readUnsignedShort ();
-
+
return readUTF(in, UTFlen);
}
@@ -601,7 +601,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
* This method is similar to <code>readUTF</code>, but the
* UTF-8 byte length is in 64 bits.
* This method is not public. It is used by <code>ObjectInputStream</code>.
- *
+ *
* @return The <code>String</code> read
*
* @exception EOFException If end of file is reached before reading
@@ -648,25 +648,25 @@ public class DataInputStream extends FilterInputStream implements DataInput
}
/**
- * This method attempts to skip and discard the specified number of bytes
- * in the input stream. It may actually skip fewer bytes than requested.
- * This method will not skip any bytes if passed a negative number of bytes
- * to skip.
+ * This method attempts to skip and discard the specified number of bytes
+ * in the input stream. It may actually skip fewer bytes than requested.
+ * This method will not skip any bytes if passed a negative number of bytes
+ * to skip.
*
* @param n The requested number of bytes to skip.
*
* @return The requested number of bytes to skip.
*
* @exception IOException If an error occurs.
- * @specnote The JDK docs claim that this returns the number of bytes
- * actually skipped. The JCL claims that this method can throw an
+ * @specnote The JDK docs claim that this returns the number of bytes
+ * actually skipped. The JCL claims that this method can throw an
* EOFException. Neither of these appear to be true in the JDK 1.3's
* implementation. This tries to implement the actual JDK behaviour.
*/
public final int skipBytes (int n) throws IOException
{
if (n <= 0)
- return 0;
+ return 0;
try
{
return (int) in.skip (n);
@@ -674,15 +674,15 @@ public class DataInputStream extends FilterInputStream implements DataInput
catch (EOFException x)
{
// do nothing.
- }
+ }
return n;
}
-
+
static boolean convertToBoolean (int b) throws EOFException
{
if (b < 0)
throw new EOFException ();
-
+
return (b != 0);
}
@@ -690,7 +690,7 @@ public class DataInputStream extends FilterInputStream implements DataInput
{
if (i < 0)
throw new EOFException ();
-
+
return (byte) i;
}
@@ -698,86 +698,86 @@ public class DataInputStream extends FilterInputStream implements DataInput
{
if (i < 0)
throw new EOFException ();
-
+
return (i & 0xFF);
}
static char convertToChar (byte[] buf)
{
return (char) ((buf [0] << 8)
- | (buf [1] & 0xff));
- }
+ | (buf [1] & 0xff));
+ }
static short convertToShort (byte[] buf)
{
return (short) ((buf [0] << 8)
- | (buf [1] & 0xff));
- }
+ | (buf [1] & 0xff));
+ }
static int convertToUnsignedShort (byte[] buf)
{
return (((buf [0] & 0xff) << 8)
- | (buf [1] & 0xff));
+ | (buf [1] & 0xff));
}
static int convertToInt (byte[] buf)
{
return (((buf [0] & 0xff) << 24)
- | ((buf [1] & 0xff) << 16)
- | ((buf [2] & 0xff) << 8)
- | (buf [3] & 0xff));
+ | ((buf [1] & 0xff) << 16)
+ | ((buf [2] & 0xff) << 8)
+ | (buf [3] & 0xff));
}
static long convertToLong (byte[] buf)
{
return (((long)(buf [0] & 0xff) << 56) |
- ((long)(buf [1] & 0xff) << 48) |
- ((long)(buf [2] & 0xff) << 40) |
- ((long)(buf [3] & 0xff) << 32) |
- ((long)(buf [4] & 0xff) << 24) |
- ((long)(buf [5] & 0xff) << 16) |
- ((long)(buf [6] & 0xff) << 8) |
- ((long)(buf [7] & 0xff)));
+ ((long)(buf [1] & 0xff) << 48) |
+ ((long)(buf [2] & 0xff) << 40) |
+ ((long)(buf [3] & 0xff) << 32) |
+ ((long)(buf [4] & 0xff) << 24) |
+ ((long)(buf [5] & 0xff) << 16) |
+ ((long)(buf [6] & 0xff) << 8) |
+ ((long)(buf [7] & 0xff)));
}
// FIXME: This method should be re-thought. I suspect we have multiple
// UTF-8 decoders floating around. We should use the standard charset
// converters, maybe and adding a direct call into one of the new
// NIO converters for a super-fast UTF8 decode.
- static String convertFromUTF (byte[] buf)
+ static String convertFromUTF (byte[] buf)
throws EOFException, UTFDataFormatException
{
- // Give StringBuffer an initial estimated size to avoid
+ // Give StringBuffer an initial estimated size to avoid
// enlarge buffer frequently
CPStringBuilder strbuf = new CPStringBuilder (buf.length / 2 + 2);
for (int i = 0; i < buf.length; )
{
- if ((buf [i] & 0x80) == 0) // bit pattern 0xxxxxxx
- strbuf.append ((char) (buf [i++] & 0xFF));
- else if ((buf [i] & 0xE0) == 0xC0) // bit pattern 110xxxxx
- {
- if (i + 1 >= buf.length
- || (buf [i + 1] & 0xC0) != 0x80)
- throw new UTFDataFormatException ();
-
- strbuf.append((char) (((buf [i++] & 0x1F) << 6)
- | (buf [i++] & 0x3F)));
- }
- else if ((buf [i] & 0xF0) == 0xE0) // bit pattern 1110xxxx
- {
- if (i + 2 >= buf.length
- || (buf [i + 1] & 0xC0) != 0x80
- || (buf [i + 2] & 0xC0) != 0x80)
- throw new UTFDataFormatException ();
-
- strbuf.append ((char) (((buf [i++] & 0x0F) << 12)
- | ((buf [i++] & 0x3F) << 6)
- | (buf [i++] & 0x3F)));
- }
- else // must be ((buf [i] & 0xF0) == 0xF0 || (buf [i] & 0xC0) == 0x80)
- throw new UTFDataFormatException (); // bit patterns 1111xxxx or
- // 10xxxxxx
+ if ((buf [i] & 0x80) == 0) // bit pattern 0xxxxxxx
+ strbuf.append ((char) (buf [i++] & 0xFF));
+ else if ((buf [i] & 0xE0) == 0xC0) // bit pattern 110xxxxx
+ {
+ if (i + 1 >= buf.length
+ || (buf [i + 1] & 0xC0) != 0x80)
+ throw new UTFDataFormatException ();
+
+ strbuf.append((char) (((buf [i++] & 0x1F) << 6)
+ | (buf [i++] & 0x3F)));
+ }
+ else if ((buf [i] & 0xF0) == 0xE0) // bit pattern 1110xxxx
+ {
+ if (i + 2 >= buf.length
+ || (buf [i + 1] & 0xC0) != 0x80
+ || (buf [i + 2] & 0xC0) != 0x80)
+ throw new UTFDataFormatException ();
+
+ strbuf.append ((char) (((buf [i++] & 0x0F) << 12)
+ | ((buf [i++] & 0x3F) << 6)
+ | (buf [i++] & 0x3F)));
+ }
+ else // must be ((buf [i] & 0xF0) == 0xF0 || (buf [i] & 0xC0) == 0x80)
+ throw new UTFDataFormatException (); // bit patterns 1111xxxx or
+ // 10xxxxxx
}
return strbuf.toString ();
diff --git a/java/io/DataOutput.java b/java/io/DataOutput.java
index 0d4362332..6eee4b702 100644
--- a/java/io/DataOutput.java
+++ b/java/io/DataOutput.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,9 +44,9 @@ package java.io;
*/
/**
- * This interface is implemented by classes that can wrte data to streams
+ * This interface is implemented by classes that can wrte data to streams
* from Java primitive types. This data can subsequently be read back
- * by classes implementing the <code>DataInput</code> interface.
+ * by classes implementing the <code>DataInput</code> interface.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@cygnus.com)
@@ -58,7 +58,7 @@ public interface DataOutput
/**
* This method writes a Java boolean value to an output stream. If
* <code>value</code> is <code>true</code>, a byte with the value of
- * 1 will be written, otherwise a byte with the value of 0 will be
+ * 1 will be written, otherwise a byte with the value of 0 will be
* written.
*
* The value written can be read using the <code>readBoolean</code>
@@ -74,7 +74,7 @@ public interface DataOutput
/**
* This method writes a Java byte value to an output stream. The
- * byte to be written will be in the lowest 8 bits of the
+ * byte to be written will be in the lowest 8 bits of the
* <code>int</code> value passed.
*
* The value written can be read using the <code>readByte</code> or
@@ -236,10 +236,10 @@ public interface DataOutput
void writeBytes(String value) throws IOException;
/**
- * This method writes all the characters of a <code>String</code> to an
+ * This method writes all the characters of a <code>String</code> to an
* output stream as an array of <code>char</code>'s. Each character
* is written using the method specified in the <code>writeChar</code>
- * method.
+ * method.
*
* @param value The String to write
*
@@ -253,13 +253,13 @@ public interface DataOutput
* This method writes a Java <code>String</code> to the stream in a modified
* UTF-8 format. First, two bytes are written to the stream indicating the
* number of bytes to follow. This is written in the form of a Java
- * <code>short</code> value in the same manner used by the
- * <code>writeShort</code> method. Note that this is the number of
+ * <code>short</code> value in the same manner used by the
+ * <code>writeShort</code> method. Note that this is the number of
* bytes in the
* encoded <code>String</code> not the <code>String</code> length. Next
* come the encoded characters. Each character in the <code>String</code>
* is encoded as either one, two or three bytes. For characters in the
- * range of <code>\u0001</code> to <code>\u007F</code>, one byte is used.
+ * range of <code>\u0001</code> to <code>\u007F</code>, one byte is used.
* The character
* value goes into bits 0-7 and bit eight is 0. For characters in the range
* of <code>\u0080</code> to <code>\u007FF</code>, two bytes are used. Bits
@@ -308,14 +308,14 @@ public interface DataOutput
void write(byte[] buf) throws IOException;
/**
- * This method writes raw bytes from the passed array <code>buf</code>
+ * This method writes raw bytes from the passed array <code>buf</code>
* starting
- * <code>offset</code> bytes into the buffer. The number of bytes
- * written will be exactly <code>len</code>.
+ * <code>offset</code> bytes into the buffer. The number of bytes
+ * written will be exactly <code>len</code>.
*
* @param buf The buffer from which to write the data
* @param offset The offset into the buffer to start writing data from
- * @param len The number of bytes to write from the buffer to the output
+ * @param len The number of bytes to write from the buffer to the output
* stream
*
* @exception IOException If any other error occurs
@@ -323,4 +323,3 @@ public interface DataOutput
void write(byte[] buf, int offset, int len) throws IOException;
} // interface DataOutput
-
diff --git a/java/io/DataOutputStream.java b/java/io/DataOutputStream.java
index 435ff76d1..4837795c6 100644
--- a/java/io/DataOutputStream.java
+++ b/java/io/DataOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -66,12 +66,12 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
* Utf8 byte buffer, used by writeUTF()
*/
private byte[] buf;
-
+
/**
* This method initializes an instance of <code>DataOutputStream</code> to
* write its data to the specified underlying <code>OutputStream</code>
*
- * @param out The subordinate <code>OutputStream</code> to which this
+ * @param out The subordinate <code>OutputStream</code> to which this
* object will write
*/
public DataOutputStream (OutputStream out)
@@ -127,7 +127,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
*
* @exception IOException If an error occurs.
*/
- public synchronized void write (byte[] buf, int offset, int len)
+ public synchronized void write (byte[] buf, int offset, int len)
throws IOException
{
out.write(buf, offset, len);
@@ -162,7 +162,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
* The value written can be read using the <code>readByte</code> or
* <code>readUnsignedByte</code> methods in <code>DataInput</code>.
*
- * @param value The <code>byte</code> to write to the stream, passed as
+ * @param value The <code>byte</code> to write to the stream, passed as
* the low eight bits of an <code>int</code>.
*
* @exception IOException If an error occurs
@@ -215,7 +215,7 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
* The value written can be read using the <code>readChar</code>
* method in <code>DataInput</code>.
*
- * @param value The <code>char</code> value to write,
+ * @param value The <code>char</code> value to write,
* passed as an <code>int</code>.
*
* @exception IOException If an error occurs
@@ -394,18 +394,18 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
for (int i = start; i < len; ++i)
{
- char c = value.charAt(i);
- if (c >= '\u0001' && c <= '\u007f')
- sum += 1;
- else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
- sum += 2;
- else
- sum += 3;
+ char c = value.charAt(i);
+ if (c >= '\u0001' && c <= '\u007f')
+ sum += 1;
+ else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
+ sum += 2;
+ else
+ sum += 3;
}
return sum;
}
-
+
/**
* This method writes a Java <code>String</code> to the stream in a modified
* UTF-8 format. First, two bytes are written to the stream indicating the
@@ -507,34 +507,33 @@ public class DataOutputStream extends FilterOutputStream implements DataOutput
if (buf == null)
buf = new byte[512];
-
+
do
{
- while (i < len && pos < buf.length - 3)
- {
- char c = value.charAt(i++);
- if (c >= '\u0001' && c <= '\u007f')
+ while (i < len && pos < buf.length - 3)
+ {
+ char c = value.charAt(i++);
+ if (c >= '\u0001' && c <= '\u007f')
buf[pos++] = (byte) c;
- else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
- {
- buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6)));
- buf[pos++] = (byte) (0x80 | (0x3f & c));
- }
- else
- {
- // JSL says the first byte should be or'd with 0xc0, but
- // that is a typo. Unicode says 0xe0, and that is what is
- // consistent with DataInputStream.
- buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12)));
- buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6)));
- buf[pos++] = (byte) (0x80 | (0x3f & c));
- }
- }
- write(buf, 0, pos);
- pos = 0;
+ else if (c == '\u0000' || (c >= '\u0080' && c <= '\u07ff'))
+ {
+ buf[pos++] = (byte) (0xc0 | (0x1f & (c >> 6)));
+ buf[pos++] = (byte) (0x80 | (0x3f & c));
+ }
+ else
+ {
+ // JSL says the first byte should be or'd with 0xc0, but
+ // that is a typo. Unicode says 0xe0, and that is what is
+ // consistent with DataInputStream.
+ buf[pos++] = (byte) (0xe0 | (0x0f & (c >> 12)));
+ buf[pos++] = (byte) (0x80 | (0x3f & (c >> 6)));
+ buf[pos++] = (byte) (0x80 | (0x3f & c));
+ }
+ }
+ write(buf, 0, pos);
+ pos = 0;
}
while (i < len);
}
} // class DataOutputStream
-
diff --git a/java/io/DeleteFileHelper.java b/java/io/DeleteFileHelper.java
index 6e33adce8..a2b96bb41 100644
--- a/java/io/DeleteFileHelper.java
+++ b/java/io/DeleteFileHelper.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,7 +56,7 @@ final class DeleteFileHelper extends Thread
if (filesToDelete == null)
{
filesToDelete = new ArrayList<File>();
-
+
AccessController.doPrivileged(new PrivilegedAction()
{
public Object run()
@@ -70,12 +70,12 @@ final class DeleteFileHelper extends Thread
// Shutdown is already in progress, so we can't
// register ours.
}
-
+
return null;
}
});
}
-
+
filesToDelete.add(file);
}
@@ -83,14 +83,14 @@ final class DeleteFileHelper extends Thread
{
for (File file : filesToDelete)
{
- try
- {
- file.delete();
- }
- catch (Exception e)
- {
- // Do nothing here.
- }
+ try
+ {
+ file.delete();
+ }
+ catch (Exception e)
+ {
+ // Do nothing here.
+ }
}
}
@@ -98,7 +98,7 @@ final class DeleteFileHelper extends Thread
DeleteFileHelper()
{
}
-
+
public void run()
{
deleteFiles();
diff --git a/java/io/EOFException.java b/java/io/EOFException.java
index cfedb7d9e..0d90a3f0f 100644
--- a/java/io/EOFException.java
+++ b/java/io/EOFException.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package java.io;
/**
- * This exception is thrown when the end of the file or stream was
+ * This exception is thrown when the end of the file or stream was
* encountered unexpectedly. This is not the normal way that an EOF
* condition is reported; such as a special value like -1 being returned.
* However, certain types of streams expecting certain data in a certain
diff --git a/java/io/Externalizable.java b/java/io/Externalizable.java
index 113c19ff6..7399dab3b 100644
--- a/java/io/Externalizable.java
+++ b/java/io/Externalizable.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,20 +40,20 @@ package java.io;
/**
* This interface provides a way that classes can completely control how
- * the data of their object instances are written and read to and from
- * streams. It has two methods which are used to write the data to a stream
- * and to read the data from a stream. The read method must read the data
- * in exactly the way it was written by the write method.
+ * the data of their object instances are written and read to and from
+ * streams. It has two methods which are used to write the data to a stream
+ * and to read the data from a stream. The read method must read the data
+ * in exactly the way it was written by the write method.
* <p>
* Note that classes which implement this interface must take into account
- * that all superclass data must also be written to the stream as well.
+ * that all superclass data must also be written to the stream as well.
* The class implementing this interface must figure out how to make that
* happen.
* <p>
- * This interface can be used to provide object persistence. When an
+ * This interface can be used to provide object persistence. When an
* object is to be stored externally, the <code>writeExternal</code> method is
* called to save state. When the object is restored, an instance is
- * created using the default no-argument constructor and the
+ * created using the default no-argument constructor and the
* <code>readExternal</code> method is used to restore the state.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -63,9 +63,9 @@ public interface Externalizable extends Serializable
/**
* This method restores an object's state by reading in the instance data
* for the object from the passed in stream. Note that this stream is not
- * a subclass of <code>InputStream</code>, but rather is a class that
+ * a subclass of <code>InputStream</code>, but rather is a class that
* implements
- * the <code>ObjectInput</code> interface. That interface provides a
+ * the <code>ObjectInput</code> interface. That interface provides a
* mechanism for
* reading in Java data types from a stream.
* <p>
@@ -77,28 +77,28 @@ public interface Externalizable extends Serializable
* for that object must be found and loaded. If that operation fails,
* then this method throws a <code>ClassNotFoundException</code>
*
- * @param in An <code>ObjectInput</code> instance for reading in the object
+ * @param in An <code>ObjectInput</code> instance for reading in the object
* state
*
- * @exception ClassNotFoundException If the class of an object being
+ * @exception ClassNotFoundException If the class of an object being
* restored cannot be found
* @exception IOException If any other error occurs
*/
- void readExternal(ObjectInput in)
+ void readExternal(ObjectInput in)
throws ClassNotFoundException, IOException;
/**
* This method is responsible for writing the instance data of an object
* to the passed in stream. Note that this stream is not a subclass of
* <code>OutputStream</code>, but rather is a class that implements the
- * <code>ObjectOutput</code> interface. That interface provides a
+ * <code>ObjectOutput</code> interface. That interface provides a
* number of methods
* for writing Java data values to a stream.
* <p>
* Not that the implementation of this method must be coordinated with
* the implementation of <code>readExternal</code>.
*
- * @param out An <code>ObjectOutput</code> instance for writing the
+ * @param out An <code>ObjectOutput</code> instance for writing the
* object state
*
* @exception IOException If an error occurs
diff --git a/java/io/File.java b/java/io/File.java
index f02331044..4f670e147 100644
--- a/java/io/File.java
+++ b/java/io/File.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -76,12 +76,12 @@ public class File implements Serializable, Comparable<File>
/**
* This is the first character of the file separator string. On many
- * hosts (for example, on the GNU system), this represents the entire
+ * hosts (for example, on the GNU system), this represents the entire
* separator string. The complete separator string is obtained from the
* <code>file.separator</code>system property.
*/
public static final char separatorChar = separator.charAt(0);
-
+
/**
* This is the string that is used to separate the host name from the
* path name in paths that include the host name. It is the value of
@@ -89,7 +89,7 @@ public class File implements Serializable, Comparable<File>
*/
public static final String pathSeparator
= SystemProperties.getProperty("path.separator");
-
+
/**
* This is the first character of the string used to separate the host name
* from the path name in paths that include a host. The separator string
@@ -102,17 +102,17 @@ public class File implements Serializable, Comparable<File>
* may be an absolute or relative path name.
*/
private String path;
-
-
+
+
/**
* The time (millisecond), when the last temporary file was created.
*/
private static long last_tmp;
-
+
/**
* The number of files, created during the current millisecond.
*/
- private static int n_created;
+ private static int n_created;
/**
* This method tests whether or not the current thread is allowed to
@@ -121,10 +121,10 @@ public class File implements Serializable, Comparable<File>
* (if any) allows access to the file via it's <code>checkRead</code>
* method 3) the file is readable.
*
- * @return <code>true</code> if reading is allowed,
+ * @return <code>true</code> if reading is allowed,
* <code>false</code> otherwise
*
- * @exception SecurityException If the <code>SecurityManager</code>
+ * @exception SecurityException If the <code>SecurityManager</code>
* does not allow access to the file
*/
public boolean canRead()
@@ -144,17 +144,17 @@ public class File implements Serializable, Comparable<File>
* whether or not a non-existent file can be created, check the parent
* directory for write access.
*
- * @return <code>true</code> if writing is allowed, <code>false</code>
+ * @return <code>true</code> if writing is allowed, <code>false</code>
* otherwise
*
- * @exception SecurityException If the <code>SecurityManager</code>
+ * @exception SecurityException If the <code>SecurityManager</code>
* does not allow access to the file
*/
public boolean canWrite()
{
// First do a SecurityCheck before doing anything else.
checkWrite();
-
+
// Test for existence. This is required by the spec
if (! VMFile.exists(path))
return false;
@@ -172,10 +172,10 @@ public class File implements Serializable, Comparable<File>
* (if any) allows access to the file via it's <code>checkExec</code>
* method 3) the file is executable.
*
- * @return <code>true</code> if execution is allowed,
+ * @return <code>true</code> if execution is allowed,
* <code>false</code> otherwise
*
- * @exception SecurityException If the <code>SecurityManager</code>
+ * @exception SecurityException If the <code>SecurityManager</code>
* does not allow access to the file
*/
public boolean canExecute()
@@ -184,7 +184,7 @@ public class File implements Serializable, Comparable<File>
return false;
checkExec();
-
+
return VMFile.canExecute(path);
}
@@ -214,7 +214,7 @@ public class File implements Serializable, Comparable<File>
* This method deletes the file represented by this object. If this file
* is a directory, it must be empty in order for the delete to succeed.
*
- * @return <code>true</code> if the file was deleted, <code>false</code>
+ * @return <code>true</code> if the file was deleted, <code>false</code>
* otherwise
*
* @exception SecurityException If deleting of the file is not allowed
@@ -222,33 +222,33 @@ public class File implements Serializable, Comparable<File>
public synchronized boolean delete()
{
SecurityManager s = System.getSecurityManager();
-
+
if (s != null)
s.checkDelete(path);
-
+
return VMFile.delete(path);
}
/**
- * This method tests two <code>File</code> objects for equality by
+ * This method tests two <code>File</code> objects for equality by
* comparing the path of the specified <code>File</code> against the path
* of this object. The two objects are equal if an only if 1) The
* argument is not null 2) The argument is a <code>File</code> object and
* 3) The path of the <code>File</code>argument is equal to the path
* of this object.
* <p>
- * The paths of the files are determined by calling the
+ * The paths of the files are determined by calling the
* <code>getPath()</code>
* method on each object.
*
- * @return <code>true</code> if the two objects are equal,
+ * @return <code>true</code> if the two objects are equal,
* <code>false</code> otherwise.
*/
public boolean equals(Object obj)
{
if (! (obj instanceof File))
return false;
-
+
File other = (File) obj;
if (VMFile.IS_CASE_SENSITIVE)
@@ -281,7 +281,7 @@ public class File implements Serializable, Comparable<File>
{
path = normalizePath (name);
}
-
+
// Remove duplicate and redundant separator characters.
private String normalizePath(String p)
{
@@ -290,12 +290,12 @@ public class File implements Serializable, Comparable<File>
if (separatorChar == '\\')
{
p = p.replace ('/', '\\');
- // We have to special case the "\c:" prefix.
- if (p.length() > 2 && p.charAt(0) == '\\' &&
- ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') ||
- (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) &&
- p.charAt(2) == ':')
- p = p.substring(1);
+ // We have to special case the "\c:" prefix.
+ if (p.length() > 2 && p.charAt(0) == '\\' &&
+ ((p.charAt(1) >= 'a' && p.charAt(1) <= 'z') ||
+ (p.charAt(1) >= 'A' && p.charAt(1) <= 'Z')) &&
+ p.charAt(2) == ':')
+ p = p.substring(1);
}
int dupIndex = p.indexOf(dupSeparator);
@@ -310,25 +310,25 @@ public class File implements Serializable, Comparable<File>
// Ignore trailing separator (though on Windows "a:\", for
// example, is a valid and minimal path).
if (plen > 1 && p.charAt (plen - 1) == separatorChar)
- {
- if (! (separatorChar == '\\' && ((plen == 3 && p.charAt(1) == ':')
+ {
+ if (! (separatorChar == '\\' && ((plen == 3 && p.charAt(1) == ':')
|| (plen == 2 && p.charAt(0) == separatorChar))))
- return p.substring (0, plen - 1);
- }
- else
- return p;
+ return p.substring (0, plen - 1);
+ }
+ else
+ return p;
}
-
+
CPStringBuilder newpath = new CPStringBuilder(plen);
int last = 0;
while (dupIndex != -1)
{
newpath.append(p.substring(last, dupIndex));
- // Ignore the duplicate path characters.
- while (p.charAt(dupIndex) == separatorChar)
- {
- dupIndex++;
- if (dupIndex == plen)
+ // Ignore the duplicate path characters.
+ while (p.charAt(dupIndex) == separatorChar)
+ {
+ dupIndex++;
+ if (dupIndex == plen)
{
if ((separatorChar == '\\'
&& newpath.length() == 2
@@ -337,14 +337,14 @@ public class File implements Serializable, Comparable<File>
{
newpath.append(separatorChar);
}
- return newpath.toString();
+ return newpath.toString();
}
- }
- newpath.append(separatorChar);
- last = dupIndex;
- dupIndex = p.indexOf(dupSeparator, last);
+ }
+ newpath.append(separatorChar);
+ last = dupIndex;
+ dupIndex = p.indexOf(dupSeparator, last);
}
-
+
// Again, ignore possible trailing separator (except special cases
// like "a:\" on Windows).
int end;
@@ -360,10 +360,10 @@ public class File implements Serializable, Comparable<File>
else
end = plen;
newpath.append(p.substring(last, end));
-
+
return newpath.toString();
}
-
+
/**
* This method initializes a new <code>File</code> object to represent
* a file in the specified named directory. The path name to the file
@@ -380,35 +380,35 @@ public class File implements Serializable, Comparable<File>
throw new NullPointerException();
if (dirPath != null)
{
- if (dirPath.length() > 0)
- {
- // Try to be smart about the number of separator characters.
- if (dirPath.charAt(dirPath.length() - 1) == separatorChar
- || name.length() == 0)
- path = normalizePath(dirPath + name);
- else
- path = normalizePath(dirPath + separatorChar + name);
- }
- else
- {
- // If dirPath is empty, use a system dependant
- // default prefix.
- // Note that the leading separators in name have
- // to be chopped off, to prevent them forming
- // a UNC prefix on Windows.
- if (separatorChar == '\\' /* TODO use ON_WINDOWS */)
- {
- int skip = 0;
- while(name.length() > skip
- && (name.charAt(skip) == separatorChar
- || name.charAt(skip) == '/'))
- {
- skip++;
- }
- name = name.substring(skip);
- }
- path = normalizePath(separatorChar + name);
- }
+ if (dirPath.length() > 0)
+ {
+ // Try to be smart about the number of separator characters.
+ if (dirPath.charAt(dirPath.length() - 1) == separatorChar
+ || name.length() == 0)
+ path = normalizePath(dirPath + name);
+ else
+ path = normalizePath(dirPath + separatorChar + name);
+ }
+ else
+ {
+ // If dirPath is empty, use a system dependant
+ // default prefix.
+ // Note that the leading separators in name have
+ // to be chopped off, to prevent them forming
+ // a UNC prefix on Windows.
+ if (separatorChar == '\\' /* TODO use ON_WINDOWS */)
+ {
+ int skip = 0;
+ while(name.length() > skip
+ && (name.charAt(skip) == separatorChar
+ || name.charAt(skip) == '/'))
+ {
+ skip++;
+ }
+ name = name.substring(skip);
+ }
+ path = normalizePath(separatorChar + name);
+ }
}
else
path = normalizePath(name);
@@ -439,10 +439,10 @@ public class File implements Serializable, Comparable<File>
public File(URI uri)
{
if (uri == null)
- throw new NullPointerException("uri is null");
+ throw new NullPointerException("uri is null");
if (!uri.getScheme().equals("file"))
- throw new IllegalArgumentException("invalid uri protocol");
+ throw new IllegalArgumentException("invalid uri protocol");
String name = uri.getPath();
if (name == null)
@@ -489,7 +489,7 @@ public class File implements Serializable, Comparable<File>
* "." and "..", and symbolic links.
* <p>
* Note that this method, unlike the other methods which return path
- * names, can throw an IOException. This is because native method
+ * names, can throw an IOException. This is because native method
* might be required in order to resolve the canonical path
*
* @exception IOException If an error occurs
@@ -499,11 +499,11 @@ public class File implements Serializable, Comparable<File>
// On Windows, getAbsolutePath might end up calling us, so we
// have to special case that call to avoid infinite recursion.
if (separatorChar == '\\' && path.length() == 2 &&
- ((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') ||
- (path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) &&
- path.charAt(1) == ':')
+ ((path.charAt(0) >= 'a' && path.charAt(0) <= 'z') ||
+ (path.charAt(0) >= 'A' && path.charAt(0) <= 'Z')) &&
+ path.charAt(1) == ':')
{
- return VMFile.toCanonicalForm(path);
+ return VMFile.toCanonicalForm(path);
}
// Call getAbsolutePath first to make sure that we do the
// current directory handling, because the native code
@@ -536,7 +536,7 @@ public class File implements Serializable, Comparable<File>
*/
public String getName()
{
- return VMFile.getName(path);
+ return VMFile.getName(path);
}
/**
@@ -551,11 +551,11 @@ public class File implements Serializable, Comparable<File>
{
String prefix = null;
int nameSeqIndex = 0;
-
+
if (path.equals(""))
return null;
- // The "prefix", if present, is the leading "/" on UNIX and
+ // The "prefix", if present, is the leading "/" on UNIX and
// either the drive specifier (e.g. "C:") or the leading "\\"
// of a UNC network path on Windows.
if (separatorChar == '/' && path.charAt (0) == '/')
@@ -575,7 +575,7 @@ public class File implements Serializable, Comparable<File>
}
}
- // According to the JDK docs, the returned parent path is the
+ // According to the JDK docs, the returned parent path is the
// portion of the name sequence before the last separator
// character, if found, prefixed by the prefix, otherwise null.
if (nameSeqIndex < path.length())
@@ -586,7 +586,7 @@ public class File implements Serializable, Comparable<File>
return prefix;
else if (last == (nameSeq.length() - 1))
// Note: The path would not have a trailing separator
- // except for cases like "C:\" on Windows (see
+ // except for cases like "C:\" on Windows (see
// normalizePath( )), where Sun's JRE 1.4 returns null.
return null;
else if (last == 0)
@@ -598,8 +598,8 @@ public class File implements Serializable, Comparable<File>
return nameSeq.substring (0, last);
}
else
- // Sun's JRE 1.4 returns null if the prefix is the only
- // component of the path - so "/" gives null on UNIX and
+ // Sun's JRE 1.4 returns null if the prefix is the only
+ // component of the path - so "/" gives null on UNIX and
// "C:", "\\", etc. return null on Windows.
return null;
}
@@ -608,7 +608,7 @@ public class File implements Serializable, Comparable<File>
* This method returns a <code>File</code> object representing the parent
* file of this one.
*
- * @return a <code>File</code> for the parent of this object.
+ * @return a <code>File</code> for the parent of this object.
* <code>null</code>
* will be returned if this object does not have a parent.
*
@@ -652,7 +652,7 @@ public class File implements Serializable, Comparable<File>
* by system. As an example, on GNU systems, a path is absolute if it starts
* with a "/".
*
- * @return <code>true</code> if this object represents an absolute
+ * @return <code>true</code> if this object represents an absolute
* file name, <code>false</code> otherwise.
*/
public boolean isAbsolute()
@@ -664,7 +664,7 @@ public class File implements Serializable, Comparable<File>
* This method tests whether or not the file represented by this object
* is a directory. In order for this method to return <code>true</code>,
* the file represented by this object must exist and be a directory.
- *
+ *
* @return <code>true</code> if this file is a directory, <code>false</code>
* otherwise
*
@@ -673,7 +673,7 @@ public class File implements Serializable, Comparable<File>
public boolean isDirectory()
{
checkRead();
- return VMFile.isDirectory(path);
+ return VMFile.isDirectory(path);
}
/**
@@ -681,7 +681,7 @@ public class File implements Serializable, Comparable<File>
* is a "plain" file. A file is a plain file if and only if it 1) Exists,
* 2) Is not a directory or other type of special file.
*
- * @return <code>true</code> if this is a plain file, <code>false</code>
+ * @return <code>true</code> if this is a plain file, <code>false</code>
* otherwise
*
* @exception SecurityException If reading of the file is not permitted
@@ -713,7 +713,7 @@ public class File implements Serializable, Comparable<File>
* time value returned is an abstract value that should not be interpreted
* as a specified time value. It is only useful for comparing to other
* such time values returned on the same system. In that case, the larger
- * value indicates a more recent modification time.
+ * value indicates a more recent modification time.
* <p>
* If the file does not exist, then a value of 0 is returned.
*
@@ -759,13 +759,13 @@ public class File implements Serializable, Comparable<File>
* directory. If read access to the directory is denied, an exception
* will be thrown.
*
- * @param filter An object which will identify files to exclude from
+ * @param filter An object which will identify files to exclude from
* the directory listing.
*
- * @return An array of files in the directory, or <code>null</code>
+ * @return An array of files in the directory, or <code>null</code>
* if this object does not represent a valid directory.
- *
- * @exception SecurityException If read access is not allowed to the
+ *
+ * @exception SecurityException If read access is not allowed to the
* directory by the <code>SecurityManager</code>
*/
public String[] list(FilenameFilter filter)
@@ -774,10 +774,10 @@ public class File implements Serializable, Comparable<File>
if (!exists() || !isDirectory())
return null;
-
+
// Get the list of files
String files[] = VMFile.list(path);
-
+
// Check if an error occured in listInternal().
// This is an unreadable directory, pretend there is nothing inside.
if (files == null)
@@ -785,15 +785,15 @@ public class File implements Serializable, Comparable<File>
if (filter == null)
return files;
-
+
// Apply the filter
int count = 0;
for (int i = 0; i < files.length; i++)
{
if (filter.accept(this, files[i]))
- ++count;
+ ++count;
else
- files[i] = null;
+ files[i] = null;
}
String[] retfiles = new String[count];
@@ -817,10 +817,10 @@ public class File implements Serializable, Comparable<File>
* directory. If read access to the directory is denied, an exception
* will be thrown.
*
- * @return An array of files in the directory, or <code>null</code> if
+ * @return An array of files in the directory, or <code>null</code> if
* this object does not represent a valid directory.
- *
- * @exception SecurityException If read access is not allowed to the
+ *
+ * @exception SecurityException If read access is not allowed to the
* directory by the <code>SecurityManager</code>
*/
public String[] list()
@@ -850,14 +850,14 @@ public class File implements Serializable, Comparable<File>
{
return listFiles((FilenameFilter) null);
}
-
+
/**
* This method returns an array of <code>File</code> objects representing
* all the files in the directory represented by this object. If this
* object does not represent a directory, <code>null</code> is returned.
* Each of the returned <code>File</code> object is constructed with this
* object as its parent.
- * <p>
+ * <p>
* In this form of the <code>listFiles()</code> method, a filter is specified
* that allows the caller to control which files are returned in the
* list. The <code>FilenameFilter</code> specified is called for each
@@ -878,7 +878,7 @@ public class File implements Serializable, Comparable<File>
public File[] listFiles(FilenameFilter filter)
{
String[] filelist = list(filter);
-
+
if (filelist == null)
return null;
@@ -896,7 +896,7 @@ public class File implements Serializable, Comparable<File>
* object does not represent a directory, <code>null</code> is returned.
* Each of the returned <code>File</code> object is constructed with this
* object as its parent.
- * <p>
+ * <p>
* In this form of the <code>listFiles()</code> method, a filter is specified
* that allows the caller to control which files are returned in the
* list. The <code>FileFilter</code> specified is called for each
@@ -958,13 +958,13 @@ public class File implements Serializable, Comparable<File>
public URI toURI()
{
String abspath = getAbsolutePath();
-
+
if (isDirectory() || path.equals(""))
abspath = abspath + separatorChar;
if (separatorChar == '\\')
abspath = separatorChar + abspath;
-
+
try
{
return new URI("file", null, null, -1,
@@ -975,7 +975,7 @@ public class File implements Serializable, Comparable<File>
{
// Can't happen.
throw (InternalError) new InternalError("Unconvertible file: "
- + this).initCause(use);
+ + this).initCause(use);
}
}
@@ -986,7 +986,7 @@ public class File implements Serializable, Comparable<File>
*
* @return A <code>URL</code> for this object.
*
- * @exception MalformedURLException If the URL cannot be created
+ * @exception MalformedURLException If the URL cannot be created
* successfully.
*/
public URL toURL() throws MalformedURLException
@@ -998,7 +998,7 @@ public class File implements Serializable, Comparable<File>
/**
* This method creates a directory for the path represented by this object.
*
- * @return <code>true</code> if the directory was created,
+ * @return <code>true</code> if the directory was created,
* <code>false</code> otherwise
*
* @exception SecurityException If write access is not allowed to this file
@@ -1013,7 +1013,7 @@ public class File implements Serializable, Comparable<File>
* This method creates a directory for the path represented by this file.
* It will also create any intervening parent directories if necessary.
*
- * @return <code>true</code> if the directory was created,
+ * @return <code>true</code> if the directory was created,
* <code>false</code> otherwise
*
* @exception SecurityException If write access is not allowed to this file
@@ -1025,7 +1025,7 @@ public class File implements Serializable, Comparable<File>
{
return mkdir();
}
-
+
File f = new File(parent);
if (!f.exists())
{
@@ -1038,12 +1038,12 @@ public class File implements Serializable, Comparable<File>
}
/**
- * This method creates a temporary file in the specified directory. If
- * the directory name is null, then this method uses the system temporary
- * directory. The files created are guaranteed not to currently exist and
- * the same file name will never be used twice in the same virtual
- * machine instance.
- * The system temporary directory is determined by examinging the
+ * This method creates a temporary file in the specified directory. If
+ * the directory name is null, then this method uses the system temporary
+ * directory. The files created are guaranteed not to currently exist and
+ * the same file name will never be used twice in the same virtual
+ * machine instance.
+ * The system temporary directory is determined by examinging the
* <code>java.io.tmpdir</code> system property.
* <p>
* The <code>prefix</code> parameter is a sequence of at least three
@@ -1057,18 +1057,18 @@ public class File implements Serializable, Comparable<File>
*
* @param prefix The character prefix to use in generating the path name.
* @param suffix The character suffix to use in generating the path name.
- * @param directory The directory to create the file in, or
+ * @param directory The directory to create the file in, or
* <code>null</code> for the default temporary directory
*
* @exception IllegalArgumentException If the patterns is not valid
- * @exception SecurityException If there is no permission to perform
+ * @exception SecurityException If there is no permission to perform
* this operation
* @exception IOException If an error occurs
*
* @since 1.2
*/
public static synchronized File createTempFile(String prefix, String suffix,
- File directory)
+ File directory)
throws IOException
{
// Grab the system temp directory if necessary
@@ -1076,8 +1076,8 @@ public class File implements Serializable, Comparable<File>
{
String dirname = System.getProperty("java.io.tmpdir");
if (dirname == null)
- throw new IOException("Cannot determine system temporary directory");
-
+ throw new IOException("Cannot determine system temporary directory");
+
directory = new File(dirname);
if (! VMFile.exists(directory.path))
throw new IOException("System temporary directory "
@@ -1099,7 +1099,7 @@ public class File implements Serializable, Comparable<File>
// Now identify a file name and make sure it doesn't exist.
File file;
if (!VMFile.IS_DOS_8_3)
- {
+ {
do
{
long now = System.currentTimeMillis();
@@ -1111,7 +1111,7 @@ public class File implements Serializable, Comparable<File>
}
else
n_created++;
-
+
String name = Long.toHexString(now);
if (n_created > 0)
name += '_'+Integer.toHexString(n_created);
@@ -1143,16 +1143,16 @@ public class File implements Serializable, Comparable<File>
// Now create the file and return our file object
// XXX - FIXME race condition.
- VMFile.create(file.getAbsolutePath());
+ VMFile.create(file.getAbsolutePath());
return file;
}
/**
* This method sets the owner's read permission for the File represented by
* this object.
- *
+ *
* It is the same as calling <code>setReadable(readable, true)</code>.
- *
+ *
* @param <code>readable</code> <code>true</code> to set read permission,
* <code>false</code> to unset the read permission.
* @return <code>true</code> if the file permissions are changed,
@@ -1165,21 +1165,21 @@ public class File implements Serializable, Comparable<File>
{
return setReadable(readable, true);
}
-
+
/**
* This method sets the read permissions for the File represented by
* this object.
- *
+ *
* If <code>ownerOnly</code> is set to <code>true</code> then only the
* read permission bit for the owner of the file is changed.
- *
+ *
* If <code>ownerOnly</code> is set to <code>false</code>, the file
* permissions are changed so that the file can be read by everyone.
- *
+ *
* On unix like systems this sets the <code>user</code>, <code>group</code>
* and <code>other</code> read bits and is equal to call
* <code>chmod a+r</code> on the file.
- *
+ *
* @param <code>readable</code> <code>true</code> to set read permission,
* <code>false</code> to unset the read permission.
* @param <code>ownerOnly</code> <code>true</code> to set read permission
@@ -1195,13 +1195,13 @@ public class File implements Serializable, Comparable<File>
checkWrite();
return VMFile.setReadable(path, readable, ownerOnly);
}
-
+
/**
* This method sets the owner's write permission for the File represented by
* this object.
- *
- * It is the same as calling <code>setWritable(readable, true)</code>.
- *
+ *
+ * It is the same as calling <code>setWritable(readable, true)</code>.
+ *
* @param <code>writable</code> <code>true</code> to set write permission,
* <code>false</code> to unset write permission.
* @return <code>true</code> if the file permissions are changed,
@@ -1214,25 +1214,25 @@ public class File implements Serializable, Comparable<File>
{
return setWritable(writable, true);
}
-
+
/**
* This method sets the write permissions for the File represented by
* this object.
- *
+ *
* If <code>ownerOnly</code> is set to <code>true</code> then only the
* write permission bit for the owner of the file is changed.
- *
+ *
* If <code>ownerOnly</code> is set to <code>false</code>, the file
* permissions are changed so that the file can be written by everyone.
- *
+ *
* On unix like systems this set the <code>user</code>, <code>group</code>
* and <code>other</code> write bits and is equal to call
* <code>chmod a+w</code> on the file.
- *
+ *
* @param <code>writable</code> <code>true</code> to set write permission,
* <code>false</code> to unset write permission.
* @param <code>ownerOnly</code> <code>true</code> to set write permission
- * for owner only, <code>false</code> for all.
+ * for owner only, <code>false</code> for all.
* @return <code>true</code> if the file permissions are changed,
* <code>false</code> otherwise.
* @exception SecurityException If write access of the file is not permitted.
@@ -1244,13 +1244,13 @@ public class File implements Serializable, Comparable<File>
checkWrite();
return VMFile.setWritable(path, writable, ownerOnly);
}
-
+
/**
* This method sets the owner's execute permission for the File represented
* by this object.
- *
- * It is the same as calling <code>setExecutable(readable, true)</code>.
- *
+ *
+ * It is the same as calling <code>setExecutable(readable, true)</code>.
+ *
* @param <code>executable</code> <code>true</code> to set execute permission,
* <code>false</code> to unset execute permission.
* @return <code>true</code> if the file permissions are changed,
@@ -1259,29 +1259,29 @@ public class File implements Serializable, Comparable<File>
* @see #setExecutable(boolean, boolean)
* @since 1.6
*/
- public boolean setExecutable(boolean executable)
+ public boolean setExecutable(boolean executable)
{
return setExecutable(executable, true);
}
-
+
/**
* This method sets the execute permissions for the File represented by
* this object.
- *
+ *
* If <code>ownerOnly</code> is set to <code>true</code> then only the
* execute permission bit for the owner of the file is changed.
- *
+ *
* If <code>ownerOnly</code> is set to <code>false</code>, the file
* permissions are changed so that the file can be executed by everyone.
- *
+ *
* On unix like systems this set the <code>user</code>, <code>group</code>
* and <code>other</code> write bits and is equal to call
* <code>chmod a+x</code> on the file.
- *
+ *
* @param <code>executable</code> <code>true</code> to set write permission,
* <code>false</code> to unset write permission.
* @param <code>ownerOnly</code> <code>true</code> to set write permission
- * for owner only, <code>false</code> for all.
+ * for owner only, <code>false</code> for all.
* @return <code>true</code> if the file permissions are changed,
* <code>false</code> otherwise.
* @exception SecurityException If write access of the file is not permitted.
@@ -1296,8 +1296,8 @@ public class File implements Serializable, Comparable<File>
/**
* Get the total space for the partition pointed by this file path, in bytes.
- *
- * @return the total number of bytes in this partition.
+ *
+ * @return the total number of bytes in this partition.
* @since 1.6
*/
public long getTotalSpace()
@@ -1307,14 +1307,14 @@ public class File implements Serializable, Comparable<File>
if (s != null)
s.checkPermission(new RuntimePermission("getFileSystemAttributes"));
checkRead();
-
+
return VMFile.getTotalSpace(path);
}
-
+
/**
* Get the free space in the partition pointed by this file path, in bytes.
- *
- * @return the number of free bytes in this partition.
+ *
+ * @return the number of free bytes in this partition.
* @since 1.6
*/
public long getFreeSpace()
@@ -1324,25 +1324,25 @@ public class File implements Serializable, Comparable<File>
if (s != null)
s.checkPermission(new RuntimePermission("getFileSystemAttributes"));
checkRead();
-
+
return VMFile.getFreeSpace(path);
}
-
+
/**
* Get the usable space in the partition pointed by this file path, in bytes.
* This is not necessarily the same as the number returned by
* {@link #getFreeSpace()}.
- *
+ *
* <strong>Implementation note</strong>: Unlike the RI, on Linux and UNIX
* like systems this methods take into account the reserved space for the
* "root" user. This means that the returned results will be a little
* different if a normal user or root perform the query.
- *
+ *
* Also, the bytes returned should be interpreted as an hint, and may be
* different at each call of this method or even right after the method
* returns.
- *
- * @return the number of usable bytes in this partition.
+ *
+ * @return the number of usable bytes in this partition.
* @since 1.6
*/
public long getUsableSpace()
@@ -1352,18 +1352,18 @@ public class File implements Serializable, Comparable<File>
if (s != null)
s.checkPermission(new RuntimePermission("getFileSystemAttributes"));
checkRead();
-
+
// root users can use the reserved extra space
String user = System.getProperty("user.name");
if (user != null && user.equals("root"))
return VMFile.getFreeSpace(path);
-
+
return VMFile.getUsableSpace(path);
}
-
+
/**
* This method sets the file represented by this object to be read only.
- * A read only file or directory cannot be modified. Please note that
+ * A read only file or directory cannot be modified. Please note that
* GNU systems allow read only files to be deleted if the directory it
* is contained in is writable.
*
@@ -1401,44 +1401,44 @@ public class File implements Serializable, Comparable<File>
public static File[] listRoots()
{
File[] roots = VMFile.listRoots();
-
+
SecurityManager s = System.getSecurityManager();
if (s != null)
{
- // Only return roots to which the security manager permits read access.
- int count = roots.length;
- for (int i = 0; i < roots.length; i++)
- {
- try
- {
- s.checkRead (roots[i].path);
- }
- catch (SecurityException sx)
- {
- roots[i] = null;
- count--;
- }
- }
- if (count != roots.length)
- {
- File[] newRoots = new File[count];
- int k = 0;
- for (int i = 0; i < roots.length; i++)
- {
- if (roots[i] != null)
- newRoots[k++] = roots[i];
- }
- roots = newRoots;
- }
+ // Only return roots to which the security manager permits read access.
+ int count = roots.length;
+ for (int i = 0; i < roots.length; i++)
+ {
+ try
+ {
+ s.checkRead (roots[i].path);
+ }
+ catch (SecurityException sx)
+ {
+ roots[i] = null;
+ count--;
+ }
+ }
+ if (count != roots.length)
+ {
+ File[] newRoots = new File[count];
+ int k = 0;
+ for (int i = 0; i < roots.length; i++)
+ {
+ if (roots[i] != null)
+ newRoots[k++] = roots[i];
+ }
+ roots = newRoots;
+ }
}
return roots;
}
/**
- * This method creates a temporary file in the system temporary directory.
+ * This method creates a temporary file in the system temporary directory.
* The files created are guaranteed not to currently exist and the same file
* name will never be used twice in the same virtual machine instance. The
- * system temporary directory is determined by examinging the
+ * system temporary directory is determined by examinging the
* <code>java.io.tmpdir</code> system property.
* <p>
* The <code>prefix</code> parameter is a sequence of at least three
@@ -1450,14 +1450,14 @@ public class File implements Serializable, Comparable<File>
* If a <code>SecurityManager</code> exists, then its <code>checkWrite</code>
* method is used to verify that this operation is permitted.
* <p>
- * This method is identical to calling
+ * This method is identical to calling
* <code>createTempFile(prefix, suffix, null)</code>.
*
* @param prefix The character prefix to use in generating the path name.
* @param suffix The character suffix to use in generating the path name.
*
* @exception IllegalArgumentException If the prefix or suffix are not valid.
- * @exception SecurityException If there is no permission to perform
+ * @exception SecurityException If there is no permission to perform
* this operation
* @exception IOException If an error occurs
*/
@@ -1470,13 +1470,13 @@ public class File implements Serializable, Comparable<File>
/**
* This method compares the specified <code>File</code> to this one
* to test for equality. It does this by comparing the canonical path names
- * of the files.
+ * of the files.
* <p>
* The canonical paths of the files are determined by calling the
* <code>getCanonicalPath</code> method on each object.
* <p>
* This method returns a 0 if the specified <code>Object</code> is equal
- * to this one, a negative value if it is less than this one
+ * to this one, a negative value if it is less than this one
* a positive value if it is greater than this one.
*
* @return An integer as described above
@@ -1497,10 +1497,10 @@ public class File implements Serializable, Comparable<File>
*
* @param dest The <code>File</code> object representing the target name
*
- * @return <code>true</code> if the rename succeeds, <code>false</code>
+ * @return <code>true</code> if the rename succeeds, <code>false</code>
* otherwise.
*
- * @exception SecurityException If write access is not allowed to the
+ * @exception SecurityException If write access is not allowed to the
* file by the <code>SecurityMananger</code>.
*/
public synchronized boolean renameTo(File dest)
@@ -1527,7 +1527,7 @@ public class File implements Serializable, Comparable<File>
*
* @since 1.2
*/
- public boolean setLastModified(long time)
+ public boolean setLastModified(long time)
{
if (time < 0)
throw new IllegalArgumentException("Negative modification time: " + time);
@@ -1540,7 +1540,7 @@ public class File implements Serializable, Comparable<File>
{
// Check the SecurityManager
SecurityManager s = System.getSecurityManager();
-
+
if (s != null)
s.checkWrite(path);
}
@@ -1549,7 +1549,7 @@ public class File implements Serializable, Comparable<File>
{
// Check the SecurityManager
SecurityManager s = System.getSecurityManager();
-
+
if (s != null)
s.checkRead(path);
}
@@ -1558,12 +1558,12 @@ public class File implements Serializable, Comparable<File>
{
// Check the SecurityManager
SecurityManager s = System.getSecurityManager();
-
+
if (s != null)
s.checkExec(path);
}
-
- /**
+
+ /**
* Calling this method requests that the file represented by this object
* be deleted when the virtual machine exits. Note that this request cannot
* be cancelled. Also, it will only be carried out if the virtual machine
@@ -1571,7 +1571,7 @@ public class File implements Serializable, Comparable<File>
*
* @exception SecurityException If deleting of the file is not allowed
*
- * @since 1.2
+ * @since 1.2
*/
public void deleteOnExit()
{
@@ -1597,10 +1597,9 @@ public class File implements Serializable, Comparable<File>
// If the file was from an OS with a different dir separator,
// fixup the path to use the separator on this OS.
char oldSeparatorChar = ois.readChar();
-
+
if (oldSeparatorChar != separatorChar)
path = path.replace(oldSeparatorChar, separatorChar);
}
-
-} // class File
+} // class File
diff --git a/java/io/FileDescriptor.java b/java/io/FileDescriptor.java
index cf9ff20d5..ce58a9fb0 100644
--- a/java/io/FileDescriptor.java
+++ b/java/io/FileDescriptor.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -51,7 +51,7 @@ import java.nio.channels.FileChannel;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@cygnus.com)
- * @date September 24, 1998
+ * @date September 24, 1998
*/
public final class FileDescriptor
{
@@ -100,7 +100,7 @@ public final class FileDescriptor
/**
* This method forces all data that has not yet been physically written to
- * the underlying storage medium associated with this
+ * the underlying storage medium associated with this
* <code>FileDescriptor</code>
* to be written out. This method will not return until all data has
* been fully written to the underlying device. If the device does not
@@ -111,17 +111,17 @@ public final class FileDescriptor
{
if (channel instanceof FileChannel)
{
- try
- {
- ((FileChannel) channel).force(true);
- }
- catch (IOException ex)
- {
- if (ex instanceof SyncFailedException)
- throw (SyncFailedException) ex;
- else
- throw new SyncFailedException(ex.toString());
- }
+ try
+ {
+ ((FileChannel) channel).force(true);
+ }
+ catch (IOException ex)
+ {
+ if (ex instanceof SyncFailedException)
+ throw (SyncFailedException) ex;
+ else
+ throw new SyncFailedException(ex.toString());
+ }
}
}
@@ -129,11 +129,11 @@ public final class FileDescriptor
* This methods tests whether or not this object represents a valid open
* native file handle.
*
- * @return <code>true</code> if this object represents a valid
+ * @return <code>true</code> if this object represents a valid
* native file handle, <code>false</code> otherwise
*/
public boolean valid ()
- {
+ {
ByteChannel c = channel;
return (c != null) && (c.isOpen());
}
diff --git a/java/io/FileFilter.java b/java/io/FileFilter.java
index e57ac9fd0..087c5e9f0 100644
--- a/java/io/FileFilter.java
+++ b/java/io/FileFilter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,14 +40,14 @@ package java.io;
/**
* This interface has one method which is used for filtering pathnames
- * returned in a pathname listing. It is currently used by the
+ * returned in a pathname listing. It is currently used by the
* <code>File.listFiles(FileFilter)</code> method.
* <p>
* The method in this interface determines if a particular pathname should
* or should not be included in the pathname listing.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- *
+ *
* @see File#listFiles(java.io.FileFilter)
*/
public interface FileFilter
@@ -58,7 +58,7 @@ public interface FileFilter
*
* @param pathname The pathname to test
*
- * @return <code>true</code> if the path should be included in the list,
+ * @return <code>true</code> if the path should be included in the list,
* <code>false</code> otherwise.
*/
boolean accept(File pathname);
diff --git a/java/io/FileInputStream.java b/java/io/FileInputStream.java
index 8217668b4..0e71caf37 100644
--- a/java/io/FileInputStream.java
+++ b/java/io/FileInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -48,9 +48,9 @@ import java.nio.channels.FileChannel;
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
-
+
/**
- * This class is a stream that reads its bytes from a file.
+ * This class is a stream that reads its bytes from a file.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy (warrenl@cygnus.com)
@@ -68,7 +68,7 @@ public class FileInputStream extends InputStream
* This method initializes a <code>FileInputStream</code> to read from the
* specified named file. A security check is first made to determine
* whether or not access to this file is allowed. This is done by
- * calling the <code>checkRead()</code> method of the
+ * calling the <code>checkRead()</code> method of the
* <code>SecurityManager</code>
* (if one exists) with the name of this file. An exception is thrown
* if reading is not allowed. If the file does not exist, an exception
@@ -77,7 +77,7 @@ public class FileInputStream extends InputStream
* @param name The name of the file this stream should read from
*
* @exception SecurityException If read access to the file is not allowed
- * @exception FileNotFoundException If the file does not exist
+ * @exception FileNotFoundException If the file does not exist
* or if it is a directory
*/
public FileInputStream(String name) throws FileNotFoundException
@@ -129,13 +129,13 @@ public class FileInputStream extends InputStream
* specified <code>FileDescriptor</code> object. A security
* check is first made to
* determine whether or not access to this file is allowed. This is done by
- * calling the <code>checkRead()</code> method of the
+ * calling the <code>checkRead()</code> method of the
* <code>SecurityManager</code>
- * (if one exists) with the specified <code>FileDescriptor</code>
- * An exception is
+ * (if one exists) with the specified <code>FileDescriptor</code>
+ * An exception is
* thrown if reading is not allowed.
*
- * @param fdObj The <code>FileDescriptor</code> object this stream
+ * @param fdObj The <code>FileDescriptor</code> object this stream
* should read from
*
* @exception SecurityException If read access to the file is not allowed
@@ -210,9 +210,9 @@ public class FileInputStream extends InputStream
{
synchronized (this)
{
- if (fd == null)
- fd = new FileDescriptor (ch);
- return fd;
+ if (fd == null)
+ fd = new FileDescriptor (ch);
+ return fd;
}
}
@@ -256,7 +256,7 @@ public class FileInputStream extends InputStream
/**
* This method read bytes from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index
+ * supplied buffer. It starts storing the data at index
* <code>offset</code> into
* the buffer and attempts to read <code>len</code> bytes. This method can
* return before reading the number of bytes requested. The actual number
@@ -297,7 +297,7 @@ public class FileInputStream extends InputStream
public synchronized long skip (long numBytes) throws IOException
{
if (numBytes < 0)
- throw new IllegalArgumentException ("Can't skip negative bytes: " +
+ throw new IllegalArgumentException ("Can't skip negative bytes: " +
numBytes);
if (numBytes == 0)
@@ -314,10 +314,9 @@ public class FileInputStream extends InputStream
* A file channel must be created by first creating an instance of
* Input/Output/RandomAccessFile and invoking the getChannel() method on it.
*/
- public synchronized FileChannel getChannel ()
+ public synchronized FileChannel getChannel ()
{
return ch;
}
} // class FileInputStream
-
diff --git a/java/io/FileOutputStream.java b/java/io/FileOutputStream.java
index b012e6044..6915822ea 100644
--- a/java/io/FileOutputStream.java
+++ b/java/io/FileOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -71,7 +71,7 @@ public class FileOutputStream extends OutputStream
* Before opening a file, a security check is performed by calling the
* <code>checkWrite</code> method of the <code>SecurityManager</code> (if
* one exists) with the name of the file to be opened. An exception is
- * thrown if writing is not allowed.
+ * thrown if writing is not allowed.
*
* @param path The name of the file this stream should write to
* @param append <code>true</code> to append bytes to the end of the file,
@@ -94,7 +94,7 @@ public class FileOutputStream extends OutputStream
* Before opening a file, a security check is performed by calling the
* <code>checkWrite</code> method of the <code>SecurityManager</code> (if
* one exists) with the name of the file to be opened. An exception is
- * thrown if writing is not allowed.
+ * thrown if writing is not allowed.
*
* @param path The name of the file this stream should write to
*
@@ -109,14 +109,14 @@ public class FileOutputStream extends OutputStream
/**
* This method initializes a <code>FileOutputStream</code> object to write
- * to the specified <code>File</code> object. The file is created if it
- * does not exist, and the bytes written are written starting at the
+ * to the specified <code>File</code> object. The file is created if it
+ * does not exist, and the bytes written are written starting at the
* beginning of the file.
* <p>
* Before opening a file, a security check is performed by calling the
* <code>checkWrite</code> method of the <code>SecurityManager</code> (if
* one exists) with the name of the file to be opened. An exception is
- * thrown if writing is not allowed.
+ * thrown if writing is not allowed.
*
* @param file The <code>File</code> object this stream should write to
*
@@ -131,16 +131,16 @@ public class FileOutputStream extends OutputStream
/**
* This method initializes a <code>FileOutputStream</code> object to write
- * to the specified <code>File</code> object. The file is created if it
- * does not exist, and the bytes written are written starting at the
- * beginning of the file if the <code>append</code> parameter is
+ * to the specified <code>File</code> object. The file is created if it
+ * does not exist, and the bytes written are written starting at the
+ * beginning of the file if the <code>append</code> parameter is
* <code>false</code>. Otherwise bytes are written at the end of the
* file.
* <p>
* Before opening a file, a security check is performed by calling the
* <code>checkWrite</code> method of the <code>SecurityManager</code> (if
* one exists) with the name of the file to be opened. An exception is
- * thrown if writing is not allowed.
+ * thrown if writing is not allowed.
*
* @param file The <code>File</code> object this stream should write to
* @param append <code>true</code> to append bytes to the end of the file,
@@ -185,7 +185,7 @@ public class FileOutputStream extends OutputStream
* Before opening a file, a security check is performed by calling the
* <code>checkWrite</code> method of the <code>SecurityManager</code> (if
* one exists) with the specified <code>FileDescriptor</code> as an argument.
- * An exception is thrown if writing is not allowed.
+ * An exception is thrown if writing is not allowed.
*
* @param fdObj The <code>FileDescriptor</code> this stream should write to
*
@@ -230,14 +230,14 @@ public class FileOutputStream extends OutputStream
{
synchronized (this)
{
- if (fd == null)
- fd = new FileDescriptor (ch);
- return fd;
+ if (fd == null)
+ fd = new FileDescriptor (ch);
+ return fd;
}
}
/**
- * This method writes a single byte of data to the file.
+ * This method writes a single byte of data to the file.
*
* @param b The byte of data to write, passed as an <code>int</code>
*
@@ -263,7 +263,7 @@ public class FileOutputStream extends OutputStream
}
/**
- * This method writes <code>len</code> bytes from the byte array
+ * This method writes <code>len</code> bytes from the byte array
* <code>buf</code> to the file starting at index <code>offset</code>.
*
* @param buf The array of bytes to write to the file
@@ -279,7 +279,7 @@ public class FileOutputStream extends OutputStream
|| len < 0
|| offset + len > buf.length)
throw new ArrayIndexOutOfBoundsException ();
-
+
ch.write(ByteBuffer.wrap(buf, offset, len));
}
@@ -301,10 +301,9 @@ public class FileOutputStream extends OutputStream
* A file channel must be created by first creating an instance of
* Input/Output/RandomAccessFile and invoking the getChannel() method on it.
*/
- public synchronized FileChannel getChannel()
+ public synchronized FileChannel getChannel()
{
return ch;
}
} // class FileOutputStream
-
diff --git a/java/io/FilePermission.java b/java/io/FilePermission.java
index 0872a378b..5aa10b3c0 100644
--- a/java/io/FilePermission.java
+++ b/java/io/FilePermission.java
@@ -59,7 +59,7 @@ public final class FilePermission extends Permission implements Serializable
String action;
int i = actionsString.indexOf(',');
int startI = 0;
- while (i != -1)
+ while (i != -1)
{
action = actionsString.substring(startI, i).trim().toLowerCase();
if (action.equals("read"))
@@ -70,9 +70,9 @@ public final class FilePermission extends Permission implements Serializable
executePerm = true;
else if (action.equals("delete"))
deletePerm = true;
- else
- throw new IllegalArgumentException("Unknown action: " + action);
-
+ else
+ throw new IllegalArgumentException("Unknown action: " + action);
+
startI = i + 1;
i = actionsString.indexOf(',', startI);
}
@@ -99,7 +99,7 @@ public final class FilePermission extends Permission implements Serializable
* permission represents. The actions must be "read", "write",
* "execute" and/or "delete".
*/
- public FilePermission(String pathExpression, String actionsString)
+ public FilePermission(String pathExpression, String actionsString)
{
// FIXME: what to do when the file string is malformed?
super(pathExpression);
@@ -110,26 +110,26 @@ public final class FilePermission extends Permission implements Serializable
this.actionsString = actionsString;
checkPerms();
}
-
+
/**
* Get the actions this FilePermission supports.
* @return the String representing the actions this FilePermission supports.
*/
- public String getActions()
+ public String getActions()
{
return actionsString;
}
/**
* Get the hash code for this Object.<P>
- * FilePermission's hash code is calculated as the exclusive or of the
+ * FilePermission's hash code is calculated as the exclusive or of the
* target
* String's hash code and the action String's hash code.
- * @specnote Sun did not specify how to calculate the hash code;
+ * @specnote Sun did not specify how to calculate the hash code;
* I made this up.
* @return the hash code for this Object.
*/
- public int hashCode()
+ public int hashCode()
{
return getName().hashCode() ^ actionsString.hashCode();
}
@@ -141,7 +141,7 @@ public final class FilePermission extends Permission implements Serializable
* @param o the Object to compare to.
* @return whether the Objects are semantically equivalent.
*/
- public boolean equals(Object o)
+ public boolean equals(Object o)
{
if (! (o instanceof FilePermission))
return false;
@@ -152,38 +152,38 @@ public final class FilePermission extends Permission implements Serializable
// Compare names, taking into account if they refer to a directory
// and one has a separator and the other does not.
- if (f1.length() > 0 && f1.charAt(f1.length() - 1) == File.separatorChar)
+ if (f1.length() > 0 && f1.charAt(f1.length() - 1) == File.separatorChar)
{
if (f2.length() > 0
- && f2.charAt(f2.length() - 1) == File.separatorChar)
+ && f2.charAt(f2.length() - 1) == File.separatorChar)
{
- if (! f2.equals(f1))
- return false;
+ if (! f2.equals(f1))
+ return false;
}
else
{
- if (! f2.equals(f1.substring(0, f1.length() - 1)))
- return false;
+ if (! f2.equals(f1.substring(0, f1.length() - 1)))
+ return false;
}
}
else
{
if (f2.length() > 0
- && f2.charAt(f2.length() - 1) == File.separatorChar)
+ && f2.charAt(f2.length() - 1) == File.separatorChar)
{
- if (! f1.equals(f2.substring(0, f2.length() - 1)))
- return false;
+ if (! f1.equals(f2.substring(0, f2.length() - 1)))
+ return false;
}
else
{
- if (! f1.equals(f2))
- return false;
+ if (! f1.equals(f2))
+ return false;
}
}
return (readPerm == p.readPerm
- && writePerm == p.writePerm
- && executePerm == p.executePerm
- && deletePerm == p.deletePerm);
+ && writePerm == p.writePerm
+ && executePerm == p.executePerm
+ && deletePerm == p.deletePerm);
}
/**
@@ -191,14 +191,14 @@ public final class FilePermission extends Permission implements Serializable
* Permission A implies permission B if these things are all true:
* <OL>
* <LI>A and B are both FilePermissions.</LI>
- * <LI>All possible files in B are included in A
+ * <LI>All possible files in B are included in A
* (possibly more are in A).</LI>
* <LI>All actions B supports, A also supports.</LI>
* </OL>
* @param p the Permission to compare against.
* @return whether this Permission implies p
*/
- public boolean implies(Permission p)
+ public boolean implies(Permission p)
{
if (! (p instanceof FilePermission))
return false;
@@ -207,7 +207,7 @@ public final class FilePermission extends Permission implements Serializable
if (f1.equals(ALL_FILES))
return true;
-
+
FilePermission fp = (FilePermission) p;
String f2 = fp.getName();
@@ -216,12 +216,12 @@ public final class FilePermission extends Permission implements Serializable
try
{
- f1 = new File(f1).getCanonicalPath();
- f2 = new File(f2).getCanonicalPath();
+ f1 = new File(f1).getCanonicalPath();
+ f2 = new File(f2).getCanonicalPath();
}
catch (IOException ioe)
{
- return false;
+ return false;
}
String sub1;
@@ -229,54 +229,54 @@ public final class FilePermission extends Permission implements Serializable
switch (f1.charAt(f1.length() - 1))
{
case '*':
- sub1 = f1.substring(0, f1.length() - 1); // chop off "*"
- if (f2.length() <= sub1.length())
- {
- // If it's smaller, there is no way it could be part of
- // this directory. If it's the same (or length - 1), it
- // could be the same directory but specifies access to
- // the directory rather than the files in it.
- return false;
- }
- else if (f2.charAt(sub1.length() - 1) == File.separatorChar)
- {
- // Make sure the part before the "/" is the same.
- if (! f2.substring(0, sub1.length()).equals(sub1))
- return false;
- // Make sure there are no subdirectories specified
- // underneath this one.
- if (f2.substring(sub1.length() + 1).indexOf(File.separatorChar)
- != -1)
- return false;
- }
- else
- {
- // Obviously not equal: f2 is either not a directory or
- // is not the same directory (its name continues further
- // than we want).
- return false;
- }
- break;
+ sub1 = f1.substring(0, f1.length() - 1); // chop off "*"
+ if (f2.length() <= sub1.length())
+ {
+ // If it's smaller, there is no way it could be part of
+ // this directory. If it's the same (or length - 1), it
+ // could be the same directory but specifies access to
+ // the directory rather than the files in it.
+ return false;
+ }
+ else if (f2.charAt(sub1.length() - 1) == File.separatorChar)
+ {
+ // Make sure the part before the "/" is the same.
+ if (! f2.substring(0, sub1.length()).equals(sub1))
+ return false;
+ // Make sure there are no subdirectories specified
+ // underneath this one.
+ if (f2.substring(sub1.length() + 1).indexOf(File.separatorChar)
+ != -1)
+ return false;
+ }
+ else
+ {
+ // Obviously not equal: f2 is either not a directory or
+ // is not the same directory (its name continues further
+ // than we want).
+ return false;
+ }
+ break;
case '-':
- // Chop off "/-".
- sub1 = f1.substring(0, f1.length() - 2);
- if (f2.length() < sub1.length())
- {
- // If it's smaller, there is no way it could be part of
- // this directory.
- return false;
- }
- else if (f2.length() > sub1.length()
- && f2.charAt(sub1.length()) != File.separatorChar)
- return false;
- else if (! f2.substring(0, sub1.length()).equals(sub1))
- return false;
- break;
+ // Chop off "/-".
+ sub1 = f1.substring(0, f1.length() - 2);
+ if (f2.length() < sub1.length())
+ {
+ // If it's smaller, there is no way it could be part of
+ // this directory.
+ return false;
+ }
+ else if (f2.length() > sub1.length()
+ && f2.charAt(sub1.length()) != File.separatorChar)
+ return false;
+ else if (! f2.substring(0, sub1.length()).equals(sub1))
+ return false;
+ break;
default:
- if (!f1.equals(f2))
- return false;
- break;
+ if (!f1.equals(f2))
+ return false;
+ break;
}
if (fp.readPerm && ! readPerm)
@@ -287,7 +287,7 @@ public final class FilePermission extends Permission implements Serializable
return false;
if (fp.deletePerm && ! deletePerm)
return false;
-
+
return true;
}
}
diff --git a/java/io/FileReader.java b/java/io/FileReader.java
index 4a1dd5ff4..05e14c376 100644
--- a/java/io/FileReader.java
+++ b/java/io/FileReader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,7 +41,7 @@ package java.io;
/**
* This class provides a convenient way to set up a <code>Reader</code>
* to read from a file. It opens the specified file for reading and creates
- * the <code>InputStreamReader</code> to read from the
+ * the <code>InputStreamReader</code> to read from the
* resulting <code>FileInputStream</code>. This class can only be used
* to read from files using the default character encoding. Use
* <code>InputStreamReader</code> directly to use a non-default encoding.
@@ -56,7 +56,7 @@ public class FileReader extends InputStreamReader
*
* @param file The <code>File</code> object representing the file to read from
*
- * @exception FileNotFoundException If the file is not found or some other
+ * @exception FileNotFoundException If the file is not found or some other
* error occurs
*/
public FileReader(File file) throws FileNotFoundException
@@ -81,7 +81,7 @@ public class FileReader extends InputStreamReader
*
* @param name The name of the file to read from
*
- * @exception FileNotFoundException If the file is not found or some other
+ * @exception FileNotFoundException If the file is not found or some other
* error occurs
*/
public FileReader(String name) throws FileNotFoundException
@@ -89,4 +89,3 @@ public class FileReader extends InputStreamReader
super(new FileInputStream(name));
}
} // class FileReader
-
diff --git a/java/io/FileWriter.java b/java/io/FileWriter.java
index ce18efe5e..95d5eea3b 100644
--- a/java/io/FileWriter.java
+++ b/java/io/FileWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ package java.io;
/**
* This is a convenience class for writing to files. It creates an
- * <code>FileOutputStream</code> and initializes an
+ * <code>FileOutputStream</code> and initializes an
* <code>OutputStreamWriter</code> to write to it.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -100,7 +100,7 @@ public class FileWriter extends OutputStreamWriter
}
/**
- * This method intializes a new <code>FileWriter</code> object to
+ * This method intializes a new <code>FileWriter</code> object to
* write to the
* specified named file.
*
@@ -116,7 +116,7 @@ public class FileWriter extends OutputStreamWriter
}
/**
- * This method intializes a new <code>FileWriter</code> object to
+ * This method intializes a new <code>FileWriter</code> object to
* write to the
* specified named file. This form of the constructor allows the caller
* to determine whether data should be written starting at the beginning or
diff --git a/java/io/FilenameFilter.java b/java/io/FilenameFilter.java
index 57b4d3b18..5a9045f52 100644
--- a/java/io/FilenameFilter.java
+++ b/java/io/FilenameFilter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,8 +45,8 @@ package java.io;
/**
* This interface has one method which is used for filtering filenames
- * returned in a directory listing. It is currently used by the
- * <code>File.list(FilenameFilter)</code> method and by the filename
+ * returned in a directory listing. It is currently used by the
+ * <code>File.list(FilenameFilter)</code> method and by the filename
* dialog in AWT.
* <p>
* The method in this interface determines if a particular file should
@@ -73,4 +73,3 @@ public interface FilenameFilter
boolean accept(File dir, String name);
} // interface FilenameFilter
-
diff --git a/java/io/FilterInputStream.java b/java/io/FilterInputStream.java
index d3cb9e4f7..c9d50e535 100644
--- a/java/io/FilterInputStream.java
+++ b/java/io/FilterInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ package java.io;
*/
/**
- * This is the common superclass of all standard classes that filter
+ * This is the common superclass of all standard classes that filter
* input. It acts as a layer on top of an underlying <code>InputStream</code>
* and simply redirects calls made to it to the subordinate InputStream
* instead. Subclasses of this class perform additional filtering
@@ -60,7 +60,7 @@ package java.io;
* When creating a subclass of <code>FilterInputStream</code>, override the
* appropriate methods to implement the desired filtering. However, note
* that the <code>read(byte[])</code> method does not need to be overridden
- * as this class redirects calls to that method to
+ * as this class redirects calls to that method to
* <code>read(byte[], int, int)</code> instead of to the subordinate
* <code>InputStream read(byte[])</code> method.
*
@@ -132,7 +132,7 @@ public class FilterInputStream extends InputStream
/**
* Calls the <code>in.skip(long)</code> method
*
- * @param numBytes The requested number of bytes to skip.
+ * @param numBytes The requested number of bytes to skip.
*
* @return The value returned from <code>in.skip(long)</code>
*
@@ -156,8 +156,8 @@ public class FilterInputStream extends InputStream
}
/**
- * Calls the <code>read(byte[], int, int)</code> overloaded method.
- * Note that
+ * Calls the <code>read(byte[], int, int)</code> overloaded method.
+ * Note that
* this method does not redirect its call directly to a corresponding
* method in <code>in</code>. This allows subclasses to override only the
* three argument version of <code>read</code>.
@@ -193,7 +193,7 @@ public class FilterInputStream extends InputStream
* This method closes the input stream by closing the input stream that
* this object is filtering. Future attempts to access this stream may
* throw an exception.
- *
+ *
* @exception IOException If an error occurs
*/
public void close() throws IOException
diff --git a/java/io/FilterOutputStream.java b/java/io/FilterOutputStream.java
index 4c2dfc04a..401e5478c 100644
--- a/java/io/FilterOutputStream.java
+++ b/java/io/FilterOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,10 +44,10 @@ package java.io;
*/
/**
- * This class is the common superclass of output stream classes that
+ * This class is the common superclass of output stream classes that
* filter the output they write. These classes typically transform the
* data in some way prior to writing it out to another underlying
- * <code>OutputStream</code>. This class simply overrides all the
+ * <code>OutputStream</code>. This class simply overrides all the
* methods in <code>OutputStream</code> to redirect them to the
* underlying stream. Subclasses provide actual filtering.
*
@@ -141,10 +141,9 @@ public class FilterOutputStream extends OutputStream
public void write(byte[] buf, int offset, int len) throws IOException
{
// Don't do checking here, per Java Lang Spec.
- for (int i=0; i < len; i++)
+ for (int i=0; i < len; i++)
write(buf[offset + i]);
}
} // class FilterOutputStream
-
diff --git a/java/io/FilterReader.java b/java/io/FilterReader.java
index 1abaa8a4b..0e57e21c5 100644
--- a/java/io/FilterReader.java
+++ b/java/io/FilterReader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ package java.io;
*/
/**
- * This is the common superclass of all standard classes that filter
+ * This is the common superclass of all standard classes that filter
* input. It acts as a layer on top of an underlying <code>Reader</code>
* and simply redirects calls made to it to the subordinate Reader
* instead. Subclasses of this class perform additional filtering
@@ -54,7 +54,7 @@ package java.io;
* When creating a subclass of <code>FilterReader</code>, override the
* appropriate methods to implement the desired filtering. However, note
* that the <code>read(char[])</code> method does not need to be overridden
- * as this class redirects calls to that method to
+ * as this class redirects calls to that method to
* <code>read(yte[], int, int)</code> instead of to the subordinate
* <code>Reader} read(yte[])</code> method.
*
@@ -98,7 +98,7 @@ public abstract class FilterReader extends Reader
/**
* Calls the <code>in.markSupported()</code> method.
*
- * @return <code>true</code> if mark/reset is supported,
+ * @return <code>true</code> if mark/reset is supported,
* <code>false</code> otherwise
*/
public boolean markSupported()
@@ -131,7 +131,7 @@ public abstract class FilterReader extends Reader
/**
* Calls the <code>in.skip(long)</code> method
*
- * @param num_chars The requested number of chars to skip.
+ * @param num_chars The requested number of chars to skip.
*
* @return The value returned from <code>in.skip(long)</code>
*
@@ -182,4 +182,3 @@ public abstract class FilterReader extends Reader
}
} // class FilterReader
-
diff --git a/java/io/FilterWriter.java b/java/io/FilterWriter.java
index 9b9ce33f9..382dec06a 100644
--- a/java/io/FilterWriter.java
+++ b/java/io/FilterWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,15 +44,15 @@ package java.io;
*/
/**
- * This class is the common superclass of output character stream classes
+ * This class is the common superclass of output character stream classes
* that filter the output they write. These classes typically transform the
* data in some way prior to writing it out to another underlying
- * <code>Writer</code>. This class simply overrides all the
+ * <code>Writer</code>. This class simply overrides all the
* methods in <code>Writer</code> to redirect them to the
* underlying stream. Subclasses provide actual filtering.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Tom Tromey (tromey@cygnus.com)
+ * @author Tom Tromey (tromey@cygnus.com)
*/
public abstract class FilterWriter extends Writer
{
@@ -132,7 +132,7 @@ public abstract class FilterWriter extends Writer
* starting at position <code>offset</code>.
*
* @param str The <code>String</code> that is to be written
- * @param offset The character offset into the <code>String</code>
+ * @param offset The character offset into the <code>String</code>
* to start writing from
* @param len The number of chars to write
*
@@ -144,4 +144,3 @@ public abstract class FilterWriter extends Writer
}
} // class FilterWriter
-
diff --git a/java/io/InputStream.java b/java/io/InputStream.java
index 2934f0034..58b3dbd19 100644
--- a/java/io/InputStream.java
+++ b/java/io/InputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -35,7 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
+
package java.io;
/**
@@ -121,7 +121,7 @@ public abstract class InputStream implements Closeable
* if they support mark/reset functionality.
*
* @return <code>true</code> if mark/reset functionality is
- * supported, <code>false</code> otherwise
+ * supported, <code>false</code> otherwise
*/
public boolean markSupported()
{
@@ -200,18 +200,18 @@ public abstract class InputStream implements Closeable
for (i = 0; i < len; ++i)
try
- {
- if ((ch = read()) < 0)
- return i == 0 ? -1 : i; // EOF
- b[off + i] = (byte) ch;
- }
+ {
+ if ((ch = read()) < 0)
+ return i == 0 ? -1 : i; // EOF
+ b[off + i] = (byte) ch;
+ }
catch (IOException ex)
- {
- // Only reading the first byte should cause an IOException.
- if (i == 0)
- throw ex;
- return i;
- }
+ {
+ // Only reading the first byte should cause an IOException.
+ if (i == 0)
+ throw ex;
+ return i;
+ }
return i;
}
@@ -259,10 +259,10 @@ public abstract class InputStream implements Closeable
while (n > 0L)
{
- int numread = read(tmpbuf, 0, n > buflen ? buflen : (int) n);
- if (numread <= 0)
- break;
- n -= numread;
+ int numread = read(tmpbuf, 0, n > buflen ? buflen : (int) n);
+ if (numread <= 0)
+ break;
+ n -= numread;
}
return origN - n;
diff --git a/java/io/InputStreamReader.java b/java/io/InputStreamReader.java
index 6c5297f6b..51925a8c5 100644
--- a/java/io/InputStreamReader.java
+++ b/java/io/InputStreamReader.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -51,13 +51,13 @@ import java.nio.charset.CodingErrorAction;
/**
* This class reads characters from a byte input stream. The characters
- * read are converted from bytes in the underlying stream by a
+ * read are converted from bytes in the underlying stream by a
* decoding layer. The decoding layer transforms bytes to chars according
- * to an encoding standard. There are many available encodings to choose
+ * to an encoding standard. There are many available encodings to choose
* from. The desired encoding can either be specified by name, or if no
* encoding is selected, the system default encoding will be used. The
* system default encoding name is determined from the system property
- * <code>file.encoding</code>. The only encodings that are guaranteed to
+ * <code>file.encoding</code>. The only encodings that are guaranteed to
* be availalbe are "8859_1" (the Latin-1 character set) and "UTF8".
* Unforunately, Java does not provide a mechanism for listing the
* ecodings that are supported in a given implementation.
@@ -79,7 +79,7 @@ import java.nio.charset.CodingErrorAction;
* <li>More later</li>
* </ul>
* <p>
- * It is recommended that applications do not use
+ * It is recommended that applications do not use
* <code>InputStreamReader</code>'s
* directly. Rather, for efficiency purposes, an object of this class
* should be wrapped by a <code>BufferedReader</code>.
@@ -93,7 +93,7 @@ import java.nio.charset.CodingErrorAction;
* @author Robert Schuster
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Per Bothner (bothner@cygnus.com)
- * @date April 22, 1998.
+ * @date April 22, 1998.
*/
public class InputStreamReader extends Reader
{
@@ -148,44 +148,44 @@ public class InputStreamReader extends Reader
* This method initializes a new instance of <code>InputStreamReader</code>
* to read from the specified stream using the default encoding.
*
- * @param in The <code>InputStream</code> to read from
+ * @param in The <code>InputStream</code> to read from
*/
public InputStreamReader(InputStream in)
{
if (in == null)
throw new NullPointerException();
this.in = in;
- try
- {
- encoding = SystemProperties.getProperty("file.encoding");
- // Don't use NIO if avoidable
- if(EncodingHelper.isISOLatin1(encoding))
- {
- encoding = "ISO8859_1";
- maxBytesPerChar = 1f;
- decoder = null;
- return;
- }
- Charset cs = EncodingHelper.getCharset(encoding);
- decoder = cs.newDecoder();
- encoding = EncodingHelper.getOldCanonical(cs.name());
- try {
- maxBytesPerChar = cs.newEncoder().maxBytesPerChar();
- } catch(UnsupportedOperationException _){
- maxBytesPerChar = 1f;
- }
- decoder.onMalformedInput(CodingErrorAction.REPLACE);
- decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- decoder.reset();
- } catch(RuntimeException e) {
- encoding = "ISO8859_1";
- maxBytesPerChar = 1f;
- decoder = null;
- } catch(UnsupportedEncodingException e) {
- encoding = "ISO8859_1";
- maxBytesPerChar = 1f;
- decoder = null;
- }
+ try
+ {
+ encoding = SystemProperties.getProperty("file.encoding");
+ // Don't use NIO if avoidable
+ if(EncodingHelper.isISOLatin1(encoding))
+ {
+ encoding = "ISO8859_1";
+ maxBytesPerChar = 1f;
+ decoder = null;
+ return;
+ }
+ Charset cs = EncodingHelper.getCharset(encoding);
+ decoder = cs.newDecoder();
+ encoding = EncodingHelper.getOldCanonical(cs.name());
+ try {
+ maxBytesPerChar = cs.newEncoder().maxBytesPerChar();
+ } catch(UnsupportedOperationException _){
+ maxBytesPerChar = 1f;
+ }
+ decoder.onMalformedInput(CodingErrorAction.REPLACE);
+ decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ decoder.reset();
+ } catch(RuntimeException e) {
+ encoding = "ISO8859_1";
+ maxBytesPerChar = 1f;
+ decoder = null;
+ } catch(UnsupportedEncodingException e) {
+ encoding = "ISO8859_1";
+ maxBytesPerChar = 1f;
+ decoder = null;
+ }
}
/**
@@ -193,11 +193,11 @@ public class InputStreamReader extends Reader
* to read from the specified stream using a caller supplied character
* encoding scheme. Note that due to a deficiency in the Java language
* design, there is no way to determine which encodings are supported.
- *
+ *
* @param in The <code>InputStream</code> to read from
* @param encoding_name The name of the encoding scheme to use
*
- * @exception UnsupportedEncodingException If the encoding scheme
+ * @exception UnsupportedEncodingException If the encoding scheme
* requested is not available.
*/
public InputStreamReader(InputStream in, String encoding_name)
@@ -206,23 +206,23 @@ public class InputStreamReader extends Reader
if (in == null
|| encoding_name == null)
throw new NullPointerException();
-
+
this.in = in;
// Don't use NIO if avoidable
if(EncodingHelper.isISOLatin1(encoding_name))
{
- encoding = "ISO8859_1";
- maxBytesPerChar = 1f;
- decoder = null;
- return;
+ encoding = "ISO8859_1";
+ maxBytesPerChar = 1f;
+ decoder = null;
+ return;
}
try {
Charset cs = EncodingHelper.getCharset(encoding_name);
try {
maxBytesPerChar = cs.newEncoder().maxBytesPerChar();
} catch(UnsupportedOperationException _){
- maxBytesPerChar = 1f;
- }
+ maxBytesPerChar = 1f;
+ }
decoder = cs.newDecoder();
decoder.onMalformedInput(CodingErrorAction.REPLACE);
@@ -242,7 +242,7 @@ public class InputStreamReader extends Reader
* Creates an InputStreamReader that uses a decoder of the given
* charset to decode the bytes in the InputStream into
* characters.
- *
+ *
* @since 1.4
*/
public InputStreamReader(InputStream in, Charset charset) {
@@ -266,7 +266,7 @@ public class InputStreamReader extends Reader
/**
* Creates an InputStreamReader that uses the given charset decoder
* to decode the bytes in the InputStream into characters.
- *
+ *
* @since 1.4
*/
public InputStreamReader(InputStream in, CharsetDecoder decoder) {
@@ -282,8 +282,8 @@ public class InputStreamReader extends Reader
else
maxBytesPerChar = charset.newEncoder().maxBytesPerChar();
} catch(UnsupportedOperationException _){
- maxBytesPerChar = 1f;
- }
+ maxBytesPerChar = 1f;
+ }
decoder.onMalformedInput(CodingErrorAction.REPLACE);
decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
@@ -291,11 +291,11 @@ public class InputStreamReader extends Reader
if (charset == null)
encoding = "US-ASCII";
else
- encoding = EncodingHelper.getOldCanonical(decoder.charset().name());
+ encoding = EncodingHelper.getOldCanonical(decoder.charset().name());
}
-
+
/**
- * This method closes this stream, as well as the underlying
+ * This method closes this stream, as well as the underlying
* <code>InputStream</code>.
*
* @exception IOException If an error occurs
@@ -304,14 +304,14 @@ public class InputStreamReader extends Reader
{
synchronized (lock)
{
- // Makes sure all intermediate data is released by the decoder.
- if (decoder != null)
- decoder.reset();
- if (in != null)
- in.close();
- in = null;
- isDone = true;
- decoder = null;
+ // Makes sure all intermediate data is released by the decoder.
+ if (decoder != null)
+ decoder.reset();
+ if (in != null)
+ in.close();
+ in = null;
+ isDone = true;
+ decoder = null;
}
}
@@ -333,7 +333,7 @@ public class InputStreamReader extends Reader
* If the stream is not ready to be read, it could (although is not required
* to) block on the next read attempt.
*
- * @return <code>true</code> if the stream is ready to be read,
+ * @return <code>true</code> if the stream is ready to be read,
* <code>false</code> otherwise
*
* @exception IOException If an error occurs
@@ -342,7 +342,7 @@ public class InputStreamReader extends Reader
{
if (in == null)
throw new IOException("Reader has been closed");
-
+
return in.available() != 0;
}
@@ -367,10 +367,10 @@ public class InputStreamReader extends Reader
return -1;
if(decoder != null)
{
- int totalBytes = (int)((double) length * maxBytesPerChar);
+ int totalBytes = (int)((double) length * maxBytesPerChar);
if (byteBuffer != null)
totalBytes = Math.max(totalBytes, byteBuffer.remaining());
- byte[] bytes;
+ byte[] bytes;
// Fetch cached bytes array if available and big enough.
synchronized(cacheLock)
{
@@ -381,57 +381,57 @@ public class InputStreamReader extends Reader
bytesCache = null;
}
- int remaining = 0;
- if(byteBuffer != null)
- {
- remaining = byteBuffer.remaining();
- byteBuffer.get(bytes, 0, remaining);
- }
- int read;
- if(totalBytes - remaining > 0)
- {
- read = in.read(bytes, remaining, totalBytes - remaining);
- if(read == -1){
- read = remaining;
- isDone = true;
- } else
- read += remaining;
- } else
+ int remaining = 0;
+ if(byteBuffer != null)
+ {
+ remaining = byteBuffer.remaining();
+ byteBuffer.get(bytes, 0, remaining);
+ }
+ int read;
+ if(totalBytes - remaining > 0)
+ {
+ read = in.read(bytes, remaining, totalBytes - remaining);
+ if(read == -1){
+ read = remaining;
+ isDone = true;
+ } else
+ read += remaining;
+ } else
read = remaining;
- byteBuffer = ByteBuffer.wrap(bytes, 0, read);
- CharBuffer cb = CharBuffer.wrap(buf, offset, length);
- int startPos = cb.position();
-
- if(hasSavedSurrogate){
- hasSavedSurrogate = false;
- cb.put(savedSurrogate);
- read++;
- }
-
- CoderResult cr = decoder.decode(byteBuffer, cb, isDone);
- decoder.reset();
- // 1 char remains which is the first half of a surrogate pair.
- if(cr.isOverflow() && cb.hasRemaining()){
- CharBuffer overflowbuf = CharBuffer.allocate(2);
- cr = decoder.decode(byteBuffer, overflowbuf, isDone);
- overflowbuf.flip();
- if(overflowbuf.hasRemaining())
- {
- cb.put(overflowbuf.get());
- savedSurrogate = overflowbuf.get();
- hasSavedSurrogate = true;
- isDone = false;
- }
- }
-
- if(byteBuffer.hasRemaining()) {
- byteBuffer.compact();
- byteBuffer.flip();
- isDone = false;
- } else
- byteBuffer = null;
-
- read = cb.position() - startPos;
+ byteBuffer = ByteBuffer.wrap(bytes, 0, read);
+ CharBuffer cb = CharBuffer.wrap(buf, offset, length);
+ int startPos = cb.position();
+
+ if(hasSavedSurrogate){
+ hasSavedSurrogate = false;
+ cb.put(savedSurrogate);
+ read++;
+ }
+
+ CoderResult cr = decoder.decode(byteBuffer, cb, isDone);
+ decoder.reset();
+ // 1 char remains which is the first half of a surrogate pair.
+ if(cr.isOverflow() && cb.hasRemaining()){
+ CharBuffer overflowbuf = CharBuffer.allocate(2);
+ cr = decoder.decode(byteBuffer, overflowbuf, isDone);
+ overflowbuf.flip();
+ if(overflowbuf.hasRemaining())
+ {
+ cb.put(overflowbuf.get());
+ savedSurrogate = overflowbuf.get();
+ hasSavedSurrogate = true;
+ isDone = false;
+ }
+ }
+
+ if(byteBuffer.hasRemaining()) {
+ byteBuffer.compact();
+ byteBuffer.flip();
+ isDone = false;
+ } else
+ byteBuffer = null;
+
+ read = cb.position() - startPos;
// Put cached bytes array back if we are finished and the cache
// is null or smaller than the used bytes array.
@@ -445,7 +445,7 @@ public class InputStreamReader extends Reader
}
else
{
- byte[] bytes;
+ byte[] bytes;
// Fetch cached bytes array if available and big enough.
synchronized (cacheLock)
{
@@ -456,8 +456,8 @@ public class InputStreamReader extends Reader
bytesCache = null;
}
- int read = in.read(bytes);
- for(int i=0;i<read;i++)
+ int read = in.read(bytes);
+ for(int i=0;i<read;i++)
buf[offset+i] = (char)(bytes[i]&0xFF);
// Put back byte array into cache if appropriate.
@@ -466,7 +466,7 @@ public class InputStreamReader extends Reader
if (bytesCache == null || bytesCache.length < bytes.length)
bytesCache = bytes;
}
- return read;
+ return read;
}
}
@@ -503,7 +503,7 @@ public class InputStreamReader extends Reader
{
if (in == null)
throw new IOException("Reader has been closed");
-
+
return super.skip(count);
}
}
diff --git a/java/io/InvalidClassException.java b/java/io/InvalidClassException.java
index c71b0c67f..e31a44f2d 100644
--- a/java/io/InvalidClassException.java
+++ b/java/io/InvalidClassException.java
@@ -108,4 +108,3 @@ public class InvalidClassException extends ObjectStreamException
return (classname == null ? "" : classname + "; ") + msg;
}
}
-
diff --git a/java/io/LineNumberInputStream.java b/java/io/LineNumberInputStream.java
index da43097f2..2d8e36202 100644
--- a/java/io/LineNumberInputStream.java
+++ b/java/io/LineNumberInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -82,7 +82,7 @@ public class LineNumberInputStream extends FilterInputStream
private boolean justReadReturnChar = false;
/**
- * Create a new <code>LineNumberInputStream</code> that reads from the
+ * Create a new <code>LineNumberInputStream</code> that reads from the
* specified subordinate <code>InputStream</code>
*
* @param in The subordinate <code>InputStream</code> to read from
@@ -147,7 +147,7 @@ public class LineNumberInputStream extends FilterInputStream
* functionality.
*
* @param readlimit The number of bytes that can be read before the
- * mark becomes invalid
+ * mark becomes invalid
*/
public void mark(int readlimit)
{
@@ -170,7 +170,7 @@ public class LineNumberInputStream extends FilterInputStream
* to be read.
*
* @return The byte read or -1 if end of stream
- *
+ *
* @exception IOException If an error occurs
*/
public int read() throws IOException
@@ -183,17 +183,17 @@ public class LineNumberInputStream extends FilterInputStream
if (ch == '\n')
if (justReadReturnChar)
- {
- ch = in.read();
+ {
+ ch = in.read();
justReadReturnChar = false;
- }
+ }
else
- lineNumber++;
+ lineNumber++;
else if (ch == '\r')
{
- ch = '\n';
- justReadReturnChar = true;
- lineNumber++;
+ ch = '\n';
+ justReadReturnChar = true;
+ lineNumber++;
}
else
justReadReturnChar = false;
@@ -239,11 +239,11 @@ public class LineNumberInputStream extends FilterInputStream
final int origOff = off;
while (len-- > 0)
{
- int ch = read();
- if (ch < 0)
- break;
+ int ch = read();
+ if (ch < 0)
+ break;
- b[off++] = (byte) ch;
+ b[off++] = (byte) ch;
}
// This is safe since we already know that some bytes were
@@ -274,7 +274,7 @@ public class LineNumberInputStream extends FilterInputStream
/**
* This method sets the current line number to the specified value.
- *
+ *
* @param lineNumber The new line number
*/
public void setLineNumber(int lineNumber)
@@ -283,7 +283,7 @@ public class LineNumberInputStream extends FilterInputStream
}
/**
- * This method skips up to the requested number of bytes in the
+ * This method skips up to the requested number of bytes in the
* input stream. The actual number of bytes skipped is returned. If the
* desired number of bytes to skip is negative, no bytes are skipped.
*
@@ -302,11 +302,11 @@ public class LineNumberInputStream extends FilterInputStream
do
{
- int ch = read();
- if (ch < 0)
- break;
- if (ch == '\n' || ch == '\r')
- lineNumber++;
+ int ch = read();
+ if (ch < 0)
+ break;
+ if (ch == '\n' || ch == '\r')
+ lineNumber++;
}
while (--n > 0);
diff --git a/java/io/LineNumberReader.java b/java/io/LineNumberReader.java
index 5e263f761..6ac0b55fe 100644
--- a/java/io/LineNumberReader.java
+++ b/java/io/LineNumberReader.java
@@ -151,22 +151,22 @@ public class LineNumberReader extends BufferedReader
synchronized (lock)
{
- // This is basically the same as BufferedReader.mark.
- // However, if the previous character was a '\r', we need to
- // save that 'r', in case the next character is a '\n'.
- if (pos + readLimit > limit)
- {
- int saveCR = matchedNewLine ? 1 : 0;
- char[] old_buffer = buffer;
- if (readLimit > limit)
- buffer = new char[saveCR + readLimit];
- int copy_start = pos - saveCR;
- savedLineNumber = lineNumber;
- limit -= copy_start;
- System.arraycopy(old_buffer, copy_start, buffer, 0, limit);
- pos = saveCR;
- }
- markPos = pos;
+ // This is basically the same as BufferedReader.mark.
+ // However, if the previous character was a '\r', we need to
+ // save that 'r', in case the next character is a '\n'.
+ if (pos + readLimit > limit)
+ {
+ int saveCR = matchedNewLine ? 1 : 0;
+ char[] old_buffer = buffer;
+ if (readLimit > limit)
+ buffer = new char[saveCR + readLimit];
+ int copy_start = pos - saveCR;
+ savedLineNumber = lineNumber;
+ limit -= copy_start;
+ System.arraycopy(old_buffer, copy_start, buffer, 0, limit);
+ pos = saveCR;
+ }
+ markPos = pos;
}
}
@@ -185,11 +185,11 @@ public class LineNumberReader extends BufferedReader
{
synchronized (lock)
{
- if (markPos < 0)
- throw new IOException("mark never set or invalidated");
- lineNumber = savedLineNumber;
- pos = markPos;
- matchedNewLine = (markPos > 0 && buffer[markPos-1] == '\r');
+ if (markPos < 0)
+ throw new IOException("mark never set or invalidated");
+ lineNumber = savedLineNumber;
+ pos = markPos;
+ matchedNewLine = (markPos > 0 && buffer[markPos-1] == '\r');
}
}
@@ -237,24 +237,24 @@ public class LineNumberReader extends BufferedReader
{
synchronized (lock)
{
- skipRedundantLF();
- if (pos >= limit && fill() < 0)
- return -1;
- char ch = buffer[pos++];
-
- if ((matchedNewLine = (ch == '\r')) || ch == '\n')
- {
- lineNumber++;
- return '\n';
- }
- matchedNewLine = false;
- return (int) ch;
+ skipRedundantLF();
+ if (pos >= limit && fill() < 0)
+ return -1;
+ char ch = buffer[pos++];
+
+ if ((matchedNewLine = (ch == '\r')) || ch == '\n')
+ {
+ lineNumber++;
+ return '\n';
+ }
+ matchedNewLine = false;
+ return (int) ch;
}
}
/**
* This method reads chars from a stream and stores them into a caller
- * supplied buffer. It starts storing data at index <code>offset</code> into
+ * supplied buffer. It starts storing data at index <code>offset</code> into
* the buffer and attemps to read <code>len</code> chars. This method can
* return before reading the number of chars requested. The actual number
* of chars read is returned as an int. A -1 is returned to indicated the
@@ -288,37 +288,37 @@ public class LineNumberReader extends BufferedReader
if (count <= 0)
{
- if (count < 0)
- throw new IndexOutOfBoundsException();
- return 0;
+ if (count < 0)
+ throw new IndexOutOfBoundsException();
+ return 0;
}
synchronized (lock)
{
- if (pos >= limit && fill() < 0)
- return -1;
-
- int start_offset = offset;
- boolean matched = matchedNewLine;
-
- while (count-- > 0 && pos < limit)
- {
- char ch = buffer[pos++];
- if (ch == '\r')
- {
- lineNumber++;
- matched = true;
- }
- else if (ch == '\n' && !matched)
- lineNumber++;
- else
- matched = false;
-
- buf[offset++] = ch;
- }
-
- matchedNewLine = matched;
- return offset - start_offset;
+ if (pos >= limit && fill() < 0)
+ return -1;
+
+ int start_offset = offset;
+ boolean matched = matchedNewLine;
+
+ while (count-- > 0 && pos < limit)
+ {
+ char ch = buffer[pos++];
+ if (ch == '\r')
+ {
+ lineNumber++;
+ matched = true;
+ }
+ else if (ch == '\n' && !matched)
+ lineNumber++;
+ else
+ matched = false;
+
+ buf[offset++] = ch;
+ }
+
+ matchedNewLine = matched;
+ return offset - start_offset;
}
}
@@ -326,20 +326,20 @@ public class LineNumberReader extends BufferedReader
{
if (pos > 0 && matchedNewLine)
{
- if (pos < limit)
- { // fast case
- if (buffer[pos] == '\n')
- pos++;
- }
- else
- { // check whether the next buffer begins with '\n'.
- // in that case kill the '\n'.
- if (fill() <= 0)
- return;
- if (buffer[pos] == '\n')
- pos++;
- }
- matchedNewLine = true;
+ if (pos < limit)
+ { // fast case
+ if (buffer[pos] == '\n')
+ pos++;
+ }
+ else
+ { // check whether the next buffer begins with '\n'.
+ // in that case kill the '\n'.
+ if (fill() <= 0)
+ return;
+ if (buffer[pos] == '\n')
+ pos++;
+ }
+ matchedNewLine = true;
}
}
@@ -414,4 +414,3 @@ public class LineNumberReader extends BufferedReader
return skipped;
}
}
-
diff --git a/java/io/ObjectInput.java b/java/io/ObjectInput.java
index 175b60f9d..f8d51e00d 100644
--- a/java/io/ObjectInput.java
+++ b/java/io/ObjectInput.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -36,7 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package java.io;
+package java.io;
/**
* This interface extends the <code>DataInput</code> interface to provide a
@@ -62,9 +62,9 @@ public interface ObjectInput extends DataInput
/**
* This method reading a byte of data from a stream. It returns that byte
- * as an <code>int</code>. This method blocks if no data is available
+ * as an <code>int</code>. This method blocks if no data is available
* to be read.
- *
+ *
* @return The byte of data read
*
* @exception IOException If an error occurs
@@ -73,7 +73,7 @@ public interface ObjectInput extends DataInput
/**
* This method reads raw bytes and stores them them a byte array buffer.
- * Note that this method will block if no data is available. However,
+ * Note that this method will block if no data is available. However,
* it will not necessarily block until it fills the entire buffer. That is,
* a "short count" is possible.
*
@@ -87,8 +87,8 @@ public interface ObjectInput extends DataInput
/**
* This method reads raw bytes and stores them in a byte array buffer
- * <code>buf</code> starting at position <code>offset</code> into the
- * buffer. A
+ * <code>buf</code> starting at position <code>offset</code> into the
+ * buffer. A
* maximum of <code>len</code> bytes will be read. Note that this method
* blocks if no data is available, but will not necessarily block until
* it can read <code>len</code> bytes of data. That is, a "short count" is
@@ -111,11 +111,11 @@ public interface ObjectInput extends DataInput
*
* @return The object instance that was read
*
- * @exception ClassNotFoundException If a class for the object cannot be
+ * @exception ClassNotFoundException If a class for the object cannot be
* found
* @exception IOException If any other error occurs
*/
- Object readObject()
+ Object readObject()
throws ClassNotFoundException, IOException;
/**
diff --git a/java/io/ObjectInputStream.java b/java/io/ObjectInputStream.java
index 36e70d6a4..dc56aff9d 100644
--- a/java/io/ObjectInputStream.java
+++ b/java/io/ObjectInputStream.java
@@ -86,17 +86,17 @@ public class ObjectInputStream extends InputStream
{
if (DEBUG)
{
- String val = System.getProperty("gcj.dumpobjects");
- if (dump == false && val != null && !val.equals(""))
- {
- dump = true;
- System.out.println ("Serialization debugging enabled");
- }
- else if (dump == true && (val == null || val.equals("")))
- {
- dump = false;
- System.out.println ("Serialization debugging disabled");
- }
+ String val = System.getProperty("gcj.dumpobjects");
+ if (dump == false && val != null && !val.equals(""))
+ {
+ dump = true;
+ System.out.println ("Serialization debugging enabled");
+ }
+ else if (dump == true && (val == null || val.equals("")))
+ {
+ dump = false;
+ System.out.println ("Serialization debugging disabled");
+ }
}
this.resolveEnabled = false;
@@ -120,9 +120,9 @@ public class ObjectInputStream extends InputStream
* <code>private void readObject (ObjectInputStream)</code>.
*
* If an exception is thrown from this method, the stream is left in
- * an undefined state. This method can also throw Errors and
+ * an undefined state. This method can also throw Errors and
* RuntimeExceptions if caused by existing readResolve() user code.
- *
+ *
* @return The object read from the underlying stream.
*
* @exception ClassNotFoundException The class that an object being
@@ -182,9 +182,9 @@ public class ObjectInputStream extends InputStream
* <code>private void readObject (ObjectInputStream)</code>.
*
* If an exception is thrown from this method, the stream is left in
- * an undefined state. This method can also throw Errors and
+ * an undefined state. This method can also throw Errors and
* RuntimeExceptions if caused by existing readResolve() user code.
- *
+ *
* @param shared true if handles created by this call should be shared
* with later calls.
* @return The object read from the underlying stream.
@@ -212,15 +212,15 @@ public class ObjectInputStream extends InputStream
try
{
- ret_val = parseContent(marker, shared);
+ ret_val = parseContent(marker, shared);
}
finally
{
- setBlockDataMode(old_mode);
- if (DEBUG)
- depth -= 2;
+ setBlockDataMode(old_mode);
+ if (DEBUG)
+ depth -= 2;
}
-
+
return ret_val;
}
@@ -246,66 +246,66 @@ public class ObjectInputStream extends InputStream
switch (marker)
{
case TC_ENDBLOCKDATA:
- {
- ret_val = null;
- is_consumed = true;
- break;
- }
-
+ {
+ ret_val = null;
+ is_consumed = true;
+ break;
+ }
+
case TC_BLOCKDATA:
case TC_BLOCKDATALONG:
- {
- if (marker == TC_BLOCKDATALONG)
- { if(dump) dumpElementln("BLOCKDATALONG"); }
- else
- { if(dump) dumpElementln("BLOCKDATA"); }
- readNextBlock(marker);
- }
-
+ {
+ if (marker == TC_BLOCKDATALONG)
+ { if(dump) dumpElementln("BLOCKDATALONG"); }
+ else
+ { if(dump) dumpElementln("BLOCKDATA"); }
+ readNextBlock(marker);
+ }
+
case TC_NULL:
- {
- if(dump) dumpElementln("NULL");
- ret_val = null;
- break;
- }
-
+ {
+ if(dump) dumpElementln("NULL");
+ ret_val = null;
+ break;
+ }
+
case TC_REFERENCE:
- {
- if(dump) dumpElement("REFERENCE ");
- int oid = realInputStream.readInt();
- if(dump) dumpElementln(Integer.toHexString(oid));
- ret_val = lookupHandle(oid);
- if (!shared)
- throw new
- InvalidObjectException("References can not be read unshared.");
- break;
- }
-
+ {
+ if(dump) dumpElement("REFERENCE ");
+ int oid = realInputStream.readInt();
+ if(dump) dumpElementln(Integer.toHexString(oid));
+ ret_val = lookupHandle(oid);
+ if (!shared)
+ throw new
+ InvalidObjectException("References can not be read unshared.");
+ break;
+ }
+
case TC_CLASS:
- {
- if(dump) dumpElementln("CLASS");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class clazz = osc.forClass();
- assignNewHandle(clazz,shared);
- ret_val = clazz;
- break;
- }
-
+ {
+ if(dump) dumpElementln("CLASS");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class clazz = osc.forClass();
+ assignNewHandle(clazz,shared);
+ ret_val = clazz;
+ break;
+ }
+
case TC_PROXYCLASSDESC:
- {
- if(dump) dumpElementln("PROXYCLASS");
- int n_intf = this.realInputStream.readInt();
- String[] intfs = new String[n_intf];
- for (int i = 0; i < n_intf; i++)
- {
- intfs[i] = this.realInputStream.readUTF();
- }
-
- boolean oldmode = setBlockDataMode(true);
- Class cl = resolveProxyClass(intfs);
- setBlockDataMode(oldmode);
-
- ObjectStreamClass osc = lookupClass(cl);
+ {
+ if(dump) dumpElementln("PROXYCLASS");
+ int n_intf = this.realInputStream.readInt();
+ String[] intfs = new String[n_intf];
+ for (int i = 0; i < n_intf; i++)
+ {
+ intfs[i] = this.realInputStream.readUTF();
+ }
+
+ boolean oldmode = setBlockDataMode(true);
+ Class cl = resolveProxyClass(intfs);
+ setBlockDataMode(oldmode);
+
+ ObjectStreamClass osc = lookupClass(cl);
if (osc.firstNonSerializableParentConstructor == null)
{
osc.realClassIsSerializable = true;
@@ -321,215 +321,215 @@ public class ObjectInputStream extends InputStream
new InternalError("Object ctor missing").initCause(x);
}
}
- assignNewHandle(osc,shared);
-
- if (!is_consumed)
- {
- byte b = this.realInputStream.readByte();
- if (b != TC_ENDBLOCKDATA)
- throw new IOException("Data annotated to class was not consumed." + b);
- }
- else
- is_consumed = false;
- ObjectStreamClass superosc = (ObjectStreamClass)readObject();
- osc.setSuperclass(superosc);
- ret_val = osc;
- break;
- }
-
+ assignNewHandle(osc,shared);
+
+ if (!is_consumed)
+ {
+ byte b = this.realInputStream.readByte();
+ if (b != TC_ENDBLOCKDATA)
+ throw new IOException("Data annotated to class was not consumed." + b);
+ }
+ else
+ is_consumed = false;
+ ObjectStreamClass superosc = (ObjectStreamClass)readObject();
+ osc.setSuperclass(superosc);
+ ret_val = osc;
+ break;
+ }
+
case TC_CLASSDESC:
- {
- ObjectStreamClass osc = readClassDescriptor();
-
- if (!is_consumed)
- {
- byte b = this.realInputStream.readByte();
- if (b != TC_ENDBLOCKDATA)
- throw new IOException("Data annotated to class was not consumed." + b);
- }
- else
- is_consumed = false;
-
- osc.setSuperclass ((ObjectStreamClass)readObject());
- ret_val = osc;
- break;
- }
-
+ {
+ ObjectStreamClass osc = readClassDescriptor();
+
+ if (!is_consumed)
+ {
+ byte b = this.realInputStream.readByte();
+ if (b != TC_ENDBLOCKDATA)
+ throw new IOException("Data annotated to class was not consumed." + b);
+ }
+ else
+ is_consumed = false;
+
+ osc.setSuperclass ((ObjectStreamClass)readObject());
+ ret_val = osc;
+ break;
+ }
+
case TC_STRING:
- {
- if(dump) dumpElement("STRING=");
- String s = this.realInputStream.readUTF();
- if(dump) dumpElementln(s);
- ret_val = processResolution(null, s, assignNewHandle(s,shared),
- shared);
- break;
- }
-
+ {
+ if(dump) dumpElement("STRING=");
+ String s = this.realInputStream.readUTF();
+ if(dump) dumpElementln(s);
+ ret_val = processResolution(null, s, assignNewHandle(s,shared),
+ shared);
+ break;
+ }
+
case TC_LONGSTRING:
- {
- if(dump) dumpElement("STRING=");
- String s = this.realInputStream.readUTFLong();
- if(dump) dumpElementln(s);
- ret_val = processResolution(null, s, assignNewHandle(s,shared),
- shared);
- break;
- }
+ {
+ if(dump) dumpElement("STRING=");
+ String s = this.realInputStream.readUTFLong();
+ if(dump) dumpElementln(s);
+ ret_val = processResolution(null, s, assignNewHandle(s,shared),
+ shared);
+ break;
+ }
case TC_ARRAY:
- {
- if(dump) dumpElementln("ARRAY");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class componentType = osc.forClass().getComponentType();
- if(dump) dumpElement("ARRAY LENGTH=");
- int length = this.realInputStream.readInt();
- if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
- Object array = Array.newInstance(componentType, length);
- int handle = assignNewHandle(array,shared);
- readArrayElements(array, componentType);
- if(dump)
- for (int i = 0, len = Array.getLength(array); i < len; i++)
- dumpElementln(" ELEMENT[" + i + "]=", Array.get(array, i));
- ret_val = processResolution(null, array, handle, shared);
- break;
- }
-
+ {
+ if(dump) dumpElementln("ARRAY");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class componentType = osc.forClass().getComponentType();
+ if(dump) dumpElement("ARRAY LENGTH=");
+ int length = this.realInputStream.readInt();
+ if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType);
+ Object array = Array.newInstance(componentType, length);
+ int handle = assignNewHandle(array,shared);
+ readArrayElements(array, componentType);
+ if(dump)
+ for (int i = 0, len = Array.getLength(array); i < len; i++)
+ dumpElementln(" ELEMENT[" + i + "]=", Array.get(array, i));
+ ret_val = processResolution(null, array, handle, shared);
+ break;
+ }
+
case TC_OBJECT:
- {
- if(dump) dumpElementln("OBJECT");
- ObjectStreamClass osc = (ObjectStreamClass)readObject();
- Class clazz = osc.forClass();
-
- if (!osc.realClassIsSerializable)
- throw new NotSerializableException
- (clazz + " is not Serializable, and thus cannot be deserialized.");
-
- if (osc.realClassIsExternalizable)
- {
- Externalizable obj = osc.newInstance();
-
- int handle = assignNewHandle(obj,shared);
-
- boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
-
- boolean oldmode = this.readDataFromBlock;
- if (read_from_blocks)
- setBlockDataMode(true);
-
- obj.readExternal(this);
-
- if (read_from_blocks)
+ {
+ if(dump) dumpElementln("OBJECT");
+ ObjectStreamClass osc = (ObjectStreamClass)readObject();
+ Class clazz = osc.forClass();
+
+ if (!osc.realClassIsSerializable)
+ throw new NotSerializableException
+ (clazz + " is not Serializable, and thus cannot be deserialized.");
+
+ if (osc.realClassIsExternalizable)
+ {
+ Externalizable obj = osc.newInstance();
+
+ int handle = assignNewHandle(obj,shared);
+
+ boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0);
+
+ boolean oldmode = this.readDataFromBlock;
+ if (read_from_blocks)
+ setBlockDataMode(true);
+
+ obj.readExternal(this);
+
+ if (read_from_blocks)
{
- setBlockDataMode(oldmode);
- if (!oldmode)
- if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
- throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method.");
- }
+ setBlockDataMode(oldmode);
+ if (!oldmode)
+ if (this.realInputStream.readByte() != TC_ENDBLOCKDATA)
+ throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method.");
+ }
- ret_val = processResolution(osc, obj, handle,shared);
+ ret_val = processResolution(osc, obj, handle,shared);
break;
-
- } // end if (osc.realClassIsExternalizable)
-
- Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor);
-
- int handle = assignNewHandle(obj,shared);
- Object prevObject = this.currentObject;
- ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
- TreeSet<ValidatorAndPriority> prevObjectValidators =
- this.currentObjectValidators;
-
- this.currentObject = obj;
- this.currentObjectValidators = null;
- ObjectStreamClass[] hierarchy = hierarchy(clazz);
-
- for (int i = 0; i < hierarchy.length; i++)
+
+ } // end if (osc.realClassIsExternalizable)
+
+ Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor);
+
+ int handle = assignNewHandle(obj,shared);
+ Object prevObject = this.currentObject;
+ ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
+ TreeSet<ValidatorAndPriority> prevObjectValidators =
+ this.currentObjectValidators;
+
+ this.currentObject = obj;
+ this.currentObjectValidators = null;
+ ObjectStreamClass[] hierarchy = hierarchy(clazz);
+
+ for (int i = 0; i < hierarchy.length; i++)
{
- this.currentObjectStreamClass = hierarchy[i];
- if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
-
- // XXX: should initialize fields in classes in the hierarchy
- // that aren't in the stream
- // should skip over classes in the stream that aren't in the
- // real classes hierarchy
-
- Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
- if (readObjectMethod != null)
- {
- fieldsAlreadyRead = false;
- boolean oldmode = setBlockDataMode(true);
- callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
- setBlockDataMode(oldmode);
- }
- else
- {
- readFields(obj, currentObjectStreamClass);
- }
-
- if (this.currentObjectStreamClass.hasWriteMethod())
- {
- if(dump) dumpElement("ENDBLOCKDATA? ");
- try
- {
- /* Read blocks until an end marker */
- byte writeMarker = this.realInputStream.readByte();
- while (writeMarker != TC_ENDBLOCKDATA)
- {
- parseContent(writeMarker, shared);
- writeMarker = this.realInputStream.readByte();
- }
- if(dump) dumpElementln("yes");
- }
- catch (EOFException e)
- {
- throw (IOException) new IOException
- ("No end of block data seen for class with readObject (ObjectInputStream) method.").initCause(e);
- }
- }
- }
-
- this.currentObject = prevObject;
- this.currentObjectStreamClass = prevObjectStreamClass;
- ret_val = processResolution(osc, obj, handle, shared);
- if (currentObjectValidators != null)
- invokeValidators();
- this.currentObjectValidators = prevObjectValidators;
-
- break;
- }
-
+ this.currentObjectStreamClass = hierarchy[i];
+ if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ());
+
+ // XXX: should initialize fields in classes in the hierarchy
+ // that aren't in the stream
+ // should skip over classes in the stream that aren't in the
+ // real classes hierarchy
+
+ Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod;
+ if (readObjectMethod != null)
+ {
+ fieldsAlreadyRead = false;
+ boolean oldmode = setBlockDataMode(true);
+ callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj);
+ setBlockDataMode(oldmode);
+ }
+ else
+ {
+ readFields(obj, currentObjectStreamClass);
+ }
+
+ if (this.currentObjectStreamClass.hasWriteMethod())
+ {
+ if(dump) dumpElement("ENDBLOCKDATA? ");
+ try
+ {
+ /* Read blocks until an end marker */
+ byte writeMarker = this.realInputStream.readByte();
+ while (writeMarker != TC_ENDBLOCKDATA)
+ {
+ parseContent(writeMarker, shared);
+ writeMarker = this.realInputStream.readByte();
+ }
+ if(dump) dumpElementln("yes");
+ }
+ catch (EOFException e)
+ {
+ throw (IOException) new IOException
+ ("No end of block data seen for class with readObject (ObjectInputStream) method.").initCause(e);
+ }
+ }
+ }
+
+ this.currentObject = prevObject;
+ this.currentObjectStreamClass = prevObjectStreamClass;
+ ret_val = processResolution(osc, obj, handle, shared);
+ if (currentObjectValidators != null)
+ invokeValidators();
+ this.currentObjectValidators = prevObjectValidators;
+
+ break;
+ }
+
case TC_RESET:
- if(dump) dumpElementln("RESET");
- clearHandles();
- ret_val = readObject();
- break;
-
+ if(dump) dumpElementln("RESET");
+ clearHandles();
+ ret_val = readObject();
+ break;
+
case TC_EXCEPTION:
- {
- if(dump) dumpElement("EXCEPTION=");
- Exception e = (Exception)readObject();
- if(dump) dumpElementln(e.toString());
- clearHandles();
- throw new WriteAbortedException("Exception thrown during writing of stream", e);
- }
+ {
+ if(dump) dumpElement("EXCEPTION=");
+ Exception e = (Exception)readObject();
+ if(dump) dumpElementln(e.toString());
+ clearHandles();
+ throw new WriteAbortedException("Exception thrown during writing of stream", e);
+ }
case TC_ENUM:
- {
- /* TC_ENUM classDesc newHandle enumConstantName */
- if (dump)
- dumpElementln("ENUM=");
- ObjectStreamClass osc = (ObjectStreamClass) readObject();
- String constantName = (String) readObject();
- if (dump)
- dumpElementln("CONSTANT NAME = " + constantName);
- Class clazz = osc.forClass();
- Enum instance = Enum.valueOf(clazz, constantName);
- assignNewHandle(instance,shared);
- ret_val = instance;
- break;
- }
+ {
+ /* TC_ENUM classDesc newHandle enumConstantName */
+ if (dump)
+ dumpElementln("ENUM=");
+ ObjectStreamClass osc = (ObjectStreamClass) readObject();
+ String constantName = (String) readObject();
+ if (dump)
+ dumpElementln("CONSTANT NAME = " + constantName);
+ Class clazz = osc.forClass();
+ Enum instance = Enum.valueOf(clazz, constantName);
+ assignNewHandle(instance,shared);
+ ret_val = instance;
+ break;
+ }
default:
- throw new IOException("Unknown marker on stream: " + marker);
+ throw new IOException("Unknown marker on stream: " + marker);
}
return ret_val;
}
@@ -537,8 +537,8 @@ public class ObjectInputStream extends InputStream
/**
* This method makes a partial check of types for the fields
* contained given in arguments. It checks primitive types of
- * fields1 against non primitive types of fields2. This method
- * assumes the two lists has already been sorted according to
+ * fields1 against non primitive types of fields2. This method
+ * assumes the two lists has already been sorted according to
* the Java specification.
*
* @param name Name of the class owning the given fields.
@@ -551,45 +551,45 @@ public class ObjectInputStream extends InputStream
throws InvalidClassException
{
int nonPrimitive = 0;
-
- for (nonPrimitive = 0;
- nonPrimitive < fields1.length
- && fields1[nonPrimitive].isPrimitive(); nonPrimitive++)
+
+ for (nonPrimitive = 0;
+ nonPrimitive < fields1.length
+ && fields1[nonPrimitive].isPrimitive(); nonPrimitive++)
{
}
if (nonPrimitive == fields1.length)
return;
-
+
int i = 0;
ObjectStreamField f1;
ObjectStreamField f2;
-
+
while (i < fields2.length
- && nonPrimitive < fields1.length)
+ && nonPrimitive < fields1.length)
{
- f1 = fields1[nonPrimitive];
- f2 = fields2[i];
-
- if (!f2.isPrimitive())
- break;
-
- int compVal = f1.getName().compareTo (f2.getName());
-
- if (compVal < 0)
- {
- nonPrimitive++;
- }
- else if (compVal > 0)
- {
- i++;
- }
- else
- {
- throw new InvalidClassException
- ("invalid field type for " + f2.getName() +
- " in class " + name);
- }
+ f1 = fields1[nonPrimitive];
+ f2 = fields2[i];
+
+ if (!f2.isPrimitive())
+ break;
+
+ int compVal = f1.getName().compareTo (f2.getName());
+
+ if (compVal < 0)
+ {
+ nonPrimitive++;
+ }
+ else if (compVal > 0)
+ {
+ i++;
+ }
+ else
+ {
+ throw new InvalidClassException
+ ("invalid field type for " + f2.getName() +
+ " in class " + name);
+ }
}
}
@@ -623,31 +623,31 @@ public class ObjectInputStream extends InputStream
if(dump) dumpElementln(Short.toString(field_count));
ObjectStreamField[] fields = new ObjectStreamField[field_count];
ObjectStreamClass osc = new ObjectStreamClass(name, uid,
- flags, fields);
+ flags, fields);
assignNewHandle(osc,true);
for (int i = 0; i < field_count; i++)
{
- if(dump) dumpElement(" TYPE CODE=");
- char type_code = (char)this.realInputStream.readByte();
- if(dump) dumpElement(type_code + "; FIELD NAME=");
- String field_name = this.realInputStream.readUTF();
- if(dump) dumpElementln(field_name);
- String class_name;
-
- // If the type code is an array or an object we must
- // decode a String here. In the other case we convert
- // the type code and pass it to ObjectStreamField.
- // Type codes are decoded by gnu.java.lang.reflect.TypeSignature.
- if (type_code == 'L' || type_code == '[')
- class_name = (String)readObject();
- else
- class_name = String.valueOf(type_code);
-
- fields[i] =
- new ObjectStreamField(field_name, class_name);
+ if(dump) dumpElement(" TYPE CODE=");
+ char type_code = (char)this.realInputStream.readByte();
+ if(dump) dumpElement(type_code + "; FIELD NAME=");
+ String field_name = this.realInputStream.readUTF();
+ if(dump) dumpElementln(field_name);
+ String class_name;
+
+ // If the type code is an array or an object we must
+ // decode a String here. In the other case we convert
+ // the type code and pass it to ObjectStreamField.
+ // Type codes are decoded by gnu.java.lang.reflect.TypeSignature.
+ if (type_code == 'L' || type_code == '[')
+ class_name = (String)readObject();
+ else
+ class_name = String.valueOf(type_code);
+
+ fields[i] =
+ new ObjectStreamField(field_name, class_name);
}
-
+
/* Now that fields have been read we may resolve the class
* (and read annotation if needed). */
Class clazz = resolveClass(osc);
@@ -710,63 +710,63 @@ public class ObjectInputStream extends InputStream
/*
* Check that there is no type inconsistencies between the lists.
* A special checking must be done for the two groups: primitive types and
- * not primitive types.
+ * not primitive types.
*/
checkTypeConsistency(name, real_fields, stream_fields);
checkTypeConsistency(name, stream_fields, real_fields);
-
+
while (stream_idx < stream_fields.length
- || real_idx < real_fields.length)
+ || real_idx < real_fields.length)
{
- ObjectStreamField stream_field = null;
- ObjectStreamField real_field = null;
-
- if (stream_idx == stream_fields.length)
- {
- real_field = real_fields[real_idx++];
- }
- else if (real_idx == real_fields.length)
- {
- stream_field = stream_fields[stream_idx++];
- }
- else
- {
- int comp_val =
- real_fields[real_idx].compareTo (stream_fields[stream_idx]);
-
- if (comp_val < 0)
- {
- real_field = real_fields[real_idx++];
- }
- else if (comp_val > 0)
- {
- stream_field = stream_fields[stream_idx++];
- }
- else
- {
- stream_field = stream_fields[stream_idx++];
- real_field = real_fields[real_idx++];
- if (stream_field.getType() != real_field.getType())
- throw new InvalidClassException
- ("invalid field type for " + real_field.getName() +
- " in class " + name);
- }
- }
-
- /* If some of stream_fields does not correspond to any of real_fields,
- * or the opposite, then fieldmapping will go short.
- */
- if (map_idx == fieldmapping.length)
- {
- ObjectStreamField[] newfieldmapping =
- new ObjectStreamField[fieldmapping.length + 2];
- System.arraycopy(fieldmapping, 0,
- newfieldmapping, 0, fieldmapping.length);
- fieldmapping = newfieldmapping;
- }
- fieldmapping[map_idx++] = stream_field;
- fieldmapping[map_idx++] = real_field;
+ ObjectStreamField stream_field = null;
+ ObjectStreamField real_field = null;
+
+ if (stream_idx == stream_fields.length)
+ {
+ real_field = real_fields[real_idx++];
+ }
+ else if (real_idx == real_fields.length)
+ {
+ stream_field = stream_fields[stream_idx++];
+ }
+ else
+ {
+ int comp_val =
+ real_fields[real_idx].compareTo (stream_fields[stream_idx]);
+
+ if (comp_val < 0)
+ {
+ real_field = real_fields[real_idx++];
+ }
+ else if (comp_val > 0)
+ {
+ stream_field = stream_fields[stream_idx++];
+ }
+ else
+ {
+ stream_field = stream_fields[stream_idx++];
+ real_field = real_fields[real_idx++];
+ if (stream_field.getType() != real_field.getType())
+ throw new InvalidClassException
+ ("invalid field type for " + real_field.getName() +
+ " in class " + name);
+ }
+ }
+
+ /* If some of stream_fields does not correspond to any of real_fields,
+ * or the opposite, then fieldmapping will go short.
+ */
+ if (map_idx == fieldmapping.length)
+ {
+ ObjectStreamField[] newfieldmapping =
+ new ObjectStreamField[fieldmapping.length + 2];
+ System.arraycopy(fieldmapping, 0,
+ newfieldmapping, 0, fieldmapping.length);
+ fieldmapping = newfieldmapping;
+ }
+ fieldmapping[map_idx++] = stream_field;
+ fieldmapping[map_idx++] = real_field;
}
osc.fieldMapping = fieldmapping;
@@ -797,12 +797,12 @@ public class ObjectInputStream extends InputStream
{
if (this.currentObject == null || this.currentObjectStreamClass == null)
throw new NotActiveException("defaultReadObject called by non-active"
- + " class and/or object");
+ + " class and/or object");
if (fieldsAlreadyRead)
throw new NotActiveException("defaultReadObject called but fields "
- + "already read from stream (by "
- + "defaultReadObject or readFields)");
+ + "already read from stream (by "
+ + "defaultReadObject or readFields)");
boolean oldmode = setBlockDataMode(false);
readFields(this.currentObject, this.currentObjectStreamClass);
@@ -831,20 +831,20 @@ public class ObjectInputStream extends InputStream
* object currently being deserialized
*/
public void registerValidation(ObjectInputValidation validator,
- int priority)
+ int priority)
throws InvalidObjectException, NotActiveException
{
if (this.currentObject == null || this.currentObjectStreamClass == null)
throw new NotActiveException("registerValidation called by non-active "
- + "class and/or object");
+ + "class and/or object");
if (validator == null)
throw new InvalidObjectException("attempt to add a null "
- + "ObjectInputValidation object");
+ + "ObjectInputValidation object");
if (currentObjectValidators == null)
currentObjectValidators = new TreeSet<ValidatorAndPriority>();
-
+
currentObjectValidators.add(new ValidatorAndPriority(validator, priority));
}
@@ -942,10 +942,10 @@ public class ObjectInputStream extends InputStream
* represent the class hierarchy for clazz.
*/
private ObjectStreamClass[] hierarchy(Class clazz)
- {
+ {
ObjectStreamClass osc = lookupClass(clazz);
- return osc == null ? new ObjectStreamClass[0] : osc.hierarchy();
+ return osc == null ? new ObjectStreamClass[0] : osc.hierarchy();
}
/**
@@ -971,27 +971,27 @@ public class ObjectInputStream extends InputStream
throws IOException, ClassNotFoundException
{
ClassLoader cl = currentLoader();
-
+
Class<?>[] clss = new Class<?>[intfs.length];
if(cl == null)
{
- for (int i = 0; i < intfs.length; i++)
- clss[i] = Class.forName(intfs[i]);
- cl = ClassLoader.getSystemClassLoader();
+ for (int i = 0; i < intfs.length; i++)
+ clss[i] = Class.forName(intfs[i]);
+ cl = ClassLoader.getSystemClassLoader();
}
else
for (int i = 0; i < intfs.length; i++)
- clss[i] = Class.forName(intfs[i], false, cl);
- try
+ clss[i] = Class.forName(intfs[i], false, cl);
+ try
{
- return Proxy.getProxyClass(cl, clss);
- }
- catch (IllegalArgumentException e)
+ return Proxy.getProxyClass(cl, clss);
+ }
+ catch (IllegalArgumentException e)
{
- throw new ClassNotFoundException(null, e);
+ throw new ClassNotFoundException(null, e);
}
}
-
+
/**
* If <code>enable</code> is <code>true</code> and this object is
* trusted, then <code>resolveObject (Object)</code> will be called
@@ -1005,9 +1005,9 @@ public class ObjectInputStream extends InputStream
{
if (enable)
{
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new SerializablePermission("enableSubstitution"));
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new SerializablePermission("enableSubstitution"));
}
boolean old_val = this.resolveEnabled;
@@ -1040,9 +1040,9 @@ public class ObjectInputStream extends InputStream
{
if (this.readDataFromBlock)
{
- if (this.blockDataPosition >= this.blockDataBytes)
- readNextBlock();
- return (this.blockData[this.blockDataPosition++] & 0xff);
+ if (this.blockDataPosition >= this.blockDataBytes)
+ readNextBlock();
+ return (this.blockData[this.blockDataPosition++] & 0xff);
}
else
return this.realInputStream.read();
@@ -1059,11 +1059,11 @@ public class ObjectInputStream extends InputStream
remain = this.blockDataBytes - this.blockDataPosition;
}
length = Math.min(length, remain);
- System.arraycopy(this.blockData, this.blockDataPosition,
- data, offset, length);
- this.blockDataPosition += length;
+ System.arraycopy(this.blockData, this.blockDataPosition,
+ data, offset, length);
+ this.blockDataPosition += length;
- return length;
+ return length;
}
else
return this.realInputStream.read(data, offset, length);
@@ -1073,10 +1073,10 @@ public class ObjectInputStream extends InputStream
{
if (this.readDataFromBlock)
{
- if (this.blockDataPosition >= this.blockDataBytes)
- readNextBlock ();
+ if (this.blockDataPosition >= this.blockDataBytes)
+ readNextBlock ();
- return this.blockDataBytes - this.blockDataPosition;
+ return this.blockDataBytes - this.blockDataPosition;
}
else
return this.realInputStream.available();
@@ -1307,8 +1307,8 @@ public class ObjectInputStream extends InputStream
*
* @return A valid freshly created 'GetField' instance to get access to
* the deserialized stream.
- * @throws IOException An input/output exception occured.
- * @throws ClassNotFoundException
+ * @throws IOException An input/output exception occured.
+ * @throws ClassNotFoundException
* @throws NotActiveException
*/
public GetField readFields()
@@ -1322,7 +1322,7 @@ public class ObjectInputStream extends InputStream
if (fieldsAlreadyRead)
throw new NotActiveException("readFields called but fields already read from"
- + " stream (by defaultReadObject or readFields)");
+ + " stream (by defaultReadObject or readFields)");
final ObjectStreamClass clazz = this.currentObjectStreamClass;
final byte[] prim_field_data = new byte[clazz.primFieldSize];
@@ -1339,247 +1339,247 @@ public class ObjectInputStream extends InputStream
prereadFields = new GetField()
{
- public ObjectStreamClass getObjectStreamClass()
- {
- return clazz;
- }
-
- public boolean defaulted(String name)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField f = clazz.getField(name);
-
- /* First if we have a serialized field use the descriptor */
- if (f != null)
- {
- /* It is in serialPersistentFields but setClass tells us
- * it should not be set. This value is defaulted.
- */
- if (f.isPersistent() && !f.isToSet())
- return true;
-
- return false;
- }
-
- /* This is not a serialized field. There should be
- * a default value only if the field really exists.
- */
- try
- {
- return (clazz.forClass().getDeclaredField (name) != null);
- }
- catch (NoSuchFieldException e)
- {
- throw new IllegalArgumentException(e);
- }
- }
-
- public boolean get(String name, boolean defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Boolean.TYPE);
-
- if (field == null)
- return defvalue;
-
- return prim_field_data[field.getOffset()] == 0 ? false : true;
- }
-
- public char get(String name, char defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Character.TYPE);
-
- if (field == null)
- return defvalue;
-
- int off = field.getOffset();
-
- return (char)(((prim_field_data[off++] & 0xFF) << 8)
- | (prim_field_data[off] & 0xFF));
- }
-
- public byte get(String name, byte defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Byte.TYPE);
-
- if (field == null)
- return defvalue;
-
- return prim_field_data[field.getOffset()];
- }
-
- public short get(String name, short defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Short.TYPE);
-
- if (field == null)
- return defvalue;
-
- int off = field.getOffset();
-
- return (short)(((prim_field_data[off++] & 0xFF) << 8)
- | (prim_field_data[off] & 0xFF));
- }
-
- public int get(String name, int defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Integer.TYPE);
-
- if (field == null)
- return defvalue;
-
- int off = field.getOffset();
-
- return ((prim_field_data[off++] & 0xFF) << 24)
- | ((prim_field_data[off++] & 0xFF) << 16)
- | ((prim_field_data[off++] & 0xFF) << 8)
- | (prim_field_data[off] & 0xFF);
- }
-
- public long get(String name, long defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Long.TYPE);
-
- if (field == null)
- return defvalue;
-
- int off = field.getOffset();
-
- return (long)(((prim_field_data[off++] & 0xFFL) << 56)
- | ((prim_field_data[off++] & 0xFFL) << 48)
- | ((prim_field_data[off++] & 0xFFL) << 40)
- | ((prim_field_data[off++] & 0xFFL) << 32)
- | ((prim_field_data[off++] & 0xFF) << 24)
- | ((prim_field_data[off++] & 0xFF) << 16)
- | ((prim_field_data[off++] & 0xFF) << 8)
- | (prim_field_data[off] & 0xFF));
- }
-
- public float get(String name, float defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Float.TYPE);
-
- if (field == null)
- return defvalue;
-
- int off = field.getOffset();
-
- return Float.intBitsToFloat(((prim_field_data[off++] & 0xFF) << 24)
- | ((prim_field_data[off++] & 0xFF) << 16)
- | ((prim_field_data[off++] & 0xFF) << 8)
- | (prim_field_data[off] & 0xFF));
- }
-
- public double get(String name, double defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field = getField(name, Double.TYPE);
+ public ObjectStreamClass getObjectStreamClass()
+ {
+ return clazz;
+ }
+
+ public boolean defaulted(String name)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField f = clazz.getField(name);
+
+ /* First if we have a serialized field use the descriptor */
+ if (f != null)
+ {
+ /* It is in serialPersistentFields but setClass tells us
+ * it should not be set. This value is defaulted.
+ */
+ if (f.isPersistent() && !f.isToSet())
+ return true;
+
+ return false;
+ }
+
+ /* This is not a serialized field. There should be
+ * a default value only if the field really exists.
+ */
+ try
+ {
+ return (clazz.forClass().getDeclaredField (name) != null);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public boolean get(String name, boolean defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Boolean.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ return prim_field_data[field.getOffset()] == 0 ? false : true;
+ }
+
+ public char get(String name, char defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Character.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ int off = field.getOffset();
- if (field == null)
- return defvalue;
-
- int off = field.getOffset();
-
- return Double.longBitsToDouble
- ( (long) (((prim_field_data[off++] & 0xFFL) << 56)
- | ((prim_field_data[off++] & 0xFFL) << 48)
- | ((prim_field_data[off++] & 0xFFL) << 40)
- | ((prim_field_data[off++] & 0xFFL) << 32)
- | ((prim_field_data[off++] & 0xFF) << 24)
- | ((prim_field_data[off++] & 0xFF) << 16)
- | ((prim_field_data[off++] & 0xFF) << 8)
- | (prim_field_data[off] & 0xFF)));
- }
-
- public Object get(String name, Object defvalue)
- throws IOException, IllegalArgumentException
- {
- ObjectStreamField field =
- getField(name, defvalue == null ? null : defvalue.getClass ());
-
- if (field == null)
- return defvalue;
-
- return objs[field.getOffset()];
- }
-
- private ObjectStreamField getField(String name, Class type)
- throws IllegalArgumentException
- {
- ObjectStreamField field = clazz.getField(name);
- boolean illegal = false;
+ return (char)(((prim_field_data[off++] & 0xFF) << 8)
+ | (prim_field_data[off] & 0xFF));
+ }
+
+ public byte get(String name, byte defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Byte.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ return prim_field_data[field.getOffset()];
+ }
+
+ public short get(String name, short defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Short.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ int off = field.getOffset();
+
+ return (short)(((prim_field_data[off++] & 0xFF) << 8)
+ | (prim_field_data[off] & 0xFF));
+ }
+
+ public int get(String name, int defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Integer.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ int off = field.getOffset();
+
+ return ((prim_field_data[off++] & 0xFF) << 24)
+ | ((prim_field_data[off++] & 0xFF) << 16)
+ | ((prim_field_data[off++] & 0xFF) << 8)
+ | (prim_field_data[off] & 0xFF);
+ }
+
+ public long get(String name, long defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Long.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ int off = field.getOffset();
+
+ return (long)(((prim_field_data[off++] & 0xFFL) << 56)
+ | ((prim_field_data[off++] & 0xFFL) << 48)
+ | ((prim_field_data[off++] & 0xFFL) << 40)
+ | ((prim_field_data[off++] & 0xFFL) << 32)
+ | ((prim_field_data[off++] & 0xFF) << 24)
+ | ((prim_field_data[off++] & 0xFF) << 16)
+ | ((prim_field_data[off++] & 0xFF) << 8)
+ | (prim_field_data[off] & 0xFF));
+ }
+
+ public float get(String name, float defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Float.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ int off = field.getOffset();
+
+ return Float.intBitsToFloat(((prim_field_data[off++] & 0xFF) << 24)
+ | ((prim_field_data[off++] & 0xFF) << 16)
+ | ((prim_field_data[off++] & 0xFF) << 8)
+ | (prim_field_data[off] & 0xFF));
+ }
+
+ public double get(String name, double defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field = getField(name, Double.TYPE);
+
+ if (field == null)
+ return defvalue;
+
+ int off = field.getOffset();
+
+ return Double.longBitsToDouble
+ ( (long) (((prim_field_data[off++] & 0xFFL) << 56)
+ | ((prim_field_data[off++] & 0xFFL) << 48)
+ | ((prim_field_data[off++] & 0xFFL) << 40)
+ | ((prim_field_data[off++] & 0xFFL) << 32)
+ | ((prim_field_data[off++] & 0xFF) << 24)
+ | ((prim_field_data[off++] & 0xFF) << 16)
+ | ((prim_field_data[off++] & 0xFF) << 8)
+ | (prim_field_data[off] & 0xFF)));
+ }
+
+ public Object get(String name, Object defvalue)
+ throws IOException, IllegalArgumentException
+ {
+ ObjectStreamField field =
+ getField(name, defvalue == null ? null : defvalue.getClass ());
+
+ if (field == null)
+ return defvalue;
+
+ return objs[field.getOffset()];
+ }
+
+ private ObjectStreamField getField(String name, Class type)
+ throws IllegalArgumentException
+ {
+ ObjectStreamField field = clazz.getField(name);
+ boolean illegal = false;
// XXX This code is horrible and needs to be rewritten!
- try
- {
- try
- {
- Class field_type = field.getType();
-
- if (type == field_type ||
- (type == null && !field_type.isPrimitive()))
- {
- /* See defaulted */
- return field;
- }
-
- illegal = true;
- throw new IllegalArgumentException
- ("Field requested is of type "
- + field_type.getName()
- + ", but requested type was "
- + (type == null ? "Object" : type.getName()));
- }
- catch (NullPointerException _)
- {
- /* Here we catch NullPointerException, because it may
- only come from the call 'field.getType()'. If field
- is null, we have to return null and classpath ethic
- say we must try to avoid 'if (xxx == null)'.
- */
- }
- catch (IllegalArgumentException e)
- {
- throw e;
- }
-
- return null;
- }
- finally
- {
- /* If this is an unassigned field we should return
- * the default value.
- */
- if (!illegal && field != null && !field.isToSet() && field.isPersistent())
- return null;
-
- /* We do not want to modify transient fields. They should
- * be left to 0.
- */
- try
- {
- Field f = clazz.forClass().getDeclaredField(name);
- if (Modifier.isTransient(f.getModifiers()))
- throw new IllegalArgumentException
- ("no such field (non transient) " + name);
- if (field == null && f.getType() != type)
- throw new IllegalArgumentException
- ("Invalid requested type for field " + name);
- }
- catch (NoSuchFieldException e)
- {
- if (field == null)
- throw new IllegalArgumentException(e);
- }
-
- }
- }
+ try
+ {
+ try
+ {
+ Class field_type = field.getType();
+
+ if (type == field_type ||
+ (type == null && !field_type.isPrimitive()))
+ {
+ /* See defaulted */
+ return field;
+ }
+
+ illegal = true;
+ throw new IllegalArgumentException
+ ("Field requested is of type "
+ + field_type.getName()
+ + ", but requested type was "
+ + (type == null ? "Object" : type.getName()));
+ }
+ catch (NullPointerException _)
+ {
+ /* Here we catch NullPointerException, because it may
+ only come from the call 'field.getType()'. If field
+ is null, we have to return null and classpath ethic
+ say we must try to avoid 'if (xxx == null)'.
+ */
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw e;
+ }
+
+ return null;
+ }
+ finally
+ {
+ /* If this is an unassigned field we should return
+ * the default value.
+ */
+ if (!illegal && field != null && !field.isToSet() && field.isPersistent())
+ return null;
+
+ /* We do not want to modify transient fields. They should
+ * be left to 0.
+ */
+ try
+ {
+ Field f = clazz.forClass().getDeclaredField(name);
+ if (Modifier.isTransient(f.getModifiers()))
+ throw new IllegalArgumentException
+ ("no such field (non transient) " + name);
+ if (field == null && f.getType() != type)
+ throw new IllegalArgumentException
+ ("Invalid requested type for field " + name);
+ }
+ catch (NoSuchFieldException e)
+ {
+ if (field == null)
+ throw new IllegalArgumentException(e);
+ }
+
+ }
+ }
};
fieldsAlreadyRead = true;
@@ -1648,11 +1648,11 @@ public class ObjectInputStream extends InputStream
* @see #lookupHandle
*/
private void rememberHandle(Object obj, boolean shared,
- int handle)
+ int handle)
{
handles.put(handle, new Pair<Boolean,Object>(shared, obj));
}
-
+
/**
* Look up the object associated with a given handle.
*
@@ -1667,43 +1667,43 @@ public class ObjectInputStream extends InputStream
{
Pair<Boolean,Object> result = handles.get(handle);
if (result == null)
- throw new StreamCorruptedException("The handle, " +
- Integer.toHexString(handle) +
- ", is invalid.");
+ throw new StreamCorruptedException("The handle, " +
+ Integer.toHexString(handle) +
+ ", is invalid.");
if (!result.getLeft())
- throw new InvalidObjectException("The handle, " +
- Integer.toHexString(handle) +
- ", is not shared.");
+ throw new InvalidObjectException("The handle, " +
+ Integer.toHexString(handle) +
+ ", is not shared.");
return result.getRight();
}
private Object processResolution(ObjectStreamClass osc, Object obj, int handle,
- boolean shared)
+ boolean shared)
throws IOException
{
if (osc != null && obj instanceof Serializable)
{
- try
- {
- Method m = osc.readResolveMethod;
- if(m != null)
- {
- obj = m.invoke(obj, new Object[] {});
- }
- }
- catch (IllegalAccessException ignore)
- {
- }
- catch (InvocationTargetException exception)
- {
- Throwable cause = exception.getCause();
- if (cause instanceof ObjectStreamException)
- throw (ObjectStreamException) cause;
- else if (cause instanceof RuntimeException)
- throw (RuntimeException) cause;
- else if (cause instanceof Error)
- throw (Error) cause;
- }
+ try
+ {
+ Method m = osc.readResolveMethod;
+ if(m != null)
+ {
+ obj = m.invoke(obj, new Object[] {});
+ }
+ }
+ catch (IllegalAccessException ignore)
+ {
+ }
+ catch (InvocationTargetException exception)
+ {
+ Throwable cause = exception.getCause();
+ if (cause instanceof ObjectStreamException)
+ throw (ObjectStreamException) cause;
+ else if (cause instanceof RuntimeException)
+ throw (RuntimeException) cause;
+ else if (cause instanceof Error)
+ throw (Error) cause;
+ }
}
if (this.resolveEnabled)
@@ -1712,24 +1712,24 @@ public class ObjectInputStream extends InputStream
rememberHandle(obj, shared, handle);
if (!shared)
{
- if (obj instanceof byte[])
- return ((byte[]) obj).clone();
- if (obj instanceof short[])
- return ((short[]) obj).clone();
- if (obj instanceof int[])
- return ((int[]) obj).clone();
- if (obj instanceof long[])
- return ((long[]) obj).clone();
- if (obj instanceof char[])
- return ((char[]) obj).clone();
- if (obj instanceof boolean[])
- return ((boolean[]) obj).clone();
- if (obj instanceof float[])
- return ((float[]) obj).clone();
- if (obj instanceof double[])
- return ((double[]) obj).clone();
- if (obj instanceof Object[])
- return ((Object[]) obj).clone();
+ if (obj instanceof byte[])
+ return ((byte[]) obj).clone();
+ if (obj instanceof short[])
+ return ((short[]) obj).clone();
+ if (obj instanceof int[])
+ return ((int[]) obj).clone();
+ if (obj instanceof long[])
+ return ((long[]) obj).clone();
+ if (obj instanceof char[])
+ return ((char[]) obj).clone();
+ if (obj instanceof boolean[])
+ return ((boolean[]) obj).clone();
+ if (obj instanceof float[])
+ return ((float[]) obj).clone();
+ if (obj instanceof double[])
+ return ((double[]) obj).clone();
+ if (obj instanceof Object[])
+ return ((Object[]) obj).clone();
}
return obj;
}
@@ -1756,19 +1756,19 @@ public class ObjectInputStream extends InputStream
{
if (marker == TC_BLOCKDATA)
{
- if(dump) dumpElement("BLOCK DATA SIZE=");
- this.blockDataBytes = this.realInputStream.readUnsignedByte();
- if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
+ if(dump) dumpElement("BLOCK DATA SIZE=");
+ this.blockDataBytes = this.realInputStream.readUnsignedByte();
+ if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
}
else if (marker == TC_BLOCKDATALONG)
{
- if(dump) dumpElement("BLOCK DATA LONG SIZE=");
- this.blockDataBytes = this.realInputStream.readInt();
- if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
+ if(dump) dumpElement("BLOCK DATA LONG SIZE=");
+ this.blockDataBytes = this.realInputStream.readInt();
+ if(dump) dumpElementln (Integer.toString(this.blockDataBytes));
}
else
{
- throw new EOFException("Attempt to read primitive data, but no data block is active.");
+ throw new EOFException("Attempt to read primitive data, but no data block is active.");
}
if (this.blockData.length < this.blockDataBytes)
@@ -1783,68 +1783,68 @@ public class ObjectInputStream extends InputStream
{
if (clazz.isPrimitive())
{
- if (clazz == Boolean.TYPE)
- {
- boolean[] cast_array = (boolean[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readBoolean();
- return;
- }
- if (clazz == Byte.TYPE)
- {
- byte[] cast_array = (byte[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readByte();
- return;
- }
- if (clazz == Character.TYPE)
- {
- char[] cast_array = (char[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readChar();
- return;
- }
- if (clazz == Double.TYPE)
- {
- double[] cast_array = (double[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readDouble();
- return;
- }
- if (clazz == Float.TYPE)
- {
- float[] cast_array = (float[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readFloat();
- return;
- }
- if (clazz == Integer.TYPE)
- {
- int[] cast_array = (int[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readInt();
- return;
- }
- if (clazz == Long.TYPE)
- {
- long[] cast_array = (long[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readLong();
- return;
- }
- if (clazz == Short.TYPE)
- {
- short[] cast_array = (short[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = this.realInputStream.readShort();
- return;
- }
+ if (clazz == Boolean.TYPE)
+ {
+ boolean[] cast_array = (boolean[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readBoolean();
+ return;
+ }
+ if (clazz == Byte.TYPE)
+ {
+ byte[] cast_array = (byte[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readByte();
+ return;
+ }
+ if (clazz == Character.TYPE)
+ {
+ char[] cast_array = (char[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readChar();
+ return;
+ }
+ if (clazz == Double.TYPE)
+ {
+ double[] cast_array = (double[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readDouble();
+ return;
+ }
+ if (clazz == Float.TYPE)
+ {
+ float[] cast_array = (float[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readFloat();
+ return;
+ }
+ if (clazz == Integer.TYPE)
+ {
+ int[] cast_array = (int[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readInt();
+ return;
+ }
+ if (clazz == Long.TYPE)
+ {
+ long[] cast_array = (long[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readLong();
+ return;
+ }
+ if (clazz == Short.TYPE)
+ {
+ short[] cast_array = (short[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = this.realInputStream.readShort();
+ return;
+ }
}
else
{
- Object[] cast_array = (Object[])array;
- for (int i=0; i < cast_array.length; i++)
- cast_array[i] = readObject();
+ Object[] cast_array = (Object[])array;
+ for (int i=0; i < cast_array.length; i++)
+ cast_array[i] = readObject();
}
}
@@ -1855,121 +1855,121 @@ public class ObjectInputStream extends InputStream
for (int i = 0; i < fields.length; i += 2)
{
- ObjectStreamField stream_field = fields[i];
- ObjectStreamField real_field = fields[i + 1];
- boolean read_value = (stream_field != null && stream_field.getOffset() >= 0 && stream_field.isToSet());
- boolean set_value = (real_field != null && real_field.isToSet());
- String field_name;
- char type;
-
- if (stream_field != null)
- {
- field_name = stream_field.getName();
- type = stream_field.getTypeCode();
- }
- else
- {
- field_name = real_field.getName();
- type = real_field.getTypeCode();
- }
-
- switch(type)
- {
- case 'Z':
- {
- boolean value =
- read_value ? this.realInputStream.readBoolean() : false;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setBooleanField(obj, value);
- break;
- }
- case 'B':
- {
- byte value =
- read_value ? this.realInputStream.readByte() : 0;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setByteField(obj, value);
- break;
- }
- case 'C':
- {
- char value =
- read_value ? this.realInputStream.readChar(): 0;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setCharField(obj, value);
- break;
- }
- case 'D':
- {
- double value =
- read_value ? this.realInputStream.readDouble() : 0;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setDoubleField(obj, value);
- break;
- }
- case 'F':
- {
- float value =
- read_value ? this.realInputStream.readFloat() : 0;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setFloatField(obj, value);
- break;
- }
- case 'I':
- {
- int value =
- read_value ? this.realInputStream.readInt() : 0;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setIntField(obj, value);
- break;
- }
- case 'J':
- {
- long value =
- read_value ? this.realInputStream.readLong() : 0;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setLongField(obj, value);
- break;
- }
- case 'S':
- {
- short value =
- read_value ? this.realInputStream.readShort() : 0;
- if (dump && read_value && set_value)
- dumpElementln(" " + field_name + ": " + value);
- if (set_value)
- real_field.setShortField(obj, value);
- break;
- }
- case 'L':
- case '[':
- {
- Object value =
- read_value ? readObject() : null;
- if (set_value)
- real_field.setObjectField(obj, value);
- break;
- }
- default:
- throw new InternalError("Invalid type code: " + type);
- }
+ ObjectStreamField stream_field = fields[i];
+ ObjectStreamField real_field = fields[i + 1];
+ boolean read_value = (stream_field != null && stream_field.getOffset() >= 0 && stream_field.isToSet());
+ boolean set_value = (real_field != null && real_field.isToSet());
+ String field_name;
+ char type;
+
+ if (stream_field != null)
+ {
+ field_name = stream_field.getName();
+ type = stream_field.getTypeCode();
+ }
+ else
+ {
+ field_name = real_field.getName();
+ type = real_field.getTypeCode();
+ }
+
+ switch(type)
+ {
+ case 'Z':
+ {
+ boolean value =
+ read_value ? this.realInputStream.readBoolean() : false;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setBooleanField(obj, value);
+ break;
+ }
+ case 'B':
+ {
+ byte value =
+ read_value ? this.realInputStream.readByte() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setByteField(obj, value);
+ break;
+ }
+ case 'C':
+ {
+ char value =
+ read_value ? this.realInputStream.readChar(): 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setCharField(obj, value);
+ break;
+ }
+ case 'D':
+ {
+ double value =
+ read_value ? this.realInputStream.readDouble() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setDoubleField(obj, value);
+ break;
+ }
+ case 'F':
+ {
+ float value =
+ read_value ? this.realInputStream.readFloat() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setFloatField(obj, value);
+ break;
+ }
+ case 'I':
+ {
+ int value =
+ read_value ? this.realInputStream.readInt() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setIntField(obj, value);
+ break;
+ }
+ case 'J':
+ {
+ long value =
+ read_value ? this.realInputStream.readLong() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setLongField(obj, value);
+ break;
+ }
+ case 'S':
+ {
+ short value =
+ read_value ? this.realInputStream.readShort() : 0;
+ if (dump && read_value && set_value)
+ dumpElementln(" " + field_name + ": " + value);
+ if (set_value)
+ real_field.setShortField(obj, value);
+ break;
+ }
+ case 'L':
+ case '[':
+ {
+ Object value =
+ read_value ? readObject() : null;
+ if (set_value)
+ real_field.setObjectField(obj, value);
+ break;
+ }
+ default:
+ throw new InternalError("Invalid type code: " + type);
+ }
}
}
-
+
// Toggles writing primitive data to block-data buffer.
private boolean setBlockDataMode (boolean on)
{
@@ -1989,10 +1989,10 @@ public class ObjectInputStream extends InputStream
throws ClassNotFoundException, IOException
{
if (constructor == null)
- throw new InvalidClassException("Missing accessible no-arg base class constructor for " + real_class.getName());
+ throw new InvalidClassException("Missing accessible no-arg base class constructor for " + real_class.getName());
try
{
- return VMObjectInputStream.allocateObject(real_class, constructor.getDeclaringClass(), constructor);
+ return VMObjectInputStream.allocateObject(real_class, constructor.getDeclaringClass(), constructor);
}
catch (InstantiationException e)
{
@@ -2007,17 +2007,17 @@ public class ObjectInputStream extends InputStream
{
try
{
- Iterator<ValidatorAndPriority> it = currentObjectValidators.iterator();
- while(it.hasNext())
- {
- ValidatorAndPriority vap = it.next();
- ObjectInputValidation validator = vap.validator;
- validator.validateObject();
- }
+ Iterator<ValidatorAndPriority> it = currentObjectValidators.iterator();
+ while(it.hasNext())
+ {
+ ValidatorAndPriority vap = it.next();
+ ObjectInputValidation validator = vap.validator;
+ validator.validateObject();
+ }
}
finally
{
- currentObjectValidators = null;
+ currentObjectValidators = null;
}
}
@@ -2026,32 +2026,32 @@ public class ObjectInputStream extends InputStream
{
try
{
- readObject.invoke(obj, new Object[] { this });
+ readObject.invoke(obj, new Object[] { this });
}
catch (InvocationTargetException x)
{
/* Rethrow if possible. */
- Throwable exception = x.getTargetException();
- if (exception instanceof RuntimeException)
- throw (RuntimeException) exception;
- if (exception instanceof IOException)
- throw (IOException) exception;
+ Throwable exception = x.getTargetException();
+ if (exception instanceof RuntimeException)
+ throw (RuntimeException) exception;
+ if (exception instanceof IOException)
+ throw (IOException) exception;
if (exception instanceof ClassNotFoundException)
throw (ClassNotFoundException) exception;
- throw (IOException) new IOException(
- "Exception thrown from readObject() on " + klass).initCause(x);
+ throw (IOException) new IOException(
+ "Exception thrown from readObject() on " + klass).initCause(x);
}
catch (Exception x)
{
- throw (IOException) new IOException(
- "Failure invoking readObject() on " + klass).initCause(x);
+ throw (IOException) new IOException(
+ "Failure invoking readObject() on " + klass).initCause(x);
}
// Invalidate fields which has been read through readFields.
prereadFields = null;
}
-
+
private static final int BUFFER_SIZE = 1024;
private DataInputStream realInputStream;
@@ -2083,7 +2083,7 @@ public class ObjectInputStream extends InputStream
{
System.out.print(msg);
}
-
+
private void dumpElementln (String msg)
{
System.out.println(msg);
@@ -2096,11 +2096,11 @@ public class ObjectInputStream extends InputStream
{
try
{
- System.out.print(msg);
- if (java.lang.reflect.Proxy.isProxyClass(obj.getClass()))
- System.out.println(obj.getClass());
- else
- System.out.println(obj);
+ System.out.print(msg);
+ if (java.lang.reflect.Proxy.isProxyClass(obj.getClass()))
+ System.out.println(obj.getClass());
+ else
+ System.out.println(obj);
}
catch (Exception _)
{
@@ -2129,4 +2129,3 @@ public class ObjectInputStream extends InputStream
}
}
}
-
diff --git a/java/io/ObjectInputValidation.java b/java/io/ObjectInputValidation.java
index 4fdb8414f..fb6de1905 100644
--- a/java/io/ObjectInputValidation.java
+++ b/java/io/ObjectInputValidation.java
@@ -1,4 +1,4 @@
-/* ObjectInputValidation.java -- Validate an object
+/* ObjectInputValidation.java -- Validate an object
Copyright (C) 1998, 2003 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -36,7 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package java.io;
+package java.io;
/**
* This class allows an object to validate that it is valid after
@@ -46,7 +46,7 @@ package java.io;
* be used to perform re-initialization type activities on an object
* after it has been completely deserialized.
*
- * Since this method functions as a type of callback, it must be
+ * Since this method functions as a type of callback, it must be
* registered through <code>ObjectInputStream.registerValidation</code>
* in order to be invoked. This is typically done in the
* <code>readObject</code> method.
diff --git a/java/io/ObjectOutput.java b/java/io/ObjectOutput.java
index d35a09c3a..628f8b97b 100644
--- a/java/io/ObjectOutput.java
+++ b/java/io/ObjectOutput.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,7 +41,7 @@ package java.io;
/**
* This interface extends <code>DataOutput</code> to provide the additional
* facility of writing object instances to a stream. It also adds some
- * additional methods to make the interface more
+ * additional methods to make the interface more
* <code>OutputStream</code> like.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -64,7 +64,7 @@ public interface ObjectOutput extends DataOutput
* output stream.
*
* @param buf The array of bytes to write.
- *
+ *
* @exception IOException If an error occurs.
*/
void write(byte[] buf) throws IOException;
@@ -79,7 +79,7 @@ public interface ObjectOutput extends DataOutput
*
* @exception IOException If an error occurs.
*/
- void write(byte[] buf, int offset, int len)
+ void write(byte[] buf, int offset, int len)
throws IOException;
/**
@@ -108,4 +108,3 @@ public interface ObjectOutput extends DataOutput
void close() throws IOException;
} // interface ObjectOutput
-
diff --git a/java/io/ObjectOutputStream.java b/java/io/ObjectOutputStream.java
index c09487536..18890c02f 100644
--- a/java/io/ObjectOutputStream.java
+++ b/java/io/ObjectOutputStream.java
@@ -151,9 +151,9 @@ public class ObjectOutputStream extends OutputStream
if (DEBUG)
{
- String val = System.getProperty("gcj.dumpobjects");
- if (val != null && !val.equals(""))
- dump = true;
+ String val = System.getProperty("gcj.dumpobjects");
+ if (val != null && !val.equals(""))
+ dump = true;
}
}
@@ -246,261 +246,261 @@ public class ObjectOutputStream extends OutputStream
{
if (useSubclassMethod)
{
- if (dump)
- dumpElementln ("WRITE OVERRIDE: " + obj);
-
- writeObjectOverride(obj);
- return;
+ if (dump)
+ dumpElementln ("WRITE OVERRIDE: " + obj);
+
+ writeObjectOverride(obj);
+ return;
}
if (dump)
dumpElementln ("WRITE: ", obj);
-
- depth += 2;
+
+ depth += 2;
boolean was_serializing = isSerializing;
boolean old_mode = setBlockDataMode(false);
try
{
- isSerializing = true;
- boolean replaceDone = false;
- Object replacedObject = null;
-
- while (true)
- {
- if (obj == null)
- {
- realOutput.writeByte(TC_NULL);
- break;
- }
-
- int handle = findHandle(obj);
- if (handle >= 0 && shared)
- {
- realOutput.writeByte(TC_REFERENCE);
- realOutput.writeInt(handle);
- break;
- }
-
- if (obj instanceof Class)
- {
- Class cl = (Class)obj;
- ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(cl);
- realOutput.writeByte(TC_CLASS);
- if (!osc.isProxyClass)
- {
- writeObject (osc);
- }
- else
- {System.err.println("1");
- realOutput.writeByte(TC_PROXYCLASSDESC);
- Class[] intfs = cl.getInterfaces();
- realOutput.writeInt(intfs.length);
- for (int i = 0; i < intfs.length; i++)
- realOutput.writeUTF(intfs[i].getName());
-
- boolean oldmode = setBlockDataMode(true);
- annotateProxyClass(cl);
- setBlockDataMode(oldmode);
- realOutput.writeByte(TC_ENDBLOCKDATA);
-
- writeObject(osc.getSuper());
- }
- if (shared)
- assignNewHandle(obj);
- break;
- }
-
- if (obj instanceof ObjectStreamClass)
- {
- writeClassDescriptor((ObjectStreamClass) obj);
- break;
- }
-
- Class clazz = obj.getClass();
- ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(clazz);
- if (osc == null)
- throw new NotSerializableException(clazz.getName());
-
- if (osc.isEnum())
- {
- /* TC_ENUM classDesc newHandle enumConstantName */
- realOutput.writeByte(TC_ENUM);
- writeObject(osc);
- if (shared)
- assignNewHandle(obj);
- writeObject(((Enum) obj).name());
- break;
- }
-
- if ((replacementEnabled || obj instanceof Serializable)
- && ! replaceDone)
- {
- replacedObject = obj;
-
- if (obj instanceof Serializable)
- {
- try
- {
+ isSerializing = true;
+ boolean replaceDone = false;
+ Object replacedObject = null;
+
+ while (true)
+ {
+ if (obj == null)
+ {
+ realOutput.writeByte(TC_NULL);
+ break;
+ }
+
+ int handle = findHandle(obj);
+ if (handle >= 0 && shared)
+ {
+ realOutput.writeByte(TC_REFERENCE);
+ realOutput.writeInt(handle);
+ break;
+ }
+
+ if (obj instanceof Class)
+ {
+ Class cl = (Class)obj;
+ ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(cl);
+ realOutput.writeByte(TC_CLASS);
+ if (!osc.isProxyClass)
+ {
+ writeObject (osc);
+ }
+ else
+ {System.err.println("1");
+ realOutput.writeByte(TC_PROXYCLASSDESC);
+ Class[] intfs = cl.getInterfaces();
+ realOutput.writeInt(intfs.length);
+ for (int i = 0; i < intfs.length; i++)
+ realOutput.writeUTF(intfs[i].getName());
+
+ boolean oldmode = setBlockDataMode(true);
+ annotateProxyClass(cl);
+ setBlockDataMode(oldmode);
+ realOutput.writeByte(TC_ENDBLOCKDATA);
+
+ writeObject(osc.getSuper());
+ }
+ if (shared)
+ assignNewHandle(obj);
+ break;
+ }
+
+ if (obj instanceof ObjectStreamClass)
+ {
+ writeClassDescriptor((ObjectStreamClass) obj);
+ break;
+ }
+
+ Class clazz = obj.getClass();
+ ObjectStreamClass osc = ObjectStreamClass.lookupForClassObject(clazz);
+ if (osc == null)
+ throw new NotSerializableException(clazz.getName());
+
+ if (osc.isEnum())
+ {
+ /* TC_ENUM classDesc newHandle enumConstantName */
+ realOutput.writeByte(TC_ENUM);
+ writeObject(osc);
+ if (shared)
+ assignNewHandle(obj);
+ writeObject(((Enum) obj).name());
+ break;
+ }
+
+ if ((replacementEnabled || obj instanceof Serializable)
+ && ! replaceDone)
+ {
+ replacedObject = obj;
+
+ if (obj instanceof Serializable)
+ {
+ try
+ {
Method m = osc.writeReplaceMethod;
if (m != null)
obj = m.invoke(obj, new Object[0]);
- }
- catch (IllegalAccessException ignore)
- {
- }
- catch (InvocationTargetException ignore)
- {
- }
- }
-
- if (replacementEnabled)
- obj = replaceObject(obj);
-
- replaceDone = true;
- continue;
- }
-
- if (obj instanceof String)
- {
+ }
+ catch (IllegalAccessException ignore)
+ {
+ }
+ catch (InvocationTargetException ignore)
+ {
+ }
+ }
+
+ if (replacementEnabled)
+ obj = replaceObject(obj);
+
+ replaceDone = true;
+ continue;
+ }
+
+ if (obj instanceof String)
+ {
String s = (String)obj;
long l = realOutput.getUTFlength(s, 0, 0);
if (l <= 65535)
{
- realOutput.writeByte(TC_STRING);
- if (shared)
- assignNewHandle(obj);
- realOutput.writeUTFShort(s, (int)l);
+ realOutput.writeByte(TC_STRING);
+ if (shared)
+ assignNewHandle(obj);
+ realOutput.writeUTFShort(s, (int)l);
}
else
{
- realOutput.writeByte(TC_LONGSTRING);
- if (shared)
- assignNewHandle(obj);
- realOutput.writeUTFLong(s, l);
+ realOutput.writeByte(TC_LONGSTRING);
+ if (shared)
+ assignNewHandle(obj);
+ realOutput.writeUTFLong(s, l);
+ }
+ break;
+ }
+
+ if (clazz.isArray ())
+ {
+ realOutput.writeByte(TC_ARRAY);
+ writeObject(osc);
+ if (shared)
+ assignNewHandle(obj);
+ writeArraySizeAndElements(obj, clazz.getComponentType());
+ break;
+ }
+
+ realOutput.writeByte(TC_OBJECT);
+ writeObject(osc);
+
+ if (shared)
+ if (replaceDone)
+ assignNewHandle(replacedObject);
+ else
+ assignNewHandle(obj);
+
+ if (obj instanceof Externalizable)
+ {
+ if (protocolVersion == PROTOCOL_VERSION_2)
+ setBlockDataMode(true);
+
+ ((Externalizable)obj).writeExternal(this);
+
+ if (protocolVersion == PROTOCOL_VERSION_2)
+ {
+ setBlockDataMode(false);
+ realOutput.writeByte(TC_ENDBLOCKDATA);
+ }
+
+ break;
+ }
+
+ if (obj instanceof Serializable)
+ {
+ Object prevObject = this.currentObject;
+ ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
+ currentObject = obj;
+ ObjectStreamClass[] hierarchy = osc.hierarchy();
+
+ for (int i = 0; i < hierarchy.length; i++)
+ {
+ currentObjectStreamClass = hierarchy[i];
+
+ fieldsAlreadyWritten = false;
+ if (currentObjectStreamClass.hasWriteMethod())
+ {
+ if (dump)
+ dumpElementln ("WRITE METHOD CALLED FOR: ", obj);
+ setBlockDataMode(true);
+ callWriteMethod(obj, currentObjectStreamClass);
+ setBlockDataMode(false);
+ realOutput.writeByte(TC_ENDBLOCKDATA);
+ if (dump)
+ dumpElementln ("WRITE ENDBLOCKDATA FOR: ", obj);
+ }
+ else
+ {
+ if (dump)
+ dumpElementln ("WRITE FIELDS CALLED FOR: ", obj);
+ writeFields(obj, currentObjectStreamClass);
+ }
}
- break;
- }
-
- if (clazz.isArray ())
- {
- realOutput.writeByte(TC_ARRAY);
- writeObject(osc);
- if (shared)
- assignNewHandle(obj);
- writeArraySizeAndElements(obj, clazz.getComponentType());
- break;
- }
-
- realOutput.writeByte(TC_OBJECT);
- writeObject(osc);
-
- if (shared)
- if (replaceDone)
- assignNewHandle(replacedObject);
- else
- assignNewHandle(obj);
-
- if (obj instanceof Externalizable)
- {
- if (protocolVersion == PROTOCOL_VERSION_2)
- setBlockDataMode(true);
-
- ((Externalizable)obj).writeExternal(this);
-
- if (protocolVersion == PROTOCOL_VERSION_2)
- {
- setBlockDataMode(false);
- realOutput.writeByte(TC_ENDBLOCKDATA);
- }
-
- break;
- }
-
- if (obj instanceof Serializable)
- {
- Object prevObject = this.currentObject;
- ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
- currentObject = obj;
- ObjectStreamClass[] hierarchy = osc.hierarchy();
-
- for (int i = 0; i < hierarchy.length; i++)
- {
- currentObjectStreamClass = hierarchy[i];
-
- fieldsAlreadyWritten = false;
- if (currentObjectStreamClass.hasWriteMethod())
- {
- if (dump)
- dumpElementln ("WRITE METHOD CALLED FOR: ", obj);
- setBlockDataMode(true);
- callWriteMethod(obj, currentObjectStreamClass);
- setBlockDataMode(false);
- realOutput.writeByte(TC_ENDBLOCKDATA);
- if (dump)
- dumpElementln ("WRITE ENDBLOCKDATA FOR: ", obj);
- }
- else
- {
- if (dump)
- dumpElementln ("WRITE FIELDS CALLED FOR: ", obj);
- writeFields(obj, currentObjectStreamClass);
- }
- }
-
- this.currentObject = prevObject;
- this.currentObjectStreamClass = prevObjectStreamClass;
- currentPutField = null;
- break;
- }
-
- throw new NotSerializableException(clazz.getName()
- + " in "
- + obj.getClass());
- } // end pseudo-loop
+
+ this.currentObject = prevObject;
+ this.currentObjectStreamClass = prevObjectStreamClass;
+ currentPutField = null;
+ break;
+ }
+
+ throw new NotSerializableException(clazz.getName()
+ + " in "
+ + obj.getClass());
+ } // end pseudo-loop
}
catch (ObjectStreamException ose)
{
- // Rethrow these are fatal.
- throw ose;
+ // Rethrow these are fatal.
+ throw ose;
}
catch (IOException e)
{
- realOutput.writeByte(TC_EXCEPTION);
- reset(true);
-
- setBlockDataMode(false);
- try
- {
- if (DEBUG)
- {
- e.printStackTrace(System.out);
- }
- writeObject(e);
- }
- catch (IOException ioe)
- {
- StreamCorruptedException ex =
- new StreamCorruptedException
- (ioe + " thrown while exception was being written to stream.");
- if (DEBUG)
- {
- ex.printStackTrace(System.out);
- }
- throw ex;
- }
-
- reset (true);
-
+ realOutput.writeByte(TC_EXCEPTION);
+ reset(true);
+
+ setBlockDataMode(false);
+ try
+ {
+ if (DEBUG)
+ {
+ e.printStackTrace(System.out);
+ }
+ writeObject(e);
+ }
+ catch (IOException ioe)
+ {
+ StreamCorruptedException ex =
+ new StreamCorruptedException
+ (ioe + " thrown while exception was being written to stream.");
+ if (DEBUG)
+ {
+ ex.printStackTrace(System.out);
+ }
+ throw ex;
+ }
+
+ reset (true);
+
}
finally
{
- isSerializing = was_serializing;
- setBlockDataMode(old_mode);
- depth -= 2;
+ isSerializing = was_serializing;
+ setBlockDataMode(old_mode);
+ depth -= 2;
- if (dump)
- dumpElementln ("END: ", obj);
+ if (dump)
+ dumpElementln ("END: ", obj);
}
}
@@ -509,13 +509,13 @@ public class ObjectOutputStream extends OutputStream
if (osc.isProxyClass)
{
realOutput.writeByte(TC_PROXYCLASSDESC);
- Class[] intfs = osc.forClass().getInterfaces();
- realOutput.writeInt(intfs.length);
- for (int i = 0; i < intfs.length; i++)
- realOutput.writeUTF(intfs[i].getName());
+ Class[] intfs = osc.forClass().getInterfaces();
+ realOutput.writeInt(intfs.length);
+ for (int i = 0; i < intfs.length; i++)
+ realOutput.writeUTF(intfs[i].getName());
assignNewHandle(osc);
-
+
boolean oldmode = setBlockDataMode(true);
annotateProxyClass(osc.forClass());
setBlockDataMode(oldmode);
@@ -525,37 +525,37 @@ public class ObjectOutputStream extends OutputStream
{
realOutput.writeByte(TC_CLASSDESC);
realOutput.writeUTF(osc.getName());
- if (osc.isEnum())
- realOutput.writeLong(0L);
- else
- realOutput.writeLong(osc.getSerialVersionUID());
+ if (osc.isEnum())
+ realOutput.writeLong(0L);
+ else
+ realOutput.writeLong(osc.getSerialVersionUID());
assignNewHandle(osc);
int flags = osc.getFlags();
if (protocolVersion == PROTOCOL_VERSION_2
- && osc.isExternalizable())
+ && osc.isExternalizable())
flags |= SC_BLOCK_DATA;
realOutput.writeByte(flags);
ObjectStreamField[] fields = osc.fields;
- if (fields == ObjectStreamClass.INVALID_FIELDS)
- throw new InvalidClassException
- (osc.getName(), "serialPersistentFields is invalid");
+ if (fields == ObjectStreamClass.INVALID_FIELDS)
+ throw new InvalidClassException
+ (osc.getName(), "serialPersistentFields is invalid");
realOutput.writeShort(fields.length);
ObjectStreamField field;
for (int i = 0; i < fields.length; i++)
{
- field = fields[i];
- realOutput.writeByte(field.getTypeCode ());
- realOutput.writeUTF(field.getName ());
+ field = fields[i];
+ realOutput.writeByte(field.getTypeCode ());
+ realOutput.writeUTF(field.getName ());
- if (! field.isPrimitive())
- writeObject(field.getTypeString());
+ if (! field.isPrimitive())
+ writeObject(field.getTypeString());
}
boolean oldmode = setBlockDataMode(true);
@@ -569,7 +569,7 @@ public class ObjectOutputStream extends OutputStream
else
writeObject(null);
}
-
+
/**
* Writes the current objects non-transient, non-static fields from
* the current class to the underlying output stream.
@@ -598,11 +598,11 @@ public class ObjectOutputStream extends OutputStream
{
if (currentObject == null || currentObjectStreamClass == null)
throw new NotActiveException
- ("defaultWriteObject called by non-active class and/or object");
+ ("defaultWriteObject called by non-active class and/or object");
if (fieldsAlreadyWritten)
throw new IOException
- ("Only one of writeFields and defaultWriteObject may be called, and it may only be called once");
+ ("Only one of writeFields and defaultWriteObject may be called, and it may only be called once");
fieldsAlreadyWritten = true;
}
@@ -629,12 +629,12 @@ public class ObjectOutputStream extends OutputStream
{
if (!internal)
{
- if (isSerializing)
- throw new IOException("Reset called while serialization in progress");
+ if (isSerializing)
+ throw new IOException("Reset called while serialization in progress");
- realOutput.writeByte(TC_RESET);
+ realOutput.writeByte(TC_RESET);
}
-
+
clearHandles();
}
@@ -650,29 +650,29 @@ public class ObjectOutputStream extends OutputStream
* For an explanation of the differences between the two protocols
* see the Java Object Serialization Specification.
* </p>
- *
+ *
* @param version the version to use.
- *
- * @throws IllegalArgumentException if <code>version</code> is not a valid
+ *
+ * @throws IllegalArgumentException if <code>version</code> is not a valid
* protocol.
* @throws IllegalStateException if called after the first the first object
* was serialized.
* @throws IOException if an I/O error occurs.
- *
+ *
* @see ObjectStreamConstants#PROTOCOL_VERSION_1
* @see ObjectStreamConstants#PROTOCOL_VERSION_2
- *
+ *
* @since 1.2
*/
public void useProtocolVersion(int version) throws IOException
{
if (version != PROTOCOL_VERSION_1 && version != PROTOCOL_VERSION_2)
throw new IllegalArgumentException("Invalid protocol version requested.");
-
+
if (nextOID != baseWireHandle)
- throw new IllegalStateException("Protocol version cannot be changed "
+ throw new IllegalStateException("Protocol version cannot be changed "
+ "after serialization started.");
-
+
protocolVersion = version;
}
@@ -728,9 +728,9 @@ public class ObjectOutputStream extends OutputStream
{
if (enable)
{
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new SerializablePermission("enableSubstitution"));
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new SerializablePermission("enableSubstitution"));
}
boolean old_val = replacementEnabled;
@@ -799,10 +799,10 @@ public class ObjectOutputStream extends OutputStream
{
if (writeDataAsBlocks)
{
- if (blockDataCount == BUFFER_SIZE)
- drain();
+ if (blockDataCount == BUFFER_SIZE)
+ drain();
- blockData[ blockDataCount++ ] = (byte)data;
+ blockData[ blockDataCount++ ] = (byte)data;
}
else
realOutput.write(data);
@@ -825,20 +825,20 @@ public class ObjectOutputStream extends OutputStream
{
if (writeDataAsBlocks)
{
- if (len < 0)
- throw new IndexOutOfBoundsException();
-
- if (blockDataCount + len < BUFFER_SIZE)
- {
- System.arraycopy(b, off, blockData, blockDataCount, len);
- blockDataCount += len;
- }
- else
- {
- drain();
- writeBlockDataHeader(len);
- realOutput.write(b, off, len);
- }
+ if (len < 0)
+ throw new IndexOutOfBoundsException();
+
+ if (blockDataCount + len < BUFFER_SIZE)
+ {
+ System.arraycopy(b, off, blockData, blockDataCount, len);
+ blockDataCount += len;
+ }
+ else
+ {
+ drain();
+ writeBlockDataHeader(len);
+ realOutput.write(b, off, len);
+ }
}
else
realOutput.write(b, off, len);
@@ -1014,143 +1014,143 @@ public class ObjectOutputStream extends OutputStream
currentPutField = new PutField()
{
- private byte[] prim_field_data
- = new byte[currentObjectStreamClass.primFieldSize];
- private Object[] objs
- = new Object[currentObjectStreamClass.objectFieldCount];
-
- private ObjectStreamField getField (String name)
- {
- ObjectStreamField field
- = currentObjectStreamClass.getField(name);
-
- if (field == null)
- throw new IllegalArgumentException("no such serializable field " + name);
-
- return field;
- }
-
- public void put(String name, boolean value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'Z');
- prim_field_data[field.getOffset ()] = (byte)(value ? 1 : 0);
- }
-
- public void put(String name, byte value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'B');
- prim_field_data[field.getOffset()] = value;
- }
-
- public void put(String name, char value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'C');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, double value)
- {
- ObjectStreamField field = getField (name);
-
- checkType(field, 'D');
- int off = field.getOffset();
- long l_value = Double.doubleToLongBits (value);
- prim_field_data[off++] = (byte)(l_value >>> 52);
- prim_field_data[off++] = (byte)(l_value >>> 48);
- prim_field_data[off++] = (byte)(l_value >>> 40);
- prim_field_data[off++] = (byte)(l_value >>> 32);
- prim_field_data[off++] = (byte)(l_value >>> 24);
- prim_field_data[off++] = (byte)(l_value >>> 16);
- prim_field_data[off++] = (byte)(l_value >>> 8);
- prim_field_data[off] = (byte)l_value;
- }
-
- public void put(String name, float value)
- {
- ObjectStreamField field = getField(name);
-
- checkType(field, 'F');
- int off = field.getOffset();
- int i_value = Float.floatToIntBits(value);
- prim_field_data[off++] = (byte)(i_value >>> 24);
- prim_field_data[off++] = (byte)(i_value >>> 16);
- prim_field_data[off++] = (byte)(i_value >>> 8);
- prim_field_data[off] = (byte)i_value;
- }
-
- public void put(String name, int value)
- {
- ObjectStreamField field = getField(name);
- checkType(field, 'I');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 24);
- prim_field_data[off++] = (byte)(value >>> 16);
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, long value)
- {
- ObjectStreamField field = getField(name);
- checkType(field, 'J');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 52);
- prim_field_data[off++] = (byte)(value >>> 48);
- prim_field_data[off++] = (byte)(value >>> 40);
- prim_field_data[off++] = (byte)(value >>> 32);
- prim_field_data[off++] = (byte)(value >>> 24);
- prim_field_data[off++] = (byte)(value >>> 16);
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, short value)
- {
- ObjectStreamField field = getField(name);
- checkType(field, 'S');
- int off = field.getOffset();
- prim_field_data[off++] = (byte)(value >>> 8);
- prim_field_data[off] = (byte)value;
- }
-
- public void put(String name, Object value)
- {
- ObjectStreamField field = getField(name);
-
- if (value != null &&
- ! field.getType().isAssignableFrom(value.getClass ()))
- throw new IllegalArgumentException("Class " + value.getClass() +
- " cannot be cast to " + field.getType());
- objs[field.getOffset()] = value;
- }
-
- public void write(ObjectOutput out) throws IOException
- {
- // Apparently Block data is not used with PutField as per
- // empirical evidence against JDK 1.2. Also see Mauve test
- // java.io.ObjectInputOutput.Test.GetPutField.
- boolean oldmode = setBlockDataMode(false);
- out.write(prim_field_data);
- for (int i = 0; i < objs.length; ++ i)
- out.writeObject(objs[i]);
- setBlockDataMode(oldmode);
- }
-
- private void checkType(ObjectStreamField field, char type)
- throws IllegalArgumentException
- {
- if (TypeSignature.getEncodingOfClass(field.getType()).charAt(0)
- != type)
- throw new IllegalArgumentException();
- }
+ private byte[] prim_field_data
+ = new byte[currentObjectStreamClass.primFieldSize];
+ private Object[] objs
+ = new Object[currentObjectStreamClass.objectFieldCount];
+
+ private ObjectStreamField getField (String name)
+ {
+ ObjectStreamField field
+ = currentObjectStreamClass.getField(name);
+
+ if (field == null)
+ throw new IllegalArgumentException("no such serializable field " + name);
+
+ return field;
+ }
+
+ public void put(String name, boolean value)
+ {
+ ObjectStreamField field = getField(name);
+
+ checkType(field, 'Z');
+ prim_field_data[field.getOffset ()] = (byte)(value ? 1 : 0);
+ }
+
+ public void put(String name, byte value)
+ {
+ ObjectStreamField field = getField(name);
+
+ checkType(field, 'B');
+ prim_field_data[field.getOffset()] = value;
+ }
+
+ public void put(String name, char value)
+ {
+ ObjectStreamField field = getField(name);
+
+ checkType(field, 'C');
+ int off = field.getOffset();
+ prim_field_data[off++] = (byte)(value >>> 8);
+ prim_field_data[off] = (byte)value;
+ }
+
+ public void put(String name, double value)
+ {
+ ObjectStreamField field = getField (name);
+
+ checkType(field, 'D');
+ int off = field.getOffset();
+ long l_value = Double.doubleToLongBits (value);
+ prim_field_data[off++] = (byte)(l_value >>> 52);
+ prim_field_data[off++] = (byte)(l_value >>> 48);
+ prim_field_data[off++] = (byte)(l_value >>> 40);
+ prim_field_data[off++] = (byte)(l_value >>> 32);
+ prim_field_data[off++] = (byte)(l_value >>> 24);
+ prim_field_data[off++] = (byte)(l_value >>> 16);
+ prim_field_data[off++] = (byte)(l_value >>> 8);
+ prim_field_data[off] = (byte)l_value;
+ }
+
+ public void put(String name, float value)
+ {
+ ObjectStreamField field = getField(name);
+
+ checkType(field, 'F');
+ int off = field.getOffset();
+ int i_value = Float.floatToIntBits(value);
+ prim_field_data[off++] = (byte)(i_value >>> 24);
+ prim_field_data[off++] = (byte)(i_value >>> 16);
+ prim_field_data[off++] = (byte)(i_value >>> 8);
+ prim_field_data[off] = (byte)i_value;
+ }
+
+ public void put(String name, int value)
+ {
+ ObjectStreamField field = getField(name);
+ checkType(field, 'I');
+ int off = field.getOffset();
+ prim_field_data[off++] = (byte)(value >>> 24);
+ prim_field_data[off++] = (byte)(value >>> 16);
+ prim_field_data[off++] = (byte)(value >>> 8);
+ prim_field_data[off] = (byte)value;
+ }
+
+ public void put(String name, long value)
+ {
+ ObjectStreamField field = getField(name);
+ checkType(field, 'J');
+ int off = field.getOffset();
+ prim_field_data[off++] = (byte)(value >>> 52);
+ prim_field_data[off++] = (byte)(value >>> 48);
+ prim_field_data[off++] = (byte)(value >>> 40);
+ prim_field_data[off++] = (byte)(value >>> 32);
+ prim_field_data[off++] = (byte)(value >>> 24);
+ prim_field_data[off++] = (byte)(value >>> 16);
+ prim_field_data[off++] = (byte)(value >>> 8);
+ prim_field_data[off] = (byte)value;
+ }
+
+ public void put(String name, short value)
+ {
+ ObjectStreamField field = getField(name);
+ checkType(field, 'S');
+ int off = field.getOffset();
+ prim_field_data[off++] = (byte)(value >>> 8);
+ prim_field_data[off] = (byte)value;
+ }
+
+ public void put(String name, Object value)
+ {
+ ObjectStreamField field = getField(name);
+
+ if (value != null &&
+ ! field.getType().isAssignableFrom(value.getClass ()))
+ throw new IllegalArgumentException("Class " + value.getClass() +
+ " cannot be cast to " + field.getType());
+ objs[field.getOffset()] = value;
+ }
+
+ public void write(ObjectOutput out) throws IOException
+ {
+ // Apparently Block data is not used with PutField as per
+ // empirical evidence against JDK 1.2. Also see Mauve test
+ // java.io.ObjectInputOutput.Test.GetPutField.
+ boolean oldmode = setBlockDataMode(false);
+ out.write(prim_field_data);
+ for (int i = 0; i < objs.length; ++ i)
+ out.writeObject(objs[i]);
+ setBlockDataMode(oldmode);
+ }
+
+ private void checkType(ObjectStreamField field, char type)
+ throws IllegalArgumentException
+ {
+ if (TypeSignature.getEncodingOfClass(field.getType()).charAt(0)
+ != type)
+ throw new IllegalArgumentException();
+ }
};
// end PutFieldImpl
@@ -1174,13 +1174,13 @@ public class ObjectOutputStream extends OutputStream
{
if (size < 256)
{
- realOutput.writeByte(TC_BLOCKDATA);
- realOutput.write(size);
+ realOutput.writeByte(TC_BLOCKDATA);
+ realOutput.write(size);
}
else
{
- realOutput.writeByte(TC_BLOCKDATALONG);
- realOutput.writeInt(size);
+ realOutput.writeByte(TC_BLOCKDATALONG);
+ realOutput.writeInt(size);
}
}
@@ -1217,76 +1217,76 @@ public class ObjectOutputStream extends OutputStream
if (clazz.isPrimitive())
{
- if (clazz == Boolean.TYPE)
- {
- boolean[] cast_array = (boolean[])array;
- realOutput.writeInt (length);
- for (int i = 0; i < length; i++)
- realOutput.writeBoolean(cast_array[i]);
- return;
- }
- if (clazz == Byte.TYPE)
- {
- byte[] cast_array = (byte[])array;
- realOutput.writeInt(length);
- realOutput.write(cast_array, 0, length);
- return;
- }
- if (clazz == Character.TYPE)
- {
- char[] cast_array = (char[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeChar(cast_array[i]);
- return;
- }
- if (clazz == Double.TYPE)
- {
- double[] cast_array = (double[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeDouble(cast_array[i]);
- return;
- }
- if (clazz == Float.TYPE)
- {
- float[] cast_array = (float[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeFloat(cast_array[i]);
- return;
- }
- if (clazz == Integer.TYPE)
- {
- int[] cast_array = (int[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- realOutput.writeInt(cast_array[i]);
- return;
- }
- if (clazz == Long.TYPE)
- {
- long[] cast_array = (long[])array;
- realOutput.writeInt (length);
- for (int i = 0; i < length; i++)
- realOutput.writeLong(cast_array[i]);
- return;
- }
- if (clazz == Short.TYPE)
- {
- short[] cast_array = (short[])array;
- realOutput.writeInt (length);
- for (int i = 0; i < length; i++)
- realOutput.writeShort(cast_array[i]);
- return;
- }
+ if (clazz == Boolean.TYPE)
+ {
+ boolean[] cast_array = (boolean[])array;
+ realOutput.writeInt (length);
+ for (int i = 0; i < length; i++)
+ realOutput.writeBoolean(cast_array[i]);
+ return;
+ }
+ if (clazz == Byte.TYPE)
+ {
+ byte[] cast_array = (byte[])array;
+ realOutput.writeInt(length);
+ realOutput.write(cast_array, 0, length);
+ return;
+ }
+ if (clazz == Character.TYPE)
+ {
+ char[] cast_array = (char[])array;
+ realOutput.writeInt(length);
+ for (int i = 0; i < length; i++)
+ realOutput.writeChar(cast_array[i]);
+ return;
+ }
+ if (clazz == Double.TYPE)
+ {
+ double[] cast_array = (double[])array;
+ realOutput.writeInt(length);
+ for (int i = 0; i < length; i++)
+ realOutput.writeDouble(cast_array[i]);
+ return;
+ }
+ if (clazz == Float.TYPE)
+ {
+ float[] cast_array = (float[])array;
+ realOutput.writeInt(length);
+ for (int i = 0; i < length; i++)
+ realOutput.writeFloat(cast_array[i]);
+ return;
+ }
+ if (clazz == Integer.TYPE)
+ {
+ int[] cast_array = (int[])array;
+ realOutput.writeInt(length);
+ for (int i = 0; i < length; i++)
+ realOutput.writeInt(cast_array[i]);
+ return;
+ }
+ if (clazz == Long.TYPE)
+ {
+ long[] cast_array = (long[])array;
+ realOutput.writeInt (length);
+ for (int i = 0; i < length; i++)
+ realOutput.writeLong(cast_array[i]);
+ return;
+ }
+ if (clazz == Short.TYPE)
+ {
+ short[] cast_array = (short[])array;
+ realOutput.writeInt (length);
+ for (int i = 0; i < length; i++)
+ realOutput.writeShort(cast_array[i]);
+ return;
+ }
}
else
{
- Object[] cast_array = (Object[])array;
- realOutput.writeInt(length);
- for (int i = 0; i < length; i++)
- writeObject(cast_array[i]);
+ Object[] cast_array = (Object[])array;
+ realOutput.writeInt(length);
+ for (int i = 0; i < length; i++)
+ writeObject(cast_array[i]);
}
}
@@ -1319,11 +1319,11 @@ public class ObjectOutputStream extends OutputStream
IOException e = new IOException("Unexpected exception " + _);
e.initCause(_);
throw(e);
- }
+ }
setBlockDataMode(oldmode);
}
-
+
/**
* Helper function for writeFields(Object,ObjectStreamClass): write
@@ -1341,10 +1341,10 @@ public class ObjectOutputStream extends OutputStream
{
ObjectStreamField osf = fields[i];
Field field = osf.field;
-
+
if (DEBUG && dump)
dumpElementln ("WRITE FIELD: " + osf.getName() + " type=" + osf.getType());
-
+
switch (osf.getTypeCode())
{
case 'Z': realOutput.writeBoolean(field.getBoolean(obj)); break;
@@ -1355,9 +1355,9 @@ public class ObjectOutputStream extends OutputStream
case 'F': realOutput.writeFloat (field.getFloat (obj)); break;
case 'J': realOutput.writeLong (field.getLong (obj)); break;
case 'D': realOutput.writeDouble (field.getDouble (obj)); break;
- case 'L':
+ case 'L':
case '[': writeObject (field.get (obj)); break;
- default:
+ default:
throw new IOException("Unexpected type code " + osf.getTypeCode());
}
}
@@ -1396,27 +1396,27 @@ public class ObjectOutputStream extends OutputStream
catch (InvocationTargetException x)
{
/* Rethrow if possible. */
- Throwable exception = x.getTargetException();
- if (exception instanceof RuntimeException)
- throw (RuntimeException) exception;
- if (exception instanceof IOException)
- throw (IOException) exception;
-
- IOException ioe
- = new IOException("Exception thrown from writeObject() on " +
- osc.forClass().getName() + ": " +
+ Throwable exception = x.getTargetException();
+ if (exception instanceof RuntimeException)
+ throw (RuntimeException) exception;
+ if (exception instanceof IOException)
+ throw (IOException) exception;
+
+ IOException ioe
+ = new IOException("Exception thrown from writeObject() on " +
+ osc.forClass().getName() + ": " +
exception.getClass().getName());
- ioe.initCause(exception);
- throw ioe;
+ ioe.initCause(exception);
+ throw ioe;
}
catch (Exception x)
{
- IOException ioe
- = new IOException("Failure invoking writeObject() on " +
- osc.forClass().getName() + ": " +
- x.getClass().getName());
- ioe.initCause(x);
- throw ioe;
+ IOException ioe
+ = new IOException("Failure invoking writeObject() on " +
+ osc.forClass().getName() + ": " +
+ x.getClass().getName());
+ ioe.initCause(x);
+ throw ioe;
}
}
@@ -1424,21 +1424,21 @@ public class ObjectOutputStream extends OutputStream
{
try
{
- for (int i = 0; i < depth; i++)
- System.out.print (" ");
- System.out.print (Thread.currentThread() + ": ");
- System.out.print (msg);
- if (java.lang.reflect.Proxy.isProxyClass(obj.getClass()))
- System.out.print (obj.getClass());
- else
- System.out.print (obj);
+ for (int i = 0; i < depth; i++)
+ System.out.print (" ");
+ System.out.print (Thread.currentThread() + ": ");
+ System.out.print (msg);
+ if (java.lang.reflect.Proxy.isProxyClass(obj.getClass()))
+ System.out.print (obj.getClass());
+ else
+ System.out.print (obj);
}
catch (Exception _)
{
}
finally
{
- System.out.println ();
+ System.out.println ();
}
}
diff --git a/java/io/ObjectStreamClass.java b/java/io/ObjectStreamClass.java
index dd7cecf9c..dc387c9e3 100644
--- a/java/io/ObjectStreamClass.java
+++ b/java/io/ObjectStreamClass.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -81,7 +81,7 @@ public class ObjectStreamClass implements Serializable
*
* Warning: If this class contains an invalid serialPersistentField arrays
* lookup will not throw anything. However {@link #getFields()} will return
- * an empty array and {@link java.io.ObjectOutputStream#writeObject} will throw an
+ * an empty array and {@link java.io.ObjectOutputStream#writeObject} will throw an
* {@link java.io.InvalidClassException}.
*
* @see java.io.Serializable
@@ -112,9 +112,9 @@ public class ObjectStreamClass implements Serializable
return osc;
else
{
- osc = new ObjectStreamClass(cl);
- classLookupTable.put(cl, osc);
- return osc;
+ osc = new ObjectStreamClass(cl);
+ classLookupTable.put(cl, osc);
+ return osc;
}
}
@@ -180,7 +180,7 @@ public class ObjectStreamClass implements Serializable
{
for (int i = 0; i < fields.length; i++)
if (fields[i].getName().equals(name))
- return fields[i];
+ return fields[i];
return null;
}
@@ -256,24 +256,24 @@ public class ObjectStreamClass implements Serializable
*/
ObjectStreamClass[] hierarchy()
{
- ObjectStreamClass[] result = hierarchy;
+ ObjectStreamClass[] result = hierarchy;
if (result == null)
{
- int d = 0;
-
+ int d = 0;
+
for(ObjectStreamClass osc = this; osc != null; osc = osc.getSuper())
d++;
-
+
result = new ObjectStreamClass[d];
-
+
for (ObjectStreamClass osc = this; osc != null; osc = osc.getSuper())
{
result[--d] = osc;
}
-
- hierarchy = result;
+
+ hierarchy = result;
}
- return result;
+ return result;
}
/**
@@ -292,7 +292,7 @@ public class ObjectStreamClass implements Serializable
ObjectStreamClass(String name, long uid, byte flags,
- ObjectStreamField[] fields)
+ ObjectStreamField[] fields)
{
this.name = name;
this.uid = uid;
@@ -322,117 +322,117 @@ public class ObjectStreamClass implements Serializable
uid = class_uid;
else
{
- // Check that the actual UID of the resolved class matches the UID from
- // the stream. Mismatches for array classes are ignored.
- if (!cl.isArray() && uid != class_uid)
- {
- String msg = cl +
- ": Local class not compatible: stream serialVersionUID="
- + uid + ", local serialVersionUID=" + class_uid;
- throw new InvalidClassException (msg);
- }
+ // Check that the actual UID of the resolved class matches the UID from
+ // the stream. Mismatches for array classes are ignored.
+ if (!cl.isArray() && uid != class_uid)
+ {
+ String msg = cl +
+ ": Local class not compatible: stream serialVersionUID="
+ + uid + ", local serialVersionUID=" + class_uid;
+ throw new InvalidClassException (msg);
+ }
}
isProxyClass = clazz != null && Proxy.isProxyClass(clazz);
this.superClass = superClass;
calculateOffsets();
-
+
try
{
- ObjectStreamField[] exportedFields = getSerialPersistentFields (clazz);
-
- if (exportedFields == null)
- return;
-
- ObjectStreamField[] newFieldList = new ObjectStreamField[exportedFields.length + fields.length];
- int i, j, k;
-
- /* We now check the import fields against the exported fields.
- * There should not be contradiction (e.g. int x and String x)
- * but extra virtual fields can be added to the class.
- */
-
- Arrays.sort(exportedFields);
-
- i = 0; j = 0; k = 0;
- while (i < fields.length && j < exportedFields.length)
- {
- int comp = fields[i].compareTo(exportedFields[j]);
-
- if (comp < 0)
- {
- newFieldList[k] = fields[i];
- fields[i].setPersistent(false);
- fields[i].setToSet(false);
- i++;
- }
- else if (comp > 0)
- {
- /* field not found in imported fields. We add it
- * in the list of supported fields.
- */
- newFieldList[k] = exportedFields[j];
- newFieldList[k].setPersistent(true);
- newFieldList[k].setToSet(false);
- try
- {
- newFieldList[k].lookupField(clazz);
- newFieldList[k].checkFieldType();
- }
- catch (NoSuchFieldException _)
- {
- }
- j++;
- }
- else
- {
- try
- {
- exportedFields[j].lookupField(clazz);
- exportedFields[j].checkFieldType();
- }
- catch (NoSuchFieldException _)
- {
- }
-
- if (!fields[i].getType().equals(exportedFields[j].getType()))
- throw new InvalidClassException
- ("serialPersistentFields must be compatible with" +
- " imported fields (about " + fields[i].getName() + ")");
- newFieldList[k] = fields[i];
- fields[i].setPersistent(true);
- i++;
- j++;
- }
- k++;
- }
-
- if (i < fields.length)
- for (;i<fields.length;i++,k++)
- {
- fields[i].setPersistent(false);
- fields[i].setToSet(false);
- newFieldList[k] = fields[i];
- }
- else
- if (j < exportedFields.length)
- for (;j<exportedFields.length;j++,k++)
- {
- exportedFields[j].setPersistent(true);
- exportedFields[j].setToSet(false);
- newFieldList[k] = exportedFields[j];
- }
-
- fields = new ObjectStreamField[k];
- System.arraycopy(newFieldList, 0, fields, 0, k);
+ ObjectStreamField[] exportedFields = getSerialPersistentFields (clazz);
+
+ if (exportedFields == null)
+ return;
+
+ ObjectStreamField[] newFieldList = new ObjectStreamField[exportedFields.length + fields.length];
+ int i, j, k;
+
+ /* We now check the import fields against the exported fields.
+ * There should not be contradiction (e.g. int x and String x)
+ * but extra virtual fields can be added to the class.
+ */
+
+ Arrays.sort(exportedFields);
+
+ i = 0; j = 0; k = 0;
+ while (i < fields.length && j < exportedFields.length)
+ {
+ int comp = fields[i].compareTo(exportedFields[j]);
+
+ if (comp < 0)
+ {
+ newFieldList[k] = fields[i];
+ fields[i].setPersistent(false);
+ fields[i].setToSet(false);
+ i++;
+ }
+ else if (comp > 0)
+ {
+ /* field not found in imported fields. We add it
+ * in the list of supported fields.
+ */
+ newFieldList[k] = exportedFields[j];
+ newFieldList[k].setPersistent(true);
+ newFieldList[k].setToSet(false);
+ try
+ {
+ newFieldList[k].lookupField(clazz);
+ newFieldList[k].checkFieldType();
+ }
+ catch (NoSuchFieldException _)
+ {
+ }
+ j++;
+ }
+ else
+ {
+ try
+ {
+ exportedFields[j].lookupField(clazz);
+ exportedFields[j].checkFieldType();
+ }
+ catch (NoSuchFieldException _)
+ {
+ }
+
+ if (!fields[i].getType().equals(exportedFields[j].getType()))
+ throw new InvalidClassException
+ ("serialPersistentFields must be compatible with" +
+ " imported fields (about " + fields[i].getName() + ")");
+ newFieldList[k] = fields[i];
+ fields[i].setPersistent(true);
+ i++;
+ j++;
+ }
+ k++;
+ }
+
+ if (i < fields.length)
+ for (;i<fields.length;i++,k++)
+ {
+ fields[i].setPersistent(false);
+ fields[i].setToSet(false);
+ newFieldList[k] = fields[i];
+ }
+ else
+ if (j < exportedFields.length)
+ for (;j<exportedFields.length;j++,k++)
+ {
+ exportedFields[j].setPersistent(true);
+ exportedFields[j].setToSet(false);
+ newFieldList[k] = exportedFields[j];
+ }
+
+ fields = new ObjectStreamField[k];
+ System.arraycopy(newFieldList, 0, fields, 0, k);
}
catch (NoSuchFieldException ignore)
{
- return;
+ return;
}
catch (IllegalAccessException ignore)
{
- return;
+ return;
}
}
@@ -450,31 +450,31 @@ public class ObjectStreamClass implements Serializable
int fcount = fields.length;
for (i = 0; i < fcount; ++ i)
{
- field = fields[i];
-
- if (! field.isPrimitive())
- break;
-
- field.setOffset(primFieldSize);
- switch (field.getTypeCode())
- {
- case 'B':
- case 'Z':
- ++ primFieldSize;
- break;
- case 'C':
- case 'S':
- primFieldSize += 2;
- break;
- case 'I':
- case 'F':
- primFieldSize += 4;
- break;
- case 'D':
- case 'J':
- primFieldSize += 8;
- break;
- }
+ field = fields[i];
+
+ if (! field.isPrimitive())
+ break;
+
+ field.setOffset(primFieldSize);
+ switch (field.getTypeCode())
+ {
+ case 'B':
+ case 'Z':
+ ++ primFieldSize;
+ break;
+ case 'C':
+ case 'S':
+ primFieldSize += 2;
+ break;
+ case 'I':
+ case 'F':
+ primFieldSize += 4;
+ break;
+ case 'D':
+ case 'J':
+ primFieldSize += 8;
+ break;
+ }
}
for (objectFieldCount = 0; i < fcount; ++ i)
@@ -482,12 +482,12 @@ public class ObjectStreamClass implements Serializable
}
private Method findMethod(Method[] methods, String name, Class[] params,
- Class returnType, boolean mustBePrivate)
+ Class returnType, boolean mustBePrivate)
{
outer:
for (int i = 0; i < methods.length; i++)
{
- final Method m = methods[i];
+ final Method m = methods[i];
int mods = m.getModifiers();
if (Modifier.isStatic(mods)
|| (mustBePrivate && !Modifier.isPrivate(mods)))
@@ -495,23 +495,23 @@ outer:
continue;
}
- if (m.getName().equals(name)
- && m.getReturnType() == returnType)
- {
- Class[] mp = m.getParameterTypes();
- if (mp.length == params.length)
- {
- for (int j = 0; j < mp.length; j++)
- {
- if (mp[j] != params[j])
- {
- continue outer;
- }
- }
- AccessController.doPrivileged(new SetAccessibleAction(m));
- return m;
- }
- }
+ if (m.getName().equals(name)
+ && m.getReturnType() == returnType)
+ {
+ Class[] mp = m.getParameterTypes();
+ if (mp.length == params.length)
+ {
+ for (int j = 0; j < mp.length; j++)
+ {
+ if (mp[j] != params[j])
+ {
+ continue outer;
+ }
+ }
+ AccessController.doPrivileged(new SetAccessibleAction(m));
+ return m;
+ }
+ }
}
return null;
}
@@ -540,23 +540,23 @@ outer:
{
for (Class c = from; c != null; c = c.getSuperclass())
{
- try
- {
- Method res = c.getDeclaredMethod(name, noArgs);
- int mods = res.getModifiers();
-
- if (c == from
- || Modifier.isProtected(mods)
- || Modifier.isPublic(mods)
- || (! Modifier.isPrivate(mods) && inSamePackage(c, from)))
- {
- AccessController.doPrivileged(new SetAccessibleAction(res));
- return res;
- }
- }
- catch (NoSuchMethodException e)
- {
- }
+ try
+ {
+ Method res = c.getDeclaredMethod(name, noArgs);
+ int mods = res.getModifiers();
+
+ if (c == from
+ || Modifier.isProtected(mods)
+ || Modifier.isPublic(mods)
+ || (! Modifier.isPrivate(mods) && inSamePackage(c, from)))
+ {
+ AccessController.doPrivileged(new SetAccessibleAction(res));
+ return res;
+ }
+ }
+ catch (NoSuchMethodException e)
+ {
+ }
}
return null;
@@ -576,37 +576,37 @@ outer:
private static boolean loadedByBootOrApplicationClassLoader(Class cl)
{
ClassLoader l = cl.getClassLoader();
- return
- ( l == null /* boot loader */ )
+ return
+ ( l == null /* boot loader */ )
|| (l == ClassLoader.getSystemClassLoader() /* application loader */);
- }
+ }
+
+ static Hashtable methodCache = new Hashtable();
- static Hashtable methodCache = new Hashtable();
-
static final Class[] readObjectSignature = { ObjectInputStream.class };
static final Class[] writeObjectSignature = { ObjectOutputStream.class };
private void cacheMethods()
{
- Class cl = forClass();
- Method[] cached = (Method[]) methodCache.get(cl);
+ Class cl = forClass();
+ Method[] cached = (Method[]) methodCache.get(cl);
if (cached == null)
{
cached = new Method[4];
Method[] methods = cl.getDeclaredMethods();
-
+
cached[0] = findMethod(methods, "readObject",
- readObjectSignature,
+ readObjectSignature,
Void.TYPE, true);
cached[1] = findMethod(methods, "writeObject",
- writeObjectSignature,
+ writeObjectSignature,
Void.TYPE, true);
// readResolve and writeReplace can be in parent classes, as long as they
// are accessible from this class.
cached[2] = findAccessibleMethod("readResolve", cl);
cached[3] = findAccessibleMethod("writeReplace", cl);
-
+
/* put in cache if classes not loaded by user class loader.
* For a user class loader, the cache may otherwise grow
* without limit.
@@ -663,65 +663,65 @@ outer:
if (!isSerializable() || isExternalizable() || isEnum())
{
- fields = NO_FIELDS;
- return;
+ fields = NO_FIELDS;
+ return;
}
try
{
- final Field f =
- cl.getDeclaredField("serialPersistentFields");
- setAccessible.setMember(f);
- AccessController.doPrivileged(setAccessible);
- int modifiers = f.getModifiers();
-
- if (Modifier.isStatic(modifiers)
- && Modifier.isFinal(modifiers)
- && Modifier.isPrivate(modifiers))
- {
- fields = getSerialPersistentFields(cl);
- if (fields != null)
- {
- ObjectStreamField[] fieldsName = new ObjectStreamField[fields.length];
- System.arraycopy(fields, 0, fieldsName, 0, fields.length);
-
- Arrays.sort (fieldsName, new Comparator() {
- public int compare(Object o1, Object o2)
- {
- ObjectStreamField f1 = (ObjectStreamField)o1;
- ObjectStreamField f2 = (ObjectStreamField)o2;
-
- return f1.getName().compareTo(f2.getName());
- }
- });
-
- for (int i=1; i < fields.length; i++)
- {
- if (fieldsName[i-1].getName().equals(fieldsName[i].getName()))
- {
- fields = INVALID_FIELDS;
- return;
- }
- }
-
- Arrays.sort (fields);
- // Retrieve field reference.
- for (int i=0; i < fields.length; i++)
- {
- try
- {
- fields[i].lookupField(cl);
- }
- catch (NoSuchFieldException _)
- {
- fields[i].setToSet(false);
- }
- }
-
- calculateOffsets();
- return;
- }
- }
+ final Field f =
+ cl.getDeclaredField("serialPersistentFields");
+ setAccessible.setMember(f);
+ AccessController.doPrivileged(setAccessible);
+ int modifiers = f.getModifiers();
+
+ if (Modifier.isStatic(modifiers)
+ && Modifier.isFinal(modifiers)
+ && Modifier.isPrivate(modifiers))
+ {
+ fields = getSerialPersistentFields(cl);
+ if (fields != null)
+ {
+ ObjectStreamField[] fieldsName = new ObjectStreamField[fields.length];
+ System.arraycopy(fields, 0, fieldsName, 0, fields.length);
+
+ Arrays.sort (fieldsName, new Comparator() {
+ public int compare(Object o1, Object o2)
+ {
+ ObjectStreamField f1 = (ObjectStreamField)o1;
+ ObjectStreamField f2 = (ObjectStreamField)o2;
+
+ return f1.getName().compareTo(f2.getName());
+ }
+ });
+
+ for (int i=1; i < fields.length; i++)
+ {
+ if (fieldsName[i-1].getName().equals(fieldsName[i].getName()))
+ {
+ fields = INVALID_FIELDS;
+ return;
+ }
+ }
+
+ Arrays.sort (fields);
+ // Retrieve field reference.
+ for (int i=0; i < fields.length; i++)
+ {
+ try
+ {
+ fields[i].lookupField(cl);
+ }
+ catch (NoSuchFieldException _)
+ {
+ fields[i].setToSet(false);
+ }
+ }
+
+ calculateOffsets();
+ return;
+ }
+ }
}
catch (NoSuchFieldException ignore)
{
@@ -737,34 +737,34 @@ outer:
// set non-serializable fields to null in all_fields
for (int i = 0; i < all_fields.length; i++)
{
- modifiers = all_fields[i].getModifiers();
- if (Modifier.isTransient(modifiers)
- || Modifier.isStatic(modifiers))
- all_fields[i] = null;
- else
- num_good_fields++;
+ modifiers = all_fields[i].getModifiers();
+ if (Modifier.isTransient(modifiers)
+ || Modifier.isStatic(modifiers))
+ all_fields[i] = null;
+ else
+ num_good_fields++;
}
// make a copy of serializable (non-null) fields
fields = new ObjectStreamField[ num_good_fields ];
for (int from = 0, to = 0; from < all_fields.length; from++)
if (all_fields[from] != null)
- {
- final Field f = all_fields[from];
- setAccessible.setMember(f);
- AccessController.doPrivileged(setAccessible);
- fields[to] = new ObjectStreamField(all_fields[from]);
- to++;
- }
+ {
+ final Field f = all_fields[from];
+ setAccessible.setMember(f);
+ AccessController.doPrivileged(setAccessible);
+ fields[to] = new ObjectStreamField(all_fields[from]);
+ to++;
+ }
Arrays.sort(fields);
// Make sure we don't have any duplicate field names
// (Sun JDK 1.4.1. throws an Internal Error as well)
for (int i = 1; i < fields.length; i++)
{
- if(fields[i - 1].getName().equals(fields[i].getName()))
- throw new InternalError("Duplicate field " +
- fields[i].getName() + " in class " + cl.getName());
+ if(fields[i - 1].getName().equals(fields[i].getName()))
+ throw new InternalError("Duplicate field " +
+ fields[i].getName() + " in class " + cl.getName());
}
calculateOffsets();
}
@@ -778,17 +778,17 @@ outer:
long result = 0;
Long cache = (Long) uidCache.get(cl);
if (cache != null)
- result = cache.longValue();
+ result = cache.longValue();
else
{
- // Note that we can't use Class.isEnum() here, because that returns
- // false for java.lang.Enum and enum value sub classes.
- if (Enum.class.isAssignableFrom(cl) || Proxy.isProxyClass(cl))
- {
- // Spec says that enums and dynamic proxies have
- // a serialVersionUID of 0L.
- return 0L;
- }
+ // Note that we can't use Class.isEnum() here, because that returns
+ // false for java.lang.Enum and enum value sub classes.
+ if (Enum.class.isAssignableFrom(cl) || Proxy.isProxyClass(cl))
+ {
+ // Spec says that enums and dynamic proxies have
+ // a serialVersionUID of 0L.
+ return 0L;
+ }
try
{
result = getClassUIDFromField(cl);
@@ -826,11 +826,11 @@ outer:
* @throws NoSuchFieldException if such a field does not exist or is
* not static, not final, not of type Long or not accessible.
*/
- long getClassUIDFromField(Class cl)
+ long getClassUIDFromField(Class cl)
throws NoSuchFieldException
{
long result;
-
+
try
{
// Use getDeclaredField rather than getField, since serialVersionUID
@@ -840,7 +840,7 @@ outer:
SetAccessibleAction setAccessible = new SetAccessibleAction(suid);
AccessController.doPrivileged(setAccessible);
int modifiers = suid.getModifiers();
-
+
if (Modifier.isStatic(modifiers)
&& Modifier.isFinal(modifiers)
&& suid.getType() == Long.TYPE)
@@ -869,12 +869,12 @@ outer:
* @throws IOException if writing to the DigestOutputStream causes
* an IOException.
*/
- long calculateClassUID(Class cl)
+ long calculateClassUID(Class cl)
throws NoSuchAlgorithmException, IOException
{
- long result;
+ long result;
MessageDigest md;
- try
+ try
{
md = MessageDigest.getInstance("SHA");
}
@@ -885,19 +885,19 @@ outer:
Security.addProvider(gnuProvider);
md = MessageDigest.getInstance("SHA");
}
-
+
DigestOutputStream digest_out =
new DigestOutputStream(nullOutputStream, md);
DataOutputStream data_out = new DataOutputStream(digest_out);
-
+
data_out.writeUTF(cl.getName());
-
+
int modifiers = cl.getModifiers();
// just look at interesting bits
modifiers = modifiers & (Modifier.ABSTRACT | Modifier.FINAL
| Modifier.INTERFACE | Modifier.PUBLIC);
data_out.writeInt(modifiers);
-
+
// Pretend that an array has no interfaces, because when array
// serialization was defined (JDK 1.1), arrays didn't have it.
if (! cl.isArray())
@@ -907,7 +907,7 @@ outer:
for (int i = 0; i < interfaces.length; i++)
data_out.writeUTF(interfaces[i].getName());
}
-
+
Field field;
Field[] fields = cl.getDeclaredFields();
Arrays.sort(fields, memberComparator);
@@ -919,12 +919,12 @@ outer:
&& (Modifier.isStatic(modifiers)
|| Modifier.isTransient(modifiers)))
continue;
-
+
data_out.writeUTF(field.getName());
data_out.writeInt(modifiers);
data_out.writeUTF(TypeSignature.getEncodingOfClass (field.getType()));
}
-
+
// write class initializer method if present
if (VMObjectStreamClass.hasClassInitializer(cl))
{
@@ -932,7 +932,7 @@ outer:
data_out.writeInt(Modifier.STATIC);
data_out.writeUTF("()V");
}
-
+
Constructor constructor;
Constructor[] constructors = cl.getDeclaredConstructors();
Arrays.sort (constructors, memberComparator);
@@ -942,16 +942,16 @@ outer:
modifiers = constructor.getModifiers();
if (Modifier.isPrivate(modifiers))
continue;
-
+
data_out.writeUTF("<init>");
data_out.writeInt(modifiers);
-
+
// the replacement of '/' with '.' was needed to make computed
// SUID's agree with those computed by JDK
- data_out.writeUTF
+ data_out.writeUTF
(TypeSignature.getEncodingOfConstructor(constructor).replace('/','.'));
}
-
+
Method method;
Method[] methods = cl.getDeclaredMethods();
Arrays.sort(methods, memberComparator);
@@ -961,16 +961,16 @@ outer:
modifiers = method.getModifiers();
if (Modifier.isPrivate(modifiers))
continue;
-
+
data_out.writeUTF(method.getName());
data_out.writeInt(modifiers);
-
+
// the replacement of '/' with '.' was needed to make computed
// SUID's agree with those computed by JDK
data_out.writeUTF
(TypeSignature.getEncodingOfMethod(method).replace('/', '.'));
}
-
+
data_out.close();
byte[] sha = md.digest();
result = 0;
@@ -990,7 +990,7 @@ outer:
* @param clazz Class to retrieve 'serialPersistentFields' from.
* @return The content of 'serialPersistentFields'.
*/
- private ObjectStreamField[] getSerialPersistentFields(Class clazz)
+ private ObjectStreamField[] getSerialPersistentFields(Class clazz)
throws NoSuchFieldException, IllegalAccessException
{
ObjectStreamField[] fieldsArray = null;
@@ -1003,12 +1003,12 @@ outer:
int modifiers = f.getModifiers();
if (!(Modifier.isStatic(modifiers) &&
- Modifier.isFinal(modifiers) &&
- Modifier.isPrivate(modifiers)))
+ Modifier.isFinal(modifiers) &&
+ Modifier.isPrivate(modifiers)))
return null;
-
+
o = (ObjectStreamField[]) f.get(null);
-
+
if (o == null)
return null;
@@ -1029,40 +1029,40 @@ outer:
{
synchronized(this)
{
- if (constructor == null)
- {
- try
- {
- final Constructor c = clazz.getConstructor(new Class[0]);
-
- AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
- {
- c.setAccessible(true);
- return null;
- }
- });
-
- constructor = c;
- }
- catch(NoSuchMethodException x)
- {
- throw new InvalidClassException(clazz.getName(),
- "No public zero-argument constructor");
- }
- }
+ if (constructor == null)
+ {
+ try
+ {
+ final Constructor c = clazz.getConstructor(new Class[0]);
+
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
+ {
+ c.setAccessible(true);
+ return null;
+ }
+ });
+
+ constructor = c;
+ }
+ catch(NoSuchMethodException x)
+ {
+ throw new InvalidClassException(clazz.getName(),
+ "No public zero-argument constructor");
+ }
+ }
}
try
{
- return (Externalizable)constructor.newInstance();
+ return (Externalizable)constructor.newInstance();
}
catch(Exception x)
{
- throw (InvalidClassException)
- new InvalidClassException(clazz.getName(),
- "Unable to instantiate").initCause(x);
+ throw (InvalidClassException)
+ new InvalidClassException(clazz.getName(),
+ "Unable to instantiate").initCause(x);
}
}
@@ -1130,7 +1130,7 @@ outer:
if (comp == 0)
return TypeSignature.getEncodingOfMember(m1).
- compareTo(TypeSignature.getEncodingOfMember(m2));
+ compareTo(TypeSignature.getEncodingOfMember(m2));
else
return comp;
}
diff --git a/java/io/ObjectStreamConstants.java b/java/io/ObjectStreamConstants.java
index a29db2a0e..8f70196c9 100644
--- a/java/io/ObjectStreamConstants.java
+++ b/java/io/ObjectStreamConstants.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,24 +45,24 @@ package java.io;
* <code>ObjectInputStream</code>, and <code>ObjectStreamClass</code>.
* The values for these constants are specified by the Java library
* specification.
- *
+ *
* @since 1.1
*/
public interface ObjectStreamConstants
{
- /**
+ /**
* The serialization stream protocol version 1. This version was
* the default serialization protocol before JDK 1.2.
- *
+ *
* @see ObjectOutputStream#useProtocolVersion(int)
* @since 1.2
*/
int PROTOCOL_VERSION_1 = 1;
-
- /**
+
+ /**
* The serialization stream protocol version 2. This version is
* used as the default serialization protocol since JDK 1.2.
- *
+ *
* @see ObjectOutputStream#useProtocolVersion(int)
* @since 1.2
*/
@@ -72,7 +72,7 @@ public interface ObjectStreamConstants
* The magic number that is written as part of the stream header.
*/
short STREAM_MAGIC = (short)0xaced;
-
+
/**
* The stream version number that is written as part of the stream header.
* Note that this is different from the protocol version that specifies
@@ -84,70 +84,70 @@ public interface ObjectStreamConstants
* Token value to designate a <code>null</code> reference in the stream.
*/
byte TC_NULL = (byte)112; //0x70
-
+
/**
* Token value to designate a reference to an already serialized object.
*/
byte TC_REFERENCE = (byte)113; //0x71
-
+
/**
* Token value to designate a class descriptor is next in the stream.
*/
byte TC_CLASSDESC = (byte)114; //0x72
-
+
/**
- * Token value to designate a new object is next in the stream.
+ * Token value to designate a new object is next in the stream.
*/
byte TC_OBJECT = (byte)115; //0x73
-
+
/**
* Token value to designate a new string is next in the stream.
*/
byte TC_STRING = (byte)116; //0x74
-
+
/**
* Token value to designate a new array is next in the stream.
*/
byte TC_ARRAY = (byte)117; //0x75
-
+
/**
* Token reference to designate a reference to a class.
*/
byte TC_CLASS = (byte)118; //0x76
-
+
/**
* Token value to designate a block of primitive data is next in the stream.
* The next byte in the stream holds the size of the block (in bytes).
*/
byte TC_BLOCKDATA = (byte)119; //0x77
-
+
/**
* Token value to designate the end of a block of primitve data.
*/
byte TC_ENDBLOCKDATA = (byte)120; //0x78
-
+
/**
* Token value to designate a reset of the stream state.
*/
byte TC_RESET = (byte)121; //0x79
-
+
/**
* Token value to designate a long block of primitive data is next in the
* stream. The next long in the stream holds the size of the block
- * (in bytes).
+ * (in bytes).
*/
byte TC_BLOCKDATALONG = (byte)122; //0x7A
-
+
/**
* Token value to designate an exception occured during serialization.
*/
byte TC_EXCEPTION = (byte)123; //0x7B
-
+
/**
* Token value to designate a long string is next in the stream.
*/
byte TC_LONGSTRING = (byte)124; //0x7C
-
+
/**
* Token value to designate a proxy class descriptor is next in the stream.
*/
@@ -155,16 +155,16 @@ public interface ObjectStreamConstants
/**
* Token value to designate an enum constant is next in the stream.
- *
+ *
* @since 1.5
*/
byte TC_ENUM = (byte)126; //0x7E
-
+
/**
* The first token value.
*/
byte TC_BASE = TC_NULL;
-
+
/**
* The last token value.
*/
@@ -180,23 +180,23 @@ public interface ObjectStreamConstants
* defines the <code>writeObject</code> method.
*/
byte SC_WRITE_METHOD = 0x01;
-
+
/**
* Flag used in <code>ObjectStreamClass</code> to designate that the class
* is serializeable.
*/
byte SC_SERIALIZABLE = 0x02;
-
+
/**
* Flag used in <code>ObjectStreamClass</code> to designate that the class
* is externalizable.
*/
byte SC_EXTERNALIZABLE = 0x04;
-
+
/**
* Flag used in <code>ObjectStreamClass</code> to designate that
* externalizable data is written in block data mode.
- *
+ *
* @since 1.2
*/
byte SC_BLOCK_DATA = 0x08;
@@ -204,11 +204,11 @@ public interface ObjectStreamConstants
/**
* Flag used in <code>ObjectStreamClass</code> to designate that the class
* is an enum constant.
- *
+ *
* @since 1.5
*/
byte SC_ENUM = 0x10;
-
+
/**
* Constant for use with a <code>SecurityManager</code> to check if
* substitution of objects is allowed.
@@ -224,4 +224,3 @@ public interface ObjectStreamConstants
SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION
= new SerializablePermission("enableSubclassImplementation");
}
-
diff --git a/java/io/ObjectStreamField.java b/java/io/ObjectStreamField.java
index 91f557870..dfb6728a7 100644
--- a/java/io/ObjectStreamField.java
+++ b/java/io/ObjectStreamField.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -55,7 +55,7 @@ import java.security.PrivilegedAction;
* @author Michael Koch (konqueror@gmx.de)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
-public class ObjectStreamField
+public class ObjectStreamField
implements Comparable<Object>
{
private String name;
@@ -74,7 +74,7 @@ public class ObjectStreamField
}
/**
- * This constructor creates an ObjectStreamField instance
+ * This constructor creates an ObjectStreamField instance
* which represents a field named <code>name</code> and is
* of the type <code>type</code>.
*
@@ -87,7 +87,7 @@ public class ObjectStreamField
}
/**
- * This constructor creates an ObjectStreamField instance
+ * This constructor creates an ObjectStreamField instance
* which represents a field named <code>name</code> and is
* of the type <code>type</code>.
*
@@ -105,9 +105,9 @@ public class ObjectStreamField
this.typename = TypeSignature.getEncodingOfClass(type);
this.unshared = unshared;
}
-
+
/**
- * There are many cases you can not get java.lang.Class from typename
+ * There are many cases you can not get java.lang.Class from typename
* if your context class loader cannot load it, then use typename to
* construct the field.
*
@@ -130,7 +130,7 @@ public class ObjectStreamField
{
}
}
-
+
/**
* This method returns the name of the field represented by the
* ObjectStreamField instance.
@@ -169,7 +169,7 @@ public class ObjectStreamField
* {@link #getTypeCode()} in the case the type is a real
* class (and not a primitive).
*
- * @return The name of the type (class name) if it is not a
+ * @return The name of the type (class name) if it is not a
* primitive, in the other case null is returned.
*/
public String getTypeString ()
@@ -195,7 +195,7 @@ public class ObjectStreamField
/**
* This method sets the current offset of the field.
- *
+ *
* @param off The offset of the field in bytes.
* @see #getOffset()
*/
@@ -255,7 +255,7 @@ public class ObjectStreamField
* the field should not be changed when the stream is read (if it is not
* explicitly specified using serialPersistentFields).
*
- * @param persistent True if the field is persistent, false in the
+ * @param persistent True if the field is persistent, false in the
* other cases.
* @see #isPersistent()
*/
@@ -276,7 +276,7 @@ public class ObjectStreamField
}
/**
- * This method is specific to classpath's implementation and so
+ * This method is specific to classpath's implementation and so
* has the default access. It changes the state of this field as
* to be set by ObjectInputStream.
*
@@ -312,16 +312,16 @@ public class ObjectStreamField
void lookupField(Class clazz) throws NoSuchFieldException, SecurityException
{
final Field f = clazz.getDeclaredField(name);
-
+
AccessController.doPrivileged(new PrivilegedAction()
{
- public Object run()
- {
- f.setAccessible(true);
- return null;
- }
+ public Object run()
+ {
+ f.setAccessible(true);
+ return null;
+ }
});
-
+
this.field = f;
}
@@ -340,8 +340,8 @@ public class ObjectStreamField
if (!ftype.isAssignableFrom(type))
throw new InvalidClassException
- ("invalid field type for " + name +
- " in class " + field.getDeclaringClass());
+ ("invalid field type for " + name +
+ " in class " + field.getDeclaringClass());
}
/**
@@ -356,19 +356,19 @@ public class ObjectStreamField
final void setBooleanField(Object obj, boolean val)
{
- VMObjectStreamClass.setBooleanNative(field, obj, val);
+ VMObjectStreamClass.setBooleanNative(field, obj, val);
}
final void setByteField(Object obj, byte val)
{
VMObjectStreamClass.setByteNative(field, obj, val);
}
-
+
final void setCharField(Object obj, char val)
{
VMObjectStreamClass.setCharNative(field, obj, val);
}
-
+
final void setShortField(Object obj, short val)
{
VMObjectStreamClass.setShortNative(field, obj, val);
@@ -378,24 +378,24 @@ public class ObjectStreamField
{
VMObjectStreamClass.setIntNative(field, obj, val);
}
-
+
final void setLongField(Object obj, long val)
{
VMObjectStreamClass.setLongNative(field, obj, val);
}
-
+
final void setFloatField(Object obj, float val)
{
VMObjectStreamClass.setFloatNative(field, obj, val);
}
-
+
final void setDoubleField(Object obj, double val)
{
VMObjectStreamClass.setDoubleNative(field, obj, val);
}
-
+
final void setObjectField(Object obj, Object val)
- {
+ {
VMObjectStreamClass.setObjectNative(field, obj, val);
}
}
diff --git a/java/io/OutputStream.java b/java/io/OutputStream.java
index e3caa70f1..5ba9478e3 100644
--- a/java/io/OutputStream.java
+++ b/java/io/OutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,10 +39,10 @@ exception statement from your version. */
package java.io;
/**
- * This abstract class forms the base of the hierarchy of classes that
+ * This abstract class forms the base of the hierarchy of classes that
* write output as a stream of bytes. It provides a common set of methods
* for writing bytes to stream. Subclasses implement and/or extend these
- * methods to write bytes in a particular manner or to a particular
+ * methods to write bytes in a particular manner or to a particular
* destination such as a file on disk or network connection.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -65,7 +65,7 @@ public abstract class OutputStream implements Closeable, Flushable
* Subclasses must provide an implementation of this abstract method
*
* @param b The byte to be written to the output stream, passed as
- * the low eight bits of an <code>int</code>
+ * the low eight bits of an <code>int</code>
*
* @exception IOException If an error occurs
*/
@@ -98,7 +98,7 @@ public abstract class OutputStream implements Closeable, Flushable
* @param b The array of bytes to write from
* @param off The index into the array to start writing from
* @param len The number of bytes to write
- *
+ *
* @exception IOException If an error occurs
*/
public void write (byte[] b, int off, int len)
diff --git a/java/io/OutputStreamWriter.java b/java/io/OutputStreamWriter.java
index 5ccceed70..27067fdb9 100644
--- a/java/io/OutputStreamWriter.java
+++ b/java/io/OutputStreamWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -79,7 +79,7 @@ import java.nio.charset.MalformedInputException;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Per Bothner (bothner@cygnus.com)
- * @date April 17, 1998.
+ * @date April 17, 1998.
*/
public class OutputStreamWriter extends Writer
{
@@ -111,13 +111,13 @@ public class OutputStreamWriter extends Writer
* design, there is no way to determine which encodings are supported.
*
* @param out The <code>OutputStream</code> to write to
- * @param encoding_scheme The name of the encoding scheme to use for
+ * @param encoding_scheme The name of the encoding scheme to use for
* character to byte translation
*
- * @exception UnsupportedEncodingException If the named encoding is
+ * @exception UnsupportedEncodingException If the named encoding is
* not available.
*/
- public OutputStreamWriter (OutputStream out, String encoding_scheme)
+ public OutputStreamWriter (OutputStream out, String encoding_scheme)
throws UnsupportedEncodingException
{
CharsetEncoder encoder;
@@ -125,58 +125,58 @@ public class OutputStreamWriter extends Writer
this.out = out;
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
- try
+ try
{
- // Don't use NIO if avoidable
- if(EncodingHelper.isISOLatin1(encoding_scheme))
- {
- encodingName = "ISO8859_1";
- encoder = null;
- }
+ // Don't use NIO if avoidable
+ if(EncodingHelper.isISOLatin1(encoding_scheme))
+ {
+ encodingName = "ISO8859_1";
+ encoder = null;
+ }
else
- {
- /*
- * Workaround for encodings with a byte-order-mark.
- * We only want to write it once per stream.
- */
- try
- {
- if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
- encoding_scheme.equalsIgnoreCase("UTF-16") ||
- encoding_scheme.equalsIgnoreCase("UTF16"))
- {
- encoding_scheme = "UTF-16BE";
- out.write((byte)0xFE);
- out.write((byte)0xFF);
- }
- else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle"))
- {
- encoding_scheme = "UTF-16LE";
- out.write((byte)0xFF);
- out.write((byte)0xFE);
- }
- }
- catch(IOException ioe)
- {
- }
-
- Charset cs = EncodingHelper.getCharset(encoding_scheme);
- if(cs == null)
- throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
- " unknown");
- encoder = cs.newEncoder();
- encodingName = EncodingHelper.getOldCanonical(cs.name());
-
- encoder.onMalformedInput(CodingErrorAction.REPLACE);
- encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- }
- }
- catch(RuntimeException e)
+ {
+ /*
+ * Workaround for encodings with a byte-order-mark.
+ * We only want to write it once per stream.
+ */
+ try
+ {
+ if(encoding_scheme.equalsIgnoreCase("UnicodeBig") ||
+ encoding_scheme.equalsIgnoreCase("UTF-16") ||
+ encoding_scheme.equalsIgnoreCase("UTF16"))
+ {
+ encoding_scheme = "UTF-16BE";
+ out.write((byte)0xFE);
+ out.write((byte)0xFF);
+ }
+ else if(encoding_scheme.equalsIgnoreCase("UnicodeLittle"))
+ {
+ encoding_scheme = "UTF-16LE";
+ out.write((byte)0xFF);
+ out.write((byte)0xFE);
+ }
+ }
+ catch(IOException ioe)
+ {
+ }
+
+ Charset cs = EncodingHelper.getCharset(encoding_scheme);
+ if(cs == null)
+ throw new UnsupportedEncodingException("Encoding "+encoding_scheme+
+ " unknown");
+ encoder = cs.newEncoder();
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
+
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ }
+ }
+ catch(RuntimeException e)
{
- // Default to ISO Latin-1, will happen if this is called, for instance,
- // before the NIO provider is loadable.
- encoder = null;
- encodingName = "ISO8859_1";
+ // Default to ISO Latin-1, will happen if this is called, for instance,
+ // before the NIO provider is loadable.
+ encoder = null;
+ encodingName = "ISO8859_1";
}
this.encoder = encoder;
this.encodingName = encodingName;
@@ -194,23 +194,23 @@ public class OutputStreamWriter extends Writer
String encodingName;
this.out = out;
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
- try
+ try
{
- String encoding = System.getProperty("file.encoding");
- Charset cs = Charset.forName(encoding);
- encoder = cs.newEncoder();
- encodingName = EncodingHelper.getOldCanonical(cs.name());
- }
- catch(RuntimeException e)
+ String encoding = System.getProperty("file.encoding");
+ Charset cs = Charset.forName(encoding);
+ encoder = cs.newEncoder();
+ encodingName = EncodingHelper.getOldCanonical(cs.name());
+ }
+ catch(RuntimeException e)
{
- encoder = null;
- encodingName = "ISO8859_1";
+ encoder = null;
+ encodingName = "ISO8859_1";
}
if(encoder != null)
{
- encoder.onMalformedInput(CodingErrorAction.REPLACE);
- encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ encoder.onMalformedInput(CodingErrorAction.REPLACE);
+ encoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
}
this.encoder = encoder;
this.encodingName = encodingName;
@@ -222,7 +222,7 @@ public class OutputStreamWriter extends Writer
*
* @param out The <code>OutputStream</code> to write to
* @param cs The <code>Charset</code> of the encoding to use
- *
+ *
* @since 1.5
*/
public OutputStreamWriter(OutputStream out, Charset cs)
@@ -234,7 +234,7 @@ public class OutputStreamWriter extends Writer
outputBuffer = CharBuffer.allocate(BUFFER_SIZE);
encodingName = EncodingHelper.getOldCanonical(cs.name());
}
-
+
/**
* This method initializes a new instance of <code>OutputStreamWriter</code>
* to write to the specified stream using a given
@@ -242,7 +242,7 @@ public class OutputStreamWriter extends Writer
*
* @param out The <code>OutputStream</code> to write to
* @param enc The <code>CharsetEncoder</code> to encode the output with
- *
+ *
* @since 1.5
*/
public OutputStreamWriter(OutputStream out, CharsetEncoder enc)
@@ -258,7 +258,7 @@ public class OutputStreamWriter extends Writer
}
/**
- * This method closes this stream, and the underlying
+ * This method closes this stream, and the underlying
* <code>OutputStream</code>
*
* @exception IOException If an error occurs
@@ -291,17 +291,17 @@ public class OutputStreamWriter extends Writer
*/
public void flush () throws IOException
{
- if(out != null){
- if(outputBuffer != null){
- char[] buf = new char[outputBuffer.position()];
- if(buf.length > 0){
- outputBuffer.flip();
- outputBuffer.get(buf);
- writeConvert(buf, 0, buf.length);
- outputBuffer.clear();
- }
- }
- out.flush ();
+ if(out != null){
+ if(outputBuffer != null){
+ char[] buf = new char[outputBuffer.position()];
+ if(buf.length > 0){
+ outputBuffer.flip();
+ outputBuffer.get(buf);
+ writeConvert(buf, 0, buf.length);
+ outputBuffer.clear();
+ }
+ }
+ out.flush ();
}
}
@@ -324,71 +324,71 @@ public class OutputStreamWriter extends Writer
throw new IOException("Buffer is null.");
if(outputBuffer != null)
- {
- if(count >= outputBuffer.remaining())
- {
- int r = outputBuffer.remaining();
- outputBuffer.put(buf, offset, r);
- writeConvert(outputBuffer.array(), 0, BUFFER_SIZE);
- outputBuffer.clear();
- offset += r;
- count -= r;
- // if the remaining bytes is larger than the whole buffer,
- // just don't buffer.
- if(count >= outputBuffer.remaining()){
+ {
+ if(count >= outputBuffer.remaining())
+ {
+ int r = outputBuffer.remaining();
+ outputBuffer.put(buf, offset, r);
+ writeConvert(outputBuffer.array(), 0, BUFFER_SIZE);
+ outputBuffer.clear();
+ offset += r;
+ count -= r;
+ // if the remaining bytes is larger than the whole buffer,
+ // just don't buffer.
+ if(count >= outputBuffer.remaining()){
writeConvert(buf, offset, count);
- return;
- }
- }
- outputBuffer.put(buf, offset, count);
- } else writeConvert(buf, offset, count);
+ return;
+ }
+ }
+ outputBuffer.put(buf, offset, count);
+ } else writeConvert(buf, offset, count);
}
/**
* Converts and writes characters.
*/
- private void writeConvert (char[] buf, int offset, int count)
+ private void writeConvert (char[] buf, int offset, int count)
throws IOException
{
if(encoder == null)
{
byte[] b = new byte[count];
for(int i=0;i<count;i++)
- b[i] = nullConversion(buf[offset+i]);
+ b[i] = nullConversion(buf[offset+i]);
out.write(b);
} else {
try {
- ByteBuffer output = encoder.encode(CharBuffer.wrap(buf,offset,count));
- encoder.reset();
- if(output.hasArray())
- out.write(output.array());
- else
- {
- byte[] outbytes = new byte[output.remaining()];
- output.get(outbytes);
- out.write(outbytes);
- }
+ ByteBuffer output = encoder.encode(CharBuffer.wrap(buf,offset,count));
+ encoder.reset();
+ if(output.hasArray())
+ out.write(output.array());
+ else
+ {
+ byte[] outbytes = new byte[output.remaining()];
+ output.get(outbytes);
+ out.write(outbytes);
+ }
} catch(IllegalStateException e) {
- throw new IOException("Internal error.");
+ throw new IOException("Internal error.");
} catch(MalformedInputException e) {
- throw new IOException("Invalid character sequence.");
+ throw new IOException("Invalid character sequence.");
} catch(CharacterCodingException e) {
- throw new IOException("Unmappable character.");
+ throw new IOException("Unmappable character.");
}
}
}
private byte nullConversion(char c) {
- return (byte)((c <= 0xFF)?c:'?');
+ return (byte)((c <= 0xFF)?c:'?');
}
/**
- * This method writes <code>count</code> bytes from the specified
+ * This method writes <code>count</code> bytes from the specified
* <code>String</code> starting at position <code>offset</code> into the
* <code>String</code>.
*
* @param str The <code>String</code> to write chars from
- * @param offset The position in the <code>String</code> to start
+ * @param offset The position in the <code>String</code> to start
* writing chars from
* @param count The number of chars to write
*
@@ -411,20 +411,19 @@ public class OutputStreamWriter extends Writer
*/
public void write (int ch) throws IOException
{
- // No buffering, no encoding ... just pass through
- if (encoder == null && outputBuffer == null) {
- out.write(nullConversion((char)ch));
- } else {
- if (outputBuffer != null) {
- if (outputBuffer.remaining() == 0) {
- writeConvert(outputBuffer.array(), 0, BUFFER_SIZE);
- outputBuffer.clear();
- }
- outputBuffer.put((char)ch);
- } else {
- writeConvert(new char[]{ (char)ch }, 0, 1);
- }
- }
+ // No buffering, no encoding ... just pass through
+ if (encoder == null && outputBuffer == null) {
+ out.write(nullConversion((char)ch));
+ } else {
+ if (outputBuffer != null) {
+ if (outputBuffer.remaining() == 0) {
+ writeConvert(outputBuffer.array(), 0, BUFFER_SIZE);
+ outputBuffer.clear();
+ }
+ outputBuffer.put((char)ch);
+ } else {
+ writeConvert(new char[]{ (char)ch }, 0, 1);
+ }
+ }
}
} // class OutputStreamWriter
-
diff --git a/java/io/PipedInputStream.java b/java/io/PipedInputStream.java
index 924cc6662..0171a1b6f 100644
--- a/java/io/PipedInputStream.java
+++ b/java/io/PipedInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -37,21 +37,21 @@ exception statement from your version. */
package java.io;
-// NOTE: This implementation is very similar to that of PipedReader. If you
-// fix a bug in here, chances are you should make a similar change to the
+// NOTE: This implementation is very similar to that of PipedReader. If you
+// fix a bug in here, chances are you should make a similar change to the
// PipedReader code.
/**
* An input stream that reads its bytes from an output stream
- * to which it is connected.
+ * to which it is connected.
* <p>
* Data is read and written to an internal buffer. It is highly recommended
- * that the <code>PipedInputStream</code> and connected
+ * that the <code>PipedInputStream</code> and connected
* <code>PipedOutputStream</code>
- * be part of different threads. If they are not, the read and write
+ * be part of different threads. If they are not, the read and write
* operations could deadlock their thread.
*
- * @specnote The JDK implementation appears to have some undocumented
+ * @specnote The JDK implementation appears to have some undocumented
* functionality where it keeps track of what thread is writing
* to pipe and throws an IOException if that thread susequently
* dies. This behaviour seems dubious and unreliable - we don't
@@ -61,7 +61,7 @@ package java.io;
*/
public class PipedInputStream extends InputStream
{
- /** PipedOutputStream to which this is connected. Null only if this
+ /** PipedOutputStream to which this is connected. Null only if this
* InputStream hasn't been connected yet. */
PipedOutputStream source;
@@ -86,7 +86,7 @@ public class PipedInputStream extends InputStream
/**
* The index into buffer where the next byte from the connected
- * <code>PipedOutputStream</code> will be written. If this variable is
+ * <code>PipedOutputStream</code> will be written. If this variable is
* equal to <code>out</code>, then the buffer is full. If set to < 0,
* the buffer is empty.
*/
@@ -101,8 +101,8 @@ public class PipedInputStream extends InputStream
private byte[] read_buf = new byte[1];
/**
- * Creates a new <code>PipedInputStream</code> that is not connected to a
- * <code>PipedOutputStream</code>. It must be connected before bytes can
+ * Creates a new <code>PipedInputStream</code> that is not connected to a
+ * <code>PipedOutputStream</code>. It must be connected before bytes can
* be read from this stream.
*/
public PipedInputStream()
@@ -114,24 +114,24 @@ public class PipedInputStream extends InputStream
* Creates a new <code>PipedInputStream</code> of the given size that is not
* connected to a <code>PipedOutputStream</code>.
* It must be connected before bytes can be read from this stream.
- *
+ *
* @since 1.6
* @since IllegalArgumentException If pipeSize <= 0.
*/
- public PipedInputStream(int pipeSize) throws IllegalArgumentException
+ public PipedInputStream(int pipeSize) throws IllegalArgumentException
{
if (pipeSize <= 0)
throw new IllegalArgumentException("pipeSize must be > 0");
-
+
this.buffer = new byte[pipeSize];
}
-
+
/**
* This constructor creates a new <code>PipedInputStream</code> and connects
- * it to the passed in <code>PipedOutputStream</code>. The stream is then
+ * it to the passed in <code>PipedOutputStream</code>. The stream is then
* ready for reading.
*
- * @param source The <code>PipedOutputStream</code> to connect this
+ * @param source The <code>PipedOutputStream</code> to connect this
* stream to
*
* @exception IOException If <code>source</code> is already connected.
@@ -147,7 +147,7 @@ public class PipedInputStream extends InputStream
* size and connects it to the passed in <code>PipedOutputStream</code>.
* The stream is then ready for reading.
*
- * @param source The <code>PipedOutputStream</code> to connect this
+ * @param source The <code>PipedOutputStream</code> to connect this
* stream to
*
* @since 1.6
@@ -159,30 +159,30 @@ public class PipedInputStream extends InputStream
this(pipeSize);
connect(source);
}
-
+
/**
- * This method connects this stream to the passed in
+ * This method connects this stream to the passed in
* <code>PipedOutputStream</code>.
* This stream is then ready for reading. If this stream is already
* connected or has been previously closed, then an exception is thrown
*
* @param source The <code>PipedOutputStream</code> to connect this stream to
*
- * @exception IOException If this PipedInputStream or <code>source</code>
+ * @exception IOException If this PipedInputStream or <code>source</code>
* has been connected already.
*/
public void connect(PipedOutputStream source) throws IOException
{
- // The JDK (1.3) does not appear to check for a previously closed
+ // The JDK (1.3) does not appear to check for a previously closed
// connection here.
-
+
if (this.source != null || source.sink != null)
throw new IOException ("Already connected");
-
+
source.sink = this;
this.source = source;
}
-
+
/**
* This method receives a byte of input from the source PipedOutputStream.
* If the internal circular buffer is full, this method blocks.
@@ -210,7 +210,7 @@ public class PipedInputStream extends InputStream
* @specnote This code should be in PipedOutputStream.write, but we
* put it here in order to support that bizarre recieve(int)
* method.
- */
+ */
synchronized void receive(byte[] buf, int offset, int len)
throws IOException
{
@@ -219,59 +219,59 @@ public class PipedInputStream extends InputStream
int bufpos = offset;
int copylen;
-
+
while (len > 0)
{
try
- {
- while (in == out)
- {
- // The pipe is full. Wake up any readers and wait for them.
- notifyAll();
- wait();
- // The pipe could have been closed while we were waiting.
- if (closed)
- throw new IOException ("Pipe closed");
- }
- }
- catch (InterruptedException ix)
- {
+ {
+ while (in == out)
+ {
+ // The pipe is full. Wake up any readers and wait for them.
+ notifyAll();
+ wait();
+ // The pipe could have been closed while we were waiting.
+ if (closed)
+ throw new IOException ("Pipe closed");
+ }
+ }
+ catch (InterruptedException ix)
+ {
throw new InterruptedIOException ();
- }
-
- if (in < 0) // The pipe is empty.
- in = 0;
-
- // Figure out how many bytes from buf can be copied without
- // overrunning out or going past the length of the buffer.
- if (in < out)
- copylen = Math.min (len, out - in);
- else
- copylen = Math.min (len, buffer.length - in);
-
- // Copy bytes until the pipe is filled, wrapping if necessary.
- System.arraycopy(buf, bufpos, buffer, in, copylen);
- len -= copylen;
- bufpos += copylen;
- in += copylen;
- if (in == buffer.length)
- in = 0;
+ }
+
+ if (in < 0) // The pipe is empty.
+ in = 0;
+
+ // Figure out how many bytes from buf can be copied without
+ // overrunning out or going past the length of the buffer.
+ if (in < out)
+ copylen = Math.min (len, out - in);
+ else
+ copylen = Math.min (len, buffer.length - in);
+
+ // Copy bytes until the pipe is filled, wrapping if necessary.
+ System.arraycopy(buf, bufpos, buffer, in, copylen);
+ len -= copylen;
+ bufpos += copylen;
+ in += copylen;
+ if (in == buffer.length)
+ in = 0;
}
// Notify readers that new data is in the pipe.
notifyAll();
}
-
+
/**
* This method reads one byte from the stream.
* -1 is returned to indicated that no bytes can be read
* because the end of the stream was reached. If the stream is already
* closed, a -1 will again be returned to indicate the end of the stream.
- *
+ *
* <p>This method will block if no byte is available to be read.</p>
*
* @return the value of the read byte value, or -1 of the end of the stream
* was reached
- *
+ *
* @throws IOException if an error occured
*/
public int read() throws IOException
@@ -285,14 +285,14 @@ public class PipedInputStream extends InputStream
int r = read(read_buf, 0, 1);
return r != -1 ? (read_buf[0] & 0xff) : -1;
}
-
+
/**
* This method reads bytes from the stream into a caller supplied buffer.
- * It starts storing bytes at position <code>offset</code> into the
+ * It starts storing bytes at position <code>offset</code> into the
* buffer and
- * reads a maximum of <code>len</code> bytes. Note that this method
+ * reads a maximum of <code>len</code> bytes. Note that this method
* can actually
- * read fewer than <code>len</code> bytes. The actual number of bytes
+ * read fewer than <code>len</code> bytes. The actual number of bytes
* read is
* returned. A -1 is returned to indicated that no bytes can be read
* because the end of the stream was reached - ie close() was called on the
@@ -306,7 +306,7 @@ public class PipedInputStream extends InputStream
*
* @exception IOException If <code>close()</code> was called on this Piped
* InputStream.
- */
+ */
public synchronized int read(byte[] buf, int offset, int len)
throws IOException
{
@@ -319,61 +319,61 @@ public class PipedInputStream extends InputStream
if (len == 0)
return 0;
- // If the buffer is empty, wait until there is something in the pipe
+ // If the buffer is empty, wait until there is something in the pipe
// to read.
try
{
- while (in < 0)
- {
- if (source.closed)
- return -1;
- wait();
- }
+ while (in < 0)
+ {
+ if (source.closed)
+ return -1;
+ wait();
+ }
}
catch (InterruptedException ix)
{
throw new InterruptedIOException();
}
-
+
int total = 0;
int copylen;
-
+
while (true)
{
- // Figure out how many bytes from the pipe can be copied without
- // overrunning in or going past the length of buf.
- if (out < in)
- copylen = Math.min (len, in - out);
- else
- copylen = Math.min (len, buffer.length - out);
+ // Figure out how many bytes from the pipe can be copied without
+ // overrunning in or going past the length of buf.
+ if (out < in)
+ copylen = Math.min (len, in - out);
+ else
+ copylen = Math.min (len, buffer.length - out);
System.arraycopy (buffer, out, buf, offset, copylen);
- offset += copylen;
- len -= copylen;
- out += copylen;
- total += copylen;
-
- if (out == buffer.length)
- out = 0;
-
- if (out == in)
- {
- // Pipe is now empty.
- in = -1;
- out = 0;
- }
+ offset += copylen;
+ len -= copylen;
+ out += copylen;
+ total += copylen;
+
+ if (out == buffer.length)
+ out = 0;
+
+ if (out == in)
+ {
+ // Pipe is now empty.
+ in = -1;
+ out = 0;
+ }
// If output buffer is filled or the pipe is empty, we're done.
- if (len == 0 || in == -1)
- {
- // Notify any waiting outputstream that there is now space
- // to write.
- notifyAll();
- return total;
- }
+ if (len == 0 || in == -1)
+ {
+ // Notify any waiting outputstream that there is now space
+ // to write.
+ notifyAll();
+ return total;
+ }
}
}
-
+
/**
* This method returns the number of bytes that can be read from this stream
* before blocking could occur. This is the number of bytes that are
@@ -384,12 +384,12 @@ public class PipedInputStream extends InputStream
* @return The number of bytes that can be read before blocking might occur
*
* @exception IOException If an error occurs
- */
+ */
public synchronized int available() throws IOException
{
- // The JDK 1.3 implementation does not appear to check for the closed or
+ // The JDK 1.3 implementation does not appear to check for the closed or
// unconnected stream conditions here.
-
+
if (in < 0)
return 0;
else if (out < in)
@@ -397,7 +397,7 @@ public class PipedInputStream extends InputStream
else
return (buffer.length - out) + in;
}
-
+
/**
* This methods closes the stream so that no more data can be read
* from it.
@@ -411,4 +411,3 @@ public class PipedInputStream extends InputStream
notifyAll();
}
}
-
diff --git a/java/io/PipedOutputStream.java b/java/io/PipedOutputStream.java
index 81881050d..839cb1e22 100644
--- a/java/io/PipedOutputStream.java
+++ b/java/io/PipedOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -38,16 +38,16 @@ exception statement from your version. */
package java.io;
-// NOTE: This implementation is very similar to that of PipedWriter. If you
-// fix a bug in here, chances are you should make a similar change to the
+// NOTE: This implementation is very similar to that of PipedWriter. If you
+// fix a bug in here, chances are you should make a similar change to the
// PipedWriter code.
/**
- * This class writes its bytes to a <code>PipedInputStream</code> to
+ * This class writes its bytes to a <code>PipedInputStream</code> to
* which it is connected.
* <p>
* It is highly recommended that a <code>PipedOutputStream</code> and its
- * connected <code>PipedInputStream</code> be in different threads. If
+ * connected <code>PipedInputStream</code> be in different threads. If
* they are in the same thread, read and write operations could deadlock
* the thread.
*
@@ -55,14 +55,14 @@ package java.io;
*/
public class PipedOutputStream extends OutputStream
{
- /** Target PipedInputStream to which this is connected. Null only if this
+ /** Target PipedInputStream to which this is connected. Null only if this
* OutputStream hasn't been connected yet. */
PipedInputStream sink;
-
+
/** Set to true if close() has been called on this OutputStream. */
boolean closed;
-
- /**
+
+ /**
* Create an unconnected PipedOutputStream. It must be connected
* to a <code>PipedInputStream</code> using the <code>connect</code>
* method prior to writing any data or an exception will be thrown.
@@ -78,7 +78,7 @@ public class PipedOutputStream extends OutputStream
*
* @param sink The <code>PipedInputStream</code> to connect this stream to.
*
- * @exception IOException If <code>sink</code> has already been connected
+ * @exception IOException If <code>sink</code> has already been connected
* to a different PipedOutputStream.
*/
public PipedOutputStream(PipedInputStream sink) throws IOException
@@ -87,7 +87,7 @@ public class PipedOutputStream extends OutputStream
}
/**
- * Connects this object to the specified <code>PipedInputStream</code>
+ * Connects this object to the specified <code>PipedInputStream</code>
* object. This stream will then be ready for writing.
*
* @param sink The <code>PipedInputStream</code> to connect this stream to
@@ -103,29 +103,29 @@ public class PipedOutputStream extends OutputStream
}
/**
- * Write a single byte of date to the stream. Note that this method will
- * block if the <code>PipedInputStream</code> to which this object is
+ * Write a single byte of date to the stream. Note that this method will
+ * block if the <code>PipedInputStream</code> to which this object is
* connected has a full buffer.
*
* @param b The byte of data to be written, passed as an <code>int</code>.
*
* @exception IOException If the stream has not been connected or has
* been closed.
- */
+ */
public void write(int b) throws IOException
{
if (sink == null)
throw new IOException ("Not connected");
if (closed)
throw new IOException ("Pipe closed");
-
+
sink.receive (b);
}
-
+
/**
* This method writes <code>len</code> bytes of data from the byte array
* <code>buf</code> starting at index <code>offset</code> in the array
- * to the stream. Note that this method will block if the
+ * to the stream. Note that this method will block if the
* <code>PipedInputStream</code> to which this object is connected has
* a buffer that cannot hold all of the bytes to be written.
*
@@ -142,7 +142,7 @@ public class PipedOutputStream extends OutputStream
throw new IOException ("Not connected");
if (closed)
throw new IOException ("Pipe closed");
-
+
sink.receive(buffer, offset, len);
}
@@ -157,7 +157,7 @@ public class PipedOutputStream extends OutputStream
public void flush() throws IOException
{
}
-
+
/**
* This method closes this stream so that no more data can be written
* to it. Any further attempts to write to this stream may throw an
@@ -170,12 +170,12 @@ public class PipedOutputStream extends OutputStream
// A close call on an unconnected PipedOutputStream has no effect.
if (sink != null)
{
- closed = true;
- // Notify any waiting readers that the stream is now closed.
- synchronized (sink)
- {
- sink.notifyAll();
- }
+ closed = true;
+ // Notify any waiting readers that the stream is now closed.
+ synchronized (sink)
+ {
+ sink.notifyAll();
+ }
}
}
}
diff --git a/java/io/PipedReader.java b/java/io/PipedReader.java
index 8a3363a60..4f449ffce 100644
--- a/java/io/PipedReader.java
+++ b/java/io/PipedReader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -37,20 +37,20 @@ exception statement from your version. */
package java.io;
-// NOTE: This implementation is very similar to that of PipedInputStream.
-// If you fix a bug in here, chances are you should make a similar change to
+// NOTE: This implementation is very similar to that of PipedInputStream.
+// If you fix a bug in here, chances are you should make a similar change to
// the PipedInputStream code.
/**
- * An input stream that reads characters from a piped writer to which it is
- * connected.
+ * An input stream that reads characters from a piped writer to which it is
+ * connected.
* <p>
* Data is read and written to an internal buffer. It is highly recommended
* that the <code>PipedReader</code> and connected <code>PipedWriter</code>
* be part of different threads. If they are not, there is a possibility
* that the read and write operations could deadlock their thread.
*
- * @specnote The JDK implementation appears to have some undocumented
+ * @specnote The JDK implementation appears to have some undocumented
* functionality where it keeps track of what thread is writing
* to pipe and throws an IOException if that thread susequently
* dies. This behaviour seems dubious and unreliable - we don't
@@ -60,7 +60,7 @@ package java.io;
*/
public class PipedReader extends Reader
{
- /** PipedWriter to which this is connected. Null only if this
+ /** PipedWriter to which this is connected. Null only if this
* Reader hasn't been connected yet. */
PipedWriter source;
@@ -80,7 +80,7 @@ public class PipedReader extends Reader
/**
* The index into buffer where the next char from the connected
- * <code>PipedWriter</code> will be written. If this variable is
+ * <code>PipedWriter</code> will be written. If this variable is
* equal to <code>out</code>, then the buffer is full. If set to < 0,
* the buffer is empty.
*/
@@ -95,8 +95,8 @@ public class PipedReader extends Reader
char[] read_buf = new char[1];
/**
- * Creates a new <code>PipedReader</code> that is not connected to a
- * <code>PipedWriter</code>. It must be connected before chars can
+ * Creates a new <code>PipedReader</code> that is not connected to a
+ * <code>PipedWriter</code>. It must be connected before chars can
* be read from this stream.
*/
public PipedReader()
@@ -105,7 +105,7 @@ public class PipedReader extends Reader
/**
* This constructor creates a new <code>PipedReader</code> and connects
- * it to the passed in <code>PipedWriter</code>. The stream is then
+ * it to the passed in <code>PipedWriter</code>. The stream is then
* ready for reading.
*
* @param source The <code>PipedWriter</code> to connect this stream to
@@ -118,28 +118,28 @@ public class PipedReader extends Reader
}
/**
- * This method connects this stream to the passed in
+ * This method connects this stream to the passed in
* <code>PipedWriter</code>.
* This stream is then ready for reading. If this stream is already
* connected or has been previously closed, then an exception is thrown
*
* @param source The <code>PipedWriter</code> to connect this stream to
*
- * @exception IOException If this PipedReader or <code>source</code>
+ * @exception IOException If this PipedReader or <code>source</code>
* has been connected already.
*/
public void connect(PipedWriter source) throws IOException
{
- // The JDK (1.3) does not appear to check for a previously closed
+ // The JDK (1.3) does not appear to check for a previously closed
// connection here.
-
+
if (this.source != null || source.sink != null)
throw new IOException ("Already connected");
-
+
source.sink = this;
this.source = source;
}
-
+
/**
* This method is used by the connected <code>PipedWriter</code> to
* write chars into the buffer.
@@ -152,67 +152,67 @@ public class PipedReader extends Reader
* @specnote This code should be in PipedWriter.write, but we
* put it here in order to support that bizarre recieve(int)
* method.
- */
+ */
void receive(char[] buf, int offset, int len)
throws IOException
{
synchronized (lock)
{
if (closed)
- throw new IOException ("Pipe closed");
+ throw new IOException ("Pipe closed");
int bufpos = offset;
int copylen;
while (len > 0)
- {
+ {
try
- {
- while (in == out)
- {
- // The pipe is full. Wake up any readers and wait for them.
- lock.notifyAll();
- lock.wait();
- // The pipe could have been closed while we were waiting.
- if (closed)
- throw new IOException ("Pipe closed");
- }
- }
- catch (InterruptedException ix)
- {
+ {
+ while (in == out)
+ {
+ // The pipe is full. Wake up any readers and wait for them.
+ lock.notifyAll();
+ lock.wait();
+ // The pipe could have been closed while we were waiting.
+ if (closed)
+ throw new IOException ("Pipe closed");
+ }
+ }
+ catch (InterruptedException ix)
+ {
throw new InterruptedIOException ();
- }
-
- if (in < 0) // The pipe is empty.
- in = 0;
-
- // Figure out how many chars from buf can be copied without
- // overrunning out or going past the length of the buffer.
- if (in < out)
- copylen = Math.min (len, out - in);
- else
- copylen = Math.min (len, buffer.length - in);
-
- // Copy chars until the pipe is filled, wrapping if necessary.
- System.arraycopy(buf, bufpos, buffer, in, copylen);
- len -= copylen;
- bufpos += copylen;
- in += copylen;
- if (in == buffer.length)
- in = 0;
- }
+ }
+
+ if (in < 0) // The pipe is empty.
+ in = 0;
+
+ // Figure out how many chars from buf can be copied without
+ // overrunning out or going past the length of the buffer.
+ if (in < out)
+ copylen = Math.min (len, out - in);
+ else
+ copylen = Math.min (len, buffer.length - in);
+
+ // Copy chars until the pipe is filled, wrapping if necessary.
+ System.arraycopy(buf, bufpos, buffer, in, copylen);
+ len -= copylen;
+ bufpos += copylen;
+ in += copylen;
+ if (in == buffer.length)
+ in = 0;
+ }
// Notify readers that new data is in the pipe.
lock.notifyAll();
}
}
-
+
/**
* This method reads chars from the stream into a caller supplied buffer.
- * It starts storing chars at position <code>offset</code> into the
+ * It starts storing chars at position <code>offset</code> into the
* buffer and
- * reads a maximum of <code>len</code> chars. Note that this method
+ * reads a maximum of <code>len</code> chars. Note that this method
* can actually
- * read fewer than <code>len</code> chars. The actual number of chars
+ * read fewer than <code>len</code> chars. The actual number of chars
* read is
* returned. A -1 is returned to indicated that no chars can be read
* because the end of the stream was reached. If the stream is already
@@ -231,12 +231,12 @@ public class PipedReader extends Reader
int r = read(read_buf, 0, 1);
return r != -1 ? read_buf[0] : -1;
}
-
+
/**
- * This method reads characters from the stream into a caller supplied
- * buffer. It starts storing chars at position <code>offset</code> into
- * the buffer and reads a maximum of <code>len</code> chars. Note that
- * this method can actually read fewer than <code>len</code> chars.
+ * This method reads characters from the stream into a caller supplied
+ * buffer. It starts storing chars at position <code>offset</code> into
+ * the buffer and reads a maximum of <code>len</code> chars. Note that
+ * this method can actually read fewer than <code>len</code> chars.
* The actual number of chars read is
* returned. A -1 is returned to indicated that no chars can be read
* because the end of the stream was reached - ie close() was called on the
@@ -250,102 +250,102 @@ public class PipedReader extends Reader
*
* @exception IOException If <code>close()</code> was called on this Piped
* Reader.
- */
+ */
public int read(char[] buf, int offset, int len)
throws IOException
{
synchronized (lock)
{
if (source == null)
- throw new IOException ("Not connected");
+ throw new IOException ("Not connected");
if (closed)
- throw new IOException ("Pipe closed");
+ throw new IOException ("Pipe closed");
// Don't block if nothing was requested.
if (len == 0)
return 0;
- // If the buffer is empty, wait until there is something in the pipe
+ // If the buffer is empty, wait until there is something in the pipe
// to read.
try
- {
- while (in < 0)
- {
- if (source.closed)
- return -1;
- lock.wait();
- }
- }
+ {
+ while (in < 0)
+ {
+ if (source.closed)
+ return -1;
+ lock.wait();
+ }
+ }
catch (InterruptedException ix)
- {
+ {
throw new InterruptedIOException();
- }
+ }
int total = 0;
int copylen;
while (true)
- {
- // Figure out how many chars from the pipe can be copied without
- // overrunning in or going past the length of buf.
- if (out < in)
- copylen = Math.min (len, in - out);
- else
- copylen = Math.min (len, buffer.length - out);
+ {
+ // Figure out how many chars from the pipe can be copied without
+ // overrunning in or going past the length of buf.
+ if (out < in)
+ copylen = Math.min (len, in - out);
+ else
+ copylen = Math.min (len, buffer.length - out);
System.arraycopy (buffer, out, buf, offset, copylen);
- offset += copylen;
- len -= copylen;
- out += copylen;
- total += copylen;
+ offset += copylen;
+ len -= copylen;
+ out += copylen;
+ total += copylen;
- if (out == buffer.length)
- out = 0;
+ if (out == buffer.length)
+ out = 0;
- if (out == in)
- {
- // Pipe is now empty.
- in = -1;
- out = 0;
- }
+ if (out == in)
+ {
+ // Pipe is now empty.
+ in = -1;
+ out = 0;
+ }
// If output buffer is filled or the pipe is empty, we're done.
- if (len == 0 || in == -1)
- {
- // Notify any waiting Writer that there is now space
- // to write.
- lock.notifyAll();
- return total;
- }
- }
+ if (len == 0 || in == -1)
+ {
+ // Notify any waiting Writer that there is now space
+ // to write.
+ lock.notifyAll();
+ return total;
+ }
+ }
}
}
-
+
public boolean ready() throws IOException
{
- // The JDK 1.3 implementation does not appear to check for the closed or
+ // The JDK 1.3 implementation does not appear to check for the closed or
// unconnected stream conditions here. However, checking for a
// closed stream is explicitly required by the JDK 1.2 and 1.3
// documentation (for Reader.close()), so we do it.
-
+
synchronized (lock)
{
if (closed)
- throw new IOException("Pipe closed");
+ throw new IOException("Pipe closed");
if (in < 0)
- return false;
+ return false;
int count;
if (out < in)
- count = in - out;
+ count = in - out;
else
- count = (buffer.length - out) - in;
+ count = (buffer.length - out) - in;
return (count > 0);
}
}
-
+
/**
* This methods closes the stream so that no more data can be read
* from it.
@@ -362,4 +362,3 @@ public class PipedReader extends Reader
}
}
}
-
diff --git a/java/io/PipedWriter.java b/java/io/PipedWriter.java
index 92786e5de..0d48ab0e4 100644
--- a/java/io/PipedWriter.java
+++ b/java/io/PipedWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -38,16 +38,16 @@ exception statement from your version. */
package java.io;
-// NOTE: This implementation is very similar to that of PipedOutputStream.
-// If you fix a bug in here, chances are you should make a similar change to
+// NOTE: This implementation is very similar to that of PipedOutputStream.
+// If you fix a bug in here, chances are you should make a similar change to
// the PipedOutputStream code.
/**
- * This class writes its chars to a <code>PipedReader</code> to
+ * This class writes its chars to a <code>PipedReader</code> to
* which it is connected.
* <p>
* It is highly recommended that a <code>PipedWriter</code> and its
- * connected <code>PipedReader</code> be in different threads. If
+ * connected <code>PipedReader</code> be in different threads. If
* they are in the same thread, read and write operations could deadlock
* the thread.
*
@@ -55,17 +55,17 @@ package java.io;
*/
public class PipedWriter extends Writer
{
- /** Target PipedReader to which this is connected. Null only if this
+ /** Target PipedReader to which this is connected. Null only if this
* Writer hasn't been connected yet. */
PipedReader sink;
-
+
/** Set to true if close() has been called on this Writer. */
boolean closed;
/** Buffer used to implement single-argument write */
char[] read_buf = new char[1];
-
- /**
+
+ /**
* Create an unconnected PipedWriter. It must be connected
* to a <code>PipedReader</code> using the <code>connect</code>
* method prior to writing any data or an exception will be thrown.
@@ -81,7 +81,7 @@ public class PipedWriter extends Writer
*
* @param sink The <code>PipedReader</code> to connect this stream to.
*
- * @exception IOException If <code>sink</code> has already been connected
+ * @exception IOException If <code>sink</code> has already been connected
* to a different PipedWriter.
*/
public PipedWriter(PipedReader sink) throws IOException
@@ -90,7 +90,7 @@ public class PipedWriter extends Writer
}
/**
- * Connects this object to the specified <code>PipedReader</code>
+ * Connects this object to the specified <code>PipedReader</code>
* object. This stream will then be ready for writing.
*
* @param sink The <code>PipedReader</code> to connect this stream to
@@ -106,25 +106,25 @@ public class PipedWriter extends Writer
}
/**
- * Write a single char of date to the stream. Note that this method will
- * block if the <code>PipedReader</code> to which this object is
+ * Write a single char of date to the stream. Note that this method will
+ * block if the <code>PipedReader</code> to which this object is
* connected has a full buffer.
*
* @param b The char of data to be written, passed as an <code>int</code>.
*
* @exception IOException If the stream has not been connected or has
* been closed.
- */
+ */
public void write(int b) throws IOException
{
read_buf[0] = (char) (b & 0xffff);
sink.receive (read_buf, 0, 1);
}
-
+
/**
* This method writes <code>len</code> chars of data from the char array
* <code>buf</code> starting at index <code>offset</code> in the array
- * to the stream. Note that this method will block if the
+ * to the stream. Note that this method will block if the
* <code>PipedReader</code> to which this object is connected has
* a buffer that cannot hold all of the chars to be written.
*
@@ -141,7 +141,7 @@ public class PipedWriter extends Writer
throw new IOException ("Not connected");
if (closed)
throw new IOException ("Pipe closed");
-
+
sink.receive(buffer, offset, len);
}
@@ -158,7 +158,7 @@ public class PipedWriter extends Writer
if (closed)
throw new IOException ("Pipe closed");
}
-
+
/**
* This method closes this stream so that no more data can be written
* to it. Any further attempts to write to this stream may throw an
@@ -171,12 +171,12 @@ public class PipedWriter extends Writer
// A close call on an unconnected PipedWriter has no effect.
if (sink != null)
{
- closed = true;
- // Notify any waiting readers that the stream is now closed.
- synchronized (sink)
- {
- sink.notifyAll();
- }
+ closed = true;
+ // Notify any waiting readers that the stream is now closed.
+ synchronized (sink)
+ {
+ sink.notifyAll();
+ }
}
}
}
diff --git a/java/io/PrintStream.java b/java/io/PrintStream.java
index 9347ac397..eaab7c3d4 100644
--- a/java/io/PrintStream.java
+++ b/java/io/PrintStream.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -53,7 +53,7 @@ import gnu.classpath.SystemProperties;
* This class prints Java primitive values and object to a stream as
* text. None of the methods in this class throw an exception. However,
* errors can be detected by calling the <code>checkError()</code> method.
- * Additionally, this stream can be designated as "autoflush" when
+ * Additionally, this stream can be designated as "autoflush" when
* created so that any writes are automatically flushed to the underlying
* output sink when the current line is terminated.
* <p>
@@ -85,7 +85,7 @@ public class PrintStream extends FilterOutputStream implements Appendable
private boolean error_occurred = false;
/**
- * This is <code>true</code> if auto-flush is enabled,
+ * This is <code>true</code> if auto-flush is enabled,
* <code>false</code> otherwise
*/
private final boolean auto_flush;
@@ -173,13 +173,13 @@ public class PrintStream extends FilterOutputStream implements Appendable
* This method initializes a new <code>PrintStream</code> object to write
* to the specified output sink. This constructor also allows "auto-flush"
* functionality to be specified where the stream will be flushed after
- * every <code>print</code> or <code>println</code> call, when the
- * <code>write</code> methods with array arguments are called, or when a
+ * every <code>print</code> or <code>println</code> call, when the
+ * <code>write</code> methods with array arguments are called, or when a
* single new-line character is written.
* <p>
*
* @param out The <code>OutputStream</code> to write to.
- * @param auto_flush <code>true</code> to flush the stream after every
+ * @param auto_flush <code>true</code> to flush the stream after every
* line, <code>false</code> otherwise
*/
public PrintStream (OutputStream out, boolean auto_flush)
@@ -187,13 +187,13 @@ public class PrintStream extends FilterOutputStream implements Appendable
super (out);
String encoding;
try {
- encoding = SystemProperties.getProperty("file.encoding");
+ encoding = SystemProperties.getProperty("file.encoding");
} catch (SecurityException e){
- encoding = "ISO8859_1";
+ encoding = "ISO8859_1";
} catch (IllegalArgumentException e){
- encoding = "ISO8859_1";
+ encoding = "ISO8859_1";
} catch (NullPointerException e){
- encoding = "ISO8859_1";
+ encoding = "ISO8859_1";
}
this.encoding = encoding;
this.auto_flush = auto_flush;
@@ -203,13 +203,13 @@ public class PrintStream extends FilterOutputStream implements Appendable
* This method initializes a new <code>PrintStream</code> object to write
* to the specified output sink. This constructor also allows "auto-flush"
* functionality to be specified where the stream will be flushed after
- * every <code>print</code> or <code>println</code> call, when the
- * <code>write</code> methods with array arguments are called, or when a
+ * every <code>print</code> or <code>println</code> call, when the
+ * <code>write</code> methods with array arguments are called, or when a
* single new-line character is written.
* <p>
*
* @param out The <code>OutputStream</code> to write to.
- * @param auto_flush <code>true</code> to flush the stream after every
+ * @param auto_flush <code>true</code> to flush the stream after every
* line, <code>false</code> otherwise
* @param encoding The name of the character encoding to use for this
* object.
@@ -230,7 +230,7 @@ public class PrintStream extends FilterOutputStream implements Appendable
* <code>true</code> forever for this stream. Before checking for an
* error condition, this method flushes the stream.
*
- * @return <code>true</code> if an error has occurred,
+ * @return <code>true</code> if an error has occurred,
* <code>false</code> otherwise
*/
public boolean checkError ()
@@ -255,16 +255,16 @@ public class PrintStream extends FilterOutputStream implements Appendable
{
try
{
- flush();
- out.close();
+ flush();
+ out.close();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread().interrupt();
+ Thread.currentThread().interrupt();
}
catch (IOException e)
{
- setError ();
+ setError ();
}
}
@@ -276,15 +276,15 @@ public class PrintStream extends FilterOutputStream implements Appendable
{
try
{
- out.flush();
+ out.flush();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread().interrupt();
+ Thread.currentThread().interrupt();
}
catch (IOException e)
{
- setError ();
+ setError ();
}
}
@@ -293,39 +293,39 @@ public class PrintStream extends FilterOutputStream implements Appendable
try
{
writeChars(str, 0, str.length());
- if (println)
- writeChars(line_separator, 0, line_separator.length);
- if (auto_flush)
- flush();
+ if (println)
+ writeChars(line_separator, 0, line_separator.length);
+ if (auto_flush)
+ flush();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread().interrupt();
+ Thread.currentThread().interrupt();
}
catch (IOException e)
{
- setError ();
+ setError ();
}
}
private synchronized void print (char[] chars, int pos, int len,
- boolean println)
+ boolean println)
{
try
{
writeChars(chars, pos, len);
- if (println)
- writeChars(line_separator, 0, line_separator.length);
- if (auto_flush)
- flush();
+ if (println)
+ writeChars(line_separator, 0, line_separator.length);
+ if (auto_flush)
+ flush();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread().interrupt();
+ Thread.currentThread().interrupt();
}
catch (IOException e)
{
- setError ();
+ setError ();
}
}
@@ -577,7 +577,7 @@ public class PrintStream extends FilterOutputStream implements Appendable
* This method writes a byte of data to the stream. If auto-flush is
* enabled, printing a newline character will cause the stream to be
* flushed after the character is written.
- *
+ *
* @param oneByte The byte to be written
*/
public void write (int oneByte)
@@ -585,13 +585,13 @@ public class PrintStream extends FilterOutputStream implements Appendable
try
{
out.write (oneByte & 0xff);
-
+
if (auto_flush && (oneByte == '\n'))
flush ();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread ().interrupt ();
+ Thread.currentThread ().interrupt ();
}
catch (IOException e)
{
@@ -612,13 +612,13 @@ public class PrintStream extends FilterOutputStream implements Appendable
try
{
out.write (buffer, offset, len);
-
+
if (auto_flush)
flush ();
}
catch (InterruptedIOException iioe)
{
- Thread.currentThread ().interrupt ();
+ Thread.currentThread ().interrupt ();
}
catch (IOException e)
{
diff --git a/java/io/PrintWriter.java b/java/io/PrintWriter.java
index 5b4294cba..a67a7f8aa 100644
--- a/java/io/PrintWriter.java
+++ b/java/io/PrintWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,7 +50,7 @@ import java.util.Formatter;
* This class prints Java primitive values and objects to a stream as
* text. None of the methods in this class throw an exception. However,
* errors can be detected by calling the <code>checkError()</code> method.
- * Additionally, this stream can be designated as "autoflush" when
+ * Additionally, this stream can be designated as "autoflush" when
* created so that any writes are automatically flushed to the underlying
* output sink whenever one of the <code>println</code> methods is
* called. (Note that this differs from the <code>PrintStream</code>
@@ -59,7 +59,7 @@ import java.util.Formatter;
*
* @author Per Bothner (bothner@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
- * @date April 17, 1998.
+ * @date April 17, 1998.
*/
public class PrintWriter extends Writer
{
@@ -73,7 +73,7 @@ public class PrintWriter extends Writer
* on this stream.
*/
private boolean error;
-
+
/**
* Indicates whether or not the stream has been closed.
*/
@@ -105,7 +105,7 @@ public class PrintWriter extends Writer
* every line is terminated or newline character is written.
*
* @param wr The <code>Writer</code> to write to.
- * @param autoflush <code>true</code> to flush the stream after every
+ * @param autoflush <code>true</code> to flush the stream after every
* line, <code>false</code> otherwise
*/
public PrintWriter(Writer wr, boolean autoflush)
@@ -133,11 +133,11 @@ public class PrintWriter extends Writer
/**
* This method initializes a new <code>PrintWriter</code> object to write
* to the specified <code>OutputStream</code>. Characters will be converted
- * to chars using the system default encoding. This form of the
+ * to chars using the system default encoding. This form of the
* constructor allows auto-flush functionality to be enabled if desired
*
* @param out The <code>OutputStream</code> to write to
- * @param autoflush <code>true</code> to flush the stream after every
+ * @param autoflush <code>true</code> to flush the stream after every
* <code>println</code> call, <code>false</code> otherwise.
*/
public PrintWriter(OutputStream out, boolean autoflush)
@@ -152,7 +152,7 @@ public class PrintWriter extends Writer
* OutputStreamWriter using the default encoding.
* @param file name of the file to write to
* @throws FileNotFoundException if the file cannot be written or created
- *
+ *
* @since 1.5
*/
public PrintWriter(String file) throws FileNotFoundException
@@ -168,10 +168,10 @@ public class PrintWriter extends Writer
* @param enc the encoding to use
* @throws FileNotFoundException if the file cannot be written or created
* @throws UnsupportedEncodingException if the encoding is not supported
- *
+ *
* @since 1.5
*/
- public PrintWriter(String file, String enc)
+ public PrintWriter(String file, String enc)
throws FileNotFoundException, UnsupportedEncodingException
{
this(new OutputStreamWriter(new FileOutputStream(file), enc));
@@ -183,7 +183,7 @@ public class PrintWriter extends Writer
* OutputStreamWriter using the default encoding.
* @param file the file to write to
* @throws FileNotFoundException if the file cannot be written or created
- *
+ *
* @since 1.5
*/
public PrintWriter(File file) throws FileNotFoundException
@@ -199,10 +199,10 @@ public class PrintWriter extends Writer
* @param enc the encoding to use
* @throws FileNotFoundException if the file cannot be written or created
* @throws UnsupportedEncodingException if the encoding is not supported
- *
+ *
* @since 1.5
*/
- public PrintWriter(File file, String enc)
+ public PrintWriter(File file, String enc)
throws FileNotFoundException, UnsupportedEncodingException
{
this(new OutputStreamWriter(new FileOutputStream(file), enc));
@@ -223,7 +223,7 @@ public class PrintWriter extends Writer
* <code>true</code> forever for this stream. Before checking for an
* error condition, this method flushes the stream.
*
- * @return <code>true</code> if an error has occurred,
+ * @return <code>true</code> if an error has occurred,
* <code>false</code> otherwise
*/
public boolean checkError()
@@ -241,11 +241,11 @@ public class PrintWriter extends Writer
{
try
{
- out.flush();
+ out.flush();
}
catch (IOException ex)
{
- error = true;
+ error = true;
}
}
@@ -261,7 +261,7 @@ public class PrintWriter extends Writer
}
catch (IOException ex)
{
- error = true;
+ error = true;
}
}
@@ -382,7 +382,7 @@ public class PrintWriter extends Writer
* This is the system dependent line separator
*/
private static final char[] line_separator
- = System.getProperty("line.separator", "\n").toCharArray();
+ = System.getProperty("line.separator", "\n").toCharArray();
/**
* This method prints a line separator sequence to the stream. The value
@@ -393,16 +393,16 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- try
- {
- write(line_separator, 0, line_separator.length);
- if (autoflush)
- out.flush();
- }
- catch (IOException ex)
- {
- error = true;
- }
+ try
+ {
+ write(line_separator, 0, line_separator.length);
+ if (autoflush)
+ out.flush();
+ }
+ catch (IOException ex)
+ {
+ error = true;
+ }
}
}
@@ -419,8 +419,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(bool);
- println();
+ print(bool);
+ println();
}
}
@@ -436,8 +436,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(inum);
- println();
+ print(inum);
+ println();
}
}
@@ -453,8 +453,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(lnum);
- println();
+ print(lnum);
+ println();
}
}
@@ -470,8 +470,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(fnum);
- println();
+ print(fnum);
+ println();
}
}
@@ -487,8 +487,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(dnum);
- println();
+ print(dnum);
+ println();
}
}
@@ -505,8 +505,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(obj);
- println();
+ print(obj);
+ println();
}
}
@@ -522,8 +522,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(str);
- println();
+ print(str);
+ println();
}
}
@@ -539,8 +539,8 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(ch);
- println();
+ print(ch);
+ println();
}
}
@@ -556,30 +556,30 @@ public class PrintWriter extends Writer
{
synchronized (lock)
{
- print(charArray);
- println();
+ print(charArray);
+ println();
}
}
/**
- * This method writes a single char to the stream.
- *
+ * This method writes a single char to the stream.
+ *
* @param ch The char to be written, passed as a int
*/
public void write(int ch)
{
try
{
- out.write(ch);
+ out.write(ch);
}
catch (IOException ex)
{
- error = true;
+ error = true;
}
}
/**
- * This method writes <code>count</code> chars from the specified array
+ * This method writes <code>count</code> chars from the specified array
* starting at index <code>offset</code> into the array.
*
* @param charArray The array of chars to write
@@ -590,11 +590,11 @@ public class PrintWriter extends Writer
{
try
{
- out.write(charArray, offset, count);
+ out.write(charArray, offset, count);
}
catch (IOException ex)
{
- error = true;
+ error = true;
}
}
@@ -611,11 +611,11 @@ public class PrintWriter extends Writer
{
try
{
- out.write(str, offset, count);
+ out.write(str, offset, count);
}
catch (IOException ex)
{
- error = true;
+ error = true;
}
}
@@ -627,7 +627,7 @@ public class PrintWriter extends Writer
public void write(char[] charArray)
{
write(charArray, 0, charArray.length);
- }
+ }
/**
* This method writes the contents of the specified <code>String</code>
@@ -638,7 +638,7 @@ public class PrintWriter extends Writer
public void write(String str)
{
write(str, 0, str.length());
- }
+ }
/** @since 1.5 */
public PrintWriter append(char c)
@@ -687,4 +687,3 @@ public class PrintWriter extends Writer
return this;
}
}
-
diff --git a/java/io/PushbackInputStream.java b/java/io/PushbackInputStream.java
index ff202c72d..62737870c 100644
--- a/java/io/PushbackInputStream.java
+++ b/java/io/PushbackInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -38,10 +38,10 @@ exception statement from your version. */
package java.io;
/**
- * This subclass of <code>FilterInputStream</code> provides the ability to
+ * This subclass of <code>FilterInputStream</code> provides the ability to
* unread data from a stream. It maintains an internal buffer of unread
* data that is supplied to the next read operation. This is conceptually
- * similar to mark/reset functionality, except that in this case the
+ * similar to mark/reset functionality, except that in this case the
* position to reset the stream to does not need to be known in advance.
* <p>
* The default pushback buffer size one byte, but this can be overridden
@@ -66,8 +66,8 @@ public class PushbackInputStream extends FilterInputStream
/**
* This is the position in the buffer from which the next byte will be
* read. Bytes are stored in reverse order in the buffer, starting from
- * <code>buf[buf.length - 1]</code> to <code>buf[0]</code>. Thus when
- * <code>pos</code> is 0 the buffer is full and <code>buf.length</code> when
+ * <code>buf[buf.length - 1]</code> to <code>buf[0]</code>. Thus when
+ * <code>pos</code> is 0 the buffer is full and <code>buf.length</code> when
* it is empty
*/
protected int pos;
@@ -107,7 +107,7 @@ public class PushbackInputStream extends FilterInputStream
* might (or might not) occur on the very next read attempt.
* <p>
* This method will return the number of bytes available from the
- * pushback buffer plus the number of bytes available from the
+ * pushback buffer plus the number of bytes available from the
* underlying stream.
*
* @return The number of bytes that can be read before blocking could occur
@@ -116,19 +116,19 @@ public class PushbackInputStream extends FilterInputStream
*/
public int available() throws IOException
{
- try
+ try
{
- return (buf.length - pos) + super.available();
- }
- catch (NullPointerException npe)
+ return (buf.length - pos) + super.available();
+ }
+ catch (NullPointerException npe)
{
- throw new IOException ("Stream closed");
+ throw new IOException ("Stream closed");
}
}
/**
* This method closes the stream and releases any associated resources.
- *
+ *
* @exception IOException If an error occurs.
*/
public synchronized void close() throws IOException
@@ -192,9 +192,9 @@ public class PushbackInputStream extends FilterInputStream
* <p>
* This method will block until some data can be read.
* <p>
- * This method first reads bytes from the pushback buffer in order to
+ * This method first reads bytes from the pushback buffer in order to
* satisfy the read request. If the pushback buffer cannot provide all
- * of the bytes requested, the remaining bytes are read from the
+ * of the bytes requested, the remaining bytes are read from the
* underlying stream.
*
* @param b The array into which the bytes read should be stored
@@ -211,18 +211,18 @@ public class PushbackInputStream extends FilterInputStream
if (numBytes > 0)
{
- System.arraycopy (buf, pos, b, off, numBytes);
- pos += numBytes;
- len -= numBytes;
- off += numBytes;
+ System.arraycopy (buf, pos, b, off, numBytes);
+ pos += numBytes;
+ len -= numBytes;
+ off += numBytes;
}
- if (len > 0)
+ if (len > 0)
{
len = super.read(b, off, len);
if (len == -1) //EOF
- return numBytes > 0 ? numBytes : -1;
- numBytes += len;
+ return numBytes > 0 ? numBytes : -1;
+ numBytes += len;
}
return numBytes;
}
@@ -250,7 +250,7 @@ public class PushbackInputStream extends FilterInputStream
}
/**
- * This method pushes all of the bytes in the passed byte array into
+ * This method pushes all of the bytes in the passed byte array into
* the pushback bfer. These bytes are pushed in reverse order so that
* the next byte read from the stream after this operation will be
* <code>b[0]</code> followed by <code>b[1]</code>, etc.
@@ -306,7 +306,7 @@ public class PushbackInputStream extends FilterInputStream
* requested amount.
* <p>
* This method first discards bytes from the buffer, then calls the
- * <code>skip</code> method on the underlying <code>InputStream</code> to
+ * <code>skip</code> method on the underlying <code>InputStream</code> to
* skip additional bytes if necessary.
*
* @param n The requested number of bytes to skip
@@ -323,11 +323,11 @@ public class PushbackInputStream extends FilterInputStream
if (n > 0L)
{
- int numread = (int) Math.min((long) (buf.length - pos), n);
- pos += numread;
- n -= numread;
- if (n > 0)
- n -= super.skip(n);
+ int numread = (int) Math.min((long) (buf.length - pos), n);
+ pos += numread;
+ n -= numread;
+ if (n > 0)
+ n -= super.skip(n);
}
return origN - n;
diff --git a/java/io/PushbackReader.java b/java/io/PushbackReader.java
index 04bccc70f..43bf826a8 100644
--- a/java/io/PushbackReader.java
+++ b/java/io/PushbackReader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,10 +39,10 @@ exception statement from your version. */
package java.io;
/**
- * This subclass of <code>FilterReader</code> provides the ability to
+ * This subclass of <code>FilterReader</code> provides the ability to
* unread data from a stream. It maintains an internal buffer of unread
* data that is supplied to the next read operation. This is conceptually
- * similar to mark/reset functionality, except that in this case the
+ * similar to mark/reset functionality, except that in this case the
* position to reset the stream to does not need to be known in advance.
* <p>
* The default pushback buffer size one char, but this can be overridden
@@ -66,15 +66,15 @@ public class PushbackReader extends FilterReader
/**
* This is the position in the buffer from which the next char will be
* read. Bytes are stored in reverse order in the buffer, starting from
- * <code>buf[buf.length - 1]</code> to <code>buf[0]</code>. Thus when
- * <code>pos</code> is 0 the buffer is full and <code>buf.length</code> when
+ * <code>buf[buf.length - 1]</code> to <code>buf[0]</code>. Thus when
+ * <code>pos</code> is 0 the buffer is full and <code>buf.length</code> when
* it is empty
*/
private int pos;
/**
* This method initializes a <code>PushbackReader</code> to read from the
- * specified subordinate <code>Reader</code> with a default pushback buffer
+ * specified subordinate <code>Reader</code> with a default pushback buffer
* size of 1.
*
* @param in The subordinate stream to read from
@@ -112,8 +112,8 @@ public class PushbackReader extends FilterReader
{
synchronized (lock)
{
- buf = null;
- super.close();
+ buf = null;
+ super.close();
}
}
@@ -134,7 +134,7 @@ public class PushbackReader extends FilterReader
* This method returns <code>false</code> to indicate that it does not support
* mark/reset functionality.
*
- * @return This method returns <code>false</code> to indicate that this
+ * @return This method returns <code>false</code> to indicate that this
* class does not support mark/reset functionality
*
*/
@@ -164,7 +164,7 @@ public class PushbackReader extends FilterReader
* read in the pushback buffer or if the underlying stream is ready to
* be read.
*
- * @return <code>true</code> if this stream is ready to be read,
+ * @return <code>true</code> if this stream is ready to be read,
* <code>false</code> otherwise
*
* @exception IOException If an error occurs
@@ -173,13 +173,13 @@ public class PushbackReader extends FilterReader
{
synchronized (lock)
{
- if (buf == null)
- throw new IOException ("stream closed");
+ if (buf == null)
+ throw new IOException ("stream closed");
- if (((buf.length - pos) > 0) || super.ready())
- return(true);
- else
- return(false);
+ if (((buf.length - pos) > 0) || super.ready())
+ return(true);
+ else
+ return(false);
}
}
@@ -191,7 +191,7 @@ public class PushbackReader extends FilterReader
* requested amount.
* <p>
* This method first discards chars from the buffer, then calls the
- * <code>skip</code> method on the underlying <code>Reader</code> to
+ * <code>skip</code> method on the underlying <code>Reader</code> to
* skip additional chars if necessary.
*
* @param num_chars The requested number of chars to skip
@@ -204,21 +204,21 @@ public class PushbackReader extends FilterReader
{
synchronized (lock)
{
- if (num_chars <= 0)
- return(0);
+ if (num_chars <= 0)
+ return(0);
- if ((buf.length - pos) >= num_chars)
- {
- pos += num_chars;
- return(num_chars);
- }
+ if ((buf.length - pos) >= num_chars)
+ {
+ pos += num_chars;
+ return(num_chars);
+ }
- int chars_discarded = buf.length - pos;
- pos = buf.length;
+ int chars_discarded = buf.length - pos;
+ pos = buf.length;
- long chars_skipped = in.skip(num_chars - chars_discarded);
+ long chars_skipped = in.skip(num_chars - chars_discarded);
- return(chars_discarded + chars_skipped);
+ return(chars_discarded + chars_skipped);
}
}
@@ -239,14 +239,14 @@ public class PushbackReader extends FilterReader
{
synchronized (lock)
{
- if (buf == null)
+ if (buf == null)
throw new IOException("stream closed");
- if (pos == buf.length)
- return(super.read());
+ if (pos == buf.length)
+ return(super.read());
- ++pos;
- return((buf[pos - 1] & 0xFFFF));
+ ++pos;
+ return((buf[pos - 1] & 0xFFFF));
}
}
@@ -261,9 +261,9 @@ public class PushbackReader extends FilterReader
* <p>
* This method will block until some data can be read.
* <p>
- * This method first reads chars from the pushback buffer in order to
+ * This method first reads chars from the pushback buffer in order to
* satisfy the read request. If the pushback buffer cannot provide all
- * of the chars requested, the remaining chars are read from the
+ * of the chars requested, the remaining chars are read from the
* underlying stream.
*
* @param buffer The array into which the chars read should be stored
@@ -279,21 +279,21 @@ public class PushbackReader extends FilterReader
{
synchronized (lock)
{
- if (buf == null)
+ if (buf == null)
throw new IOException("stream closed");
- if (offset < 0 || length < 0 || offset + length > buffer.length)
+ if (offset < 0 || length < 0 || offset + length > buffer.length)
throw new ArrayIndexOutOfBoundsException();
- int numBytes = Math.min(buf.length - pos, length);
- if (numBytes > 0)
- {
- System.arraycopy (buf, pos, buffer, offset, numBytes);
- pos += numBytes;
- return numBytes;
- }
+ int numBytes = Math.min(buf.length - pos, length);
+ if (numBytes > 0)
+ {
+ System.arraycopy (buf, pos, buffer, offset, numBytes);
+ pos += numBytes;
+ return numBytes;
+ }
- return super.read(buffer, offset, length);
+ return super.read(buffer, offset, length);
}
}
@@ -304,7 +304,7 @@ public class PushbackReader extends FilterReader
* <p>
* If the pushback buffer is full, this method throws an exception.
* <p>
- * The argument to this method is an <code>int</code>. Only the low eight
+ * The argument to this method is an <code>int</code>. Only the low eight
* bits of this value are pushed back.
*
* @param b The char to be pushed back, passed as an int
@@ -315,18 +315,18 @@ public class PushbackReader extends FilterReader
{
synchronized (lock)
{
- if (buf == null)
- throw new IOException("stream closed");
- if (pos == 0)
- throw new IOException("Pushback buffer is full");
+ if (buf == null)
+ throw new IOException("stream closed");
+ if (pos == 0)
+ throw new IOException("Pushback buffer is full");
- --pos;
- buf[pos] = (char)(b & 0xFFFF);
+ --pos;
+ buf[pos] = (char)(b & 0xFFFF);
}
}
/**
- * This method pushes all of the chars in the passed char array into
+ * This method pushes all of the chars in the passed char array into
* the pushback buffer. These chars are pushed in reverse order so that
* the next char read from the stream after this operation will be
* <code>buf[0]</code> followed by <code>buf[1]</code>, etc.
@@ -345,7 +345,7 @@ public class PushbackReader extends FilterReader
/**
* This method pushed back chars from the passed in array into the pushback
- * buffer. The chars from <code>buf[offset]</code> to
+ * buffer. The chars from <code>buf[offset]</code> to
* <code>buf[offset + len]</code>
* are pushed in reverse order so that the next char read from the stream
* after this operation will be <code>buf[offset]</code> followed by
@@ -365,20 +365,19 @@ public class PushbackReader extends FilterReader
{
synchronized (lock)
{
- if (buf == null)
+ if (buf == null)
throw new IOException("stream closed");
- if (pos < length)
- throw new IOException("Pushback buffer is full");
+ if (pos < length)
+ throw new IOException("Pushback buffer is full");
- // Note the order that these chars are being added is the opposite
- // of what would be done if they were added to the buffer one at a time.
- // See the Java Class Libraries book p. 1397.
- System.arraycopy(buffer, offset, buf, pos - length, length);
+ // Note the order that these chars are being added is the opposite
+ // of what would be done if they were added to the buffer one at a time.
+ // See the Java Class Libraries book p. 1397.
+ System.arraycopy(buffer, offset, buf, pos - length, length);
- // Don't put this into the arraycopy above, an exception might be thrown
- // and in that case we don't want to modify pos.
- pos -= length;
+ // Don't put this into the arraycopy above, an exception might be thrown
+ // and in that case we don't want to modify pos.
+ pos -= length;
}
}
}
-
diff --git a/java/io/RandomAccessFile.java b/java/io/RandomAccessFile.java
index 036fc8c6b..da0c81272 100644
--- a/java/io/RandomAccessFile.java
+++ b/java/io/RandomAccessFile.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -67,12 +67,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
// The corresponding input and output streams.
private DataOutputStream out;
private DataInputStream in;
-
-
+
+
/**
* This method initializes a new instance of <code>RandomAccessFile</code>
- * to read from the specified <code>File</code> object with the specified
- * access mode. The access mode is either "r" for read only access or "rw"
+ * to read from the specified <code>File</code> object with the specified
+ * access mode. The access mode is either "r" for read only access or "rw"
* for read-write access.
* <p>
* Note that a <code>SecurityManager</code> check is made prior to
@@ -82,11 +82,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* @param file The <code>File</code> object to read and/or write.
* @param mode "r" for read only or "rw" for read-write access to the file
*
- * @exception IllegalArgumentException If <code>mode</code> has an
+ * @exception IllegalArgumentException If <code>mode</code> has an
* illegal value
- * @exception SecurityException If the requested access to the file
+ * @exception SecurityException If the requested access to the file
* is not allowed
- * @exception FileNotFoundException If the file is a directory, or
+ * @exception FileNotFoundException If the file is a directory, or
* any other error occurs
*/
public RandomAccessFile (File file, String mode)
@@ -99,13 +99,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
fdmode = FileChannelImpl.READ | FileChannelImpl.WRITE;
else if (mode.equals("rws"))
{
- fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE
- | FileChannelImpl.SYNC);
+ fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE
+ | FileChannelImpl.SYNC);
}
else if (mode.equals("rwd"))
{
- fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE
- | FileChannelImpl.DSYNC);
+ fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE
+ | FileChannelImpl.DSYNC);
}
else
throw new IllegalArgumentException ("invalid mode: " + mode);
@@ -159,11 +159,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* @param fileName The name of the file to read and/or write
* @param mode "r", "rw", "rws", or "rwd"
*
- * @exception IllegalArgumentException If <code>mode</code> has an
+ * @exception IllegalArgumentException If <code>mode</code> has an
* illegal value
- * @exception SecurityException If the requested access to the file
+ * @exception SecurityException If the requested access to the file
* is not allowed
- * @exception FileNotFoundException If the file is a directory or
+ * @exception FileNotFoundException If the file is a directory or
* any other error occurs
*/
public RandomAccessFile (String fileName, String mode)
@@ -184,7 +184,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method returns a <code>FileDescriptor</code> object that
+ * This method returns a <code>FileDescriptor</code> object that
* represents the native file handle for this file.
*
* @return The <code>FileDescriptor</code> object for this file
@@ -195,9 +195,9 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
{
synchronized (this)
{
- if (fd == null)
- fd = new FileDescriptor (ch);
- return fd;
+ if (fd == null)
+ fd = new FileDescriptor (ch);
+ return fd;
}
}
@@ -239,10 +239,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
ch.truncate (newLen);
else if (newLen > length())
{
- long pos = getFilePointer();
- seek(newLen - 1);
- write(0);
- seek(pos);
+ long pos = getFilePointer();
+ seek(newLen - 1);
+ write(0);
+ seek(pos);
}
}
@@ -273,7 +273,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads bytes from the file into the specified array. The
- * bytes are stored starting at the beginning of the array and up to
+ * bytes are stored starting at the beginning of the array and up to
* <code>buf.length</code> bytes can be read.
*
* @param buffer The buffer to read bytes from the file into
@@ -310,14 +310,14 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* value returned is <code>false</code> If the byte is non-zero, then
* the value returned is <code>true</code>
* <p>
- * This method can read a <code>boolean</code> written by an object
+ * This method can read a <code>boolean</code> written by an object
* implementing the
- * <code>writeBoolean()</code> method in the <code>DataOutput</code>
+ * <code>writeBoolean()</code> method in the <code>DataOutput</code>
* interface.
*
* @return The <code>boolean</code> value read
*
- * @exception EOFException If end of file is reached before reading the
+ * @exception EOFException If end of file is reached before reading the
* boolean
* @exception IOException If any other error occurs
*/
@@ -330,8 +330,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* This method reads a Java byte value from an input stream. The value
* is in the range of -128 to 127.
* <p>
- * This method can read a <code>byte</code> written by an object
- * implementing the
+ * This method can read a <code>byte</code> written by an object
+ * implementing the
* <code>writeByte()</code> method in the <code>DataOutput</code> interface.
*
* @return The <code>byte</code> value read
@@ -347,24 +347,24 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method reads a Java <code>char</code> value from an input stream.
- * It operates by reading two bytes from the stream and converting them to
+ * This method reads a Java <code>char</code> value from an input stream.
+ * It operates by reading two bytes from the stream and converting them to
* a single 16-bit Java <code>char</code> The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
- * As an example, if <code>byte1</code> and <code>byte2</code> represent
+ * As an example, if <code>byte1</code> and <code>byte2</code> represent
* the first
* and second byte read from the stream respectively, they will be
* transformed to a <code>char</code> in the following manner:
* <p>
* <code>(char)(((byte1 &amp; 0xFF) &lt;&lt; 8) | (byte2 &amp; 0xFF)</code>
* <p>
- * This method can read a <code>char</code> written by an object
+ * This method can read a <code>char</code> written by an object
* implementing the
* <code>writeChar()</code> method in the <code>DataOutput</code> interface.
*
- * @return The <code>char</code> value read
+ * @return The <code>char</code> value read
*
* @exception EOFException If end of file is reached before reading the char
* @exception IOException If any other error occurs
@@ -379,19 +379,19 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads a Java double value from an input stream. It operates
* by first reading a <code>logn</code> value from the stream by calling the
- * <code>readLong()</code> method in this interface, then
+ * <code>readLong()</code> method in this interface, then
* converts that <code>long</code>
- * to a <code>double</code> using the <code>longBitsToDouble</code>
+ * to a <code>double</code> using the <code>longBitsToDouble</code>
* method in the class <code>java.lang.Double</code>
* <p>
- * This method can read a <code>double</code> written by an object
+ * This method can read a <code>double</code> written by an object
* implementing the
- * <code>writeDouble()</code> method in the <code>DataOutput</code>
+ * <code>writeDouble()</code> method in the <code>DataOutput</code>
* interface.
*
* @return The <code>double</code> value read
*
- * @exception EOFException If end of file is reached before reading
+ * @exception EOFException If end of file is reached before reading
* the double
* @exception IOException If any other error occurs
*
@@ -406,12 +406,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads a Java float value from an input stream. It operates
* by first reading an <code>int</code> value from the stream by calling the
- * <code>readInt()</code> method in this interface, then converts
+ * <code>readInt()</code> method in this interface, then converts
* that <code>int</code>
- * to a <code>float</code> using the <code>intBitsToFloat</code> method in
+ * to a <code>float</code> using the <code>intBitsToFloat</code> method in
* the class <code>java.lang.Float</code>
* <p>
- * This method can read a <code>float</code> written by an object
+ * This method can read a <code>float</code> written by an object
* implementing the
* <code>writeFloat()</code> method in the <code>DataOutput</code> interface.
*
@@ -436,7 +436,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
*
* @param buffer The buffer into which to read the data
*
- * @exception EOFException If end of file is reached before filling the
+ * @exception EOFException If end of file is reached before filling the
* buffer
* @exception IOException If any other error occurs
*/
@@ -446,19 +446,19 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method reads raw bytes into the passed array <code>buf</code>
+ * This method reads raw bytes into the passed array <code>buf</code>
* starting
- * <code>offset</code> bytes into the buffer. The number of bytes read
+ * <code>offset</code> bytes into the buffer. The number of bytes read
* will be
- * exactly <code>len</code> Note that this method blocks until the data is
- * available and throws an exception if there is not enough data left in
+ * exactly <code>len</code> Note that this method blocks until the data is
+ * available and throws an exception if there is not enough data left in
* the stream to read <code>len</code> bytes.
*
* @param buffer The buffer into which to read the data
* @param offset The offset into the buffer to start storing data
* @param count The number of bytes to read into the buffer
*
- * @exception EOFException If end of file is reached before filling
+ * @exception EOFException If end of file is reached before filling
* the buffer
* @exception IOException If any other error occurs
*/
@@ -470,22 +470,22 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads a Java <code>int</code> value from an input stream
- * It operates by reading four bytes from the stream and converting them to
+ * It operates by reading four bytes from the stream and converting them to
* a single Java <code>int</code> The bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
- * As an example, if <code>byte1</code> through <code>byte4</code>
+ * As an example, if <code>byte1</code> through <code>byte4</code>
* represent the first
* four bytes read from the stream, they will be
* transformed to an <code>int</code> in the following manner:
* <p>
- * <code>(int)(((byte1 &amp; 0xFF) &lt;&lt; 24) + ((byte2 &amp; 0xFF) &lt;&lt; 16) +
+ * <code>(int)(((byte1 &amp; 0xFF) &lt;&lt; 24) + ((byte2 &amp; 0xFF) &lt;&lt; 16) +
* ((byte3 &amp; 0xFF) &lt;&lt; 8) + (byte4 &amp; 0xFF)))</code>
* <p>
* The value returned is in the range of 0 to 65535.
* <p>
- * This method can read an <code>int</code> written by an object
+ * This method can read an <code>int</code> written by an object
* implementing the
* <code>writeInt()</code> method in the <code>DataOutput</code> interface.
*
@@ -503,17 +503,17 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads the next line of text data from an input stream.
- * It operates by reading bytes and converting those bytes to
+ * It operates by reading bytes and converting those bytes to
* <code>char</code>
- * values by treating the byte read as the low eight bits of the
+ * values by treating the byte read as the low eight bits of the
* <code>char</code>
* and using <code>0</code> as the high eight bits. Because of this, it does
* not support the full 16-bit Unicode character set.
* <p>
* The reading of bytes ends when either the end of file or a line terminator
* is encountered. The bytes read are then returned as a <code>String</code>
- * A line terminator is a byte sequence consisting of either
- * <code>\r</code> <code>\n</code> or <code>\r\n</code> These
+ * A line terminator is a byte sequence consisting of either
+ * <code>\r</code> <code>\n</code> or <code>\r\n</code> These
* termination charaters are
* discarded and are not returned as part of the string.
* <p>
@@ -533,25 +533,25 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads a Java long value from an input stream
- * It operates by reading eight bytes from the stream and converting them to
+ * It operates by reading eight bytes from the stream and converting them to
* a single Java <code>long</code> The bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
- * As an example, if <code>byte1</code> through <code>byte8</code>
+ * As an example, if <code>byte1</code> through <code>byte8</code>
* represent the first
* eight bytes read from the stream, they will be
* transformed to an <code>long</code> in the following manner:
* <p>
* <code>
- * (long)((((long)byte1 &amp; 0xFF) &lt;&lt; 56) + (((long)byte2 &amp; 0xFF) &lt;&lt; 48) +
- * (((long)byte3 &amp; 0xFF) &lt;&lt; 40) + (((long)byte4 &amp; 0xFF) &lt;&lt; 32) +
- * (((long)byte5 &amp; 0xFF) &lt;&lt; 24) + (((long)byte6 &amp; 0xFF) &lt;&lt; 16) +
+ * (long)((((long)byte1 &amp; 0xFF) &lt;&lt; 56) + (((long)byte2 &amp; 0xFF) &lt;&lt; 48) +
+ * (((long)byte3 &amp; 0xFF) &lt;&lt; 40) + (((long)byte4 &amp; 0xFF) &lt;&lt; 32) +
+ * (((long)byte5 &amp; 0xFF) &lt;&lt; 24) + (((long)byte6 &amp; 0xFF) &lt;&lt; 16) +
* (((long)byte7 &amp; 0xFF) &lt;&lt; 8) + ((long)byte9 &amp; 0xFF)))</code>
* <p>
* The value returned is in the range of 0 to 65535.
* <p>
- * This method can read an <code>long</code> written by an object
+ * This method can read an <code>long</code> written by an object
* implementing the
* <code>writeLong()</code> method in the <code>DataOutput</code> interface.
*
@@ -569,12 +569,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads a signed 16-bit value into a Java in from the stream.
- * It operates by reading two bytes from the stream and converting them to
+ * It operates by reading two bytes from the stream and converting them to
* a single 16-bit Java <code>short</code> The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
- * As an example, if <code>byte1</code> and <code>byte2</code>
+ * As an example, if <code>byte1</code> and <code>byte2</code>
* represent the first
* and second byte read from the stream respectively, they will be
* transformed to a <code>short</code> in the following manner:
@@ -583,7 +583,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* <p>
* The value returned is in the range of -32768 to 32767.
* <p>
- * This method can read a <code>short</code> written by an object
+ * This method can read a <code>short</code> written by an object
* implementing the
* <code>writeShort()</code> method in the <code>DataOutput</code> interface.
*
@@ -600,12 +600,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method reads 8 unsigned bits into a Java <code>int</code> value
- * from the
+ * This method reads 8 unsigned bits into a Java <code>int</code> value
+ * from the
* stream. The value returned is in the range of 0 to 255.
* <p>
- * This method can read an unsigned byte written by an object implementing
- * the <code>writeUnsignedByte()</code> method in the
+ * This method can read an unsigned byte written by an object implementing
+ * the <code>writeUnsignedByte()</code> method in the
* <code>DataOutput</code> interface.
*
* @return The unsigned bytes value read as a Java <code>int</code>
@@ -622,12 +622,12 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method reads 16 unsigned bits into a Java int value from the stream.
- * It operates by reading two bytes from the stream and converting them to
+ * It operates by reading two bytes from the stream and converting them to
* a single Java <code>int</code> The two bytes are stored most
* significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
+ * host byte ordering.
* <p>
- * As an example, if <code>byte1</code> and <code>byte2</code>
+ * As an example, if <code>byte1</code> and <code>byte2</code>
* represent the first
* and second byte read from the stream respectively, they will be
* transformed to an <code>int</code> in the following manner:
@@ -637,7 +637,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* The value returned is in the range of 0 to 65535.
* <p>
* This method can read an unsigned short written by an object implementing
- * the <code>writeUnsignedShort()</code> method in the
+ * the <code>writeUnsignedShort()</code> method in the
* <code>DataOutput</code> interface.
*
* @return The unsigned short value read as a Java <code>int</code>
@@ -651,7 +651,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method reads a <code>String</code> from an input stream that
+ * This method reads a <code>String</code> from an input stream that
* is encoded in
* a modified UTF-8 format. This format has a leading two byte sequence
* that contains the remaining number of bytes to read. This two byte
@@ -659,11 +659,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* interface.
* <p>
* After the number of remaining bytes have been determined, these bytes
- * are read an transformed into <code>char</code> values.
+ * are read an transformed into <code>char</code> values.
* These <code>char</code> values
* are encoded in the stream using either a one, two, or three byte format.
* The particular format in use can be determined by examining the first
- * byte read.
+ * byte read.
* <p>
* If the first byte has a high order bit of 0 then
* that character consists on only one byte. This character value consists
@@ -673,14 +673,14 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* <p>
* <code>(char)byte1</code>
* <p>
- * If the first byte has <code>110</code> as its high order bits, then the
+ * If the first byte has <code>110</code> as its high order bits, then the
* character consists of two bytes. The bits that make up the character
* value are in positions 0 through 4 of the first byte and bit positions
- * 0 through 5 of the second byte. (The second byte should have
+ * 0 through 5 of the second byte. (The second byte should have
* 10 as its high order bits). These values are in most significant
* byte first (i.e., "big endian") order.
* <p>
- * As an example, if <code>byte1</code> and <code>byte2</code>
+ * As an example, if <code>byte1</code> and <code>byte2</code>
* are the first two bytes
* read respectively, and the high order bits of them match the patterns
* which indicate a two byte character encoding, then they would be
@@ -695,27 +695,27 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* have <code>10</code> as their high order bits). These values are in most
* significant byte first (i.e., "big endian") order.
* <p>
- * As an example, if <code>byte1</code> <code>byte2</code>
+ * As an example, if <code>byte1</code> <code>byte2</code>
* and <code>byte3</code> are the
* three bytes read, and the high order bits of them match the patterns
* which indicate a three byte character encoding, then they would be
* converted to a Java <code>char</code> like so:
* <p>
- * <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
+ * <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) |
* (byte3 & 0x3F))</code>
* <p>
* Note that all characters are encoded in the method that requires the
* fewest number of bytes with the exception of the character with the
- * value of <code>&#92;u0000</code> which is encoded as two bytes. This is
+ * value of <code>&#92;u0000</code> which is encoded as two bytes. This is
* a modification of the UTF standard used to prevent C language style
* <code>NUL</code> values from appearing in the byte stream.
* <p>
* This method can read data that was written by an object implementing the
* <code>writeUTF()</code> method in <code>DataOutput</code>
- *
+ *
* @return The <code>String</code> read
*
- * @exception EOFException If end of file is reached before reading the
+ * @exception EOFException If end of file is reached before reading the
* String
* @exception UTFDataFormatException If the data is not in UTF-8 format
* @exception IOException If any other error occurs
@@ -728,11 +728,11 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method sets the current file position to the specified offset
+ * This method sets the current file position to the specified offset
* from the beginning of the file. Note that some operating systems will
* allow the file pointer to be set past the current end of the file.
*
- * @param pos The offset from the beginning of the file at which to set
+ * @param pos The offset from the beginning of the file at which to set
* the file pointer
*
* @exception IOException If an error occurs
@@ -743,8 +743,8 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method attempts to skip and discard the specified number of bytes
- * in the input stream. It may actually skip fewer bytes than requested.
+ * This method attempts to skip and discard the specified number of bytes
+ * in the input stream. It may actually skip fewer bytes than requested.
* The actual number of bytes skipped is returned. This method will not
* skip any bytes if passed a negative number of bytes to skip.
*
@@ -759,10 +759,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
if (numBytes < 0)
throw new IllegalArgumentException ("Can't skip negative bytes: " +
numBytes);
-
+
if (numBytes == 0)
return 0;
-
+
long oldPos = ch.position();
long newPos = oldPos + numBytes;
long size = ch.size();
@@ -821,7 +821,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
}
/**
- * This method writes a Java <code>boolean</code> to the underlying output
+ * This method writes a Java <code>boolean</code> to the underlying output
* stream. For a value of <code>true</code>, 1 is written to the stream.
* For a value of <code>false</code>, 0 is written.
*
@@ -841,7 +841,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* This method writes a Java <code>byte</code> value to the underlying
* output stream.
*
- * @param val The <code>byte</code> to write to the stream, passed
+ * @param val The <code>byte</code> to write to the stream, passed
* as an <code>int</code>.
*
* @exception IOException If an error occurs
@@ -858,7 +858,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* This method writes a Java <code>short</code> to the stream, high byte
* first. This method requires two bytes to encode the value.
*
- * @param val The <code>short</code> value to write to the stream,
+ * @param val The <code>short</code> value to write to the stream,
* passed as an <code>int</code>.
*
* @exception IOException If an error occurs
@@ -875,7 +875,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* This method writes a single <code>char</code> value to the stream,
* high byte first.
*
- * @param val The <code>char</code> value to write, passed as
+ * @param val The <code>char</code> value to write, passed as
* an <code>int</code>.
*
* @exception IOException If an error occurs
@@ -922,7 +922,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method writes a Java <code>float</code> value to the stream. This
- * value is written by first calling the method
+ * value is written by first calling the method
* <code>Float.floatToIntBits</code>
* to retrieve an <code>int</code> representing the floating point number,
* then writing this <code>int</code> value to the stream exactly the same
@@ -944,13 +944,13 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
/**
* This method writes a Java <code>double</code> value to the stream. This
- * value is written by first calling the method
+ * value is written by first calling the method
* <code>Double.doubleToLongBits</code>
* to retrieve an <code>long</code> representing the floating point number,
* then writing this <code>long</code> value to the stream exactly the same
* as the <code>writeLong()</code> method does.
*
- * @param val The double precision floating point number to write to the
+ * @param val The double precision floating point number to write to the
* stream.
*
* @exception IOException If an error occurs
@@ -981,7 +981,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
out.writeBytes(val);
}
-
+
/**
* This method writes all the characters in a <code>String</code> to the
* stream. There will be two bytes for each character value. The high
@@ -998,7 +998,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
out.writeChars(val);
}
-
+
/**
* This method writes a Java <code>String</code> to the stream in a modified
* UTF-8 format. First, two bytes are written to the stream indicating the
@@ -1006,10 +1006,10 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
* encoded <code>String</code> not the <code>String</code> length. Next
* come the encoded characters. Each character in the <code>String</code>
* is encoded as either one, two or three bytes. For characters in the
- * range of <code>&#92;u0001</code> to <code>&#92;u007F</code>,
+ * range of <code>&#92;u0001</code> to <code>&#92;u007F</code>,
* one byte is used. The character
* value goes into bits 0-7 and bit eight is 0. For characters in the range
- * of <code>&#92;u0080</code> to <code>&#92;u007FF</code>, two
+ * of <code>&#92;u0080</code> to <code>&#92;u007FF</code>, two
* bytes are used. Bits
* 6-10 of the character value are encoded bits 0-4 of the first byte, with
* the high bytes having a value of "110". Bits 0-5 of the character value
@@ -1035,7 +1035,7 @@ public class RandomAccessFile implements DataOutput, DataInput, Closeable
out.writeUTF(val);
}
-
+
/**
* This method creates a java.nio.channels.FileChannel.
* Nio does not allow one to create a file channel directly.
diff --git a/java/io/Reader.java b/java/io/Reader.java
index 6da1813c6..11a12f812 100644
--- a/java/io/Reader.java
+++ b/java/io/Reader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -36,7 +36,7 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.io;
-
+
import java.nio.CharBuffer;
/* Written using "Java Class Libraries", 2nd edition, plus online
@@ -52,18 +52,18 @@ import java.nio.CharBuffer;
* or network connection.
*
* @author Per Bothner (bothner@cygnus.com)
- * @date April 21, 1998.
- * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @date April 21, 1998.
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
public abstract class Reader implements Closeable, Readable
{
/**
* This is the <code>Object</code> used for synchronizing critical code
- * sections. Subclasses should use this variable instead of a
+ * sections. Subclasses should use this variable instead of a
* synchronized method or an explicit synchronization on <code>this</code>
*/
protected Object lock;
-
+
/**
* Unitializes a <code>Reader</code> that will use the object
* itself for synchronization of critical code sections.
@@ -86,10 +86,10 @@ public abstract class Reader implements Closeable, Readable
/**
* Read chars from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index <code>offset</code>
- * into the buffer and attempts to read <code>len</code> chars. This method
- * can return before reading the number of chars requested. The actual
- * number of chars read is returned as an int. A -1 is returned to indicate
+ * supplied buffer. It starts storing the data at index <code>offset</code>
+ * into the buffer and attempts to read <code>len</code> chars. This method
+ * can return before reading the number of chars requested. The actual
+ * number of chars read is returned as an int. A -1 is returned to indicate
* the end of the stream.
* <p>
* This method will block until some data can be read.
@@ -113,7 +113,7 @@ public abstract class Reader implements Closeable, Readable
*/
public abstract int read(char buf[], int offset, int count)
throws IOException;
-
+
/**
* Reads chars from a stream and stores them into a caller
* supplied buffer. This method attempts to completely fill the buffer,
@@ -182,10 +182,10 @@ public abstract class Reader implements Closeable, Readable
* point.
* <p>
* This method always returns <code>false</code> in this class, but
- * subclasses can override this method to return <code>true</code> if they
+ * subclasses can override this method to return <code>true</code> if they
* support mark/reset functionality.
*
- * @return <code>true</code> if mark/reset functionality is supported,
+ * @return <code>true</code> if mark/reset functionality is supported,
* <code>false</code> otherwise
*
*/
@@ -197,17 +197,17 @@ public abstract class Reader implements Closeable, Readable
/**
* Marks a position in the input to which the stream can be
* "reset" by calling the <code>reset()</code> method. The parameter
- * <code>readlimit</code> is the number of chars that can be read from the
+ * <code>readlimit</code> is the number of chars that can be read from the
* stream after setting the mark before the mark becomes invalid. For
- * example, if <code>mark()</code> is called with a read limit of 10, then
- * when 11 chars of data are read from the stream before the
- * <code>reset()</code> method is called, then the mark is invalid and the
+ * example, if <code>mark()</code> is called with a read limit of 10, then
+ * when 11 chars of data are read from the stream before the
+ * <code>reset()</code> method is called, then the mark is invalid and the
* stream object instance is not required to remember the mark.
*
- * @param readLimit The number of chars that can be read before the mark
+ * @param readLimit The number of chars that can be read before the mark
* becomes invalid
*
- * @exception IOException If an error occurs such as mark not being
+ * @exception IOException If an error occurs such as mark not being
* supported for this class
*/
public void mark(int readLimit) throws IOException
@@ -216,8 +216,8 @@ public abstract class Reader implements Closeable, Readable
}
/**
- * Resets a stream to the point where the <code>mark()</code>
- * method was called. Any chars that were read after the mark point was
+ * Resets a stream to the point where the <code>mark()</code>
+ * method was called. Any chars that were read after the mark point was
* set will be re-read during subsequent reads.
* <p>
* This method always throws an IOException in this class, but subclasses
@@ -237,7 +237,7 @@ public abstract class Reader implements Closeable, Readable
* <p>
* This method always returns <code>false</code> in this class
*
- * @return <code>true</code> if the stream is ready to be read,
+ * @return <code>true</code> if the stream is ready to be read,
* <code>false</code> otherwise.
*
* @exception IOException If an error occurs
@@ -274,12 +274,12 @@ public abstract class Reader implements Closeable, Readable
synchronized (lock)
{
while (todo > 0)
- {
- int skipped = read(buffer, 0, bsize > todo ? (int) todo : bsize);
- if (skipped <= 0)
- break;
- todo -= skipped;
- }
+ {
+ int skipped = read(buffer, 0, bsize > todo ? (int) todo : bsize);
+ if (skipped <= 0)
+ break;
+ todo -= skipped;
+ }
}
return count - todo;
}
diff --git a/java/io/SequenceInputStream.java b/java/io/SequenceInputStream.java
index 5ff85e989..92f032ccf 100644
--- a/java/io/SequenceInputStream.java
+++ b/java/io/SequenceInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ import java.util.Enumeration;
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
-
+
/**
* This class merges a sequence of multiple <code>InputStream</code>'s in
* order to form a single logical stream that can be read by applications
@@ -126,7 +126,7 @@ public class SequenceInputStream extends InputStream
/**
* Closes this stream. This will cause any remaining unclosed subordinate
- * <code>InputStream</code>'s to be closed as well. Subsequent attempts to
+ * <code>InputStream</code>'s to be closed as well. Subsequent attempts to
* read from this stream may cause an exception.
*
* @exception IOException If an error occurs
@@ -135,8 +135,8 @@ public class SequenceInputStream extends InputStream
{
while (in != null)
{
- in.close();
- in = getNextStream ();
+ in.close();
+ in = getNextStream ();
}
}
@@ -158,7 +158,7 @@ public class SequenceInputStream extends InputStream
while (in != null && (ch = in.read()) < 0)
{
- in.close();
+ in.close();
in = getNextStream();
}
@@ -192,7 +192,7 @@ public class SequenceInputStream extends InputStream
// don't bother doing it here.
while (in != null && (ch = in.read(b, off, len)) < 0)
{
- in.close();
+ in.close();
in = getNextStream();
}
@@ -210,12 +210,12 @@ public class SequenceInputStream extends InputStream
if (e != null)
{
if (e.hasMoreElements())
- nextIn = e.nextElement();
+ nextIn = e.nextElement();
}
else if (in2 != null)
{
- nextIn = in2;
- in2 = null;
+ nextIn = in2;
+ in2 = null;
}
return nextIn;
diff --git a/java/io/Serializable.java b/java/io/Serializable.java
index a6d99f6d5..869fa6de8 100644
--- a/java/io/Serializable.java
+++ b/java/io/Serializable.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/io/SerializablePermission.java b/java/io/SerializablePermission.java
index b5c07e4ec..88846cc35 100644
--- a/java/io/SerializablePermission.java
+++ b/java/io/SerializablePermission.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -60,19 +60,19 @@ import java.security.BasicPermission;
public final class SerializablePermission extends BasicPermission
{
static final long serialVersionUID = 8537212141160296410L;
-
+
/*
* Class Variables
*/
private static final String[] legal_names = { "enableSubclassImplementation",
- "enableSubstitution" };
+ "enableSubstitution" };
/*
* Constructors
*/
/**
- * This method initializes a new instance of
+ * This method initializes a new instance of
* <code>SerializablePermission</code>
* that has the specified name.
*
@@ -87,7 +87,7 @@ public final class SerializablePermission extends BasicPermission
}
/**
- * This method initializes a new instance of
+ * This method initializes a new instance of
* <code>SerializablePermission</code>
* that has the specified name and action list. Note that the action list
* is unused in this class.
@@ -95,7 +95,7 @@ public final class SerializablePermission extends BasicPermission
* @param name The name of the permission.
* @param actions The action list (unused).
*
- * @exception IllegalArgumentException If the name is not valid for
+ * @exception IllegalArgumentException If the name is not valid for
* this class.
*/
public SerializablePermission(String name, String actions)
@@ -110,4 +110,3 @@ public final class SerializablePermission extends BasicPermission
}
} // class SerializablePermission
-
diff --git a/java/io/StreamTokenizer.java b/java/io/StreamTokenizer.java
index 87384f39f..0245fbf51 100644
--- a/java/io/StreamTokenizer.java
+++ b/java/io/StreamTokenizer.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,18 +41,18 @@ import gnu.java.lang.CPStringBuilder;
/**
* This class parses streams of characters into tokens. There are a
- * million-zillion flags that can be set to control the parsing, as
+ * million-zillion flags that can be set to control the parsing, as
* described under the various method headings.
*
* @author Warren Levy (warrenl@cygnus.com)
- * @date October 25, 1998.
+ * @date October 25, 1998.
*/
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
* "The Java Language Specification", ISBN 0-201-63451-1
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct.
*/
-
+
public class StreamTokenizer
{
/** A constant indicating that the end of the stream has been read. */
@@ -74,7 +74,7 @@ public class StreamTokenizer
* Contains the type of the token read resulting from a call to nextToken
* The rules are as follows:
* <ul>
- * <li>For a token consisting of a single ordinary character, this is the
+ * <li>For a token consisting of a single ordinary character, this is the
* value of that character.</li>
* <li>For a quoted string, this is the value of the quote character</li>
* <li>For a word, this is TT_WORD</li>
@@ -134,7 +134,7 @@ public class StreamTokenizer
}
/**
- * This method initializes a new <code>StreamTokenizer</code> to read
+ * This method initializes a new <code>StreamTokenizer</code> to read
* characters from a <code>Reader</code> and parse them. The char values
* have their hight bits masked so that the value is treated a character
* in the range of 0x0000 to 0x00FF.
@@ -178,11 +178,11 @@ public class StreamTokenizer
{
if (ch >= 0 && ch <= 255)
{
- comment[ch] = true;
- whitespace[ch] = false;
- alphabetic[ch] = false;
- numeric[ch] = false;
- quote[ch] = false;
+ comment[ch] = true;
+ whitespace[ch] = false;
+ alphabetic[ch] = false;
+ numeric[ch] = false;
+ quote[ch] = false;
}
}
@@ -199,7 +199,7 @@ public class StreamTokenizer
}
/**
- * This method returns the current line number. Note that if the
+ * This method returns the current line number. Note that if the
* <code>pushBack()</code> method is called, it has no effect on the
* line number returned by this method.
*
@@ -213,7 +213,7 @@ public class StreamTokenizer
/**
* This method sets a flag that indicates whether or not alphabetic
* tokens that are returned should be converted to lower case.
- *
+ *
* @param flag <code>true</code> to convert to lower case,
* <code>false</code> otherwise
*/
@@ -248,8 +248,8 @@ public class StreamTokenizer
}
/**
- * This method reads the next token from the stream. It sets the
- * <code>ttype</code> variable to the appropriate token type and
+ * This method reads the next token from the stream. It sets the
+ * <code>ttype</code> variable to the appropriate token type and
* returns it. It also can set <code>sval</code> or <code>nval</code>
* as described below. The parsing strategy is as follows:
* <ul>
@@ -266,13 +266,13 @@ public class StreamTokenizer
* is stored in <code>sval</code>. If lower case mode is set, the token
* stored in <code>sval</code> is converted to lower case. The end of line
* sequence terminates a word only if EOL signficance has been turned on.
- * The start of a comment also terminates a word. Any character with a
+ * The start of a comment also terminates a word. Any character with a
* non-alphabetic and non-numeric attribute (such as white space, a quote,
* or a commet) are treated as non-alphabetic and terminate the word.</li>
* <li>If a comment character is parsed, then all remaining characters on
* the current line are skipped and another token is parsed. Any EOL or
* EOF's encountered are not discarded, but rather terminate the comment.</li>
- * <li>If a quote character is parsed, then all characters up to the
+ * <li>If a quote character is parsed, then all characters up to the
* second occurrence of the same quote character are parsed into a
* <code>String</code>. This <code>String</code> is stored as
* <code>sval</code>, but is not converted to lower case, even if lower case
@@ -281,7 +281,7 @@ public class StreamTokenizer
* (\b (backspace), \t (HTAB), \n (linefeed), \f (form feed), \r
* (carriage return), \" (double quote), \' (single quote), \\
* (backslash), \XXX (octal esacpe)) are converted to the appropriate
- * char values. Invalid esacape sequences are left in untranslated.
+ * char values. Invalid esacape sequences are left in untranslated.
* Unicode characters like ('\ u0000') are not recognized. </li>
* <li>If the C++ comment sequence "//" is encountered, and the parser
* is configured to handle that sequence, then the remainder of the line
@@ -303,9 +303,9 @@ public class StreamTokenizer
{
if (pushedBack)
{
- pushedBack = false;
- if (ttype != TT_NONE)
- return ttype;
+ pushedBack = false;
+ if (ttype != TT_NONE)
+ return ttype;
}
sval = null;
@@ -314,196 +314,196 @@ public class StreamTokenizer
// Skip whitespace. Deal with EOL along the way.
while (isWhitespace(ch = in.read()))
if (ch == '\n' || ch == '\r')
- {
- lineNumber++;
-
- // Throw away \n if in combination with \r.
- if (ch == '\r' && (ch = in.read()) != '\n')
- {
- if (ch != TT_EOF)
- in.unread(ch);
- }
- if (eolSignificant)
- return (ttype = TT_EOL);
- }
+ {
+ lineNumber++;
+
+ // Throw away \n if in combination with \r.
+ if (ch == '\r' && (ch = in.read()) != '\n')
+ {
+ if (ch != TT_EOF)
+ in.unread(ch);
+ }
+ if (eolSignificant)
+ return (ttype = TT_EOL);
+ }
if (ch == '/')
if ((ch = in.read()) == '/' && slashSlash)
- {
- while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
- ;
-
- if (ch != TT_EOF)
- in.unread(ch);
- return nextToken(); // Recursive, but not too deep in normal cases
- }
- else if (ch == '*' && slashStar)
- {
- while (true)
- {
- ch = in.read();
- if (ch == '*')
- {
- if ((ch = in.read()) == '/')
- break;
- else if (ch != TT_EOF)
- in.unread(ch);
- }
- else if (ch == '\n' || ch == '\r')
- {
- lineNumber++;
- if (ch == '\r' && (ch = in.read()) != '\n')
- {
- if (ch != TT_EOF)
- in.unread(ch);
- }
- }
- else if (ch == TT_EOF)
- {
- break;
- }
- }
- return nextToken(); // Recursive, but not too deep in normal cases
- }
+ {
+ while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
+ ;
+
+ if (ch != TT_EOF)
+ in.unread(ch);
+ return nextToken(); // Recursive, but not too deep in normal cases
+ }
+ else if (ch == '*' && slashStar)
+ {
+ while (true)
+ {
+ ch = in.read();
+ if (ch == '*')
+ {
+ if ((ch = in.read()) == '/')
+ break;
+ else if (ch != TT_EOF)
+ in.unread(ch);
+ }
+ else if (ch == '\n' || ch == '\r')
+ {
+ lineNumber++;
+ if (ch == '\r' && (ch = in.read()) != '\n')
+ {
+ if (ch != TT_EOF)
+ in.unread(ch);
+ }
+ }
+ else if (ch == TT_EOF)
+ {
+ break;
+ }
+ }
+ return nextToken(); // Recursive, but not too deep in normal cases
+ }
else
- {
- if (ch != TT_EOF)
- in.unread(ch);
- ch = '/';
- }
+ {
+ if (ch != TT_EOF)
+ in.unread(ch);
+ ch = '/';
+ }
if (ch == TT_EOF)
ttype = TT_EOF;
else if (isNumeric(ch))
{
- boolean isNegative = false;
- if (ch == '-')
- {
- // Read ahead to see if this is an ordinary '-' rather than numeric.
- ch = in.read();
- if (isNumeric(ch) && ch != '-')
- {
- isNegative = true;
- }
- else
- {
- if (ch != TT_EOF)
- in.unread(ch);
- return (ttype = '-');
- }
- }
-
- CPStringBuilder tokbuf = new CPStringBuilder();
- tokbuf.append((char) ch);
-
- int decCount = 0;
- while (isNumeric(ch = in.read()) && ch != '-')
- if (ch == '.' && decCount++ > 0)
- break;
- else
- tokbuf.append((char) ch);
-
- if (ch != TT_EOF)
- in.unread(ch);
- ttype = TT_NUMBER;
- try
- {
- nval = Double.valueOf(tokbuf.toString()).doubleValue();
- }
- catch (NumberFormatException _)
- {
- nval = 0.0;
- }
- if (isNegative)
- nval = -nval;
+ boolean isNegative = false;
+ if (ch == '-')
+ {
+ // Read ahead to see if this is an ordinary '-' rather than numeric.
+ ch = in.read();
+ if (isNumeric(ch) && ch != '-')
+ {
+ isNegative = true;
+ }
+ else
+ {
+ if (ch != TT_EOF)
+ in.unread(ch);
+ return (ttype = '-');
+ }
+ }
+
+ CPStringBuilder tokbuf = new CPStringBuilder();
+ tokbuf.append((char) ch);
+
+ int decCount = 0;
+ while (isNumeric(ch = in.read()) && ch != '-')
+ if (ch == '.' && decCount++ > 0)
+ break;
+ else
+ tokbuf.append((char) ch);
+
+ if (ch != TT_EOF)
+ in.unread(ch);
+ ttype = TT_NUMBER;
+ try
+ {
+ nval = Double.valueOf(tokbuf.toString()).doubleValue();
+ }
+ catch (NumberFormatException _)
+ {
+ nval = 0.0;
+ }
+ if (isNegative)
+ nval = -nval;
}
else if (isAlphabetic(ch))
{
- CPStringBuilder tokbuf = new CPStringBuilder();
- tokbuf.append((char) ch);
- while (isAlphabetic(ch = in.read()) || isNumeric(ch))
- tokbuf.append((char) ch);
- if (ch != TT_EOF)
- in.unread(ch);
- ttype = TT_WORD;
- sval = tokbuf.toString();
- if (lowerCase)
- sval = sval.toLowerCase();
+ CPStringBuilder tokbuf = new CPStringBuilder();
+ tokbuf.append((char) ch);
+ while (isAlphabetic(ch = in.read()) || isNumeric(ch))
+ tokbuf.append((char) ch);
+ if (ch != TT_EOF)
+ in.unread(ch);
+ ttype = TT_WORD;
+ sval = tokbuf.toString();
+ if (lowerCase)
+ sval = sval.toLowerCase();
}
else if (isComment(ch))
{
- while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
- ;
-
- if (ch != TT_EOF)
- in.unread(ch);
- return nextToken(); // Recursive, but not too deep in normal cases.
+ while ((ch = in.read()) != '\n' && ch != '\r' && ch != TT_EOF)
+ ;
+
+ if (ch != TT_EOF)
+ in.unread(ch);
+ return nextToken(); // Recursive, but not too deep in normal cases.
}
else if (isQuote(ch))
{
- ttype = ch;
- CPStringBuilder tokbuf = new CPStringBuilder();
- while ((ch = in.read()) != ttype && ch != '\n' && ch != '\r' &&
- ch != TT_EOF)
- {
- if (ch == '\\')
- switch (ch = in.read())
- {
- case 'a': ch = 0x7;
- break;
- case 'b': ch = '\b';
- break;
- case 'f': ch = 0xC;
- break;
- case 'n': ch = '\n';
- break;
- case 'r': ch = '\r';
- break;
- case 't': ch = '\t';
- break;
- case 'v': ch = 0xB;
- break;
- case '\n': ch = '\n';
- break;
+ ttype = ch;
+ CPStringBuilder tokbuf = new CPStringBuilder();
+ while ((ch = in.read()) != ttype && ch != '\n' && ch != '\r' &&
+ ch != TT_EOF)
+ {
+ if (ch == '\\')
+ switch (ch = in.read())
+ {
+ case 'a': ch = 0x7;
+ break;
+ case 'b': ch = '\b';
+ break;
+ case 'f': ch = 0xC;
+ break;
+ case 'n': ch = '\n';
+ break;
+ case 'r': ch = '\r';
+ break;
+ case 't': ch = '\t';
+ break;
+ case 'v': ch = 0xB;
+ break;
+ case '\n': ch = '\n';
+ break;
case '\r': ch = '\r';
- break;
- case '\"':
- case '\'':
- case '\\':
- break;
- default:
- int ch1, nextch;
- if ((nextch = ch1 = ch) >= '0' && ch <= '7')
- {
- ch -= '0';
- if ((nextch = in.read()) >= '0' && nextch <= '7')
- {
- ch = ch * 8 + nextch - '0';
- if ((nextch = in.read()) >= '0' && nextch <= '7' &&
- ch1 >= '0' && ch1 <= '3')
- {
- ch = ch * 8 + nextch - '0';
- nextch = in.read();
- }
- }
- }
-
- if (nextch != TT_EOF)
- in.unread(nextch);
- }
-
- tokbuf.append((char) ch);
- }
-
- // Throw away matching quote char.
- if (ch != ttype && ch != TT_EOF)
- in.unread(ch);
-
- sval = tokbuf.toString();
+ break;
+ case '\"':
+ case '\'':
+ case '\\':
+ break;
+ default:
+ int ch1, nextch;
+ if ((nextch = ch1 = ch) >= '0' && ch <= '7')
+ {
+ ch -= '0';
+ if ((nextch = in.read()) >= '0' && nextch <= '7')
+ {
+ ch = ch * 8 + nextch - '0';
+ if ((nextch = in.read()) >= '0' && nextch <= '7' &&
+ ch1 >= '0' && ch1 <= '3')
+ {
+ ch = ch * 8 + nextch - '0';
+ nextch = in.read();
+ }
+ }
+ }
+
+ if (nextch != TT_EOF)
+ in.unread(nextch);
+ }
+
+ tokbuf.append((char) ch);
+ }
+
+ // Throw away matching quote char.
+ if (ch != ttype && ch != TT_EOF)
+ in.unread(ch);
+
+ sval = tokbuf.toString();
}
else
{
- ttype = ch;
+ ttype = ch;
}
return ttype;
@@ -591,11 +591,11 @@ public class StreamTokenizer
{
if (ch >= 0 && ch <= 255)
{
- quote[ch] = true;
- comment[ch] = false;
- whitespace[ch] = false;
- alphabetic[ch] = false;
- numeric[ch] = false;
+ quote[ch] = true;
+ comment[ch] = false;
+ whitespace[ch] = false;
+ alphabetic[ch] = false;
+ numeric[ch] = false;
}
}
@@ -692,8 +692,8 @@ public class StreamTokenizer
hi = 255;
for (int i = low; i <= hi; i++)
{
- resetChar(i);
- whitespace[i] = true;
+ resetChar(i);
+ whitespace[i] = true;
}
}
diff --git a/java/io/StringBufferInputStream.java b/java/io/StringBufferInputStream.java
index 090881985..28405d938 100644
--- a/java/io/StringBufferInputStream.java
+++ b/java/io/StringBufferInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.io;
* plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
* Status: Believed complete and correct. Deprecated in JDK 1.1.
*/
-
+
/**
* This class permits a <code>String</code> to be read as an input stream.
* The low eight bits of each character in the <code>String</code> are the
@@ -51,10 +51,10 @@ package java.io;
* discarded.
* <p>
* The mark/reset functionality in this class behaves differently than
- * normal. The <code>mark()</code> method is always ignored and the
- * <code>reset()</code> method always resets in stream to start reading from
- * position 0 in the String. Note that since this method does not override
- * <code>markSupported()</code> in <code>InputStream</code>, calling that
+ * normal. The <code>mark()</code> method is always ignored and the
+ * <code>reset()</code> method always resets in stream to start reading from
+ * position 0 in the String. Note that since this method does not override
+ * <code>markSupported()</code> in <code>InputStream</code>, calling that
* method will return <code>false</code>.
* <p>
* Note that this class is deprecated because it does not properly handle
@@ -104,7 +104,7 @@ public class StringBufferInputStream extends InputStream
}
/**
- * This method reads one byte from the stream. The <code>pos</code> counter
+ * This method reads one byte from the stream. The <code>pos</code> counter
* is advanced to the next byte to be read. The byte read is returned as
* an int in the range of 0-255. If the stream position is already at the
* end of the buffer, no byte is read and a -1 is returned in order to
@@ -115,18 +115,18 @@ public class StringBufferInputStream extends InputStream
public int read()
{
if (pos >= count)
- return -1; // EOF
+ return -1; // EOF
return ((int) buffer.charAt(pos++)) & 0xFF;
}
/**
* This method reads bytes from the stream and stores them into a caller
- * supplied buffer. It starts storing the data at index <code>offset</code>
+ * supplied buffer. It starts storing the data at index <code>offset</code>
* into the buffer and attempts to read <code>len</code> bytes. This method
* can return before reading the number of bytes requested if the end of the
- * stream is encountered first. The actual number of bytes read is
- * returned. If no bytes can be read because the stream is already at
+ * stream is encountered first. The actual number of bytes read is
+ * returned. If no bytes can be read because the stream is already at
* the end of stream position, a -1 is returned.
* <p>
* This method does not block.
@@ -143,7 +143,7 @@ public class StringBufferInputStream extends InputStream
throw new ArrayIndexOutOfBoundsException();
if (pos >= count)
- return -1; // EOF
+ return -1; // EOF
int numRead = Math.min(len, count - pos);
if (numRead < 0)
diff --git a/java/io/StringReader.java b/java/io/StringReader.java
index 7e4e7d84f..c4021a8fb 100644
--- a/java/io/StringReader.java
+++ b/java/io/StringReader.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,7 +44,7 @@ package java.io;
*/
/**
- * This class permits a <code>String</code> to be read as a character
+ * This class permits a <code>String</code> to be read as a character
* input stream.
* <p>
* The mark/reset functionality in this class behaves differently than
@@ -53,7 +53,7 @@ package java.io;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Warren Levy (warrenl@cygnus.com)
- * @date October 19, 1998.
+ * @date October 19, 1998.
*/
public class StringReader extends Reader
{
@@ -70,8 +70,8 @@ public class StringReader extends Reader
private int count;
/**
- * Create a new <code>StringReader</code> that will read chars from the
- * passed in <code>String</code>. This stream will read from the beginning
+ * Create a new <code>StringReader</code> that will read chars from the
+ * passed in <code>String</code>. This stream will read from the beginning
* to the end of the <code>String</code>.
*
* @param buffer The <code>String</code> this stream will read from.
@@ -180,7 +180,7 @@ public class StringReader extends Reader
/**
* This method attempts to skip the requested number of chars in the
- * input stream. It does this by advancing the <code>pos</code> value by
+ * input stream. It does this by advancing the <code>pos</code> value by
* the specified number of chars. It this would exceed the length of the
* buffer, then only enough chars are skipped to position the stream at
* the end of the buffer. The actual number of chars skipped is returned.
@@ -206,4 +206,3 @@ public class StringReader extends Reader
}
}
}
-
diff --git a/java/io/StringWriter.java b/java/io/StringWriter.java
index 5a16e63ea..85500b5cb 100644
--- a/java/io/StringWriter.java
+++ b/java/io/StringWriter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -118,7 +118,7 @@ public class StringWriter extends Writer
* as a <code>String</code>.
*
* @return A <code>String</code> representing the chars written to
- * this stream.
+ * this stream.
*/
public String toString ()
{
@@ -170,7 +170,7 @@ public class StringWriter extends Writer
* @param str The <code>String</code> to write characters from
* @param offset The character position to start writing from
* @param len The number of characters to write.
- */
+ */
public void write (String str, int offset, int len)
{
// char[] tmpbuf = new char[len];
diff --git a/java/io/UnsupportedEncodingException.java b/java/io/UnsupportedEncodingException.java
index cf0ab64cb..597597563 100644
--- a/java/io/UnsupportedEncodingException.java
+++ b/java/io/UnsupportedEncodingException.java
@@ -39,7 +39,7 @@ exception statement from your version. */
package java.io;
/**
- * This exception is thrown when the requested character encoding is
+ * This exception is thrown when the requested character encoding is
* not supported.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
diff --git a/java/io/Writer.java b/java/io/Writer.java
index 660b69089..5b3e7073a 100644
--- a/java/io/Writer.java
+++ b/java/io/Writer.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,10 +44,10 @@ package java.io;
*/
/**
- * This abstract class forms the base of the hierarchy of classes that
+ * This abstract class forms the base of the hierarchy of classes that
* write output as a stream of chars. It provides a common set of methods
* for writing chars to stream. Subclasses implement and/or extend these
- * methods to write chars in a particular manner or to a particular
+ * methods to write chars in a particular manner or to a particular
* destination such as a file on disk or network connection.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -98,7 +98,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable
public abstract void flush() throws IOException;
/**
- * This method closes the stream. Any internal or native resources
+ * This method closes the stream. Any internal or native resources
* associated
* with this stream are freed. Any subsequent attempt to access the stream
* might throw an exception.
@@ -110,7 +110,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable
public abstract void close() throws IOException;
/**
- * This method writes a single char to the output stream.
+ * This method writes a single char to the output stream.
*
* @param b The char to be written to the output stream, passed as an int
*
@@ -125,8 +125,8 @@ public abstract class Writer implements Appendable, Closeable, Flushable
}
/**
- * This method all the writes char from the passed array to the output
- * stream. This method is equivalent to
+ * This method all the writes char from the passed array to the output
+ * stream. This method is equivalent to
* <code>write(buf, 0, buf.length)</code> which
* is exactly how it is implemented in this class.
*
@@ -148,10 +148,10 @@ public abstract class Writer implements Appendable, Closeable, Flushable
* @param buf The array of char to write from
* @param offset The index into the array to start writing from
* @param len The number of char to write
- *
+ *
* @exception IOException If an error occurs
*/
- public abstract void write(char[] buf, int offset, int len)
+ public abstract void write(char[] buf, int offset, int len)
throws IOException;
/**
@@ -165,7 +165,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable
public void write(String str) throws IOException
{
write(str, 0, str.length());
- }
+ }
/**
* This method writes <code>len</code> chars from the <code>String</code>
@@ -180,7 +180,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable
*/
public void write(String str, int offset, int len) throws IOException
{
- // FIXME - for libgcj re-write using native code to not require
+ // FIXME - for libgcj re-write using native code to not require
// copied buffer.
char[] buf = new char[len];
diff --git a/java/lang/AbstractStringBuffer.java b/java/lang/AbstractStringBuffer.java
index dc3a8c9ec..242afdcb4 100644
--- a/java/lang/AbstractStringBuffer.java
+++ b/java/lang/AbstractStringBuffer.java
@@ -169,13 +169,13 @@ abstract class AbstractStringBuffer
/* If the StringBuffer's value just grew, then we know that
value is newly allocated and the region between count and
newLength is filled with '\0'. */
- count = newLength;
+ count = newLength;
}
else
{
- /* The StringBuffer's value doesn't need to grow. However,
- we should clear out any cruft that may exist. */
- while (count < newLength)
+ /* The StringBuffer's value doesn't need to grow. However,
+ we should clear out any cruft that may exist. */
+ while (count < newLength)
value[count++] = '\0';
}
}
@@ -244,7 +244,7 @@ abstract class AbstractStringBuffer
* @see System#arraycopy(Object, int, Object, int, int)
*/
public void getChars(int srcOffset, int srcEnd,
- char[] dst, int dstOffset)
+ char[] dst, int dstOffset)
{
if (srcOffset < 0 || srcEnd > count || srcEnd < srcOffset)
throw new StringIndexOutOfBoundsException();
@@ -316,10 +316,10 @@ abstract class AbstractStringBuffer
return append("null");
synchronized (stringBuffer)
{
- int len = stringBuffer.count;
- ensureCapacity(count + len);
- VMSystem.arraycopy(stringBuffer.value, 0, value, count, len);
- count += len;
+ int len = stringBuffer.count;
+ ensureCapacity(count + len);
+ VMSystem.arraycopy(stringBuffer.value, 0, value, count, len);
+ count += len;
}
return this;
}
@@ -420,9 +420,9 @@ abstract class AbstractStringBuffer
seq = "null";
if (end - start > 0)
{
- ensureCapacity_unsynchronized(count + end - start);
- for (; start < end; ++start)
- value[count++] = seq.charAt(start);
+ ensureCapacity_unsynchronized(count + end - start);
+ for (; start < end; ++start)
+ value[count++] = seq.charAt(start);
}
return this;
}
@@ -907,9 +907,9 @@ abstract class AbstractStringBuffer
// If we save more than 1/4 of the buffer, shrink.
if (wouldSave > 200 || wouldSave * 4 > value.length)
{
- char[] newValue = new char[count];
- VMSystem.arraycopy(value, 0, newValue, 0, count);
- value = newValue;
+ char[] newValue = new char[count];
+ VMSystem.arraycopy(value, 0, newValue, 0, count);
+ value = newValue;
}
}
@@ -933,23 +933,23 @@ abstract class AbstractStringBuffer
int count = 0;
while (start < end)
{
- char base = value[start];
- if (base < Character.MIN_HIGH_SURROGATE
- || base > Character.MAX_HIGH_SURROGATE
- || start == end
- || start == count
- || value[start + 1] < Character.MIN_LOW_SURROGATE
- || value[start + 1] > Character.MAX_LOW_SURROGATE)
- {
- // Nothing.
- }
- else
- {
- // Surrogate pair.
- ++start;
- }
- ++start;
- ++count;
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == end
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ ++count;
}
return count;
}
@@ -969,22 +969,22 @@ abstract class AbstractStringBuffer
{
while (codePoints > 0)
{
- char base = value[start];
- if (base < Character.MIN_HIGH_SURROGATE
- || base > Character.MAX_HIGH_SURROGATE
- || start == count
- || value[start + 1] < Character.MIN_LOW_SURROGATE
- || value[start + 1] > Character.MAX_LOW_SURROGATE)
- {
- // Nothing.
- }
- else
- {
- // Surrogate pair.
- ++start;
- }
- ++start;
- --codePoints;
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ --codePoints;
}
return start;
}
diff --git a/java/lang/Boolean.java b/java/lang/Boolean.java
index 2b0236d1b..f2eaf4125 100644
--- a/java/lang/Boolean.java
+++ b/java/lang/Boolean.java
@@ -226,7 +226,7 @@ public final class Boolean implements Serializable, Comparable<Boolean>
* Compares this Boolean to another.
*
* @param other the Boolean to compare this Boolean to
- * @return 0 if both Booleans represent the same value, a positive number
+ * @return 0 if both Booleans represent the same value, a positive number
* if this Boolean represents true and the other false, and a negative
* number otherwise.
* @since 1.5
@@ -247,5 +247,5 @@ public final class Boolean implements Serializable, Comparable<Boolean>
{
return "true".equalsIgnoreCase(b) ? true : false;
}
-
+
}
diff --git a/java/lang/Character.java b/java/lang/Character.java
index eaa9557f6..05e641c3a 100644
--- a/java/lang/Character.java
+++ b/java/lang/Character.java
@@ -168,7 +168,7 @@ public final class Character implements Serializable, Comparable<Character>
* standard.
*/
private UnicodeBlock(int start, int end, String name,
- String canonicalName)
+ String canonicalName)
{
super(name);
this.start = start;
@@ -202,8 +202,8 @@ public final class Character implements Serializable, Comparable<Character>
public static UnicodeBlock of(int codePoint)
{
if (codePoint > MAX_CODE_POINT)
- throw new IllegalArgumentException("The supplied integer value is " +
- "too large to be a codepoint.");
+ throw new IllegalArgumentException("The supplied integer value is " +
+ "too large to be a codepoint.");
// Simple binary search for the correct block.
int low = 0;
int hi = sets.length - 1;
@@ -278,7 +278,7 @@ public final class Character implements Serializable, Comparable<Character>
return SURROGATES_AREA;
break;
case CONSTANT:
- if (usCollator.compare(blockName, "SURROGATES_AREA") == 0)
+ if (usCollator.compare(blockName, "SURROGATES_AREA") == 0)
return SURROGATES_AREA;
break;
}
@@ -292,12 +292,12 @@ public final class Character implements Serializable, Comparable<Character>
break;
case NO_SPACES:
for (UnicodeBlock block : sets)
- {
- String nsName = block.canonicalName.replaceAll(" ","");
- if (usCollator.compare(blockName, nsName) == 0)
- return block;
- }
- break;
+ {
+ String nsName = block.canonicalName.replaceAll(" ","");
+ if (usCollator.compare(blockName, nsName) == 0)
+ return block;
+ }
+ break;
case CONSTANT:
for (UnicodeBlock block : sets)
if (usCollator.compare(blockName, block.toString()) == 0)
@@ -314,7 +314,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BASIC_LATIN
= new UnicodeBlock(0x0000, 0x007F,
- "BASIC_LATIN",
+ "BASIC_LATIN",
"Basic Latin");
/**
@@ -323,7 +323,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LATIN_1_SUPPLEMENT
= new UnicodeBlock(0x0080, 0x00FF,
- "LATIN_1_SUPPLEMENT",
+ "LATIN_1_SUPPLEMENT",
"Latin-1 Supplement");
/**
@@ -332,7 +332,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LATIN_EXTENDED_A
= new UnicodeBlock(0x0100, 0x017F,
- "LATIN_EXTENDED_A",
+ "LATIN_EXTENDED_A",
"Latin Extended-A");
/**
@@ -341,7 +341,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LATIN_EXTENDED_B
= new UnicodeBlock(0x0180, 0x024F,
- "LATIN_EXTENDED_B",
+ "LATIN_EXTENDED_B",
"Latin Extended-B");
/**
@@ -350,7 +350,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock IPA_EXTENSIONS
= new UnicodeBlock(0x0250, 0x02AF,
- "IPA_EXTENSIONS",
+ "IPA_EXTENSIONS",
"IPA Extensions");
/**
@@ -359,7 +359,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SPACING_MODIFIER_LETTERS
= new UnicodeBlock(0x02B0, 0x02FF,
- "SPACING_MODIFIER_LETTERS",
+ "SPACING_MODIFIER_LETTERS",
"Spacing Modifier Letters");
/**
@@ -368,7 +368,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock COMBINING_DIACRITICAL_MARKS
= new UnicodeBlock(0x0300, 0x036F,
- "COMBINING_DIACRITICAL_MARKS",
+ "COMBINING_DIACRITICAL_MARKS",
"Combining Diacritical Marks");
/**
@@ -377,7 +377,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GREEK
= new UnicodeBlock(0x0370, 0x03FF,
- "GREEK",
+ "GREEK",
"Greek");
/**
@@ -386,7 +386,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CYRILLIC
= new UnicodeBlock(0x0400, 0x04FF,
- "CYRILLIC",
+ "CYRILLIC",
"Cyrillic");
/**
@@ -396,7 +396,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CYRILLIC_SUPPLEMENTARY
= new UnicodeBlock(0x0500, 0x052F,
- "CYRILLIC_SUPPLEMENTARY",
+ "CYRILLIC_SUPPLEMENTARY",
"Cyrillic Supplementary");
/**
@@ -405,7 +405,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ARMENIAN
= new UnicodeBlock(0x0530, 0x058F,
- "ARMENIAN",
+ "ARMENIAN",
"Armenian");
/**
@@ -414,7 +414,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HEBREW
= new UnicodeBlock(0x0590, 0x05FF,
- "HEBREW",
+ "HEBREW",
"Hebrew");
/**
@@ -423,7 +423,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ARABIC
= new UnicodeBlock(0x0600, 0x06FF,
- "ARABIC",
+ "ARABIC",
"Arabic");
/**
@@ -433,7 +433,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SYRIAC
= new UnicodeBlock(0x0700, 0x074F,
- "SYRIAC",
+ "SYRIAC",
"Syriac");
/**
@@ -443,7 +443,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock THAANA
= new UnicodeBlock(0x0780, 0x07BF,
- "THAANA",
+ "THAANA",
"Thaana");
/**
@@ -452,7 +452,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock DEVANAGARI
= new UnicodeBlock(0x0900, 0x097F,
- "DEVANAGARI",
+ "DEVANAGARI",
"Devanagari");
/**
@@ -461,7 +461,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BENGALI
= new UnicodeBlock(0x0980, 0x09FF,
- "BENGALI",
+ "BENGALI",
"Bengali");
/**
@@ -470,7 +470,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GURMUKHI
= new UnicodeBlock(0x0A00, 0x0A7F,
- "GURMUKHI",
+ "GURMUKHI",
"Gurmukhi");
/**
@@ -479,7 +479,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GUJARATI
= new UnicodeBlock(0x0A80, 0x0AFF,
- "GUJARATI",
+ "GUJARATI",
"Gujarati");
/**
@@ -488,7 +488,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ORIYA
= new UnicodeBlock(0x0B00, 0x0B7F,
- "ORIYA",
+ "ORIYA",
"Oriya");
/**
@@ -497,7 +497,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TAMIL
= new UnicodeBlock(0x0B80, 0x0BFF,
- "TAMIL",
+ "TAMIL",
"Tamil");
/**
@@ -506,7 +506,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TELUGU
= new UnicodeBlock(0x0C00, 0x0C7F,
- "TELUGU",
+ "TELUGU",
"Telugu");
/**
@@ -515,7 +515,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock KANNADA
= new UnicodeBlock(0x0C80, 0x0CFF,
- "KANNADA",
+ "KANNADA",
"Kannada");
/**
@@ -524,7 +524,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MALAYALAM
= new UnicodeBlock(0x0D00, 0x0D7F,
- "MALAYALAM",
+ "MALAYALAM",
"Malayalam");
/**
@@ -534,7 +534,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SINHALA
= new UnicodeBlock(0x0D80, 0x0DFF,
- "SINHALA",
+ "SINHALA",
"Sinhala");
/**
@@ -543,7 +543,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock THAI
= new UnicodeBlock(0x0E00, 0x0E7F,
- "THAI",
+ "THAI",
"Thai");
/**
@@ -552,7 +552,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LAO
= new UnicodeBlock(0x0E80, 0x0EFF,
- "LAO",
+ "LAO",
"Lao");
/**
@@ -561,7 +561,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TIBETAN
= new UnicodeBlock(0x0F00, 0x0FFF,
- "TIBETAN",
+ "TIBETAN",
"Tibetan");
/**
@@ -571,7 +571,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MYANMAR
= new UnicodeBlock(0x1000, 0x109F,
- "MYANMAR",
+ "MYANMAR",
"Myanmar");
/**
@@ -580,7 +580,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GEORGIAN
= new UnicodeBlock(0x10A0, 0x10FF,
- "GEORGIAN",
+ "GEORGIAN",
"Georgian");
/**
@@ -589,7 +589,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HANGUL_JAMO
= new UnicodeBlock(0x1100, 0x11FF,
- "HANGUL_JAMO",
+ "HANGUL_JAMO",
"Hangul Jamo");
/**
@@ -599,7 +599,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ETHIOPIC
= new UnicodeBlock(0x1200, 0x137F,
- "ETHIOPIC",
+ "ETHIOPIC",
"Ethiopic");
/**
@@ -609,7 +609,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CHEROKEE
= new UnicodeBlock(0x13A0, 0x13FF,
- "CHEROKEE",
+ "CHEROKEE",
"Cherokee");
/**
@@ -619,7 +619,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS
= new UnicodeBlock(0x1400, 0x167F,
- "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS",
+ "UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS",
"Unified Canadian Aboriginal Syllabics");
/**
@@ -629,7 +629,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock OGHAM
= new UnicodeBlock(0x1680, 0x169F,
- "OGHAM",
+ "OGHAM",
"Ogham");
/**
@@ -639,7 +639,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock RUNIC
= new UnicodeBlock(0x16A0, 0x16FF,
- "RUNIC",
+ "RUNIC",
"Runic");
/**
@@ -649,7 +649,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TAGALOG
= new UnicodeBlock(0x1700, 0x171F,
- "TAGALOG",
+ "TAGALOG",
"Tagalog");
/**
@@ -659,7 +659,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HANUNOO
= new UnicodeBlock(0x1720, 0x173F,
- "HANUNOO",
+ "HANUNOO",
"Hanunoo");
/**
@@ -669,7 +669,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BUHID
= new UnicodeBlock(0x1740, 0x175F,
- "BUHID",
+ "BUHID",
"Buhid");
/**
@@ -679,7 +679,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TAGBANWA
= new UnicodeBlock(0x1760, 0x177F,
- "TAGBANWA",
+ "TAGBANWA",
"Tagbanwa");
/**
@@ -689,7 +689,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock KHMER
= new UnicodeBlock(0x1780, 0x17FF,
- "KHMER",
+ "KHMER",
"Khmer");
/**
@@ -699,7 +699,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MONGOLIAN
= new UnicodeBlock(0x1800, 0x18AF,
- "MONGOLIAN",
+ "MONGOLIAN",
"Mongolian");
/**
@@ -709,7 +709,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LIMBU
= new UnicodeBlock(0x1900, 0x194F,
- "LIMBU",
+ "LIMBU",
"Limbu");
/**
@@ -719,7 +719,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TAI_LE
= new UnicodeBlock(0x1950, 0x197F,
- "TAI_LE",
+ "TAI_LE",
"Tai Le");
/**
@@ -729,7 +729,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock KHMER_SYMBOLS
= new UnicodeBlock(0x19E0, 0x19FF,
- "KHMER_SYMBOLS",
+ "KHMER_SYMBOLS",
"Khmer Symbols");
/**
@@ -739,7 +739,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock PHONETIC_EXTENSIONS
= new UnicodeBlock(0x1D00, 0x1D7F,
- "PHONETIC_EXTENSIONS",
+ "PHONETIC_EXTENSIONS",
"Phonetic Extensions");
/**
@@ -748,7 +748,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LATIN_EXTENDED_ADDITIONAL
= new UnicodeBlock(0x1E00, 0x1EFF,
- "LATIN_EXTENDED_ADDITIONAL",
+ "LATIN_EXTENDED_ADDITIONAL",
"Latin Extended Additional");
/**
@@ -757,7 +757,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GREEK_EXTENDED
= new UnicodeBlock(0x1F00, 0x1FFF,
- "GREEK_EXTENDED",
+ "GREEK_EXTENDED",
"Greek Extended");
/**
@@ -766,7 +766,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GENERAL_PUNCTUATION
= new UnicodeBlock(0x2000, 0x206F,
- "GENERAL_PUNCTUATION",
+ "GENERAL_PUNCTUATION",
"General Punctuation");
/**
@@ -775,7 +775,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS
= new UnicodeBlock(0x2070, 0x209F,
- "SUPERSCRIPTS_AND_SUBSCRIPTS",
+ "SUPERSCRIPTS_AND_SUBSCRIPTS",
"Superscripts and Subscripts");
/**
@@ -784,7 +784,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CURRENCY_SYMBOLS
= new UnicodeBlock(0x20A0, 0x20CF,
- "CURRENCY_SYMBOLS",
+ "CURRENCY_SYMBOLS",
"Currency Symbols");
/**
@@ -793,7 +793,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS
= new UnicodeBlock(0x20D0, 0x20FF,
- "COMBINING_MARKS_FOR_SYMBOLS",
+ "COMBINING_MARKS_FOR_SYMBOLS",
"Combining Marks for Symbols");
/**
@@ -802,7 +802,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LETTERLIKE_SYMBOLS
= new UnicodeBlock(0x2100, 0x214F,
- "LETTERLIKE_SYMBOLS",
+ "LETTERLIKE_SYMBOLS",
"Letterlike Symbols");
/**
@@ -811,7 +811,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock NUMBER_FORMS
= new UnicodeBlock(0x2150, 0x218F,
- "NUMBER_FORMS",
+ "NUMBER_FORMS",
"Number Forms");
/**
@@ -820,7 +820,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ARROWS
= new UnicodeBlock(0x2190, 0x21FF,
- "ARROWS",
+ "ARROWS",
"Arrows");
/**
@@ -829,7 +829,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MATHEMATICAL_OPERATORS
= new UnicodeBlock(0x2200, 0x22FF,
- "MATHEMATICAL_OPERATORS",
+ "MATHEMATICAL_OPERATORS",
"Mathematical Operators");
/**
@@ -838,7 +838,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MISCELLANEOUS_TECHNICAL
= new UnicodeBlock(0x2300, 0x23FF,
- "MISCELLANEOUS_TECHNICAL",
+ "MISCELLANEOUS_TECHNICAL",
"Miscellaneous Technical");
/**
@@ -847,7 +847,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CONTROL_PICTURES
= new UnicodeBlock(0x2400, 0x243F,
- "CONTROL_PICTURES",
+ "CONTROL_PICTURES",
"Control Pictures");
/**
@@ -856,7 +856,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock OPTICAL_CHARACTER_RECOGNITION
= new UnicodeBlock(0x2440, 0x245F,
- "OPTICAL_CHARACTER_RECOGNITION",
+ "OPTICAL_CHARACTER_RECOGNITION",
"Optical Character Recognition");
/**
@@ -865,7 +865,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ENCLOSED_ALPHANUMERICS
= new UnicodeBlock(0x2460, 0x24FF,
- "ENCLOSED_ALPHANUMERICS",
+ "ENCLOSED_ALPHANUMERICS",
"Enclosed Alphanumerics");
/**
@@ -874,7 +874,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BOX_DRAWING
= new UnicodeBlock(0x2500, 0x257F,
- "BOX_DRAWING",
+ "BOX_DRAWING",
"Box Drawing");
/**
@@ -883,7 +883,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BLOCK_ELEMENTS
= new UnicodeBlock(0x2580, 0x259F,
- "BLOCK_ELEMENTS",
+ "BLOCK_ELEMENTS",
"Block Elements");
/**
@@ -892,7 +892,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GEOMETRIC_SHAPES
= new UnicodeBlock(0x25A0, 0x25FF,
- "GEOMETRIC_SHAPES",
+ "GEOMETRIC_SHAPES",
"Geometric Shapes");
/**
@@ -901,7 +901,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MISCELLANEOUS_SYMBOLS
= new UnicodeBlock(0x2600, 0x26FF,
- "MISCELLANEOUS_SYMBOLS",
+ "MISCELLANEOUS_SYMBOLS",
"Miscellaneous Symbols");
/**
@@ -910,7 +910,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock DINGBATS
= new UnicodeBlock(0x2700, 0x27BF,
- "DINGBATS",
+ "DINGBATS",
"Dingbats");
/**
@@ -920,7 +920,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A
= new UnicodeBlock(0x27C0, 0x27EF,
- "MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A",
+ "MISCELLANEOUS_MATHEMATICAL_SYMBOLS_A",
"Miscellaneous Mathematical Symbols-A");
/**
@@ -930,7 +930,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SUPPLEMENTAL_ARROWS_A
= new UnicodeBlock(0x27F0, 0x27FF,
- "SUPPLEMENTAL_ARROWS_A",
+ "SUPPLEMENTAL_ARROWS_A",
"Supplemental Arrows-A");
/**
@@ -940,7 +940,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BRAILLE_PATTERNS
= new UnicodeBlock(0x2800, 0x28FF,
- "BRAILLE_PATTERNS",
+ "BRAILLE_PATTERNS",
"Braille Patterns");
/**
@@ -950,7 +950,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SUPPLEMENTAL_ARROWS_B
= new UnicodeBlock(0x2900, 0x297F,
- "SUPPLEMENTAL_ARROWS_B",
+ "SUPPLEMENTAL_ARROWS_B",
"Supplemental Arrows-B");
/**
@@ -960,7 +960,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B
= new UnicodeBlock(0x2980, 0x29FF,
- "MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B",
+ "MISCELLANEOUS_MATHEMATICAL_SYMBOLS_B",
"Miscellaneous Mathematical Symbols-B");
/**
@@ -970,7 +970,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SUPPLEMENTAL_MATHEMATICAL_OPERATORS
= new UnicodeBlock(0x2A00, 0x2AFF,
- "SUPPLEMENTAL_MATHEMATICAL_OPERATORS",
+ "SUPPLEMENTAL_MATHEMATICAL_OPERATORS",
"Supplemental Mathematical Operators");
/**
@@ -980,7 +980,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MISCELLANEOUS_SYMBOLS_AND_ARROWS
= new UnicodeBlock(0x2B00, 0x2BFF,
- "MISCELLANEOUS_SYMBOLS_AND_ARROWS",
+ "MISCELLANEOUS_SYMBOLS_AND_ARROWS",
"Miscellaneous Symbols and Arrows");
/**
@@ -990,7 +990,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_RADICALS_SUPPLEMENT
= new UnicodeBlock(0x2E80, 0x2EFF,
- "CJK_RADICALS_SUPPLEMENT",
+ "CJK_RADICALS_SUPPLEMENT",
"CJK Radicals Supplement");
/**
@@ -1000,7 +1000,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock KANGXI_RADICALS
= new UnicodeBlock(0x2F00, 0x2FDF,
- "KANGXI_RADICALS",
+ "KANGXI_RADICALS",
"Kangxi Radicals");
/**
@@ -1010,7 +1010,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock IDEOGRAPHIC_DESCRIPTION_CHARACTERS
= new UnicodeBlock(0x2FF0, 0x2FFF,
- "IDEOGRAPHIC_DESCRIPTION_CHARACTERS",
+ "IDEOGRAPHIC_DESCRIPTION_CHARACTERS",
"Ideographic Description Characters");
/**
@@ -1019,7 +1019,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION
= new UnicodeBlock(0x3000, 0x303F,
- "CJK_SYMBOLS_AND_PUNCTUATION",
+ "CJK_SYMBOLS_AND_PUNCTUATION",
"CJK Symbols and Punctuation");
/**
@@ -1028,7 +1028,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HIRAGANA
= new UnicodeBlock(0x3040, 0x309F,
- "HIRAGANA",
+ "HIRAGANA",
"Hiragana");
/**
@@ -1037,7 +1037,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock KATAKANA
= new UnicodeBlock(0x30A0, 0x30FF,
- "KATAKANA",
+ "KATAKANA",
"Katakana");
/**
@@ -1046,7 +1046,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BOPOMOFO
= new UnicodeBlock(0x3100, 0x312F,
- "BOPOMOFO",
+ "BOPOMOFO",
"Bopomofo");
/**
@@ -1055,7 +1055,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HANGUL_COMPATIBILITY_JAMO
= new UnicodeBlock(0x3130, 0x318F,
- "HANGUL_COMPATIBILITY_JAMO",
+ "HANGUL_COMPATIBILITY_JAMO",
"Hangul Compatibility Jamo");
/**
@@ -1064,7 +1064,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock KANBUN
= new UnicodeBlock(0x3190, 0x319F,
- "KANBUN",
+ "KANBUN",
"Kanbun");
/**
@@ -1074,7 +1074,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BOPOMOFO_EXTENDED
= new UnicodeBlock(0x31A0, 0x31BF,
- "BOPOMOFO_EXTENDED",
+ "BOPOMOFO_EXTENDED",
"Bopomofo Extended");
/**
@@ -1084,7 +1084,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock KATAKANA_PHONETIC_EXTENSIONS
= new UnicodeBlock(0x31F0, 0x31FF,
- "KATAKANA_PHONETIC_EXTENSIONS",
+ "KATAKANA_PHONETIC_EXTENSIONS",
"Katakana Phonetic Extensions");
/**
@@ -1093,7 +1093,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS
= new UnicodeBlock(0x3200, 0x32FF,
- "ENCLOSED_CJK_LETTERS_AND_MONTHS",
+ "ENCLOSED_CJK_LETTERS_AND_MONTHS",
"Enclosed CJK Letters and Months");
/**
@@ -1102,7 +1102,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_COMPATIBILITY
= new UnicodeBlock(0x3300, 0x33FF,
- "CJK_COMPATIBILITY",
+ "CJK_COMPATIBILITY",
"CJK Compatibility");
/**
@@ -1112,7 +1112,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
= new UnicodeBlock(0x3400, 0x4DBF,
- "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A",
+ "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A",
"CJK Unified Ideographs Extension A");
/**
@@ -1122,7 +1122,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock YIJING_HEXAGRAM_SYMBOLS
= new UnicodeBlock(0x4DC0, 0x4DFF,
- "YIJING_HEXAGRAM_SYMBOLS",
+ "YIJING_HEXAGRAM_SYMBOLS",
"Yijing Hexagram Symbols");
/**
@@ -1131,7 +1131,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS
= new UnicodeBlock(0x4E00, 0x9FFF,
- "CJK_UNIFIED_IDEOGRAPHS",
+ "CJK_UNIFIED_IDEOGRAPHS",
"CJK Unified Ideographs");
/**
@@ -1141,7 +1141,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock YI_SYLLABLES
= new UnicodeBlock(0xA000, 0xA48F,
- "YI_SYLLABLES",
+ "YI_SYLLABLES",
"Yi Syllables");
/**
@@ -1151,7 +1151,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock YI_RADICALS
= new UnicodeBlock(0xA490, 0xA4CF,
- "YI_RADICALS",
+ "YI_RADICALS",
"Yi Radicals");
/**
@@ -1160,7 +1160,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HANGUL_SYLLABLES
= new UnicodeBlock(0xAC00, 0xD7AF,
- "HANGUL_SYLLABLES",
+ "HANGUL_SYLLABLES",
"Hangul Syllables");
/**
@@ -1170,7 +1170,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HIGH_SURROGATES
= new UnicodeBlock(0xD800, 0xDB7F,
- "HIGH_SURROGATES",
+ "HIGH_SURROGATES",
"High Surrogates");
/**
@@ -1180,7 +1180,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HIGH_PRIVATE_USE_SURROGATES
= new UnicodeBlock(0xDB80, 0xDBFF,
- "HIGH_PRIVATE_USE_SURROGATES",
+ "HIGH_PRIVATE_USE_SURROGATES",
"High Private Use Surrogates");
/**
@@ -1190,7 +1190,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LOW_SURROGATES
= new UnicodeBlock(0xDC00, 0xDFFF,
- "LOW_SURROGATES",
+ "LOW_SURROGATES",
"Low Surrogates");
/**
@@ -1199,7 +1199,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock PRIVATE_USE_AREA
= new UnicodeBlock(0xE000, 0xF8FF,
- "PRIVATE_USE_AREA",
+ "PRIVATE_USE_AREA",
"Private Use Area");
/**
@@ -1208,7 +1208,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS
= new UnicodeBlock(0xF900, 0xFAFF,
- "CJK_COMPATIBILITY_IDEOGRAPHS",
+ "CJK_COMPATIBILITY_IDEOGRAPHS",
"CJK Compatibility Ideographs");
/**
@@ -1217,7 +1217,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ALPHABETIC_PRESENTATION_FORMS
= new UnicodeBlock(0xFB00, 0xFB4F,
- "ALPHABETIC_PRESENTATION_FORMS",
+ "ALPHABETIC_PRESENTATION_FORMS",
"Alphabetic Presentation Forms");
/**
@@ -1226,7 +1226,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_A
= new UnicodeBlock(0xFB50, 0xFDFF,
- "ARABIC_PRESENTATION_FORMS_A",
+ "ARABIC_PRESENTATION_FORMS_A",
"Arabic Presentation Forms-A");
/**
@@ -1236,7 +1236,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock VARIATION_SELECTORS
= new UnicodeBlock(0xFE00, 0xFE0F,
- "VARIATION_SELECTORS",
+ "VARIATION_SELECTORS",
"Variation Selectors");
/**
@@ -1245,7 +1245,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock COMBINING_HALF_MARKS
= new UnicodeBlock(0xFE20, 0xFE2F,
- "COMBINING_HALF_MARKS",
+ "COMBINING_HALF_MARKS",
"Combining Half Marks");
/**
@@ -1254,7 +1254,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_COMPATIBILITY_FORMS
= new UnicodeBlock(0xFE30, 0xFE4F,
- "CJK_COMPATIBILITY_FORMS",
+ "CJK_COMPATIBILITY_FORMS",
"CJK Compatibility Forms");
/**
@@ -1263,7 +1263,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SMALL_FORM_VARIANTS
= new UnicodeBlock(0xFE50, 0xFE6F,
- "SMALL_FORM_VARIANTS",
+ "SMALL_FORM_VARIANTS",
"Small Form Variants");
/**
@@ -1272,7 +1272,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock ARABIC_PRESENTATION_FORMS_B
= new UnicodeBlock(0xFE70, 0xFEFF,
- "ARABIC_PRESENTATION_FORMS_B",
+ "ARABIC_PRESENTATION_FORMS_B",
"Arabic Presentation Forms-B");
/**
@@ -1281,7 +1281,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS
= new UnicodeBlock(0xFF00, 0xFFEF,
- "HALFWIDTH_AND_FULLWIDTH_FORMS",
+ "HALFWIDTH_AND_FULLWIDTH_FORMS",
"Halfwidth and Fullwidth Forms");
/**
@@ -1290,7 +1290,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SPECIALS
= new UnicodeBlock(0xFFF0, 0xFFFF,
- "SPECIALS",
+ "SPECIALS",
"Specials");
/**
@@ -1300,7 +1300,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LINEAR_B_SYLLABARY
= new UnicodeBlock(0x10000, 0x1007F,
- "LINEAR_B_SYLLABARY",
+ "LINEAR_B_SYLLABARY",
"Linear B Syllabary");
/**
@@ -1310,7 +1310,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock LINEAR_B_IDEOGRAMS
= new UnicodeBlock(0x10080, 0x100FF,
- "LINEAR_B_IDEOGRAMS",
+ "LINEAR_B_IDEOGRAMS",
"Linear B Ideograms");
/**
@@ -1320,7 +1320,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock AEGEAN_NUMBERS
= new UnicodeBlock(0x10100, 0x1013F,
- "AEGEAN_NUMBERS",
+ "AEGEAN_NUMBERS",
"Aegean Numbers");
/**
@@ -1330,7 +1330,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock OLD_ITALIC
= new UnicodeBlock(0x10300, 0x1032F,
- "OLD_ITALIC",
+ "OLD_ITALIC",
"Old Italic");
/**
@@ -1340,7 +1340,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock GOTHIC
= new UnicodeBlock(0x10330, 0x1034F,
- "GOTHIC",
+ "GOTHIC",
"Gothic");
/**
@@ -1350,7 +1350,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock UGARITIC
= new UnicodeBlock(0x10380, 0x1039F,
- "UGARITIC",
+ "UGARITIC",
"Ugaritic");
/**
@@ -1360,7 +1360,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock DESERET
= new UnicodeBlock(0x10400, 0x1044F,
- "DESERET",
+ "DESERET",
"Deseret");
/**
@@ -1370,7 +1370,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SHAVIAN
= new UnicodeBlock(0x10450, 0x1047F,
- "SHAVIAN",
+ "SHAVIAN",
"Shavian");
/**
@@ -1380,7 +1380,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock OSMANYA
= new UnicodeBlock(0x10480, 0x104AF,
- "OSMANYA",
+ "OSMANYA",
"Osmanya");
/**
@@ -1390,7 +1390,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CYPRIOT_SYLLABARY
= new UnicodeBlock(0x10800, 0x1083F,
- "CYPRIOT_SYLLABARY",
+ "CYPRIOT_SYLLABARY",
"Cypriot Syllabary");
/**
@@ -1400,7 +1400,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock BYZANTINE_MUSICAL_SYMBOLS
= new UnicodeBlock(0x1D000, 0x1D0FF,
- "BYZANTINE_MUSICAL_SYMBOLS",
+ "BYZANTINE_MUSICAL_SYMBOLS",
"Byzantine Musical Symbols");
/**
@@ -1410,7 +1410,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MUSICAL_SYMBOLS
= new UnicodeBlock(0x1D100, 0x1D1FF,
- "MUSICAL_SYMBOLS",
+ "MUSICAL_SYMBOLS",
"Musical Symbols");
/**
@@ -1420,7 +1420,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TAI_XUAN_JING_SYMBOLS
= new UnicodeBlock(0x1D300, 0x1D35F,
- "TAI_XUAN_JING_SYMBOLS",
+ "TAI_XUAN_JING_SYMBOLS",
"Tai Xuan Jing Symbols");
/**
@@ -1430,7 +1430,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock MATHEMATICAL_ALPHANUMERIC_SYMBOLS
= new UnicodeBlock(0x1D400, 0x1D7FF,
- "MATHEMATICAL_ALPHANUMERIC_SYMBOLS",
+ "MATHEMATICAL_ALPHANUMERIC_SYMBOLS",
"Mathematical Alphanumeric Symbols");
/**
@@ -1440,7 +1440,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
= new UnicodeBlock(0x20000, 0x2A6DF,
- "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B",
+ "CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B",
"CJK Unified Ideographs Extension B");
/**
@@ -1450,7 +1450,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT
= new UnicodeBlock(0x2F800, 0x2FA1F,
- "CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT",
+ "CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT",
"CJK Compatibility Ideographs Supplement");
/**
@@ -1460,7 +1460,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock TAGS
= new UnicodeBlock(0xE0000, 0xE007F,
- "TAGS",
+ "TAGS",
"Tags");
/**
@@ -1470,7 +1470,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock VARIATION_SELECTORS_SUPPLEMENT
= new UnicodeBlock(0xE0100, 0xE01EF,
- "VARIATION_SELECTORS_SUPPLEMENT",
+ "VARIATION_SELECTORS_SUPPLEMENT",
"Variation Selectors Supplement");
/**
@@ -1480,7 +1480,7 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_A
= new UnicodeBlock(0xF0000, 0xFFFFF,
- "SUPPLEMENTARY_PRIVATE_USE_AREA_A",
+ "SUPPLEMENTARY_PRIVATE_USE_AREA_A",
"Supplementary Private Use Area-A");
/**
@@ -1490,13 +1490,13 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static final UnicodeBlock SUPPLEMENTARY_PRIVATE_USE_AREA_B
= new UnicodeBlock(0x100000, 0x10FFFF,
- "SUPPLEMENTARY_PRIVATE_USE_AREA_B",
+ "SUPPLEMENTARY_PRIVATE_USE_AREA_B",
"Supplementary Private Use Area-B");
/**
* Surrogates Area.
* 'D800' - 'DFFF'.
- * @deprecated As of 1.5, the three areas,
+ * @deprecated As of 1.5, the three areas,
* <a href="#HIGH_SURROGATES">HIGH_SURROGATES</a>,
* <a href="#HIGH_PRIVATE_USE_SURROGATES">HIGH_PRIVATE_USE_SURROGATES</a>
* and <a href="#LOW_SURROGATES">LOW_SURROGATES</a>, as defined
@@ -1508,7 +1508,7 @@ public final class Character implements Serializable, Comparable<Character>
public static final UnicodeBlock SURROGATES_AREA
= new UnicodeBlock(0xD800, 0xDFFF,
"SURROGATES_AREA",
- "Surrogates Area");
+ "Surrogates Area");
/**
* The defined subsets.
@@ -1643,9 +1643,9 @@ public final class Character implements Serializable, Comparable<Character>
} // class UnicodeBlock
/**
- * A class to encompass all the properties of characters in the
+ * A class to encompass all the properties of characters in the
* private use blocks in the Unicode standard. This class extends
- * UnassignedCharacters because the return type from getType() is
+ * UnassignedCharacters because the return type from getType() is
* different.
* @author Anthony Balkissoon abalkiss at redhat dot com
*
@@ -1657,25 +1657,25 @@ public final class Character implements Serializable, Comparable<Character>
*/
static int getType(int cp)
{
- // The upper 2 code points in any plane are considered unassigned,
+ // The upper 2 code points in any plane are considered unassigned,
// even in the private-use planes.
if ((cp & 0xffff) >= 0xfffe)
return UnassignedCharacters.getType(cp);
return PRIVATE_USE;
}
-
+
/**
* Returns true if the character cp is defined.
*/
static boolean isDefined(int cp)
{
- // The upper 2 code points in any plane are considered unassigned,
+ // The upper 2 code points in any plane are considered unassigned,
// even in the private-use planes.
if ((cp & 0xffff) >= 0xfffe)
return UnassignedCharacters.isDefined(cp);
return true;
}
-
+
/**
* Gets the directionality for the character cp.
*/
@@ -1686,9 +1686,9 @@ public final class Character implements Serializable, Comparable<Character>
return DIRECTIONALITY_LEFT_TO_RIGHT;
}
}
-
+
/**
- * A class to encompass all the properties of code points that are
+ * A class to encompass all the properties of code points that are
* currently undefined in the Unicode standard.
* @author Anthony Balkissoon abalkiss at redhat dot com
*
@@ -1707,7 +1707,7 @@ public final class Character implements Serializable, Comparable<Character>
}
/**
- * Returns the Unicode directionality property for unassigned
+ * Returns the Unicode directionality property for unassigned
* characters.
* @param cp the character
* @return DIRECTIONALITY_UNDEFINED
@@ -1736,9 +1736,9 @@ public final class Character implements Serializable, Comparable<Character>
{
return UNASSIGNED;
}
-
+
/**
- * Returns false to indiciate that the character is not defined in the
+ * Returns false to indiciate that the character is not defined in the
* Unicode standard.
* @param cp the character
* @return false
@@ -1759,7 +1759,7 @@ public final class Character implements Serializable, Comparable<Character>
}
/**
- * Returns false to indicate that the character cannot be ignored
+ * Returns false to indicate that the character cannot be ignored
* within an identifier
* @param cp the character
* @return false
@@ -1770,7 +1770,7 @@ public final class Character implements Serializable, Comparable<Character>
}
/**
- * Returns false to indicate that the character cannot be part of a
+ * Returns false to indicate that the character cannot be part of a
* Java identifier.
* @param cp the character
* @return false
@@ -1781,7 +1781,7 @@ public final class Character implements Serializable, Comparable<Character>
}
/**
- * Returns false to indicate that the character cannot be start a
+ * Returns false to indicate that the character cannot be start a
* Java identifier.
* @param cp the character
* @return false
@@ -1821,7 +1821,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return false;
}
-
+
/**
* Returns false to indicate that the character cannot is not mirrored.
* @param cp the character
@@ -1841,7 +1841,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return false;
}
-
+
/**
* Returns false to indicate that the character it not a titlecase letter.
* @param cp the character
@@ -1851,9 +1851,9 @@ public final class Character implements Serializable, Comparable<Character>
{
return false;
}
-
+
/**
- * Returns false to indicate that the character cannot be part of a
+ * Returns false to indicate that the character cannot be part of a
* Unicode identifier.
* @param cp the character
* @return false
@@ -1864,7 +1864,7 @@ public final class Character implements Serializable, Comparable<Character>
}
/**
- * Returns false to indicate that the character cannot start a
+ * Returns false to indicate that the character cannot start a
* Unicode identifier.
* @param cp the character
* @return false
@@ -1904,7 +1904,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return cp;
}
-
+
/**
* Returns cp to indicate this character has no titlecase conversion.
* @param cp the character
@@ -1923,7 +1923,7 @@ public final class Character implements Serializable, Comparable<Character>
static int toUpperCase(int cp)
{
return cp;
- }
+ }
}
/**
@@ -2014,7 +2014,7 @@ public final class Character implements Serializable, Comparable<Character>
* This value is <code>'\uDFFF'</code>.
* @since 1.5
*/
- public static final char MAX_LOW_SURROGATE = '\uDFFF';
+ public static final char MAX_LOW_SURROGATE = '\uDFFF';
/**
* The minimum Unicode surrogate code unit in the UTF-16 character encoding.
@@ -2034,7 +2034,7 @@ public final class Character implements Serializable, Comparable<Character>
* The lowest possible supplementary Unicode code point (the first code
* point outside the basic multilingual plane (BMP)).
* This value is <code>0x10000</code>.
- */
+ */
public static final int MIN_SUPPLEMENTARY_CODE_POINT = 0x10000;
/**
@@ -2418,7 +2418,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #readCodePoint(int)
* @see CharData#BLOCKS
*/
- private static final char[][] blocks =
+ private static final char[][] blocks =
new char[][]{
String.zeroBasedStringValue(CharData.BLOCKS[0]),
String.zeroBasedStringValue(CharData.BLOCKS[1]),
@@ -2443,7 +2443,7 @@ public final class Character implements Serializable, Comparable<Character>
* of String.value to avoid copying the array.
* @see CharData#DATA
*/
- private static final char[][] data =
+ private static final char[][] data =
new char[][]{
String.zeroBasedStringValue(CharData.DATA[0]),
String.zeroBasedStringValue(CharData.DATA[1]),
@@ -2468,7 +2468,7 @@ public final class Character implements Serializable, Comparable<Character>
* of String.value to avoid copying the array.
* @see CharData#NUM_VALUE
*/
- private static final char[][] numValue =
+ private static final char[][] numValue =
new char[][]{
String.zeroBasedStringValue(CharData.NUM_VALUE[0]),
String.zeroBasedStringValue(CharData.NUM_VALUE[1]),
@@ -2492,8 +2492,8 @@ public final class Character implements Serializable, Comparable<Character>
* Stores unicode uppercase attribute table. Exploit package visibility
* of String.value to avoid copying the array.
* @see CharData#UPPER
- */
- private static final char[][] upper =
+ */
+ private static final char[][] upper =
new char[][]{
String.zeroBasedStringValue(CharData.UPPER[0]),
String.zeroBasedStringValue(CharData.UPPER[1]),
@@ -2518,7 +2518,7 @@ public final class Character implements Serializable, Comparable<Character>
* of String.value to avoid copying the array.
* @see CharData#LOWER
*/
- private static final char[][] lower =
+ private static final char[][] lower =
new char[][]{
String.zeroBasedStringValue(CharData.LOWER[0]),
String.zeroBasedStringValue(CharData.LOWER[1]),
@@ -2544,7 +2544,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see CharData#DIRECTION
*/
// Package visible for use by String.
- static final char[][] direction =
+ static final char[][] direction =
new char[][]{
String.zeroBasedStringValue(CharData.DIRECTION[0]),
String.zeroBasedStringValue(CharData.DIRECTION[1]),
@@ -2569,7 +2569,7 @@ public final class Character implements Serializable, Comparable<Character>
* String.value to avoid copying the array.
* @see CharData#TITLE
*/
- private static final char[] title = String.zeroBasedStringValue(CharData.TITLE);
+ private static final char[] title = String.zeroBasedStringValue(CharData.TITLE);
/**
* Mask for grabbing the type out of the contents of data.
@@ -2698,7 +2698,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isLowerCase((int)ch);
}
-
+
/**
* Determines if a character is a Unicode lowercase letter. For example,
* <code>'a'</code> is lowercase. Returns true if getType() returns
@@ -2712,7 +2712,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isTitleCase(char)
* @see #toLowerCase(char)
* @see #getType(char)
- *
+ *
* @since 1.5
*/
public static boolean isLowerCase(int codePoint)
@@ -2738,7 +2738,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isUpperCase((int)ch);
}
-
+
/**
* Determines if a character is a Unicode uppercase letter. For example,
* <code>'A'</code> is uppercase. Returns true if getType() returns
@@ -2752,7 +2752,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isTitleCase(char)
* @see #toUpperCase(char)
* @see #getType(char)
- *
+ *
* @since 1.5
*/
public static boolean isUpperCase(int codePoint)
@@ -2792,14 +2792,14 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isUpperCase(char)
* @see #toTitleCase(char)
* @see #getType(char)
- *
+ *
* @since 1.5
*/
public static boolean isTitleCase(int codePoint)
{
return getType(codePoint) == TITLECASE_LETTER;
}
-
+
/**
* Determines if a character is a Unicode decimal digit. For example,
@@ -2818,7 +2818,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isDigit((int)ch);
}
-
+
/**
* Determines if a character is a Unicode decimal digit. For example,
* <code>'0'</code> is a digit. A character is a Unicode digit if
@@ -2831,7 +2831,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #digit(char, int)
* @see #forDigit(int, int)
* @see #getType(char)
- *
+ *
* @since 1.5
*/
@@ -2859,7 +2859,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isDefined((int)ch);
}
-
+
/**
* Determines if a character is part of the Unicode Standard. This is an
* evolving standard, but covers every character in the data file.
@@ -2874,7 +2874,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isLowerCase(char)
* @see #isTitleCase(char)
* @see #isUpperCase(char)
- *
+ *
* @since 1.5
*/
public static boolean isDefined(int codePoint)
@@ -2885,7 +2885,7 @@ public final class Character implements Serializable, Comparable<Character>
/**
* Determines if a character is a Unicode letter. Not all letters have case,
* so this may return true when isLowerCase and isUpperCase return false.
- * A character is a Unicode letter if getType() returns one of
+ * A character is a Unicode letter if getType() returns one of
* UPPERCASE_LETTER, LOWERCASE_LETTER, TITLECASE_LETTER, MODIFIER_LETTER,
* or OTHER_LETTER.
* <br>
@@ -2907,11 +2907,11 @@ public final class Character implements Serializable, Comparable<Character>
{
return isLetter((int)ch);
}
-
+
/**
* Determines if a character is a Unicode letter. Not all letters have case,
* so this may return true when isLowerCase and isUpperCase return false.
- * A character is a Unicode letter if getType() returns one of
+ * A character is a Unicode letter if getType() returns one of
* UPPERCASE_LETTER, LOWERCASE_LETTER, TITLECASE_LETTER, MODIFIER_LETTER,
* or OTHER_LETTER.
* <br>
@@ -2928,7 +2928,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isTitleCase(char)
* @see #isUnicodeIdentifierStart(char)
* @see #isUpperCase(char)
- *
+ *
* @since 1.5
*/
public static boolean isLetter(int codePoint)
@@ -2947,17 +2947,17 @@ public final class Character implements Serializable, Comparable<Character>
* @param index the start position in the CharSequence
* @param codePointOffset the number of code points offset from the start
* position
- * @return the index into the CharSequence that is codePointOffset code
+ * @return the index into the CharSequence that is codePointOffset code
* points offset from index
- *
+ *
* @throws NullPointerException if seq is null
* @throws IndexOutOfBoundsException if index is negative or greater than the
* length of the sequence.
- * @throws IndexOutOfBoundsException if codePointOffset is positive and the
+ * @throws IndexOutOfBoundsException if codePointOffset is positive and the
* subsequence from index to the end of seq has fewer than codePointOffset
* code points
* @throws IndexOutOfBoundsException if codePointOffset is negative and the
- * subsequence from the start of seq to index has fewer than
+ * subsequence from the start of seq to index has fewer than
* (-codePointOffset) code points
* @since 1.5
*/
@@ -2968,7 +2968,7 @@ public final class Character implements Serializable, Comparable<Character>
int len = seq.length();
if (index < 0 || index > len)
throw new IndexOutOfBoundsException();
-
+
int numToGo = codePointOffset;
int offset = index;
int adjust = 1;
@@ -2999,7 +2999,7 @@ public final class Character implements Serializable, Comparable<Character>
return offset;
}
}
-
+
/**
* Returns the index into the given char subarray that is offset
* <code>codePointOffset</code> code points from <code>index</code>.
@@ -3010,11 +3010,11 @@ public final class Character implements Serializable, Comparable<Character>
* @param codePointOffset the number of code points offset from <code>index
* </code>
* @return the index into the char array
- *
+ *
* @throws NullPointerException if a is null
* @throws IndexOutOfBoundsException if start or count is negative or if
* start + count is greater than the length of the array
- * @throws IndexOutOfBoundsException if index is less than start or larger
+ * @throws IndexOutOfBoundsException if index is less than start or larger
* than start + count
* @throws IndexOutOfBoundsException if codePointOffset is positive and the
* subarray from index to start + count - 1 has fewer than codePointOffset
@@ -3022,7 +3022,7 @@ public final class Character implements Serializable, Comparable<Character>
* @throws IndexOutOfBoundsException if codePointOffset is negative and the
* subarray from start to index - 1 has fewer than (-codePointOffset) code
* points
- *
+ *
* @since 1.5
*/
public static int offsetByCodePoints(char[] a,
@@ -3035,7 +3035,7 @@ public final class Character implements Serializable, Comparable<Character>
int end = start + count;
if (start < 0 || count < 0 || end > len || index < start || index > end)
throw new IndexOutOfBoundsException();
-
+
int numToGo = codePointOffset;
int offset = index;
int adjust = 1;
@@ -3069,18 +3069,18 @@ public final class Character implements Serializable, Comparable<Character>
}
}
-
+
/**
* Returns the number of Unicode code points in the specified range of the
* given CharSequence. The first char in the range is at position
- * beginIndex and the last one is at position endIndex - 1. Paired
- * surrogates (supplementary characters are represented by a pair of chars -
- * one from the high surrogates and one from the low surrogates)
+ * beginIndex and the last one is at position endIndex - 1. Paired
+ * surrogates (supplementary characters are represented by a pair of chars -
+ * one from the high surrogates and one from the low surrogates)
* count as just one code point.
* @param seq the CharSequence to inspect
* @param beginIndex the beginning of the range
* @param endIndex the end of the range
- * @return the number of Unicode code points in the given range of the
+ * @return the number of Unicode code points in the given range of the
* sequence
* @throws NullPointerException if seq is null
* @throws IndexOutOfBoundsException if beginIndex is negative, endIndex is
@@ -3093,7 +3093,7 @@ public final class Character implements Serializable, Comparable<Character>
int len = seq.length();
if (beginIndex < 0 || endIndex > len || beginIndex > endIndex)
throw new IndexOutOfBoundsException();
-
+
int count = 0;
for (int i = beginIndex; i < endIndex; i++)
{
@@ -3102,24 +3102,24 @@ public final class Character implements Serializable, Comparable<Character>
if (isHighSurrogate(seq.charAt(i)) && (i + 1) < endIndex
&& isLowSurrogate(seq.charAt(i + 1)))
i ++;
- }
+ }
return count;
}
-
+
/**
* Returns the number of Unicode code points in the specified range of the
* given char array. The first char in the range is at position
* offset and the length of the range is count. Paired surrogates
- * (supplementary characters are represented by a pair of chars -
- * one from the high surrogates and one from the low surrogates)
+ * (supplementary characters are represented by a pair of chars -
+ * one from the high surrogates and one from the low surrogates)
* count as just one code point.
* @param a the char array to inspect
* @param offset the beginning of the range
* @param count the length of the range
- * @return the number of Unicode code points in the given range of the
+ * @return the number of Unicode code points in the given range of the
* array
* @throws NullPointerException if a is null
- * @throws IndexOutOfBoundsException if offset or count is negative or if
+ * @throws IndexOutOfBoundsException if offset or count is negative or if
* offset + countendIndex is larger than the length of a.
* @since 1.5
*/
@@ -3130,7 +3130,7 @@ public final class Character implements Serializable, Comparable<Character>
int end = offset + count;
if (offset < 0 || count < 0 || end > len)
throw new IndexOutOfBoundsException();
-
+
int counter = 0;
for (int i = offset; i < end; i++)
{
@@ -3139,7 +3139,7 @@ public final class Character implements Serializable, Comparable<Character>
if (isHighSurrogate(a[i]) && (i + 1) < end
&& isLowSurrogate(a[i + 1]))
i ++;
- }
+ }
return counter;
}
@@ -3177,7 +3177,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isJavaLetterOrDigit(char)
* @see #isLetter(char)
* @see #isUnicodeIdentifierPart(char)
- *
+ *
* @since 1.5
*/
public static boolean isLetterOrDigit(int codePoint)
@@ -3190,7 +3190,7 @@ public final class Character implements Serializable, Comparable<Character>
| (1 << OTHER_LETTER)
| (1 << DECIMAL_DIGIT_NUMBER))) != 0;
}
-
+
/**
* Determines if a character can start a Java identifier. This is the
* combination of isLetter, any character where getType returns
@@ -3306,7 +3306,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isJavaIdentifierPart((int)ch);
}
-
+
/**
* Determines if a character can follow the first letter in
* a Java identifier. This is the combination of isJavaLetter (isLetter,
@@ -3411,7 +3411,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isUnicodeIdentifierPart((int)ch);
}
-
+
/**
* Determines if a character can follow the first letter in
* a Unicode identifier. This includes letters, connecting punctuation,
@@ -3512,7 +3512,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return (char) (lower[0][readCodePoint((int)ch) >>> 7] + ch);
}
-
+
/**
* Converts a Unicode character into its lowercase equivalent mapping.
* If a mapping does not exist, then the character passed is returned.
@@ -3525,7 +3525,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isUpperCase(char)
* @see #toTitleCase(char)
* @see #toUpperCase(char)
- *
+ *
* @since 1.5
*/
public static int toLowerCase(int codePoint)
@@ -3537,7 +3537,7 @@ public final class Character implements Serializable, Comparable<Character>
return UnassignedCharacters.toLowerCase(codePoint);
if (plane > 14)
return PrivateUseCharacters.toLowerCase(codePoint);
-
+
// The short value stored in lower[plane] is the signed difference between
// codePoint and its lowercase conversion.
return ((short)lower[plane][readCodePoint(codePoint) >>> 7]) + codePoint;
@@ -3560,7 +3560,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return (char) (upper[0][readCodePoint((int)ch) >>> 7] + ch);
}
-
+
/**
* Converts a Unicode character into its uppercase equivalent mapping.
* If a mapping does not exist, then the character passed is returned.
@@ -3573,7 +3573,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isUpperCase(char)
* @see #toLowerCase(char)
* @see #toTitleCase(char)
- *
+ *
* @since 1.5
*/
public static int toUpperCase(int codePoint)
@@ -3585,7 +3585,7 @@ public final class Character implements Serializable, Comparable<Character>
return UnassignedCharacters.toUpperCase(codePoint);
if (plane > 14)
return PrivateUseCharacters.toUpperCase(codePoint);
-
+
// The short value stored in upper[plane] is the signed difference between
// codePoint and its uppercase conversion.
return ((short)upper[plane][readCodePoint(codePoint) >>> 7]) + codePoint;
@@ -3623,7 +3623,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #isTitleCase(char)
* @see #toLowerCase(char)
* @see #toUpperCase(char)
- *
+ *
* @since 1.5
*/
public static int toTitleCase(int codePoint)
@@ -3693,7 +3693,7 @@ public final class Character implements Serializable, Comparable<Character>
{
if (radix < MIN_RADIX || radix > MAX_RADIX)
return -1;
-
+
// If the code point is unassigned or in one of the private use areas
// then we delegate the call to the appropriate private static inner class.
int plane = codePoint >>> 16;
@@ -3709,8 +3709,8 @@ public final class Character implements Serializable, Comparable<Character>
{
// Signedness doesn't matter; 0xffff vs. -1 are both rejected.
int digit = numValue[plane][attr >> 7];
-
- // If digit is less than or equal to -3 then the numerical value was
+
+ // If digit is less than or equal to -3 then the numerical value was
// too large to fit into numValue and is stored in CharData.LARGENUMS.
if (digit <= -3)
digit = CharData.LARGENUMS[-digit - 3];
@@ -3718,7 +3718,7 @@ public final class Character implements Serializable, Comparable<Character>
}
return -1;
}
-
+
/**
* Returns the Unicode numeric value property of a character. For example,
* <code>'\\u216C'</code> (the Roman numeral fifty) returns 50.
@@ -3751,7 +3751,7 @@ public final class Character implements Serializable, Comparable<Character>
// Treat numValue as signed.
return (short) numValue[0][readCodePoint((int)ch) >> 7];
}
-
+
/**
* Returns the Unicode numeric value property of a character. For example,
* <code>'\\u216C'</code> (the Roman numeral fifty) returns 50.
@@ -3788,9 +3788,9 @@ public final class Character implements Serializable, Comparable<Character>
return UnassignedCharacters.getNumericValue(codePoint);
if (plane > 14)
return PrivateUseCharacters.getNumericValue(codePoint);
-
+
// If the value N found in numValue[plane] is less than or equal to -3
- // then the numeric value was too big to fit into 16 bits and is
+ // then the numeric value was too big to fit into 16 bits and is
// stored in CharData.LARGENUMS at offset (-N - 3).
short num = (short)numValue[plane][readCodePoint(codePoint) >> 7];
if (num <= -3)
@@ -3837,7 +3837,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isSpaceChar((int)ch);
}
-
+
/**
* Determines if a character is a Unicode space character. This includes
* SPACE_SEPARATOR, LINE_SEPARATOR, and PARAGRAPH_SEPARATOR.
@@ -3878,7 +3878,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return isWhitespace((int) ch);
}
-
+
/**
* Determines if a character is Java whitespace. This includes Unicode
* space characters (SPACE_SEPARATOR, LINE_SEPARATOR, and
@@ -3903,7 +3903,7 @@ public final class Character implements Serializable, Comparable<Character>
return UnassignedCharacters.isWhiteSpace(codePoint);
if (plane > 14)
return PrivateUseCharacters.isWhiteSpace(codePoint);
-
+
int attr = readCodePoint(codePoint);
return ((((1 << (attr & TYPE_MASK))
& ((1 << SPACE_SEPARATOR)
@@ -3937,14 +3937,14 @@ public final class Character implements Serializable, Comparable<Character>
{
return isISOControl((int)ch);
}
-
+
/**
* Determines if the character is an ISO Control character. This is true
* if the code point is in the range [0, 0x001F] or if it is in the range
* [0x007F, 0x009F].
* @param codePoint the character to check
* @return true if the character is in one of the above ranges
- *
+ *
* @since 1.5
*/
public static boolean isISOControl(int codePoint)
@@ -3952,7 +3952,7 @@ public final class Character implements Serializable, Comparable<Character>
if ((codePoint >= 0 && codePoint <= 0x001F)
|| (codePoint >= 0x007F && codePoint <= 0x009F))
return true;
- return false;
+ return false;
}
/**
@@ -3996,7 +3996,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return getType((int)ch);
}
-
+
/**
* Returns the Unicode general category property of a character.
*
@@ -4032,7 +4032,7 @@ public final class Character implements Serializable, Comparable<Character>
* @see #MODIFIER_SYMBOL
* @see #INITIAL_QUOTE_PUNCTUATION
* @see #FINAL_QUOTE_PUNCTUATION
- *
+ *
* @since 1.5
*/
public static int getType(int codePoint)
@@ -4044,7 +4044,7 @@ public final class Character implements Serializable, Comparable<Character>
return UnassignedCharacters.getType(codePoint);
if (plane > 14)
return PrivateUseCharacters.getType(codePoint);
-
+
return readCodePoint(codePoint) & TYPE_MASK;
}
@@ -4105,7 +4105,7 @@ public final class Character implements Serializable, Comparable<Character>
return getDirectionality((int)ch);
}
-
+
/**
* Returns the Unicode directionality property of the character. This
* is used in the visual ordering of text.
@@ -4143,11 +4143,11 @@ public final class Character implements Serializable, Comparable<Character>
return UnassignedCharacters.getDirectionality(codePoint);
if (plane > 14)
return PrivateUseCharacters.getDirectionality(codePoint);
-
+
// The result will correctly be signed.
return (byte) (direction[plane][readCodePoint(codePoint) >> 7] >> 2);
}
-
+
/**
* Determines whether the character is mirrored according to Unicode. For
* example, <code>\u0028</code> (LEFT PARENTHESIS) appears as '(' in
@@ -4161,7 +4161,7 @@ public final class Character implements Serializable, Comparable<Character>
{
return (readCodePoint((int)ch) & MIRROR_MASK) != 0;
}
-
+
/**
* Determines whether the character is mirrored according to Unicode. For
* example, <code>\u0028</code> (LEFT PARENTHESIS) appears as '(' in
@@ -4180,7 +4180,7 @@ public final class Character implements Serializable, Comparable<Character>
return UnassignedCharacters.isMirrored(codePoint);
if (plane > 14)
return PrivateUseCharacters.isMirrored(codePoint);
-
+
return (readCodePoint(codePoint) & MIRROR_MASK) != 0;
}
@@ -4229,7 +4229,7 @@ public final class Character implements Serializable, Comparable<Character>
/**
* Converts a unicode code point to a UTF-16 representation of that
* code point.
- *
+ *
* @param codePoint the unicode code point
*
* @return the UTF-16 representation of that code point
@@ -4288,7 +4288,7 @@ public final class Character implements Serializable, Comparable<Character>
else
{
dst[dstIndex] = (char) codePoint;
- result = 1;
+ result = 1;
}
return result;
}
@@ -4305,9 +4305,9 @@ public final class Character implements Serializable, Comparable<Character>
*/
public static int charCount(int codePoint)
{
- return
- (codePoint >= MIN_SUPPLEMENTARY_CODE_POINT)
- ? 2
+ return
+ (codePoint >= MIN_SUPPLEMENTARY_CODE_POINT)
+ ? 2
: 1;
}
@@ -4510,7 +4510,7 @@ public final class Character implements Serializable, Comparable<Character>
public static int codePointBefore(char[] chars, int index, int start)
{
if (index < start || index > chars.length
- || start < 0 || start >= chars.length)
+ || start < 0 || start >= chars.length)
throw new IndexOutOfBoundsException();
--index;
char low = chars[index];
diff --git a/java/lang/Class.java b/java/lang/Class.java
index 0aafe80f8..1caee0147 100644
--- a/java/lang/Class.java
+++ b/java/lang/Class.java
@@ -99,7 +99,7 @@ import java.util.LinkedHashSet;
* @since 1.0
* @see ClassLoader
*/
-public final class Class<T>
+public final class Class<T>
implements Serializable, Type, AnnotatedElement, GenericDeclaration
{
/**
@@ -215,7 +215,7 @@ public final class Class<T>
* @since 1.2
*/
public static Class<?> forName(String name, boolean initialize,
- ClassLoader classloader)
+ ClassLoader classloader)
throws ClassNotFoundException
{
if (classloader == null)
@@ -232,7 +232,7 @@ public final class Class<T>
}
return (Class<?>) VMClass.forName(name, initialize, classloader);
}
-
+
/**
* Get all the public member classes and interfaces declared in this
* class or inherited from superclasses. This returns an array of length
@@ -263,7 +263,7 @@ public final class Class<T>
list.addAll(Arrays.asList(superClass.internalGetClasses()));
return list.toArray(new Class<?>[list.size()]);
}
-
+
/**
* Get the ClassLoader that loaded this class. If the class was loaded
* by the bootstrap classloader, this method will return null.
@@ -288,7 +288,7 @@ public final class Class<T>
if (loader != null && sm != null)
{
// Get the calling classloader
- ClassLoader cl = VMStackWalker.getCallingClassLoader();
+ ClassLoader cl = VMStackWalker.getCallingClassLoader();
if (cl != null && !cl.isAncestorOf(loader))
sm.checkPermission(new RuntimePermission("getClassLoader"));
}
@@ -331,9 +331,9 @@ public final class Class<T>
Constructor[] constructors = getDeclaredConstructors(true);
for (int i = 0; i < constructors.length; i++)
{
- Constructor constructor = constructors[i];
- if (matchParameters(types, constructor.getParameterTypes()))
- return constructor;
+ Constructor constructor = constructors[i];
+ if (matchParameters(types, constructor.getParameterTypes()))
+ return constructor;
}
throw new NoSuchMethodException();
}
@@ -377,9 +377,9 @@ public final class Class<T>
Constructor[] constructors = getDeclaredConstructors(false);
for (int i = 0; i < constructors.length; i++)
{
- Constructor constructor = constructors[i];
- if (matchParameters(types, constructor.getParameterTypes()))
- return constructor;
+ Constructor constructor = constructors[i];
+ if (matchParameters(types, constructor.getParameterTypes()))
+ return constructor;
}
throw new NoSuchMethodException();
}
@@ -429,7 +429,7 @@ public final class Class<T>
{
return VMClass.getDeclaredConstructors (this, publicOnly);
}
-
+
/**
* Get a field declared in this class, where name is its simple name. The
* implicit length field of arrays is not available. A security check may
@@ -449,8 +449,8 @@ public final class Class<T>
Field[] fields = getDeclaredFields(false);
for (int i = 0; i < fields.length; i++)
{
- if (fields[i].getName().equals(name))
- return fields[i];
+ if (fields[i].getName().equals(name))
+ return fields[i];
}
throw new NoSuchFieldException();
}
@@ -535,7 +535,7 @@ public final class Class<T>
{
return VMClass.getDeclaredMethods (this, publicOnly);
}
-
+
/**
* If this is a nested or inner class, return the class that declared it.
* If not, return null.
@@ -643,7 +643,7 @@ public final class Class<T>
private Class[] params;
private Class returnType;
private int hash;
-
+
MethodKey(Method m)
{
name = m.getName();
@@ -651,36 +651,36 @@ public final class Class<T>
returnType = m.getReturnType();
hash = name.hashCode() ^ returnType.hashCode();
for(int i = 0; i < params.length; i++)
- {
- hash ^= params[i].hashCode();
- }
+ {
+ hash ^= params[i].hashCode();
+ }
}
-
+
public boolean equals(Object o)
{
if (o instanceof MethodKey)
- {
- MethodKey m = (MethodKey) o;
- if (m.name.equals(name) && m.params.length == params.length
- && m.returnType == returnType)
- {
- for (int i = 0; i < params.length; i++)
- {
- if (m.params[i] != params[i])
- return false;
- }
- return true;
- }
- }
+ {
+ MethodKey m = (MethodKey) o;
+ if (m.name.equals(name) && m.params.length == params.length
+ && m.returnType == returnType)
+ {
+ for (int i = 0; i < params.length; i++)
+ {
+ if (m.params[i] != params[i])
+ return false;
+ }
+ return true;
+ }
+ }
return false;
}
-
+
public int hashCode()
{
return hash;
}
}
-
+
/**
* Get a public method declared or inherited in this class, where name is
* its simple name. The implicit methods of Object are not available from
@@ -725,21 +725,21 @@ public final class Class<T>
Class superClass = getSuperclass();
if (superClass != null)
{
- match = superClass.internalGetMethod(methodName, args);
- if(match != null)
- return match;
+ match = superClass.internalGetMethod(methodName, args);
+ if(match != null)
+ return match;
}
Class[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++)
{
- match = interfaces[i].internalGetMethod(methodName, args);
- if (match != null)
- return match;
+ match = interfaces[i].internalGetMethod(methodName, args);
+ if (match != null)
+ return match;
}
return null;
}
- /**
+ /**
* Find the best matching method in <code>list</code> according to
* the definition of ``best matching'' used by <code>getMethod()</code>
*
@@ -756,14 +756,14 @@ public final class Class<T>
Method match = null;
for (int i = 0; i < list.length; i++)
{
- Method method = list[i];
- if (!method.getName().equals(name))
- continue;
- if (!matchParameters(args, method.getParameterTypes()))
- continue;
- if (match == null
- || match.getReturnType().isAssignableFrom(method.getReturnType()))
- match = method;
+ Method method = list[i];
+ if (!method.getName().equals(name))
+ continue;
+ if (!matchParameters(args, method.getParameterTypes()))
+ continue;
+ if (match == null
+ || match.getReturnType().isAssignableFrom(method.getReturnType()))
+ match = method;
}
return match;
}
@@ -783,12 +783,12 @@ public final class Class<T>
return false;
for (int i = 0; i < types1.length; i++)
{
- if (types1[i] != types2[i])
- return false;
+ if (types1[i] != types2[i])
+ return false;
}
return true;
}
-
+
/**
* Get all the public methods declared in this class or inherited from
* superclasses. This returns an array of length 0 if there are no methods,
@@ -825,25 +825,25 @@ public final class Class<T>
Class[] interfaces = getInterfaces();
for(int i = 0; i < interfaces.length; i++)
{
- methods = interfaces[i].internalGetMethods();
- for(int j = 0; j < methods.length; j++)
- {
- map.put(new MethodKey(methods[j]), methods[j]);
- }
+ methods = interfaces[i].internalGetMethods();
+ for(int j = 0; j < methods.length; j++)
+ {
+ map.put(new MethodKey(methods[j]), methods[j]);
+ }
}
Class superClass = getSuperclass();
if(superClass != null)
{
- methods = superClass.internalGetMethods();
- for(int i = 0; i < methods.length; i++)
- {
- map.put(new MethodKey(methods[i]), methods[i]);
- }
+ methods = superClass.internalGetMethods();
+ for(int i = 0; i < methods.length; i++)
+ {
+ map.put(new MethodKey(methods[i]), methods[i]);
+ }
}
methods = getDeclaredMethods(true);
for(int i = 0; i < methods.length; i++)
{
- map.put(new MethodKey(methods[i]), methods[i]);
+ map.put(new MethodKey(methods[i]), methods[i]);
}
return map.values().toArray(new Method[map.size()]);
}
@@ -867,7 +867,7 @@ public final class Class<T>
Modifier.FINAL | Modifier.STATIC | Modifier.ABSTRACT |
Modifier.INTERFACE));
}
-
+
/**
* Get the name of this class, separated by dots for package separators.
* If the class represents a primitive type, or void, then the
@@ -896,7 +896,7 @@ public final class Class<T>
* @return the name of this class
*/
public String getName()
- {
+ {
return VMClass.getName (this);
}
@@ -959,16 +959,16 @@ public final class Class<T>
{
if (resourceName.length() > 0)
{
- if (resourceName.charAt(0) != '/')
- {
- String pkg = getPackagePortion(getName());
- if (pkg.length() > 0)
- resourceName = pkg.replace('.','/') + '/' + resourceName;
- }
- else
- {
- resourceName = resourceName.substring(1);
- }
+ if (resourceName.charAt(0) != '/')
+ {
+ String pkg = getPackagePortion(getName());
+ if (pkg.length() > 0)
+ resourceName = pkg.replace('.','/') + '/' + resourceName;
+ }
+ else
+ {
+ resourceName = resourceName.substring(1);
+ }
}
return resourceName;
}
@@ -984,7 +984,7 @@ public final class Class<T>
{
return signers == null ? null : (Object[]) signers.clone ();
}
-
+
/**
* Set the signers of this class.
*
@@ -1006,7 +1006,7 @@ public final class Class<T>
{
return VMClass.getSuperclass (this);
}
-
+
/**
* Return whether this class is an array type.
*
@@ -1017,7 +1017,7 @@ public final class Class<T>
{
return VMClass.isArray (this);
}
-
+
/**
* Discover whether an instance of the Class parameter would be an
* instance of this Class as well. Think of doing
@@ -1036,7 +1036,7 @@ public final class Class<T>
{
return VMClass.isAssignableFrom (this, c);
}
-
+
/**
* Discover whether an Object is an instance of this Class. Think of it
* as almost like <code>o instanceof (this class)</code>.
@@ -1049,7 +1049,7 @@ public final class Class<T>
{
return VMClass.isInstance (this, o);
}
-
+
/**
* Check whether this class is an interface or not. Array types are not
* interfaces.
@@ -1060,7 +1060,7 @@ public final class Class<T>
{
return VMClass.isInterface (this);
}
-
+
/**
* Return whether this class is a primitive type. A primitive type class
* is a class representing a kind of "placeholder" for the various
@@ -1084,7 +1084,7 @@ public final class Class<T>
{
return VMClass.isPrimitive (this);
}
-
+
/**
* Get a new instance of this class by calling the no-argument constructor.
* The class is initialized if it has not been already. A security check
@@ -1109,45 +1109,45 @@ public final class Class<T>
Constructor<T> constructor;
synchronized(this)
{
- constructor = this.constructor;
+ constructor = this.constructor;
}
if (constructor == null)
{
- Constructor[] constructors = getDeclaredConstructors(false);
- for (int i = 0; i < constructors.length; i++)
- {
- if (constructors[i].getParameterTypes().length == 0)
- {
- constructor = constructors[i];
- break;
- }
- }
- if (constructor == null)
- throw new InstantiationException(getName());
- if (!Modifier.isPublic(constructor.getModifiers())
+ Constructor[] constructors = getDeclaredConstructors(false);
+ for (int i = 0; i < constructors.length; i++)
+ {
+ if (constructors[i].getParameterTypes().length == 0)
+ {
+ constructor = constructors[i];
+ break;
+ }
+ }
+ if (constructor == null)
+ throw new InstantiationException(getName());
+ if (!Modifier.isPublic(constructor.getModifiers())
|| !Modifier.isPublic(VMClass.getModifiers(this, true)))
- {
- setAccessible(constructor);
- }
- synchronized(this)
- {
- if (this.constructor == null)
- this.constructor = constructor;
- }
+ {
+ setAccessible(constructor);
+ }
+ synchronized(this)
+ {
+ if (this.constructor == null)
+ this.constructor = constructor;
+ }
}
int modifiers = constructor.getModifiers();
if (!Modifier.isPublic(modifiers)
|| !Modifier.isPublic(VMClass.getModifiers(this, true)))
{
- Class caller = VMStackWalker.getCallingClass();
- if (caller != null &&
- caller != this &&
- (Modifier.isPrivate(modifiers)
- || getClassLoader() != caller.getClassLoader()
- || !getPackagePortion(getName())
- .equals(getPackagePortion(caller.getName()))))
- throw new IllegalAccessException(getName()
- + " has an inaccessible constructor");
+ Class caller = VMStackWalker.getCallingClass();
+ if (caller != null &&
+ caller != this &&
+ (Modifier.isPrivate(modifiers)
+ || getClassLoader() != caller.getClassLoader()
+ || !getPackagePortion(getName())
+ .equals(getPackagePortion(caller.getName()))))
+ throw new IllegalAccessException(getName()
+ + " has an inaccessible constructor");
}
try
{
@@ -1155,9 +1155,9 @@ public final class Class<T>
}
catch (InvocationTargetException e)
{
- VMClass.throwException(e.getTargetException());
- throw (InternalError) new InternalError
- ("VMClass.throwException returned").initCause(e);
+ VMClass.throwException(e.getTargetException());
+ throw (InternalError) new InternalError
+ ("VMClass.throwException returned").initCause(e);
}
}
@@ -1288,14 +1288,14 @@ public final class Class<T>
* returns an appropriately cast reference to this object. Otherwise,
* a <code>ClassCastException</code> is thrown.
* </p>
- *
+ *
* @param klass the class object, the parameterized type (<code>U</code>) of
* which should be a superclass of the parameterized type of
* this instance.
* @return a reference to this object, appropriately cast.
* @throws ClassCastException if this class can not be converted to one
* which represents a subclass of the specified
- * type, <code>U</code>.
+ * type, <code>U</code>.
* @since 1.5
*/
public <U> Class<? extends U> asSubclass(Class<U> klass)
@@ -1328,16 +1328,16 @@ public final class Class<T>
Field[] fields = getDeclaredFields(true);
for (int i = 0; i < fields.length; i++)
{
- Field field = fields[i];
- if (field.getName().equals(name))
- return field;
+ Field field = fields[i];
+ if (field.getName().equals(name))
+ return field;
}
Class[] interfaces = getInterfaces();
for (int i = 0; i < interfaces.length; i++)
{
- Field field = interfaces[i].internalGetField(name);
- if(field != null)
- return field;
+ Field field = interfaces[i].internalGetField(name);
+ if(field != null)
+ return field;
}
Class superClass = getSuperclass();
if (superClass != null)
@@ -1368,10 +1368,10 @@ public final class Class<T>
SecurityManager sm = SecurityManager.current;
if (sm != null)
{
- sm.checkMemberAccess(this, which);
- Package pkg = getPackage();
- if (pkg != null)
- sm.checkPackageAccess(pkg.getName());
+ sm.checkMemberAccess(this, which);
+ Package pkg = getPackage();
+ if (pkg != null)
+ sm.checkPackageAccess(pkg.getName());
}
}
@@ -1388,30 +1388,30 @@ public final class Class<T>
{
if (isEnum())
{
- try
- {
+ try
+ {
Method m = getMethod("values");
setAccessible(m);
- return (T[]) m.invoke(null);
- }
- catch (NoSuchMethodException exception)
- {
- throw new Error("Enum lacks values() method");
- }
- catch (IllegalAccessException exception)
- {
- throw new Error("Unable to access Enum class");
- }
- catch (InvocationTargetException exception)
- {
- throw new
- RuntimeException("The values method threw an exception",
- exception);
- }
+ return (T[]) m.invoke(null);
+ }
+ catch (NoSuchMethodException exception)
+ {
+ throw new Error("Enum lacks values() method");
+ }
+ catch (IllegalAccessException exception)
+ {
+ throw new Error("Unable to access Enum class");
+ }
+ catch (InvocationTargetException exception)
+ {
+ throw new
+ RuntimeException("The values method threw an exception",
+ exception);
+ }
}
else
{
- return null;
+ return null;
}
}
@@ -1458,7 +1458,7 @@ public final class Class<T>
* <code>getName()</code> which follows the last ".". Anonymous
* classes have no name, and so the result of calling this method is
* "". The simple name of an array consists of the simple name of
- * its component type, followed by "[]". Thus, an array with the
+ * its component type, followed by "[]". Thus, an array with the
* component type of an anonymous class has a simple name of simply
* "[]".
*
@@ -1485,7 +1485,7 @@ public final class Class<T>
Annotation[] annotations = getAnnotations();
for (Annotation annotation : annotations)
if (annotation.annotationType() == annotationClass)
- foundAnnotation = (A) annotation;
+ foundAnnotation = (A) annotation;
return foundAnnotation;
}
@@ -1506,15 +1506,15 @@ public final class Class<T>
for (Annotation a : getDeclaredAnnotations())
map.put((Class) a.annotationType(), a);
for (Class<? super T> s = getSuperclass();
- s != null;
- s = s.getSuperclass())
+ s != null;
+ s = s.getSuperclass())
{
- for (Annotation a : s.getDeclaredAnnotations())
- {
- Class k = (Class) a.annotationType();
- if (! map.containsKey(k) && k.isAnnotationPresent(Inherited.class))
- map.put(k, a);
- }
+ for (Annotation a : s.getDeclaredAnnotations())
+ {
+ Class k = (Class) a.annotationType();
+ if (! map.containsKey(k) && k.isAnnotationPresent(Inherited.class))
+ map.put(k, a);
+ }
}
Collection<Annotation> v = map.values();
return v.toArray(new Annotation[v.size()]);
@@ -1533,7 +1533,7 @@ public final class Class<T>
* The canonical name for top-level classes, top-level interfaces and
* primitive types is always the same as the fully-qualified name.
* For array types, the canonical name is the canonical name of its
- * component type with `[]' appended.
+ * component type with `[]' appended.
* </p>
* <p>
* The canonical name of a member class always refers to the place where
@@ -1590,7 +1590,7 @@ public final class Class<T>
/**
* Returns the constructor which immediately encloses this class. If
- * this class is a top-level class, or a local or anonymous class
+ * this class is a top-level class, or a local or anonymous class
* immediately enclosed by a type definition, instance initializer
* or static initializer, then <code>null</code> is returned.
*
@@ -1606,7 +1606,7 @@ public final class Class<T>
/**
* Returns the method which immediately encloses this class. If
- * this class is a top-level class, or a local or anonymous class
+ * this class is a top-level class, or a local or anonymous class
* immediately enclosed by a type definition, instance initializer
* or static initializer, then <code>null</code> is returned.
*
@@ -1718,7 +1718,7 @@ public final class Class<T>
* An array of size zero is returned if this class has no type
* variables.
*
- * @return the type variables associated with this class.
+ * @return the type variables associated with this class.
* @throws GenericSignatureFormatError if the generic signature does
* not conform to the format specified in the Virtual Machine
* specification, version 3.
@@ -1743,8 +1743,8 @@ public final class Class<T>
* @return true if an annotation exists for the specified type.
* @since 1.5
*/
- public boolean isAnnotationPresent(Class<? extends Annotation>
- annotationClass)
+ public boolean isAnnotationPresent(Class<? extends Annotation>
+ annotationClass)
{
return getAnnotation(annotationClass) != null;
}
diff --git a/java/lang/ClassLoader.java b/java/lang/ClassLoader.java
index 591406ac4..b7cbb2a1a 100644
--- a/java/lang/ClassLoader.java
+++ b/java/lang/ClassLoader.java
@@ -165,23 +165,23 @@ public abstract class ClassLoader
if (secman != null && SecurityManager.current == null)
{
if (secman.equals("") || secman.equals("default"))
- {
- SecurityManager.current = new SecurityManager();
- }
- else
- {
- try
- {
- Class cl = Class.forName(secman, false, StaticData.systemClassLoader);
- SecurityManager.current = (SecurityManager)cl.newInstance();
- }
- catch (Exception x)
- {
- throw (InternalError)
- new InternalError("Unable to create SecurityManager")
- .initCause(x);
- }
- }
+ {
+ SecurityManager.current = new SecurityManager();
+ }
+ else
+ {
+ try
+ {
+ Class cl = Class.forName(secman, false, StaticData.systemClassLoader);
+ SecurityManager.current = (SecurityManager)cl.newInstance();
+ }
+ catch (Exception x)
+ {
+ throw (InternalError)
+ new InternalError("Unable to create SecurityManager")
+ .initCause(x);
+ }
+ }
}
}
@@ -320,23 +320,23 @@ public abstract class ClassLoader
Class<?> c = findLoadedClass(name);
if (c == null)
{
- // Can the class be loaded by a parent?
- try
- {
- if (parent == null)
- {
- c = VMClassLoader.loadClass(name, resolve);
- if (c != null)
- return c;
- }
- else
- {
- return parent.loadClass(name, resolve);
- }
- }
+ // Can the class be loaded by a parent?
+ try
+ {
+ if (parent == null)
+ {
+ c = VMClassLoader.loadClass(name, resolve);
+ if (c != null)
+ return c;
+ }
+ else
+ {
+ return parent.loadClass(name, resolve);
+ }
+ }
catch (ClassNotFoundException e)
- {
- }
+ {
+ }
// Still not found, we have to do it ourself.
c = findClass(name);
}
@@ -431,7 +431,7 @@ public abstract class ClassLoader
* @since 1.1
*/
protected final Class<?> defineClass(String name, byte[] data, int offset,
- int len) throws ClassFormatError
+ int len) throws ClassFormatError
{
return defineClass(name, data, offset, len, null);
}
@@ -460,16 +460,16 @@ public abstract class ClassLoader
* @since 1.2
*/
protected final synchronized Class<?> defineClass(String name, byte[] data,
- int offset, int len,
- ProtectionDomain domain)
+ int offset, int len,
+ ProtectionDomain domain)
throws ClassFormatError
{
checkInitialized();
if (domain == null)
domain = StaticData.defaultProtectionDomain;
-
+
return VMClassLoader.defineClassWithTransformers(this, name, data, offset,
- len, domain);
+ len, domain);
}
/**
@@ -493,7 +493,7 @@ public abstract class ClassLoader
* @since 1.5
*/
protected final Class<?> defineClass(String name, ByteBuffer buf,
- ProtectionDomain domain)
+ ProtectionDomain domain)
throws ClassFormatError
{
byte[] data = new byte[buf.remaining()];
@@ -547,8 +547,8 @@ public abstract class ClassLoader
SecurityManager sm = SecurityManager.current;
if (sm != null)
{
- ClassLoader cl = VMStackWalker.getCallingClassLoader();
- if (cl != null && ! cl.isAncestorOf(this))
+ ClassLoader cl = VMStackWalker.getCallingClassLoader();
+ if (cl != null && ! cl.isAncestorOf(this))
sm.checkPermission(new RuntimePermission("getClassLoader"));
}
return parent;
@@ -791,9 +791,9 @@ public abstract class ClassLoader
SecurityManager sm = SecurityManager.current;
if (sm != null)
{
- ClassLoader cl = VMStackWalker.getCallingClassLoader();
- if (cl != null && cl != StaticData.systemClassLoader)
- sm.checkPermission(new RuntimePermission("getClassLoader"));
+ ClassLoader cl = VMStackWalker.getCallingClassLoader();
+ if (cl != null && cl != StaticData.systemClassLoader)
+ sm.checkPermission(new RuntimePermission("getClassLoader"));
}
return StaticData.systemClassLoader;
@@ -863,10 +863,10 @@ public abstract class ClassLoader
if (p == null)
{
- synchronized (definedPackages)
- {
- p = definedPackages.get(name);
- }
+ synchronized (definedPackages)
+ {
+ p = definedPackages.get(name);
+ }
}
return p;
}
@@ -895,7 +895,7 @@ public abstract class ClassLoader
parentPackages = parent.getPackages();
Package[] allPackages = new Package[parentPackages.length
- + packages.length];
+ + packages.length];
System.arraycopy(parentPackages, 0, allPackages, 0,
parentPackages.length);
System.arraycopy(packages, 0, allPackages, parentPackages.length,
@@ -937,7 +937,7 @@ public abstract class ClassLoader
{
defaultAssertionStatus = enabled;
}
-
+
/**
* Set the default assertion status for packages, used unless overridden
* by a class request. This default also covers subpackages, unless they
@@ -958,7 +958,7 @@ public abstract class ClassLoader
= new HashMap<String, Boolean>(StaticData.systemPackageAssertionStatus);
packageAssertionStatus.put(name, Boolean.valueOf(enabled));
}
-
+
/**
* Set the default assertion status for a class. This only affects the
* status of top-level classes, any other string is harmless.
@@ -976,11 +976,11 @@ public abstract class ClassLoader
{
if (classAssertionStatus == null)
classAssertionStatus
- = new HashMap<String, Boolean>(StaticData.systemClassAssertionStatus);
+ = new HashMap<String, Boolean>(StaticData.systemClassAssertionStatus);
// The toString() hack catches null, as required.
classAssertionStatus.put(name.toString(), Boolean.valueOf(enabled));
}
-
+
/**
* Resets the default assertion status of this classloader, its packages
* and classes, all to false. This allows overriding defaults inherited
@@ -1007,9 +1007,9 @@ public abstract class ClassLoader
{
while (loader != null)
{
- if (this == loader)
- return true;
- loader = loader.parent;
+ if (this == loader)
+ return true;
+ loader = loader.parent;
}
return false;
}
@@ -1021,17 +1021,17 @@ public abstract class ClassLoader
ArrayList list = new ArrayList();
while (tok.hasMoreTokens())
{
- try
- {
- File f = new File(tok.nextToken());
- File[] files = f.listFiles();
- if (files != null)
- for (int i = 0; i < files.length; i++)
- list.add(files[i].toURL());
- }
- catch(Exception x)
- {
- }
+ try
+ {
+ File f = new File(tok.nextToken());
+ File[] files = f.listFiles();
+ if (files != null)
+ for (int i = 0; i < files.length; i++)
+ list.add(files[i].toURL());
+ }
+ catch(Exception x)
+ {
+ }
}
URL[] urls = new URL[list.size()];
list.toArray(urls);
@@ -1042,7 +1042,7 @@ public abstract class ClassLoader
{
try
{
- list.add(new File(file).toURL());
+ list.add(new File(file).toURL());
}
catch(java.net.MalformedURLException x)
{
@@ -1056,22 +1056,22 @@ public abstract class ClassLoader
ArrayList list = new ArrayList();
while (tok.hasMoreTokens())
{
- String s = tok.nextToken();
- if (s.equals(File.pathSeparator))
- addFileURL(list, ".");
- else
- {
- addFileURL(list, s);
- if (tok.hasMoreTokens())
- {
- // Skip the separator.
- tok.nextToken();
- // If the classpath ended with a separator,
- // append the current directory.
- if (!tok.hasMoreTokens())
- addFileURL(list, ".");
- }
- }
+ String s = tok.nextToken();
+ if (s.equals(File.pathSeparator))
+ addFileURL(list, ".");
+ else
+ {
+ addFileURL(list, s);
+ if (tok.hasMoreTokens())
+ {
+ // Skip the separator.
+ tok.nextToken();
+ // If the classpath ended with a separator,
+ // append the current directory.
+ if (!tok.hasMoreTokens())
+ addFileURL(list, ".");
+ }
+ }
}
URL[] urls = new URL[list.size()];
list.toArray(urls);
@@ -1096,22 +1096,22 @@ public abstract class ClassLoader
static ClassLoader createSystemClassLoader(URL[] urls, ClassLoader parent)
{
return
- new URLClassLoader(urls, parent)
- {
- protected synchronized Class loadClass(String name,
- boolean resolve)
- throws ClassNotFoundException
- {
- SecurityManager sm = SecurityManager.current;
- if (sm != null)
- {
- int lastDot = name.lastIndexOf('.');
- if (lastDot != -1)
- sm.checkPackageAccess(name.substring(0, lastDot));
- }
- return super.loadClass(name, resolve);
- }
- };
+ new URLClassLoader(urls, parent)
+ {
+ protected synchronized Class loadClass(String name,
+ boolean resolve)
+ throws ClassNotFoundException
+ {
+ SecurityManager sm = SecurityManager.current;
+ if (sm != null)
+ {
+ int lastDot = name.lastIndexOf('.');
+ if (lastDot != -1)
+ sm.checkPackageAccess(name.substring(0, lastDot));
+ }
+ return super.loadClass(name, resolve);
+ }
+ };
}
static ClassLoader createAuxiliarySystemClassLoader(ClassLoader parent)
@@ -1119,20 +1119,20 @@ public abstract class ClassLoader
String loader = SystemProperties.getProperty("java.system.class.loader", null);
if (loader == null)
{
- return parent;
+ return parent;
}
try
{
- Constructor c = Class.forName(loader, false, parent)
- .getConstructor(new Class[] { ClassLoader.class });
- return (ClassLoader)c.newInstance(new Object[] { parent });
+ Constructor c = Class.forName(loader, false, parent)
+ .getConstructor(new Class[] { ClassLoader.class });
+ return (ClassLoader)c.newInstance(new Object[] { parent });
}
catch (Exception e)
{
- System.err.println("Requested system classloader " + loader + " failed.");
- throw (Error)
- new Error("Requested system classloader " + loader + " failed.")
- .initCause(e);
+ System.err.println("Requested system classloader " + loader + " failed.");
+ throw (Error)
+ new Error("Requested system classloader " + loader + " failed.")
+ .initCause(e);
}
}
diff --git a/java/lang/Comparable.java b/java/lang/Comparable.java
index 4ad39af83..d4ca63ad8 100644
--- a/java/lang/Comparable.java
+++ b/java/lang/Comparable.java
@@ -52,8 +52,8 @@ package java.lang;
*
* <p>Lists, arrays, and sets of objects that implement this interface can
* be sorted automatically, without the need for an explicit
- * {@link java.util.Comparator}. Note that <code>e1.compareTo(null)</code>
- * should throw an Exception; as should comparison between incompatible
+ * {@link java.util.Comparator}. Note that <code>e1.compareTo(null)</code>
+ * should throw an Exception; as should comparison between incompatible
* classes.
*
* @author Geoff Berry
diff --git a/java/lang/Double.java b/java/lang/Double.java
index f3f7cb1e0..3ae1b0111 100644
--- a/java/lang/Double.java
+++ b/java/lang/Double.java
@@ -213,7 +213,7 @@ public final class Double extends Number implements Comparable<Double>
long bits = doubleToLongBits(d);
CPStringBuilder result = new CPStringBuilder();
-
+
if (bits < 0)
result.append('-');
result.append("0x");
@@ -603,21 +603,21 @@ public final class Double extends Number implements Comparable<Double>
{
// handle the easy cases:
if (x < y)
- return -1;
+ return -1;
if (x > y)
- return 1;
+ return 1;
// handle equality respecting that 0.0 != -0.0 (hence not using x == y):
long lx = doubleToRawLongBits(x);
long ly = doubleToRawLongBits(y);
if (lx == ly)
- return 0;
+ return 0;
// handle NaNs:
if (x != x)
- return (y != y) ? 0 : 1;
+ return (y != y) ? 0 : 1;
else if (y != y)
- return -1;
+ return -1;
// handle +/- 0.0
return (lx < ly) ? -1 : 1;
diff --git a/java/lang/Enum.java b/java/lang/Enum.java
index da2e40b8e..46d28243f 100644
--- a/java/lang/Enum.java
+++ b/java/lang/Enum.java
@@ -102,17 +102,17 @@ public abstract class Enum<T extends Enum<T>>
if (! f.isEnumConstant())
throw new IllegalArgumentException(s);
Class.setAccessible(f);
- @SuppressWarnings("unchecked")
- S val = (S) f.get(null);
+ @SuppressWarnings("unchecked")
+ S val = (S) f.get(null);
return val;
}
catch (NoSuchFieldException exception)
{
- throw new IllegalArgumentException(s);
+ throw new IllegalArgumentException(s);
}
catch (IllegalAccessException exception)
{
- throw new Error("Unable to access Enum class");
+ throw new Error("Unable to access Enum class");
}
}
@@ -167,7 +167,7 @@ public abstract class Enum<T extends Enum<T>>
* integer if <code>e.ordinal > this.ordinal</code>.
* @throws ClassCastException if <code>e</code> is not an enumeration
* constant of the same class.
- */
+ */
public final int compareTo(T e)
{
if (getDeclaringClass() != e.getDeclaringClass())
@@ -201,7 +201,7 @@ public abstract class Enum<T extends Enum<T>>
/**
* Returns the number of this enumeration constant, which represents
* the order in which it was originally declared, starting from zero.
- *
+ *
* @return the number of this constant.
*/
public final int ordinal()
diff --git a/java/lang/EnumConstantNotPresentException.java b/java/lang/EnumConstantNotPresentException.java
index 4586c372c..f597318db 100644
--- a/java/lang/EnumConstantNotPresentException.java
+++ b/java/lang/EnumConstantNotPresentException.java
@@ -69,7 +69,7 @@ public class EnumConstantNotPresentException extends RuntimeException
* @param name the name of the missing enum constant
*/
public EnumConstantNotPresentException(Class<? extends Enum> theEnum,
- String name)
+ String name)
{
super("enum " + theEnum + " is missing the constant " + name);
enumType = theEnum;
diff --git a/java/lang/Float.java b/java/lang/Float.java
index 63e43c257..a4a766ec4 100644
--- a/java/lang/Float.java
+++ b/java/lang/Float.java
@@ -224,7 +224,7 @@ public final class Float extends Number implements Comparable<Float>
int bits = floatToIntBits(f);
CPStringBuilder result = new CPStringBuilder();
-
+
if (bits < 0)
result.append('-');
result.append("0x");
@@ -611,21 +611,21 @@ public final class Float extends Number implements Comparable<Float>
{
// handle the easy cases:
if (x < y)
- return -1;
+ return -1;
if (x > y)
- return 1;
+ return 1;
// handle equality respecting that 0.0 != -0.0 (hence not using x == y):
int ix = floatToRawIntBits(x);
int iy = floatToRawIntBits(y);
if (ix == iy)
- return 0;
+ return 0;
// handle NaNs:
if (x != x)
- return (y != y) ? 0 : 1;
+ return (y != y) ? 0 : 1;
else if (y != y)
- return -1;
+ return -1;
// handle +/- 0.0
return (ix < iy) ? -1 : 1;
diff --git a/java/lang/IllegalArgumentException.java b/java/lang/IllegalArgumentException.java
index 75a0b8bfe..26354a58e 100644
--- a/java/lang/IllegalArgumentException.java
+++ b/java/lang/IllegalArgumentException.java
@@ -88,7 +88,7 @@ public class IllegalArgumentException extends RuntimeException
* automatically incorporated into the resulting detail message of
* this exception.
* </p>
- *
+ *
* @param message the detail message, which should give the reason for
* this exception being thrown.
* @param cause the cause of this exception, or null if the cause
@@ -116,7 +116,7 @@ public class IllegalArgumentException extends RuntimeException
* This makes this constructor very useful for simply wrapping another
* exception.
* </p>
- *
+ *
* @param cause the cause of this exception, or null if the cause
* is unknown.
* @since 1.5
diff --git a/java/lang/IllegalStateException.java b/java/lang/IllegalStateException.java
index 6b4e5f842..b182f092e 100644
--- a/java/lang/IllegalStateException.java
+++ b/java/lang/IllegalStateException.java
@@ -93,7 +93,7 @@ public class IllegalStateException extends RuntimeException
* automatically incorporated into the resulting detail message of
* this exception.
* </p>
- *
+ *
* @param message the detail message, which should give the reason for
* this exception being thrown.
* @param cause the cause of this exception, or null if the cause
@@ -121,7 +121,7 @@ public class IllegalStateException extends RuntimeException
* This makes this constructor very useful for simply wrapping another
* exception.
* </p>
- *
+ *
* @param cause the cause of this exception, or null if the cause
* is unknown.
* @since 1.5
@@ -132,4 +132,3 @@ public class IllegalStateException extends RuntimeException
}
}
-
diff --git a/java/lang/IndexOutOfBoundsException.java b/java/lang/IndexOutOfBoundsException.java
index c53c67e55..0a00253ae 100644
--- a/java/lang/IndexOutOfBoundsException.java
+++ b/java/lang/IndexOutOfBoundsException.java
@@ -41,7 +41,7 @@ package java.lang;
/**
* This exception can be thrown to indicate an attempt to access an
* index which is out of bounds on objects like String, Array, or Vector.
- * Usually any negative integer less than or equal to -1 and positive
+ * Usually any negative integer less than or equal to -1 and positive
* integer greater than or equal to the size of the object is an index
* which would be out of bounds.
*
diff --git a/java/lang/Integer.java b/java/lang/Integer.java
index e5ca4b342..f379795ea 100644
--- a/java/lang/Integer.java
+++ b/java/lang/Integer.java
@@ -205,12 +205,12 @@ public final class Integer extends Number implements Comparable<Integer>
// When the value is MIN_VALUE, it overflows when made positive
if (num < 0)
- {
+ {
i = size = stringSize(MAX_VALUE, radix) + 2;
buffer = new char[size];
- buffer[--i] = digits[(int) (-(num + radix) % radix)];
- num = -(num / radix);
- }
+ buffer[--i] = digits[(int) (-(num + radix) % radix)];
+ num = -(num / radix);
+ }
else
{
i = size = stringSize(num, radix) + 1;
@@ -704,9 +704,9 @@ public final class Integer extends Number implements Comparable<Integer>
public static int reverseBytes(int val)
{
return ( ((val >> 24) & 0xff)
- | ((val >> 8) & 0xff00)
- | ((val << 8) & 0xff0000)
- | ((val << 24) & 0xff000000));
+ | ((val >> 8) & 0xff00)
+ | ((val << 8) & 0xff0000)
+ | ((val << 24) & 0xff000000));
}
/**
@@ -786,15 +786,15 @@ public final class Integer extends Number implements Comparable<Integer>
if (ch == '-')
{
if (len == 1)
- throw new NumberFormatException("pure '-'");
+ throw new NumberFormatException("pure '-'");
isNeg = true;
ch = str.charAt(++index);
}
else if (ch == '+')
{
- if (len == 1)
- throw new NumberFormatException("pure '+'");
- ch = str.charAt(++index);
+ if (len == 1)
+ throw new NumberFormatException("pure '+'");
+ ch = str.charAt(++index);
}
if (decode)
{
@@ -828,8 +828,8 @@ public final class Integer extends Number implements Comparable<Integer>
int val = 0;
while (index < len)
{
- if (val < 0 || val > max)
- throw new NumberFormatException("number overflow (pos=" + index + ") : " + str);
+ if (val < 0 || val > max)
+ throw new NumberFormatException("number overflow (pos=" + index + ") : " + str);
ch = Character.digit(str.charAt(index++), radix);
val = val * radix + ch;
diff --git a/java/lang/Long.java b/java/lang/Long.java
index a5ee6c707..e7579d865 100644
--- a/java/lang/Long.java
+++ b/java/lang/Long.java
@@ -817,8 +817,8 @@ public final class Long extends Number implements Comparable<Long>
long val = 0;
while (index < len)
{
- if (val < 0 || val > max)
- throw new NumberFormatException();
+ if (val < 0 || val > max)
+ throw new NumberFormatException();
ch = Character.digit(str.charAt(index++), radix);
val = val * radix + ch;
diff --git a/java/lang/Math.java b/java/lang/Math.java
index 90574d52f..6cf29b4a0 100644
--- a/java/lang/Math.java
+++ b/java/lang/Math.java
@@ -709,7 +709,7 @@ public final class Math
* zero, then the original value is returned. The returned result is
* within 1 ulp of the exact result. For a finite value, <code>x</code>,
* the cube root of <code>-x</code> is equal to the negation of the cube root
- * of <code>x</code>.
+ * of <code>x</code>.
* </p>
* <p>
* For a square root, use <code>sqrt</code>. For other roots, use
@@ -730,7 +730,7 @@ public final class Math
/**
* <p>
* Returns the hyperbolic cosine of the given value. For a value,
- * <code>x</code>, the hyperbolic cosine is <code>(e<sup>x</sup> +
+ * <code>x</code>, the hyperbolic cosine is <code>(e<sup>x</sup> +
* e<sup>-x</sup>)/2</code>
* with <code>e</code> being <a href="#E">Euler's number</a>. The returned
* result is within 2.5 ulps of the exact result.
@@ -740,7 +740,7 @@ public final class Math
* returned. For either infinity, positive infinity is returned.
* The hyperbolic cosine of zero is 1.0.
* </p>
- *
+ *
* @param a the numeric argument
* @return the hyperbolic cosine of <code>a</code>.
* @since 1.5
@@ -758,12 +758,12 @@ public final class Math
* 1 ulp of the exact result, and results are semi-monotonic. For finite
* inputs, the returned value is greater than or equal to -1.0. Once
* a result enters within half a ulp of this limit, the limit is returned.
- * </p>
+ * </p>
* <p>
* For <code>NaN</code>, positive infinity and zero, the original value
* is returned. Negative infinity returns a result of -1.0 (the limit).
* </p>
- *
+ *
* @param a the numeric argument
* @return <code>e<sup>a</sup> - 1</code>
* @since 1.5
@@ -785,7 +785,7 @@ public final class Math
* is positive infinity. Otherwise, if either argument is <code>NaN</code>,
* then <code>NaN</code> is returned.
* </p>
- *
+ *
* @param a the first parameter.
* @param b the second parameter.
* @return the hypotenuse matching the supplied parameters.
@@ -855,7 +855,7 @@ public final class Math
* <li>If <code>a</code> is positive or negative zero, the result is the
* same.</li>
* </ul>
- *
+ *
* @param a the numeric argument.
* @return the sign of the argument.
* @since 1.5.
@@ -882,7 +882,7 @@ public final class Math
* <li>If <code>a</code> is positive or negative zero, the result is the
* same.</li>
* </ul>
- *
+ *
* @param a the numeric argument.
* @return the sign of the argument.
* @since 1.5.
@@ -901,7 +901,7 @@ public final class Math
/**
* <p>
* Returns the hyperbolic sine of the given value. For a value,
- * <code>x</code>, the hyperbolic sine is <code>(e<sup>x</sup> -
+ * <code>x</code>, the hyperbolic sine is <code>(e<sup>x</sup> -
* e<sup>-x</sup>)/2</code>
* with <code>e</code> being <a href="#E">Euler's number</a>. The returned
* result is within 2.5 ulps of the exact result.
@@ -910,7 +910,7 @@ public final class Math
* If the supplied value is <code>NaN</code>, an infinity or a zero, then the
* original value is returned.
* </p>
- *
+ *
* @param a the numeric argument
* @return the hyperbolic sine of <code>a</code>.
* @since 1.5
@@ -923,7 +923,7 @@ public final class Math
/**
* <p>
* Returns the hyperbolic tangent of the given value. For a value,
- * <code>x</code>, the hyperbolic tangent is <code>(e<sup>x</sup> -
+ * <code>x</code>, the hyperbolic tangent is <code>(e<sup>x</sup> -
* e<sup>-x</sup>)/(e<sup>x</sup> + e<sup>-x</sup>)</code>
* (i.e. <code>sinh(a)/cosh(a)</code>)
* with <code>e</code> being <a href="#E">Euler's number</a>. The returned
@@ -938,7 +938,7 @@ public final class Math
* value is returned. Positive infinity returns +1.0 and negative infinity
* returns -1.0.
* </p>
- *
+ *
* @param a the numeric argument
* @return the hyperbolic tangent of <code>a</code>.
* @since 1.5
diff --git a/java/lang/NoClassDefFoundError.java b/java/lang/NoClassDefFoundError.java
index 7e8e6caff..55d5f2605 100644
--- a/java/lang/NoClassDefFoundError.java
+++ b/java/lang/NoClassDefFoundError.java
@@ -43,7 +43,7 @@ package java.lang;
* Java Virtual Machine tries to load a class and no definition of the class
* can be found. This could happen when using the <code>new</code> expression
* or during a normal method call. The reason this would occur at runtime is
- * because the missing class definition existed when the currently executing
+ * because the missing class definition existed when the currently executing
* class was compiled, but now that definition cannot be found.
*
* @author Brian Jones
diff --git a/java/lang/Object.java b/java/lang/Object.java
index fbd1dc77d..a6e700434 100644
--- a/java/lang/Object.java
+++ b/java/lang/Object.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/lang/Package.java b/java/lang/Package.java
index 1141a0722..9220dfd21 100644
--- a/java/lang/Package.java
+++ b/java/lang/Package.java
@@ -109,8 +109,8 @@ public class Package
* that defines the Package.
*/
Package(String name,
- String specTitle, String specVendor, String specVersion,
- String implTitle, String implVendor, String implVersion, URL sealed)
+ String specTitle, String specVendor, String specVersion,
+ String implTitle, String implVendor, String implVersion, URL sealed)
{
this(name, specTitle, specVendor, specVersion, implTitle, implVendor,
implVersion, sealed, null);
@@ -121,7 +121,7 @@ public class Package
* the <code>name</code> of the package may be <code>null</code>.
* There are no public constructors defined for Package; this is a package
* local constructor that is used by java.lang.Classloader.definePackage().
- *
+ *
* @param name The name of the Package
* @param specTitle The name of the specification
* @param specVendor The name of the specification designer
@@ -132,8 +132,8 @@ public class Package
* @param sealed If sealed the origin of the package classes
*/
Package(String name,
- String specTitle, String specVendor, String specVersion,
- String implTitle, String implVendor, String implVersion, URL sealed,
+ String specTitle, String specVendor, String specVersion,
+ String implTitle, String implVendor, String implVersion, URL sealed,
ClassLoader loader)
{
if (name == null)
@@ -333,7 +333,7 @@ public class Package
public String toString()
{
return ("package " + name + (specTitle == null ? "" : ", " + specTitle)
- + (specVersion == null ? "" : ", version " + specVersion));
+ + (specVersion == null ? "" : ", version " + specVersion));
}
/**
@@ -351,7 +351,7 @@ public class Package
Annotation[] annotations = getAnnotations();
for (Annotation annotation : annotations)
if (annotation.annotationType() == annotationClass)
- foundAnnotation = (A) annotation;
+ foundAnnotation = (A) annotation;
return foundAnnotation;
}
@@ -405,8 +405,8 @@ public class Package
* @return true if an annotation exists for the specified type.
* @since 1.5
*/
- public boolean isAnnotationPresent(Class<? extends Annotation>
- annotationClass)
+ public boolean isAnnotationPresent(Class<? extends Annotation>
+ annotationClass)
{
return getAnnotation(annotationClass) != null;
}
diff --git a/java/lang/ProcessBuilder.java b/java/lang/ProcessBuilder.java
index 9ffe24cde..0b32edec2 100644
--- a/java/lang/ProcessBuilder.java
+++ b/java/lang/ProcessBuilder.java
@@ -204,7 +204,7 @@ public final class ProcessBuilder
* indicates that the default behaviour of using the
* working directory of the current process should
* be adopted.
- *
+ *
* @return the working directory.
*/
public File directory()
@@ -218,7 +218,7 @@ public final class ProcessBuilder
* which indicates the default value should be used.
* The default is the working directory of the current
* process.
- *
+ *
* @param directory the new working directory.
* @return a reference to this process builder.
*/
@@ -252,7 +252,7 @@ public final class ProcessBuilder
* some may not allow any changes to the environment variables or
* may prevent certain values being used. Attempts to do so will
* throw an <code>UnsupportedOperationException</code> or
- * <code>IllegalArgumentException</code>, respectively.
+ * <code>IllegalArgumentException</code>, respectively.
* </p>
* <p>
* Use of this method may require a security check for the
diff --git a/java/lang/Runtime.java b/java/lang/Runtime.java
index 64ca5d912..3134c2a47 100644
--- a/java/lang/Runtime.java
+++ b/java/lang/Runtime.java
@@ -93,11 +93,11 @@ public class Runtime
{
if (current != null)
throw new InternalError("Attempt to recreate Runtime");
-
+
// If used by underlying VM this contains the directories where Classpath's own
// native libraries are located.
String bootPath = SystemProperties.getProperty("gnu.classpath.boot.library.path", "");
-
+
// If properly set by the user this contains the directories where the application's
// native libraries are located. On operating systems where a LD_LIBRARY_PATH environment
// variable is available a VM should preset java.library.path with value of this
@@ -109,22 +109,22 @@ public class Runtime
StringTokenizer t1 = new StringTokenizer(bootPath, pathSep);
StringTokenizer t2 = new StringTokenizer(path, pathSep);
libpath = new String[t1.countTokens() + t2.countTokens()];
-
+
int i = 0;
while(t1.hasMoreTokens()) {
String prefix = t1.nextToken();
if (! prefix.endsWith(fileSep))
prefix += fileSep;
-
+
libpath[i] = prefix;
i++;
}
-
+
while(t2.hasMoreTokens()) {
String prefix = t2.nextToken();
if (! prefix.endsWith(fileSep))
prefix += fileSep;
-
+
libpath[i] = prefix;
i++;
}
@@ -185,8 +185,8 @@ public class Runtime
// inside a join on our thread.
exitSequence.interrupt();
// Shutdown hooks are still running, so we clear status to
- // make sure we don't halt.
- status = 0;
+ // make sure we don't halt.
+ status = 0;
}
}
@@ -214,7 +214,7 @@ public class Runtime
* Any subsequent invocations will simply return false.
* Note that it is package accessible so that VMRuntime can call it
* when VM exit is not triggered by a call to Runtime.exit().
- *
+ *
* @return was the current thread the first one to call this method?
*/
boolean runShutdownHooks()
@@ -286,8 +286,8 @@ public class Runtime
shutdownHooks = null;
}
}
- // Run finalization on all finalizable objects (even if they are
- // still reachable).
+ // Run finalization on all finalizable objects (even if they are
+ // still reachable).
VMRuntime.runFinalizationForExit();
}
return first;
@@ -750,15 +750,15 @@ public class Runtime
String filename;
if (loader != null && (filename = loader.findLibrary(libname)) != null)
{
- if (loadLib(filename, loader) != 0)
- return;
+ if (loadLib(filename, loader) != 0)
+ return;
}
else
{
- filename = VMRuntime.mapLibraryName(libname);
- for (int i = 0; i < libpath.length; i++)
- if (loadLib(libpath[i] + filename, loader) != 0)
- return;
+ filename = VMRuntime.mapLibraryName(libname);
+ for (int i = 0; i < libpath.length; i++)
+ if (loadLib(libpath[i] + filename, loader) != 0)
+ return;
}
throw new UnsatisfiedLinkError("Native library `" + libname
+ "' not found (as file `" + filename + "') in gnu.classpath.boot.library.path and java.library.path");
diff --git a/java/lang/SecurityException.java b/java/lang/SecurityException.java
index 84be33ce0..f20fbe04f 100644
--- a/java/lang/SecurityException.java
+++ b/java/lang/SecurityException.java
@@ -87,7 +87,7 @@ public class SecurityException extends RuntimeException
* automatically incorporated into the resulting detail message of
* this exception.
* </p>
- *
+ *
* @param message the detail message, which should give the reason for
* this exception being thrown.
* @param cause the cause of this exception, or null if the cause
@@ -115,7 +115,7 @@ public class SecurityException extends RuntimeException
* This makes this constructor very useful for simply wrapping another
* exception.
* </p>
- *
+ *
* @param cause the cause of this exception, or null if the cause
* is unknown.
* @since 1.5
diff --git a/java/lang/SecurityManager.java b/java/lang/SecurityManager.java
index ff84d9506..d7adc112f 100644
--- a/java/lang/SecurityManager.java
+++ b/java/lang/SecurityManager.java
@@ -225,7 +225,7 @@ public class SecurityManager
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
- *
+ *
* @return the most recent non-system ClassLoader on the execution stack
* @deprecated use {@link #checkPermission(Permission)} instead
*/
@@ -248,7 +248,7 @@ public class SecurityManager
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
- *
+ *
* @return the most recent non-system Class on the execution stack
* @deprecated use {@link #checkPermission(Permission)} instead
*/
@@ -287,7 +287,7 @@ public class SecurityManager
* are from system classes</li>
* <li>A check of <code>java.security.AllPermission</code> succeeds.</li>
* </ul>
- *
+ *
* @return the index of the most recent non-system Class on the stack
* @deprecated use {@link #checkPermission(Permission)} instead
*/
@@ -432,8 +432,8 @@ public class SecurityManager
*/
public void checkAccess(Thread thread)
{
- if (thread.getThreadGroup() != null
- && thread.getThreadGroup().parent == null)
+ if (thread.getThreadGroup() != null
+ && thread.getThreadGroup().parent == null)
checkPermission(new RuntimePermission("modifyThread"));
}
@@ -1062,10 +1062,10 @@ public class SecurityManager
String list = (String)AccessController.doPrivileged(new PrivilegedAction()
{
- public Object run()
+ public Object run()
{
- return Security.getProperty(restriction);
- }
+ return Security.getProperty(restriction);
+ }
});
if (list == null || list.equals(""))
@@ -1076,12 +1076,12 @@ public class SecurityManager
StringTokenizer st = new StringTokenizer(list, ",");
while (st.hasMoreTokens())
{
- if (packageNamePlusDot.startsWith(st.nextToken()))
- {
- Permission p = new RuntimePermission(permission + packageName);
- checkPermission(p);
- return;
- }
+ if (packageNamePlusDot.startsWith(st.nextToken()))
+ {
+ Permission p = new RuntimePermission(permission + packageName);
+ checkPermission(p);
+ return;
+ }
}
}
}
diff --git a/java/lang/StackTraceElement.java b/java/lang/StackTraceElement.java
index 73e1a463d..167272dab 100644
--- a/java/lang/StackTraceElement.java
+++ b/java/lang/StackTraceElement.java
@@ -119,7 +119,7 @@ public final class StackTraceElement implements Serializable
* @param fileName the name of the file, null if unknown
* @param lineNumber the line in the file, negative if unknown, or -2
* if this method is native
- *
+ *
* @since 1.5
*/
public StackTraceElement(String className, String methodName, String fileName,
diff --git a/java/lang/StrictMath.java b/java/lang/StrictMath.java
index 6eb1cb208..88f5e5750 100644
--- a/java/lang/StrictMath.java
+++ b/java/lang/StrictMath.java
@@ -658,12 +658,12 @@ public final strictfp class StrictMath
// 1. Replace x by |x| (sinh(-x) = -sinh(x)).
// 2.
// E + E/(E+1)
- // 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
- // 2
+ // 0 <= x <= 22 : sinh(x) := --------------, E=expm1(x)
+ // 2
//
// 22 <= x <= lnovft : sinh(x) := exp(x)/2
// lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2)
- // ln2ovft < x : sinh(x) := +inf (overflow)
+ // ln2ovft < x : sinh(x) := +inf (overflow)
double t, w, h;
@@ -691,15 +691,15 @@ public final strictfp class StrictMath
// |x| in [0, 22], return sign(x) * 0.5 * (E+E/(E+1))
if (h_bits < 0x40360000L) // |x| < 22
{
- if (h_bits < 0x3e300000L) // |x| < 2^-28
- return x; // for tiny arguments return x
+ if (h_bits < 0x3e300000L) // |x| < 2^-28
+ return x; // for tiny arguments return x
- t = expm1(abs(x));
+ t = expm1(abs(x));
- if (h_bits < 0x3ff00000L)
- return h * (2.0 * t - t * t / (t + 1.0));
+ if (h_bits < 0x3ff00000L)
+ return h * (2.0 * t - t * t / (t + 1.0));
- return h * (t + t / (t + 1.0));
+ return h * (t + t / (t + 1.0));
}
// |x| in [22, log(Double.MAX_VALUE)], return 0.5 * exp(|x|)
@@ -708,12 +708,12 @@ public final strictfp class StrictMath
// |x| in [log(Double.MAX_VALUE), overflowthreshold]
if ((h_bits < 0x408633ceL)
- || ((h_bits == 0x408633ceL) && (l_bits <= 0x8fb9f87dL)))
+ || ((h_bits == 0x408633ceL) && (l_bits <= 0x8fb9f87dL)))
{
- w = exp(0.5 * abs(x));
- t = h * w;
+ w = exp(0.5 * abs(x));
+ t = h * w;
- return t * w;
+ return t * w;
}
// |x| > overflowthershold
@@ -749,12 +749,12 @@ public final strictfp class StrictMath
// 0 <= x <= ln2/2 : cosh(x) := 1 + -------------------
// 2*exp(x)
//
- // exp(x) + 1/exp(x)
+ // exp(x) + 1/exp(x)
// ln2/2 <= x <= 22 : cosh(x) := ------------------
- // 2
+ // 2
// 22 <= x <= lnovft : cosh(x) := exp(x)/2
// lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2)
- // ln2ovft < x : cosh(x) := +inf (overflow)
+ // ln2ovft < x : cosh(x) := +inf (overflow)
double t, w;
long bits;
@@ -776,22 +776,22 @@ public final strictfp class StrictMath
// |x| in [0, 0.5 * ln(2)], return 1 + expm1(|x|)^2 / (2 * exp(|x|))
if (hx < 0x3fd62e43L)
{
- t = expm1(abs(x));
- w = 1.0 + t;
+ t = expm1(abs(x));
+ w = 1.0 + t;
- // for tiny arguments return 1.
- if (hx < 0x3c800000L)
- return w;
+ // for tiny arguments return 1.
+ if (hx < 0x3c800000L)
+ return w;
- return 1.0 + (t * t) / (w + w);
+ return 1.0 + (t * t) / (w + w);
}
// |x| in [0.5 * ln(2), 22], return exp(|x|)/2 + 1 / (2 * exp(|x|))
if (hx < 0x40360000L)
{
- t = exp(abs(x));
+ t = exp(abs(x));
- return 0.5 * t + 0.5 / t;
+ return 0.5 * t + 0.5 / t;
}
// |x| in [22, log(Double.MAX_VALUE)], return 0.5 * exp(|x|)
@@ -801,12 +801,12 @@ public final strictfp class StrictMath
// |x| in [log(Double.MAX_VALUE), overflowthreshold],
// return exp(x/2)/2 * exp(x/2)
if ((hx < 0x408633ceL)
- || ((hx == 0x408633ceL) && (lx <= 0x8fb9f87dL)))
+ || ((hx == 0x408633ceL) && (lx <= 0x8fb9f87dL)))
{
- w = exp(0.5 * abs(x));
- t = 0.5 * w;
+ w = exp(0.5 * abs(x));
+ t = 0.5 * w;
- return t * w;
+ return t * w;
}
// |x| > overflowthreshold
@@ -862,22 +862,22 @@ public final strictfp class StrictMath
if (h_bits < 0x40360000L) // |x| < 22
{
- if (h_bits < 0x3c800000L) // |x| < 2^-55
- return x * (1.0 + x);
-
- if (h_bits >= 0x3ff00000L) // |x| >= 1
- {
- t = expm1(2.0 * abs(x));
- z = 1.0 - 2.0 / (t + 2.0);
- }
- else // |x| < 1
- {
- t = expm1(-2.0 * abs(x));
- z = -t / (t + 2.0);
- }
+ if (h_bits < 0x3c800000L) // |x| < 2^-55
+ return x * (1.0 + x);
+
+ if (h_bits >= 0x3ff00000L) // |x| >= 1
+ {
+ t = expm1(2.0 * abs(x));
+ z = 1.0 - 2.0 / (t + 2.0);
+ }
+ else // |x| < 1
+ {
+ t = expm1(-2.0 * abs(x));
+ z = -t / (t + 2.0);
+ }
}
else // |x| >= 22
- z = 1.0;
+ z = 1.0;
return (x >= 0) ? z : -z;
}
@@ -909,7 +909,7 @@ public final strictfp class StrictMath
private static double buildDouble(long lowDWord, long highDWord)
{
return Double.longBitsToDouble(((highDWord & 0xffffffffL) << 32)
- | (lowDWord & 0xffffffffL));
+ | (lowDWord & 0xffffffffL));
}
/**
@@ -960,26 +960,26 @@ public final strictfp class StrictMath
if (bits < 0x0010000000000000L) // subnormal number
{
- t = TWO_54;
- t *= x;
+ t = TWO_54;
+ t *= x;
- // __HI(t)=__HI(t)/3+B2;
- bits = Double.doubleToLongBits(t);
- h = getHighDWord(bits);
- l = getLowDWord(bits);
+ // __HI(t)=__HI(t)/3+B2;
+ bits = Double.doubleToLongBits(t);
+ h = getHighDWord(bits);
+ l = getLowDWord(bits);
- h = h / 3 + CBRT_B2;
+ h = h / 3 + CBRT_B2;
- t = buildDouble(l, h);
+ t = buildDouble(l, h);
}
else
{
- // __HI(t)=__HI(x)/3+B1;
- h = getHighDWord(bits);
- l = 0;
+ // __HI(t)=__HI(x)/3+B1;
+ h = getHighDWord(bits);
+ l = 0;
- h = h / 3 + CBRT_B1;
- t = buildDouble(l, h);
+ h = h / 3 + CBRT_B1;
+ t = buildDouble(l, h);
}
// new cbrt to 23 bits
@@ -998,7 +998,7 @@ public final strictfp class StrictMath
t = buildDouble(l, h);
// one step newton iteration to 53 bits with error less than 0.667 ulps
- s = t * t; // t * t is exact
+ s = t * t; // t * t is exact
r = x / s;
w = t + t;
r = (r - t) / (w + r); // r - t is exact
@@ -1087,75 +1087,75 @@ public final strictfp class StrictMath
{
// Method
// 1. Argument reduction:
- // Given x, find r and integer k such that
+ // Given x, find r and integer k such that
//
// x = k * ln(2) + r, |r| <= 0.5 * ln(2)
//
// Here a correction term c will be computed to compensate
- // the error in r when rounded to a floating-point number.
+ // the error in r when rounded to a floating-point number.
//
// 2. Approximating expm1(r) by a special rational function on
- // the interval [0, 0.5 * ln(2)]:
- // Since
- // r*(exp(r)+1)/(exp(r)-1) = 2 + r^2/6 - r^4/360 + ...
- // we define R1(r*r) by
- // r*(exp(r)+1)/(exp(r)-1) = 2 + r^2/6 * R1(r*r)
- // That is,
- // R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)
- // = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))
- // = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...
+ // the interval [0, 0.5 * ln(2)]:
+ // Since
+ // r*(exp(r)+1)/(exp(r)-1) = 2 + r^2/6 - r^4/360 + ...
+ // we define R1(r*r) by
+ // r*(exp(r)+1)/(exp(r)-1) = 2 + r^2/6 * R1(r*r)
+ // That is,
+ // R1(r**2) = 6/r *((exp(r)+1)/(exp(r)-1) - 2/r)
+ // = 6/r * ( 1 + 2.0*(1/(exp(r)-1) - 1/r))
+ // = 1 - r^2/60 + r^4/2520 - r^6/100800 + ...
// We use a special Remes algorithm on [0, 0.347] to generate
- // a polynomial of degree 5 in r*r to approximate R1. The
- // maximum error of this polynomial approximation is bounded
- // by 2**-61. In other words,
- // R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5
- // where Q1 = -1.6666666666666567384E-2,
- // Q2 = 3.9682539681370365873E-4,
- // Q3 = -9.9206344733435987357E-6,
- // Q4 = 2.5051361420808517002E-7,
- // Q5 = -6.2843505682382617102E-9;
- // (where z=r*r, and Q1 to Q5 are called EXPM1_Qx in the source)
- // with error bounded by
- // | 5 | -61
- // | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2
- // | |
+ // a polynomial of degree 5 in r*r to approximate R1. The
+ // maximum error of this polynomial approximation is bounded
+ // by 2**-61. In other words,
+ // R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5
+ // where Q1 = -1.6666666666666567384E-2,
+ // Q2 = 3.9682539681370365873E-4,
+ // Q3 = -9.9206344733435987357E-6,
+ // Q4 = 2.5051361420808517002E-7,
+ // Q5 = -6.2843505682382617102E-9;
+ // (where z=r*r, and Q1 to Q5 are called EXPM1_Qx in the source)
+ // with error bounded by
+ // | 5 | -61
+ // | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2
+ // | |
//
- // expm1(r) = exp(r)-1 is then computed by the following
- // specific way which minimize the accumulation rounding error:
- // 2 3
- // r r [ 3 - (R1 + R1*r/2) ]
- // expm1(r) = r + --- + --- * [--------------------]
- // 2 2 [ 6 - r*(3 - R1*r/2) ]
+ // expm1(r) = exp(r)-1 is then computed by the following
+ // specific way which minimize the accumulation rounding error:
+ // 2 3
+ // r r [ 3 - (R1 + R1*r/2) ]
+ // expm1(r) = r + --- + --- * [--------------------]
+ // 2 2 [ 6 - r*(3 - R1*r/2) ]
//
- // To compensate the error in the argument reduction, we use
- // expm1(r+c) = expm1(r) + c + expm1(r)*c
- // ~ expm1(r) + c + r*c
- // Thus c+r*c will be added in as the correction terms for
- // expm1(r+c). Now rearrange the term to avoid optimization
- // screw up:
- // ( 2 2 )
- // ({ ( r [ R1 - (3 - R1*r/2) ] ) } r )
- // expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )
- // ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 )
+ // To compensate the error in the argument reduction, we use
+ // expm1(r+c) = expm1(r) + c + expm1(r)*c
+ // ~ expm1(r) + c + r*c
+ // Thus c+r*c will be added in as the correction terms for
+ // expm1(r+c). Now rearrange the term to avoid optimization
+ // screw up:
+ // ( 2 2 )
+ // ({ ( r [ R1 - (3 - R1*r/2) ] ) } r )
+ // expm1(r+c)~r - ({r*(--- * [--------------------]-c)-c} - --- )
+ // ({ ( 2 [ 6 - r*(3 - R1*r/2) ] ) } 2 )
// ( )
//
- // = r - E
+ // = r - E
// 3. Scale back to obtain expm1(x):
- // From step 1, we have
- // expm1(x) = either 2^k*[expm1(r)+1] - 1
- // = or 2^k*[expm1(r) + (1-2^-k)]
+ // From step 1, we have
+ // expm1(x) = either 2^k*[expm1(r)+1] - 1
+ // = or 2^k*[expm1(r) + (1-2^-k)]
// 4. Implementation notes:
- // (A). To save one multiplication, we scale the coefficient Qi
- // to Qi*2^i, and replace z by (x^2)/2.
- // (B). To achieve maximum accuracy, we compute expm1(x) by
- // (i) if x < -56*ln2, return -1.0, (raise inexact if x!=inf)
- // (ii) if k=0, return r-E
- // (iii) if k=-1, return 0.5*(r-E)-0.5
- // (iv) if k=1 if r < -0.25, return 2*((r+0.5)- E)
- // else return 1.0+2.0*(r-E);
- // (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)
- // (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else
- // (vii) return 2^k(1-((E+2^-k)-r))
+ // (A). To save one multiplication, we scale the coefficient Qi
+ // to Qi*2^i, and replace z by (x^2)/2.
+ // (B). To achieve maximum accuracy, we compute expm1(x) by
+ // (i) if x < -56*ln2, return -1.0, (raise inexact if x!=inf)
+ // (ii) if k=0, return r-E
+ // (iii) if k=-1, return 0.5*(r-E)-0.5
+ // (iv) if k=1 if r < -0.25, return 2*((r+0.5)- E)
+ // else return 1.0+2.0*(r-E);
+ // (v) if (k<-2||k>56) return 2^k(1-(E-r)) - 1 (or exp(x)-1)
+ // (vi) if k <= 20, return 2^k((1-2^-k)-(E-r)), else
+ // (vii) return 2^k(1-((E+2^-k)-r))
boolean negative = (x < 0);
double y, hi, lo, c, t, e, hxs, hfx, r1;
@@ -1175,52 +1175,52 @@ public final strictfp class StrictMath
// handle special cases and large arguments
if (h_bits >= 0x4043687aL) // if |x| >= 56 * ln(2)
{
- if (h_bits >= 0x40862e42L) // if |x| >= EXP_LIMIT_H
- {
- if (h_bits >= 0x7ff00000L)
- {
- if (((h_bits & 0x000fffffL) | (l_bits & 0xffffffffL)) != 0)
- return x; // exp(NaN) = NaN
- else
- return negative ? -1.0 : x; // exp({+-inf}) = {+inf, -1}
- }
-
- if (x > EXP_LIMIT_H)
- return Double.POSITIVE_INFINITY; // overflow
- }
-
- if (negative) // x <= -56 * ln(2)
- return -1.0;
+ if (h_bits >= 0x40862e42L) // if |x| >= EXP_LIMIT_H
+ {
+ if (h_bits >= 0x7ff00000L)
+ {
+ if (((h_bits & 0x000fffffL) | (l_bits & 0xffffffffL)) != 0)
+ return x; // exp(NaN) = NaN
+ else
+ return negative ? -1.0 : x; // exp({+-inf}) = {+inf, -1}
+ }
+
+ if (x > EXP_LIMIT_H)
+ return Double.POSITIVE_INFINITY; // overflow
+ }
+
+ if (negative) // x <= -56 * ln(2)
+ return -1.0;
}
// argument reduction
if (h_bits > 0x3fd62e42L) // |x| > 0.5 * ln(2)
{
- if (h_bits < 0x3ff0a2b2L) // |x| < 1.5 * ln(2)
- {
- if (negative)
- {
- hi = x + LN2_H;
- lo = -LN2_L;
- k = -1;
- }
- else
- {
- hi = x - LN2_H;
- lo = LN2_L;
- k = 1;
- }
- }
- else
- {
- k = (int) (INV_LN2 * x + (negative ? - 0.5 : 0.5));
- t = k;
- hi = x - t * LN2_H;
- lo = t * LN2_L;
- }
-
- x = hi - lo;
- c = (hi - x) - lo;
+ if (h_bits < 0x3ff0a2b2L) // |x| < 1.5 * ln(2)
+ {
+ if (negative)
+ {
+ hi = x + LN2_H;
+ lo = -LN2_L;
+ k = -1;
+ }
+ else
+ {
+ hi = x - LN2_H;
+ lo = LN2_L;
+ k = 1;
+ }
+ }
+ else
+ {
+ k = (int) (INV_LN2 * x + (negative ? - 0.5 : 0.5));
+ t = k;
+ hi = x - t * LN2_H;
+ lo = t * LN2_L;
+ }
+
+ x = hi - lo;
+ c = (hi - x) - lo;
}
else if (h_bits < 0x3c900000L) // |x| < 2^-54 return x
@@ -1232,85 +1232,85 @@ public final strictfp class StrictMath
hfx = 0.5 * x;
hxs = x * hfx;
r1 = 1.0 + hxs * (EXPM1_Q1
- + hxs * (EXPM1_Q2
+ + hxs * (EXPM1_Q2
+ hxs * (EXPM1_Q3
- + hxs * (EXPM1_Q4
- + hxs * EXPM1_Q5))));
+ + hxs * (EXPM1_Q4
+ + hxs * EXPM1_Q5))));
t = 3.0 - r1 * hfx;
e = hxs * ((r1 - t) / (6.0 - x * t));
if (k == 0)
{
- return x - (x * e - hxs); // c == 0
+ return x - (x * e - hxs); // c == 0
}
else
{
- e = x * (e - c) - c;
- e -= hxs;
+ e = x * (e - c) - c;
+ e -= hxs;
- if (k == -1)
- return 0.5 * (x - e) - 0.5;
+ if (k == -1)
+ return 0.5 * (x - e) - 0.5;
- if (k == 1)
- {
- if (x < - 0.25)
- return -2.0 * (e - (x + 0.5));
- else
- return 1.0 + 2.0 * (x - e);
- }
+ if (k == 1)
+ {
+ if (x < - 0.25)
+ return -2.0 * (e - (x + 0.5));
+ else
+ return 1.0 + 2.0 * (x - e);
+ }
- if (k <= -2 || k > 56) // sufficient to return exp(x) - 1
- {
- y = 1.0 - (e - x);
+ if (k <= -2 || k > 56) // sufficient to return exp(x) - 1
+ {
+ y = 1.0 - (e - x);
- bits = Double.doubleToLongBits(y);
- h_bits = getHighDWord(bits);
- l_bits = getLowDWord(bits);
+ bits = Double.doubleToLongBits(y);
+ h_bits = getHighDWord(bits);
+ l_bits = getLowDWord(bits);
- h_bits += (k << 20); // add k to y's exponent
+ h_bits += (k << 20); // add k to y's exponent
- y = buildDouble(l_bits, h_bits);
+ y = buildDouble(l_bits, h_bits);
- return y - 1.0;
- }
+ return y - 1.0;
+ }
- t = 1.0;
- if (k < 20)
- {
- bits = Double.doubleToLongBits(t);
- h_bits = 0x3ff00000L - (0x00200000L >> k);
- l_bits = getLowDWord(bits);
+ t = 1.0;
+ if (k < 20)
+ {
+ bits = Double.doubleToLongBits(t);
+ h_bits = 0x3ff00000L - (0x00200000L >> k);
+ l_bits = getLowDWord(bits);
- t = buildDouble(l_bits, h_bits); // t = 1 - 2^(-k)
- y = t - (e - x);
+ t = buildDouble(l_bits, h_bits); // t = 1 - 2^(-k)
+ y = t - (e - x);
- bits = Double.doubleToLongBits(y);
- h_bits = getHighDWord(bits);
- l_bits = getLowDWord(bits);
+ bits = Double.doubleToLongBits(y);
+ h_bits = getHighDWord(bits);
+ l_bits = getLowDWord(bits);
- h_bits += (k << 20); // add k to y's exponent
+ h_bits += (k << 20); // add k to y's exponent
- y = buildDouble(l_bits, h_bits);
- }
- else
- {
- bits = Double.doubleToLongBits(t);
- h_bits = (0x000003ffL - k) << 20;
- l_bits = getLowDWord(bits);
+ y = buildDouble(l_bits, h_bits);
+ }
+ else
+ {
+ bits = Double.doubleToLongBits(t);
+ h_bits = (0x000003ffL - k) << 20;
+ l_bits = getLowDWord(bits);
- t = buildDouble(l_bits, h_bits); // t = 2^(-k)
+ t = buildDouble(l_bits, h_bits); // t = 2^(-k)
- y = x - (e + t);
- y += 1.0;
+ y = x - (e + t);
+ y += 1.0;
- bits = Double.doubleToLongBits(y);
- h_bits = getHighDWord(bits);
- l_bits = getLowDWord(bits);
+ bits = Double.doubleToLongBits(y);
+ h_bits = getHighDWord(bits);
+ l_bits = getLowDWord(bits);
- h_bits += (k << 20); // add k to y's exponent
+ h_bits += (k << 20); // add k to y's exponent
- y = buildDouble(l_bits, h_bits);
- }
+ y = buildDouble(l_bits, h_bits);
+ }
}
return y;
@@ -2504,7 +2504,7 @@ public final strictfp class StrictMath
* <li>If <code>a</code> is positive or negative zero, the result is the
* same.</li>
* </ul>
- *
+ *
* @param a the numeric argument.
* @return the sign of the argument.
* @since 1.5.
@@ -2526,7 +2526,7 @@ public final strictfp class StrictMath
* <li>If <code>a</code> is positive or negative zero, the result is the
* same.</li>
* </ul>
- *
+ *
* @param a the numeric argument.
* @return the sign of the argument.
* @since 1.5.
diff --git a/java/lang/String.java b/java/lang/String.java
index c8c6cb962..45c0daff6 100644
--- a/java/lang/String.java
+++ b/java/lang/String.java
@@ -107,7 +107,7 @@ public final class String
* @see CharData#UPPER_EXPAND
*/
private static final char[] upperExpand
- = zeroBasedStringValue(CharData.UPPER_EXPAND);
+ = zeroBasedStringValue(CharData.UPPER_EXPAND);
/**
* Stores unicode multi-character uppercase special casing table.
@@ -115,8 +115,8 @@ public final class String
* @see CharData#UPPER_SPECIAL
*/
private static final char[] upperSpecial
- = zeroBasedStringValue(CharData.UPPER_SPECIAL);
-
+ = zeroBasedStringValue(CharData.UPPER_SPECIAL);
+
/**
* Characters which make up the String.
* Package access is granted for use by StringBuffer.
@@ -281,7 +281,7 @@ public final class String
// equivalent to: offset + count < 0 || offset + count > ascii.length
if (ascii.length - offset < count)
throw new StringIndexOutOfBoundsException("offset + count: "
- + (offset + count));
+ + (offset + count));
value = new char[count];
this.offset = 0;
this.count = count;
@@ -355,18 +355,18 @@ public final class String
{
try
{
- return Charset.forName(encoding);
+ return Charset.forName(encoding);
}
catch(IllegalCharsetNameException e)
{
- throw new UnsupportedEncodingException("Encoding: "+encoding+
- " not found.");
+ throw new UnsupportedEncodingException("Encoding: "+encoding+
+ " not found.");
}
catch(UnsupportedCharsetException e)
{
- throw new UnsupportedEncodingException("Encoding: "+encoding+
- " not found.");
- }
+ throw new UnsupportedEncodingException("Encoding: "+encoding+
+ " not found.");
+ }
}
/**
@@ -397,31 +397,31 @@ public final class String
// equivalent to: offset + count < 0 || offset + count > data.length
if (data.length - offset < count)
throw new StringIndexOutOfBoundsException("offset + count: "
- + (offset + count));
- try
+ + (offset + count));
+ try
{
CharsetDecoder csd = encoding.newDecoder();
- csd.onMalformedInput(CodingErrorAction.REPLACE);
- csd.onUnmappableCharacter(CodingErrorAction.REPLACE);
- CharBuffer cbuf = csd.decode(ByteBuffer.wrap(data, offset, count));
- if(cbuf.hasArray())
- {
- value = cbuf.array();
- this.offset = cbuf.position();
- this.count = cbuf.remaining();
- } else {
- // Doubt this will happen. But just in case.
- value = new char[cbuf.remaining()];
- cbuf.get(value);
- this.offset = 0;
- this.count = value.length;
- }
- }
+ csd.onMalformedInput(CodingErrorAction.REPLACE);
+ csd.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ CharBuffer cbuf = csd.decode(ByteBuffer.wrap(data, offset, count));
+ if(cbuf.hasArray())
+ {
+ value = cbuf.array();
+ this.offset = cbuf.position();
+ this.count = cbuf.remaining();
+ } else {
+ // Doubt this will happen. But just in case.
+ value = new char[cbuf.remaining()];
+ cbuf.get(value);
+ this.offset = 0;
+ this.count = value.length;
+ }
+ }
catch(CharacterCodingException e)
{
- // This shouldn't ever happen.
- throw (InternalError) new InternalError().initCause(e);
- }
+ // This shouldn't ever happen.
+ throw (InternalError) new InternalError().initCause(e);
+ }
}
/**
@@ -494,39 +494,39 @@ public final class String
// equivalent to: offset + count < 0 || offset + count > data.length
if (data.length - offset < count)
throw new StringIndexOutOfBoundsException("offset + count: "
- + (offset + count));
+ + (offset + count));
int o, c;
char[] v;
String encoding;
- try
- {
- encoding = System.getProperty("file.encoding");
- CharsetDecoder csd = Charset.forName(encoding).newDecoder();
- csd.onMalformedInput(CodingErrorAction.REPLACE);
- csd.onUnmappableCharacter(CodingErrorAction.REPLACE);
- CharBuffer cbuf = csd.decode(ByteBuffer.wrap(data, offset, count));
- if(cbuf.hasArray())
- {
+ try
+ {
+ encoding = System.getProperty("file.encoding");
+ CharsetDecoder csd = Charset.forName(encoding).newDecoder();
+ csd.onMalformedInput(CodingErrorAction.REPLACE);
+ csd.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ CharBuffer cbuf = csd.decode(ByteBuffer.wrap(data, offset, count));
+ if(cbuf.hasArray())
+ {
v = cbuf.array();
- o = cbuf.position();
- c = cbuf.remaining();
- } else {
- // Doubt this will happen. But just in case.
- v = new char[cbuf.remaining()];
- cbuf.get(v);
- o = 0;
- c = v.length;
- }
- } catch(Exception ex){
- // If anything goes wrong (System property not set,
- // NIO provider not available, etc)
- // Default to the 'safe' encoding ISO8859_1
- v = new char[count];
- o = 0;
- c = count;
- for (int i=0;i<count;i++)
- v[i] = (char)data[offset+i];
- }
+ o = cbuf.position();
+ c = cbuf.remaining();
+ } else {
+ // Doubt this will happen. But just in case.
+ v = new char[cbuf.remaining()];
+ cbuf.get(v);
+ o = 0;
+ c = v.length;
+ }
+ } catch(Exception ex){
+ // If anything goes wrong (System property not set,
+ // NIO provider not available, etc)
+ // Default to the 'safe' encoding ISO8859_1
+ v = new char[count];
+ o = 0;
+ c = count;
+ for (int i=0;i<count;i++)
+ v[i] = (char)data[offset+i];
+ }
this.value = v;
this.offset = o;
this.count = c;
@@ -610,7 +610,7 @@ public final class String
// equivalent to: offset + count < 0 || offset + count > data.length
if (data.length - offset < count)
throw new StringIndexOutOfBoundsException("offset + count: "
- + (offset + count));
+ + (offset + count));
if (dont_copy)
{
value = data;
@@ -631,7 +631,7 @@ public final class String
* @param codePoints the entire array of code points
* @param offset the start of the subarray
* @param count the length of the subarray
- *
+ *
* @throws IllegalArgumentException if an invalid code point is found
* in the codePoints array
* @throws IndexOutOfBoundsException if offset is negative or offset + count
@@ -640,34 +640,34 @@ public final class String
public String(int[] codePoints, int offset, int count)
{
// FIXME: This implementation appears to give correct internal
- // representation of the String because:
+ // representation of the String because:
// - length() is correct
- // - getting a char[] from toCharArray() and testing
+ // - getting a char[] from toCharArray() and testing
// Character.codePointAt() on all the characters in that array gives
// the appropriate results
- // however printing the String gives incorrect results. This may be
+ // however printing the String gives incorrect results. This may be
// due to printing method errors (such as incorrectly looping through
// the String one char at a time rather than one "character" at a time.
-
+
if (offset < 0)
throw new IndexOutOfBoundsException();
int end = offset + count;
int pos = 0;
// This creates a char array that is long enough for all of the code
// points to represent supplementary characters. This is more than likely
- // a waste of storage, so we use it only temporarily and then copy the
+ // a waste of storage, so we use it only temporarily and then copy the
// used portion into the value array.
char[] temp = new char[2 * codePoints.length];
for (int i = offset; i < end; i++)
{
- pos += Character.toChars(codePoints[i], temp, pos);
+ pos += Character.toChars(codePoints[i], temp, pos);
}
this.count = pos;
this.value = new char[pos];
System.arraycopy(temp, 0, value, 0, pos);
this.offset = 0;
}
-
+
/**
* Returns the number of characters contained in this String.
*
@@ -813,25 +813,25 @@ public final class String
*/
public byte[] getBytes(Charset enc)
{
- try
+ try
{
- CharsetEncoder cse = enc.newEncoder();
- cse.onMalformedInput(CodingErrorAction.REPLACE);
- cse.onUnmappableCharacter(CodingErrorAction.REPLACE);
- ByteBuffer bbuf = cse.encode(CharBuffer.wrap(value, offset, count));
- if(bbuf.hasArray())
- return bbuf.array();
-
- // Doubt this will happen. But just in case.
- byte[] bytes = new byte[bbuf.remaining()];
- bbuf.get(bytes);
- return bytes;
- }
+ CharsetEncoder cse = enc.newEncoder();
+ cse.onMalformedInput(CodingErrorAction.REPLACE);
+ cse.onUnmappableCharacter(CodingErrorAction.REPLACE);
+ ByteBuffer bbuf = cse.encode(CharBuffer.wrap(value, offset, count));
+ if(bbuf.hasArray())
+ return bbuf.array();
+
+ // Doubt this will happen. But just in case.
+ byte[] bytes = new byte[bbuf.remaining()];
+ bbuf.get(bytes);
+ return bytes;
+ }
catch(CharacterCodingException e)
{
- // This shouldn't ever happen.
- throw (InternalError) new InternalError().initCause(e);
- }
+ // This shouldn't ever happen.
+ throw (InternalError) new InternalError().initCause(e);
+ }
}
/**
@@ -845,18 +845,18 @@ public final class String
* @since 1.1
*/
public byte[] getBytes()
- {
- try
- {
- return getBytes(System.getProperty("file.encoding"));
- } catch(Exception e) {
- // XXX - Throw an error here?
- // For now, default to the 'safe' encoding.
- byte[] bytes = new byte[count];
- for(int i=0;i<count;i++)
- bytes[i] = (byte)((value[offset+i] <= 0xFF)?
- value[offset+i]:'?');
- return bytes;
+ {
+ try
+ {
+ return getBytes(System.getProperty("file.encoding"));
+ } catch(Exception e) {
+ // XXX - Throw an error here?
+ // For now, default to the 'safe' encoding.
+ byte[] bytes = new byte[count];
+ for(int i=0;i<count;i++)
+ bytes[i] = (byte)((value[offset+i] <= 0xFF)?
+ value[offset+i]:'?');
+ return bytes;
}
}
@@ -929,7 +929,7 @@ public final class String
return false;
for (int i = 0; i < count; ++i)
if (value[offset + i] != seq.charAt(i))
- return false;
+ return false;
return true;
}
@@ -1025,7 +1025,7 @@ public final class String
return result;
}
return count - str.count;
- }
+ }
/**
* Predicate which determines if this String matches another String
@@ -1789,7 +1789,7 @@ public final class String
if (begin == limit)
return "";
while (value[begin++] <= '\u0020');
-
+
int end = limit;
while (value[--end] <= '\u0020')
;
@@ -1991,10 +1991,10 @@ public final class String
}
/**
- * If two Strings are considered equal, by the equals() method,
- * then intern() will return the same String instance. ie.
- * if (s1.equals(s2)) then (s1.intern() == s2.intern()).
- * All string literals and string-valued constant expressions
+ * If two Strings are considered equal, by the equals() method,
+ * then intern() will return the same String instance. ie.
+ * if (s1.equals(s2)) then (s1.intern() == s2.intern()).
+ * All string literals and string-valued constant expressions
* are already interned.
*
* @return the interned String
@@ -2026,23 +2026,23 @@ public final class String
int count = 0;
while (start < end)
{
- char base = value[start];
- if (base < Character.MIN_HIGH_SURROGATE
- || base > Character.MAX_HIGH_SURROGATE
- || start == end
- || start == count
- || value[start + 1] < Character.MIN_LOW_SURROGATE
- || value[start + 1] > Character.MAX_LOW_SURROGATE)
- {
- // Nothing.
- }
- else
- {
- // Surrogate pair.
- ++start;
- }
- ++start;
- ++count;
+ char base = value[start];
+ if (base < Character.MIN_HIGH_SURROGATE
+ || base > Character.MAX_HIGH_SURROGATE
+ || start == end
+ || start == count
+ || value[start + 1] < Character.MIN_LOW_SURROGATE
+ || value[start + 1] > Character.MAX_LOW_SURROGATE)
+ {
+ // Nothing.
+ }
+ else
+ {
+ // Surrogate pair.
+ ++start;
+ }
+ ++start;
+ ++count;
}
return count;
}
@@ -2111,30 +2111,30 @@ public final class String
value = s.value;
else
{
- int count = s.count;
- value = new char[count];
- VMSystem.arraycopy(s.value, s.offset, value, 0, count);
+ int count = s.count;
+ value = new char[count];
+ VMSystem.arraycopy(s.value, s.offset, value, 0, count);
}
return value;
}
-
+
/**
* Returns true iff this String contains the sequence of Characters
* described in s.
* @param s the CharSequence
* @return true iff this String contains s
- *
+ *
* @since 1.5
*/
public boolean contains (CharSequence s)
{
return this.indexOf(s.toString()) != -1;
}
-
+
/**
* Returns a string that is this string with all instances of the sequence
- * represented by <code>target</code> replaced by the sequence in
+ * represented by <code>target</code> replaced by the sequence in
* <code>replacement</code>.
* @param target the sequence to be replaced
* @param replacement the sequence used as the replacement
@@ -2146,9 +2146,9 @@ public final class String
String replaceString = replacement.toString();
int targetLength = target.length();
int replaceLength = replacement.length();
-
+
int startPos = this.indexOf(targetString);
- CPStringBuilder result = new CPStringBuilder(this);
+ CPStringBuilder result = new CPStringBuilder(this);
while (startPos != -1)
{
// Replace the target with the replacement
@@ -2159,15 +2159,15 @@ public final class String
}
return result.toString();
}
-
+
/**
- * Return the index into this String that is offset from the given index by
+ * Return the index into this String that is offset from the given index by
* <code>codePointOffset</code> code points.
* @param index the index at which to start
* @param codePointOffset the number of code points to offset
* @return the index into this String that is <code>codePointOffset</code>
* code points offset from <code>index</code>.
- *
+ *
* @throws IndexOutOfBoundsException if index is negative or larger than the
* length of this string.
* @throws IndexOutOfBoundsException if codePointOffset is positive and the
@@ -2180,7 +2180,7 @@ public final class String
{
if (index < 0 || index > count)
throw new IndexOutOfBoundsException();
-
+
return Character.offsetByCodePoints(value, offset, count, offset + index,
codePointOffset);
}
diff --git a/java/lang/StringBuffer.java b/java/lang/StringBuffer.java
index b105f55da..81a52f6d4 100644
--- a/java/lang/StringBuffer.java
+++ b/java/lang/StringBuffer.java
@@ -691,7 +691,7 @@ public final class StringBuffer
* @since 1.5
*/
public synchronized StringBuffer insert(int offset, CharSequence sequence,
- int start, int end)
+ int start, int end)
{
super.insert(offset, sequence, start, end);
return this;
diff --git a/java/lang/StringBuilder.java b/java/lang/StringBuilder.java
index aefe9272b..83a064ad0 100644
--- a/java/lang/StringBuilder.java
+++ b/java/lang/StringBuilder.java
@@ -291,7 +291,7 @@ public final class StringBuilder
* @return this <code>StringBuilder</code>
*/
public StringBuilder append(CharSequence seq, int start,
- int end)
+ int end)
{
super.append(seq, start, end);
return this;
@@ -487,7 +487,7 @@ public final class StringBuilder
* @throws StringIndexOutOfBoundsException if any index is out of bounds
*/
public StringBuilder insert(int offset,
- char[] str, int str_offset, int len)
+ char[] str, int str_offset, int len)
{
super.insert(offset, str, str_offset, len);
return this;
@@ -556,7 +556,7 @@ public final class StringBuilder
* or end are out of bounds
*/
public StringBuilder insert(int offset, CharSequence sequence,
- int start, int end)
+ int start, int end)
{
super.insert(offset, sequence, start, end);
return this;
diff --git a/java/lang/System.java b/java/lang/System.java
index 58b1bbad3..39d6da229 100644
--- a/java/lang/System.java
+++ b/java/lang/System.java
@@ -134,7 +134,7 @@ public final class System
SecurityManager sm = SecurityManager.current; // Be thread-safe.
if (sm != null)
sm.checkPermission(new RuntimePermission("setIO"));
-
+
VMSystem.setIn(in);
}
@@ -151,7 +151,7 @@ public final class System
{
SecurityManager sm = SecurityManager.current; // Be thread-safe.
if (sm != null)
- sm.checkPermission(new RuntimePermission("setIO"));
+ sm.checkPermission(new RuntimePermission("setIO"));
VMSystem.setOut(out);
}
@@ -202,15 +202,15 @@ public final class System
// preload it here.
if (SecurityManager.current == null)
{
- try
- {
- Class.forName("java.security.Security");
- }
- catch (ClassNotFoundException e)
- {
- }
+ try
+ {
+ Class.forName("java.security.Security");
+ }
+ catch (ClassNotFoundException e)
+ {
+ }
}
-
+
SecurityManager.current = sm;
}
@@ -237,8 +237,8 @@ public final class System
{
return VMSystem.currentTimeMillis();
}
-
- /**
+
+ /**
* <p>
* Returns the current value of a nanosecond-precise system timer.
* The value of the timer is an offset relative to some arbitrary fixed
@@ -261,7 +261,7 @@ public final class System
* </p>
*
* @return the time of a system timer in nanoseconds.
- * @since 1.5
+ * @since 1.5
*/
public static long nanoTime()
{
@@ -365,7 +365,7 @@ public final class System
* <dt>gnu.java.io.encoding_scheme_alias.iso-latin-_?</dt> <dd>8859_?</dd>
* <dt>gnu.java.io.encoding_scheme_alias.latin?</dt> <dd>8859_?</dd>
* <dt>gnu.java.io.encoding_scheme_alias.utf-8</dt> <dd>UTF8</dd>
- * <dt>gnu.java.util.zoneinfo.dir</dt> <dd>Root of zoneinfo tree</dd>
+ * <dt>gnu.java.util.zoneinfo.dir</dt> <dd>Root of zoneinfo tree</dd>
* <dt>gnu.javax.print.server</dt> <dd>Hostname of external CUPS server.</dd>
* </dl>
*
@@ -549,7 +549,7 @@ public final class System
if (environmentMap == null)
{
- Map<String,String> variables = new EnvironmentMap();
+ Map<String,String> variables = new EnvironmentMap();
List<String> environ = (List<String>)VMSystem.environ();
for (String envEntry : environ)
{
@@ -558,16 +558,16 @@ public final class System
{
// it's perfectly legal that some entries may be in the form
// key=value=value=value
- int equalSignIndex = envEntry.indexOf('=');
+ int equalSignIndex = envEntry.indexOf('=');
String key = envEntry.substring(0, equalSignIndex);
String value = envEntry.substring(equalSignIndex + 1);
variables.put(key, value);
}
}
-
+
environmentMap = Collections.unmodifiableMap(variables);
}
-
+
return environmentMap;
}
@@ -731,7 +731,7 @@ public final class System
{
c = coll;
}
-
+
/**
* Blocks queries containing a null object or an object which
* isn't of type <code>String</code>. All other queries
@@ -745,15 +745,15 @@ public final class System
public boolean contains(Object obj)
{
if (obj == null)
- throw new
- NullPointerException("This collection does not support " +
- "null values.");
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
if (!(obj instanceof String))
- throw new
- ClassCastException("This collection only supports Strings.");
+ throw new
+ ClassCastException("This collection only supports Strings.");
return c.contains(obj);
}
-
+
/**
* Blocks queries where the collection contains a null object or
* an object which isn't of type <code>String</code>. All other
@@ -768,15 +768,15 @@ public final class System
public boolean containsAll(Collection<?> coll)
{
for (Object o: coll)
- {
- if (o == null)
- throw new
- NullPointerException("This collection does not support " +
- "null values.");
- if (!(o instanceof String))
- throw new
- ClassCastException("This collection only supports Strings.");
- }
+ {
+ if (o == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(o instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ }
return c.containsAll(coll);
}
@@ -790,7 +790,7 @@ public final class System
{
return c.iterator();
}
-
+
/**
* Blocks the removal of elements from the collection.
*
@@ -802,15 +802,15 @@ public final class System
public boolean remove(Object key)
{
if (key == null)
- throw new
- NullPointerException("This collection does not support " +
- "null values.");
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
if (!(key instanceof String))
- throw new
- ClassCastException("This collection only supports Strings.");
+ throw new
+ ClassCastException("This collection only supports Strings.");
return c.contains(key);
- }
-
+ }
+
/**
* Blocks the removal of all elements in the specified
* collection from the collection.
@@ -824,18 +824,18 @@ public final class System
public boolean removeAll(Collection<?> coll)
{
for (Object o: coll)
- {
- if (o == null)
- throw new
- NullPointerException("This collection does not support " +
- "null values.");
- if (!(o instanceof String))
- throw new
- ClassCastException("This collection only supports Strings.");
- }
+ {
+ if (o == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(o instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ }
return c.removeAll(coll);
}
-
+
/**
* Blocks the retention of all elements in the specified
* collection from the collection.
@@ -849,15 +849,15 @@ public final class System
public boolean retainAll(Collection<?> coll)
{
for (Object o: coll)
- {
- if (o == null)
- throw new
- NullPointerException("This collection does not support " +
- "null values.");
- if (!(o instanceof String))
- throw new
- ClassCastException("This collection only supports Strings.");
- }
+ {
+ if (o == null)
+ throw new
+ NullPointerException("This collection does not support " +
+ "null values.");
+ if (!(o instanceof String))
+ throw new
+ ClassCastException("This collection only supports Strings.");
+ }
return c.containsAll(coll);
}
@@ -877,14 +877,14 @@ public final class System
/**
* This is a specialised <code>HashMap</code>, which
* prevents the addition or querying of anything other than
- * <code>String</code> objects.
+ * <code>String</code> objects.
*
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
static class EnvironmentMap
extends HashMap<String,String>
{
-
+
/**
* Cache the entry set.
*/
@@ -915,7 +915,7 @@ public final class System
* @param m the map to be added to this.
* @throws NullPointerException if a key or value is null.
* @throws ClassCastException if a key or value is not a String.
- */
+ */
EnvironmentMap(Map<String,String> m)
{
super(m);
@@ -933,14 +933,14 @@ public final class System
public boolean containsKey(Object key)
{
if (key == null)
- throw new
- NullPointerException("This map does not support null keys.");
+ throw new
+ NullPointerException("This map does not support null keys.");
if (!(key instanceof String))
- throw new
- ClassCastException("This map only allows queries using Strings.");
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
return super.containsKey(key);
}
-
+
/**
* Blocks queries using a null or non-<code>String</code> value.
* All other queries are forwarded to the superclass.
@@ -952,11 +952,11 @@ public final class System
public boolean containsValue(Object value)
{
if (value == null)
- throw new
- NullPointerException("This map does not support null values.");
+ throw new
+ NullPointerException("This map does not support null values.");
if (!(value instanceof String))
- throw new
- ClassCastException("This map only allows queries using Strings.");
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
return super.containsValue(value);
}
@@ -985,14 +985,14 @@ public final class System
public String get(Object key)
{
if (key == null)
- throw new
- NullPointerException("This map does not support null keys.");
+ throw new
+ NullPointerException("This map does not support null keys.");
if (!(key instanceof String))
- throw new
- ClassCastException("This map only allows queries using Strings.");
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
return super.get(key);
}
-
+
/**
* Returns a set view of the keys, with the same
* provisions as for the underlying map.
@@ -1021,13 +1021,13 @@ public final class System
public String put(String key, String value)
{
if (key == null)
- throw new NullPointerException("A new key is null.");
+ throw new NullPointerException("A new key is null.");
if (value == null)
- throw new NullPointerException("A new value is null.");
+ throw new NullPointerException("A new value is null.");
if (!(key instanceof String))
- throw new ClassCastException("A new key is not a String.");
+ throw new ClassCastException("A new key is not a String.");
if (!(value instanceof String))
- throw new ClassCastException("A new value is not a String.");
+ throw new ClassCastException("A new value is not a String.");
return super.put(key, value);
}
@@ -1043,14 +1043,14 @@ public final class System
public String remove(Object key)
{
if (key == null)
- throw new
- NullPointerException("This map does not support null keys.");
+ throw new
+ NullPointerException("This map does not support null keys.");
if (!(key instanceof String))
- throw new
- ClassCastException("This map only allows queries using Strings.");
+ throw new
+ ClassCastException("This map only allows queries using Strings.");
return super.remove(key);
}
-
+
/**
* Returns a collection view of the values, with the same
* provisions as for the underlying map.
@@ -1063,7 +1063,7 @@ public final class System
values = new EnvironmentCollection(super.values());
return values;
}
-
+
}
/**
diff --git a/java/lang/Thread.java b/java/lang/Thread.java
index 82e726187..bc2dbb5b7 100644
--- a/java/lang/Thread.java
+++ b/java/lang/Thread.java
@@ -143,13 +143,13 @@ public class Thread implements Runnable
/** This thread's ID. */
private final long threadId;
-
+
/** The park blocker. See LockSupport. */
Object parkBlocker;
/** The next thread number to use. */
private static int numAnonymousThreadsCreated;
-
+
/** Used to generate the next thread ID to use. */
private static long totalThreadsCreated;
@@ -354,10 +354,10 @@ public class Thread implements Runnable
Thread current = currentThread();
if (group == null)
{
- if (sm != null)
- group = sm.getThreadGroup();
- if (group == null)
- group = current.group;
+ if (sm != null)
+ group = sm.getThreadGroup();
+ if (group == null)
+ group = current.group;
}
if (sm != null)
sm.checkAccess(group);
@@ -368,7 +368,7 @@ public class Thread implements Runnable
this.runnable = target;
this.stacksize = size;
this.locals = new ThreadLocalMap();
-
+
synchronized (Thread.class)
{
this.threadId = ++totalThreadsCreated;
@@ -422,7 +422,7 @@ public class Thread implements Runnable
this.threadId = ++totalThreadsCreated;
}
}
-
+
/**
* Generate a name for an anonymous thread.
*/
@@ -510,7 +510,7 @@ public class Thread implements Runnable
{
throw new NoSuchMethodError();
}
-
+
/**
* Print a stack trace of the current thread to stderr using the same
* format as Throwable's printStackTrace() method.
@@ -540,7 +540,7 @@ public class Thread implements Runnable
{
return currentThread().group.enumerate(array);
}
-
+
/**
* Get this Thread's name.
*
@@ -731,7 +731,7 @@ public class Thread implements Runnable
if (t != null)
t.resume();
}
-
+
/**
* The method of Thread that will be run if there is no Runnable object
* associated with the Thread. Thread's implementation does nothing at all.
@@ -788,7 +788,7 @@ public class Thread implements Runnable
if (loader != null && sm != null)
{
// Get the calling classloader
- ClassLoader cl = VMStackWalker.getCallingClassLoader();
+ ClassLoader cl = VMStackWalker.getCallingClassLoader();
if (cl != null && !cl.isAncestorOf(loader))
sm.checkPermission(new RuntimePermission("getClassLoader"));
}
@@ -921,7 +921,7 @@ public class Thread implements Runnable
VMThread.create(this, stacksize);
}
-
+
/**
* Cause this Thread to stop abnormally because of the throw of a ThreadDeath
* error. If you stop a Thread that has not yet started, it will stop
@@ -992,9 +992,9 @@ public class Thread implements Runnable
}
VMThread vt = vmThread;
if (vt != null)
- vt.stop(t);
+ vt.stop(t);
else
- stillborn = t;
+ stillborn = t;
}
/**
@@ -1055,7 +1055,7 @@ public class Thread implements Runnable
public String toString()
{
return ("Thread[" + name + "," + priority + ","
- + (group == null ? "" : group.getName()) + "]");
+ + (group == null ? "" : group.getName()) + "]");
}
/**
@@ -1076,7 +1076,7 @@ public class Thread implements Runnable
return currentThread().locals;
}
- /**
+ /**
* Assigns the given <code>UncaughtExceptionHandler</code> to this
* thread. This will then be called if the thread terminates due
* to an uncaught exception, pre-empting that of the
@@ -1084,17 +1084,17 @@ public class Thread implements Runnable
*
* @param h the handler to use for this thread.
* @throws SecurityException if the current thread can't modify this thread.
- * @since 1.5
+ * @since 1.5
*/
public void setUncaughtExceptionHandler(UncaughtExceptionHandler h)
{
SecurityManager sm = SecurityManager.current; // Be thread-safe.
if (sm != null)
- sm.checkAccess(this);
+ sm.checkAccess(this);
exceptionHandler = h;
}
- /**
+ /**
* <p>
* Returns the handler used when this thread terminates due to an
* uncaught exception. The handler used is determined by the following:
@@ -1107,17 +1107,17 @@ public class Thread implements Runnable
* (which can only happen when the thread was terminated since
* then it won't have an associated thread group anymore).</li>
* </ul>
- *
+ *
* @return the appropriate <code>UncaughtExceptionHandler</code> or
* <code>null</code> if one can't be obtained.
- * @since 1.5
+ * @since 1.5
*/
public UncaughtExceptionHandler getUncaughtExceptionHandler()
{
return exceptionHandler != null ? exceptionHandler : group;
}
- /**
+ /**
* <p>
* Sets the default uncaught exception handler used when one isn't
* provided by the thread or its associated <code>ThreadGroup</code>.
@@ -1137,36 +1137,36 @@ public class Thread implements Runnable
* @throws SecurityException if a security manager is present and
* disallows the runtime permission
* "setDefaultUncaughtExceptionHandler".
- * @since 1.5
+ * @since 1.5
*/
- public static void
+ public static void
setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler h)
{
SecurityManager sm = SecurityManager.current; // Be thread-safe.
if (sm != null)
- sm.checkPermission(new RuntimePermission("setDefaultUncaughtExceptionHandler"));
+ sm.checkPermission(new RuntimePermission("setDefaultUncaughtExceptionHandler"));
defaultHandler = h;
}
- /**
+ /**
* Returns the handler used by default when a thread terminates
* unexpectedly due to an exception, or <code>null</code> if one doesn't
* exist.
*
* @return the default uncaught exception handler.
- * @since 1.5
+ * @since 1.5
*/
public static UncaughtExceptionHandler getDefaultUncaughtExceptionHandler()
{
return defaultHandler;
}
-
- /**
+
+ /**
* Returns the unique identifier for this thread. This ID is generated
* on thread creation, and may be re-used on its death.
*
* @return a positive long number representing the thread's ID.
- * @since 1.5
+ * @since 1.5
*/
public long getId()
{
@@ -1231,7 +1231,7 @@ public class Thread implements Runnable
void uncaughtException(Thread thr, Throwable exc);
}
- /**
+ /**
* <p>
* Represents the current state of a thread, according to the VM rather
* than the operating system. It can be one of the following:
@@ -1249,7 +1249,7 @@ public class Thread implements Runnable
* <li>TERMINATED -- The thread has exited.</li>
* </ul>
*
- * @since 1.5
+ * @since 1.5
*/
public enum State
{
@@ -1296,7 +1296,7 @@ public class Thread implements Runnable
* by the thread, with the most recent method forming the
* first element in the array. The array will be empty
* if the virtual machine can not obtain information on the
- * thread.
+ * thread.
* </p>
* <p>
* To execute this method, the current security manager
@@ -1304,7 +1304,7 @@ public class Thread implements Runnable
* <code>"getStackTrace"</code> and
* <code>"modifyThreadGroup"</code> {@link RuntimePermission}s.
* </p>
- *
+ *
* @return a map of threads to arrays of {@link StackTraceElement}s.
* @throws SecurityException if a security manager exists, and
* prevents either or both the runtime
@@ -1322,14 +1322,14 @@ public class Thread implements Runnable
int filled = group.enumerate(threadList);
while (filled == arraySize)
{
- arraySize *= 2;
- threadList = new Thread[arraySize];
- filled = group.enumerate(threadList);
+ arraySize *= 2;
+ threadList = new Thread[arraySize];
+ filled = group.enumerate(threadList);
}
Map traces = new HashMap();
for (int a = 0; a < filled; ++a)
traces.put(threadList[a],
- threadList[a].getStackTrace());
+ threadList[a].getStackTrace());
return traces;
}
diff --git a/java/lang/ThreadLocal.java b/java/lang/ThreadLocal.java
index 1f60a5553..71b722e55 100644
--- a/java/lang/ThreadLocal.java
+++ b/java/lang/ThreadLocal.java
@@ -100,7 +100,7 @@ public class ThreadLocal<T>
/**
* Allocate a new hash.
*/
- private synchronized int computeNextHash()
+ private synchronized int computeNextHash()
{
return nextHashBase++ * 6709;
}
diff --git a/java/lang/Throwable.java b/java/lang/Throwable.java
index f74851f0b..13bc5b903 100644
--- a/java/lang/Throwable.java
+++ b/java/lang/Throwable.java
@@ -423,32 +423,32 @@ public class Throwable implements Serializable
Throwable cause = getCause();
while (cause != null)
{
- // Cause start first line
+ // Cause start first line
sb.append("Caused by: ");
// Cause stacktrace
StackTraceElement[] parentStack = stack;
stack = cause.getStackTrace();
- if (parentStack == null || parentStack.length == 0)
- stackTraceStringBuffer(sb, cause.toString(), stack, 0);
- else
- {
- int equal = 0; // Count how many of the last stack frames are equal
- int frame = stack.length-1;
- int parentFrame = parentStack.length-1;
- while (frame > 0 && parentFrame > 0)
- {
- if (stack[frame].equals(parentStack[parentFrame]))
- {
- equal++;
- frame--;
- parentFrame--;
- }
- else
- break;
- }
- stackTraceStringBuffer(sb, cause.toString(), stack, equal);
- }
+ if (parentStack == null || parentStack.length == 0)
+ stackTraceStringBuffer(sb, cause.toString(), stack, 0);
+ else
+ {
+ int equal = 0; // Count how many of the last stack frames are equal
+ int frame = stack.length-1;
+ int parentFrame = parentStack.length-1;
+ while (frame > 0 && parentFrame > 0)
+ {
+ if (stack[frame].equals(parentStack[parentFrame]))
+ {
+ equal++;
+ frame--;
+ parentFrame--;
+ }
+ else
+ break;
+ }
+ stackTraceStringBuffer(sb, cause.toString(), stack, equal);
+ }
cause = cause.getCause();
}
@@ -458,7 +458,7 @@ public class Throwable implements Serializable
// Adds to the given StringBuffer a line containing the name and
// all stacktrace elements minus the last equal ones.
private static void stackTraceStringBuffer(CPStringBuilder sb, String name,
- StackTraceElement[] stack, int equal)
+ StackTraceElement[] stack, int equal)
{
String nl = StaticData.nl;
// (finish) first line
@@ -468,24 +468,24 @@ public class Throwable implements Serializable
// The stacktrace
if (stack == null || stack.length == 0)
{
- sb.append(" <<No stacktrace available>>");
- sb.append(nl);
+ sb.append(" <<No stacktrace available>>");
+ sb.append(nl);
}
else
{
- for (int i = 0; i < stack.length-equal; i++)
- {
- sb.append(" at ");
- sb.append(stack[i] == null ? "<<Unknown>>" : stack[i].toString());
- sb.append(nl);
- }
- if (equal > 0)
- {
- sb.append(" ...");
- sb.append(equal);
- sb.append(" more");
- sb.append(nl);
- }
+ for (int i = 0; i < stack.length-equal; i++)
+ {
+ sb.append(" at ");
+ sb.append(stack[i] == null ? "<<Unknown>>" : stack[i].toString());
+ sb.append(nl);
+ }
+ if (equal > 0)
+ {
+ sb.append(" ...");
+ sb.append(equal);
+ sb.append(" more");
+ sb.append(nl);
+ }
}
}
@@ -518,12 +518,12 @@ public class Throwable implements Serializable
{
if (stackTrace == null)
if (vmState == null)
- stackTrace = new StackTraceElement[0];
- else
- {
- stackTrace = vmState.getStackTrace(this);
- vmState = null; // No longer needed
- }
+ stackTrace = new StackTraceElement[0];
+ else
+ {
+ stackTrace = vmState.getStackTrace(this);
+ vmState = null; // No longer needed
+ }
return stackTrace;
}
@@ -548,9 +548,9 @@ public class Throwable implements Serializable
while (--i >= 0)
{
- st[i] = stackTrace[i];
- if (st[i] == null)
- throw new NullPointerException("Element " + i + " null");
+ st[i] = stackTrace[i];
+ if (st[i] == null)
+ throw new NullPointerException("Element " + i + " null");
}
this.stackTrace = st;
diff --git a/java/lang/TypeNotPresentException.java b/java/lang/TypeNotPresentException.java
index 65d98457e..4d6bf2399 100644
--- a/java/lang/TypeNotPresentException.java
+++ b/java/lang/TypeNotPresentException.java
@@ -43,7 +43,7 @@ package java.lang;
* Thrown when a type is accessed using a <code>String</code>-based
* representation, but no definition of the supplied type is found.
* This is effectively an unchecked equivalent of the existing
- * <code>ClassNotFound</code> exception.
+ * <code>ClassNotFound</code> exception.
* </p>
* <p>
* It may occur due to an attempt to load a missing class, interface or
@@ -66,7 +66,7 @@ public class TypeNotPresentException
* may be used to provide additional history, with regards to the
* root of the problem. It is perfectly valid for this to be null,
* if the cause of the problem is unknown.
- *
+ *
* @param typeName the name of the missing type.
* @param cause the cause of this exception, or null if the cause
* is unknown.
diff --git a/java/lang/UnsupportedOperationException.java b/java/lang/UnsupportedOperationException.java
index e691cc7c9..4994f6714 100644
--- a/java/lang/UnsupportedOperationException.java
+++ b/java/lang/UnsupportedOperationException.java
@@ -86,7 +86,7 @@ public class UnsupportedOperationException extends RuntimeException
* automatically incorporated into the resulting detail message of
* this exception.
* </p>
- *
+ *
* @param message the detail message, which should give the reason for
* this exception being thrown.
* @param cause the cause of this exception, or null if the cause
@@ -114,7 +114,7 @@ public class UnsupportedOperationException extends RuntimeException
* This makes this constructor very useful for simply wrapping another
* exception.
* </p>
- *
+ *
* @param cause the cause of this exception, or null if the cause
* is unknown.
* @since 1.5
diff --git a/java/lang/annotation/Annotation.java b/java/lang/annotation/Annotation.java
index cc334ec3b..aac8bb9f1 100644
--- a/java/lang/annotation/Annotation.java
+++ b/java/lang/annotation/Annotation.java
@@ -67,13 +67,13 @@ public interface Annotation
* annotation, according to the following:
* <ul>
* <li>If the members are <code>float</code>s, then, for floats
- * <code>x</code> and <code>y</code>,
+ * <code>x</code> and <code>y</code>,
* <code>Float.valueOf(x).equals(Float.valueOf(y)</code> must return
* true. This differs from the usual (<code>==</code>) comparison
* in that <code>NaN</code> is considered equal to itself and positive
* and negative zero are seen as different.</li>
* <li>Likewise, if the members are <code>double</code>s, then, for doubles
- * <code>x</code> and <code>y</code>,
+ * <code>x</code> and <code>y</code>,
* <code>Double.valueOf(x).equals(Double.valueOf(y)</code> must return
* true. This differs from the usual (<code>==</code>) comparison
* in that <code>NaN</code> is considered equal to itself and positive
diff --git a/java/lang/annotation/AnnotationTypeMismatchException.java b/java/lang/annotation/AnnotationTypeMismatchException.java
index 653305d63..bab32e0ea 100644
--- a/java/lang/annotation/AnnotationTypeMismatchException.java
+++ b/java/lang/annotation/AnnotationTypeMismatchException.java
@@ -44,7 +44,7 @@ import java.lang.reflect.Method;
* which the type has changed, since compilation or serialization
* took place. The mismatch between the compiled or serialized
* type and the current type causes this exception to be thrown.
- *
+ *
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
diff --git a/java/lang/annotation/IncompleteAnnotationException.java b/java/lang/annotation/IncompleteAnnotationException.java
index 5b20650d1..b511b36c2 100644
--- a/java/lang/annotation/IncompleteAnnotationException.java
+++ b/java/lang/annotation/IncompleteAnnotationException.java
@@ -40,8 +40,8 @@ package java.lang.annotation;
/**
* Thrown when accessing an element within an annotation which
* was added since compilation or serialization took place, and
- * does not have a default value.
- *
+ * does not have a default value.
+ *
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
@@ -59,7 +59,7 @@ public class IncompleteAnnotationException extends RuntimeException
* @param name the name of the missing element.
*/
public IncompleteAnnotationException(Class<? extends Annotation> type,
- String name)
+ String name)
{
this.annotationType = type;
this.elementName = name;
@@ -100,7 +100,7 @@ public class IncompleteAnnotationException extends RuntimeException
/**
* The name of the missing element.
*
- * @serial the name of the missing element.
+ * @serial the name of the missing element.
*/
private String elementName;
diff --git a/java/lang/instrument/ClassFileTransformer.java b/java/lang/instrument/ClassFileTransformer.java
index 01b2f8aaa..189a46a3c 100644
--- a/java/lang/instrument/ClassFileTransformer.java
+++ b/java/lang/instrument/ClassFileTransformer.java
@@ -67,9 +67,9 @@ public interface ClassFileTransformer
* @param protectionDomain the protection domain of the class being defined or
* redefined
* @param classfileBuffer the input byte buffer in class file format
- *
+ *
* @return a class file buffer or null when no transformation has been performed
- *
+ *
* @throws IllegalClassFormatException if the byte buffer does not represent
* a well-formed class file
* @see Instrumentation#redefineClasses(java.lang.instrument.ClassDefinition[])
@@ -82,4 +82,3 @@ public interface ClassFileTransformer
byte[] classfileBuffer)
throws IllegalClassFormatException;
}
-
diff --git a/java/lang/instrument/Instrumentation.java b/java/lang/instrument/Instrumentation.java
index 81aefa6d6..42e3ab5be 100644
--- a/java/lang/instrument/Instrumentation.java
+++ b/java/lang/instrument/Instrumentation.java
@@ -50,22 +50,22 @@ package java.lang.instrument;
*/
public interface Instrumentation
{
-
+
/**
* Adds a <code>ClassFileTransformer</class> object
* to the instrumentation. Each time a class is defined
* or redefined, the <code>transform</code> method of the
* <code>transformer</code> object is called.
- *
+ *
* @param transformer the transformer to add
* @throws NullPointerException if transformer is null
*/
void addTransformer(ClassFileTransformer transformer);
-
+
/**
* Removes the given transformer from the set of transformers
* this Instrumentation object has.
- *
+ *
* @param transformer the transformer to remove
* @return true if the transformer was found and removed, false if
* the transformer was not found
@@ -75,7 +75,7 @@ public interface Instrumentation
/**
* Returns if the current JVM supports class redefinition
- *
+ *
* @return true if the current JVM supports class redefinition
*/
boolean isRedefineClassesSupported();
@@ -85,9 +85,9 @@ public interface Instrumentation
* the corresponding class files.
*
* @param definitions an array of classes to redefine
- *
- * @throws ClassNotFoundException if a class cannot be found
- * @throws UnmodifiableClassException if a class cannot be modified
+ *
+ * @throws ClassNotFoundException if a class cannot be found
+ * @throws UnmodifiableClassException if a class cannot be modified
* @throws UnsupportedOperationException if the JVM does not support
* redefinition or the redefinition made unsupported changes
* @throws ClassFormatError if a class file is not valid
@@ -97,7 +97,7 @@ public interface Instrumentation
* are unsupported
* @throws ClassCircularityError if circularity occured with the new
* classes
- * @throws LinkageError if a linkage error occurs
+ * @throws LinkageError if a linkage error occurs
* @throws NullPointerException if the definitions array is null, or any
* of its element
*
@@ -112,7 +112,7 @@ public interface Instrumentation
/**
* Get all the classes loaded by the JVM.
- *
+ *
* @return an array containing all the classes loaded by the JVM. The array
* is empty if no class is loaded.
*/
@@ -120,9 +120,9 @@ public interface Instrumentation
/**
* Get all the classes loaded by a given class loader
- *
+ *
* @param loader the loader
- *
+ *
* @return an array containing all the classes loaded by the given loader.
* The array is empty if no class was loaded by the loader.
*/
@@ -130,7 +130,7 @@ public interface Instrumentation
/**
* Get the size of an object. It contains the size of all fields.
- *
+ *
* @param objectToSize the object
* @return the size of the object
* @throws NullPointerException if objectToSize is null.
diff --git a/java/lang/management/ClassLoadingMXBean.java b/java/lang/management/ClassLoadingMXBean.java
index 2a8651b9c..491af247f 100644
--- a/java/lang/management/ClassLoadingMXBean.java
+++ b/java/lang/management/ClassLoadingMXBean.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.lang.management;
/**
- * Provides access to information about the class loading
+ * Provides access to information about the class loading
* behaviour of the current invocation of the virtual
* machine. An instance of this bean is obtained by calling
* {@link ManagementFactory#getClassLoadingMXBean()}.
@@ -100,4 +100,3 @@ public interface ClassLoadingMXBean
void setVerbose(boolean verbose);
}
-
diff --git a/java/lang/management/CompilationMXBean.java b/java/lang/management/CompilationMXBean.java
index 7f666f2c6..36f69c44b 100644
--- a/java/lang/management/CompilationMXBean.java
+++ b/java/lang/management/CompilationMXBean.java
@@ -50,7 +50,7 @@ package java.lang.management;
*/
public interface CompilationMXBean
{
-
+
/**
* Returns the name of the Just-In-Time (JIT) compiler.
*
diff --git a/java/lang/management/GarbageCollectorMXBean.java b/java/lang/management/GarbageCollectorMXBean.java
index 5bb0a18d3..f3da0042d 100644
--- a/java/lang/management/GarbageCollectorMXBean.java
+++ b/java/lang/management/GarbageCollectorMXBean.java
@@ -70,7 +70,7 @@ public interface GarbageCollectorMXBean
* Note that the accumulated time may not change, even when the
* collection count increases, if the time taken is sufficiently
* short; this depends on the resolution of the timer used.
- *
+ *
* @return the accumulated number of milliseconds spent collecting,
* or -1 if this is undefined.
*/
diff --git a/java/lang/management/ManagementFactory.java b/java/lang/management/ManagementFactory.java
index 977b39975..c054f5dd9 100644
--- a/java/lang/management/ManagementFactory.java
+++ b/java/lang/management/ManagementFactory.java
@@ -82,7 +82,7 @@ import javax.management.openmbean.TabularData;
/**
* <p>
* Provides access to the system's management beans via a series
- * of static methods.
+ * of static methods.
* </p>
* <p>
* An instance of a system management bean can be obtained by
@@ -251,16 +251,16 @@ public class ManagementFactory
public static OperatingSystemMXBean getOperatingSystemMXBean()
{
if (osBean == null)
- try
- {
- osBean = new OperatingSystemMXBeanImpl();
- }
+ try
+ {
+ osBean = new OperatingSystemMXBeanImpl();
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "operating system bean is not a " +
- "compliant management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "operating system bean is not a " +
+ "compliant management bean.");
+ }
return osBean;
}
@@ -275,15 +275,15 @@ public class ManagementFactory
{
if (runtimeBean == null)
try
- {
- runtimeBean = new RuntimeMXBeanImpl();
- }
+ {
+ runtimeBean = new RuntimeMXBeanImpl();
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "runtime bean is not a compliant " +
- "management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "runtime bean is not a compliant " +
+ "management bean.");
+ }
return runtimeBean;
}
@@ -298,15 +298,15 @@ public class ManagementFactory
{
if (classLoadingBean == null)
try
- {
- classLoadingBean = new ClassLoadingMXBeanImpl();
- }
+ {
+ classLoadingBean = new ClassLoadingMXBeanImpl();
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "class loading bean is not a " +
- "compliant management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "class loading bean is not a " +
+ "compliant management bean.");
+ }
return classLoadingBean;
}
@@ -321,15 +321,15 @@ public class ManagementFactory
{
if (threadBean == null)
try
- {
- threadBean = new ThreadMXBeanImpl();
- }
+ {
+ threadBean = new ThreadMXBeanImpl();
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "thread bean is not a compliant " +
- "management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "thread bean is not a compliant " +
+ "management bean.");
+ }
return threadBean;
}
@@ -344,15 +344,15 @@ public class ManagementFactory
{
if (memoryBean == null)
try
- {
- memoryBean = new MemoryMXBeanImpl();
- }
+ {
+ memoryBean = new MemoryMXBeanImpl();
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "memory bean is not a compliant " +
- "management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "memory bean is not a compliant " +
+ "management bean.");
+ }
return memoryBean;
}
@@ -369,17 +369,17 @@ public class ManagementFactory
public static CompilationMXBean getCompilationMXBean()
{
if (compilationBean == null &&
- SystemProperties.getProperty("gnu.java.compiler.name") != null)
+ SystemProperties.getProperty("gnu.java.compiler.name") != null)
try
- {
- compilationBean = new CompilationMXBeanImpl();
- }
+ {
+ compilationBean = new CompilationMXBeanImpl();
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "compilation bean is not a compliant " +
- "management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "compilation bean is not a compliant " +
+ "management bean.");
+ }
return compilationBean;
}
@@ -397,15 +397,15 @@ public class ManagementFactory
String[] names = VMManagementFactory.getMemoryPoolNames();
for (int a = 0; a < names.length; ++a)
try
- {
- poolBeans.add(new MemoryPoolMXBeanImpl(names[a]));
- }
+ {
+ poolBeans.add(new MemoryPoolMXBeanImpl(names[a]));
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "memory pool bean, " + a + ", is " +
- "not a compliant management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "memory pool bean, " + a + ", is " +
+ "not a compliant management bean.");
+ }
return poolBeans;
}
@@ -423,15 +423,15 @@ public class ManagementFactory
String[] names = VMManagementFactory.getMemoryManagerNames();
for (int a = 0; a < names.length; ++a)
try
- {
- managerBeans.add(new MemoryManagerMXBeanImpl(names[a]));
- }
+ {
+ managerBeans.add(new MemoryManagerMXBeanImpl(names[a]));
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "memory manager bean, " + a + ", is " +
- "not a compliant management bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "memory manager bean, " + a + ", is " +
+ "not a compliant management bean.");
+ }
managerBeans.addAll(getGarbageCollectorMXBeans());
return managerBeans;
}
@@ -450,16 +450,16 @@ public class ManagementFactory
String[] names = VMManagementFactory.getGarbageCollectorNames();
for (int a = 0; a < names.length; ++a)
try
- {
- gcBeans.add(new GarbageCollectorMXBeanImpl(names[a]));
- }
+ {
+ gcBeans.add(new GarbageCollectorMXBeanImpl(names[a]));
+ }
catch (NotCompliantMBeanException e)
- {
- throw new InternalError("The GNU implementation of the " +
- "garbage collector bean, " + a +
- ", is not a compliant management " +
- "bean.");
- }
+ {
+ throw new InternalError("The GNU implementation of the " +
+ "garbage collector bean, " + a +
+ ", is not a compliant management " +
+ "bean.");
+ }
return gcBeans;
}
@@ -490,77 +490,77 @@ public class ManagementFactory
{
if (platformServer == null)
{
- platformServer = MBeanServerFactory.createMBeanServer();
- try
- {
- platformServer.registerMBean(getOperatingSystemMXBean(),
- new ObjectName(OPERATING_SYSTEM_MXBEAN_NAME));
- platformServer.registerMBean(getRuntimeMXBean(),
- new ObjectName(RUNTIME_MXBEAN_NAME));
- platformServer.registerMBean(getClassLoadingMXBean(),
- new ObjectName(CLASS_LOADING_MXBEAN_NAME));
- platformServer.registerMBean(getThreadMXBean(),
- new ObjectName(THREAD_MXBEAN_NAME));
- platformServer.registerMBean(getMemoryMXBean(),
- new ObjectName(MEMORY_MXBEAN_NAME));
- CompilationMXBean compBean = getCompilationMXBean();
- if (compBean != null)
- platformServer.registerMBean(compBean,
- new ObjectName(COMPILATION_MXBEAN_NAME));
- Iterator beans = getMemoryPoolMXBeans().iterator();
- while (beans.hasNext())
- {
- MemoryPoolMXBean bean = (MemoryPoolMXBean) beans.next();
- platformServer.registerMBean(bean,
- new ObjectName(MEMORY_POOL_MXBEAN_DOMAIN_TYPE +
- ",name=" +
- bean.getName()));
- }
- beans = getMemoryManagerMXBeans().iterator();
- while (beans.hasNext())
- {
- MemoryManagerMXBean bean = (MemoryManagerMXBean) beans.next();
- platformServer.registerMBean(bean,
- new ObjectName(MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE +
- ",name=" +
- bean.getName()));
- }
- beans = getGarbageCollectorMXBeans().iterator();
- while (beans.hasNext())
- {
- GarbageCollectorMXBean bean = (GarbageCollectorMXBean) beans.next();
- platformServer.registerMBean(bean,
- new ObjectName(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE +
- ",name=" +
- bean.getName()));
- }
- platformServer.registerMBean(LogManager.getLoggingMXBean(),
- new ObjectName(LogManager.LOGGING_MXBEAN_NAME));
- }
- catch (InstanceAlreadyExistsException e)
- {
- throw (Error)
- (new InternalError("One of the management beans is " +
- "already registered.").initCause(e));
- }
- catch (MBeanRegistrationException e)
- {
- throw (Error)
- (new InternalError("One of the management beans' preRegister " +
- "methods threw an exception.").initCause(e));
- }
- catch (NotCompliantMBeanException e)
- {
- throw (Error)
- (new InternalError("One of the management beans is " +
- "not compliant.").initCause(e));
- }
- catch (MalformedObjectNameException e)
- {
- throw (Error)
- (new InternalError("The object name of a management bean is " +
- "not compliant.").initCause(e));
- }
+ platformServer = MBeanServerFactory.createMBeanServer();
+ try
+ {
+ platformServer.registerMBean(getOperatingSystemMXBean(),
+ new ObjectName(OPERATING_SYSTEM_MXBEAN_NAME));
+ platformServer.registerMBean(getRuntimeMXBean(),
+ new ObjectName(RUNTIME_MXBEAN_NAME));
+ platformServer.registerMBean(getClassLoadingMXBean(),
+ new ObjectName(CLASS_LOADING_MXBEAN_NAME));
+ platformServer.registerMBean(getThreadMXBean(),
+ new ObjectName(THREAD_MXBEAN_NAME));
+ platformServer.registerMBean(getMemoryMXBean(),
+ new ObjectName(MEMORY_MXBEAN_NAME));
+ CompilationMXBean compBean = getCompilationMXBean();
+ if (compBean != null)
+ platformServer.registerMBean(compBean,
+ new ObjectName(COMPILATION_MXBEAN_NAME));
+ Iterator beans = getMemoryPoolMXBeans().iterator();
+ while (beans.hasNext())
+ {
+ MemoryPoolMXBean bean = (MemoryPoolMXBean) beans.next();
+ platformServer.registerMBean(bean,
+ new ObjectName(MEMORY_POOL_MXBEAN_DOMAIN_TYPE +
+ ",name=" +
+ bean.getName()));
+ }
+ beans = getMemoryManagerMXBeans().iterator();
+ while (beans.hasNext())
+ {
+ MemoryManagerMXBean bean = (MemoryManagerMXBean) beans.next();
+ platformServer.registerMBean(bean,
+ new ObjectName(MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE +
+ ",name=" +
+ bean.getName()));
+ }
+ beans = getGarbageCollectorMXBeans().iterator();
+ while (beans.hasNext())
+ {
+ GarbageCollectorMXBean bean = (GarbageCollectorMXBean) beans.next();
+ platformServer.registerMBean(bean,
+ new ObjectName(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE +
+ ",name=" +
+ bean.getName()));
+ }
+ platformServer.registerMBean(LogManager.getLoggingMXBean(),
+ new ObjectName(LogManager.LOGGING_MXBEAN_NAME));
+ }
+ catch (InstanceAlreadyExistsException e)
+ {
+ throw (Error)
+ (new InternalError("One of the management beans is " +
+ "already registered.").initCause(e));
+ }
+ catch (MBeanRegistrationException e)
+ {
+ throw (Error)
+ (new InternalError("One of the management beans' preRegister " +
+ "methods threw an exception.").initCause(e));
+ }
+ catch (NotCompliantMBeanException e)
+ {
+ throw (Error)
+ (new InternalError("One of the management beans is " +
+ "not compliant.").initCause(e));
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw (Error)
+ (new InternalError("The object name of a management bean is " +
+ "not compliant.").initCause(e));
+ }
}
return platformServer;
}
@@ -600,51 +600,51 @@ public class ManagementFactory
* @throws IOException if the connection throws one.
*/
public static <T> T newPlatformMXBeanProxy(MBeanServerConnection connection,
- String mxbeanName,
- Class<T> mxbeanInterface)
+ String mxbeanName,
+ Class<T> mxbeanInterface)
throws IOException
{
if (!(mxbeanName.equals(CLASS_LOADING_MXBEAN_NAME) ||
- mxbeanName.equals(COMPILATION_MXBEAN_NAME) ||
- mxbeanName.startsWith(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE) ||
- mxbeanName.startsWith(MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE) ||
- mxbeanName.equals(MEMORY_MXBEAN_NAME) ||
- mxbeanName.startsWith(MEMORY_POOL_MXBEAN_DOMAIN_TYPE) ||
- mxbeanName.equals(OPERATING_SYSTEM_MXBEAN_NAME) ||
- mxbeanName.equals(RUNTIME_MXBEAN_NAME) ||
- mxbeanName.equals(THREAD_MXBEAN_NAME)))
+ mxbeanName.equals(COMPILATION_MXBEAN_NAME) ||
+ mxbeanName.startsWith(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE) ||
+ mxbeanName.startsWith(MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE) ||
+ mxbeanName.equals(MEMORY_MXBEAN_NAME) ||
+ mxbeanName.startsWith(MEMORY_POOL_MXBEAN_DOMAIN_TYPE) ||
+ mxbeanName.equals(OPERATING_SYSTEM_MXBEAN_NAME) ||
+ mxbeanName.equals(RUNTIME_MXBEAN_NAME) ||
+ mxbeanName.equals(THREAD_MXBEAN_NAME)))
{
- throw new IllegalArgumentException("The named bean, " + mxbeanName +
- ", is not a platform name.");
+ throw new IllegalArgumentException("The named bean, " + mxbeanName +
+ ", is not a platform name.");
}
if ((mxbeanName.equals(CLASS_LOADING_MXBEAN_NAME) &&
- mxbeanInterface != ClassLoadingMXBean.class) ||
- (mxbeanName.equals(COMPILATION_MXBEAN_NAME) &&
- mxbeanInterface != CompilationMXBean.class) ||
- (mxbeanName.startsWith(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE) &&
- mxbeanInterface != GarbageCollectorMXBean.class) ||
- (mxbeanName.startsWith(MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE) &&
- mxbeanInterface != MemoryManagerMXBean.class) ||
- (mxbeanName.equals(MEMORY_MXBEAN_NAME) &&
- mxbeanInterface != MemoryMXBean.class) ||
- (mxbeanName.startsWith(MEMORY_POOL_MXBEAN_DOMAIN_TYPE) &&
- mxbeanInterface != MemoryPoolMXBean.class) ||
- (mxbeanName.equals(OPERATING_SYSTEM_MXBEAN_NAME) &&
- mxbeanInterface != OperatingSystemMXBean.class) ||
- (mxbeanName.equals(RUNTIME_MXBEAN_NAME) &&
- mxbeanInterface != RuntimeMXBean.class) ||
- (mxbeanName.equals(THREAD_MXBEAN_NAME) &&
- mxbeanInterface != ThreadMXBean.class))
+ mxbeanInterface != ClassLoadingMXBean.class) ||
+ (mxbeanName.equals(COMPILATION_MXBEAN_NAME) &&
+ mxbeanInterface != CompilationMXBean.class) ||
+ (mxbeanName.startsWith(GARBAGE_COLLECTOR_MXBEAN_DOMAIN_TYPE) &&
+ mxbeanInterface != GarbageCollectorMXBean.class) ||
+ (mxbeanName.startsWith(MEMORY_MANAGER_MXBEAN_DOMAIN_TYPE) &&
+ mxbeanInterface != MemoryManagerMXBean.class) ||
+ (mxbeanName.equals(MEMORY_MXBEAN_NAME) &&
+ mxbeanInterface != MemoryMXBean.class) ||
+ (mxbeanName.startsWith(MEMORY_POOL_MXBEAN_DOMAIN_TYPE) &&
+ mxbeanInterface != MemoryPoolMXBean.class) ||
+ (mxbeanName.equals(OPERATING_SYSTEM_MXBEAN_NAME) &&
+ mxbeanInterface != OperatingSystemMXBean.class) ||
+ (mxbeanName.equals(RUNTIME_MXBEAN_NAME) &&
+ mxbeanInterface != RuntimeMXBean.class) ||
+ (mxbeanName.equals(THREAD_MXBEAN_NAME) &&
+ mxbeanInterface != ThreadMXBean.class))
throw new IllegalArgumentException("The interface, " + mxbeanInterface +
- ", does not match the bean, " + mxbeanName);
+ ", does not match the bean, " + mxbeanName);
ObjectName bean;
try
{
- bean = new ObjectName(mxbeanName);
+ bean = new ObjectName(mxbeanName);
}
catch (MalformedObjectNameException e)
{
- throw new IllegalArgumentException("The named bean is invalid.");
+ throw new IllegalArgumentException("The named bean is invalid.");
}
if (!(connection.isRegistered(bean)))
throw new IllegalArgumentException("The bean is not registered on this connection.");
@@ -654,8 +654,8 @@ public class ManagementFactory
else
interfaces = new Class[] { mxbeanInterface };
return (T) Proxy.newProxyInstance(mxbeanInterface.getClassLoader(),
- interfaces,
- new ManagementInvocationHandler(connection, bean));
+ interfaces,
+ new ManagementInvocationHandler(connection, bean));
}
/**
@@ -688,7 +688,7 @@ public class ManagementFactory
* @param bean the bean to proxy.
*/
public ManagementInvocationHandler(MBeanServerConnection conn,
- ObjectName bean)
+ ObjectName bean)
throws IOException
{
this.conn = conn;
@@ -715,46 +715,46 @@ public class ManagementFactory
{
String name = method.getName();
if (name.equals("toString"))
- return "Proxy for " + bean + " using " + conn;
+ return "Proxy for " + bean + " using " + conn;
if (name.equals("addNotificationListener"))
- {
- conn.addNotificationListener(bean,
- (NotificationListener) args[0],
- (NotificationFilter) args[1],
- args[2]);
- return null;
- }
+ {
+ conn.addNotificationListener(bean,
+ (NotificationListener) args[0],
+ (NotificationFilter) args[1],
+ args[2]);
+ return null;
+ }
if (name.equals("getNotificationInfo"))
- return conn.getMBeanInfo(bean).getNotifications();
+ return conn.getMBeanInfo(bean).getNotifications();
if (name.equals("removeNotificationListener"))
- {
- if (args.length == 1)
- conn.removeNotificationListener(bean,
- (NotificationListener)
- args[0]);
- else
- conn.removeNotificationListener(bean,
- (NotificationListener)
- args[0],
- (NotificationFilter)
- args[1], args[2]);
- return null;
- }
+ {
+ if (args.length == 1)
+ conn.removeNotificationListener(bean,
+ (NotificationListener)
+ args[0]);
+ else
+ conn.removeNotificationListener(bean,
+ (NotificationListener)
+ args[0],
+ (NotificationFilter)
+ args[1], args[2]);
+ return null;
+ }
String attrib = null;
if (name.startsWith("get"))
- attrib = name.substring(3);
+ attrib = name.substring(3);
else if (name.startsWith("is"))
- attrib = name.substring(2);
+ attrib = name.substring(2);
if (attrib != null)
- return translate(conn.getAttribute(bean, attrib), method);
+ return translate(conn.getAttribute(bean, attrib), method);
else if (name.startsWith("set"))
- {
- conn.setAttribute(bean, new Attribute(name.substring(3),
- args[0]));
- return null;
- }
+ {
+ conn.setAttribute(bean, new Attribute(name.substring(3),
+ args[0]));
+ return null;
+ }
else
- return translate(conn.invoke(bean, name, args, null), method);
+ return translate(conn.invoke(bean, name, args, null), method);
}
/**
@@ -772,44 +772,44 @@ public class ManagementFactory
{
Class<?> returnType = method.getReturnType();
if (returnType.isEnum())
- {
- String ename = (String) otype;
- Enum[] constants = (Enum[]) returnType.getEnumConstants();
- for (Enum c : constants)
- if (c.name().equals(ename))
- return c;
- }
+ {
+ String ename = (String) otype;
+ Enum[] constants = (Enum[]) returnType.getEnumConstants();
+ for (Enum c : constants)
+ if (c.name().equals(ename))
+ return c;
+ }
if (List.class.isAssignableFrom(returnType))
- {
- Object[] elems = (Object[]) otype;
- List l = new ArrayList(elems.length);
- for (Object elem : elems)
- l.add(elem);
- return l;
- }
+ {
+ Object[] elems = (Object[]) otype;
+ List l = new ArrayList(elems.length);
+ for (Object elem : elems)
+ l.add(elem);
+ return l;
+ }
if (Map.class.isAssignableFrom(returnType))
- {
- TabularData data = (TabularData) otype;
- Map m = new HashMap(data.size());
- for (Object val : data.values())
- {
- CompositeData vals = (CompositeData) val;
- m.put(vals.get("key"), vals.get("value"));
- }
- return m;
- }
+ {
+ TabularData data = (TabularData) otype;
+ Map m = new HashMap(data.size());
+ for (Object val : data.values())
+ {
+ CompositeData vals = (CompositeData) val;
+ m.put(vals.get("key"), vals.get("value"));
+ }
+ return m;
+ }
try
- {
- Method m = returnType.getMethod("from",
- new Class[]
- { CompositeData.class });
- return m.invoke(null, (CompositeData) otype);
- }
+ {
+ Method m = returnType.getMethod("from",
+ new Class[]
+ { CompositeData.class });
+ return m.invoke(null, (CompositeData) otype);
+ }
catch (NoSuchMethodException e)
- {
- /* Ignored; we expect this if this
- isn't a from(CompositeData) class */
- }
+ {
+ /* Ignored; we expect this if this
+ isn't a from(CompositeData) class */
+ }
return otype;
}
diff --git a/java/lang/management/ManagementPermission.java b/java/lang/management/ManagementPermission.java
index 0e6bd0612..73794571c 100644
--- a/java/lang/management/ManagementPermission.java
+++ b/java/lang/management/ManagementPermission.java
@@ -71,7 +71,7 @@ import java.security.BasicPermission;
* usage limits changed. Malicious code could use
* this to alter the behaviour of the system.</li>
* </ul>
- *
+ *
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
@@ -127,6 +127,5 @@ public final class ManagementPermission
if (!(actions == null || actions.equals("")))
throw new IllegalArgumentException("Invalid actions.");
}
-
-}
+}
diff --git a/java/lang/management/MemoryMXBean.java b/java/lang/management/MemoryMXBean.java
index 4d9e5ff1c..acf0e6795 100644
--- a/java/lang/management/MemoryMXBean.java
+++ b/java/lang/management/MemoryMXBean.java
@@ -39,7 +39,7 @@ package java.lang.management;
/**
* <p>
- * Provides access to information about the memory used
+ * Provides access to information about the memory used
* by the virtual machine. An instance of this bean is
* obtained by calling
* {@link ManagementFactory#getMemoryMXBean()}.
@@ -104,7 +104,7 @@ package java.lang.management;
*/
public interface MemoryMXBean
{
-
+
/**
* Instigates a garbage collection cycle. The virtual
* machine's garbage collector should make the best
@@ -135,7 +135,7 @@ public interface MemoryMXBean
* memory.
*/
MemoryUsage getNonHeapMemoryUsage();
-
+
/**
* Returns the number of objects which are waiting to
* be garbage collected (finalized). An object is
diff --git a/java/lang/management/MemoryManagerMXBean.java b/java/lang/management/MemoryManagerMXBean.java
index 921070539..1b10e998f 100644
--- a/java/lang/management/MemoryManagerMXBean.java
+++ b/java/lang/management/MemoryManagerMXBean.java
@@ -49,10 +49,10 @@ package java.lang.management;
public interface MemoryManagerMXBean
{
- /**
+ /**
* Returns an array containing the names of the memory pools
* this memory manager manages.
- *
+ *
* @return an array containing the name of each memory pool
* this manager is responsible for.
*/
diff --git a/java/lang/management/MemoryNotificationInfo.java b/java/lang/management/MemoryNotificationInfo.java
index adb38b06f..85856e058 100644
--- a/java/lang/management/MemoryNotificationInfo.java
+++ b/java/lang/management/MemoryNotificationInfo.java
@@ -74,7 +74,7 @@ import javax.management.openmbean.SimpleType;
* {@link #from(javax.management.openmbean.CompositeData)} method may be
* used to unwrap the value and obtain an instance of this class.
* </p>
- *
+ *
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
@@ -87,7 +87,7 @@ public class MemoryNotificationInfo
* threshold again before another notification is emitted. The value is
* <code>java.management.memory.threshold.exceeded</code>.
*/
- public static final String MEMORY_THRESHOLD_EXCEEDED =
+ public static final String MEMORY_THRESHOLD_EXCEEDED =
"java.management.memory.threshold.exceeded";
/**
@@ -153,9 +153,9 @@ public class MemoryNotificationInfo
* <tr><td>committed</td><td>java.lang.Long</td></tr>
* <tr><td>max</td><td>java.lang.Long</td></tr>
* </table>
- *
+ *
* @param data the composite data structure to take values from.
- * @return a new instance containing the values from the
+ * @return a new instance containing the values from the
* composite data structure, or <code>null</code>
* if the data structure was also <code>null</code>.
* @throws IllegalArgumentException if the composite data structure
@@ -172,8 +172,8 @@ public class MemoryNotificationInfo
ThreadInfo.checkAttribute(type, "count", SimpleType.LONG);
MemoryUsage usage = MemoryUsage.from((CompositeData) data.get("usage"));
return new MemoryNotificationInfo(((String) data.get("poolName")),
- usage,
- ((Long) data.get("count")).longValue());
+ usage,
+ ((Long) data.get("count")).longValue());
}
/**
@@ -212,4 +212,3 @@ public class MemoryNotificationInfo
}
}
-
diff --git a/java/lang/management/MemoryPoolMXBean.java b/java/lang/management/MemoryPoolMXBean.java
index 36a8236dc..9729093b2 100644
--- a/java/lang/management/MemoryPoolMXBean.java
+++ b/java/lang/management/MemoryPoolMXBean.java
@@ -209,7 +209,7 @@ public interface MemoryPoolMXBean
long getUsageThresholdCount();
/**
- * Returns true if the collection usage level is equal to
+ * Returns true if the collection usage level is equal to
* or greater than the collection usage threshold.
*
* @return true if the collection usage threshold has been
@@ -236,7 +236,7 @@ public interface MemoryPoolMXBean
boolean isCollectionUsageThresholdSupported();
/**
- * Returns true if the usage level is equal to
+ * Returns true if the usage level is equal to
* or greater than the usage threshold.
*
* @return true if the usage threshold has been
@@ -260,7 +260,7 @@ public interface MemoryPoolMXBean
* @see #setUsageThreshold(long)
*/
boolean isUsageThresholdSupported();
-
+
/**
* Returns true if this memory pool is still valid. A memory pool
* becomes invalid when it is removed by the virtual machine and
diff --git a/java/lang/management/MemoryType.java b/java/lang/management/MemoryType.java
index 4422b3298..c864d5407 100644
--- a/java/lang/management/MemoryType.java
+++ b/java/lang/management/MemoryType.java
@@ -48,4 +48,3 @@ public enum MemoryType
{
HEAP, NON_HEAP;
}
-
diff --git a/java/lang/management/MemoryUsage.java b/java/lang/management/MemoryUsage.java
index d851da9a7..42aef3cc5 100644
--- a/java/lang/management/MemoryUsage.java
+++ b/java/lang/management/MemoryUsage.java
@@ -119,29 +119,29 @@ public class MemoryUsage
* above.
*/
public MemoryUsage(long init, long used, long committed,
- long maximum)
+ long maximum)
{
if (init < -1)
throw new IllegalArgumentException("Initial value of "
- + init + " is too small.");
+ + init + " is too small.");
if (used < 0)
throw new IllegalArgumentException("Used value of "
- + used + " is too small.");
+ + used + " is too small.");
if (committed < 0)
throw new IllegalArgumentException("Committed value of "
- + committed + " is too small.");
+ + committed + " is too small.");
if (committed < used)
throw new IllegalArgumentException("Committed value of "
- + committed + " is below "
- + used + ", the amount used.");
+ + committed + " is below "
+ + used + ", the amount used.");
if (maximum < -1)
throw new IllegalArgumentException("Maximum value of "
- + maximum + " is too small.");
+ + maximum + " is too small.");
if (maximum != -1 && maximum < committed)
- throw new IllegalArgumentException("Maximum value of "
- + maximum + " is below "
- + committed + ", the amount "
- + "committed.");
+ throw new IllegalArgumentException("Maximum value of "
+ + maximum + " is below "
+ + committed + ", the amount "
+ + "committed.");
this.init = init;
this.used = used;
this.committed = committed;
@@ -165,9 +165,9 @@ public class MemoryUsage
* <p>
* All should have the type, <code>java.lang.Long</code>.
* </p>
- *
+ *
* @param data the composite data structure to take values from.
- * @return a new instance containing the values from the
+ * @return a new instance containing the values from the
* composite data structure, or <code>null</code>
* if the data structure was also <code>null</code>.
* @throws IllegalArgumentException if the composite data structure
@@ -185,9 +185,9 @@ public class MemoryUsage
ThreadInfo.checkAttribute(type, "Committed", SimpleType.LONG);
ThreadInfo.checkAttribute(type, "Max", SimpleType.LONG);
return new MemoryUsage(((Long) data.get("Init")).longValue(),
- ((Long) data.get("Used")).longValue(),
- ((Long) data.get("Committed")).longValue(),
- ((Long) data.get("Max")).longValue());
+ ((Long) data.get("Used")).longValue(),
+ ((Long) data.get("Committed")).longValue(),
+ ((Long) data.get("Max")).longValue());
}
/**
@@ -217,7 +217,7 @@ public class MemoryUsage
/**
* Returns the maximum amount of memory available for this
- * pool (in bytes). This amount is not guaranteed to
+ * pool (in bytes). This amount is not guaranteed to
* actually be usable. This method may return -1, if the
* value is undefined.
*
@@ -262,4 +262,3 @@ public class MemoryUsage
}
}
-
diff --git a/java/lang/management/MonitorInfo.java b/java/lang/management/MonitorInfo.java
index cba73a80d..fd7233716 100644
--- a/java/lang/management/MonitorInfo.java
+++ b/java/lang/management/MonitorInfo.java
@@ -82,16 +82,16 @@ public class MonitorInfo
* &lt; 0.
*/
public MonitorInfo(String className, int identityHashCode, int stackDepth,
- StackTraceElement stackFrame)
+ StackTraceElement stackFrame)
{
super(className, identityHashCode);
if (stackFrame == null && stackDepth >= 0)
throw new IllegalArgumentException("The stack frame is null, but the " +
- "stack depth is greater than or equal " +
- "to zero.");
+ "stack depth is greater than or equal " +
+ "to zero.");
if (stackFrame != null && stackDepth < 0)
throw new IllegalArgumentException("The stack frame is not null, but the " +
- "stack depth is less than zero.");
+ "stack depth is less than zero.");
this.stackDepth = stackDepth;
this.stackFrame = stackFrame;
}
@@ -123,9 +123,9 @@ public class MonitorInfo
* <tr><td>lineNumber</td><td>java.lang.Integer</td></tr>
* <tr><td>nativeMethod</td><td>java.lang.Boolean</td></tr>
* </table>
- *
+ *
* @param data the composite data structure to take values from.
- * @return a new instance containing the values from the
+ * @return a new instance containing the values from the
* composite data structure, or <code>null</code>
* if the data structure was also <code>null</code>.
* @throws IllegalArgumentException if the composite data structure
@@ -141,15 +141,15 @@ public class MonitorInfo
ThreadInfo.checkAttribute(type, "IdentityHashCode", SimpleType.INTEGER);
ThreadInfo.checkAttribute(type, "LockedStackDepth", SimpleType.INTEGER);
ThreadInfo.checkAttribute(type, "LockedStackFrame",
- ThreadInfo.getStackTraceType());
+ ThreadInfo.getStackTraceType());
CompositeData frame = (CompositeData) data.get("LockedStackFrame");
return new MonitorInfo((String) data.get("ClassName"),
- (Integer) data.get("IdentityHashCode"),
- (Integer) data.get("LockedStackDepth"),
- new StackTraceElement((String) frame.get("ClassName"),
- (String) frame.get("MethodName"),
- (String) frame.get("FileName"),
- (Integer) frame.get("LineNumber")));
+ (Integer) data.get("IdentityHashCode"),
+ (Integer) data.get("LockedStackDepth"),
+ new StackTraceElement((String) frame.get("ClassName"),
+ (String) frame.get("MethodName"),
+ (String) frame.get("FileName"),
+ (Integer) frame.get("LineNumber")));
}
/**
diff --git a/java/lang/management/OperatingSystemMXBean.java b/java/lang/management/OperatingSystemMXBean.java
index ed38285a5..dcc963ef1 100644
--- a/java/lang/management/OperatingSystemMXBean.java
+++ b/java/lang/management/OperatingSystemMXBean.java
@@ -89,7 +89,7 @@ public interface OperatingSystemMXBean
/**
* Returns the system load average for the last minute, or -1
* if this is unavailable. The availability and calculation
- * of the load average is system-dependent, but is usually
+ * of the load average is system-dependent, but is usually
* a damped time-dependent average obtained by monitoring the
* number of queued and running processes. It is expected
* that this method will be called frequently to monitor the
diff --git a/java/lang/management/RuntimeMXBean.java b/java/lang/management/RuntimeMXBean.java
index a2931d127..1e2aa017f 100644
--- a/java/lang/management/RuntimeMXBean.java
+++ b/java/lang/management/RuntimeMXBean.java
@@ -56,7 +56,7 @@ public interface RuntimeMXBean
* Returns the boot classpath used by the virtual machine. This
* value follows the standard path syntax used by the underlying
* operating system (e.g. directories separated by ':' on UNIX
- * or ';' on Windows).
+ * or ';' on Windows).
* </p>
* <p>
* Supplying this value is optional. Users should check the
@@ -81,7 +81,7 @@ public interface RuntimeMXBean
* property via {@link System#getProperty(String)}. This value
* follows the standard path syntax used by the underlying operating
* system (e.g. directories separated by ':' on UNIX or ';' on
- * Windows).
+ * Windows).
*
* @return the classpath used by the system class loader.
* @throws SecurityException if a security manager exists which
@@ -114,7 +114,7 @@ public interface RuntimeMXBean
* {@link System#getProperty(String)}. This value follows the
* standard path syntax used by the underlying operating
* system (e.g. directories separated by ':' on UNIX or ';' on
- * Windows).
+ * Windows).
*
* @return the library path.
* @throws SecurityException if a security manager exists which
@@ -142,7 +142,7 @@ public interface RuntimeMXBean
* same virtual machine (for example, it might include
* the process identifier or the host name of the machine
* on which it is running). The intention is that this
- * name refers to the precise entity that the other data
+ * name refers to the precise entity that the other data
* supplied by this bean refers to, rather than the VM
* in general.
*
@@ -154,7 +154,7 @@ public interface RuntimeMXBean
* Returns the specification name of the virtual machine.
* This is equivalent to obtaining the
* <code>java.vm.specification.name</code> property via
- * {@link System#getProperty(String)}.
+ * {@link System#getProperty(String)}.
*
* @return the specification name of the VM.
* @throws SecurityException if a security manager exists which
@@ -169,7 +169,7 @@ public interface RuntimeMXBean
* Returns the specification vendor of the virtual machine.
* This is equivalent to obtaining the
* <code>java.vm.specification.vendor</code> property via
- * {@link System#getProperty(String)}.
+ * {@link System#getProperty(String)}.
*
* @return the specification vendor of the VM.
* @throws SecurityException if a security manager exists which
@@ -184,7 +184,7 @@ public interface RuntimeMXBean
* Returns the specification version of the virtual machine.
* This is equivalent to obtaining the
* <code>java.vm.specification.version</code> property via
- * {@link System#getProperty(String)}.
+ * {@link System#getProperty(String)}.
*
* @return the specification version of the VM.
* @throws SecurityException if a security manager exists which
@@ -198,7 +198,7 @@ public interface RuntimeMXBean
/**
* Returns the approximate start time of the virtual machine
* in milliseconds.
- *
+ *
* @return the start time of the virtual machine.
*/
long getStartTime();
@@ -216,7 +216,7 @@ public interface RuntimeMXBean
/**
* Returns the uptime of the virtual machine in milliseconds.
- *
+ *
* @return the uptime of the virtual machine.
*/
long getUptime();
@@ -225,7 +225,7 @@ public interface RuntimeMXBean
* Returns the implementation name of the virtual machine.
* This is equivalent to obtaining the
* <code>java.vm.name</code> property via
- * {@link System#getProperty(String)}.
+ * {@link System#getProperty(String)}.
*
* @return the implementation name of the VM.
* @throws SecurityException if a security manager exists which
@@ -240,7 +240,7 @@ public interface RuntimeMXBean
* Returns the implementation vendor of the virtual machine.
* This is equivalent to obtaining the
* <code>java.vm.vendor</code> property via
- * {@link System#getProperty(String)}.
+ * {@link System#getProperty(String)}.
*
* @return the implementation vendor of the VM.
* @throws SecurityException if a security manager exists which
@@ -255,7 +255,7 @@ public interface RuntimeMXBean
* Returns the implementation version of the virtual machine.
* This is equivalent to obtaining the
* <code>java.vm.version</code> property via
- * {@link System#getProperty(String)}.
+ * {@link System#getProperty(String)}.
*
* @return the implementation version of the VM.
* @throws SecurityException if a security manager exists which
diff --git a/java/lang/management/ThreadInfo.java b/java/lang/management/ThreadInfo.java
index 5b8856d35..a4ecc76f5 100644
--- a/java/lang/management/ThreadInfo.java
+++ b/java/lang/management/ThreadInfo.java
@@ -211,7 +211,7 @@ public class ThreadInfo
* lock, or <code>-1</code> if it doesn't have an owner
* (only used if blocked)
* @param lockOwnerName the name of the thread which owns the monitor
- * lock, or <code>null</code> if it doesn't have an
+ * lock, or <code>null</code> if it doesn't have an
* owner (only used if blocked)
* @param waitedCount the number of times the thread has been in a
* waiting state.
@@ -227,16 +227,16 @@ public class ThreadInfo
* by the thread.
* @param lockedSynchronizers an array of {@link LockInfo} objects
* representing locks held on ownable
- * synchronizers by the thread.
+ * synchronizers by the thread.
*
* @since 1.6
*/
private ThreadInfo(long threadId, String threadName, Thread.State threadState,
- long blockedCount, long blockedTime, String lockName,
- long lockOwnerId, String lockOwnerName, long waitedCount,
- long waitedTime, boolean isInNative, boolean isSuspended,
- StackTraceElement[] trace, MonitorInfo[] lockedMonitors,
- LockInfo[] lockedSynchronizers)
+ long blockedCount, long blockedTime, String lockName,
+ long lockOwnerId, String lockOwnerName, long waitedCount,
+ long waitedTime, boolean isInNative, boolean isSuspended,
+ StackTraceElement[] trace, MonitorInfo[] lockedMonitors,
+ LockInfo[] lockedSynchronizers)
{
this.threadId = threadId;
this.threadName = threadName;
@@ -266,16 +266,16 @@ public class ThreadInfo
* or of the wrong type.
*/
static void checkAttribute(CompositeType ctype, String name,
- OpenType type)
+ OpenType type)
throws IllegalArgumentException
{
OpenType foundType = ctype.getType(name);
if (foundType == null)
throw new IllegalArgumentException("Could not find a field named " +
- name);
+ name);
if (!(foundType.equals(type)))
throw new IllegalArgumentException("Field " + name + " is not of " +
- "type " + type.getClassName());
+ "type " + type.getClassName());
}
/**
@@ -288,31 +288,31 @@ public class ThreadInfo
{
if (seType == null)
try
- {
- seType = new CompositeType(StackTraceElement.class.getName(),
- "An element of a stack trace",
- new String[] { "className", "methodName",
- "fileName", "lineNumber",
- "nativeMethod"
- },
- new String[] { "Name of the class",
- "Name of the method",
- "Name of the source code file",
- "Line number",
- "True if this is a native method"
- },
- new OpenType[] {
- SimpleType.STRING, SimpleType.STRING,
- SimpleType.STRING, SimpleType.INTEGER,
- SimpleType.BOOLEAN
- });
- }
+ {
+ seType = new CompositeType(StackTraceElement.class.getName(),
+ "An element of a stack trace",
+ new String[] { "className", "methodName",
+ "fileName", "lineNumber",
+ "nativeMethod"
+ },
+ new String[] { "Name of the class",
+ "Name of the method",
+ "Name of the source code file",
+ "Line number",
+ "True if this is a native method"
+ },
+ new OpenType[] {
+ SimpleType.STRING, SimpleType.STRING,
+ SimpleType.STRING, SimpleType.INTEGER,
+ SimpleType.BOOLEAN
+ });
+ }
catch (OpenDataException e)
- {
- throw new IllegalStateException("Something went wrong in creating " +
- "the composite data type for the " +
- "stack trace element.", e);
- }
+ {
+ throw new IllegalStateException("Something went wrong in creating " +
+ "the composite data type for the " +
+ "stack trace element.", e);
+ }
return seType;
}
@@ -352,9 +352,9 @@ public class ThreadInfo
* <tr><td>lineNumber</td><td>java.lang.Integer</td></tr>
* <tr><td>nativeMethod</td><td>java.lang.Boolean</td></tr>
* </table>
- *
+ *
* @param data the composite data structure to take values from.
- * @return a new instance containing the values from the
+ * @return a new instance containing the values from the
* composite data structure, or <code>null</code>
* if the data structure was also <code>null</code>.
* @throws IllegalArgumentException if the composite data structure
@@ -380,119 +380,119 @@ public class ThreadInfo
checkAttribute(type, "LockOwnerName", SimpleType.STRING);
try
{
- checkAttribute(type, "StackTrace",
- new ArrayType(1, getStackTraceType()));
+ checkAttribute(type, "StackTrace",
+ new ArrayType(1, getStackTraceType()));
}
catch (OpenDataException e)
{
- throw new IllegalStateException("Something went wrong in creating " +
- "the array for the stack trace element.",
- e);
+ throw new IllegalStateException("Something went wrong in creating " +
+ "the array for the stack trace element.",
+ e);
}
OpenType foundType = type.getType("LockedMonitors");
if (foundType != null)
try
- {
- CompositeType mType = new CompositeType(MonitorInfo.class.getName(),
- "Information on a object monitor lock",
- new String[] { "ClassName",
- "IdentityHashCode",
- "LockedStackDepth",
- "LockedStackFrame"
- },
- new String[] { "Name of the class",
- "Identity hash code " +
- "of the class",
- "Stack depth at time " +
- "of lock",
- "Stack frame at time " +
- "of lock",
- },
- new OpenType[] {
- SimpleType.STRING, SimpleType.INTEGER,
- SimpleType.INTEGER, getStackTraceType()
- });
- if (!(foundType.equals(new ArrayType(1, mType))))
- throw new IllegalArgumentException("Field LockedMonitors is not of " +
- "type " + mType.getClassName());
- }
+ {
+ CompositeType mType = new CompositeType(MonitorInfo.class.getName(),
+ "Information on a object monitor lock",
+ new String[] { "ClassName",
+ "IdentityHashCode",
+ "LockedStackDepth",
+ "LockedStackFrame"
+ },
+ new String[] { "Name of the class",
+ "Identity hash code " +
+ "of the class",
+ "Stack depth at time " +
+ "of lock",
+ "Stack frame at time " +
+ "of lock",
+ },
+ new OpenType[] {
+ SimpleType.STRING, SimpleType.INTEGER,
+ SimpleType.INTEGER, getStackTraceType()
+ });
+ if (!(foundType.equals(new ArrayType(1, mType))))
+ throw new IllegalArgumentException("Field LockedMonitors is not of " +
+ "type " + mType.getClassName());
+ }
catch (OpenDataException e)
{
- throw new IllegalStateException("Something went wrong in creating " +
- "the composite data type for the " +
- "object monitor information array.", e);
+ throw new IllegalStateException("Something went wrong in creating " +
+ "the composite data type for the " +
+ "object monitor information array.", e);
}
foundType = type.getType("LockedSynchronizers");
if (foundType != null)
try
- {
- CompositeType lType = new CompositeType(LockInfo.class.getName(),
- "Information on a lock",
- new String[] { "ClassName",
- "IdentityHashCode"
- },
- new String[] { "Name of the class",
- "Identity hash code " +
- "of the class"
- },
- new OpenType[] {
- SimpleType.STRING, SimpleType.INTEGER
- });
- if (!(foundType.equals(new ArrayType(1, lType))))
- throw new IllegalArgumentException("Field LockedSynchronizers is not of " +
- "type " + lType.getClassName());
- }
+ {
+ CompositeType lType = new CompositeType(LockInfo.class.getName(),
+ "Information on a lock",
+ new String[] { "ClassName",
+ "IdentityHashCode"
+ },
+ new String[] { "Name of the class",
+ "Identity hash code " +
+ "of the class"
+ },
+ new OpenType[] {
+ SimpleType.STRING, SimpleType.INTEGER
+ });
+ if (!(foundType.equals(new ArrayType(1, lType))))
+ throw new IllegalArgumentException("Field LockedSynchronizers is not of " +
+ "type " + lType.getClassName());
+ }
catch (OpenDataException e)
{
- throw new IllegalStateException("Something went wrong in creating " +
- "the composite data type for the " +
- "ownable synchronizerinformation array.", e);
+ throw new IllegalStateException("Something went wrong in creating " +
+ "the composite data type for the " +
+ "ownable synchronizerinformation array.", e);
}
CompositeData[] dTraces = (CompositeData[]) data.get("StackTrace");
StackTraceElement[] traces = new StackTraceElement[dTraces.length];
for (int a = 0; a < dTraces.length; ++a)
- /* FIXME: We can't use the boolean as there is no available
- constructor. */
- traces[a] =
- new StackTraceElement((String) dTraces[a].get("ClassName"),
- (String) dTraces[a].get("MethodName"),
- (String) dTraces[a].get("FileName"),
- ((Integer)
- dTraces[a].get("LineNumber")).intValue());
+ /* FIXME: We can't use the boolean as there is no available
+ constructor. */
+ traces[a] =
+ new StackTraceElement((String) dTraces[a].get("ClassName"),
+ (String) dTraces[a].get("MethodName"),
+ (String) dTraces[a].get("FileName"),
+ ((Integer)
+ dTraces[a].get("LineNumber")).intValue());
MonitorInfo[] mInfo;
if (data.containsKey("LockedMonitors"))
{
- CompositeData[] dmInfos = (CompositeData[]) data.get("LockedMonitors");
- mInfo = new MonitorInfo[dmInfos.length];
- for (int a = 0; a < dmInfos.length; ++a)
- mInfo[a] = MonitorInfo.from(dmInfos[a]);
+ CompositeData[] dmInfos = (CompositeData[]) data.get("LockedMonitors");
+ mInfo = new MonitorInfo[dmInfos.length];
+ for (int a = 0; a < dmInfos.length; ++a)
+ mInfo[a] = MonitorInfo.from(dmInfos[a]);
}
else
mInfo = new MonitorInfo[]{};
LockInfo[] lInfo;
if (data.containsKey("LockedSynchronizers"))
{
- CompositeData[] dlInfos = (CompositeData[]) data.get("LockedSynchronizers");
- lInfo = new LockInfo[dlInfos.length];
- for (int a = 0; a < dlInfos.length; ++a)
- lInfo[a] = new LockInfo((String) dlInfos[a].get("ClassName"),
- (Integer) dlInfos[a].get("IdentityHashCode"));
+ CompositeData[] dlInfos = (CompositeData[]) data.get("LockedSynchronizers");
+ lInfo = new LockInfo[dlInfos.length];
+ for (int a = 0; a < dlInfos.length; ++a)
+ lInfo[a] = new LockInfo((String) dlInfos[a].get("ClassName"),
+ (Integer) dlInfos[a].get("IdentityHashCode"));
}
else
lInfo = new LockInfo[]{};
return new ThreadInfo(((Long) data.get("ThreadId")).longValue(),
- (String) data.get("ThreadName"),
- Thread.State.valueOf((String) data.get("ThreadState")),
- ((Long) data.get("BlockedCount")).longValue(),
- ((Long) data.get("BlockedTime")).longValue(),
- (String) data.get("LockName"),
- ((Long) data.get("LockOwnerId")).longValue(),
- (String) data.get("LockOwnerName"),
- ((Long) data.get("WaitedCount")).longValue(),
- ((Long) data.get("WaitedTime")).longValue(),
- ((Boolean) data.get("InNative")).booleanValue(),
- ((Boolean) data.get("Suspended")).booleanValue(),
- traces, mInfo, lInfo);
+ (String) data.get("ThreadName"),
+ Thread.State.valueOf((String) data.get("ThreadState")),
+ ((Long) data.get("BlockedCount")).longValue(),
+ ((Long) data.get("BlockedTime")).longValue(),
+ (String) data.get("LockName"),
+ ((Long) data.get("LockOwnerId")).longValue(),
+ (String) data.get("LockOwnerName"),
+ ((Long) data.get("WaitedCount")).longValue(),
+ ((Long) data.get("WaitedTime")).longValue(),
+ ((Boolean) data.get("InNative")).booleanValue(),
+ ((Boolean) data.get("Suspended")).booleanValue(),
+ traces, mInfo, lInfo);
}
/**
@@ -528,7 +528,7 @@ public class ThreadInfo
* for thread contention monitoring and for this support
* to be enabled.
* </p>
- *
+ *
* @return the accumulated time (in milliseconds) that this
* thread has spent in the blocked state, since
* thread contention monitoring was enabled, or -1
@@ -601,7 +601,7 @@ public class ThreadInfo
* The lock is the return value of
* {@link java.util.concurrent.locks.LockSupport#getBlocker()}.</li>
* </ol>
- *
+ *
* @return a {@link LockInfo} object representing the lock on
* which the thread is blocked, or <code>null</code> if
* the thread isn't blocked.
@@ -613,7 +613,7 @@ public class ThreadInfo
String lockName = getLockName();
int at = lockName.indexOf('@');
return new LockInfo(lockName.substring(0, at),
- Integer.decode(lockName.substring(at + 1)));
+ Integer.decode(lockName.substring(at + 1)));
}
/**
@@ -655,7 +655,7 @@ public class ThreadInfo
* monitor lock this thread is waiting for. -1 is returned
* if either this thread is not blocked, or the lock is
* not held by any other thread.
- *
+ *
* @return the thread identifier of thread holding the lock
* this thread is waiting for, or -1 if the thread
* is not blocked or the lock is not held by another
@@ -673,7 +673,7 @@ public class ThreadInfo
* monitor lock this thread is waiting for. <code>null</code>
* is returned if either this thread is not blocked,
* or the lock is not held by any other thread.
- *
+ *
* @return the thread identifier of thread holding the lock
* this thread is waiting for, or <code>null</code>
* if the thread is not blocked or the lock is not
@@ -701,7 +701,7 @@ public class ThreadInfo
* stack trace information for a thread. In these
* cases, an empty array will also be returned.
* </p>
- *
+ *
* @return an array of {@link java.lang.StackTraceElement}s
* representing the trace of this thread.
*/
@@ -742,16 +742,16 @@ public class ThreadInfo
{
return threadState;
}
-
+
/**
* Returns the number of times this thread has been
- * in the {@link java.lang.Thread.State#WAITING}
+ * in the {@link java.lang.Thread.State#WAITING}
* or {@link java.lang.Thread.State#TIMED_WAITING} state.
* A thread enters one of these states when it is waiting
* due to a call to {@link java.lang.Object.wait()},
* {@link java.lang.Object.join()} or
* {@link java.lang.concurrent.locks.LockSupport.park()},
- * either with an infinite or timed delay, respectively.
+ * either with an infinite or timed delay, respectively.
*
* @return the number of times this thread has been waiting.
*/
@@ -771,14 +771,14 @@ public class ThreadInfo
* due to a call to {@link java.lang.Object.wait()},
* {@link java.lang.Object.join()} or
* {@link java.lang.concurrent.locks.LockSupport.park()},
- * either with an infinite or timed delay, respectively.
+ * either with an infinite or timed delay, respectively.
* </p>
* <p>
* Use of this method requires virtual machine support
* for thread contention monitoring and for this support
* to be enabled.
* </p>
- *
+ *
* @return the accumulated time (in milliseconds) that this
* thread has spent in one of the waiting states, since
* thread contention monitoring was enabled, or -1
@@ -849,14 +849,14 @@ public class ThreadInfo
public String toString()
{
return getClass().getName() +
- "[id=" + threadId +
+ "[id=" + threadId +
", name=" + threadName +
", state=" + threadState +
", blockedCount=" + blockedCount +
", waitedCount=" + waitedCount +
- ", isInNative=" + isInNative +
+ ", isInNative=" + isInNative +
", isSuspended=" + isSuspended +
- (isThreadBlocked() ?
+ (isThreadBlocked() ?
", lockOwnerId=" + lockOwnerId +
", lockOwnerName=" + lockOwnerName : "") +
", lockedMonitors=" + Arrays.toString(lockedMonitors) +
@@ -888,8 +888,8 @@ public class ThreadInfo
private boolean isThreadBlocked()
{
return (threadState == Thread.State.BLOCKED ||
- threadState == Thread.State.WAITING ||
- threadState == Thread.State.TIMED_WAITING);
+ threadState == Thread.State.WAITING ||
+ threadState == Thread.State.TIMED_WAITING);
}
-
+
}
diff --git a/java/lang/management/ThreadMXBean.java b/java/lang/management/ThreadMXBean.java
index f73075dfd..551c53282 100644
--- a/java/lang/management/ThreadMXBean.java
+++ b/java/lang/management/ThreadMXBean.java
@@ -39,7 +39,7 @@ package java.lang.management;
/**
* <p>
- * Provides access to information about the threads
+ * Provides access to information about the threads
* of the virtual machine. An instance of this bean is
* obtained by calling
* {@link ManagementFactory#getThreadMXBean()}.
@@ -122,8 +122,8 @@ public interface ThreadMXBean
* @see #isSynchronizerUsageSupported()
*/
ThreadInfo[] dumpAllThreads(boolean lockedMonitors,
- boolean lockedSynchronizers);
-
+ boolean lockedSynchronizers);
+
/**
* <p>
* This method obtains a list of threads which are deadlocked
@@ -140,7 +140,7 @@ public interface ThreadMXBean
* then {@link #findMonitorDeadlockedThreads()} should be used in
* preference to this method.
* </p>
- *
+ *
* @return an array of thread identifiers, corresponding to threads
* which are currently in a deadlocked situation, or
* <code>null</code> if there are no deadlocks.
@@ -161,7 +161,7 @@ public interface ThreadMXBean
* waiting to obtain monitor ownership. On entering a synchronized
* method of an object, or re-entering it after returning from an
* {@link java.lang.Object#wait()} call, a thread obtains ownership
- * of the object's monitor.
+ * of the object's monitor.
* </p>
* <p>
* Deadlocks can occur in this situation if one or more threads end up
@@ -174,7 +174,7 @@ public interface ThreadMXBean
* of a different object. While in that method, it then wants to
* call the original synchronized method, R, called by A. Doing so
* requires ownership of P, which is still held by A. Hence, it
- * becomes blocked.
+ * becomes blocked.
* </p>
* <p>
* A then finishes its sleep, becomes runnable, and is then allowed
@@ -193,7 +193,7 @@ public interface ThreadMXBean
* to include deadlocks involving ownable synchronizers,
* {@link #findDeadlockedThreads()} should be used instead.
* </p>
- *
+ *
* @return an array of thread identifiers, corresponding to threads
* which are currently in a deadlocked situation, or
* <code>null</code> if there are no deadlocks.
@@ -221,7 +221,7 @@ public interface ThreadMXBean
* Returns the total number of nanoseconds of CPU time
* the current thread has used. This is equivalent to calling
* <code>{@link #getThreadCpuTime()}(Thread.currentThread.getId())</code>.
- * </p>
+ * </p>
* <p>
* Note that the value is only nanosecond-precise, and not accurate; there
* is no guarantee that the difference between two values is really a
@@ -248,7 +248,7 @@ public interface ThreadMXBean
* the current thread has executed in user mode. This is
* equivalent to calling
* <code>{@link #getThreadUserTime()}(Thread.currentThread.getId())</code>.
- * </p>
+ * </p>
* <p>
* Note that the value is only nanosecond-precise, and not accurate; there
* is no guarantee that the difference between two values is really a
@@ -298,8 +298,8 @@ public interface ThreadMXBean
/**
* <p>
* Returns the total number of nanoseconds of CPU time
- * the specified thread has used.
- * </p>
+ * the specified thread has used.
+ * </p>
* <p>
* Note that the value is only nanosecond-precise, and not accurate; there
* is no guarantee that the difference between two values is really a
@@ -329,7 +329,7 @@ public interface ThreadMXBean
* <code>{@link #getThreadInfo}(id, 0)</code>. If the
* identifier specifies a thread which is either non-existant
* or not alive, then the method returns <code>null</code>.
- *
+ *
* @param id the identifier of the thread to return information
* on.
* @return a {@link ThreadInfo} object pertaining to the specified
@@ -348,11 +348,11 @@ public interface ThreadMXBean
* identifier specifies a thread which is either non-existant
* or not alive, then the corresponding element in the returned
* array is <code>null</code>.
- *
+ *
* @param ids an array of thread identifiers to return information
* on.
* @return an array of {@link ThreadInfo} objects matching the
- * specified threads. The corresponding element is
+ * specified threads. The corresponding element is
* <code>null</code> if the identifier specifies
* a thread that doesn't exist or is not alive.
* @throws IllegalArgumentException if an identifier in the array is
@@ -379,15 +379,15 @@ public interface ThreadMXBean
* If an identifier specifies a thread which is either non-existant
* or not alive, then the corresponding element in the returned
* array is <code>null</code>.
- *
+ *
* @param ids an array of thread identifiers to return information
* on.
* @param lockedMonitors true if information on locked monitors
* should be included.
* @param lockedSynchronizers true if information on locked
- * ownable synchronizers should be included.
+ * ownable synchronizers should be included.
* @return an array of {@link ThreadInfo} objects matching the
- * specified threads. The corresponding element is
+ * specified threads. The corresponding element is
* <code>null</code> if the identifier specifies
* a thread that doesn't exist or is not alive.
* @throws IllegalArgumentException if an identifier in the array is
@@ -407,7 +407,7 @@ public interface ThreadMXBean
* @see #isSynchronizerUsageSupported()
*/
ThreadInfo[] getThreadInfo(long[] ids, boolean lockedMonitors,
- boolean lockedSynchronizers);
+ boolean lockedSynchronizers);
/**
* Returns information on the specified thread with
@@ -444,7 +444,7 @@ public interface ThreadMXBean
* to an empty stack trace (an empty array is returned by the
* appropriate {@link ThreadInfo} method). A maximum depth of
* <code>Integer.MAX_VALUE</code> returns the full stack trace.
- *
+ *
* @param ids an array of thread identifiers to return information
* on.
* @param maxDepth the maximum depth of the stack trace.
@@ -452,7 +452,7 @@ public interface ThreadMXBean
* correspond to an empty and full stack trace
* respectively.
* @return an array of {@link ThreadInfo} objects matching the
- * specified threads. The corresponding element is
+ * specified threads. The corresponding element is
* <code>null</code> if the identifier specifies
* a thread that doesn't exist or is not alive.
* @throws IllegalArgumentException if an identifier in the array is
@@ -466,8 +466,8 @@ public interface ThreadMXBean
/**
* <p>
* Returns the total number of nanoseconds of CPU time
- * the specified thread has executed in user mode.
- * </p>
+ * the specified thread has executed in user mode.
+ * </p>
* <p>
* Note that the value is only nanosecond-precise, and not accurate; there
* is no guarantee that the difference between two values is really a
diff --git a/java/lang/ref/PhantomReference.java b/java/lang/ref/PhantomReference.java
index 67e97d399..29215ead7 100644
--- a/java/lang/ref/PhantomReference.java
+++ b/java/lang/ref/PhantomReference.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,7 +44,7 @@ package java.lang.ref;
* finalized. This is the reason, why <code>get()</code> always
* returns null.
*
- * @author Jochen Hoenicke
+ * @author Jochen Hoenicke
*/
public class PhantomReference<T>
extends Reference<T>
@@ -60,11 +60,11 @@ public class PhantomReference<T>
{
super(referent, q);
}
-
+
/**
* Returns the object, this reference refers to.
* @return <code>null</code>, since the refered object may be
- * finalized and thus not accessible.
+ * finalized and thus not accessible.
*/
public T get()
{
diff --git a/java/lang/ref/Reference.java b/java/lang/ref/Reference.java
index ce224b891..37cda6f02 100644
--- a/java/lang/ref/Reference.java
+++ b/java/lang/ref/Reference.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -89,7 +89,7 @@ public abstract class Reference<T>
* reference is not enqueued. Otherwise it points to the next
* reference. The last reference on a queue will point to itself
* (not to null, that value is used to mark a not enqueued
- * reference).
+ * reference).
*/
volatile Reference nextOnQueue;
@@ -103,7 +103,7 @@ public abstract class Reference<T>
/**
* Creates a new reference that is not registered to any queue.
* Since it is package private, it is not possible to overload this
- * class in a different package.
+ * class in a different package.
* @param ref the object we refer to.
*/
Reference(T ref)
@@ -114,7 +114,7 @@ public abstract class Reference<T>
/**
* Creates a reference that is registered to a queue. Since this is
* package private, it is not possible to overload this class in a
- * different package.
+ * different package.
* @param ref the object we refer to.
* @param q the reference queue to register on.
* @exception NullPointerException if q is null.
@@ -129,21 +129,21 @@ public abstract class Reference<T>
/**
* Returns the object, this reference refers to.
- * @return the object, this reference refers to, or null if the
+ * @return the object, this reference refers to, or null if the
* reference was cleared.
*/
public T get()
{
synchronized (lock)
{
- return referent;
+ return referent;
}
}
/**
* Clears the reference, so that it doesn't refer to its object
* anymore. For soft and weak references this is called by the
- * garbage collector. For phantom references you should call
+ * garbage collector. For phantom references you should call
* this when enqueuing the reference.
*/
public void clear()
@@ -164,12 +164,12 @@ public abstract class Reference<T>
* Enqueue an object on a reference queue. This is normally executed
* by the garbage collector.
*/
- public boolean enqueue()
+ public boolean enqueue()
{
ReferenceQueue q = queue;
if (q != null)
{
- return q.enqueue(this);
+ return q.enqueue(this);
}
return false;
}
diff --git a/java/lang/ref/ReferenceQueue.java b/java/lang/ref/ReferenceQueue.java
index 281628779..73f62d64a 100644
--- a/java/lang/ref/ReferenceQueue.java
+++ b/java/lang/ref/ReferenceQueue.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -55,9 +55,9 @@ public class ReferenceQueue<T>
/**
* This is a linked list of references. If this is null, the list is
* empty. Otherwise this points to the first reference on the queue.
- * The first reference will point to the next reference via the
+ * The first reference will point to the next reference via the
* <code>nextOnQueue</code> field. The last reference will point to
- * itself (not to null, since <code>nextOnQueue</code> is used to
+ * itself (not to null, since <code>nextOnQueue</code> is used to
* determine if a reference is enqueued).
*/
private Reference<? extends T> first;
@@ -80,15 +80,15 @@ public class ReferenceQueue<T>
* immediately. The reference will be dequeued.
*
* @return a reference on the queue, if there is one,
- * <code>null</code> otherwise.
+ * <code>null</code> otherwise.
*/
public Reference<? extends T> poll()
- {
+ {
return dequeue();
}
/**
- * This is called by reference to enqueue itself on this queue.
+ * This is called by reference to enqueue itself on this queue.
* @param ref the reference that should be enqueued.
* @return true if successful, false if not.
*/
@@ -119,7 +119,7 @@ public class ReferenceQueue<T>
{
if (first == null)
return null;
-
+
Reference<? extends T> result = first;
first = (first == first.nextOnQueue) ? null : first.nextOnQueue;
result.nextOnQueue = null;
@@ -132,8 +132,8 @@ public class ReferenceQueue<T>
* until a reference is enqueued.
* @param timeout the timeout period in milliseconds, <code>0</code> means
* wait forever.
- * @return the reference removed from the queue, or
- * <code>null</code> if timeout period expired.
+ * @return the reference removed from the queue, or
+ * <code>null</code> if timeout period expired.
* @exception InterruptedException if the wait was interrupted.
*/
public Reference<? extends T> remove(long timeout)
@@ -147,13 +147,13 @@ public class ReferenceQueue<T>
return dequeue();
}
-
+
/**
* Removes a reference from the queue, blocking until a reference is
* enqueued.
*
- * @return the reference removed from the queue.
+ * @return the reference removed from the queue.
* @exception InterruptedException if the wait was interrupted.
*/
public Reference<? extends T> remove()
diff --git a/java/lang/ref/SoftReference.java b/java/lang/ref/SoftReference.java
index 077dc173d..269ffd0ec 100644
--- a/java/lang/ref/SoftReference.java
+++ b/java/lang/ref/SoftReference.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ package java.lang.ref;
* references it should clear. This makes a soft reference ideal for
* caches.<br>
*
- * @author Jochen Hoenicke
+ * @author Jochen Hoenicke
*/
public class SoftReference<T>
extends Reference<T>
@@ -69,15 +69,15 @@ public class SoftReference<T>
{
super(referent, q);
}
-
+
/**
* Returns the object, this reference refers to.
- * @return the object, this reference refers to, or null if the
+ * @return the object, this reference refers to, or null if the
* reference was cleared.
*/
public T get()
{
- /* Why is this overloaded???
+ /* Why is this overloaded???
* Maybe for a kind of LRU strategy. */
return super.get();
}
diff --git a/java/lang/ref/WeakReference.java b/java/lang/ref/WeakReference.java
index 563563bf1..973564336 100644
--- a/java/lang/ref/WeakReference.java
+++ b/java/lang/ref/WeakReference.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -51,8 +51,8 @@ package java.lang.ref;
* an object is not referenced anymore, the reference will
* automatically cleared, and you may remove it from the set. <br>
*
- * @author Jochen Hoenicke
- * @see java.util.WeakHashMap
+ * @author Jochen Hoenicke
+ * @see java.util.WeakHashMap
*/
public class WeakReference<T>
extends Reference<T>
diff --git a/java/lang/reflect/AccessibleObject.java b/java/lang/reflect/AccessibleObject.java
index 328f81d79..75676913d 100644
--- a/java/lang/reflect/AccessibleObject.java
+++ b/java/lang/reflect/AccessibleObject.java
@@ -91,9 +91,9 @@ public class AccessibleObject
* <code>ReflectPermission("suppressAccessChecks")</code>.<p>
*
* It is forbidden to set the accessibility flag to true on any constructor
- * for java.lang.Class. This will result in a SecurityException. If the
+ * for java.lang.Class. This will result in a SecurityException. If the
* SecurityException is thrown for any of the passed AccessibleObjects,
- * the accessibility flag will be set on AccessibleObjects in the array prior
+ * the accessibility flag will be set on AccessibleObjects in the array prior
* to the one which resulted in the exception.
*
* @param array the array of accessible objects
@@ -115,7 +115,7 @@ public class AccessibleObject
* manager exists, it is checked for
* <code>ReflectPermission("suppressAccessChecks")</code>.<p>
*
- * It is forbidden to set the accessibility flag to true on any constructor for
+ * It is forbidden to set the accessibility flag to true on any constructor for
* java.lang.Class. This will result in a SecurityException.
*
* @param flag the desired state of accessibility, true to bypass security
diff --git a/java/lang/reflect/AnnotatedElement.java b/java/lang/reflect/AnnotatedElement.java
index 8f2a8b6f5..0179a0f4c 100644
--- a/java/lang/reflect/AnnotatedElement.java
+++ b/java/lang/reflect/AnnotatedElement.java
@@ -57,7 +57,7 @@ import java.lang.annotation.Annotation;
* <code>AnnotationTypeMismatchException</code> or
* <code>IncompleteAnnotationException</code>.
* </p>
- *
+ *
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
diff --git a/java/lang/reflect/Array.java b/java/lang/reflect/Array.java
index d64e36c37..a31e48ea6 100644
--- a/java/lang/reflect/Array.java
+++ b/java/lang/reflect/Array.java
@@ -248,7 +248,7 @@ public final class Array
throw new NullPointerException();
throw new IllegalArgumentException();
}
-
+
/**
* Gets an element of a byte array.
*
@@ -422,11 +422,11 @@ public final class Array
{
if (array instanceof Object[])
{
- // Too bad the API won't let us throw the easier ArrayStoreException!
- if (value != null
- && ! array.getClass().getComponentType().isInstance(value))
- throw new IllegalArgumentException();
- ((Object[]) array)[index] = value;
+ // Too bad the API won't let us throw the easier ArrayStoreException!
+ if (value != null
+ && ! array.getClass().getComponentType().isInstance(value))
+ throw new IllegalArgumentException();
+ ((Object[]) array)[index] = value;
}
else if (value instanceof Byte)
setByte(array, index, ((Byte) value).byteValue());
diff --git a/java/lang/reflect/Constructor.java b/java/lang/reflect/Constructor.java
index d9b7e8312..d6c8d7934 100755
--- a/java/lang/reflect/Constructor.java
+++ b/java/lang/reflect/Constructor.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -81,7 +81,7 @@ import java.lang.annotation.Annotation;
public final class Constructor<T>
extends AccessibleObject
implements GenericDeclaration, Member
-{
+{
private static final int CONSTRUCTOR_MODIFIERS
= Modifier.PRIVATE | Modifier.PROTECTED | Modifier.PUBLIC;
@@ -108,7 +108,7 @@ public final class Constructor<T>
*/
public Class<T> getDeclaringClass()
{
- // Inescapable as the VM layer is 1.4 based.
+ // Inescapable as the VM layer is 1.4 based.
@SuppressWarnings("unchecked")
Class<T> declClass = (Class<T>) cons.getDeclaringClass();
return declClass;
@@ -314,7 +314,7 @@ public final class Constructor<T>
throws InstantiationException, IllegalAccessException,
InvocationTargetException
{
- // Inescapable as the VM layer is 1.4 based.
+ // Inescapable as the VM layer is 1.4 based.
@SuppressWarnings("unchecked")
T ins = (T) cons.construct(args);
return ins;
@@ -336,10 +336,10 @@ public final class Constructor<T>
{
if (p == null)
{
- String sig = cons.getSignature();
- if (sig == null)
- return new TypeVariable[0];
- p = new MethodSignatureParser(this, sig);
+ String sig = cons.getSignature();
+ if (sig == null)
+ return new TypeVariable[0];
+ p = new MethodSignatureParser(this, sig);
}
return p.getTypeParameters();
}
@@ -350,7 +350,7 @@ public final class Constructor<T>
* An array of size zero is returned if this constructor declares no
* exceptions.
*
- * @return the exception types declared by this constructor.
+ * @return the exception types declared by this constructor.
* @throws GenericSignatureFormatError if the generic signature does
* not conform to the format specified in the Virtual Machine
* specification, version 3.
@@ -360,10 +360,10 @@ public final class Constructor<T>
{
if (p == null)
{
- String sig = cons.getSignature();
- if (sig == null)
- return getExceptionTypes();
- p = new MethodSignatureParser(this, sig);
+ String sig = cons.getSignature();
+ if (sig == null)
+ return getExceptionTypes();
+ p = new MethodSignatureParser(this, sig);
}
return p.getGenericExceptionTypes();
}
@@ -384,10 +384,10 @@ public final class Constructor<T>
{
if (p == null)
{
- String sig = cons.getSignature();
- if (sig == null)
- return getParameterTypes();
- p = new MethodSignatureParser(this, sig);
+ String sig = cons.getSignature();
+ if (sig == null)
+ return getParameterTypes();
+ p = new MethodSignatureParser(this, sig);
}
return p.getGenericParameterTypes();
}
@@ -406,7 +406,7 @@ public final class Constructor<T>
* The returned annotations are serialized. Changing the annotations has
* no affect on the return value of future calls to this method.
* </p>
- *
+ *
* @return an array of arrays which represents the annotations used on the
* parameters of this constructor. The order of the array elements
* matches the declaration order of the parameters.
@@ -428,7 +428,7 @@ public final class Constructor<T>
*/
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
- // Inescapable as the VM layer is 1.4 based.
+ // Inescapable as the VM layer is 1.4 based.
@SuppressWarnings("unchecked")
T ann = (T) cons.getAnnotation(annotationClass);
return ann;
diff --git a/java/lang/reflect/Field.java b/java/lang/reflect/Field.java
index b9d928845..29ca795b8 100644
--- a/java/lang/reflect/Field.java
+++ b/java/lang/reflect/Field.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -691,11 +691,11 @@ extends AccessibleObject implements Member
{
if (p == null)
{
- String signature = f.getSignature();
- if (signature == null)
- return getType();
- p = new FieldSignatureParser(getDeclaringClass(),
- signature);
+ String signature = f.getSignature();
+ if (signature == null)
+ return getType();
+ p = new FieldSignatureParser(getDeclaringClass(),
+ signature);
}
return p.getFieldType();
}
@@ -711,7 +711,7 @@ extends AccessibleObject implements Member
*/
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
- // Inescapable as the VM layer is 1.4 based. T will erase to Annotation anyway.
+ // Inescapable as the VM layer is 1.4 based. T will erase to Annotation anyway.
@SuppressWarnings("unchecked") T ann = (T) f.getAnnotation(annotationClass);
return ann;
}
diff --git a/java/lang/reflect/GenericArrayType.java b/java/lang/reflect/GenericArrayType.java
index 8dc33a796..2e080247c 100644
--- a/java/lang/reflect/GenericArrayType.java
+++ b/java/lang/reflect/GenericArrayType.java
@@ -46,7 +46,7 @@ package java.lang.reflect;
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
-public interface GenericArrayType
+public interface GenericArrayType
extends Type
{
diff --git a/java/lang/reflect/GenericDeclaration.java b/java/lang/reflect/GenericDeclaration.java
index 244befd88..d78aba913 100644
--- a/java/lang/reflect/GenericDeclaration.java
+++ b/java/lang/reflect/GenericDeclaration.java
@@ -52,7 +52,7 @@ public interface GenericDeclaration
* Returns a <code>TypeVariable</code> object for each type variable
* declared by this entity, in order of declaration. An empty array
* is returned if no type variables are declared.
- *
+ *
* @return an array of <code>TypeVariable</code> objects.
* @throws GenericSignatureFormatError if the signature format within the
* class file does not conform to that specified in the 3rd edition
diff --git a/java/lang/reflect/InvocationHandler.java b/java/lang/reflect/InvocationHandler.java
index 208e621ee..3d30afd93 100644
--- a/java/lang/reflect/InvocationHandler.java
+++ b/java/lang/reflect/InvocationHandler.java
@@ -55,7 +55,7 @@ package java.lang.reflect;
* work on any object in general.</p>
*
* <p>Hints for implementing this class:</p>
- *
+ *
* <ul>
* <li>Don't forget that Object.equals, Object.hashCode, and
* Object.toString will call this handler. In particular,
diff --git a/java/lang/reflect/MalformedParameterizedTypeException.java b/java/lang/reflect/MalformedParameterizedTypeException.java
index 50ae23000..bfbe3bc89 100644
--- a/java/lang/reflect/MalformedParameterizedTypeException.java
+++ b/java/lang/reflect/MalformedParameterizedTypeException.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.lang.reflect;
-/**
+/**
* This exception class is thrown when one of the reflection
* methods encountered an invalid parameterized type within
* the metadata of a class. One possible reason for this
@@ -47,9 +47,9 @@ package java.lang.reflect;
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class MalformedParameterizedTypeException
+public class MalformedParameterizedTypeException
extends RuntimeException
{
private static final long serialVersionUID = -5696557788586220964L;
diff --git a/java/lang/reflect/Method.java b/java/lang/reflect/Method.java
index 0a532ddb6..fe4b2eb1f 100644
--- a/java/lang/reflect/Method.java
+++ b/java/lang/reflect/Method.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -333,7 +333,7 @@ extends AccessibleObject implements Member, GenericDeclaration
* An array of size zero is returned if this class has no type
* variables.
*
- * @return the type variables associated with this class.
+ * @return the type variables associated with this class.
* @throws GenericSignatureFormatError if the generic signature does
* not conform to the format specified in the Virtual Machine
* specification, version 3.
@@ -343,10 +343,10 @@ extends AccessibleObject implements Member, GenericDeclaration
{
if (p == null)
{
- String sig = m.getSignature();
- if (sig == null)
- return (TypeVariable<Method>[]) new TypeVariable[0];
- p = new MethodSignatureParser(this, sig);
+ String sig = m.getSignature();
+ if (sig == null)
+ return (TypeVariable<Method>[]) new TypeVariable[0];
+ p = new MethodSignatureParser(this, sig);
}
return p.getTypeParameters();
}
@@ -357,7 +357,7 @@ extends AccessibleObject implements Member, GenericDeclaration
* An array of size zero is returned if this method declares no
* exceptions.
*
- * @return the exception types declared by this method.
+ * @return the exception types declared by this method.
* @throws GenericSignatureFormatError if the generic signature does
* not conform to the format specified in the Virtual Machine
* specification, version 3.
@@ -367,10 +367,10 @@ extends AccessibleObject implements Member, GenericDeclaration
{
if (p == null)
{
- String sig = m.getSignature();
- if (sig == null)
- return getExceptionTypes();
- p = new MethodSignatureParser(this, sig);
+ String sig = m.getSignature();
+ if (sig == null)
+ return getExceptionTypes();
+ p = new MethodSignatureParser(this, sig);
}
return p.getGenericExceptionTypes();
}
@@ -391,10 +391,10 @@ extends AccessibleObject implements Member, GenericDeclaration
{
if (p == null)
{
- String sig = m.getSignature();
- if (sig == null)
- return getParameterTypes();
- p = new MethodSignatureParser(this, sig);
+ String sig = m.getSignature();
+ if (sig == null)
+ return getParameterTypes();
+ p = new MethodSignatureParser(this, sig);
}
return p.getGenericParameterTypes();
}
@@ -412,10 +412,10 @@ extends AccessibleObject implements Member, GenericDeclaration
{
if (p == null)
{
- String sig = m.getSignature();
- if (sig == null)
- return getReturnType();
- p = new MethodSignatureParser(this, sig);
+ String sig = m.getSignature();
+ if (sig == null)
+ return getReturnType();
+ p = new MethodSignatureParser(this, sig);
}
return p.getGenericReturnType();
}
@@ -450,7 +450,7 @@ extends AccessibleObject implements Member, GenericDeclaration
* The returned annotations are serialized. Changing the annotations has
* no affect on the return value of future calls to this method.
* </p>
- *
+ *
* @return an array of arrays which represents the annotations used on the
* parameters of this method. The order of the array elements
* matches the declaration order of the parameters.
@@ -472,7 +472,7 @@ extends AccessibleObject implements Member, GenericDeclaration
*/
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
{
- // Inescapable as the VM layer is 1.4 based. T will erase to Annotation anyway.
+ // Inescapable as the VM layer is 1.4 based. T will erase to Annotation anyway.
@SuppressWarnings("unchecked")
T ann = (T) m.getAnnotation(annotationClass);
return ann;
diff --git a/java/lang/reflect/Modifier.java b/java/lang/reflect/Modifier.java
index 45d9b51a7..15bad05e7 100644
--- a/java/lang/reflect/Modifier.java
+++ b/java/lang/reflect/Modifier.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -345,7 +345,7 @@ public class Modifier
r.append("strictfp ");
if (isInterface(mod))
r.append("interface ");
-
+
// Trim trailing space.
if ((mod & ALL_FLAGS) != 0)
r.setLength(r.length() - 1);
diff --git a/java/lang/reflect/Proxy.java b/java/lang/reflect/Proxy.java
index fb2004e79..0e76124df 100644
--- a/java/lang/reflect/Proxy.java
+++ b/java/lang/reflect/Proxy.java
@@ -217,7 +217,7 @@ public class Proxy implements Serializable
* <p>There are several restrictions on this method, the violation of
* which will result in an IllegalArgumentException or
* NullPointerException:</p>
- *
+ *
* <ul>
* <li>All objects in `interfaces' must represent distinct interfaces.
* Classes, primitive types, null, and duplicates are forbidden.</li>
@@ -258,7 +258,7 @@ public class Proxy implements Serializable
// synchronized so that we aren't trying to build the same class
// simultaneously in two threads
public static synchronized Class<?> getProxyClass(ClassLoader loader,
- Class<?>... interfaces)
+ Class<?>... interfaces)
{
interfaces = (Class[]) interfaces.clone();
ProxyType pt = new ProxyType(loader, interfaces);
@@ -274,7 +274,7 @@ public class Proxy implements Serializable
: ProxyData.getProxyData(pt));
clazz = (VMProxy.HAVE_NATIVE_GENERATE_PROXY_CLASS
- ? VMProxy.generateProxyClass(loader, data)
+ ? VMProxy.generateProxyClass(loader, data)
: new ClassFactory(data).generate(loader));
}
@@ -716,7 +716,7 @@ public class Proxy implements Serializable
if (! Modifier.isPublic(inter.getModifiers()))
if (in_package)
{
- String p = getPackage(inter);
+ String p = getPackage(inter);
if (! data.pack.equals(p))
throw new IllegalArgumentException("non-public interfaces "
+ "from different "
@@ -769,7 +769,7 @@ public class Proxy implements Serializable
* Method.equals as it would also check the declaring class, what we do not
* want. We only want to check that the given method have the same signature
* as a core method (same name and parameter types)
- *
+ *
* @param method the method to check
* @return whether the method has the same name and parameter types as
* Object.equals, Object.hashCode or Object.toString
@@ -795,7 +795,7 @@ public class Proxy implements Serializable
}
return false;
}
-
+
} // class ProxyData
/**
@@ -1260,7 +1260,7 @@ public class Proxy implements Serializable
ProtectionDomain.class };
Method m = vmClassLoader.getDeclaredMethod("defineClass", types);
// We can bypass the security check of setAccessible(true), since
- // we're in the same package.
+ // we're in the same package.
m.flag = true;
Object[] args = {loader, qualName, bytecode, Integer.valueOf(0),
diff --git a/java/lang/reflect/Type.java b/java/lang/reflect/Type.java
index c9ea5bfb9..41b0a9ca9 100644
--- a/java/lang/reflect/Type.java
+++ b/java/lang/reflect/Type.java
@@ -49,7 +49,7 @@ package java.lang.reflect;
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
- */
+ */
public interface Type
{
}
diff --git a/java/lang/reflect/TypeVariable.java b/java/lang/reflect/TypeVariable.java
index ec6af69db..671c290ba 100644
--- a/java/lang/reflect/TypeVariable.java
+++ b/java/lang/reflect/TypeVariable.java
@@ -39,13 +39,13 @@ exception statement from your version. */
package java.lang.reflect;
/**
- * <p>
+ * <p>
* This is a common interface for all type variables provided by
* the Java language. Instances are created the first time a type
* variable is needed by one of the reflective methods declared in
* this package.
* </p>
- * <p>
+ * <p>
* Creating a type variable requires resolving the appropriate type.
* This may involve resolving other classes as a side effect (e.g.
* if the type is nested inside other classes). Creation should not
@@ -57,7 +57,7 @@ package java.lang.reflect;
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
- */
+ */
public interface TypeVariable<T extends GenericDeclaration> extends Type
{
diff --git a/java/lang/reflect/WildcardType.java b/java/lang/reflect/WildcardType.java
index 4f789067c..43b5d0a40 100644
--- a/java/lang/reflect/WildcardType.java
+++ b/java/lang/reflect/WildcardType.java
@@ -84,7 +84,7 @@ public interface WildcardType extends Type
* the lower bounds of this type do not actually exist.
* @throws MalformedParameterizedTypeException if any of the types
* refer to a type which can not be instantiated.
- */
+ */
Type[] getLowerBounds();
/**
@@ -109,7 +109,7 @@ public interface WildcardType extends Type
* the upper bounds of this type do not actually exist.
* @throws MalformedParameterizedTypeException if any of the types
* refer to a type which can not be instantiated.
- */
+ */
Type[] getUpperBounds();
}
diff --git a/java/math/BigDecimal.java b/java/math/BigDecimal.java
index eceaf8cdd..7f4546cda 100644
--- a/java/math/BigDecimal.java
+++ b/java/math/BigDecimal.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,21 +50,21 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
* The constant zero as a BigDecimal with scale zero.
* @since 1.5
*/
- public static final BigDecimal ZERO =
+ public static final BigDecimal ZERO =
new BigDecimal (BigInteger.ZERO, 0);
/**
* The constant one as a BigDecimal with scale zero.
* @since 1.5
*/
- public static final BigDecimal ONE =
+ public static final BigDecimal ONE =
new BigDecimal (BigInteger.ONE, 0);
/**
* The constant ten as a BigDecimal with scale zero.
* @since 1.5
*/
- public static final BigDecimal TEN =
+ public static final BigDecimal TEN =
new BigDecimal (BigInteger.TEN, 0);
public static final int ROUND_UP = 0;
@@ -87,7 +87,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.intVal = BigInteger.valueOf(val);
this.scale = 0;
}
-
+
/**
* Constructs a BigDecimal using the BigDecimal(int) constructor and then
* rounds according to the MathContext.
@@ -106,9 +106,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.intVal = result.intVal;
this.scale = result.scale;
this.precision = result.precision;
- }
+ }
}
-
+
/**
* Constructs a new BigDecimal whose unscaled value is val and whose
* scale is zero.
@@ -119,7 +119,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.intVal = BigInteger.valueOf(val);
this.scale = 0;
}
-
+
/**
* Constructs a BigDecimal from the long in the same way as BigDecimal(long)
* and then rounds according to the MathContext.
@@ -138,12 +138,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.intVal = result.intVal;
this.scale = result.scale;
this.precision = result.precision;
- }
+ }
}
-
+
/**
- * Constructs a BigDecimal whose value is given by num rounded according to
- * mc. Since num is already a BigInteger, the rounding refers only to the
+ * Constructs a BigDecimal whose value is given by num rounded according to
+ * mc. Since num is already a BigInteger, the rounding refers only to the
* precision setting in mc, if mc.getPrecision() returns an int lower than
* the number of digits in num, then rounding is necessary.
* @param num the unscaledValue, before rounding
@@ -163,15 +163,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.precision = result.precision;
}
}
-
+
/**
* Constructs a BigDecimal from the String val according to the same
- * rules as the BigDecimal(String) constructor and then rounds
+ * rules as the BigDecimal(String) constructor and then rounds
* according to the MathContext mc.
* @param val the String from which we construct the initial BigDecimal
* @param mc the MathContext that specifies the rounding
* @throws ArithmeticException if the result is inexact but the rounding type
- * is RoundingMode.UNNECESSARY
+ * is RoundingMode.UNNECESSARY
* @since 1.5
*/
public BigDecimal (String val, MathContext mc)
@@ -185,13 +185,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.precision = result.precision;
}
}
-
+
/**
* Constructs a BigDecimal whose unscaled value is num and whose
* scale is zero.
* @param num the value of the new BigDecimal
*/
- public BigDecimal (BigInteger num)
+ public BigDecimal (BigInteger num)
{
this (num, 0);
}
@@ -207,9 +207,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.intVal = num;
this.scale = scale;
}
-
+
/**
- * Constructs a BigDecimal using the BigDecimal(BigInteger, int)
+ * Constructs a BigDecimal using the BigDecimal(BigInteger, int)
* constructor and then rounds according to the MathContext.
* @param num the unscaled value of the unrounded BigDecimal
* @param scale the scale of the unrounded BigDecimal
@@ -236,7 +236,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
* @param num the double from which the initial BigDecimal is created
* @param mc the MathContext that specifies the rounding behaviour
* @throws ArithmeticException if the result is inexact but the rounding type
- * is RoundingMode.UNNECESSARY
+ * is RoundingMode.UNNECESSARY
* @since 1.5
*/
public BigDecimal (double num, MathContext mc)
@@ -250,8 +250,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.precision = result.precision;
}
}
-
- public BigDecimal (double num) throws NumberFormatException
+
+ public BigDecimal (double num) throws NumberFormatException
{
if (Double.isInfinite (num) || Double.isNaN (num))
throw new NumberFormatException ("invalid argument: " + num);
@@ -282,37 +282,37 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
// Shave off factors of 10.
while (exponent < 0 && (mantissa & 1) == 0)
{
- ++exponent;
- mantissa >>= 1;
+ ++exponent;
+ mantissa >>= 1;
}
intVal = BigInteger.valueOf (bits < 0 ? - mantissa : mantissa);
if (exponent < 0)
{
- // We have MANTISSA * 2 ^ (EXPONENT).
- // Since (1/2)^N == 5^N * 10^-N we can easily convert this
- // into a power of 10.
- scale = (int) (- exponent);
- BigInteger mult = BigInteger.valueOf (5).pow (scale);
- intVal = intVal.multiply (mult);
+ // We have MANTISSA * 2 ^ (EXPONENT).
+ // Since (1/2)^N == 5^N * 10^-N we can easily convert this
+ // into a power of 10.
+ scale = (int) (- exponent);
+ BigInteger mult = BigInteger.valueOf (5).pow (scale);
+ intVal = intVal.multiply (mult);
}
else
{
- intVal = intVal.shiftLeft ((int) exponent);
- scale = 0;
+ intVal = intVal.shiftLeft ((int) exponent);
+ scale = 0;
}
}
/**
- * Constructs a BigDecimal from the char subarray and rounding
+ * Constructs a BigDecimal from the char subarray and rounding
* according to the MathContext.
* @param in the char array
* @param offset the start of the subarray
* @param len the length of the subarray
* @param mc the MathContext for rounding
- * @throws NumberFormatException if the char subarray is not a valid
+ * @throws NumberFormatException if the char subarray is not a valid
* BigDecimal representation
- * @throws ArithmeticException if the result is inexact but the rounding
+ * @throws ArithmeticException if the result is inexact but the rounding
* mode is RoundingMode.UNNECESSARY
* @since 1.5
*/
@@ -328,10 +328,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.precision = temp.precision;
}
}
-
+
/**
* Constructs a BigDecimal from the char array and rounding according
- * to the MathContext.
+ * to the MathContext.
* @param in the char array
* @param mc the MathContext
* @throws NumberFormatException if <code>in</code> is not a valid BigDecimal
@@ -350,9 +350,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
this.intVal = temp.intVal;
this.scale = temp.scale;
this.precision = temp.precision;
- }
+ }
}
-
+
/**
* Constructs a BigDecimal from the given char array, accepting the same
* sequence of characters as the BigDecimal(String) constructor.
@@ -365,10 +365,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
this(in, 0, in.length);
}
-
+
/**
* Constructs a BigDecimal from a char subarray, accepting the same sequence
- * of characters as the BigDecimal(String) constructor.
+ * of characters as the BigDecimal(String) constructor.
* @param in the char array
* @param offset the start of the subarray
* @param len the length of the subarray
@@ -385,12 +385,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
// point is the index into the char array where the exponent starts
// (or, if there is no exponent, this is equal to end)
int point = offset;
- // dot is the index into the char array where the decimal point is
+ // dot is the index into the char array where the decimal point is
// found, or -1 if there is no decimal point
int dot = -1;
-
+
// The following examples show what these variables mean. Note that
- // point and dot don't yet have the correct values, they will be
+ // point and dot don't yet have the correct values, they will be
// properly assigned in a loop later on in this method.
//
// Example 1
@@ -409,11 +409,11 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
//
// Example 3
//
- // - 1 2 3 4 5 e 7
+ // - 1 2 3 4 5 e 7
// __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __
//
- // offset = 2, len = 8, start = 3, dot = -1, point = 8, end = 10
-
+ // offset = 2, len = 8, start = 3, dot = -1, point = 8, end = 10
+
// Determine the sign of the number.
boolean negative = false;
if (in[offset] == '+')
@@ -428,7 +428,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
negative = true;
}
- // Check each character looking for the decimal point and the
+ // Check each character looking for the decimal point and the
// start of the exponent.
while (point < end)
{
@@ -443,7 +443,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
// Break when we reach the start of the exponent.
else if (c == 'e' || c == 'E')
break;
- // Throw an exception if the character was not a decimal or an
+ // Throw an exception if the character was not a decimal or an
// exponent and is not a digit.
else if (!Character.isDigit(c))
throw new NumberFormatException("unrecognized character at " + point
@@ -456,7 +456,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
CPStringBuilder val = new CPStringBuilder(point - start - 1);
if (dot != -1)
{
- // If there was a decimal we must combine the two parts that
+ // If there was a decimal we must combine the two parts that
// contain only digits and we must set the scale properly.
val.append(in, start, dot - start);
val.append(in, dot + 1, point - dot - 1);
@@ -494,7 +494,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
try
{
- // Adjust the scale according to the exponent.
+ // Adjust the scale according to the exponent.
// Remember that the value of a BigDecimal is
// unscaledValue x Math.pow(10, -scale)
scale -= Integer.parseInt(new String(in, point, end - point));
@@ -505,8 +505,8 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
}
}
}
-
- public BigDecimal (String num) throws NumberFormatException
+
+ public BigDecimal (String num) throws NumberFormatException
{
int len = num.length();
int start = 0, point = 0;
@@ -514,42 +514,42 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
boolean negative = false;
if (num.charAt(0) == '+')
{
- ++start;
- ++point;
+ ++start;
+ ++point;
}
else if (num.charAt(0) == '-')
{
- ++start;
- ++point;
- negative = true;
+ ++start;
+ ++point;
+ negative = true;
}
while (point < len)
{
- char c = num.charAt (point);
- if (c == '.')
- {
- if (dot >= 0)
- throw new NumberFormatException ("multiple `.'s in number");
- dot = point;
- }
- else if (c == 'e' || c == 'E')
- break;
- else if (Character.digit (c, 10) < 0)
- throw new NumberFormatException ("unrecognized character: " + c);
- ++point;
+ char c = num.charAt (point);
+ if (c == '.')
+ {
+ if (dot >= 0)
+ throw new NumberFormatException ("multiple `.'s in number");
+ dot = point;
+ }
+ else if (c == 'e' || c == 'E')
+ break;
+ else if (Character.digit (c, 10) < 0)
+ throw new NumberFormatException ("unrecognized character: " + c);
+ ++point;
}
String val;
if (dot >= 0)
{
- val = num.substring (start, dot) + num.substring (dot + 1, point);
- scale = point - 1 - dot;
+ val = num.substring (start, dot) + num.substring (dot + 1, point);
+ scale = point - 1 - dot;
}
else
{
- val = num.substring (start, point);
- scale = 0;
+ val = num.substring (start, point);
+ scale = 0;
}
if (val.length () == 0)
throw new NumberFormatException ("no digits seen");
@@ -567,39 +567,39 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
if (point >= len )
throw new NumberFormatException ("no exponent following e or E");
-
- try
- {
+
+ try
+ {
scale -= Integer.parseInt (num.substring (point));
- }
- catch (NumberFormatException ex)
- {
- throw new NumberFormatException ("malformed exponent");
- }
+ }
+ catch (NumberFormatException ex)
+ {
+ throw new NumberFormatException ("malformed exponent");
+ }
}
}
- public static BigDecimal valueOf (long val)
+ public static BigDecimal valueOf (long val)
{
return valueOf (val, 0);
}
- public static BigDecimal valueOf (long val, int scale)
- throws NumberFormatException
+ public static BigDecimal valueOf (long val, int scale)
+ throws NumberFormatException
{
if ((scale == 0) && ((int)val == val))
switch ((int) val)
- {
- case 0:
- return ZERO;
- case 1:
- return ONE;
- }
+ {
+ case 0:
+ return ZERO;
+ case 1:
+ return ONE;
+ }
return new BigDecimal (BigInteger.valueOf (val), scale);
}
- public BigDecimal add (BigDecimal val)
+ public BigDecimal add (BigDecimal val)
{
// For addition, need to line up decimals. Note that the movePointRight
// method cannot be used for this as it might return a BigDecimal with
@@ -613,9 +613,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
return new BigDecimal (op1.add (op2), Math.max (scale, val.scale));
}
-
+
/**
- * Returns a BigDecimal whose value is found first by calling the
+ * Returns a BigDecimal whose value is found first by calling the
* method add(val) and then by rounding according to the MathContext mc.
* @param val the augend
* @param mc the MathContext for rounding
@@ -629,13 +629,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
return add(val).round(mc);
}
- public BigDecimal subtract (BigDecimal val)
+ public BigDecimal subtract (BigDecimal val)
{
return this.add(val.negate());
}
/**
- * Returns a BigDecimal whose value is found first by calling the
+ * Returns a BigDecimal whose value is found first by calling the
* method subtract(val) and then by rounding according to the MathContext mc.
* @param val the subtrahend
* @param mc the MathContext for rounding
@@ -649,14 +649,14 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
return subtract(val).round(mc);
}
- public BigDecimal multiply (BigDecimal val)
+ public BigDecimal multiply (BigDecimal val)
{
return new BigDecimal (intVal.multiply (val.intVal), scale + val.scale);
}
-
+
/**
* Returns a BigDecimal whose value is (this x val) before it is rounded
- * according to the MathContext mc.
+ * according to the MathContext mc.
* @param val the multiplicand
* @param mc the MathContext for rounding
* @return a new BigDecimal with value approximately (this x val)
@@ -669,15 +669,15 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
return multiply(val).round(mc);
}
- public BigDecimal divide (BigDecimal val, int roundingMode)
- throws ArithmeticException, IllegalArgumentException
+ public BigDecimal divide (BigDecimal val, int roundingMode)
+ throws ArithmeticException, IllegalArgumentException
{
return divide (val, scale, roundingMode);
}
-
+
/**
* Returns a BigDecimal whose value is (this / val), with the specified scale
- * and rounding according to the RoundingMode
+ * and rounding according to the RoundingMode
* @param val the divisor
* @param scale the scale of the BigDecimal returned
* @param roundingMode the rounding mode to use
@@ -686,7 +686,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
* UNNECESSARY but the specified scale cannot represent the value exactly
* @since 1.5
*/
- public BigDecimal divide(BigDecimal val,
+ public BigDecimal divide(BigDecimal val,
int scale, RoundingMode roundingMode)
{
return divide (val, scale, roundingMode.ordinal());
@@ -705,30 +705,30 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
return divide (val, scale, roundingMode.ordinal());
}
-
+
public BigDecimal divide(BigDecimal val, int newScale, int roundingMode)
- throws ArithmeticException, IllegalArgumentException
+ throws ArithmeticException, IllegalArgumentException
{
if (roundingMode < 0 || roundingMode > 7)
- throw
- new IllegalArgumentException("illegal rounding mode: " + roundingMode);
+ throw
+ new IllegalArgumentException("illegal rounding mode: " + roundingMode);
- if (intVal.signum () == 0) // handle special case of 0.0/0.0
+ if (intVal.signum () == 0) // handle special case of 0.0/0.0
return newScale == 0 ? ZERO : new BigDecimal (ZERO.intVal, newScale);
-
+
// Ensure that pow gets a non-negative value.
BigInteger valIntVal = val.intVal;
int power = newScale - (scale - val.scale);
if (power < 0)
{
- // Effectively increase the scale of val to avoid an
- // ArithmeticException for a negative power.
+ // Effectively increase the scale of val to avoid an
+ // ArithmeticException for a negative power.
valIntVal = valIntVal.multiply (BigInteger.TEN.pow (-power));
- power = 0;
+ power = 0;
}
BigInteger dividend = intVal.multiply (BigInteger.TEN.pow (power));
-
+
BigInteger parts[] = dividend.divideAndRemainder (valIntVal);
BigInteger unrounded = parts[0];
@@ -746,33 +746,33 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
roundingMode = (sign < 0) ? ROUND_UP : ROUND_DOWN;
else
{
- // half is -1 if remainder*2 < positive intValue (*power), 0 if equal,
- // 1 if >. This implies that the remainder to round is less than,
- // equal to, or greater than half way to the next digit.
- BigInteger posRemainder
- = parts[1].signum () < 0 ? parts[1].negate() : parts[1];
- valIntVal = valIntVal.signum () < 0 ? valIntVal.negate () : valIntVal;
- int half = posRemainder.shiftLeft(1).compareTo(valIntVal);
-
- switch(roundingMode)
- {
- case ROUND_HALF_UP:
- roundingMode = (half < 0) ? ROUND_DOWN : ROUND_UP;
- break;
- case ROUND_HALF_DOWN:
- roundingMode = (half > 0) ? ROUND_UP : ROUND_DOWN;
- break;
- case ROUND_HALF_EVEN:
- if (half < 0)
- roundingMode = ROUND_DOWN;
- else if (half > 0)
- roundingMode = ROUND_UP;
- else if (unrounded.testBit(0)) // odd, then ROUND_HALF_UP
- roundingMode = ROUND_UP;
- else // even, ROUND_HALF_DOWN
- roundingMode = ROUND_DOWN;
- break;
- }
+ // half is -1 if remainder*2 < positive intValue (*power), 0 if equal,
+ // 1 if >. This implies that the remainder to round is less than,
+ // equal to, or greater than half way to the next digit.
+ BigInteger posRemainder
+ = parts[1].signum () < 0 ? parts[1].negate() : parts[1];
+ valIntVal = valIntVal.signum () < 0 ? valIntVal.negate () : valIntVal;
+ int half = posRemainder.shiftLeft(1).compareTo(valIntVal);
+
+ switch(roundingMode)
+ {
+ case ROUND_HALF_UP:
+ roundingMode = (half < 0) ? ROUND_DOWN : ROUND_UP;
+ break;
+ case ROUND_HALF_DOWN:
+ roundingMode = (half > 0) ? ROUND_UP : ROUND_DOWN;
+ break;
+ case ROUND_HALF_EVEN:
+ if (half < 0)
+ roundingMode = ROUND_DOWN;
+ else if (half > 0)
+ roundingMode = ROUND_UP;
+ else if (unrounded.testBit(0)) // odd, then ROUND_HALF_UP
+ roundingMode = ROUND_UP;
+ else // even, ROUND_HALF_DOWN
+ roundingMode = ROUND_DOWN;
+ break;
+ }
}
if (roundingMode == ROUND_UP)
@@ -781,24 +781,24 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
// roundingMode == ROUND_DOWN
return new BigDecimal (unrounded, newScale);
}
-
+
/**
* Performs division, if the resulting quotient requires rounding
- * (has a nonterminating decimal expansion),
- * an ArithmeticException is thrown.
+ * (has a nonterminating decimal expansion),
+ * an ArithmeticException is thrown.
* #see divide(BigDecimal, int, int)
* @since 1.5
*/
public BigDecimal divide(BigDecimal divisor)
- throws ArithmeticException, IllegalArgumentException
+ throws ArithmeticException, IllegalArgumentException
{
return divide(divisor, scale, ROUND_UNNECESSARY);
}
/**
* Returns a BigDecimal whose value is the remainder in the quotient
- * this / val. This is obtained by
- * subtract(divideToIntegralValue(val).multiply(val)).
+ * this / val. This is obtained by
+ * subtract(divideToIntegralValue(val).multiply(val)).
* @param val the divisor
* @return a BigDecimal whose value is the remainder
* @throws ArithmeticException if val == 0
@@ -811,7 +811,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
/**
* Returns a BigDecimal array, the first element of which is the integer part
- * of this / val, and the second element of which is the remainder of
+ * of this / val, and the second element of which is the remainder of
* that quotient.
* @param val the divisor
* @return the above described BigDecimal array
@@ -825,9 +825,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
result[1] = subtract(result[0].multiply(val));
return result;
}
-
+
/**
- * Returns a BigDecimal whose value is the integer part of the quotient
+ * Returns a BigDecimal whose value is the integer part of the quotient
* this / val. The preferred scale is this.scale - val.scale.
* @param val the divisor
* @return a BigDecimal whose value is the integer part of this / val.
@@ -838,12 +838,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
return divide(val, ROUND_DOWN).floor().setScale(scale - val.scale, ROUND_DOWN);
}
-
+
/**
- * Mutates this BigDecimal into one with no fractional part, whose value is
+ * Mutates this BigDecimal into one with no fractional part, whose value is
* equal to the largest integer that is <= to this BigDecimal. Note that
* since this method is private it is okay to mutate this BigDecimal.
- * @return the BigDecimal obtained through the floor operation on this
+ * @return the BigDecimal obtained through the floor operation on this
* BigDecimal.
*/
private BigDecimal floor()
@@ -855,17 +855,17 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
intVal = new BigInteger(intValStr).multiply(BigInteger.TEN.pow(scale));
return this;
}
-
- public int compareTo (BigDecimal val)
+
+ public int compareTo (BigDecimal val)
{
if (scale == val.scale)
return intVal.compareTo (val.intVal);
- BigInteger thisParts[] =
+ BigInteger thisParts[] =
intVal.divideAndRemainder (BigInteger.TEN.pow (scale));
BigInteger valParts[] =
val.intVal.divideAndRemainder (BigInteger.TEN.pow (val.scale));
-
+
int compare;
if ((compare = thisParts[0].compareTo (valParts[0])) != 0)
return compare;
@@ -875,46 +875,46 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
// Add some trailing zeros to the remainder with the smallest scale
if (scale < val.scale)
thisParts[1] = thisParts[1].multiply
- (BigInteger.valueOf (10).pow (val.scale - scale));
+ (BigInteger.valueOf (10).pow (val.scale - scale));
else if (scale > val.scale)
valParts[1] = valParts[1].multiply
- (BigInteger.valueOf (10).pow (scale - val.scale));
+ (BigInteger.valueOf (10).pow (scale - val.scale));
// and compare them
return thisParts[1].compareTo (valParts[1]);
}
- public boolean equals (Object o)
+ public boolean equals (Object o)
{
- return (o instanceof BigDecimal
- && scale == ((BigDecimal) o).scale
- && compareTo ((BigDecimal) o) == 0);
+ return (o instanceof BigDecimal
+ && scale == ((BigDecimal) o).scale
+ && compareTo ((BigDecimal) o) == 0);
}
- public int hashCode()
+ public int hashCode()
{
return intValue() ^ scale;
}
public BigDecimal max (BigDecimal val)
{
- switch (compareTo (val))
+ switch (compareTo (val))
{
case 1:
- return this;
+ return this;
default:
- return val;
+ return val;
}
}
- public BigDecimal min (BigDecimal val)
+ public BigDecimal min (BigDecimal val)
{
- switch (compareTo (val))
+ switch (compareTo (val))
{
case -1:
- return this;
+ return this;
default:
- return val;
+ return val;
}
}
@@ -931,35 +931,35 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
if (scale >= n)
return new BigDecimal (intVal, scale - n);
- return new BigDecimal (intVal.multiply
- (BigInteger.TEN.pow (n - scale)), 0);
+ return new BigDecimal (intVal.multiply
+ (BigInteger.TEN.pow (n - scale)), 0);
}
- public int signum ()
+ public int signum ()
{
return intVal.signum ();
}
- public int scale ()
+ public int scale ()
{
return scale;
}
-
+
public BigInteger unscaledValue()
{
return intVal;
}
- public BigDecimal abs ()
+ public BigDecimal abs ()
{
return new BigDecimal (intVal.abs (), scale);
}
- public BigDecimal negate ()
+ public BigDecimal negate ()
{
return new BigDecimal (intVal.negate (), scale);
}
-
+
/**
* Returns a BigDecimal whose value is found first by negating this via
* the negate() method, then by rounding according to the MathContext mc.
@@ -976,9 +976,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
result = result.round(mc);
return result;
}
-
+
/**
- * Returns this BigDecimal. This is included for symmetry with the
+ * Returns this BigDecimal. This is included for symmetry with the
* method negate().
* @return this
* @since 1.5
@@ -987,9 +987,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
return this;
}
-
+
/**
- * Returns a BigDecimal whose value is found by rounding <code>this</code>
+ * Returns a BigDecimal whose value is found by rounding <code>this</code>
* according to the MathContext. This is the same as round(MathContext).
* @param mc the MathContext for rounding
* @return a BigDecimal whose value is <code>this</code> before being rounded
@@ -1001,7 +1001,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
return round(mc);
}
-
+
/**
* Returns a BigDecimal which is this BigDecimal rounded according to the
* MathContext rounding settings.
@@ -1012,12 +1012,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
int mcPrecision = mc.getPrecision();
int numToChop = precision() - mcPrecision;
- // If mc specifies not to chop any digits or if we've already chopped
+ // If mc specifies not to chop any digits or if we've already chopped
// enough digits (say by using a MathContext in the constructor for this
// BigDecimal) then just return this.
if (mcPrecision == 0 || numToChop <= 0)
return this;
-
+
// Make a new BigDecimal which is the correct power of 10 to chop off
// the required number of digits and then call divide.
BigDecimal div = new BigDecimal(BigInteger.TEN.pow(numToChop));
@@ -1026,38 +1026,38 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
rounded.precision = mcPrecision;
return rounded;
}
-
+
/**
* Returns the precision of this BigDecimal (the number of digits in the
* unscaled value). The precision of a zero value is 1.
- * @return the number of digits in the unscaled value, or 1 if the value
+ * @return the number of digits in the unscaled value, or 1 if the value
* is zero.
*/
public int precision()
{
if (precision == 0)
{
- String s = intVal.toString();
- precision = s.length() - (( s.charAt(0) == '-' ) ? 1 : 0);
+ String s = intVal.toString();
+ precision = s.length() - (( s.charAt(0) == '-' ) ? 1 : 0);
}
return precision;
}
-
+
/**
* Returns the String representation of this BigDecimal, using scientific
* notation if necessary. The following steps are taken to generate
* the result:
- *
+ *
* 1. the BigInteger unscaledValue's toString method is called and if
* <code>scale == 0<code> is returned.
* 2. an <code>int adjExp</code> is created which is equal to the negation
- * of <code>scale</code> plus the number of digits in the unscaled value,
+ * of <code>scale</code> plus the number of digits in the unscaled value,
* minus one.
- * 3. if <code>scale >= 0 && adjExp >= -6</code> then we represent this
- * BigDecimal without scientific notation. A decimal is added if the
+ * 3. if <code>scale >= 0 && adjExp >= -6</code> then we represent this
+ * BigDecimal without scientific notation. A decimal is added if the
* scale is positive and zeros are prepended as necessary.
* 4. if scale is negative or adjExp is less than -6 we use scientific
- * notation. If the unscaled value has more than one digit, a decimal
+ * notation. If the unscaled value has more than one digit, a decimal
* as inserted after the first digit, the character 'E' is appended
* and adjExp is appended.
*/
@@ -1076,7 +1076,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
if (scale >= 0 && (point - 1) >= -6)
{
- // Convert to character form without scientific notation.
+ // Convert to character form without scientific notation.
if (point <= 0)
{
// Zeros need to be prepended to the StringBuilder.
@@ -1094,7 +1094,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
}
else
{
- // No zeros need to be prepended so the String is simply the
+ // No zeros need to be prepended so the String is simply the
// unscaled value with the decimal point inserted.
val.append(bigStr);
val.insert(point + (negative ? 1 : 0), '.');
@@ -1104,7 +1104,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
// We must use scientific notation to represent this BigDecimal.
val.append(bigStr);
- // If there is more than one digit in the unscaled value we put a
+ // If there is more than one digit in the unscaled value we put a
// decimal after the first digit.
if (bigStr.length() > 1)
val.insert( ( negative ? 2 : 1 ), '.');
@@ -1119,10 +1119,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
/**
* Returns the String representation of this BigDecimal, using engineering
- * notation if necessary. This is similar to toString() but when exponents
+ * notation if necessary. This is similar to toString() but when exponents
* are used the exponent is made to be a multiple of 3 such that the integer
* part is between 1 and 999.
- *
+ *
* @return a String representation of this BigDecimal in engineering notation
* @since 1.5
*/
@@ -1161,7 +1161,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
}
else
{
- // No zeros need to be prepended so the String is simply the
+ // No zeros need to be prepended so the String is simply the
// unscaled value with the decimal point inserted.
val.append(bigStr);
val.insert(point + (negative ? 1 : 0), '.');
@@ -1172,7 +1172,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
// We must use scientific notation to represent this BigDecimal.
// The exponent must be a multiple of 3 and the integer part
// must be between 1 and 999.
- val.append(bigStr);
+ val.append(bigStr);
int zeros = adjExp % 3;
int dot = 1;
if (adjExp > 0)
@@ -1185,9 +1185,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
else
{
// If the exponent is negative then we move the dot to the right
- // and decrease the exponent (increase its magnitude) until
+ // and decrease the exponent (increase its magnitude) until
// it is a multiple of 3. Note that this is not adjExp -= zeros
- // because the mod operator doesn't give us the distance to the
+ // because the mod operator doesn't give us the distance to the
// correct multiple of 3. (-5 mod 3) is -2 but the distance from
// -5 to the correct multiple of 3 (-6) is 1, not 2.
if (zeros == -2)
@@ -1211,7 +1211,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
}
else if (bigStr.length() > dot)
val.insert(dot + (negative ? 1 : 0), '.');
-
+
// And then append 'E' and the exponent (adjExp).
val.append('E');
if (adjExp >= 0)
@@ -1220,20 +1220,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
}
return val.toString();
}
-
+
/**
- * Returns a String representation of this BigDecimal without using
+ * Returns a String representation of this BigDecimal without using
* scientific notation. This is how toString() worked for releases 1.4
* and previous. Zeros may be added to the end of the String. For
- * example, an unscaled value of 1234 and a scale of -3 would result in
- * the String 1234000, but the toString() method would return
+ * example, an unscaled value of 1234 and a scale of -3 would result in
+ * the String 1234000, but the toString() method would return
* 1.234E+6.
* @return a String representation of this BigDecimal
* @since 1.5
*/
public String toPlainString()
{
- // If the scale is zero we simply return the String representation of the
+ // If the scale is zero we simply return the String representation of the
// unscaled value.
String bigStr = intVal.toString();
if (scale == 0)
@@ -1245,7 +1245,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
int point = bigStr.length() - scale - (negative ? 1 : 0);
CPStringBuilder sb = new CPStringBuilder(bigStr.length() + 2
- + (point <= 0 ? (-point + 1) : 0));
+ + (point <= 0 ? (-point + 1) : 0));
if (point <= 0)
{
// We have to prepend zeros and a decimal point.
@@ -1275,13 +1275,13 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
}
return sb.toString();
}
-
+
/**
* Converts this BigDecimal to a BigInteger. Any fractional part will
* be discarded.
* @return a BigDecimal whose value is equal to floor[this]
*/
- public BigInteger toBigInteger ()
+ public BigInteger toBigInteger ()
{
// If scale > 0 then we must divide, if scale > 0 then we must multiply,
// and if scale is zero then we just return intVal;
@@ -1291,9 +1291,9 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
return intVal.multiply(BigInteger.TEN.pow(-scale));
return intVal;
}
-
+
/**
- * Converts this BigDecimal into a BigInteger, throwing an
+ * Converts this BigDecimal into a BigInteger, throwing an
* ArithmeticException if the conversion is not exact.
* @return a BigInteger whose value is equal to the value of this BigDecimal
* @since 1.5
@@ -1303,7 +1303,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
if (scale > 0)
{
// If we have to divide, we must check if the result is exact.
- BigInteger[] result =
+ BigInteger[] result =
intVal.divideAndRemainder(BigInteger.TEN.pow(scale));
if (result[1].equals(BigInteger.ZERO))
return result[0];
@@ -1316,20 +1316,20 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
return intVal;
}
- public int intValue ()
+ public int intValue ()
{
return toBigInteger ().intValue ();
}
-
+
/**
- * Returns a BigDecimal which is numerically equal to this BigDecimal but
- * with no trailing zeros in the representation. For example, if this
+ * Returns a BigDecimal which is numerically equal to this BigDecimal but
+ * with no trailing zeros in the representation. For example, if this
* BigDecimal has [unscaledValue, scale] = [6313000, 4] this method returns
- * a BigDecimal with [unscaledValue, scale] = [6313, 1]. As another
+ * a BigDecimal with [unscaledValue, scale] = [6313, 1]. As another
* example, [12400, -2] would become [124, -4].
* @return a numerically equal BigDecimal with no trailing zeros
*/
- public BigDecimal stripTrailingZeros()
+ public BigDecimal stripTrailingZeros()
{
String intValStr = intVal.toString();
int newScale = scale;
@@ -1344,7 +1344,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
}
// Create a new BigDecimal with the appropriate substring and then
// set its scale.
- BigDecimal result = new BigDecimal(intValStr.substring(0, pointer + 1));
+ BigDecimal result = new BigDecimal(intValStr.substring(0, pointer + 1));
result.scale = newScale;
return result;
}
@@ -1354,12 +1354,12 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
return toBigInteger().longValue();
}
- public float floatValue()
+ public float floatValue()
{
return Float.valueOf(toString()).floatValue();
}
- public double doubleValue()
+ public double doubleValue()
{
return Double.valueOf(toString()).doubleValue();
}
@@ -1378,26 +1378,26 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
if( scale < 0 ) throw new ArithmeticException("Scale parameter < 0.");
return divide (ONE, scale, roundingMode);
}
-
+
/**
* Returns a BigDecimal whose value is the same as this BigDecimal but whose
* representation has a scale of <code>newScale</code>. If the scale is
* reduced then rounding may occur, according to the RoundingMode.
* @param newScale
* @param roundingMode
- * @return a BigDecimal whose scale is as given, whose value is
+ * @return a BigDecimal whose scale is as given, whose value is
* <code>this</code> with possible rounding
- * @throws ArithmeticException if the rounding mode is UNNECESSARY but
- * rounding is required
+ * @throws ArithmeticException if the rounding mode is UNNECESSARY but
+ * rounding is required
* @since 1.5
*/
public BigDecimal setScale(int newScale, RoundingMode roundingMode)
{
return setScale(newScale, roundingMode.ordinal());
}
-
+
/**
- * Returns a new BigDecimal constructed from the BigDecimal(String)
+ * Returns a new BigDecimal constructed from the BigDecimal(String)
* constructor using the Double.toString(double) method to obtain
* the String.
* @param val the double value used in Double.toString(double)
@@ -1411,10 +1411,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
throw new NumberFormatException("argument cannot be NaN or infinite.");
return new BigDecimal(Double.toString(val));
}
-
+
/**
* Returns a BigDecimal whose numerical value is the numerical value
- * of this BigDecimal multiplied by 10 to the power of <code>n</code>.
+ * of this BigDecimal multiplied by 10 to the power of <code>n</code>.
* @param n the power of ten
* @return the new BigDecimal
* @since 1.5
@@ -1425,10 +1425,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
result.precision = precision;
return result;
}
-
+
/**
- * Returns a BigDecimal whose value is <code>this</code> to the power of
- * <code>n</code>.
+ * Returns a BigDecimal whose value is <code>this</code> to the power of
+ * <code>n</code>.
* @param n the power
* @return the new BigDecimal
* @since 1.5
@@ -1440,7 +1440,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
BigDecimal result = new BigDecimal(intVal.pow(n), scale * n);
return result;
}
-
+
/**
* Returns a BigDecimal whose value is determined by first calling pow(n)
* and then by rounding according to the MathContext mc.
@@ -1457,7 +1457,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
// currently do not.
return pow(n).round(mc);
}
-
+
/**
* Returns a BigDecimal whose value is the absolute value of this BigDecimal
* with rounding according to the given MathContext.
@@ -1470,7 +1470,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
result = result.round(mc);
return result;
}
-
+
/**
* Returns the size of a unit in the last place of this BigDecimal. This
* returns a BigDecimal with [unscaledValue, scale] = [1, this.scale()].
@@ -1481,7 +1481,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
{
return new BigDecimal(BigInteger.ONE, scale);
}
-
+
/**
* Converts this BigDecimal to a long value.
* @return the long value
@@ -1499,10 +1499,10 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
|| (result < 0 && signum() == 1) || (result > 0 && signum() == -1))
throw new ArithmeticException("this BigDecimal is too " +
"large to fit into the return type");
-
+
return intVal.longValue();
}
-
+
/**
* Converts this BigDecimal into an int by first calling longValueExact
* and then checking that the <code>long</code> returned from that
@@ -1520,7 +1520,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
throw new ArithmeticException ("this BigDecimal cannot fit into an int");
return result;
}
-
+
/**
* Converts this BigDecimal into a byte by first calling longValueExact
* and then checking that the <code>long</code> returned from that
@@ -1538,7 +1538,7 @@ public class BigDecimal extends Number implements Comparable<BigDecimal>
throw new ArithmeticException ("this BigDecimal cannot fit into a byte");
return result;
}
-
+
/**
* Converts this BigDecimal into a short by first calling longValueExact
* and then checking that the <code>long</code> returned from that
diff --git a/java/math/BigInteger.java b/java/math/BigInteger.java
index 9d7abc755..953e557a8 100644
--- a/java/math/BigInteger.java
+++ b/java/math/BigInteger.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,7 +54,7 @@ import java.util.logging.Logger;
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998) and
* "Applied Cryptography, Second Edition" by Bruce Schneier (Wiley, 1996).
- *
+ *
* Based primarily on IntNum.java BitOps.java by Per Bothner (per@bothner.com)
* (found in Kawa 1.6.62).
*
@@ -84,13 +84,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>
private static final long serialVersionUID = -8287574255936472291L;
- /** We pre-allocate integers in the range minFixNum..maxFixNum.
+ /** We pre-allocate integers in the range minFixNum..maxFixNum.
* Note that we must at least preallocate 0, 1, and 10. */
private static final int minFixNum = -100;
private static final int maxFixNum = 1024;
private static final int numFixNum = maxFixNum-minFixNum+1;
private static final BigInteger[] smallFixNums;
-
+
/** The alter-ego GMP instance for this. */
private transient GMP mpz;
@@ -109,8 +109,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>
else
{
smallFixNums = new BigInteger[numFixNum];
- for (int i = numFixNum; --i >= 0; )
- smallFixNums[i] = new BigInteger(i + minFixNum);
+ for (int i = numFixNum; --i >= 0; )
+ smallFixNums[i] = new BigInteger(i + minFixNum);
ZERO = smallFixNums[-minFixNum];
ONE = smallFixNums[1 - minFixNum];
@@ -260,11 +260,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>
if (signum == 0)
{
- int i;
- for (i = magnitude.length - 1; i >= 0 && magnitude[i] == 0; --i)
- ;
- if (i >= 0)
- throw new NumberFormatException();
+ int i;
+ for (i = magnitude.length - 1; i >= 0 && magnitude[i] == 0; --i)
+ ;
+ if (i >= 0)
+ throw new NumberFormatException();
return;
}
@@ -330,20 +330,20 @@ public class BigInteger extends Number implements Comparable<BigInteger>
while (highbits == 0 && nwords > 0)
{
- highbits = rnd.nextInt();
- --nwords;
+ highbits = rnd.nextInt();
+ --nwords;
}
if (nwords == 0 && highbits >= 0)
{
- ival = highbits;
+ ival = highbits;
}
else
{
- ival = highbits < 0 ? nwords + 2 : nwords + 1;
- words = new int[ival];
- words[nwords] = highbits;
- while (--nwords >= 0)
- words[nwords] = rnd.nextInt();
+ ival = highbits < 0 ? nwords + 2 : nwords + 1;
+ words = new int[ival];
+ words[nwords] = highbits;
+ while (--nwords >= 0)
+ words[nwords] = rnd.nextInt();
}
}
@@ -369,7 +369,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>
}
}
- /**
+ /**
* Return a BigInteger that is bitLength bits long with a
* probability < 2^-100 of being composite.
*
@@ -465,9 +465,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>
// Elements remaining in byte[] are a multiple of 4.
while (nwords > 0)
words[--nwords] = bytes[bptr++] << 24 |
- (bytes[bptr++] & 0xff) << 16 |
- (bytes[bptr++] & 0xff) << 8 |
- (bytes[bptr++] & 0xff);
+ (bytes[bptr++] & 0xff) << 16 |
+ (bytes[bptr++] & 0xff) << 8 |
+ (bytes[bptr++] & 0xff);
return words;
}
@@ -489,30 +489,30 @@ public class BigInteger extends Number implements Comparable<BigInteger>
{
if (nwords == 0)
{
- if (words != null)
- {
- if (ival > 0)
- ival = words[0];
- words = null;
- }
+ if (words != null)
+ {
+ if (ival > 0)
+ ival = words[0];
+ words = null;
+ }
}
else if (words == null
- || words.length < nwords
- || words.length > nwords + 2)
+ || words.length < nwords
+ || words.length > nwords + 2)
{
- int[] new_words = new int [nwords];
- if (words == null)
- {
- new_words[0] = ival;
- ival = 1;
- }
- else
- {
- if (nwords < ival)
- ival = nwords;
- System.arraycopy(words, 0, new_words, 0, ival);
- }
- words = new_words;
+ int[] new_words = new int [nwords];
+ if (words == null)
+ {
+ new_words[0] = ival;
+ ival = 1;
+ }
+ else
+ {
+ if (nwords < ival)
+ ival = nwords;
+ System.arraycopy(words, 0, new_words, 0, ival);
+ }
+ words = new_words;
}
}
@@ -588,19 +588,19 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int i = len;
if (i > 0)
{
- int word = words[--i];
- if (word == -1)
- {
- while (i > 0 && (word = words[i - 1]) < 0)
- {
- i--;
- if (word != -1) break;
- }
- }
- else
- {
- while (word == 0 && i > 0 && (word = words[i - 1]) >= 0) i--;
- }
+ int word = words[--i];
+ if (word == -1)
+ {
+ while (i > 0 && (word = words[i - 1]) < 0)
+ {
+ i--;
+ if (word != -1) break;
+ }
+ }
+ else
+ {
+ while (word == 0 && i > 0 && (word = words[i - 1]) >= 0) i--;
+ }
}
return i + 1;
}
@@ -608,11 +608,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>
private BigInteger canonicalize()
{
if (words != null
- && (ival = BigInteger.wordsNeeded(words, ival)) <= 1)
+ && (ival = BigInteger.wordsNeeded(words, ival)) <= 1)
{
- if (ival == 1)
- ival = words[0];
- words = null;
+ if (ival == 1)
+ ival = words[0];
+ words = null;
}
if (words == null && ival >= minFixNum && ival <= maxFixNum)
return smallFixNums[ival - minFixNum];
@@ -641,17 +641,17 @@ public class BigInteger extends Number implements Comparable<BigInteger>
{
if (x.words == null)
{
- set((long) x.ival + (long) y);
- return;
+ set((long) x.ival + (long) y);
+ return;
}
int len = x.ival;
realloc(len + 1);
long carry = y;
for (int i = 0; i < len; i++)
{
- carry += ((long) x.words[i] & 0xffffffffL);
- words[i] = (int) carry;
- carry >>= 32;
+ carry += ((long) x.words[i] & 0xffffffffL);
+ words[i] = (int) carry;
+ carry >>= 32;
}
if (x.words[len - 1] < 0)
carry--;
@@ -671,15 +671,15 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int i = (int) y;
if ((long) i == y)
{
- ival = i;
- words = null;
+ ival = i;
+ words = null;
}
else
{
- realloc(2);
- words[0] = i;
- words[1] = (int) (y >> 32);
- ival = 2;
+ realloc(2);
+ words[0] = i;
+ words[1] = (int) (y >> 32);
+ ival = 2;
}
}
@@ -698,9 +698,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>
set(y.ival);
else if (this != y)
{
- realloc(y.ival);
- System.arraycopy(y.words, 0, words, 0, y.ival);
- ival = y.ival;
+ realloc(y.ival);
+ System.arraycopy(y.words, 0, words, 0, y.ival);
+ ival = y.ival;
}
}
@@ -711,10 +711,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>
return valueOf((long) k * (long) y.ival + (long) x.ival);
if (k != 1)
{
- if (k == -1)
- y = BigInteger.neg(y);
- else
- y = BigInteger.times(y, valueOf(k));
+ if (k == -1)
+ y = BigInteger.neg(y);
+ else
+ y = BigInteger.times(y, valueOf(k));
}
if (x.words == null)
return BigInteger.add(y, x.ival);
@@ -723,7 +723,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>
// Both are big
if (y.ival > x.ival)
{ // Swap so x is longer then y.
- BigInteger tmp = x; x = y; y = tmp;
+ BigInteger tmp = x; x = y; y = tmp;
}
BigInteger result = alloc(x.ival + 1);
int i = y.ival;
@@ -731,9 +731,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>
long y_ext = y.words[i - 1] < 0 ? 0xffffffffL : 0;
for (; i < x.ival; i++)
{
- carry += ((long) x.words[i] & 0xffffffffL) + y_ext;
- result.words[i] = (int) carry;
- carry >>>= 32;
+ carry += ((long) x.words[i] & 0xffffffffL) + y_ext;
+ result.words[i] = (int) carry;
+ carry >>>= 32;
}
if (x.words[i - 1] < 0)
y_ext--;
@@ -782,16 +782,16 @@ public class BigInteger extends Number implements Comparable<BigInteger>
BigInteger result = BigInteger.alloc(xlen + 1);
if (xwords[xlen - 1] < 0)
{
- negative = true;
- negate(result.words, xwords, xlen);
- xwords = result.words;
+ negative = true;
+ negate(result.words, xwords, xlen);
+ xwords = result.words;
}
else
negative = false;
if (y < 0)
{
- negative = !negative;
- y = -y;
+ negative = !negative;
+ y = -y;
}
result.words[xlen] = MPN.mul_1(result.words, xwords, xlen, y);
result.ival = xlen + 1;
@@ -813,28 +813,28 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int ylen = y.ival;
if (x.isNegative())
{
- negative = true;
- xwords = new int[xlen];
- negate(xwords, x.words, xlen);
+ negative = true;
+ xwords = new int[xlen];
+ negate(xwords, x.words, xlen);
}
else
{
- negative = false;
- xwords = x.words;
+ negative = false;
+ xwords = x.words;
}
if (y.isNegative())
{
- negative = !negative;
- ywords = new int[ylen];
- negate(ywords, y.words, ylen);
+ negative = !negative;
+ ywords = new int[ylen];
+ negate(ywords, y.words, ylen);
}
else
ywords = y.words;
// Swap if x is shorter then y.
if (xlen < ylen)
{
- int[] twords = xwords; xwords = ywords; ywords = twords;
- int tlen = xlen; xlen = ylen; ylen = tlen;
+ int[] twords = xwords; xwords = ywords; ywords = twords;
+ int tlen = xlen; xlen = ylen; ylen = tlen;
}
BigInteger result = BigInteger.alloc(xlen+ylen);
MPN.mul(result.words, xwords, xlen, ywords, ylen);
@@ -858,42 +858,42 @@ public class BigInteger extends Number implements Comparable<BigInteger>
}
private static void divide(long x, long y,
- BigInteger quotient, BigInteger remainder,
- int rounding_mode)
+ BigInteger quotient, BigInteger remainder,
+ int rounding_mode)
{
boolean xNegative, yNegative;
if (x < 0)
{
- xNegative = true;
- if (x == Long.MIN_VALUE)
- {
- divide(valueOf(x), valueOf(y),
- quotient, remainder, rounding_mode);
- return;
- }
- x = -x;
+ xNegative = true;
+ if (x == Long.MIN_VALUE)
+ {
+ divide(valueOf(x), valueOf(y),
+ quotient, remainder, rounding_mode);
+ return;
+ }
+ x = -x;
}
else
xNegative = false;
if (y < 0)
{
- yNegative = true;
- if (y == Long.MIN_VALUE)
- {
- if (rounding_mode == TRUNCATE)
- { // x != Long.Min_VALUE implies abs(x) < abs(y)
- if (quotient != null)
- quotient.set(0);
- if (remainder != null)
- remainder.set(x);
- }
- else
- divide(valueOf(x), valueOf(y),
- quotient, remainder, rounding_mode);
- return;
- }
- y = -y;
+ yNegative = true;
+ if (y == Long.MIN_VALUE)
+ {
+ if (rounding_mode == TRUNCATE)
+ { // x != Long.Min_VALUE implies abs(x) < abs(y)
+ if (quotient != null)
+ quotient.set(0);
+ if (remainder != null)
+ remainder.set(x);
+ }
+ else
+ divide(valueOf(x), valueOf(y),
+ quotient, remainder, rounding_mode);
+ return;
+ }
+ y = -y;
}
else
yNegative = false;
@@ -905,47 +905,47 @@ public class BigInteger extends Number implements Comparable<BigInteger>
boolean add_one = false;
if (r != 0)
{
- switch (rounding_mode)
- {
- case TRUNCATE:
- break;
- case CEILING:
- case FLOOR:
- if (qNegative == (rounding_mode == FLOOR))
- add_one = true;
- break;
- case ROUND:
- add_one = r > ((y - (q & 1)) >> 1);
- break;
- }
+ switch (rounding_mode)
+ {
+ case TRUNCATE:
+ break;
+ case CEILING:
+ case FLOOR:
+ if (qNegative == (rounding_mode == FLOOR))
+ add_one = true;
+ break;
+ case ROUND:
+ add_one = r > ((y - (q & 1)) >> 1);
+ break;
+ }
}
if (quotient != null)
{
- if (add_one)
- q++;
- if (qNegative)
- q = -q;
- quotient.set(q);
+ if (add_one)
+ q++;
+ if (qNegative)
+ q = -q;
+ quotient.set(q);
}
if (remainder != null)
{
- // The remainder is by definition: X-Q*Y
- if (add_one)
- {
- // Subtract the remainder from Y.
- r = y - r;
- // In this case, abs(Q*Y) > abs(X).
- // So sign(remainder) = -sign(X).
- xNegative = ! xNegative;
- }
- else
- {
- // If !add_one, then: abs(Q*Y) <= abs(X).
- // So sign(remainder) = sign(X).
- }
- if (xNegative)
- r = -r;
- remainder.set(r);
+ // The remainder is by definition: X-Q*Y
+ if (add_one)
+ {
+ // Subtract the remainder from Y.
+ r = y - r;
+ // In this case, abs(Q*Y) > abs(X).
+ // So sign(remainder) = -sign(X).
+ xNegative = ! xNegative;
+ }
+ else
+ {
+ // If !add_one, then: abs(Q*Y) <= abs(X).
+ // So sign(remainder) = sign(X).
+ }
+ if (xNegative)
+ r = -r;
+ remainder.set(r);
}
}
@@ -958,19 +958,19 @@ public class BigInteger extends Number implements Comparable<BigInteger>
* @param rounding_mode one of FLOOR, CEILING, TRUNCATE, or ROUND.
*/
private static void divide(BigInteger x, BigInteger y,
- BigInteger quotient, BigInteger remainder,
- int rounding_mode)
+ BigInteger quotient, BigInteger remainder,
+ int rounding_mode)
{
if ((x.words == null || x.ival <= 2)
- && (y.words == null || y.ival <= 2))
+ && (y.words == null || y.ival <= 2))
{
- long x_l = x.longValue();
- long y_l = y.longValue();
- if (x_l != Long.MIN_VALUE && y_l != Long.MIN_VALUE)
- {
- divide(x_l, y_l, quotient, remainder, rounding_mode);
- return;
- }
+ long x_l = x.longValue();
+ long y_l = y.longValue();
+ if (x_l != Long.MIN_VALUE && y_l != Long.MIN_VALUE)
+ {
+ divide(x_l, y_l, quotient, remainder, rounding_mode);
+ return;
+ }
}
boolean xNegative = x.isNegative();
@@ -992,57 +992,57 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int cmpval = MPN.cmp(xwords, xlen, ywords, ylen);
if (cmpval < 0) // abs(x) < abs(y)
{ // quotient = 0; remainder = num.
- int[] rwords = xwords; xwords = ywords; ywords = rwords;
- rlen = xlen; qlen = 1; xwords[0] = 0;
+ int[] rwords = xwords; xwords = ywords; ywords = rwords;
+ rlen = xlen; qlen = 1; xwords[0] = 0;
}
else if (cmpval == 0) // abs(x) == abs(y)
{
- xwords[0] = 1; qlen = 1; // quotient = 1
- ywords[0] = 0; rlen = 1; // remainder = 0;
+ xwords[0] = 1; qlen = 1; // quotient = 1
+ ywords[0] = 0; rlen = 1; // remainder = 0;
}
else if (ylen == 1)
{
- qlen = xlen;
- // Need to leave room for a word of leading zeros if dividing by 1
- // and the dividend has the high bit set. It might be safe to
- // increment qlen in all cases, but it certainly is only necessary
- // in the following case.
- if (ywords[0] == 1 && xwords[xlen-1] < 0)
- qlen++;
- rlen = 1;
- ywords[0] = MPN.divmod_1(xwords, xwords, xlen, ywords[0]);
+ qlen = xlen;
+ // Need to leave room for a word of leading zeros if dividing by 1
+ // and the dividend has the high bit set. It might be safe to
+ // increment qlen in all cases, but it certainly is only necessary
+ // in the following case.
+ if (ywords[0] == 1 && xwords[xlen-1] < 0)
+ qlen++;
+ rlen = 1;
+ ywords[0] = MPN.divmod_1(xwords, xwords, xlen, ywords[0]);
}
else // abs(x) > abs(y)
{
- // Normalize the denominator, i.e. make its most significant bit set by
- // shifting it normalization_steps bits to the left. Also shift the
- // numerator the same number of steps (to keep the quotient the same!).
-
- int nshift = MPN.count_leading_zeros(ywords[ylen - 1]);
- if (nshift != 0)
- {
- // Shift up the denominator setting the most significant bit of
- // the most significant word.
- MPN.lshift(ywords, 0, ywords, ylen, nshift);
-
- // Shift up the numerator, possibly introducing a new most
- // significant word.
- int x_high = MPN.lshift(xwords, 0, xwords, xlen, nshift);
- xwords[xlen++] = x_high;
- }
-
- if (xlen == ylen)
- xwords[xlen++] = 0;
- MPN.divide(xwords, xlen, ywords, ylen);
- rlen = ylen;
- MPN.rshift0 (ywords, xwords, 0, rlen, nshift);
-
- qlen = xlen + 1 - ylen;
- if (quotient != null)
- {
- for (int i = 0; i < qlen; i++)
- xwords[i] = xwords[i+ylen];
- }
+ // Normalize the denominator, i.e. make its most significant bit set by
+ // shifting it normalization_steps bits to the left. Also shift the
+ // numerator the same number of steps (to keep the quotient the same!).
+
+ int nshift = MPN.count_leading_zeros(ywords[ylen - 1]);
+ if (nshift != 0)
+ {
+ // Shift up the denominator setting the most significant bit of
+ // the most significant word.
+ MPN.lshift(ywords, 0, ywords, ylen, nshift);
+
+ // Shift up the numerator, possibly introducing a new most
+ // significant word.
+ int x_high = MPN.lshift(xwords, 0, xwords, xlen, nshift);
+ xwords[xlen++] = x_high;
+ }
+
+ if (xlen == ylen)
+ xwords[xlen++] = 0;
+ MPN.divide(xwords, xlen, ywords, ylen);
+ rlen = ylen;
+ MPN.rshift0 (ywords, xwords, 0, rlen, nshift);
+
+ qlen = xlen + 1 - ylen;
+ if (quotient != null)
+ {
+ for (int i = 0; i < qlen; i++)
+ xwords[i] = xwords[i+ylen];
+ }
}
if (ywords[rlen-1] < 0)
@@ -1056,74 +1056,74 @@ public class BigInteger extends Number implements Comparable<BigInteger>
boolean add_one = false;
if (rlen > 1 || ywords[0] != 0)
{ // Non-zero remainder i.e. in-exact quotient.
- switch (rounding_mode)
- {
- case TRUNCATE:
- break;
- case CEILING:
- case FLOOR:
- if (qNegative == (rounding_mode == FLOOR))
- add_one = true;
- break;
- case ROUND:
- // int cmp = compareTo(remainder<<1, abs(y));
- BigInteger tmp = remainder == null ? new BigInteger() : remainder;
- tmp.set(ywords, rlen);
- tmp = shift(tmp, 1);
- if (yNegative)
- tmp.setNegative();
- int cmp = compareTo(tmp, y);
- // Now cmp == compareTo(sign(y)*(remainder<<1), y)
- if (yNegative)
- cmp = -cmp;
- add_one = (cmp == 1) || (cmp == 0 && (xwords[0]&1) != 0);
- }
+ switch (rounding_mode)
+ {
+ case TRUNCATE:
+ break;
+ case CEILING:
+ case FLOOR:
+ if (qNegative == (rounding_mode == FLOOR))
+ add_one = true;
+ break;
+ case ROUND:
+ // int cmp = compareTo(remainder<<1, abs(y));
+ BigInteger tmp = remainder == null ? new BigInteger() : remainder;
+ tmp.set(ywords, rlen);
+ tmp = shift(tmp, 1);
+ if (yNegative)
+ tmp.setNegative();
+ int cmp = compareTo(tmp, y);
+ // Now cmp == compareTo(sign(y)*(remainder<<1), y)
+ if (yNegative)
+ cmp = -cmp;
+ add_one = (cmp == 1) || (cmp == 0 && (xwords[0]&1) != 0);
+ }
}
if (quotient != null)
{
- quotient.set(xwords, qlen);
- if (qNegative)
- {
- if (add_one) // -(quotient + 1) == ~(quotient)
- quotient.setInvert();
- else
- quotient.setNegative();
- }
- else if (add_one)
- quotient.setAdd(1);
+ quotient.set(xwords, qlen);
+ if (qNegative)
+ {
+ if (add_one) // -(quotient + 1) == ~(quotient)
+ quotient.setInvert();
+ else
+ quotient.setNegative();
+ }
+ else if (add_one)
+ quotient.setAdd(1);
}
if (remainder != null)
{
- // The remainder is by definition: X-Q*Y
- remainder.set(ywords, rlen);
- if (add_one)
- {
- // Subtract the remainder from Y:
- // abs(R) = abs(Y) - abs(orig_rem) = -(abs(orig_rem) - abs(Y)).
- BigInteger tmp;
- if (y.words == null)
- {
- tmp = remainder;
- tmp.set(yNegative ? ywords[0] + y.ival : ywords[0] - y.ival);
- }
- else
- tmp = BigInteger.add(remainder, y, yNegative ? 1 : -1);
- // Now tmp <= 0.
- // In this case, abs(Q) = 1 + floor(abs(X)/abs(Y)).
- // Hence, abs(Q*Y) > abs(X).
- // So sign(remainder) = -sign(X).
- if (xNegative)
- remainder.setNegative(tmp);
- else
- remainder.set(tmp);
- }
- else
- {
- // If !add_one, then: abs(Q*Y) <= abs(X).
- // So sign(remainder) = sign(X).
- if (xNegative)
- remainder.setNegative();
- }
+ // The remainder is by definition: X-Q*Y
+ remainder.set(ywords, rlen);
+ if (add_one)
+ {
+ // Subtract the remainder from Y:
+ // abs(R) = abs(Y) - abs(orig_rem) = -(abs(orig_rem) - abs(Y)).
+ BigInteger tmp;
+ if (y.words == null)
+ {
+ tmp = remainder;
+ tmp.set(yNegative ? ywords[0] + y.ival : ywords[0] - y.ival);
+ }
+ else
+ tmp = BigInteger.add(remainder, y, yNegative ? 1 : -1);
+ // Now tmp <= 0.
+ // In this case, abs(Q) = 1 + floor(abs(X)/abs(Y)).
+ // Hence, abs(Q*Y) > abs(X).
+ // So sign(remainder) = -sign(X).
+ if (xNegative)
+ remainder.setNegative(tmp);
+ else
+ remainder.set(tmp);
+ }
+ else
+ {
+ // If !add_one, then: abs(Q*Y) <= abs(X).
+ // So sign(remainder) = sign(X).
+ if (xNegative)
+ remainder.setNegative();
+ }
}
}
@@ -1220,9 +1220,9 @@ public class BigInteger extends Number implements Comparable<BigInteger>
{
if (exponent <= 0)
{
- if (exponent == 0)
- return ONE;
- throw new ArithmeticException("negative exponent");
+ if (exponent == 0)
+ return ONE;
+ throw new ArithmeticException("negative exponent");
}
if (USING_NATIVE)
@@ -1240,28 +1240,28 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int[] pow2 = new int [blen];
int[] rwords = new int [blen];
int[] work = new int [blen];
- getAbsolute(pow2); // pow2 = abs(this);
+ getAbsolute(pow2); // pow2 = abs(this);
int rlen = 1;
rwords[0] = 1; // rwords = 1;
for (;;) // for (i = 0; ; i++)
{
- // pow2 == this**(2**i)
- // prod = this**(sum(j=0..i-1, (exponent>>j)&1))
- if ((exponent & 1) != 0)
- { // r *= pow2
- MPN.mul(work, pow2, plen, rwords, rlen);
- int[] temp = work; work = rwords; rwords = temp;
- rlen += plen;
- while (rwords[rlen - 1] == 0) rlen--;
- }
- exponent >>= 1;
- if (exponent == 0)
- break;
- // pow2 *= pow2;
- MPN.mul(work, pow2, plen, pow2, plen);
- int[] temp = work; work = pow2; pow2 = temp; // swap to avoid a copy
- plen *= 2;
- while (pow2[plen - 1] == 0) plen--;
+ // pow2 == this**(2**i)
+ // prod = this**(sum(j=0..i-1, (exponent>>j)&1))
+ if ((exponent & 1) != 0)
+ { // r *= pow2
+ MPN.mul(work, pow2, plen, rwords, rlen);
+ int[] temp = work; work = rwords; rwords = temp;
+ rlen += plen;
+ while (rwords[rlen - 1] == 0) rlen--;
+ }
+ exponent >>= 1;
+ if (exponent == 0)
+ break;
+ // pow2 *= pow2;
+ MPN.mul(work, pow2, plen, pow2, plen);
+ int[] temp = work; work = pow2; pow2 = temp; // swap to avoid a copy
+ plen *= 2;
+ while (pow2[plen - 1] == 0) plen--;
}
if (rwords[rlen - 1] < 0)
rlen++;
@@ -1276,11 +1276,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>
throw new ArithmeticException("not invertible");
if (b == 1)
- // Success: values are indeed invertible!
- // Bottom of the recursion reached; start unwinding.
- return new int[] { -prevDiv, 1 };
+ // Success: values are indeed invertible!
+ // Bottom of the recursion reached; start unwinding.
+ return new int[] { -prevDiv, 1 };
- int[] xy = euclidInv(b, a % b, a / b); // Recursion happens here.
+ int[] xy = euclidInv(b, a % b, a / b); // Recursion happens here.
a = xy[0]; // use our local copy of 'a' as a work var
xy[0] = a * -prevDiv + xy[1];
xy[1] = a;
@@ -1295,11 +1295,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>
if (b.isOne())
{
- // Success: values are indeed invertible!
- // Bottom of the recursion reached; start unwinding.
- xy[0] = neg(prevDiv);
+ // Success: values are indeed invertible!
+ // Bottom of the recursion reached; start unwinding.
+ xy[0] = neg(prevDiv);
xy[1] = ONE;
- return;
+ return;
}
// Recursion happens in the following conditional!
@@ -1308,18 +1308,18 @@ public class BigInteger extends Number implements Comparable<BigInteger>
if (a.words == null)
{
int[] xyInt = euclidInv(b.ival, a.ival % b.ival, a.ival / b.ival);
- xy[0] = new BigInteger(xyInt[0]);
+ xy[0] = new BigInteger(xyInt[0]);
xy[1] = new BigInteger(xyInt[1]);
}
else
{
- BigInteger rem = new BigInteger();
- BigInteger quot = new BigInteger();
- divide(a, b, quot, rem, FLOOR);
+ BigInteger rem = new BigInteger();
+ BigInteger quot = new BigInteger();
+ divide(a, b, quot, rem, FLOOR);
// quot and rem may not be in canonical form. ensure
rem.canonicalize();
quot.canonicalize();
- euclidInv(b, rem, quot, xy);
+ euclidInv(b, rem, quot, xy);
}
BigInteger t = xy[0];
@@ -1358,61 +1358,61 @@ public class BigInteger extends Number implements Comparable<BigInteger>
if (y.words == null)
{
- // The result is guaranteed to be less than the modulus, y (which is
- // an int), so simplify this by working with the int result of this
- // modulo y. Also, if this is negative, make it positive via modulo
- // math. Note that BigInteger.mod() must be used even if this is
- // already an int as the % operator would provide a negative result if
- // this is negative, BigInteger.mod() never returns negative values.
+ // The result is guaranteed to be less than the modulus, y (which is
+ // an int), so simplify this by working with the int result of this
+ // modulo y. Also, if this is negative, make it positive via modulo
+ // math. Note that BigInteger.mod() must be used even if this is
+ // already an int as the % operator would provide a negative result if
+ // this is negative, BigInteger.mod() never returns negative values.
int xval = (words != null || isNegative()) ? mod(y).ival : ival;
int yval = y.ival;
- // Swap values so x > y.
- if (yval > xval)
- {
- int tmp = xval; xval = yval; yval = tmp;
- swapped = true;
- }
- // Normally, the result is in the 2nd element of the array, but
- // if originally x < y, then x and y were swapped and the result
- // is in the 1st element of the array.
- result.ival =
- euclidInv(yval, xval % yval, xval / yval)[swapped ? 0 : 1];
-
- // Result can't be negative, so make it positive by adding the
- // original modulus, y.ival (not the possibly "swapped" yval).
- if (result.ival < 0)
- result.ival += y.ival;
+ // Swap values so x > y.
+ if (yval > xval)
+ {
+ int tmp = xval; xval = yval; yval = tmp;
+ swapped = true;
+ }
+ // Normally, the result is in the 2nd element of the array, but
+ // if originally x < y, then x and y were swapped and the result
+ // is in the 1st element of the array.
+ result.ival =
+ euclidInv(yval, xval % yval, xval / yval)[swapped ? 0 : 1];
+
+ // Result can't be negative, so make it positive by adding the
+ // original modulus, y.ival (not the possibly "swapped" yval).
+ if (result.ival < 0)
+ result.ival += y.ival;
}
else
{
- // As above, force this to be a positive value via modulo math.
- BigInteger x = isNegative() ? this.mod(y) : this;
-
- // Swap values so x > y.
- if (x.compareTo(y) < 0)
- {
- result = x; x = y; y = result; // use 'result' as a work var
- swapped = true;
- }
- // As above (for ints), result will be in the 2nd element unless
- // the original x and y were swapped.
- BigInteger rem = new BigInteger();
- BigInteger quot = new BigInteger();
- divide(x, y, quot, rem, FLOOR);
+ // As above, force this to be a positive value via modulo math.
+ BigInteger x = isNegative() ? this.mod(y) : this;
+
+ // Swap values so x > y.
+ if (x.compareTo(y) < 0)
+ {
+ result = x; x = y; y = result; // use 'result' as a work var
+ swapped = true;
+ }
+ // As above (for ints), result will be in the 2nd element unless
+ // the original x and y were swapped.
+ BigInteger rem = new BigInteger();
+ BigInteger quot = new BigInteger();
+ divide(x, y, quot, rem, FLOOR);
// quot and rem may not be in canonical form. ensure
rem.canonicalize();
quot.canonicalize();
- BigInteger[] xy = new BigInteger[2];
- euclidInv(y, rem, quot, xy);
- result = swapped ? xy[0] : xy[1];
+ BigInteger[] xy = new BigInteger[2];
+ euclidInv(y, rem, quot, xy);
+ result = swapped ? xy[0] : xy[1];
- // Result can't be negative, so make it positive by adding the
- // original modulus, y (which is now x if they were swapped).
- if (result.isNegative())
- result = add(result, swapped ? x : y, 1);
+ // Result can't be negative, so make it positive by adding the
+ // original modulus, y (which is now x if they were swapped).
+ if (result.isNegative())
+ result = add(result, swapped ? x : y, 1);
}
-
+
return result;
}
@@ -1450,10 +1450,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>
while (!u.isZero())
{
- if (u.and(ONE).isOne())
- s = times(s, t).mod(m);
- u = u.shiftRight(1);
- t = times(t, t).mod(m);
+ if (u.and(ONE).isOne())
+ s = times(s, t).mod(m);
+ u = u.shiftRight(1);
+ t = times(t, t).mod(m);
}
return s;
@@ -1466,18 +1466,18 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int tmp;
if (b > a)
{
- tmp = a; a = b; b = tmp;
+ tmp = a; a = b; b = tmp;
}
for(;;)
{
- if (b == 0)
- return a;
+ if (b == 0)
+ return a;
if (b == 1)
- return b;
+ return b;
tmp = b;
- b = a % b;
- a = tmp;
- }
+ b = a % b;
+ a = tmp;
+ }
}
public BigInteger gcd(BigInteger y)
@@ -1494,24 +1494,24 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int yval = y.ival;
if (words == null)
{
- if (xval == 0)
- return abs(y);
- if (y.words == null
- && xval != Integer.MIN_VALUE && yval != Integer.MIN_VALUE)
- {
- if (xval < 0)
- xval = -xval;
- if (yval < 0)
- yval = -yval;
- return valueOf(gcd(xval, yval));
- }
- xval = 1;
+ if (xval == 0)
+ return abs(y);
+ if (y.words == null
+ && xval != Integer.MIN_VALUE && yval != Integer.MIN_VALUE)
+ {
+ if (xval < 0)
+ xval = -xval;
+ if (yval < 0)
+ yval = -yval;
+ return valueOf(gcd(xval, yval));
+ }
+ xval = 1;
}
if (y.words == null)
{
- if (yval == 0)
- return abs(this);
- yval = 1;
+ if (yval == 0)
+ return abs(this);
+ yval = 1;
}
int len = (xval > yval ? xval : yval) + 1;
int[] xwords = new int[len];
@@ -1562,12 +1562,12 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int i;
for (i = 0; i < primes.length; i++)
{
- if (words == null && ival == primes[i])
- return true;
+ if (words == null && ival == primes[i])
+ return true;
divide(this, smallFixNums[primes[i] - minFixNum], null, rem, TRUNCATE);
if (rem.canonicalize().isZero())
- return false;
+ return false;
}
// Now perform the Rabin-Miller test.
@@ -1599,23 +1599,23 @@ public class BigInteger extends Number implements Comparable<BigInteger>
// Remark 4.28 states: "...A strategy that is sometimes employed
// is to fix the bases a to be the first few primes instead of
// choosing them at random.
- z = smallFixNums[primes[t] - minFixNum].modPow(m, this);
- if (z.isOne() || z.equals(pMinus1))
- continue; // Passes the test; may be prime.
+ z = smallFixNums[primes[t] - minFixNum].modPow(m, this);
+ if (z.isOne() || z.equals(pMinus1))
+ continue; // Passes the test; may be prime.
- for (i = 0; i < b; )
- {
- if (z.isOne())
- return false;
- i++;
- if (z.equals(pMinus1))
- break; // Passes the test; may be prime.
+ for (i = 0; i < b; )
+ {
+ if (z.isOne())
+ return false;
+ i++;
+ if (z.equals(pMinus1))
+ break; // Passes the test; may be prime.
- z = z.modPow(valueOf(2), this);
- }
+ z = z.modPow(valueOf(2), this);
+ }
- if (i == b && !z.equals(pMinus1))
- return false;
+ if (i == b && !z.equals(pMinus1))
+ return false;
}
return true;
}
@@ -1626,8 +1626,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>
ival = ~ival;
else
{
- for (int i = ival; --i >= 0; )
- words[i] = ~words[i];
+ for (int i = ival; --i >= 0; )
+ words[i] = ~words[i];
}
}
@@ -1637,36 +1637,36 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int xlen;
if (x.words == null)
{
- if (count < 32)
- {
- set((long) x.ival << count);
- return;
- }
- xwords = new int[1];
- xwords[0] = x.ival;
- xlen = 1;
+ if (count < 32)
+ {
+ set((long) x.ival << count);
+ return;
+ }
+ xwords = new int[1];
+ xwords[0] = x.ival;
+ xlen = 1;
}
else
{
- xwords = x.words;
- xlen = x.ival;
+ xwords = x.words;
+ xlen = x.ival;
}
int word_count = count >> 5;
count &= 31;
int new_len = xlen + word_count;
if (count == 0)
{
- realloc(new_len);
- for (int i = xlen; --i >= 0; )
- words[i+word_count] = xwords[i];
+ realloc(new_len);
+ for (int i = xlen; --i >= 0; )
+ words[i+word_count] = xwords[i];
}
else
{
- new_len++;
- realloc(new_len);
- int shift_out = MPN.lshift(words, word_count, xwords, xlen, count);
- count = 32 - count;
- words[new_len-1] = (shift_out << count) >> count; // sign-extend.
+ new_len++;
+ realloc(new_len);
+ int shift_out = MPN.lshift(words, word_count, xwords, xlen, count);
+ count = 32 - count;
+ words[new_len-1] = (shift_out << count) >> count; // sign-extend.
}
ival = new_len;
for (int i = word_count; --i >= 0; )
@@ -1681,21 +1681,21 @@ public class BigInteger extends Number implements Comparable<BigInteger>
set(x);
else
{
- boolean neg = x.isNegative();
- int word_count = count >> 5;
- count &= 31;
- int d_len = x.ival - word_count;
- if (d_len <= 0)
- set(neg ? -1 : 0);
- else
- {
- if (words == null || words.length < d_len)
- realloc(d_len);
- MPN.rshift0 (words, x.words, word_count, d_len, count);
- ival = d_len;
- if (neg)
- words[d_len-1] |= -2 << (31 - count);
- }
+ boolean neg = x.isNegative();
+ int word_count = count >> 5;
+ count &= 31;
+ int d_len = x.ival - word_count;
+ if (d_len <= 0)
+ set(neg ? -1 : 0);
+ else
+ {
+ if (words == null || words.length < d_len)
+ realloc(d_len);
+ MPN.rshift0 (words, x.words, word_count, d_len, count);
+ ival = d_len;
+ if (neg)
+ words[d_len-1] |= -2 << (31 - count);
+ }
}
}
@@ -1711,10 +1711,10 @@ public class BigInteger extends Number implements Comparable<BigInteger>
{
if (x.words == null)
{
- if (count <= 0)
- return valueOf(count > -32 ? x.ival >> (-count) : x.ival < 0 ? -1 : 0);
- if (count < 32)
- return valueOf((long) x.ival << count);
+ if (count <= 0)
+ return valueOf(count > -32 ? x.ival >> (-count) : x.ival < 0 ? -1 : 0);
+ if (count < 32)
+ return valueOf((long) x.ival << count);
}
if (count == 0)
return x;
@@ -1767,57 +1767,57 @@ public class BigInteger extends Number implements Comparable<BigInteger>
buffer.append(Long.toString(longValue(), radix));
else
{
- boolean neg = isNegative();
- int[] work;
- if (neg || radix != 16)
- {
- work = new int[ival];
- getAbsolute(work);
- }
- else
- work = words;
- int len = ival;
-
- if (radix == 16)
- {
- if (neg)
- buffer.append('-');
- int buf_start = buffer.length();
- for (int i = len; --i >= 0; )
- {
- int word = work[i];
- for (int j = 8; --j >= 0; )
- {
- int hex_digit = (word >> (4 * j)) & 0xF;
- // Suppress leading zeros:
- if (hex_digit > 0 || buffer.length() > buf_start)
- buffer.append(Character.forDigit(hex_digit, 16));
- }
- }
- }
- else
- {
- int i = buffer.length();
- for (;;)
- {
- int digit = MPN.divmod_1(work, work, len, radix);
- buffer.append(Character.forDigit(digit, radix));
- while (len > 0 && work[len-1] == 0) len--;
- if (len == 0)
- break;
- }
- if (neg)
- buffer.append('-');
- /* Reverse buffer. */
- int j = buffer.length() - 1;
- while (i < j)
- {
- char tmp = buffer.charAt(i);
- buffer.setCharAt(i, buffer.charAt(j));
- buffer.setCharAt(j, tmp);
- i++; j--;
- }
- }
+ boolean neg = isNegative();
+ int[] work;
+ if (neg || radix != 16)
+ {
+ work = new int[ival];
+ getAbsolute(work);
+ }
+ else
+ work = words;
+ int len = ival;
+
+ if (radix == 16)
+ {
+ if (neg)
+ buffer.append('-');
+ int buf_start = buffer.length();
+ for (int i = len; --i >= 0; )
+ {
+ int word = work[i];
+ for (int j = 8; --j >= 0; )
+ {
+ int hex_digit = (word >> (4 * j)) & 0xF;
+ // Suppress leading zeros:
+ if (hex_digit > 0 || buffer.length() > buf_start)
+ buffer.append(Character.forDigit(hex_digit, 16));
+ }
+ }
+ }
+ else
+ {
+ int i = buffer.length();
+ for (;;)
+ {
+ int digit = MPN.divmod_1(work, work, len, radix);
+ buffer.append(Character.forDigit(digit, radix));
+ while (len > 0 && work[len-1] == 0) len--;
+ if (len == 0)
+ break;
+ }
+ if (neg)
+ buffer.append('-');
+ /* Reverse buffer. */
+ int j = buffer.length() - 1;
+ while (i < j)
+ {
+ char tmp = buffer.charAt(i);
+ buffer.setCharAt(i, buffer.charAt(j));
+ buffer.setCharAt(j, tmp);
+ i++; j--;
+ }
+ }
}
}
@@ -1900,8 +1900,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>
return false;
for (int i = x.ival; --i >= 0; )
{
- if (x.words[i] != y.words[i])
- return false;
+ if (x.words[i] != y.words[i])
+ return false;
}
return true;
}
@@ -1915,7 +1915,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>
}
private static BigInteger valueOf(byte[] digits, int byte_len,
- boolean negative, int radix)
+ boolean negative, int radix)
{
int chars_per_word = MPN.chars_per_word(radix);
int[] words = new int[byte_len / chars_per_word + 1];
@@ -1959,7 +1959,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int i;
for (i = 0; i < (n >> 5) ; i++)
if (words[i] != 0)
- return true;
+ return true;
return (n & 31) != 0 && (words[i] & ((1 << (n & 31)) - 1)) != 0;
}
@@ -2000,7 +2000,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int excess_bits = il - (ml + 1);
if (excess_bits > 0)
m = ((words == null) ? ival >> excess_bits
- : MPN.rshift_long(words, ival, excess_bits));
+ : MPN.rshift_long(words, ival, excess_bits));
else
m = longValue() << (- excess_bits);
@@ -2008,31 +2008,31 @@ public class BigInteger extends Number implements Comparable<BigInteger>
// any amount, even if it's less than half a step, it overflows.
if (exp == 1023 && ((m >> 1) == (1L << 53) - 1))
{
- if (remainder || checkBits(il - ml))
- return neg ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
- else
- return neg ? - Double.MAX_VALUE : Double.MAX_VALUE;
+ if (remainder || checkBits(il - ml))
+ return neg ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
+ else
+ return neg ? - Double.MAX_VALUE : Double.MAX_VALUE;
}
// Normal round-to-even rule: round up if the bit dropped is a one, and
// the bit above it or any of the bits below it is a one.
if ((m & 1) == 1
- && ((m & 2) == 2 || remainder || checkBits(excess_bits)))
- {
- m += 2;
- // Check if we overflowed the mantissa
- if ((m & (1L << 54)) != 0)
- {
- exp++;
- // renormalize
- m >>= 1;
- }
- // Check if a denormalized mantissa was just rounded up to a
- // normalized one.
- else if (ml == 52 && (m & (1L << 53)) != 0)
- exp++;
- }
-
+ && ((m & 2) == 2 || remainder || checkBits(excess_bits)))
+ {
+ m += 2;
+ // Check if we overflowed the mantissa
+ if ((m & (1L << 54)) != 0)
+ {
+ exp++;
+ // renormalize
+ m >>= 1;
+ }
+ // Check if a denormalized mantissa was just rounded up to a
+ // normalized one.
+ else if (ml == 52 && (m & (1L << 53)) != 0)
+ exp++;
+ }
+
// Discard the rounding bit
m >>= 1;
@@ -2052,14 +2052,14 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int len;
if (this.words == null)
{
- len = 1;
- words[0] = this.ival;
+ len = 1;
+ words[0] = this.ival;
}
else
{
- len = this.ival;
- for (int i = len; --i >= 0; )
- words[i] = this.words[i];
+ len = this.ival;
+ for (int i = len; --i >= 0; )
+ words[i] = this.words[i];
}
if (words[len - 1] < 0)
negate(words, words, len);
@@ -2090,11 +2090,11 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int len = x.ival;
if (x.words == null)
{
- if (len == Integer.MIN_VALUE)
- set(- (long) len);
- else
- set(-len);
- return;
+ if (len == Integer.MIN_VALUE)
+ set(- (long) len);
+ else
+ set(-len);
+ return;
}
realloc(len + 1);
if (negate(words, x.words, len))
@@ -2139,7 +2139,7 @@ public class BigInteger extends Number implements Comparable<BigInteger>
if (USING_NATIVE)
{
BigInteger result = new BigInteger();
- mpz.negate(result.mpz);
+ mpz.negate(result.mpz);
return result;
}
@@ -2193,8 +2193,8 @@ public class BigInteger extends Number implements Comparable<BigInteger>
// If BigInteger is an int, then it is in ival and nbytes will be <= 4.
while (nbytes > 4)
{
- word = words[wptr++];
- for (int i = 4; i > 0; --i, word >>= 8)
+ word = words[wptr++];
+ for (int i = 4; i > 0; --i, word >>= 8)
bytes[--nbytes] = (byte) word;
}
@@ -2234,35 +2234,35 @@ public class BigInteger extends Number implements Comparable<BigInteger>
/** Do one the the 16 possible bit-wise operations of two BigIntegers. */
private static void setBitOp(BigInteger result, int op,
- BigInteger x, BigInteger y)
+ BigInteger x, BigInteger y)
{
if ((y.words != null) && (x.words == null || x.ival < y.ival))
{
- BigInteger temp = x; x = y; y = temp;
- op = swappedOp(op);
+ BigInteger temp = x; x = y; y = temp;
+ op = swappedOp(op);
}
int xi;
int yi;
int xlen, ylen;
if (y.words == null)
{
- yi = y.ival;
- ylen = 1;
+ yi = y.ival;
+ ylen = 1;
}
else
{
- yi = y.words[0];
- ylen = y.ival;
+ yi = y.words[0];
+ ylen = y.ival;
}
if (x.words == null)
{
- xi = x.ival;
- xlen = 1;
+ xi = x.ival;
+ xlen = 1;
}
else
{
- xi = x.words[0];
- xlen = x.ival;
+ xi = x.words[0];
+ xlen = x.ival;
}
if (xlen > 1)
result.realloc(xlen);
@@ -2277,126 +2277,126 @@ public class BigInteger extends Number implements Comparable<BigInteger>
switch (op)
{
case 0: // clr
- ni = 0;
- break;
+ ni = 0;
+ break;
case 1: // and
- for (;;)
- {
- ni = xi & yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi < 0) finish = 1;
- break;
+ for (;;)
+ {
+ ni = xi & yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi < 0) finish = 1;
+ break;
case 2: // andc2
- for (;;)
- {
- ni = xi & ~yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi >= 0) finish = 1;
- break;
+ for (;;)
+ {
+ ni = xi & ~yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi >= 0) finish = 1;
+ break;
case 3: // copy x
- ni = xi;
- finish = 1; // Copy rest
- break;
+ ni = xi;
+ finish = 1; // Copy rest
+ break;
case 4: // andc1
- for (;;)
- {
- ni = ~xi & yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi < 0) finish = 2;
- break;
+ for (;;)
+ {
+ ni = ~xi & yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi < 0) finish = 2;
+ break;
case 5: // copy y
- for (;;)
- {
- ni = yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- break;
+ for (;;)
+ {
+ ni = yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ break;
case 6: // xor
- for (;;)
- {
- ni = xi ^ yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- finish = yi < 0 ? 2 : 1;
- break;
+ for (;;)
+ {
+ ni = xi ^ yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ finish = yi < 0 ? 2 : 1;
+ break;
case 7: // ior
- for (;;)
- {
- ni = xi | yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi >= 0) finish = 1;
- break;
+ for (;;)
+ {
+ ni = xi | yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi >= 0) finish = 1;
+ break;
case 8: // nor
- for (;;)
- {
- ni = ~(xi | yi);
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi >= 0) finish = 2;
- break;
+ for (;;)
+ {
+ ni = ~(xi | yi);
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi >= 0) finish = 2;
+ break;
case 9: // eqv [exclusive nor]
- for (;;)
- {
- ni = ~(xi ^ yi);
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- finish = yi >= 0 ? 2 : 1;
- break;
+ for (;;)
+ {
+ ni = ~(xi ^ yi);
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ finish = yi >= 0 ? 2 : 1;
+ break;
case 10: // c2
- for (;;)
- {
- ni = ~yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- break;
+ for (;;)
+ {
+ ni = ~yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ break;
case 11: // orc2
- for (;;)
- {
- ni = xi | ~yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi < 0) finish = 1;
- break;
+ for (;;)
+ {
+ ni = xi | ~yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi < 0) finish = 1;
+ break;
case 12: // c1
- ni = ~xi;
- finish = 2;
- break;
+ ni = ~xi;
+ finish = 2;
+ break;
case 13: // orc1
- for (;;)
- {
- ni = ~xi | yi;
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi >= 0) finish = 2;
- break;
+ for (;;)
+ {
+ ni = ~xi | yi;
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi >= 0) finish = 2;
+ break;
case 14: // nand
- for (;;)
- {
- ni = ~(xi & yi);
- if (i+1 >= ylen) break;
- w[i++] = ni; xi = x.words[i]; yi = y.words[i];
- }
- if (yi < 0) finish = 2;
- break;
+ for (;;)
+ {
+ ni = ~(xi & yi);
+ if (i+1 >= ylen) break;
+ w[i++] = ni; xi = x.words[i]; yi = y.words[i];
+ }
+ if (yi < 0) finish = 2;
+ break;
default:
case 15: // set
- ni = -1;
- break;
+ ni = -1;
+ break;
}
// Here i==ylen-1; w[0]..w[i-1] have the correct result;
// and ni contains the correct result for w[i+1].
@@ -2405,13 +2405,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>
switch (finish)
{
case 0:
- if (i == 0 && w == null)
- {
- result.ival = ni;
- return;
- }
- w[i++] = ni;
- break;
+ if (i == 0 && w == null)
+ {
+ result.ival = ni;
+ return;
+ }
+ w[i++] = ni;
+ break;
case 1: w[i] = ni; while (++i < xlen) w[i] = x.words[i]; break;
case 2: w[i] = ni; while (++i < xlen) w[i] = ~x.words[i]; break;
}
@@ -2590,15 +2590,15 @@ public class BigInteger extends Number implements Comparable<BigInteger>
// bit4count[I] is number of '1' bits in I.
private static final byte[] bit4_count = { 0, 1, 1, 2, 1, 2, 2, 3,
- 1, 2, 2, 3, 2, 3, 3, 4};
+ 1, 2, 2, 3, 2, 3, 3, 4};
private static int bitCount(int i)
{
int count = 0;
while (i != 0)
{
- count += bit4_count[i & 15];
- i >>>= 4;
+ count += bit4_count[i & 15];
+ i >>>= 4;
}
return count;
}
@@ -2622,13 +2622,13 @@ public class BigInteger extends Number implements Comparable<BigInteger>
int[] x_words = words;
if (x_words == null)
{
- x_len = 1;
- i = bitCount(ival);
+ x_len = 1;
+ i = bitCount(ival);
}
else
{
- x_len = ival;
- i = bitCount(x_words, x_len);
+ x_len = ival;
+ i = bitCount(x_words, x_len);
}
return isNegative() ? x_len * 32 - i : i;
}
@@ -2646,19 +2646,19 @@ public class BigInteger extends Number implements Comparable<BigInteger>
}
else
{
- s.defaultReadObject();
- if (magnitude.length == 0 || signum == 0)
- {
- this.ival = 0;
- this.words = null;
- }
- else
- {
- words = byteArrayToIntArray(magnitude, signum < 0 ? -1 : 0);
- BigInteger result = make(words, words.length);
- this.ival = result.ival;
- this.words = result.words;
- }
+ s.defaultReadObject();
+ if (magnitude.length == 0 || signum == 0)
+ {
+ this.ival = 0;
+ this.words = null;
+ }
+ else
+ {
+ words = byteArrayToIntArray(magnitude, signum < 0 ? -1 : 0);
+ BigInteger result = make(words, words.length);
+ this.ival = result.ival;
+ this.words = result.words;
+ }
}
}
diff --git a/java/math/MathContext.java b/java/math/MathContext.java
index 533ab13ac..161149540 100644
--- a/java/math/MathContext.java
+++ b/java/math/MathContext.java
@@ -1,4 +1,4 @@
-/* MathContext.java --
+/* MathContext.java --
Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,58 +49,58 @@ import java.io.Serializable;
public final class MathContext implements Serializable
{
/** A MathContext for unlimited precision arithmetic * */
- public static final MathContext UNLIMITED =
+ public static final MathContext UNLIMITED =
new MathContext(0, RoundingMode.HALF_UP);
-
+
/**
* A MathContext for the IEEE 754R Decimal32 format - 7 digit preicision and
* HALF_EVEN rounding.
*/
- public static final MathContext DECIMAL32 =
+ public static final MathContext DECIMAL32 =
new MathContext(7, RoundingMode.HALF_EVEN);
-
+
/**
* A MathContext for the IEEE 754R Decimal64 format - 16 digit preicision and
* HALF_EVEN rounding.
*/
- public static final MathContext DECIMAL64 =
+ public static final MathContext DECIMAL64 =
new MathContext(16, RoundingMode.HALF_EVEN);
-
+
/**
* A MathContext for the IEEE 754R Decimal128 format - 34 digit preicision and
* HALF_EVEN rounding.
*/
- public static final MathContext DECIMAL128 =
+ public static final MathContext DECIMAL128 =
new MathContext(34, RoundingMode.HALF_EVEN);
-
+
/**
* This is the serialVersionUID reported here:
* java.sun.com/j2se/1.5.0/docs/api/serialized-form.html#java.math.MathContext
*/
private static final long serialVersionUID = 5579720004786848255L;
-
+
private int precision;
-
+
private RoundingMode roundMode;
-
+
/**
* Constructs a new MathContext with the specified precision and with HALF_UP
* rounding.
* @param setPrecision the precision for the new MathContext
- *
+ *
* @throws IllegalArgumentException if precision is < 0.
*/
public MathContext(int setPrecision)
{
this(setPrecision, RoundingMode.HALF_UP);
}
-
+
/**
* Constructs a new MathContext with the specified precision and rounding
* mode.
* @param setPrecision the precision
* @param setRoundingMode the rounding mode
- *
+ *
* @throws IllegalArgumentException if precision is < 0.
*/
public MathContext(int setPrecision, RoundingMode setRoundingMode)
@@ -110,12 +110,12 @@ public final class MathContext implements Serializable
precision = setPrecision;
roundMode = setRoundingMode;
}
-
+
/**
* Constructs a MathContext from a String that has the same form as one
* produced by the toString() method.
* @param val
- *
+ *
* @throws IllegalArgumentException if the String is not in the correct
* format or if the precision specified is < 0.
*/
@@ -138,11 +138,11 @@ public final class MathContext implements Serializable
if (precision < 0)
throw new IllegalArgumentException("Precision cannot be less than 0.");
}
-
+
/**
* Returns true if x is a MathContext and has the same precision setting
* and rounding mode as this MathContext.
- *
+ *
* @return true if the above conditions hold
*/
public boolean equals(Object x)
@@ -153,7 +153,7 @@ public final class MathContext implements Serializable
return mc.precision == this.precision
&& mc.roundMode.equals(this.roundMode);
}
-
+
/**
* Returns the precision setting.
* @return the precision setting.
@@ -162,11 +162,11 @@ public final class MathContext implements Serializable
{
return precision;
}
-
+
/**
- * Returns the rounding mode setting. This will be one of
- * RoundingMode.CEILING, RoundingMode.DOWN, RoundingMode.FLOOR,
- * RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN, RoundingMode.HALF_UP,
+ * Returns the rounding mode setting. This will be one of
+ * RoundingMode.CEILING, RoundingMode.DOWN, RoundingMode.FLOOR,
+ * RoundingMode.HALF_DOWN, RoundingMode.HALF_EVEN, RoundingMode.HALF_UP,
* RoundingMode.UNNECESSARY, or RoundingMode.UP.
* @return the rounding mode setting.
*/
@@ -174,19 +174,19 @@ public final class MathContext implements Serializable
{
return roundMode;
}
-
+
/**
- * Returns "precision=p roundingMode=MODE" where p is an int giving the
+ * Returns "precision=p roundingMode=MODE" where p is an int giving the
* precision and MODE is UP, DOWN, HALF_UP, HALF_DOWN, HALF_EVEN, CEILING,
* FLOOR, or UNNECESSARY corresponding to rounding modes.
- *
+ *
* @return a String describing this MathContext
*/
public String toString()
{
return "precision="+precision+" roundingMode="+roundMode;
}
-
+
/**
* Returns the hashcode for this MathContext.
* @return the hashcode for this MathContext.
diff --git a/java/math/RoundingMode.java b/java/math/RoundingMode.java
index c85bf4ff5..140f0a36e 100644
--- a/java/math/RoundingMode.java
+++ b/java/math/RoundingMode.java
@@ -1,4 +1,4 @@
-/* RoundingMode.java -- An Enum to replace BigDecimal rounding constants.
+/* RoundingMode.java -- An Enum to replace BigDecimal rounding constants.
Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ public enum RoundingMode
* For compatability with Sun's JDK
*/
private static final long serialVersionUID = 432302042773881265L;
-
+
/**
* Returns the RoundingMode object corresponding to the legacy rounding modes
* in BigDecimal.
@@ -80,9 +80,9 @@ public enum RoundingMode
case BigDecimal.ROUND_UNNECESSARY:
return UNNECESSARY;
default:
- throw new
- IllegalArgumentException("invalid argument: " + rm +
- ". Argument should be one of the " +
+ throw new
+ IllegalArgumentException("invalid argument: " + rm +
+ ". Argument should be one of the " +
"rounding modes defined in BigDecimal.");
}
}
diff --git a/java/net/ContentHandler.java b/java/net/ContentHandler.java
index 7f63e7402..fed8f3de4 100644
--- a/java/net/ContentHandler.java
+++ b/java/net/ContentHandler.java
@@ -117,8 +117,8 @@ public abstract class ContentHandler
for (int i = 0; i < classes.length; i++)
{
- if (classes[i].isInstance(obj))
- return obj;
+ if (classes[i].isInstance(obj))
+ return obj;
}
return null;
diff --git a/java/net/DatagramSocket.java b/java/net/DatagramSocket.java
index ea681a1ab..6ca9c42fe 100644
--- a/java/net/DatagramSocket.java
+++ b/java/net/DatagramSocket.java
@@ -196,15 +196,15 @@ public class DatagramSocket
else
try
{
- impl =
- (DatagramSocketImpl) Class.forName("java.net." + propVal
- + "DatagramSocketImpl")
- .newInstance();
+ impl =
+ (DatagramSocketImpl) Class.forName("java.net." + propVal
+ + "DatagramSocketImpl")
+ .newInstance();
}
catch (Exception e)
{
- System.err.println("Could not instantiate class: java.net."
- + propVal + "DatagramSocketImpl");
+ System.err.println("Could not instantiate class: java.net."
+ + propVal + "DatagramSocketImpl");
try
{
impl = new PlainDatagramSocketImpl();
@@ -226,19 +226,19 @@ public class DatagramSocket
{
try
{
- if (! implCreated)
- {
- impl.create();
- implCreated = true;
- }
+ if (! implCreated)
+ {
+ impl.create();
+ implCreated = true;
+ }
- return impl;
+ return impl;
}
catch (IOException e)
{
- SocketException se = new SocketException();
- se.initCause(e);
- throw se;
+ SocketException se = new SocketException();
+ se.initCause(e);
+ throw se;
}
}
@@ -252,27 +252,27 @@ public class DatagramSocket
try
{
- getImpl().close();
+ getImpl().close();
}
catch (SocketException e)
{
- // Ignore this case, just close the socket in finally clause.
+ // Ignore this case, just close the socket in finally clause.
}
finally
{
- remoteAddress = null;
- remotePort = -1;
- impl = null;
+ remoteAddress = null;
+ remotePort = -1;
+ impl = null;
}
try
{
- if (getChannel() != null)
- getChannel().close();
+ if (getChannel() != null)
+ getChannel().close();
}
catch (IOException e)
{
- // Do nothing.
+ // Do nothing.
}
}
@@ -320,21 +320,21 @@ public class DatagramSocket
try
{
- localAddr =
- (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
+ localAddr =
+ (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkConnect(localAddr.getHostAddress(), -1);
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkConnect(localAddr.getHostAddress(), -1);
}
catch (SecurityException e)
{
- localAddr = InetAddress.ANY_IF;
+ localAddr = InetAddress.ANY_IF;
}
catch (SocketException e)
{
- // This cannot happen as we are bound.
- return null;
+ // This cannot happen as we are bound.
+ return null;
}
return localAddr;
@@ -352,12 +352,12 @@ public class DatagramSocket
try
{
- return getImpl().getLocalPort();
+ return getImpl().getLocalPort();
}
catch (SocketException e)
{
- // This cannot happen as we are bound.
- return 0;
+ // This cannot happen as we are bound.
+ return 0;
}
}
@@ -529,13 +529,13 @@ public class DatagramSocket
try
{
- getImpl().connect(address, port);
- remoteAddress = address;
- remotePort = port;
+ getImpl().connect(address, port);
+ remoteAddress = address;
+ remotePort = port;
}
catch (SocketException e)
{
- // This means simply not connected or connect not implemented.
+ // This means simply not connected or connect not implemented.
}
}
@@ -553,16 +553,16 @@ public class DatagramSocket
try
{
- getImpl().disconnect();
+ getImpl().disconnect();
}
catch (SocketException e)
{
- // This cannot happen as we are connected.
+ // This cannot happen as we are connected.
}
finally
{
- remoteAddress = null;
- remotePort = -1;
+ remoteAddress = null;
+ remotePort = -1;
}
}
@@ -592,7 +592,7 @@ public class DatagramSocket
if (remoteAddress != null && remoteAddress.isMulticastAddress())
throw new IOException
- ("Socket connected to a multicast address my not receive");
+ ("Socket connected to a multicast address my not receive");
if (getChannel() != null && ! getChannel().isBlocking()
&& ! ((DatagramChannelImpl) getChannel()).isInChannelOperation())
@@ -635,19 +635,19 @@ public class DatagramSocket
SecurityManager s = System.getSecurityManager();
if (s != null && ! isConnected())
{
- InetAddress addr = p.getAddress();
- if (addr.isMulticastAddress())
- s.checkMulticast(addr);
- else
- s.checkConnect(addr.getHostAddress(), p.getPort());
+ InetAddress addr = p.getAddress();
+ if (addr.isMulticastAddress())
+ s.checkMulticast(addr);
+ else
+ s.checkConnect(addr.getHostAddress(), p.getPort());
}
if (isConnected())
{
- if (p.getAddress() != null
- && (remoteAddress != p.getAddress() || remotePort != p.getPort()))
- throw new IllegalArgumentException
- ("DatagramPacket address does not match remote address");
+ if (p.getAddress() != null
+ && (remoteAddress != p.getAddress() || remotePort != p.getPort()))
+ throw new IllegalArgumentException
+ ("DatagramPacket address does not match remote address");
}
// FIXME: if this is a subclass of MulticastSocket,
@@ -675,7 +675,7 @@ public class DatagramSocket
{
if (isClosed())
throw new SocketException("socket is closed");
-
+
if (address == null)
address = new InetSocketAddress(InetAddress.ANY_IF, 0);
@@ -697,23 +697,23 @@ public class DatagramSocket
try
{
- getImpl().bind(port, addr);
- bound = true;
+ getImpl().bind(port, addr);
+ bound = true;
}
catch (SocketException exception)
{
- getImpl().close();
- throw exception;
+ getImpl().close();
+ throw exception;
}
catch (RuntimeException exception)
{
- getImpl().close();
- throw exception;
+ getImpl().close();
+ throw exception;
}
catch (Error error)
{
- getImpl().close();
- throw error;
+ getImpl().close();
+ throw error;
}
}
diff --git a/java/net/DatagramSocketImpl.java b/java/net/DatagramSocketImpl.java
index cfcde92e5..4f51f9f93 100644
--- a/java/net/DatagramSocketImpl.java
+++ b/java/net/DatagramSocketImpl.java
@@ -200,9 +200,9 @@ public abstract class DatagramSocketImpl implements SocketOptions
* socket. <b>Use <code>getTimeToLive()</code></b> instead.
*
* @return the current time-to-live
- *
+ *
* @exception IOException If an error occurs
- *
+ *
* @deprecated // FIXME: when ?
*/
protected abstract byte getTTL() throws IOException;
@@ -222,7 +222,7 @@ public abstract class DatagramSocketImpl implements SocketOptions
* socket.
*
* @return the current time-to-live
- *
+ *
* @exception IOException If an error occurs
*/
protected abstract int getTimeToLive() throws IOException;
@@ -276,7 +276,7 @@ public abstract class DatagramSocketImpl implements SocketOptions
/**
* Returns the FileDescriptor for this socket
- *
+ *
* @return the file descriptor associated with this socket
*/
protected FileDescriptor getFileDescriptor()
diff --git a/java/net/HttpURLConnection.java b/java/net/HttpURLConnection.java
index 07eae48e7..72dd67d91 100644
--- a/java/net/HttpURLConnection.java
+++ b/java/net/HttpURLConnection.java
@@ -380,7 +380,7 @@ public abstract class HttpURLConnection extends URLConnection
/**
* Returns the value of this HttpURLConnection's instanceFollowRedirects
* field
- *
+ *
* @return true if following redirects is enabled, false otherwise
*/
public boolean getInstanceFollowRedirects()
@@ -474,33 +474,33 @@ public abstract class HttpURLConnection extends URLConnection
// If responseCode not yet explicitly set by subclass
if (responseCode == -1)
{
- // Response is the first header received from the connection.
- String respField = getHeaderField(0);
-
- if (respField == null || ! respField.startsWith("HTTP/"))
- {
- // Set to default values on failure.
- responseCode = -1;
- responseMessage = null;
- return;
- }
-
- int firstSpc;
- int nextSpc;
- firstSpc = respField.indexOf(' ');
- nextSpc = respField.indexOf(' ', firstSpc + 1);
- responseMessage = respField.substring(nextSpc + 1);
- String codeStr = respField.substring(firstSpc + 1, nextSpc);
- try
- {
- responseCode = Integer.parseInt(codeStr);
- }
- catch (NumberFormatException e)
- {
- // Set to default values on failure.
- responseCode = -1;
- responseMessage = null;
- }
+ // Response is the first header received from the connection.
+ String respField = getHeaderField(0);
+
+ if (respField == null || ! respField.startsWith("HTTP/"))
+ {
+ // Set to default values on failure.
+ responseCode = -1;
+ responseMessage = null;
+ return;
+ }
+
+ int firstSpc;
+ int nextSpc;
+ firstSpc = respField.indexOf(' ');
+ nextSpc = respField.indexOf(' ', firstSpc + 1);
+ responseMessage = respField.substring(nextSpc + 1);
+ String codeStr = respField.substring(firstSpc + 1, nextSpc);
+ try
+ {
+ responseCode = Integer.parseInt(codeStr);
+ }
+ catch (NumberFormatException e)
+ {
+ // Set to default values on failure.
+ responseCode = -1;
+ responseMessage = null;
+ }
}
}
@@ -542,11 +542,11 @@ public abstract class HttpURLConnection extends URLConnection
int code;
try
{
- code = getResponseCode();
+ code = getResponseCode();
}
catch (IOException e)
{
- code = -1;
+ code = -1;
}
if (code == -1)
@@ -557,18 +557,18 @@ public abstract class HttpURLConnection extends URLConnection
try
{
- PushbackInputStream pbis = new PushbackInputStream(getInputStream());
+ PushbackInputStream pbis = new PushbackInputStream(getInputStream());
- int i = pbis.read();
- if (i == -1)
- return null;
+ int i = pbis.read();
+ if (i == -1)
+ return null;
- pbis.unread(i);
- return pbis;
+ pbis.unread(i);
+ return pbis;
}
catch (IOException e)
{
- return null;
+ return null;
}
}
diff --git a/java/net/Inet4Address.java b/java/net/Inet4Address.java
index 1a50a4729..e3cff7b13 100644
--- a/java/net/Inet4Address.java
+++ b/java/net/Inet4Address.java
@@ -70,7 +70,7 @@ public final class Inet4Address extends InetAddress
{
return new InetAddress(addr, hostName, AF_INET);
}
-
+
/**
* Initializes this object's addr instance variable from the passed in
* byte array. Note that this constructor is protected and is called
@@ -175,8 +175,8 @@ public final class Inet4Address extends InetAddress
return false;
return ((addr[0] & 0xff) == 0xe0
- && (addr[1] & 0xff) == 0x00
- && (addr[2] & 0xff) == 0x00);
+ && (addr[1] & 0xff) == 0x00
+ && (addr[2] & 0xff) == 0x00);
}
/**
@@ -218,15 +218,15 @@ public final class Inet4Address extends InetAddress
int len = addr.length;
int i = 0;
-
+
for ( ; ; )
{
sb.append(addr[i] & 0xff);
i++;
-
+
if (i == len)
break;
-
+
sb.append('.');
}
@@ -266,7 +266,7 @@ public final class Inet4Address extends InetAddress
for (int i = addr1.length; --i >= 0;)
if (addr1[i] != addr2[i])
- return false;
+ return false;
return true;
}
diff --git a/java/net/Inet6Address.java b/java/net/Inet6Address.java
index 9a1c4ea96..60c406587 100644
--- a/java/net/Inet6Address.java
+++ b/java/net/Inet6Address.java
@@ -48,7 +48,7 @@ import java.io.IOException;
/*
* Written using on-line Java Platform 1.4 API Specification and
* RFC 1884 (http://www.ietf.org/rfc/rfc1884.txt)
- *
+ *
* @author Michael Koch
* @status Updated to 1.5. Serialization compatibility is tested.
*/
@@ -62,37 +62,37 @@ public final class Inet6Address extends InetAddress
byte[] ipaddress;
/**
- * The scope ID, if any.
+ * The scope ID, if any.
* @since 1.5
- * @serial
+ * @serial
*/
private int scope_id;
/**
- * The scope ID, if any.
+ * The scope ID, if any.
* @since 1.5
- * @serial
+ * @serial
*/
private boolean scope_id_set;
/**
* Whether ifname is set or not.
* @since 1.5
- * @serial
+ * @serial
*/
private boolean scope_ifname_set;
/**
* Name of the network interface, used only by the serialization methods
* @since 1.5
- * @serial
+ * @serial
*/
private String ifname;
/**
* Scope network interface, or <code>null</code>.
*/
- private transient NetworkInterface nif;
+ private transient NetworkInterface nif;
/**
* The address family of these addresses (used for serialization).
@@ -250,14 +250,14 @@ public final class Inet6Address extends InetAddress
*
* @throws UnkownHostException if the address is an invalid number of bytes.
* @since 1.5
- */
- public static Inet6Address getByAddress(String host, byte[] addr,
- int scopeId)
+ */
+ public static Inet6Address getByAddress(String host, byte[] addr,
+ int scopeId)
throws UnknownHostException
{
if( addr.length != 16 )
throw new UnknownHostException("Illegal address length: " + addr.length
- + " bytes.");
+ + " bytes.");
Inet6Address ip = new Inet6Address( addr, host );
ip.scope_id = scopeId;
ip.scope_id_set = true;
@@ -270,14 +270,14 @@ public final class Inet6Address extends InetAddress
*
* @throws UnkownHostException if the address is an invalid number of bytes.
* @since 1.5
- */
- public static Inet6Address getByAddress(String host, byte[] addr,
- NetworkInterface nif)
+ */
+ public static Inet6Address getByAddress(String host, byte[] addr,
+ NetworkInterface nif)
throws UnknownHostException
{
if( addr.length != 16 )
throw new UnknownHostException("Illegal address length: " + addr.length
- + " bytes.");
+ + " bytes.");
Inet6Address ip = new Inet6Address( addr, host );
ip.nif = nif;
@@ -287,8 +287,8 @@ public final class Inet6Address extends InetAddress
/**
* Returns the <code>NetworkInterface</code> of the address scope
* if it is a scoped address and the scope is given in the form of a
- * NetworkInterface.
- * (I.e. the address was created using the
+ * NetworkInterface.
+ * (I.e. the address was created using the
* getByAddress(String, byte[], NetworkInterface) method)
* Otherwise this method returns <code>null</code>.
* @since 1.5
@@ -310,7 +310,7 @@ public final class Inet6Address extends InetAddress
// check scope_id_set because some JDK-serialized objects seem to have
// scope_id set to a nonzero value even when scope_id_set == false
if( scope_id_set )
- return scope_id;
+ return scope_id;
return 0;
}
@@ -323,12 +323,12 @@ public final class Inet6Address extends InetAddress
for (int i = 0; i < 16; i += 2)
{
- int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF);
+ int x = ((ipaddress[i] & 0xFF) << 8) | (ipaddress[i + 1] & 0xFF);
- if (i > 0)
- sbuf.append(':');
+ if (i > 0)
+ sbuf.append(':');
- sbuf.append(Integer.toHexString(x));
+ sbuf.append(Integer.toHexString(x));
}
if( nif != null )
sbuf.append( "%" + nif.getName() );
@@ -361,7 +361,7 @@ public final class Inet6Address extends InetAddress
for (int i = 0; i < ip.ipaddress.length; i++)
if (ipaddress[i] != ip.ipaddress[i])
- return false;
+ return false;
if( ip.nif != null && nif != null )
return nif.equals( ip.nif );
@@ -399,16 +399,16 @@ public final class Inet6Address extends InetAddress
*/
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException
- {
+ {
s.defaultReadObject();
try
{
- if( scope_ifname_set )
- nif = NetworkInterface.getByName( ifname );
+ if( scope_ifname_set )
+ nif = NetworkInterface.getByName( ifname );
}
catch( SocketException se )
{
- // FIXME: Ignore this? or throw an IOException?
+ // FIXME: Ignore this? or throw an IOException?
}
}
@@ -421,8 +421,8 @@ public final class Inet6Address extends InetAddress
{
if( nif != null )
{
- ifname = nif.getName();
- scope_ifname_set = true;
+ ifname = nif.getName();
+ scope_ifname_set = true;
}
s.defaultWriteObject();
}
diff --git a/java/net/InetAddress.java b/java/net/InetAddress.java
index 1f2667980..1a9dc6202 100644
--- a/java/net/InetAddress.java
+++ b/java/net/InetAddress.java
@@ -74,24 +74,24 @@ public class InetAddress implements Serializable
byte[] addr;
try
{
- addr = VMInetAddress.lookupInaddrAny();
+ addr = VMInetAddress.lookupInaddrAny();
}
catch (UnknownHostException e)
{
- // Make one up and hope it works.
- addr = new byte[] {0, 0, 0, 0};
+ // Make one up and hope it works.
+ addr = new byte[] {0, 0, 0, 0};
}
try
{
- ANY_IF = getByAddress(addr);
+ ANY_IF = getByAddress(addr);
}
catch (UnknownHostException e)
{
- throw (InternalError) new InternalError().initCause(e);
+ throw (InternalError) new InternalError().initCause(e);
}
ANY_IF.hostName = ANY_IF.getHostName();
}
-
+
/**
* Stores static localhost address object.
*/
@@ -100,13 +100,13 @@ public class InetAddress implements Serializable
{
try
{
- LOCALHOST = getByAddress("localhost", new byte[] {127, 0, 0, 1});
+ LOCALHOST = getByAddress("localhost", new byte[] {127, 0, 0, 1});
}
catch (UnknownHostException e)
{
- throw (InternalError) new InternalError().initCause(e);
+ throw (InternalError) new InternalError().initCause(e);
}
- }
+ }
/**
* The Serialized Form specifies that an int 'address' is saved/restored.
@@ -158,7 +158,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @return true if mulitcast, false if not
*
* @since 1.1
@@ -174,7 +174,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isAnyLocalAddress()
@@ -188,7 +188,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isLoopbackAddress()
@@ -202,7 +202,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isLinkLocalAddress()
@@ -216,7 +216,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isSiteLocalAddress()
@@ -230,7 +230,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isMCGlobal()
@@ -244,7 +244,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isMCNodeLocal()
@@ -258,7 +258,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isMCLinkLocal()
@@ -272,7 +272,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isMCSiteLocal()
@@ -287,7 +287,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @since 1.4
*/
public boolean isMCOrgLocal()
@@ -316,17 +316,17 @@ public class InetAddress implements Serializable
{
try
{
- return ResolverCache.getHostByAddr(addr);
+ return ResolverCache.getHostByAddr(addr);
}
catch (UnknownHostException e)
{
- return getHostAddress();
+ return getHostAddress();
}
}
/**
* Returns the canonical hostname represented by this InetAddress
- *
+ *
* @since 1.4
*/
public String getCanonicalHostName()
@@ -337,13 +337,13 @@ public class InetAddress implements Serializable
if (sm != null)
{
try
- {
+ {
sm.checkConnect(hostname, -1);
- }
- catch (SecurityException e)
- {
- return getHostAddress();
- }
+ }
+ catch (SecurityException e)
+ {
+ return getHostAddress();
+ }
}
return hostname;
@@ -367,7 +367,7 @@ public class InetAddress implements Serializable
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @return The IP address of this object in String form
*
* @since 1.0.2
@@ -425,7 +425,7 @@ public class InetAddress implements Serializable
for (int i = 0; i < addr.length; i++)
if (addr[i] != addr2[i])
- return false;
+ return false;
return true;
}
@@ -481,18 +481,18 @@ public class InetAddress implements Serializable
if (addr.length == 16)
{
- for (int i = 0; i < 12; i++)
- {
- if (addr[i] != (i < 10 ? 0 : (byte) 0xFF))
- return new Inet6Address(addr, host);
- }
-
- byte[] ip4addr = new byte[4];
- ip4addr[0] = addr[12];
- ip4addr[1] = addr[13];
- ip4addr[2] = addr[14];
- ip4addr[3] = addr[15];
- return new Inet4Address(ip4addr, host);
+ for (int i = 0; i < 12; i++)
+ {
+ if (addr[i] != (i < 10 ? 0 : (byte) 0xFF))
+ return new Inet6Address(addr, host);
+ }
+
+ byte[] ip4addr = new byte[4];
+ ip4addr[0] = addr[12];
+ ip4addr[1] = addr[13];
+ ip4addr[2] = addr[14];
+ ip4addr[3] = addr[15];
+ return new Inet4Address(ip4addr, host);
}
throw new UnknownHostException("IP address has illegal length");
@@ -515,14 +515,14 @@ public class InetAddress implements Serializable
byte[] address = VMInetAddress.aton(literal);
if (address == null)
return null;
-
+
try
{
- return getByAddress(address);
+ return getByAddress(address);
}
catch (UnknownHostException e)
{
- throw (InternalError) new InternalError().initCause(e);
+ throw (InternalError) new InternalError().initCause(e);
}
}
@@ -534,7 +534,7 @@ public class InetAddress implements Serializable
* default. This method is equivalent to returning the first element in
* the InetAddress array returned from GetAllByName.
*
- * @param hostname The name of the desired host, or null for the local
+ * @param hostname The name of the desired host, or null for the local
* loopback address.
*
* @return The address of the host as an InetAddress object.
@@ -612,11 +612,11 @@ public class InetAddress implements Serializable
String hostname = VMInetAddress.getLocalHostname();
try
{
- return getByName(hostname);
+ return getByName(hostname);
}
catch (SecurityException e)
{
- return LOCALHOST;
+ return LOCALHOST;
}
}
diff --git a/java/net/InetSocketAddress.java b/java/net/InetSocketAddress.java
index 5267cc11a..2126f7703 100644
--- a/java/net/InetSocketAddress.java
+++ b/java/net/InetSocketAddress.java
@@ -181,14 +181,14 @@ public class InetSocketAddress extends SocketAddress
// The hostname may differ.
if (obj instanceof InetSocketAddress)
{
- InetSocketAddress sa = (InetSocketAddress) obj;
-
- if (addr == null && sa.addr != null)
- return false;
- else if (addr == null && sa.addr == null) // we know hostname != null
- return hostname.equals(sa.hostname) && sa.port == port;
- else
- return addr.equals(sa.addr) && sa.port == port;
+ InetSocketAddress sa = (InetSocketAddress) obj;
+
+ if (addr == null && sa.addr != null)
+ return false;
+ else if (addr == null && sa.addr == null) // we know hostname != null
+ return hostname.equals(sa.hostname) && sa.port == port;
+ else
+ return addr.equals(sa.addr) && sa.port == port;
}
return false;
diff --git a/java/net/MimeTypeMapper.java b/java/net/MimeTypeMapper.java
index b0d400ced..3e4379291 100644
--- a/java/net/MimeTypeMapper.java
+++ b/java/net/MimeTypeMapper.java
@@ -258,15 +258,15 @@ class MimeTypeMapper implements FileNameMap
}
}
- public static void fillFromFile (Map<String, String> table, String fname)
+ public static void fillFromFile (Map<String, String> table, String fname)
throws IOException
{
- LineNumberReader reader =
+ LineNumberReader reader =
new LineNumberReader (new FileReader (fname));
while (reader.ready ())
{
- StringTokenizer tokenizer =
+ StringTokenizer tokenizer =
new StringTokenizer (reader.readLine ());
try
@@ -308,10 +308,10 @@ class MimeTypeMapper implements FileNameMap
int index = filename.lastIndexOf(".");
if (index != -1)
{
- if (index == filename.length())
- return "application/octet-stream";
- else
- filename = filename.substring(index + 1);
+ if (index == filename.length())
+ return "application/octet-stream";
+ else
+ filename = filename.substring(index + 1);
}
String type = (String) mime_types.get(filename);
@@ -338,7 +338,7 @@ class MimeTypeMapper implements FileNameMap
String key = it.next();
String value = map.get(key);
// Put the "," first since it is easier to make correct syntax this way.
- System.out.println(" " + (first ? " " : ", ")
+ System.out.println(" " + (first ? " " : ", ")
+ "{ \"" + key + "\", \"" + value + "\" }");
first = false;
}
diff --git a/java/net/MulticastSocket.java b/java/net/MulticastSocket.java
index 114d11f2d..5014b6a8e 100644
--- a/java/net/MulticastSocket.java
+++ b/java/net/MulticastSocket.java
@@ -202,7 +202,7 @@ public class MulticastSocket extends DatagramSocket
{
if (isClosed())
throw new SocketException("socket is closed");
-
+
InetAddress address;
if (netIf != null)
out:
@@ -235,8 +235,8 @@ public class MulticastSocket extends DatagramSocket
}
else
address = InetAddress.ANY_IF;
-
-
+
+
getImpl().setOption(SocketOptions.IP_MULTICAST_IF, address);
}
@@ -258,10 +258,10 @@ public class MulticastSocket extends DatagramSocket
InetAddress address =
(InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF);
-
+
if (address.isAnyLocalAddress())
return NetworkInterface.createAnyInterface();
-
+
NetworkInterface netIf = NetworkInterface.getByInetAddress(address);
return netIf;
@@ -294,7 +294,7 @@ public class MulticastSocket extends DatagramSocket
* Checks if local loopback mode is enabled
*
* @return true if loopback mode is enabled, false otherwise
- *
+ *
* @exception SocketException If an error occurs
*
* @since 1.4
@@ -501,13 +501,13 @@ public class MulticastSocket extends DatagramSocket
SecurityManager s = System.getSecurityManager();
if (s != null)
{
- InetAddress addr = packet.getAddress();
- if (addr.isMulticastAddress())
- s.checkPermission(new SocketPermission(addr.getHostName()
- + packet.getPort(),
- "accept,connect"));
- else
- s.checkConnect(addr.getHostAddress(), packet.getPort());
+ InetAddress addr = packet.getAddress();
+ if (addr.isMulticastAddress())
+ s.checkPermission(new SocketPermission(addr.getHostName()
+ + packet.getPort(),
+ "accept,connect"));
+ else
+ s.checkConnect(addr.getHostAddress(), packet.getPort());
}
int oldttl = getImpl().getTimeToLive();
diff --git a/java/net/NetworkInterface.java b/java/net/NetworkInterface.java
index 5ec64ff16..127dfba78 100644
--- a/java/net/NetworkInterface.java
+++ b/java/net/NetworkInterface.java
@@ -59,12 +59,12 @@ import java.util.Vector;
public final class NetworkInterface
{
private final VMNetworkInterface netif;
-
+
private NetworkInterface(VMNetworkInterface netif)
{
this.netif = netif;
}
-
+
/** Creates an NetworkInterface instance which
* represents any interface in the system. Its only
* address is <code>0.0.0.0/0.0.0.0</code>. This
@@ -74,7 +74,7 @@ public final class NetworkInterface
{
return new NetworkInterface(new VMNetworkInterface());
}
-
+
/**
* Returns the name of the network interface
*
@@ -109,16 +109,16 @@ public final class NetworkInterface
for (Enumeration<InetAddress> addresses = inetAddresses.elements();
addresses.hasMoreElements();)
{
- InetAddress addr = addresses.nextElement();
- try
- {
- s.checkConnect(addr.getHostAddress(), -1);
- tmpInetAddresses.add(addr);
- }
- catch (SecurityException e)
- {
- // Ignore.
- }
+ InetAddress addr = addresses.nextElement();
+ try
+ {
+ s.checkConnect(addr.getHostAddress(), -1);
+ tmpInetAddresses.add(addr);
+ }
+ catch (SecurityException e)
+ {
+ // Ignore.
+ }
}
return tmpInetAddresses.elements();
@@ -138,7 +138,7 @@ public final class NetworkInterface
* Returns an network interface by name
*
* @param name The name of the interface to return
- *
+ *
* @return a <code>NetworkInterface</code> object representing the interface,
* or null if there is no interface with that name.
*
@@ -187,14 +187,14 @@ public final class NetworkInterface
* Return an <code>Enumeration</code> of all available network interfaces
*
* @return all interfaces
- *
+ *
* @exception SocketException If an error occurs
*/
public static Enumeration<NetworkInterface> getNetworkInterfaces()
throws SocketException
{
VMNetworkInterface[] netifs = VMNetworkInterface.getVMInterfaces();
- Vector<NetworkInterface> networkInterfaces =
+ Vector<NetworkInterface> networkInterfaces =
new Vector<NetworkInterface>(netifs.length);
for (int i = 0; i < netifs.length; i++)
{
@@ -217,7 +217,7 @@ public final class NetworkInterface
return false;
NetworkInterface tmp = (NetworkInterface) obj;
-
+
if (netif.name == null)
return tmp.netif.name == null;
@@ -234,10 +234,10 @@ public final class NetworkInterface
{
// FIXME: hash correctly
int hc = netif.addresses.hashCode();
-
+
if (netif.name != null)
hc += netif.name.hashCode();
-
+
return hc;
}
@@ -253,7 +253,7 @@ public final class NetworkInterface
String separator = SystemProperties.getProperty("line.separator");
result = new CPStringBuilder();
-
+
result.append("name: ");
result.append(getDisplayName());
result.append(" (").append(getName()).append(") addresses:");
@@ -261,8 +261,8 @@ public final class NetworkInterface
for (Iterator it = netif.addresses.iterator(); it.hasNext(); )
{
- InetAddress address = (InetAddress) it.next();
- result.append(address.toString()).append(";").append(separator);
+ InetAddress address = (InetAddress) it.next();
+ result.append(address.toString()).append(";").append(separator);
}
return result.toString();
diff --git a/java/net/Proxy.java b/java/net/Proxy.java
index 315177413..36a25fa80 100644
--- a/java/net/Proxy.java
+++ b/java/net/Proxy.java
@@ -41,7 +41,7 @@ package java.net;
/**
* Defines a proxy setting. This setting contains a type (https, socks,
* direct) and a socket address.
- *
+ *
* @since 1.5
*/
public class Proxy
@@ -49,8 +49,8 @@ public class Proxy
/**
* Represents the proxy type.
*/
- public enum Type
- {
+ public enum Type
+ {
DIRECT, HTTP, SOCKS;
/**
@@ -112,8 +112,8 @@ public class Proxy
Proxy tmp = (Proxy) obj;
return (type.equals(tmp.type)
- && (address == null ? tmp.address == null
- : address.equals(tmp.address)));
+ && (address == null ? tmp.address == null
+ : address.equals(tmp.address)));
}
/**
@@ -134,6 +134,6 @@ public class Proxy
public String toString()
{
return type.toString() + (address == null ? ""
- : (":" + address.toString()));
+ : (":" + address.toString()));
}
}
diff --git a/java/net/ProxySelector.java b/java/net/ProxySelector.java
index 78592a244..6c85f99c7 100644
--- a/java/net/ProxySelector.java
+++ b/java/net/ProxySelector.java
@@ -44,7 +44,7 @@ import java.util.List;
/**
* Class for handling proxies for different connections.
- *
+ *
* @since 1.5
*/
public abstract class ProxySelector
@@ -100,17 +100,17 @@ public abstract class ProxySelector
/**
* Signals to the selector that a proxy was no available.
- *
+ *
* @throws IllegalArgumentException If one argument is null
*/
public abstract void connectFailed(URI uri, SocketAddress address,
- IOException exception);
+ IOException exception);
/**
* Returns the list of proxy settings for a given URI.
*
* @return list of proxy settings
- *
+ *
* @throws IllegalArgumentException If uri is null
*/
public abstract List<Proxy> select(URI uri);
diff --git a/java/net/ResolverCache.java b/java/net/ResolverCache.java
index ad329b607..d7e5ed407 100644
--- a/java/net/ResolverCache.java
+++ b/java/net/ResolverCache.java
@@ -119,21 +119,21 @@ class ResolverCache
Entry entry = get(key);
if (entry != null)
{
- if (entry.value == null)
- throw new UnknownHostException();
- return (String) entry.value;
+ if (entry.value == null)
+ throw new UnknownHostException();
+ return (String) entry.value;
}
try
{
- String hostname = VMInetAddress.getHostByAddr(addr);
- put(new Entry(key, hostname));
- return hostname;
+ String hostname = VMInetAddress.getHostByAddr(addr);
+ put(new Entry(key, hostname));
+ return hostname;
}
catch (UnknownHostException e)
{
- put(new Entry(key, null));
- throw e;
+ put(new Entry(key, null));
+ throw e;
}
}
@@ -152,21 +152,21 @@ class ResolverCache
Entry entry = get(hostname);
if (entry != null)
{
- if (entry.value == null)
- throw new UnknownHostException();
- return (byte[][]) entry.value;
+ if (entry.value == null)
+ throw new UnknownHostException();
+ return (byte[][]) entry.value;
}
try
{
- byte[][] addrs = VMInetAddress.getHostByName(hostname);
- put(new Entry(hostname, addrs));
- return addrs;
+ byte[][] addrs = VMInetAddress.getHostByName(hostname);
+ put(new Entry(hostname, addrs));
+ return addrs;
}
catch (UnknownHostException e)
{
- put(new Entry(hostname, null));
- throw e;
+ put(new Entry(hostname, null));
+ throw e;
}
}
@@ -201,9 +201,9 @@ class ResolverCache
reap();
if (entry.expires != 0)
{
- if (entry.expires != -1)
- killqueue.add(entry);
- cache.put(entry.key, entry);
+ if (entry.expires != -1)
+ killqueue.add(entry);
+ cache.put(entry.key, entry);
}
}
@@ -215,20 +215,20 @@ class ResolverCache
{
if (!killqueue.isEmpty())
{
- long now = System.currentTimeMillis();
+ long now = System.currentTimeMillis();
- Iterator iter = killqueue.iterator();
- while (iter.hasNext())
- {
- Entry entry = (Entry) iter.next();
- if (entry.expires > now)
- break;
- cache.remove(entry.key);
- iter.remove();
- }
+ Iterator iter = killqueue.iterator();
+ while (iter.hasNext())
+ {
+ Entry entry = (Entry) iter.next();
+ if (entry.expires > now)
+ break;
+ cache.remove(entry.key);
+ iter.remove();
+ }
}
}
-
+
/**
* An entry in the cache.
*/
@@ -243,7 +243,7 @@ class ResolverCache
* The entry itself. A null value indicates a failed lookup.
*/
public final Object value;
-
+
/**
* The time when this cache entry expires. If set to -1 then
* this entry will never expire. If set to 0 then this entry
@@ -261,9 +261,9 @@ class ResolverCache
int ttl = value != null ? POSITIVE_TTL : NEGATIVE_TTL;
if (ttl < 1)
- expires = ttl;
+ expires = ttl;
else
- expires = System.currentTimeMillis() + ttl * 1000;
+ expires = System.currentTimeMillis() + ttl * 1000;
}
}
}
diff --git a/java/net/ServerSocket.java b/java/net/ServerSocket.java
index fa1c51e75..1dbd7636c 100644
--- a/java/net/ServerSocket.java
+++ b/java/net/ServerSocket.java
@@ -247,8 +247,8 @@ public class ServerSocket
try
{
- impl.bind(addr, port);
- impl.listen(backlog);
+ impl.bind(addr, port);
+ impl.listen(backlog);
this.port = port;
local = new InetSocketAddress(
(InetAddress) impl.getOption(SocketOptions.SO_BINDADDR),
@@ -259,7 +259,7 @@ public class ServerSocket
try
{
if (local == null)
- close();
+ close();
}
catch (IOException _)
{
@@ -297,7 +297,7 @@ public class ServerSocket
* Returns the local socket address
*
* @return the local socket address, null if not bound
- *
+ *
* @since 1.4
*/
public SocketAddress getLocalSocketAddress()
@@ -326,33 +326,33 @@ public class ServerSocket
try
{
- implAccept(socket);
+ implAccept(socket);
}
catch (IOException e)
{
- try
- {
- socket.close();
- }
- catch (IOException e2)
- {
- // Ignore.
- }
-
- throw e;
+ try
+ {
+ socket.close();
+ }
+ catch (IOException e2)
+ {
+ // Ignore.
+ }
+
+ throw e;
}
catch (SecurityException e)
{
- try
- {
- socket.close();
- }
- catch (IOException e2)
- {
- // Ignore.
- }
-
- throw e;
+ try
+ {
+ socket.close();
+ }
+ catch (IOException e2)
+ {
+ // Ignore.
+ }
+
+ throw e;
}
return socket;
@@ -391,7 +391,7 @@ public class ServerSocket
SecurityManager sm = System.getSecurityManager();
if (sm != null)
sm.checkAccept(socket.getInetAddress().getHostAddress(),
- socket.getPort());
+ socket.getPort());
}
/**
@@ -416,7 +416,7 @@ public class ServerSocket
* by <code>ServerSocketChannel.open()</code>.</p>
*
* @return the associated socket channel, null if none exists
- *
+ *
* @since 1.4
*/
public ServerSocketChannel getChannel()
@@ -428,7 +428,7 @@ public class ServerSocket
* Returns true when the socket is bound, otherwise false
*
* @return true if socket is bound, false otherwise
- *
+ *
* @since 1.4
*/
public boolean isBound()
@@ -440,7 +440,7 @@ public class ServerSocket
* Returns true if the socket is closed, otherwise false
*
* @return true if socket is closed, false otherwise
- *
+ *
* @since 1.4
*/
public boolean isClosed()
@@ -501,7 +501,7 @@ public class ServerSocket
* Enables/Disables the SO_REUSEADDR option
*
* @param on true if SO_REUSEADDR should be enabled, false otherwise
- *
+ *
* @exception SocketException If an error occurs
*
* @since 1.4
diff --git a/java/net/Socket.java b/java/net/Socket.java
index 7541bdf78..d61e81f5e 100644
--- a/java/net/Socket.java
+++ b/java/net/Socket.java
@@ -377,23 +377,23 @@ public class Socket
// bind to address/port
try
{
- getImpl().bind(tmp.getAddress(), tmp.getPort());
- bound = true;
+ getImpl().bind(tmp.getAddress(), tmp.getPort());
+ bound = true;
}
catch (IOException exception)
{
- close();
- throw exception;
+ close();
+ throw exception;
}
catch (RuntimeException exception)
{
- close();
- throw exception;
+ close();
+ throw exception;
}
catch (Error error)
{
- close();
- throw error;
+ close();
+ throw error;
}
}
@@ -467,11 +467,11 @@ public class Socket
try
{
- return getImpl().getInetAddress();
+ return getImpl().getInetAddress();
}
catch (SocketException e)
{
- // This cannot happen as we are connected.
+ // This cannot happen as we are connected.
}
return null;
@@ -495,7 +495,7 @@ public class Socket
if (impl instanceof PlainSocketImpl)
addr = ((PlainSocketImpl) impl).getLocalAddress().getAddress();
-
+
if (addr == null)
{
try
@@ -536,11 +536,11 @@ public class Socket
try
{
- return getImpl().getPort();
+ return getImpl().getPort();
}
catch (SocketException e)
{
- // This cannot happen as we are connected.
+ // This cannot happen as we are connected.
}
return 0;
@@ -559,12 +559,12 @@ public class Socket
try
{
- if (getImpl() != null)
- return getImpl().getLocalPort();
+ if (getImpl() != null)
+ return getImpl().getLocalPort();
}
catch (SocketException e)
{
- // This cannot happen as we are bound.
+ // This cannot happen as we are bound.
}
return -1;
@@ -586,12 +586,12 @@ public class Socket
try
{
- return new InetSocketAddress(addr, getImpl().getLocalPort());
+ return new InetSocketAddress(addr, getImpl().getLocalPort());
}
catch (SocketException e)
{
- // This cannot happen as we are bound.
- return null;
+ // This cannot happen as we are bound.
+ return null;
}
}
@@ -609,13 +609,13 @@ public class Socket
try
{
- return new InetSocketAddress(getImpl().getInetAddress(),
- getImpl().getPort());
+ return new InetSocketAddress(getImpl().getInetAddress(),
+ getImpl().getPort());
}
catch (SocketException e)
{
- // This cannot happen as we are connected.
- return null;
+ // This cannot happen as we are connected.
+ return null;
}
}
@@ -721,13 +721,13 @@ public class Socket
if (on)
{
- if (linger < 0)
- throw new IllegalArgumentException("SO_LINGER must be >= 0");
+ if (linger < 0)
+ throw new IllegalArgumentException("SO_LINGER must be >= 0");
- if (linger > 65535)
- linger = 65535;
+ if (linger > 65535)
+ linger = 65535;
- getImpl().setOption(SocketOptions.SO_LINGER, Integer.valueOf(linger));
+ getImpl().setOption(SocketOptions.SO_LINGER, Integer.valueOf(linger));
}
else
getImpl().setOption(SocketOptions.SO_LINGER, Integer.valueOf(-1));
@@ -1034,15 +1034,15 @@ public class Socket
{
try
{
- if (isConnected())
- return (super.toString()
+ if (isConnected())
+ return (super.toString()
+ " [addr=" + getImpl().getInetAddress() + ",port="
- + getImpl().getPort() + ",localport="
- + getImpl().getLocalPort() + "]");
+ + getImpl().getPort() + ",localport="
+ + getImpl().getLocalPort() + "]");
}
catch (SocketException e)
{
- // This cannot happen as we are connected.
+ // This cannot happen as we are connected.
}
return super.toString() + " [unconnected]";
@@ -1225,7 +1225,7 @@ public class Socket
{
if (impl == null)
return false;
-
+
return impl.getInetAddress() != null;
}
@@ -1242,7 +1242,7 @@ public class Socket
return false;
if (impl instanceof PlainSocketImpl)
{
- InetSocketAddress addr = ((PlainSocketImpl) impl).getLocalAddress();
+ InetSocketAddress addr = ((PlainSocketImpl) impl).getLocalAddress();
return addr != null && addr.getAddress() != null;
}
return bound;
@@ -1258,7 +1258,7 @@ public class Socket
public boolean isClosed()
{
SocketChannel channel = getChannel();
-
+
return impl == null || (channel != null && ! channel.isOpen());
}
diff --git a/java/net/SocketPermission.java b/java/net/SocketPermission.java
index a5a848eee..ce16a79a0 100644
--- a/java/net/SocketPermission.java
+++ b/java/net/SocketPermission.java
@@ -127,9 +127,9 @@ public final class SocketPermission extends Permission implements Serializable
/**
* An IP address (IPv4 or IPv6). Will be set if and only if this
* object was initialized with a single literal IP address.
- */
+ */
private transient InetAddress address = null;
-
+
/**
* A range of ports.
*/
@@ -199,39 +199,39 @@ public final class SocketPermission extends Permission implements Serializable
boolean colon_allowed = true;
for (int i = 0; i < hostport.length(); i++)
{
- if (hostport.charAt(i) == ':')
- {
- if (!colon_allowed)
- throw new IllegalArgumentException("Ambiguous hostport part");
- colons++;
- colon_allowed = false;
- }
- else
- colon_allowed = true;
+ if (hostport.charAt(i) == ':')
+ {
+ if (!colon_allowed)
+ throw new IllegalArgumentException("Ambiguous hostport part");
+ colons++;
+ colon_allowed = false;
+ }
+ else
+ colon_allowed = true;
}
switch (colons)
{
case 0:
case 1:
- // a hostname or IPv4 address
- return hostport;
-
+ // a hostname or IPv4 address
+ return hostport;
+
case 7:
- // an IPv6 address with no ports
- return "[" + hostport + "]";
+ // an IPv6 address with no ports
+ return "[" + hostport + "]";
case 8:
- // an IPv6 address with ports
- int last_colon = hostport.lastIndexOf(':');
- return "[" + hostport.substring(0, last_colon) + "]"
- + hostport.substring(last_colon);
+ // an IPv6 address with ports
+ int last_colon = hostport.lastIndexOf(':');
+ return "[" + hostport.substring(0, last_colon) + "]"
+ + hostport.substring(last_colon);
default:
- throw new IllegalArgumentException("Ambiguous hostport part");
+ throw new IllegalArgumentException("Ambiguous hostport part");
}
}
-
+
/**
* Parse the hostport argument to the constructor.
*/
@@ -241,90 +241,90 @@ public final class SocketPermission extends Permission implements Serializable
String host, ports;
if (hostport.charAt(0) == '[')
{
- // host is a bracketed IPv6 address
- int end = hostport.indexOf("]");
- if (end == -1)
- throw new IllegalArgumentException("Unmatched '['");
- host = hostport.substring(1, end);
-
- address = InetAddress.getByLiteral(host);
- if (address == null)
- throw new IllegalArgumentException("Bad IPv6 address");
-
- if (end == hostport.length() - 1)
- ports = "";
- else if (hostport.charAt(end + 1) == ':')
- ports = hostport.substring(end + 2);
- else
- throw new IllegalArgumentException("Bad character after ']'");
+ // host is a bracketed IPv6 address
+ int end = hostport.indexOf("]");
+ if (end == -1)
+ throw new IllegalArgumentException("Unmatched '['");
+ host = hostport.substring(1, end);
+
+ address = InetAddress.getByLiteral(host);
+ if (address == null)
+ throw new IllegalArgumentException("Bad IPv6 address");
+
+ if (end == hostport.length() - 1)
+ ports = "";
+ else if (hostport.charAt(end + 1) == ':')
+ ports = hostport.substring(end + 2);
+ else
+ throw new IllegalArgumentException("Bad character after ']'");
}
else
{
- // host is a hostname or IPv4 address
- int sep = hostport.indexOf(":");
- if (sep == -1)
- {
- host = hostport;
- ports = "";
- }
- else
- {
- host = hostport.substring(0, sep);
- ports = hostport.substring(sep + 1);
- }
-
- address = InetAddress.getByLiteral(host);
- if (address == null)
- {
- if (host.lastIndexOf('*') > 0)
- throw new IllegalArgumentException("Bad hostname");
-
- hostname = host;
- }
+ // host is a hostname or IPv4 address
+ int sep = hostport.indexOf(":");
+ if (sep == -1)
+ {
+ host = hostport;
+ ports = "";
+ }
+ else
+ {
+ host = hostport.substring(0, sep);
+ ports = hostport.substring(sep + 1);
+ }
+
+ address = InetAddress.getByLiteral(host);
+ if (address == null)
+ {
+ if (host.lastIndexOf('*') > 0)
+ throw new IllegalArgumentException("Bad hostname");
+
+ hostname = host;
+ }
}
// Parse and validate the ports
if (ports.length() == 0)
{
- minport = MIN_PORT;
- maxport = MAX_PORT;
+ minport = MIN_PORT;
+ maxport = MAX_PORT;
}
else
{
- int sep = ports.indexOf("-");
- if (sep == -1)
- {
- // a single port
- minport = maxport = Integer.parseInt(ports);
- }
- else
- {
- if (ports.indexOf("-", sep + 1) != -1)
- throw new IllegalArgumentException("Unexpected '-'");
-
- if (sep == 0)
- {
- // an upper bound
- minport = MIN_PORT;
- maxport = Integer.parseInt(ports.substring(1));
- }
- else if (sep == ports.length() - 1)
- {
- // a lower bound
- minport =
- Integer.parseInt(ports.substring(0, ports.length() - 1));
- maxport = MAX_PORT;
- }
- else
- {
- // a range with two bounds
- minport = Integer.parseInt(ports.substring(0, sep));
- maxport = Integer.parseInt(ports.substring(sep + 1));
- }
- }
+ int sep = ports.indexOf("-");
+ if (sep == -1)
+ {
+ // a single port
+ minport = maxport = Integer.parseInt(ports);
+ }
+ else
+ {
+ if (ports.indexOf("-", sep + 1) != -1)
+ throw new IllegalArgumentException("Unexpected '-'");
+
+ if (sep == 0)
+ {
+ // an upper bound
+ minport = MIN_PORT;
+ maxport = Integer.parseInt(ports.substring(1));
+ }
+ else if (sep == ports.length() - 1)
+ {
+ // a lower bound
+ minport =
+ Integer.parseInt(ports.substring(0, ports.length() - 1));
+ maxport = MAX_PORT;
+ }
+ else
+ {
+ // a range with two bounds
+ minport = Integer.parseInt(ports.substring(0, sep));
+ maxport = Integer.parseInt(ports.substring(sep + 1));
+ }
+ }
}
}
-
+
/**
* Parse the actions argument to the constructor.
*/
@@ -334,18 +334,18 @@ public final class SocketPermission extends Permission implements Serializable
boolean resolve_needed = false;
boolean resolve_present = false;
-
+
StringTokenizer t = new StringTokenizer(actionstring, ",");
while (t.hasMoreTokens())
{
- String action = t.nextToken();
- action = action.trim().toLowerCase();
- setAction(action);
-
- if (action.equals("resolve"))
- resolve_present = true;
- else
- resolve_needed = true;
+ String action = t.nextToken();
+ action = action.trim().toLowerCase();
+ setAction(action);
+
+ if (action.equals("resolve"))
+ resolve_present = true;
+ else
+ resolve_needed = true;
}
if (resolve_needed && !resolve_present)
@@ -359,11 +359,11 @@ public final class SocketPermission extends Permission implements Serializable
{
for (int i = 0; i < ACTIONS.length; i++)
{
- if (action.equals(ACTIONS[i]))
- {
- actionmask |= 1 << i;
- return;
- }
+ if (action.equals(ACTIONS[i]))
+ {
+ actionmask |= 1 << i;
+ return;
+ }
}
throw new IllegalArgumentException("Unknown action " + action);
}
@@ -389,23 +389,23 @@ public final class SocketPermission extends Permission implements Serializable
return false;
if (p.actionmask != actionmask ||
- p.minport != minport ||
- p.maxport != maxport)
+ p.minport != minport ||
+ p.maxport != maxport)
return false;
if (address != null)
{
- if (p.address == null)
- return false;
- else
- return p.address.equals(address);
+ if (p.address == null)
+ return false;
+ else
+ return p.address.equals(address);
}
else
{
- if (p.hostname == null)
- return false;
- else
- return p.hostname.equals(hostname);
+ if (p.hostname == null)
+ return false;
+ else
+ return p.hostname.equals(hostname);
}
}
@@ -437,12 +437,12 @@ public final class SocketPermission extends Permission implements Serializable
for (int i = 0; i < ACTIONS.length; i++)
{
- if ((actionmask & (1 << i)) != 0)
- {
- if (sb.length() != 0)
- sb.append(",");
- sb.append(ACTIONS[i]);
- }
+ if ((actionmask & (1 << i)) != 0)
+ {
+ if (sb.length() != 0)
+ sb.append(",");
+ sb.append(ACTIONS[i]);
+ }
}
return sb.toString();
@@ -471,11 +471,11 @@ public final class SocketPermission extends Permission implements Serializable
try
{
- return InetAddress.getAllByName(hostname);
+ return InetAddress.getAllByName(hostname);
}
catch (UnknownHostException e)
{
- return new InetAddress[0];
+ return new InetAddress[0];
}
}
@@ -491,18 +491,18 @@ public final class SocketPermission extends Permission implements Serializable
return null;
try
{
- return InetAddress.getByName(hostname).internalGetCanonicalHostName();
+ return InetAddress.getByName(hostname).internalGetCanonicalHostName();
}
catch (UnknownHostException e)
{
- return null;
+ return null;
}
}
-
+
/**
* Returns true if the permission object passed it is implied by the
* this permission. This will be true if:
- *
+ *
* <ul>
* <li>The argument is of type <code>SocketPermission</code></li>
* <li>The actions list of the argument are in this object's actions</li>
@@ -511,7 +511,7 @@ public final class SocketPermission extends Permission implements Serializable
* </ul>
*
* <p>The argument's hostname will be a subset of this object's hostname if:</p>
- *
+ *
* <ul>
* <li>The argument's hostname or IP address is equal to this object's.</li>
* <li>The argument's canonical hostname is equal to this object's.</li>
@@ -538,10 +538,10 @@ public final class SocketPermission extends Permission implements Serializable
// imply it. This is not part of the spec, but it seems necessary.
if (p.hostname != null && p.hostname.length() == 0)
return false;
-
+
// Next check the actions
if ((p.actionmask & actionmask) != p.actionmask)
- return false;
+ return false;
// Then check the ports
if ((p.minport < minport) || (p.maxport > maxport))
@@ -554,49 +554,49 @@ public final class SocketPermission extends Permission implements Serializable
// IP address which one of p's IP addresses is equal to.
if (address != null)
{
- InetAddress[] addrs = p.getAddresses();
- for (int i = 0; i < addrs.length; i++)
- {
- if (address.equals(addrs[i]))
- return true;
- }
+ InetAddress[] addrs = p.getAddresses();
+ for (int i = 0; i < addrs.length; i++)
+ {
+ if (address.equals(addrs[i]))
+ return true;
+ }
}
// Return true if this object is a wildcarded domain that
// p's canonical name matches.
if (hostname != null && hostname.charAt(0) == '*')
{
- p_canon = p.getCanonicalHostName();
- if (p_canon != null && p_canon.endsWith(hostname.substring(1)))
- return true;
-
+ p_canon = p.getCanonicalHostName();
+ if (p_canon != null && p_canon.endsWith(hostname.substring(1)))
+ return true;
+
}
// Return true if this one of this object's IP addresses
// is equal to one of p's.
if (address == null)
{
- InetAddress[] addrs = p.getAddresses();
- InetAddress[] p_addrs = p.getAddresses();
-
- for (int i = 0; i < addrs.length; i++)
- {
- for (int j = 0; j < p_addrs.length; j++)
- {
- if (addrs[i].equals(p_addrs[j]))
- return true;
- }
- }
+ InetAddress[] addrs = p.getAddresses();
+ InetAddress[] p_addrs = p.getAddresses();
+
+ for (int i = 0; i < addrs.length; i++)
+ {
+ for (int j = 0; j < p_addrs.length; j++)
+ {
+ if (addrs[i].equals(p_addrs[j]))
+ return true;
+ }
+ }
}
// Return true if this object's canonical name equals p's.
String canon = getCanonicalHostName();
if (canon != null)
{
- if (p_canon == null)
- p_canon = p.getCanonicalHostName();
- if (p_canon != null && canon.equals(p_canon))
- return true;
+ if (p_canon == null)
+ p_canon = p.getCanonicalHostName();
+ if (p_canon != null && canon.equals(p_canon))
+ return true;
}
// Didn't make it
diff --git a/java/net/URI.java b/java/net/URI.java
index 933e4f451..b5fb9654f 100644
--- a/java/net/URI.java
+++ b/java/net/URI.java
@@ -49,7 +49,7 @@ import java.util.regex.Pattern;
/**
* <p>
- * A URI instance represents that defined by
+ * A URI instance represents that defined by
* <a href="http://www.ietf.org/rfc/rfc3986.txt">RFC3986</a>,
* with some deviations.
* </p>
@@ -157,7 +157,7 @@ import java.util.regex.Pattern;
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.4
*/
-public final class URI
+public final class URI
implements Comparable<URI>, Serializable
{
/**
@@ -193,7 +193,7 @@ public final class URI
private static final String RFC3986_SUBDELIMS = "!$&'()*+,;=";
private static final String RFC3986_REG_NAME =
RFC3986_UNRESERVED + RFC3986_SUBDELIMS + "%";
- private static final String RFC3986_PCHAR = RFC3986_UNRESERVED +
+ private static final String RFC3986_PCHAR = RFC3986_UNRESERVED +
RFC3986_SUBDELIMS + ":@%";
private static final String RFC3986_SEGMENT = RFC3986_PCHAR;
private static final String RFC3986_PATH_SEGMENTS = RFC3986_SEGMENT + "/";
@@ -230,7 +230,7 @@ public final class URI
* Index of fragment component in parsed URI.
*/
private static final int FRAGMENT_GROUP = 10;
-
+
/**
* Index of userinfo component in parsed authority section.
*/
@@ -294,19 +294,19 @@ public final class URI
this.string = (String) is.readObject();
try
{
- parseURI(this.string);
+ parseURI(this.string);
}
catch (URISyntaxException x)
{
- // Should not happen.
- throw new RuntimeException(x);
+ // Should not happen.
+ throw new RuntimeException(x);
}
}
private void writeObject(ObjectOutputStream os) throws IOException
{
if (string == null)
- string = toString();
+ string = toString();
os.writeObject(string);
}
@@ -350,11 +350,11 @@ public final class URI
String matched = match.group(group);
if (matched == null || matched.length() == 0)
{
- String prevMatched = match.group(group -1);
- if (prevMatched == null || prevMatched.length() == 0)
- return null;
- else
- return "";
+ String prevMatched = match.group(group -1);
+ if (prevMatched == null || prevMatched.length() == 0)
+ return null;
+ else
+ return "";
}
return matched;
}
@@ -369,23 +369,23 @@ public final class URI
private void parseURI(String str) throws URISyntaxException
{
Matcher matcher = URI_PATTERN.matcher(str);
-
+
if (matcher.matches())
{
- scheme = getURIGroup(matcher, SCHEME_GROUP);
- rawSchemeSpecificPart = matcher.group(SCHEME_SPEC_PART_GROUP);
- schemeSpecificPart = unquote(rawSchemeSpecificPart);
- if (!isOpaque())
- {
- rawAuthority = getURIGroup(matcher, AUTHORITY_GROUP);
- rawPath = matcher.group(PATH_GROUP);
- rawQuery = getURIGroup(matcher, QUERY_GROUP);
- }
- rawFragment = getURIGroup(matcher, FRAGMENT_GROUP);
+ scheme = getURIGroup(matcher, SCHEME_GROUP);
+ rawSchemeSpecificPart = matcher.group(SCHEME_SPEC_PART_GROUP);
+ schemeSpecificPart = unquote(rawSchemeSpecificPart);
+ if (!isOpaque())
+ {
+ rawAuthority = getURIGroup(matcher, AUTHORITY_GROUP);
+ rawPath = matcher.group(PATH_GROUP);
+ rawQuery = getURIGroup(matcher, QUERY_GROUP);
+ }
+ rawFragment = getURIGroup(matcher, FRAGMENT_GROUP);
}
else
throw new URISyntaxException(str,
- "doesn't match URI regular expression");
+ "doesn't match URI regular expression");
parseServerAuthority();
// We must eagerly unquote the parts, because this is the only time
@@ -416,27 +416,27 @@ public final class URI
int pos = 0;
for (int i = 0; i < str.length(); i++)
{
- char c = str.charAt(i);
- if (c == '%')
- {
- if (i + 2 >= str.length())
- throw new URISyntaxException(str, "Invalid quoted character");
- int hi = Character.digit(str.charAt(++i), 16);
- int lo = Character.digit(str.charAt(++i), 16);
- if (lo < 0 || hi < 0)
- throw new URISyntaxException(str, "Invalid quoted character");
- buf[pos++] = (byte) (hi * 16 + lo);
- }
- else
- buf[pos++] = (byte) c;
+ char c = str.charAt(i);
+ if (c == '%')
+ {
+ if (i + 2 >= str.length())
+ throw new URISyntaxException(str, "Invalid quoted character");
+ int hi = Character.digit(str.charAt(++i), 16);
+ int lo = Character.digit(str.charAt(++i), 16);
+ if (lo < 0 || hi < 0)
+ throw new URISyntaxException(str, "Invalid quoted character");
+ buf[pos++] = (byte) (hi * 16 + lo);
+ }
+ else
+ buf[pos++] = (byte) c;
}
try
{
- return new String(buf, 0, pos, "utf-8");
+ return new String(buf, 0, pos, "utf-8");
}
catch (java.io.UnsupportedEncodingException x2)
{
- throw (Error) new InternalError().initCause(x2);
+ throw (Error) new InternalError().initCause(x2);
}
}
@@ -488,16 +488,16 @@ public final class URI
CPStringBuilder sb = new CPStringBuilder(str.length());
for (int i = 0; i < str.length(); i++)
{
- char c = str.charAt(i);
- if ((legalCharacters.indexOf(c) == -1)
- && (c <= 127))
- {
- sb.append('%');
- sb.append(HEX.charAt(c / 16));
- sb.append(HEX.charAt(c % 16));
- }
- else
- sb.append(c);
+ char c = str.charAt(i);
+ if ((legalCharacters.indexOf(c) == -1)
+ && (c <= 127))
+ {
+ sb.append('%');
+ sb.append(HEX.charAt(c / 16));
+ sb.append(HEX.charAt(c % 16));
+ }
+ else
+ sb.append(c);
}
return sb.toString();
}
@@ -659,12 +659,12 @@ public final class URI
{
try
{
- return new URI(str);
+ return new URI(str);
}
catch (URISyntaxException e)
{
- throw (IllegalArgumentException) new IllegalArgumentException()
- .initCause(e);
+ throw (IllegalArgumentException) new IllegalArgumentException()
+ .initCause(e);
}
}
@@ -686,32 +686,32 @@ public final class URI
{
if (rawAuthority != null)
{
- Matcher matcher = AUTHORITY_PATTERN.matcher(rawAuthority);
-
- if (matcher.matches())
- {
- rawUserInfo = getURIGroup(matcher, AUTHORITY_USERINFO_GROUP);
- rawHost = getURIGroup(matcher, AUTHORITY_HOST_GROUP);
-
- String portStr = getURIGroup(matcher, AUTHORITY_PORT_GROUP);
-
- if (portStr != null && ! portStr.isEmpty())
- try
- {
- port = Integer.parseInt(portStr);
- }
- catch (NumberFormatException e)
- {
- URISyntaxException use =
- new URISyntaxException
- (string, "doesn't match URI regular expression");
- use.initCause(e);
- throw use;
- }
- }
- else
- throw new URISyntaxException(string,
- "doesn't match URI regular expression");
+ Matcher matcher = AUTHORITY_PATTERN.matcher(rawAuthority);
+
+ if (matcher.matches())
+ {
+ rawUserInfo = getURIGroup(matcher, AUTHORITY_USERINFO_GROUP);
+ rawHost = getURIGroup(matcher, AUTHORITY_HOST_GROUP);
+
+ String portStr = getURIGroup(matcher, AUTHORITY_PORT_GROUP);
+
+ if (portStr != null && ! portStr.isEmpty())
+ try
+ {
+ port = Integer.parseInt(portStr);
+ }
+ catch (NumberFormatException e)
+ {
+ URISyntaxException use =
+ new URISyntaxException
+ (string, "doesn't match URI regular expression");
+ use.initCause(e);
+ throw use;
+ }
+ }
+ else
+ throw new URISyntaxException(string,
+ "doesn't match URI regular expression");
}
return this;
}
@@ -744,13 +744,13 @@ public final class URI
return this;
try
{
- return new URI(scheme, authority, normalizePath(path), query,
- fragment);
+ return new URI(scheme, authority, normalizePath(path), query,
+ fragment);
}
catch (URISyntaxException e)
{
- throw (Error) new InternalError("Normalized URI variant could not "+
- "be constructed").initCause(e);
+ throw (Error) new InternalError("Normalized URI variant could not "+
+ "be constructed").initCause(e);
}
}
@@ -770,13 +770,13 @@ public final class URI
* The resulting URI will be free of `.' and `..' segments, barring those
* that were prepended or which couldn't be paired, respectively.
* </p>
- *
+ *
* @param relativePath the relative path to be normalized.
* @return the normalized path.
*/
private String normalizePath(String relativePath)
{
- /*
+ /*
This follows the algorithm in section 5.2.4. of RFC3986,
but doesn't modify the input buffer.
*/
@@ -785,66 +785,66 @@ public final class URI
int start = 0;
while (start < input.length())
{
- /* A */
- if (input.indexOf("../",start) == start)
- {
- start += 3;
- continue;
- }
- if (input.indexOf("./",start) == start)
- {
- start += 2;
- continue;
- }
- /* B */
- if (input.indexOf("/./",start) == start)
- {
- start += 2;
- continue;
- }
- if (input.indexOf("/.",start) == start
- && input.charAt(start + 2) != '.')
- {
- start += 1;
- input.setCharAt(start,'/');
- continue;
- }
- /* C */
- if (input.indexOf("/../",start) == start)
- {
- start += 3;
- removeLastSegment(output);
- continue;
- }
- if (input.indexOf("/..",start) == start)
- {
- start += 2;
- input.setCharAt(start,'/');
- removeLastSegment(output);
- continue;
- }
- /* D */
- if (start == input.length() - 1 && input.indexOf(".",start) == start)
- {
- input.delete(0,1);
- continue;
- }
- if (start == input.length() - 2 && input.indexOf("..",start) == start)
- {
- input.delete(0,2);
- continue;
- }
- /* E */
- int indexOfSlash = input.indexOf("/",start);
- while (indexOfSlash == start)
- {
- output.append("/");
- ++start;
- indexOfSlash = input.indexOf("/",start);
- }
- if (indexOfSlash == -1)
- indexOfSlash = input.length();
- output.append(input.substring(start, indexOfSlash));
+ /* A */
+ if (input.indexOf("../",start) == start)
+ {
+ start += 3;
+ continue;
+ }
+ if (input.indexOf("./",start) == start)
+ {
+ start += 2;
+ continue;
+ }
+ /* B */
+ if (input.indexOf("/./",start) == start)
+ {
+ start += 2;
+ continue;
+ }
+ if (input.indexOf("/.",start) == start
+ && input.charAt(start + 2) != '.')
+ {
+ start += 1;
+ input.setCharAt(start,'/');
+ continue;
+ }
+ /* C */
+ if (input.indexOf("/../",start) == start)
+ {
+ start += 3;
+ removeLastSegment(output);
+ continue;
+ }
+ if (input.indexOf("/..",start) == start)
+ {
+ start += 2;
+ input.setCharAt(start,'/');
+ removeLastSegment(output);
+ continue;
+ }
+ /* D */
+ if (start == input.length() - 1 && input.indexOf(".",start) == start)
+ {
+ input.delete(0,1);
+ continue;
+ }
+ if (start == input.length() - 2 && input.indexOf("..",start) == start)
+ {
+ input.delete(0,2);
+ continue;
+ }
+ /* E */
+ int indexOfSlash = input.indexOf("/",start);
+ while (indexOfSlash == start)
+ {
+ output.append("/");
+ ++start;
+ indexOfSlash = input.indexOf("/",start);
+ }
+ if (indexOfSlash == -1)
+ indexOfSlash = input.length();
+ output.append(input.substring(start, indexOfSlash));
start = indexOfSlash;
}
return output.toString();
@@ -890,33 +890,33 @@ public final class URI
try
{
- if (fragment != null && path != null && path.equals("")
- && scheme == null && authority == null && query == null)
- return new URI(this.scheme, this.schemeSpecificPart, fragment);
-
- if (authority == null)
- {
- authority = this.authority;
- if (path == null)
- path = "";
- if (! (path.startsWith("/")))
- {
- CPStringBuilder basepath = new CPStringBuilder(this.path);
- int i = this.path.lastIndexOf('/');
-
- if (i >= 0)
- basepath.delete(i + 1, basepath.length());
-
- basepath.append(path);
- path = normalizePath(basepath.toString());
- }
- }
- return new URI(this.scheme, authority, path, query, fragment);
+ if (fragment != null && path != null && path.equals("")
+ && scheme == null && authority == null && query == null)
+ return new URI(this.scheme, this.schemeSpecificPart, fragment);
+
+ if (authority == null)
+ {
+ authority = this.authority;
+ if (path == null)
+ path = "";
+ if (! (path.startsWith("/")))
+ {
+ CPStringBuilder basepath = new CPStringBuilder(this.path);
+ int i = this.path.lastIndexOf('/');
+
+ if (i >= 0)
+ basepath.delete(i + 1, basepath.length());
+
+ basepath.append(path);
+ path = normalizePath(basepath.toString());
+ }
+ }
+ return new URI(this.scheme, authority, path, query, fragment);
}
catch (URISyntaxException e)
{
- throw (Error) new InternalError("Resolved URI variant could not "+
- "be constructed").initCause(e);
+ throw (Error) new InternalError("Resolved URI variant could not "+
+ "be constructed").initCause(e);
}
}
@@ -973,21 +973,21 @@ public final class URI
String basePath = rawPath;
if (!(uri.getRawPath().equals(rawPath)))
{
- if (!(basePath.endsWith("/")))
- basePath = basePath.concat("/");
- if (!(uri.getRawPath().startsWith(basePath)))
- return uri;
+ if (!(basePath.endsWith("/")))
+ basePath = basePath.concat("/");
+ if (!(uri.getRawPath().startsWith(basePath)))
+ return uri;
}
try
{
- return new URI(null, null,
- uri.getRawPath().substring(basePath.length()),
- uri.getRawQuery(), uri.getRawFragment());
+ return new URI(null, null,
+ uri.getRawPath().substring(basePath.length()),
+ uri.getRawQuery(), uri.getRawFragment());
}
catch (URISyntaxException e)
{
- throw (Error) new InternalError("Relativized URI variant could not "+
- "be constructed").initCause(e);
+ throw (Error) new InternalError("Relativized URI variant could not "+
+ "be constructed").initCause(e);
}
}
@@ -1144,7 +1144,7 @@ public final class URI
}
/**
- * <p>
+ * <p>
* Compares the URI with the given object for equality. If the
* object is not a <code>URI</code>, then the method returns false.
* Otherwise, the following criteria are observed:
@@ -1187,40 +1187,40 @@ public final class URI
URI uriObj = (URI) obj;
if (scheme == null)
{
- if (uriObj.getScheme() != null)
- return false;
+ if (uriObj.getScheme() != null)
+ return false;
}
else
if (!(scheme.equalsIgnoreCase(uriObj.getScheme())))
- return false;
+ return false;
if (rawFragment == null)
{
- if (uriObj.getRawFragment() != null)
- return false;
+ if (uriObj.getRawFragment() != null)
+ return false;
}
else
if (!(rawFragment.equalsIgnoreCase(uriObj.getRawFragment())))
- return false;
+ return false;
boolean opaqueThis = isOpaque();
boolean opaqueObj = uriObj.isOpaque();
if (opaqueThis && opaqueObj)
return rawSchemeSpecificPart.equals(uriObj.getRawSchemeSpecificPart());
else if (!opaqueThis && !opaqueObj)
{
- boolean common = rawPath.equalsIgnoreCase(uriObj.getRawPath())
- && ((rawQuery == null && uriObj.getRawQuery() == null)
- || rawQuery.equalsIgnoreCase(uriObj.getRawQuery()));
- if (rawAuthority == null && uriObj.getRawAuthority() == null)
- return common;
- if (host == null)
- return common
- && rawAuthority.equalsIgnoreCase(uriObj.getRawAuthority());
- return common
- && host.equalsIgnoreCase(uriObj.getHost())
- && port == uriObj.getPort()
- && (rawUserInfo == null ?
- uriObj.getRawUserInfo() == null :
- rawUserInfo.equalsIgnoreCase(uriObj.getRawUserInfo()));
+ boolean common = rawPath.equalsIgnoreCase(uriObj.getRawPath())
+ && ((rawQuery == null && uriObj.getRawQuery() == null)
+ || rawQuery.equalsIgnoreCase(uriObj.getRawQuery()));
+ if (rawAuthority == null && uriObj.getRawAuthority() == null)
+ return common;
+ if (host == null)
+ return common
+ && rawAuthority.equalsIgnoreCase(uriObj.getRawAuthority());
+ return common
+ && host.equalsIgnoreCase(uriObj.getHost())
+ && port == uriObj.getPort()
+ && (rawUserInfo == null ?
+ uriObj.getRawUserInfo() == null :
+ rawUserInfo.equalsIgnoreCase(uriObj.getRawUserInfo()));
}
else
return false;
@@ -1278,16 +1278,16 @@ public final class URI
* on whether this URI is less than, equal to or greater
* than that supplied, respectively.
*/
- public int compareTo(URI uri)
+ public int compareTo(URI uri)
throws ClassCastException
{
if (scheme == null && uri.getScheme() != null)
return -1;
if (scheme != null)
{
- int sCompare = scheme.compareToIgnoreCase(uri.getScheme());
- if (sCompare != 0)
- return sCompare;
+ int sCompare = scheme.compareToIgnoreCase(uri.getScheme());
+ if (sCompare != 0)
+ return sCompare;
}
boolean opaqueThis = isOpaque();
boolean opaqueObj = uri.isOpaque();
@@ -1297,51 +1297,51 @@ public final class URI
return -1;
if (opaqueThis)
{
- int ssCompare =
- rawSchemeSpecificPart.compareTo(uri.getRawSchemeSpecificPart());
- if (ssCompare == 0)
- return compareFragments(uri);
- else
- return ssCompare;
+ int ssCompare =
+ rawSchemeSpecificPart.compareTo(uri.getRawSchemeSpecificPart());
+ if (ssCompare == 0)
+ return compareFragments(uri);
+ else
+ return ssCompare;
}
if (rawAuthority == null && uri.getRawAuthority() != null)
return -1;
if (rawAuthority != null)
{
- int aCompare = rawAuthority.compareTo(uri.getRawAuthority());
- if (aCompare != 0)
- {
- if (host == null)
- return aCompare;
- if (rawUserInfo == null && uri.getRawUserInfo() != null)
- return -1;
- int uCompare = rawUserInfo.compareTo(uri.getRawUserInfo());
- if (uCompare != 0)
- return uCompare;
- if (host == null && uri.getHost() != null)
- return -1;
- int hCompare = host.compareTo(uri.getHost());
- if (hCompare != 0)
- return hCompare;
- int uriPort = uri.getPort();
- return (uriPort == port) ? 0 : (uriPort > port) ? -1 : 1;
- }
+ int aCompare = rawAuthority.compareTo(uri.getRawAuthority());
+ if (aCompare != 0)
+ {
+ if (host == null)
+ return aCompare;
+ if (rawUserInfo == null && uri.getRawUserInfo() != null)
+ return -1;
+ int uCompare = rawUserInfo.compareTo(uri.getRawUserInfo());
+ if (uCompare != 0)
+ return uCompare;
+ if (host == null && uri.getHost() != null)
+ return -1;
+ int hCompare = host.compareTo(uri.getHost());
+ if (hCompare != 0)
+ return hCompare;
+ int uriPort = uri.getPort();
+ return (uriPort == port) ? 0 : (uriPort > port) ? -1 : 1;
+ }
}
if (rawPath == null && uri.getRawPath() != null)
return -1;
if (rawPath != null)
{
- int pCompare = rawPath.compareTo(uri.getRawPath());
- if (pCompare != 0)
- return pCompare;
+ int pCompare = rawPath.compareTo(uri.getRawPath());
+ if (pCompare != 0)
+ return pCompare;
}
if (rawQuery == null && uri.getRawQuery() != null)
return -1;
if (rawQuery != null)
{
- int qCompare = rawQuery.compareTo(uri.getRawQuery());
- if (qCompare != 0)
- return qCompare;
+ int qCompare = rawQuery.compareTo(uri.getRawQuery());
+ if (qCompare != 0)
+ return qCompare;
}
return compareFragments(uri);
}
@@ -1394,25 +1394,25 @@ public final class URI
CPStringBuilder encBuffer = null;
for (int i = 0; i < strRep.length(); i++)
{
- char c = strRep.charAt(i);
- if (c <= 127)
- {
- if (inNonAsciiBlock)
- {
- buffer.append(escapeCharacters(encBuffer.toString()));
- inNonAsciiBlock = false;
- }
- buffer.append(c);
- }
- else
- {
- if (!inNonAsciiBlock)
- {
- encBuffer = new CPStringBuilder();
- inNonAsciiBlock = true;
- }
- encBuffer.append(c);
- }
+ char c = strRep.charAt(i);
+ if (c <= 127)
+ {
+ if (inNonAsciiBlock)
+ {
+ buffer.append(escapeCharacters(encBuffer.toString()));
+ inNonAsciiBlock = false;
+ }
+ buffer.append(c);
+ }
+ else
+ {
+ if (!inNonAsciiBlock)
+ {
+ encBuffer = new CPStringBuilder();
+ inNonAsciiBlock = true;
+ }
+ encBuffer.append(c);
+ }
}
return buffer.toString();
}
@@ -1430,20 +1430,20 @@ public final class URI
{
try
{
- CPStringBuilder sb = new CPStringBuilder();
- // this is far from optimal, but it works
- byte[] utf8 = str.getBytes("utf-8");
- for (int j = 0; j < utf8.length; j++)
- {
- sb.append('%');
- sb.append(HEX.charAt((utf8[j] & 0xff) / 16));
- sb.append(HEX.charAt((utf8[j] & 0xff) % 16));
- }
- return sb.toString();
+ CPStringBuilder sb = new CPStringBuilder();
+ // this is far from optimal, but it works
+ byte[] utf8 = str.getBytes("utf-8");
+ for (int j = 0; j < utf8.length; j++)
+ {
+ sb.append('%');
+ sb.append(HEX.charAt((utf8[j] & 0xff) / 16));
+ sb.append(HEX.charAt((utf8[j] & 0xff) % 16));
+ }
+ return sb.toString();
}
catch (java.io.UnsupportedEncodingException x)
{
- throw (Error) new InternalError("Escaping error").initCause(x);
+ throw (Error) new InternalError("Escaping error").initCause(x);
}
}
diff --git a/java/net/URL.java b/java/net/URL.java
index 16a606fbc..1b778b40a 100644
--- a/java/net/URL.java
+++ b/java/net/URL.java
@@ -203,9 +203,9 @@ public final class URL implements Serializable
String s = SystemProperties.getProperty("gnu.java.net.nocache_protocol_handlers");
if (s == null)
- cache_handlers = true;
+ cache_handlers = true;
else
- cache_handlers = false;
+ cache_handlers = false;
}
/**
@@ -276,11 +276,11 @@ public final class URL implements Serializable
if (ph != null)
{
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkPermission(new NetPermission("specifyStreamHandler"));
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkPermission(new NetPermission("specifyStreamHandler"));
- this.ph = ph;
+ this.ph = ph;
}
else
this.ph = getURLStreamHandler(protocol);
@@ -293,18 +293,18 @@ public final class URL implements Serializable
this.port = port;
this.authority = (host != null) ? host : "";
if (port >= 0 && host != null)
- this.authority += ":" + port;
+ this.authority += ":" + port;
int hashAt = file.indexOf('#');
if (hashAt < 0)
{
- this.file = file;
- this.ref = null;
+ this.file = file;
+ this.ref = null;
}
else
{
- this.file = file.substring(0, hashAt);
- this.ref = file.substring(hashAt + 1);
+ this.file = file.substring(0, hashAt);
+ this.ref = file.substring(hashAt + 1);
}
hashCode = hashCode(); // Used for serialization.
}
@@ -324,7 +324,7 @@ public final class URL implements Serializable
public URL(String spec) throws MalformedURLException
{
this((URL) null, spec != null ? spec : "", (URLStreamHandler) null,
- false);
+ false);
}
/**
@@ -346,8 +346,8 @@ public final class URL implements Serializable
public URL(URL context, String spec) throws MalformedURLException
{
this(context, spec,
- (context == null) ? (URLStreamHandler) null : context.ph,
- false);
+ (context == null) ? (URLStreamHandler) null : context.ph,
+ false);
}
/**
@@ -395,7 +395,7 @@ public final class URL implements Serializable
*
*/
private URL(URL context, String spec, URLStreamHandler ph,
- boolean phFromUser)
+ boolean phFromUser)
throws MalformedURLException
{
/* A protocol is defined by the doc as the substring before a ':'
@@ -416,12 +416,12 @@ public final class URL implements Serializable
int colon;
int slash = spec.indexOf('/');
if ((colon = spec.indexOf("://", 1)) > 0
- && ((colon < slash || slash < 0))
+ && ((colon < slash || slash < 0))
&& ! spec.regionMatches(colon, "://:", 0, 4))
{
- context = null;
- if (! phFromUser)
- ph = null;
+ context = null;
+ if (! phFromUser)
+ ph = null;
}
boolean protocolSpecified = false;
@@ -429,10 +429,10 @@ public final class URL implements Serializable
if ((colon = spec.indexOf(':')) > 0
&& (colon < slash || slash < 0))
{
- // Protocol may have been specified in spec string.
+ // Protocol may have been specified in spec string.
protocolSpecified = true;
- protocol = spec.substring(0, colon).toLowerCase();
- if (context != null)
+ protocol = spec.substring(0, colon).toLowerCase();
+ if (context != null)
{
if (context.protocol.equals(protocol))
{
@@ -482,11 +482,11 @@ public final class URL implements Serializable
if (ph != null)
{
- SecurityManager s = System.getSecurityManager();
- if (s != null && phFromUser)
- s.checkPermission(new NetPermission("specifyStreamHandler"));
+ SecurityManager s = System.getSecurityManager();
+ if (s != null && phFromUser)
+ s.checkPermission(new NetPermission("specifyStreamHandler"));
- this.ph = ph;
+ this.ph = ph;
}
else
this.ph = getURLStreamHandler(protocol);
@@ -502,14 +502,14 @@ public final class URL implements Serializable
try
{
- this.ph.parseURL(this, spec, colon + 1,
- hashAt < 0 ? spec.length() : hashAt);
+ this.ph.parseURL(this, spec, colon + 1,
+ hashAt < 0 ? spec.length() : hashAt);
}
catch (URLParseError e)
{
MalformedURLException mue = new MalformedURLException(e.getMessage());
mue.initCause(e);
- throw mue;
+ throw mue;
}
catch (RuntimeException e)
{
@@ -772,13 +772,13 @@ public final class URL implements Serializable
protocol = protocol.toLowerCase();
if (! this.protocol.equals(protocol))
protocolHandler = getURLStreamHandler(protocol);
-
+
// It is an hidden feature of the JDK. If the protocol does not exist,
// we keep the previously initialized protocol.
if (protocolHandler != null)
{
- this.ph = protocolHandler;
- this.protocol = protocol;
+ this.ph = protocolHandler;
+ this.protocol = protocol;
}
this.authority = "";
this.port = port;
@@ -818,13 +818,13 @@ public final class URL implements Serializable
protocol = protocol.toLowerCase();
if (! this.protocol.equals(protocol))
protocolHandler = getURLStreamHandler(protocol);
-
+
// It is an hidden feature of the JDK. If the protocol does not exist,
// we keep the previously initialized protocol.
if (protocolHandler != null)
{
- this.ph = protocolHandler;
- this.protocol = protocol;
+ this.ph = protocolHandler;
+ this.protocol = protocol;
}
this.host = host;
this.userInfo = userInfo;
@@ -902,70 +902,70 @@ public final class URL implements Serializable
// First, see if a protocol handler is in our cache.
if (cache_handlers)
{
- if ((ph = ph_cache.get(protocol)) != null)
- return ph;
+ if ((ph = ph_cache.get(protocol)) != null)
+ return ph;
}
// If a non-default factory has been set, use it to find the protocol.
if (factory != null)
{
- ph = factory.createURLStreamHandler(protocol);
+ ph = factory.createURLStreamHandler(protocol);
}
// Non-default factory may have returned null or a factory wasn't set.
// Use the default search algorithm to find a handler for this protocol.
if (ph == null)
{
- // Get the list of packages to check and append our default handler
- // to it, along with the JDK specified default as a last resort.
- // Except in very unusual environments the JDK specified one shouldn't
- // ever be needed (or available).
- String ph_search_path =
- SystemProperties.getProperty("java.protocol.handler.pkgs");
-
- // Tack our default package on at the ends.
- if (ph_search_path != null)
- ph_search_path += "|" + DEFAULT_SEARCH_PATH;
- else
- ph_search_path = DEFAULT_SEARCH_PATH;
-
- // Finally loop through our search path looking for a match.
- StringTokenizer pkgPrefix = new StringTokenizer(ph_search_path, "|");
-
- // Cache the systemClassLoader
- if (systemClassLoader == null)
- {
- systemClassLoader = AccessController.doPrivileged
- (new PrivilegedAction<ClassLoader>() {
- public ClassLoader run()
- {
- return ClassLoader.getSystemClassLoader();
- }
- });
- }
-
- do
- {
- try
- {
- // Try to get a class from the system/application
- // classloader, initialize it, make an instance
- // and try to cast it to a URLStreamHandler.
- String clsName =
- (pkgPrefix.nextToken() + "." + protocol + ".Handler");
- Class c = Class.forName(clsName, true, systemClassLoader);
- ph = (URLStreamHandler) c.newInstance();
- }
+ // Get the list of packages to check and append our default handler
+ // to it, along with the JDK specified default as a last resort.
+ // Except in very unusual environments the JDK specified one shouldn't
+ // ever be needed (or available).
+ String ph_search_path =
+ SystemProperties.getProperty("java.protocol.handler.pkgs");
+
+ // Tack our default package on at the ends.
+ if (ph_search_path != null)
+ ph_search_path += "|" + DEFAULT_SEARCH_PATH;
+ else
+ ph_search_path = DEFAULT_SEARCH_PATH;
+
+ // Finally loop through our search path looking for a match.
+ StringTokenizer pkgPrefix = new StringTokenizer(ph_search_path, "|");
+
+ // Cache the systemClassLoader
+ if (systemClassLoader == null)
+ {
+ systemClassLoader = AccessController.doPrivileged
+ (new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return ClassLoader.getSystemClassLoader();
+ }
+ });
+ }
+
+ do
+ {
+ try
+ {
+ // Try to get a class from the system/application
+ // classloader, initialize it, make an instance
+ // and try to cast it to a URLStreamHandler.
+ String clsName =
+ (pkgPrefix.nextToken() + "." + protocol + ".Handler");
+ Class c = Class.forName(clsName, true, systemClassLoader);
+ ph = (URLStreamHandler) c.newInstance();
+ }
catch (ThreadDeath death)
{
throw death;
}
- catch (Throwable t)
- {
- // Ignored.
- }
- }
- while (ph == null && pkgPrefix.hasMoreTokens());
+ catch (Throwable t)
+ {
+ // Ignored.
+ }
+ }
+ while (ph == null && pkgPrefix.hasMoreTokens());
}
// Update the hashtable with the new protocol handler.
diff --git a/java/net/URLClassLoader.java b/java/net/URLClassLoader.java
index 52d297a3c..418ee77f3 100644
--- a/java/net/URLClassLoader.java
+++ b/java/net/URLClassLoader.java
@@ -288,8 +288,8 @@ public class URLClassLoader extends SecureClassLoader
if (newUrl == null)
return; // Silently ignore...
- // Reset the toString() value.
- thisString = null;
+ // Reset the toString() value.
+ thisString = null;
// Create a loader for this URL.
URLLoader loader = null;
@@ -394,8 +394,8 @@ public class URLClassLoader extends SecureClassLoader
newUrl);
}
- urlinfos.add(loader);
- ArrayList<URLLoader> extra = loader.getClassPath();
+ urlinfos.add(loader);
+ ArrayList<URLLoader> extra = loader.getClassPath();
if (extra != null)
urlinfos.addAll(extra);
}
@@ -414,8 +414,8 @@ public class URLClassLoader extends SecureClassLoader
{
for (int i = 0; i < newUrls.length; i++)
{
- urls.add(newUrls[i]);
- addURLImpl(newUrls[i]);
+ urls.add(newUrls[i]);
+ addURLImpl(newUrls[i]);
}
}
@@ -424,7 +424,7 @@ public class URLClassLoader extends SecureClassLoader
* object, if not null, has precedence.
*/
private String getAttributeValue(Attributes.Name name, Attributes first,
- Attributes second)
+ Attributes second)
{
String result = null;
if (first != null)
@@ -457,7 +457,7 @@ public class URLClassLoader extends SecureClassLoader
CPStringBuilder xform = new CPStringBuilder(name);
for (int i = xform.length () - 1; i >= 0; --i)
if (xform.charAt(i) == '.')
- xform.setCharAt(i, '/');
+ xform.setCharAt(i, '/');
xform.append('/');
String xformName = xform.toString();
@@ -466,22 +466,22 @@ public class URLClassLoader extends SecureClassLoader
String specTitle
= getAttributeValue(Attributes.Name.SPECIFICATION_TITLE,
- entryAttr, attr);
+ entryAttr, attr);
String specVersion
= getAttributeValue(Attributes.Name.SPECIFICATION_VERSION,
- entryAttr, attr);
+ entryAttr, attr);
String specVendor
= getAttributeValue(Attributes.Name.SPECIFICATION_VENDOR,
- entryAttr, attr);
+ entryAttr, attr);
String implTitle
= getAttributeValue(Attributes.Name.IMPLEMENTATION_TITLE,
- entryAttr, attr);
+ entryAttr, attr);
String implVersion
= getAttributeValue(Attributes.Name.IMPLEMENTATION_VERSION,
- entryAttr, attr);
+ entryAttr, attr);
String implVendor
= getAttributeValue(Attributes.Name.IMPLEMENTATION_VENDOR,
- entryAttr, attr);
+ entryAttr, attr);
// Look if the Manifest indicates that this package is sealed
// XXX - most likely not completely correct!
@@ -494,9 +494,9 @@ public class URLClassLoader extends SecureClassLoader
url = null;
return definePackage(name,
- specTitle, specVendor, specVersion,
- implTitle, implVendor, implVersion,
- url);
+ specTitle, specVendor, specVersion,
+ implTitle, implVendor, implVersion,
+ url);
}
/**
@@ -534,47 +534,47 @@ public class URLClassLoader extends SecureClassLoader
// construct the class (and watch out for those nasty IOExceptions)
try
{
- byte[] data;
- InputStream in = resource.getInputStream();
- try
- {
- int length = resource.getLength();
- if (length != -1)
- {
- // We know the length of the data.
- // Just try to read it in all at once
- data = new byte[length];
- int pos = 0;
- while (length - pos > 0)
- {
- int len = in.read(data, pos, length - pos);
- if (len == -1)
- throw new EOFException("Not enough data reading from: "
- + in);
- pos += len;
- }
- }
- else
- {
- // We don't know the data length.
- // Have to read it in chunks.
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
- byte[] b = new byte[4096];
- int l = 0;
- while (l != -1)
- {
- l = in.read(b);
- if (l != -1)
- out.write(b, 0, l);
- }
- data = out.toByteArray();
- }
- }
- finally
- {
- in.close();
- }
- final byte[] classData = data;
+ byte[] data;
+ InputStream in = resource.getInputStream();
+ try
+ {
+ int length = resource.getLength();
+ if (length != -1)
+ {
+ // We know the length of the data.
+ // Just try to read it in all at once
+ data = new byte[length];
+ int pos = 0;
+ while (length - pos > 0)
+ {
+ int len = in.read(data, pos, length - pos);
+ if (len == -1)
+ throw new EOFException("Not enough data reading from: "
+ + in);
+ pos += len;
+ }
+ }
+ else
+ {
+ // We don't know the data length.
+ // Have to read it in chunks.
+ ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
+ byte[] b = new byte[4096];
+ int l = 0;
+ while (l != -1)
+ {
+ l = in.read(b);
+ if (l != -1)
+ out.write(b, 0, l);
+ }
+ data = out.toByteArray();
+ }
+ }
+ finally
+ {
+ in.close();
+ }
+ final byte[] classData = data;
// Now get the CodeSource
final CodeSource source = resource.getCodeSource();
@@ -620,18 +620,18 @@ public class URLClassLoader extends SecureClassLoader
Certificate[] resourceCertificates = resource.getCertificates();
if(resourceCertificates != null)
super.setSigners(result, resourceCertificates);
-
+
return result;
}
catch (IOException ioe)
{
- throw new ClassNotFoundException(className + " not found in " + this, ioe);
+ throw new ClassNotFoundException(className + " not found in " + this, ioe);
}
}
-
+
// Cached String representation of this URLClassLoader
private String thisString;
-
+
/**
* Returns a String representation of this URLClassLoader giving the
* actual Class name, the URLs that are searched and the parent
@@ -641,25 +641,25 @@ public class URLClassLoader extends SecureClassLoader
{
synchronized (this)
{
- if (thisString == null)
- {
- CPStringBuilder sb = new CPStringBuilder();
- sb.append(this.getClass().getName());
- sb.append("{urls=[" );
- URL[] thisURLs = getURLs();
- for (int i = 0; i < thisURLs.length; i++)
- {
- sb.append(thisURLs[i]);
- if (i < thisURLs.length - 1)
- sb.append(',');
- }
- sb.append(']');
- sb.append(", parent=");
- sb.append(getParent());
- sb.append('}');
- thisString = sb.toString();
- }
- return thisString;
+ if (thisString == null)
+ {
+ CPStringBuilder sb = new CPStringBuilder();
+ sb.append(this.getClass().getName());
+ sb.append("{urls=[" );
+ URL[] thisURLs = getURLs();
+ for (int i = 0; i < thisURLs.length; i++)
+ {
+ sb.append(thisURLs[i]);
+ if (i < thisURLs.length - 1)
+ sb.append(',');
+ }
+ sb.append(']');
+ sb.append(", parent=");
+ sb.append(getParent());
+ sb.append('}');
+ thisString = sb.toString();
+ }
+ return thisString;
}
}
diff --git a/java/net/URLConnection.java b/java/net/URLConnection.java
index 674058014..e9365a3e0 100644
--- a/java/net/URLConnection.java
+++ b/java/net/URLConnection.java
@@ -173,7 +173,7 @@ public abstract class URLConnection
private static SimpleDateFormat[] dateFormats;
private static boolean dateformats_initialized;
-
+
/**
* The connection timeout period.
*/
@@ -236,7 +236,7 @@ public abstract class URLConnection
/**
* Set the connection timeout speed, in milliseconds, or zero if the timeout
- * is to be considered infinite. Note that in certain socket
+ * is to be considered infinite. Note that in certain socket
* implementations/platforms this method may not have any effect.
*
* Throws an <code>IllegalArgumentException</code> if timeout < 0.
@@ -270,7 +270,7 @@ public abstract class URLConnection
/**
* Set the read timeout, in milliseconds, or zero if the timeout
- * is to be considered infinite. Note that in certain socket
+ * is to be considered infinite. Note that in certain socket
* implementations/platforms this method may not have any effect.
*
* Throws an <code>IllegalArgumentException</code> if timeout < 0.
@@ -368,7 +368,7 @@ public abstract class URLConnection
/**
* Return a String representing the header value at the specified index.
* This allows the caller to walk the list of header fields. The analogous
- * {@link #getHeaderField(int)} method allows access to the corresponding
+ * {@link #getHeaderField(int)} method allows access to the corresponding
* key for this header field
*
* @param index The index into the header field list to retrieve the value for
@@ -397,8 +397,8 @@ public abstract class URLConnection
/**
* Returns an unmodifiable Map containing all sent header fields.
- *
- * @return The map of header fields. The map consists of String keys with
+ *
+ * @return The map of header fields. The map consists of String keys with
* an unmodifiable List of String objects as value.
*
* @since 1.4
@@ -430,11 +430,11 @@ public abstract class URLConnection
try
{
- return Integer.parseInt(value);
+ return Integer.parseInt(value);
}
catch (NumberFormatException e)
{
- return defaultValue;
+ return defaultValue;
}
}
@@ -463,15 +463,15 @@ public abstract class URLConnection
if (str != null)
{
- for (int i = 0; i < dateFormats.length; i++)
- {
- SimpleDateFormat df = dateFormats[i];
- position.setIndex(0);
- position.setErrorIndex(0);
- Date date = df.parse(str, position);
- if (date != null)
- return date.getTime();
- }
+ for (int i = 0; i < dateFormats.length; i++)
+ {
+ SimpleDateFormat df = dateFormats[i];
+ position.setIndex(0);
+ position.setErrorIndex(0);
+ Date date = df.parse(str, position);
+ if (date != null)
+ return date.getTime();
+ }
}
return result;
@@ -480,7 +480,7 @@ public abstract class URLConnection
/**
* Returns a String representing the header key at the specified index.
* This allows the caller to walk the list of header fields. The analogous
- * {@link #getHeaderField(int)} method allows access to the corresponding
+ * {@link #getHeaderField(int)} method allows access to the corresponding
* value for this tag.
*
* @param index The index into the header field list to retrieve the key for.
@@ -527,7 +527,7 @@ public abstract class URLConnection
connect();
// FIXME: Doc indicates that other criteria should be applied as
- // heuristics to determine the true content type, e.g. see
+ // heuristics to determine the true content type, e.g. see
// guessContentTypeFromName() and guessContentTypeFromStream methods
// as well as FileNameMap class & fileNameMap field & get/set methods.
String type = getContentType();
@@ -698,7 +698,7 @@ public abstract class URLConnection
{
if (connected)
throw new IllegalStateException("Already connected");
-
+
allowUserInteraction = allow;
}
@@ -820,8 +820,8 @@ public abstract class URLConnection
}
/**
- * Sets the value of the named request property.
- * This method does overwrite the value of existing properties with
+ * Sets the value of the named request property.
+ * This method does overwrite the value of existing properties with
* the new value.
*
* @param key The name of the property
@@ -898,8 +898,8 @@ public abstract class URLConnection
/**
* Returns an unmodifiable Map containing the request properties.
- *
- * @return The map of properties. The map consists of String keys with an
+ *
+ * @return The map of properties. The map consists of String keys with an
* unmodifiable List of String objects as value.
*
* @exception IllegalStateException If already connected
@@ -1074,11 +1074,11 @@ public abstract class URLConnection
handler = factory.createContentHandler(contentType);
// Now try default factory. Using this factory to instantiate built-in
- // content handlers is preferable
+ // content handlers is preferable
if (handler == null)
handler = defaultFactory.createContentHandler(contentType);
- // User-set factory has not returned a handler. Use the default search
+ // User-set factory has not returned a handler. Use the default search
// algorithm.
if (handler == null)
{
@@ -1103,7 +1103,7 @@ public abstract class URLConnection
{
if (cArray[i] == '/')
cArray[i] = '.';
- else if (! ((cArray[i] >= 'A' && cArray[i] <= 'Z') ||
+ else if (! ((cArray[i] >= 'A' && cArray[i] <= 'Z') ||
(cArray[i] >= 'a' && cArray[i] <= 'z') ||
(cArray[i] >= '0' && cArray[i] <= '9')))
cArray[i] = '_';
@@ -1129,7 +1129,7 @@ public abstract class URLConnection
return handler;
}
-
+
// We don't put these in a static initializer, because it creates problems
// with initializer co-dependency: SimpleDateFormat's constructors
// eventually depend on URLConnection (via the java.text.*Symbols classes).
diff --git a/java/net/URLDecoder.java b/java/net/URLDecoder.java
index fb7ab5916..73cedea5c 100644
--- a/java/net/URLDecoder.java
+++ b/java/net/URLDecoder.java
@@ -87,12 +87,12 @@ public class URLDecoder
{
try
{
- return decode(s, "UTF-8");
+ return decode(s, "UTF-8");
}
catch (UnsupportedEncodingException uee)
{
- // Should never happen since UTF-8 encoding should always be supported
- return s;
+ // Should never happen since UTF-8 encoding should always be supported
+ return s;
}
}
@@ -132,45 +132,45 @@ public class URLDecoder
CPStringBuilder result = new CPStringBuilder(length);
while ((i = str.indexOf('%', start)) >= 0)
{
- // Add all non-encoded characters to the result buffer
- result.append(str.substring(start, i));
- start = i;
-
- // Get all consecutive encoded bytes
- while ((i + 2 < length) && (str.charAt(i) == '%'))
- i += 3;
-
- // Decode all these bytes
- if ((bytes == null) || (bytes.length < ((i - start) / 3)))
- bytes = new byte[((i - start) / 3)];
-
- int index = 0;
- try
- {
- while (start < i)
- {
- String sub = str.substring(start + 1, start + 3);
- bytes[index] = (byte) Integer.parseInt(sub, 16);
- index++;
- start += 3;
- }
- }
- catch (NumberFormatException nfe)
- {
- // One of the hex encoded strings was bad
- }
-
- // Add the bytes as characters according to the given encoding
- result.append(new String(bytes, 0, index, encoding));
-
- // Make sure we skip to just after a % sign
- // There might not have been enough encoded characters after the %
- // or the hex chars were not actually hex chars (NumberFormatException)
- if (start < length && s.charAt(start) == '%')
- {
- result.append('%');
- start++;
- }
+ // Add all non-encoded characters to the result buffer
+ result.append(str.substring(start, i));
+ start = i;
+
+ // Get all consecutive encoded bytes
+ while ((i + 2 < length) && (str.charAt(i) == '%'))
+ i += 3;
+
+ // Decode all these bytes
+ if ((bytes == null) || (bytes.length < ((i - start) / 3)))
+ bytes = new byte[((i - start) / 3)];
+
+ int index = 0;
+ try
+ {
+ while (start < i)
+ {
+ String sub = str.substring(start + 1, start + 3);
+ bytes[index] = (byte) Integer.parseInt(sub, 16);
+ index++;
+ start += 3;
+ }
+ }
+ catch (NumberFormatException nfe)
+ {
+ // One of the hex encoded strings was bad
+ }
+
+ // Add the bytes as characters according to the given encoding
+ result.append(new String(bytes, 0, index, encoding));
+
+ // Make sure we skip to just after a % sign
+ // There might not have been enough encoded characters after the %
+ // or the hex chars were not actually hex chars (NumberFormatException)
+ if (start < length && s.charAt(start) == '%')
+ {
+ result.append('%');
+ start++;
+ }
}
// Add any characters left
diff --git a/java/net/URLEncoder.java b/java/net/URLEncoder.java
index 89d9a0bd0..09c0f3de0 100644
--- a/java/net/URLEncoder.java
+++ b/java/net/URLEncoder.java
@@ -83,14 +83,14 @@ public class URLEncoder
{
try
{
- // We default to 8859_1 for compatibility with the same
- // default elsewhere in the library.
- return encode(s, System.getProperty("file.encoding", "8859_1"));
+ // We default to 8859_1 for compatibility with the same
+ // default elsewhere in the library.
+ return encode(s, System.getProperty("file.encoding", "8859_1"));
}
catch (UnsupportedEncodingException uee)
{
- // Should never happen since default should always be supported
- return s;
+ // Should never happen since default should always be supported
+ return s;
}
}
@@ -118,40 +118,40 @@ public class URLEncoder
CPStringBuilder result = new CPStringBuilder(length);
while (true)
{
- while (i < length && isSafe(s.charAt(i)))
- i++;
-
- // Safe character can just be added
- result.append(s.substring(start, i));
-
- // Are we done?
- if (i >= length)
- return result.toString();
- else if (s.charAt(i) == ' ')
- {
- result.append('+'); // Replace space char with plus symbol.
- i++;
- }
- else
- {
- // Get all unsafe characters
- start = i;
- char c;
- while (i < length && (c = s.charAt(i)) != ' ' && ! isSafe(c))
- i++;
-
- // Convert them to %XY encoded strings
- String unsafe = s.substring(start, i);
- byte[] bytes = unsafe.getBytes(encoding);
- for (int j = 0; j < bytes.length; j++)
- {
- result.append('%');
- int val = bytes[j];
- result.append(hex.charAt((val & 0xf0) >> 4));
- result.append(hex.charAt(val & 0x0f));
- }
- }
- start = i;
+ while (i < length && isSafe(s.charAt(i)))
+ i++;
+
+ // Safe character can just be added
+ result.append(s.substring(start, i));
+
+ // Are we done?
+ if (i >= length)
+ return result.toString();
+ else if (s.charAt(i) == ' ')
+ {
+ result.append('+'); // Replace space char with plus symbol.
+ i++;
+ }
+ else
+ {
+ // Get all unsafe characters
+ start = i;
+ char c;
+ while (i < length && (c = s.charAt(i)) != ' ' && ! isSafe(c))
+ i++;
+
+ // Convert them to %XY encoded strings
+ String unsafe = s.substring(start, i);
+ byte[] bytes = unsafe.getBytes(encoding);
+ for (int j = 0; j < bytes.length; j++)
+ {
+ result.append('%');
+ int val = bytes[j];
+ result.append(hex.charAt((val & 0xf0) >> 4));
+ result.append(hex.charAt(val & 0x0f));
+ }
+ }
+ start = i;
}
}
diff --git a/java/net/URLStreamHandler.java b/java/net/URLStreamHandler.java
index 4748191e0..5433aedd9 100644
--- a/java/net/URLStreamHandler.java
+++ b/java/net/URLStreamHandler.java
@@ -131,69 +131,69 @@ public abstract class URLStreamHandler
String userInfo = url.getUserInfo();
String authority = url.getAuthority();
String query = null;
-
+
// On Windows we need to change \ to / for file URLs
char separator = File.separatorChar;
if (url.getProtocol().equals("file") && separator != '/')
{
- file = file.replace(separator, '/');
- spec = spec.replace(separator, '/');
+ file = file.replace(separator, '/');
+ spec = spec.replace(separator, '/');
}
if (spec.regionMatches(start, "//", 0, 2))
{
- String genuineHost;
- int hostEnd;
- int colon;
- int at_host;
-
- start += 2;
- int slash = spec.indexOf('/', start);
- if (slash >= 0)
- hostEnd = slash;
- else
- hostEnd = end;
-
- authority = host = spec.substring(start, hostEnd);
-
- // We first need a genuine host name (with userinfo).
- // So we check for '@': if it's present check the port in the
- // section after '@' in the other case check it in the full string.
- // P.S.: We don't care having '@' at the beginning of the string.
- if ((at_host = host.indexOf('@')) >= 0)
- {
- genuineHost = host.substring(at_host);
- userInfo = host.substring(0, at_host);
- }
- else
- genuineHost = host;
-
- // Look for optional port number. It is valid for the non-port
- // part of the host name to be null (e.g. a URL "http://:80").
- // TBD: JDK 1.2 in this case sets host to null rather than "";
- // this is undocumented and likely an unintended side effect in 1.2
- // so we'll be simple here and stick with "". Note that
- // "http://" or "http:///" produce a "" host in JDK 1.2.
- if ((colon = genuineHost.indexOf(':')) >= 0)
- {
- try
- {
- port = Integer.parseInt(genuineHost.substring(colon + 1));
- }
- catch (NumberFormatException e)
- {
- // Ignore invalid port values; port is already set to u's
- // port.
- }
-
- // Now we must cut the port number in the original string.
- if (at_host >= 0)
- host = host.substring(0, at_host + colon);
- else
- host = host.substring(0, colon);
- }
- file = null;
- start = hostEnd;
+ String genuineHost;
+ int hostEnd;
+ int colon;
+ int at_host;
+
+ start += 2;
+ int slash = spec.indexOf('/', start);
+ if (slash >= 0)
+ hostEnd = slash;
+ else
+ hostEnd = end;
+
+ authority = host = spec.substring(start, hostEnd);
+
+ // We first need a genuine host name (with userinfo).
+ // So we check for '@': if it's present check the port in the
+ // section after '@' in the other case check it in the full string.
+ // P.S.: We don't care having '@' at the beginning of the string.
+ if ((at_host = host.indexOf('@')) >= 0)
+ {
+ genuineHost = host.substring(at_host);
+ userInfo = host.substring(0, at_host);
+ }
+ else
+ genuineHost = host;
+
+ // Look for optional port number. It is valid for the non-port
+ // part of the host name to be null (e.g. a URL "http://:80").
+ // TBD: JDK 1.2 in this case sets host to null rather than "";
+ // this is undocumented and likely an unintended side effect in 1.2
+ // so we'll be simple here and stick with "". Note that
+ // "http://" or "http:///" produce a "" host in JDK 1.2.
+ if ((colon = genuineHost.indexOf(':')) >= 0)
+ {
+ try
+ {
+ port = Integer.parseInt(genuineHost.substring(colon + 1));
+ }
+ catch (NumberFormatException e)
+ {
+ // Ignore invalid port values; port is already set to u's
+ // port.
+ }
+
+ // Now we must cut the port number in the original string.
+ if (at_host >= 0)
+ host = host.substring(0, at_host + colon);
+ else
+ host = host.substring(0, colon);
+ }
+ file = null;
+ start = hostEnd;
}
else if (host == null)
host = "";
@@ -201,49 +201,49 @@ public abstract class URLStreamHandler
if (file == null || file.length() == 0
|| (start < end && spec.charAt(start) == '/'))
{
- // No file context available; just spec for file.
- // Or this is an absolute path name; ignore any file context.
- file = spec.substring(start, end);
- ref = null;
+ // No file context available; just spec for file.
+ // Or this is an absolute path name; ignore any file context.
+ file = spec.substring(start, end);
+ ref = null;
}
else if (start < end)
{
- // Context is available, but only override it if there is a new file.
- int lastSlash = file.lastIndexOf('/');
- if (lastSlash < 0)
- file = spec.substring(start, end);
- else
- file = (file.substring(0, lastSlash)
- + '/' + spec.substring(start, end));
-
- // For URLs constructed relative to a context, we
- // need to canonicalise the file path.
- file = canonicalizeFilename(file);
-
- ref = null;
+ // Context is available, but only override it if there is a new file.
+ int lastSlash = file.lastIndexOf('/');
+ if (lastSlash < 0)
+ file = spec.substring(start, end);
+ else
+ file = (file.substring(0, lastSlash)
+ + '/' + spec.substring(start, end));
+
+ // For URLs constructed relative to a context, we
+ // need to canonicalise the file path.
+ file = canonicalizeFilename(file);
+
+ ref = null;
}
if (ref == null)
{
- // Normally there should be no '#' in the file part,
- // but we are nice.
- int hash = file.indexOf('#');
- if (hash != -1)
- {
- ref = file.substring(hash + 1, file.length());
- file = file.substring(0, hash);
- }
+ // Normally there should be no '#' in the file part,
+ // but we are nice.
+ int hash = file.indexOf('#');
+ if (hash != -1)
+ {
+ ref = file.substring(hash + 1, file.length());
+ file = file.substring(0, hash);
+ }
}
// We care about the query tag only if there is no reference at all.
if (ref == null)
{
- int queryTag = file.indexOf('?');
- if (queryTag != -1)
- {
- query = file.substring(queryTag + 1);
- file = file.substring(0, queryTag);
- }
+ int queryTag = file.indexOf('?');
+ if (queryTag != -1)
+ {
+ query = file.substring(queryTag + 1);
+ file = file.substring(0, queryTag);
+ }
}
// XXX - Classpath used to call PlatformHelper.toCanonicalForm() on
@@ -270,12 +270,12 @@ public abstract class URLStreamHandler
// the general case, but it's probably not bad most of the time.
while ((index = file.indexOf("/../")) >= 0)
{
- // Strip of the previous directory - if it exists.
- int previous = file.lastIndexOf('/', index - 1);
- if (previous >= 0)
- file = file.substring(0, previous) + file.substring(index + 3);
- else
- break;
+ // Strip of the previous directory - if it exists.
+ int previous = file.lastIndexOf('/', index - 1);
+ if (previous >= 0)
+ file = file.substring(0, previous) + file.substring(index + 3);
+ else
+ break;
}
return file;
}
@@ -451,11 +451,11 @@ public abstract class URLStreamHandler
try
{
- return InetAddress.getByName(hostname);
+ return InetAddress.getByName(hostname);
}
catch (UnknownHostException e)
{
- return null;
+ return null;
}
}
@@ -505,7 +505,7 @@ public abstract class URLStreamHandler
authority = url.getAuthority();
if (authority == null)
authority = "";
-
+
file = url.getFile();
ref = url.getRef();
@@ -516,15 +516,15 @@ public abstract class URLStreamHandler
if (protocol.length() > 0)
{
- sb.append(protocol);
- sb.append(":");
+ sb.append(protocol);
+ sb.append(":");
}
-
+
// If we have superfluous leading slashes (that means, at least 2)
// we always add the authority component ("//" + host) to
// avoid ambiguity. Otherwise we would generate an URL like
// proto://home/foo
- // where we meant:
+ // where we meant:
// host: <empty> - file: //home/foo
// but URL spec says it is:
// host: home - file: /foo
diff --git a/java/nio/Buffer.java b/java/nio/Buffer.java
index 5dc670255..023ab0e1d 100644
--- a/java/nio/Buffer.java
+++ b/java/nio/Buffer.java
@@ -1,4 +1,4 @@
-/* Buffer.java --
+/* Buffer.java --
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -57,22 +57,22 @@ public abstract class Buffer
* Should be package private.
*/
Buffer (int capacity, int limit, int position, int mark,
- Pointer address)
+ Pointer address)
{
this.address = address;
if (capacity < 0)
throw new IllegalArgumentException ();
-
+
cap = capacity;
limit (limit);
position (position);
-
+
if (mark >= 0)
{
if (mark > pos)
throw new IllegalArgumentException ();
-
+
this.mark = mark;
}
else
@@ -80,7 +80,7 @@ public abstract class Buffer
this.mark = -1;
}
}
-
+
/**
* Retrieves the capacity of the buffer.
*
@@ -103,7 +103,7 @@ public abstract class Buffer
mark = -1;
return this;
}
-
+
/**
* Flips the buffer.
*
@@ -116,7 +116,7 @@ public abstract class Buffer
mark = -1;
return this;
}
-
+
/**
* Tells whether the buffer has remaining data to read or not.
*
@@ -147,7 +147,7 @@ public abstract class Buffer
/**
* Sets this buffer's limit.
- *
+ *
* @param newLimit The new limit value; must be non-negative and no larger
* than this buffer's capacity.
*
@@ -191,11 +191,11 @@ public abstract class Buffer
{
return pos;
}
-
+
/**
* Sets this buffer's position. If the mark is defined and larger than the
* new position then it is discarded.
- *
+ *
* @param newPosition The new position value; must be non-negative and no
* larger than the current limit.
*
@@ -257,7 +257,7 @@ public abstract class Buffer
/**
* Checks for underflow. This method is used internally to check
- * whether a buffer has enough elements left to satisfy a read
+ * whether a buffer has enough elements left to satisfy a read
* request.
*
* @exception BufferUnderflowException If there are no remaining
@@ -271,12 +271,12 @@ public abstract class Buffer
/**
* Checks for underflow. This method is used internally to check
- * whether a buffer has enough elements left to satisfy a read
+ * whether a buffer has enough elements left to satisfy a read
* request for a given number of elements.
*
* @param length The length of a sequence of elements.
*
- * @exception BufferUnderflowException If there are not enough
+ * @exception BufferUnderflowException If there are not enough
* remaining elements in this buffer.
*/
final void checkForUnderflow(int length)
@@ -287,7 +287,7 @@ public abstract class Buffer
/**
* Checks for overflow. This method is used internally to check
- * whether a buffer has enough space left to satisfy a write
+ * whether a buffer has enough space left to satisfy a write
* request.
*
* @exception BufferOverflowException If there is no remaining
@@ -301,12 +301,12 @@ public abstract class Buffer
/**
* Checks for overflow. This method is used internally to check
- * whether a buffer has enough space left to satisfy a write
+ * whether a buffer has enough space left to satisfy a write
* request for a given number of elements.
*
* @param length The length of a sequence of elements.
*
- * @exception BufferUnderflowException If there is not enough
+ * @exception BufferUnderflowException If there is not enough
* remaining space in this buffer.
*/
final void checkForOverflow(int length)
@@ -316,7 +316,7 @@ public abstract class Buffer
}
/**
- * Checks if index is negative or not smaller than the buffer's
+ * Checks if index is negative or not smaller than the buffer's
* limit. This method is used internally to check whether
* an indexed request can be fulfilled.
*
@@ -338,7 +338,7 @@ public abstract class Buffer
*
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
- final void checkIfReadOnly()
+ final void checkIfReadOnly()
{
if (isReadOnly())
throw new ReadOnlyBufferException ();
diff --git a/java/nio/BufferOverflowException.java b/java/nio/BufferOverflowException.java
index c72ae9238..eac79ed75 100644
--- a/java/nio/BufferOverflowException.java
+++ b/java/nio/BufferOverflowException.java
@@ -1,4 +1,4 @@
-/* BufferOverflowException.java --
+/* BufferOverflowException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/nio/BufferUnderflowException.java b/java/nio/BufferUnderflowException.java
index a6d391e00..76581371b 100644
--- a/java/nio/BufferUnderflowException.java
+++ b/java/nio/BufferUnderflowException.java
@@ -1,4 +1,4 @@
-/* BufferUnderflowException.java --
+/* BufferUnderflowException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/nio/ByteBuffer.java b/java/nio/ByteBuffer.java
index 2296e7174..30c0e7d84 100644
--- a/java/nio/ByteBuffer.java
+++ b/java/nio/ByteBuffer.java
@@ -1,4 +1,4 @@
-/* ByteBuffer.java --
+/* ByteBuffer.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -51,7 +51,7 @@ public abstract class ByteBuffer extends Buffer
final int array_offset;
ByteBuffer (int capacity, int limit, int position, int mark,
- Pointer address, byte[] backing_buffer, int array_offset)
+ Pointer address, byte[] backing_buffer, int array_offset)
{
super (capacity, limit, position, mark, address);
this.backing_buffer = backing_buffer;
@@ -60,7 +60,7 @@ public abstract class ByteBuffer extends Buffer
/**
* Allocates a new direct byte buffer.
- */
+ */
public static ByteBuffer allocateDirect (int capacity)
{
return DirectByteBufferImpl.allocate (capacity);
@@ -102,7 +102,7 @@ public abstract class ByteBuffer extends Buffer
{
return wrap (array, 0, array.length);
}
-
+
/**
* This method transfers <code>byte</code>s from this buffer into the given
* destination array. Before the transfer, it checks if there are fewer than
@@ -185,7 +185,7 @@ public abstract class ByteBuffer extends Buffer
* must be non-negative and no larger than src.length.
* @param length The number of bytes to be read from the given array;
* must be non-negative and no larger than src.length - offset.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>byte</code>s in the source array.
* @exception IndexOutOfBoundsException If the preconditions on the offset
@@ -208,7 +208,7 @@ public abstract class ByteBuffer extends Buffer
* into the buffer.
*
* @param src The array to copy into the buffer.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>byte</code>s in the source array.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -241,7 +241,7 @@ public abstract class ByteBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return backing_buffer;
}
@@ -258,7 +258,7 @@ public abstract class ByteBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return array_offset;
}
@@ -281,8 +281,8 @@ public abstract class ByteBuffer extends Buffer
int multiplier = 1;
for (int i = position() + 1; i < limit(); ++i)
{
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
}
return hashCode;
}
@@ -311,32 +311,32 @@ public abstract class ByteBuffer extends Buffer
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
-
+
for (int count = 0; count < num; count++)
{
byte a = get(pos_this++);
- byte b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
+ byte b = other.get(pos_other++);
+
+ if (a == b)
+ continue;
+
+ if (a < b)
+ return -1;
+
+ return 1;
}
-
+
return remaining() - other.remaining();
}
/**
* Returns the byte order of this buffer.
- */
+ */
public final ByteOrder order ()
{
return endian;
}
-
+
/**
* Modifies this buffer's byte order.
*/
@@ -345,7 +345,7 @@ public abstract class ByteBuffer extends Buffer
this.endian = endian;
return this;
}
-
+
/**
* Reads the <code>byte</code> at this buffer's current position,
* and then increments the position.
@@ -359,7 +359,7 @@ public abstract class ByteBuffer extends Buffer
* Writes the <code>byte</code> at this buffer's current position,
* and then increments the position.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* <code>byte</code>s in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -372,7 +372,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit.
*/
public abstract byte get (int index);
-
+
/**
* Absolute put method.
*
@@ -384,7 +384,7 @@ public abstract class ByteBuffer extends Buffer
/**
* Compacts this buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract ByteBuffer compact ();
@@ -417,32 +417,32 @@ public abstract class ByteBuffer extends Buffer
* buffer's content.
*/
public abstract ByteBuffer asReadOnlyBuffer ();
-
+
/**
* Creates a view of this byte buffer as a short buffer.
*/
public abstract ShortBuffer asShortBuffer ();
-
+
/**
* Creates a view of this byte buffer as a char buffer.
*/
public abstract CharBuffer asCharBuffer ();
-
+
/**
* Creates a view of this byte buffer as an integer buffer.
*/
public abstract IntBuffer asIntBuffer ();
-
+
/**
* Creates a view of this byte buffer as a long buffer.
*/
public abstract LongBuffer asLongBuffer ();
-
+
/**
* Creates a view of this byte buffer as a float buffer.
*/
public abstract FloatBuffer asFloatBuffer ();
-
+
/**
* Creates a view of this byte buffer as a double buffer.
*/
@@ -455,7 +455,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer.
*/
public abstract char getChar ();
-
+
/**
* Relative put method for writing a character value.
*
@@ -463,7 +463,7 @@ public abstract class ByteBuffer extends Buffer
* not smaller than its limit.
*/
public abstract ByteBuffer putChar (char value);
-
+
/**
* Absolute get method for reading a character value.
*
@@ -471,7 +471,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer
*/
public abstract char getChar (int index);
-
+
/**
* Absolute put method for writing a character value.
*
@@ -479,7 +479,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus one.
*/
public abstract ByteBuffer putChar (int index, char value);
-
+
/**
* Relative get method for reading a short value.
*
@@ -487,7 +487,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus one.
*/
public abstract short getShort ();
-
+
/**
* Relative put method for writing a short value.
*
@@ -495,7 +495,7 @@ public abstract class ByteBuffer extends Buffer
* not smaller than its limit.
*/
public abstract ByteBuffer putShort (short value);
-
+
/**
* Absolute get method for reading a short value.
*
@@ -503,7 +503,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer
*/
public abstract short getShort (int index);
-
+
/**
* Absolute put method for writing a short value.
*
@@ -511,7 +511,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus one.
*/
public abstract ByteBuffer putShort (int index, short value);
-
+
/**
* Relative get method for reading an integer value.
*
@@ -519,7 +519,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer.
*/
public abstract int getInt ();
-
+
/**
* Relative put method for writing an integer value.
*
@@ -527,7 +527,7 @@ public abstract class ByteBuffer extends Buffer
* not smaller than its limit.
*/
public abstract ByteBuffer putInt (int value);
-
+
/**
* Absolute get method for reading an integer value.
*
@@ -535,7 +535,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus three.
*/
public abstract int getInt (int index);
-
+
/**
* Absolute put method for writing an integer value.
*
@@ -543,7 +543,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus three.
*/
public abstract ByteBuffer putInt (int index, int value);
-
+
/**
* Relative get method for reading a long value.
*
@@ -551,7 +551,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer.
*/
public abstract long getLong ();
-
+
/**
* Relative put method for writing a long value.
*
@@ -559,7 +559,7 @@ public abstract class ByteBuffer extends Buffer
* not smaller than its limit.
*/
public abstract ByteBuffer putLong (long value);
-
+
/**
* Absolute get method for reading a long value.
*
@@ -567,7 +567,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus seven.
*/
public abstract long getLong (int index);
-
+
/**
* Absolute put method for writing a float value.
*
@@ -575,7 +575,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus seven.
*/
public abstract ByteBuffer putLong (int index, long value);
-
+
/**
* Relative get method for reading a float value.
*
@@ -583,7 +583,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer.
*/
public abstract float getFloat ();
-
+
/**
* Relative put method for writing a float value.
*
@@ -591,7 +591,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer.
*/
public abstract ByteBuffer putFloat (float value);
-
+
/**
* Absolute get method for reading a float value.
*
@@ -599,7 +599,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus three.
*/
public abstract float getFloat (int index);
-
+
/**
* Relative put method for writing a float value.
*
@@ -607,7 +607,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus three.
*/
public abstract ByteBuffer putFloat (int index, float value);
-
+
/**
* Relative get method for reading a double value.
*
@@ -615,7 +615,7 @@ public abstract class ByteBuffer extends Buffer
* remaining in this buffer.
*/
public abstract double getDouble ();
-
+
/**
* Relative put method for writing a double value.
*
@@ -623,7 +623,7 @@ public abstract class ByteBuffer extends Buffer
* not smaller than its limit.
*/
public abstract ByteBuffer putDouble (double value);
-
+
/**
* Absolute get method for reading a double value.
*
@@ -631,7 +631,7 @@ public abstract class ByteBuffer extends Buffer
* than the buffer's limit, minus seven.
*/
public abstract double getDouble (int index);
-
+
/**
* Absolute put method for writing a double value.
*
@@ -646,8 +646,8 @@ public abstract class ByteBuffer extends Buffer
public String toString ()
{
return getClass ().getName () +
- "[pos=" + position () +
- " lim=" + limit () +
- " cap=" + capacity () + "]";
+ "[pos=" + position () +
+ " lim=" + limit () +
+ " cap=" + capacity () + "]";
}
}
diff --git a/java/nio/ByteBufferHelper.java b/java/nio/ByteBufferHelper.java
index 6c46ca5d7..aee007b50 100644
--- a/java/nio/ByteBufferHelper.java
+++ b/java/nio/ByteBufferHelper.java
@@ -1,4 +1,4 @@
-/* ByteBufferImpl.java --
+/* ByteBufferImpl.java --
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,19 +46,19 @@ final class ByteBufferHelper
{
return (char) getShort (buffer, order);
}
-
+
public static void putChar (ByteBuffer buffer, char value, ByteOrder order)
{
putShort (buffer, (short) value, order);
}
-
+
public static char getChar (ByteBuffer buffer, int index, ByteOrder order)
{
return (char) getShort (buffer, index, order);
}
-
+
public static void putChar (ByteBuffer buffer, int index,
- char value, ByteOrder order)
+ char value, ByteOrder order)
{
putShort (buffer, index, (short) value, order);
}
@@ -76,7 +76,7 @@ final class ByteBufferHelper
return (short) ((buffer.get() << 8)
+ (buffer.get() & 0xff));
}
-
+
public static void putShort (ByteBuffer buffer, short value, ByteOrder order)
{
buffer.checkForOverflow(2);
@@ -92,9 +92,9 @@ final class ByteBufferHelper
buffer.put ((byte) value);
}
}
-
+
public static short getShort (ByteBuffer buffer,
- int index, ByteOrder order)
+ int index, ByteOrder order)
{
if (order == ByteOrder.LITTLE_ENDIAN)
{
@@ -105,9 +105,9 @@ final class ByteBufferHelper
return (short) ((buffer.get (index) << 8)
+ (buffer.get (++index) & 0xff));
}
-
+
public static void putShort (ByteBuffer buffer, int index,
- short value, ByteOrder order)
+ short value, ByteOrder order)
{
if (order == ByteOrder.LITTLE_ENDIAN)
{
@@ -138,7 +138,7 @@ final class ByteBufferHelper
+ ((buffer.get() & 0xff) << 8)
+ (buffer.get() & 0xff));
}
-
+
public static void putInt (ByteBuffer buffer, int value, ByteOrder order)
{
buffer.checkForOverflow(4);
@@ -158,7 +158,7 @@ final class ByteBufferHelper
buffer.put ((byte) value);
}
}
-
+
public static int getInt (ByteBuffer buffer, int index, ByteOrder order)
{
if (order == ByteOrder.LITTLE_ENDIAN)
@@ -174,9 +174,9 @@ final class ByteBufferHelper
+ ((buffer.get (++index) & 0xff) << 8)
+ (buffer.get (++index) & 0xff));
}
-
+
public static void putInt (ByteBuffer buffer, int index,
- int value, ByteOrder order)
+ int value, ByteOrder order)
{
if (order == ByteOrder.LITTLE_ENDIAN)
{
@@ -219,7 +219,7 @@ final class ByteBufferHelper
+ ((buffer.get() & 0xff) << 8)
+ (buffer.get() & 0xff));
}
-
+
public static void putLong (ByteBuffer buffer, long value, ByteOrder order)
{
buffer.checkForOverflow(8);
@@ -247,7 +247,7 @@ final class ByteBufferHelper
buffer.put ((byte) value);
}
}
-
+
public static long getLong (ByteBuffer buffer, int index, ByteOrder order)
{
if (order == ByteOrder.LITTLE_ENDIAN)
@@ -271,9 +271,9 @@ final class ByteBufferHelper
+ ((buffer.get (++index) & 0xff) << 8)
+ (buffer.get (++index) & 0xff));
}
-
+
public static void putLong (ByteBuffer buffer, int index,
- long value, ByteOrder order)
+ long value, ByteOrder order)
{
if (order == ByteOrder.LITTLE_ENDIAN)
{
@@ -303,19 +303,19 @@ final class ByteBufferHelper
{
return Float.intBitsToFloat (getInt (buffer, order));
}
-
+
public static void putFloat (ByteBuffer buffer, float value, ByteOrder order)
{
putInt (buffer, Float.floatToRawIntBits (value), order);
}
-
+
public static float getFloat (ByteBuffer buffer, int index, ByteOrder order)
{
return Float.intBitsToFloat (getInt (buffer, index, order));
}
public static void putFloat (ByteBuffer buffer, int index,
- float value, ByteOrder order)
+ float value, ByteOrder order)
{
putInt (buffer, index, Float.floatToRawIntBits (value), order);
}
@@ -329,16 +329,15 @@ final class ByteBufferHelper
{
putLong (buffer, Double.doubleToRawLongBits (value), order);
}
-
+
public static double getDouble (ByteBuffer buffer, int index, ByteOrder order)
{
return Double.longBitsToDouble (getLong (buffer, index, order));
}
-
+
public static void putDouble (ByteBuffer buffer, int index,
- double value, ByteOrder order)
+ double value, ByteOrder order)
{
putLong (buffer, index, Double.doubleToRawLongBits (value), order);
}
} // ByteBufferHelper
-
diff --git a/java/nio/ByteBufferImpl.java b/java/nio/ByteBufferImpl.java
index 6a1ac4681..2bf319220 100644
--- a/java/nio/ByteBufferImpl.java
+++ b/java/nio/ByteBufferImpl.java
@@ -1,4 +1,4 @@
-/* ByteBufferImpl.java --
+/* ByteBufferImpl.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,12 +46,12 @@ final class ByteBufferImpl extends ByteBuffer
private final boolean readOnly;
ByteBufferImpl (byte[] buffer, int offset, int capacity, int limit,
- int position, int mark, boolean readOnly)
+ int position, int mark, boolean readOnly)
{
super (capacity, limit, position, mark, null, buffer, offset);
this.readOnly = readOnly;
}
-
+
public CharBuffer asCharBuffer ()
{
return new CharViewBufferImpl (this, remaining() >> 1);
@@ -86,30 +86,30 @@ final class ByteBufferImpl extends ByteBuffer
{
return readOnly;
}
-
+
public ByteBuffer slice ()
{
return new ByteBufferImpl (backing_buffer, array_offset + position (),
- remaining (), remaining (), 0, -1, isReadOnly ());
+ remaining (), remaining (), 0, -1, isReadOnly ());
}
-
+
public ByteBuffer duplicate ()
{
return new ByteBufferImpl (backing_buffer, array_offset, capacity (),
- limit (), position (), mark, isReadOnly ());
+ limit (), position (), mark, isReadOnly ());
}
-
+
public ByteBuffer asReadOnlyBuffer ()
{
return new ByteBufferImpl (backing_buffer, array_offset, capacity (),
- limit (), position (), mark, true);
+ limit (), position (), mark, true);
}
-
+
void shiftDown (int dst_offset, int src_offset, int count)
{
System.arraycopy(backing_buffer, array_offset + src_offset,
- backing_buffer, array_offset + dst_offset,
- count);
+ backing_buffer, array_offset + dst_offset,
+ count);
}
public ByteBuffer compact ()
@@ -124,7 +124,7 @@ final class ByteBufferImpl extends ByteBuffer
limit(capacity());
return this;
}
-
+
public boolean isDirect ()
{
return false;
@@ -154,8 +154,8 @@ final class ByteBufferImpl extends ByteBuffer
if ( (limit - pos) < length) // check for overflow
throw new BufferUnderflowException();
- System.arraycopy(backing_buffer, pos + array_offset,
- dst, offset, length);
+ System.arraycopy(backing_buffer, pos + array_offset,
+ dst, offset, length);
pos += length;
return this;
@@ -194,7 +194,7 @@ final class ByteBufferImpl extends ByteBuffer
backing_buffer [(pos++) + array_offset] = value;
return this;
}
-
+
/**
* Absolute get method. Reads the <code>byte</code> at position
* <code>index</code>.
@@ -208,7 +208,7 @@ final class ByteBufferImpl extends ByteBuffer
return backing_buffer [index + array_offset];
}
-
+
/**
* Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
@@ -225,12 +225,12 @@ final class ByteBufferImpl extends ByteBuffer
backing_buffer [index + array_offset] = value;
return this;
}
-
+
public char getChar ()
{
return ByteBufferHelper.getChar(this, order());
}
-
+
public ByteBuffer putChar (char value)
{
if (readOnly)
@@ -250,12 +250,12 @@ final class ByteBufferImpl extends ByteBuffer
}
return this;
}
-
+
public char getChar (int index)
{
return ByteBufferHelper.getChar(this, index, order());
}
-
+
public ByteBuffer putChar (int index, char value)
{
ByteBufferHelper.putChar(this, index, value, order());
@@ -266,18 +266,18 @@ final class ByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getShort(this, order());
}
-
+
public ByteBuffer putShort (short value)
{
ByteBufferHelper.putShort(this, value, order());
return this;
}
-
+
public short getShort (int index)
{
return ByteBufferHelper.getShort(this, index, order());
}
-
+
public ByteBuffer putShort (int index, short value)
{
ByteBufferHelper.putShort(this, index, value, order());
@@ -288,18 +288,18 @@ final class ByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getInt(this, order());
}
-
+
public ByteBuffer putInt (int value)
{
ByteBufferHelper.putInt(this, value, order());
return this;
}
-
+
public int getInt (int index)
{
return ByteBufferHelper.getInt(this, index, order());
}
-
+
public ByteBuffer putInt (int index, int value)
{
ByteBufferHelper.putInt(this, index, value, order());
@@ -310,18 +310,18 @@ final class ByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getLong(this, order());
}
-
+
public ByteBuffer putLong (long value)
{
ByteBufferHelper.putLong (this, value, order());
return this;
}
-
+
public long getLong (int index)
{
return ByteBufferHelper.getLong (this, index, order());
}
-
+
public ByteBuffer putLong (int index, long value)
{
ByteBufferHelper.putLong (this, index, value, order());
@@ -332,13 +332,13 @@ final class ByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getFloat (this, order());
}
-
+
public ByteBuffer putFloat (float value)
{
ByteBufferHelper.putFloat (this, value, order());
return this;
}
-
+
public float getFloat (int index)
{
return ByteBufferHelper.getFloat (this, index, order());
@@ -360,12 +360,12 @@ final class ByteBufferImpl extends ByteBuffer
ByteBufferHelper.putDouble (this, value, order());
return this;
}
-
+
public double getDouble (int index)
{
return ByteBufferHelper.getDouble (this, index, order());
}
-
+
public ByteBuffer putDouble (int index, double value)
{
ByteBufferHelper.putDouble (this, index, value, order());
diff --git a/java/nio/ByteOrder.java b/java/nio/ByteOrder.java
index 0e3b9173e..364aa1829 100644
--- a/java/nio/ByteOrder.java
+++ b/java/nio/ByteOrder.java
@@ -1,4 +1,4 @@
-/* ByteOrder.java --
+/* ByteOrder.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/nio/CharBuffer.java b/java/nio/CharBuffer.java
index faee773bd..0176a2c4d 100644
--- a/java/nio/CharBuffer.java
+++ b/java/nio/CharBuffer.java
@@ -1,4 +1,4 @@
-/* CharBuffer.java --
+/* CharBuffer.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ public abstract class CharBuffer extends Buffer
final char[] backing_buffer;
CharBuffer (int capacity, int limit, int position, int mark,
- Pointer address, char[] backing_buffer, int array_offset)
+ Pointer address, char[] backing_buffer, int array_offset)
{
super (capacity, limit, position, mark, address);
this.backing_buffer = backing_buffer;
@@ -76,16 +76,16 @@ public abstract class CharBuffer extends Buffer
* @param length the length of the region in the array to wrap
*
* @return a new <code>CharBuffer</code> object
- *
+ *
* @exception IndexOutOfBoundsException If the preconditions on the offset
* and length parameters do not hold
*/
public static final CharBuffer wrap(char[] array, int offset, int length)
{
return new CharBufferImpl(array, 0, array.length, offset + length, offset,
- -1, false);
+ -1, false);
}
-
+
/**
* Wraps a character sequence into a <code>CharBuffer</code> object.
*
@@ -97,16 +97,16 @@ public abstract class CharBuffer extends Buffer
{
return wrap(seq, 0, seq.length());
}
-
+
/**
* Wraps a character sequence into a <code>CharBuffer</code> object.
- *
+ *
* @param seq the sequence to wrap
* @param start the index of the first character to wrap
* @param end the index of the first character not to wrap
*
* @return a new <code>CharBuffer</code> object
- *
+ *
* @exception IndexOutOfBoundsException If the preconditions on the offset
* and length parameters do not hold
*/
@@ -127,11 +127,11 @@ public abstract class CharBuffer extends Buffer
{
return wrap(array, 0, array.length);
}
-
+
/**
* This method transfers <code>char</code>s from this buffer into the given
* destination array. Before the transfer, it checks if there are fewer than
- * length <code>char</code>s remaining in this buffer.
+ * length <code>char</code>s remaining in this buffer.
*
* @param dst The destination array
* @param offset The offset within the array of the first <code>char</code>
@@ -206,7 +206,7 @@ public abstract class CharBuffer extends Buffer
{
char[] toPut = new char [src.remaining ()];
src.get (toPut);
- put (toPut);
+ put (toPut);
}
return this;
@@ -222,7 +222,7 @@ public abstract class CharBuffer extends Buffer
* must be non-negative and no larger than src.length.
* @param length The number of bytes to be read from the given array;
* must be non-negative and no larger than src.length - offset.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>char</code>s in the source array.
* @exception IndexOutOfBoundsException If the preconditions on the offset
@@ -233,7 +233,7 @@ public abstract class CharBuffer extends Buffer
{
checkArraySize(src.length, offset, length);
checkForOverflow(length);
-
+
for (int i = offset; i < offset + length; i++)
put (src [i]);
@@ -245,7 +245,7 @@ public abstract class CharBuffer extends Buffer
* into the buffer.
*
* @param src The array to copy into the buffer.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>char</code>s in the source array.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -295,7 +295,7 @@ public abstract class CharBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return array_offset;
}
@@ -316,8 +316,8 @@ public abstract class CharBuffer extends Buffer
int multiplier = 1;
for (int i = position() + 1; i < limit(); ++i)
{
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
}
return hashCode;
}
@@ -346,21 +346,21 @@ public abstract class CharBuffer extends Buffer
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
-
+
for (int count = 0; count < num; count++)
{
- char a = get(pos_this++);
- char b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
+ char a = get(pos_this++);
+ char b = other.get(pos_other++);
+
+ if (a == b)
+ continue;
+
+ if (a < b)
+ return -1;
+
+ return 1;
}
-
+
return remaining() - other.remaining();
}
@@ -382,7 +382,7 @@ public abstract class CharBuffer extends Buffer
* Writes the <code>char</code> at this buffer's current position,
* and then increments the position.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* <code>char</code>s in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -395,7 +395,7 @@ public abstract class CharBuffer extends Buffer
* than the buffer's limit.
*/
public abstract char get (int index);
-
+
/**
* Absolute put method.
*
@@ -407,7 +407,7 @@ public abstract class CharBuffer extends Buffer
/**
* Compacts this buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract CharBuffer compact ();
@@ -434,7 +434,7 @@ public abstract class CharBuffer extends Buffer
* buffer's content.
*/
public abstract CharBuffer asReadOnlyBuffer ();
-
+
/**
* Returns the remaining content of the buffer as a string.
*/
@@ -454,7 +454,7 @@ public abstract class CharBuffer extends Buffer
* Returns the length of the remaining chars in this buffer.
*/
public final int length ()
- {
+ {
return remaining ();
}
@@ -469,7 +469,7 @@ public abstract class CharBuffer extends Buffer
/**
* Relative put method.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer.
* @exception IndexOutOfBoundsException If the preconditions on the start
@@ -480,10 +480,10 @@ public abstract class CharBuffer extends Buffer
{
return put (str.toCharArray (), start, length);
}
-
+
/**
* Relative put method.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -492,10 +492,10 @@ public abstract class CharBuffer extends Buffer
{
return put (str.toCharArray (), 0, str.length ());
}
-
+
/**
* Returns the character at <code>position() + index</code>.
- *
+ *
* @exception IndexOutOfBoundsException If index is negative not smaller than
* <code>remaining()</code>.
*/
@@ -504,7 +504,7 @@ public abstract class CharBuffer extends Buffer
if (index < 0
|| index >= remaining ())
throw new IndexOutOfBoundsException ();
-
+
return get (position () + index);
}
diff --git a/java/nio/CharBufferImpl.java b/java/nio/CharBufferImpl.java
index d35ca5962..8df9dbbea 100644
--- a/java/nio/CharBufferImpl.java
+++ b/java/nio/CharBufferImpl.java
@@ -1,4 +1,4 @@
-/* CharBufferImpl.java --
+/* CharBufferImpl.java --
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,39 +49,39 @@ final class CharBufferImpl extends CharBuffer
{
this (new char [capacity], 0, capacity, capacity, 0, -1, false);
}
-
+
CharBufferImpl (char[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
{
super (capacity, limit, position, mark, null, buffer, offset);
this.readOnly = readOnly;
}
-
+
public CharBufferImpl (CharBufferImpl copy)
{
super (copy.capacity (), copy.limit (), copy.position (), 0, null, copy.backing_buffer, copy.array_offset);
this.readOnly = copy.isReadOnly ();
}
-
+
public boolean isReadOnly ()
{
return readOnly;
}
-
+
public CharBuffer slice ()
{
return new CharBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
}
-
+
public CharBuffer duplicate ()
{
return new CharBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
}
-
+
public CharBuffer asReadOnlyBuffer ()
{
return new CharBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
}
-
+
public CharBuffer compact ()
{
checkIfReadOnly();
@@ -97,7 +97,7 @@ final class CharBufferImpl extends CharBuffer
limit(capacity());
return this;
}
-
+
public boolean isDirect ()
{
return false;
@@ -113,7 +113,7 @@ final class CharBufferImpl extends CharBuffer
return new CharBufferImpl (backing_buffer, array_offset, capacity (), position () + end, position () + start, -1, isReadOnly ());
}
-
+
/**
* Reads the <code>char</code> at this buffer's current position,
* and then increments the position.
@@ -128,11 +128,11 @@ final class CharBufferImpl extends CharBuffer
return backing_buffer [(pos++) + array_offset];
}
-
+
/**
* Relative put method. Writes <code>value</code> to the next position
* in the buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public CharBuffer put (char value)
@@ -145,7 +145,7 @@ final class CharBufferImpl extends CharBuffer
backing_buffer [(pos++) + array_offset] = value;
return this;
}
-
+
/**
* Absolute get method. Reads the <code>char</code> at position
* <code>index</code>.
@@ -158,10 +158,10 @@ final class CharBufferImpl extends CharBuffer
public char get (int index)
{
checkIndex(index);
-
+
return backing_buffer [index + array_offset];
}
-
+
/**
* Bulk get, overloaded for speed.
*/
@@ -170,8 +170,8 @@ final class CharBufferImpl extends CharBuffer
checkArraySize(dst.length, offset, length);
checkForUnderflow(length);
- System.arraycopy(backing_buffer, pos + array_offset,
- dst, offset, length);
+ System.arraycopy(backing_buffer, pos + array_offset,
+ dst, offset, length);
pos += length;
return this;
}
@@ -183,9 +183,9 @@ final class CharBufferImpl extends CharBuffer
{
checkArraySize(src.length, offset, length);
checkForOverflow(length);
-
+
System.arraycopy(src, offset,
- backing_buffer, pos + array_offset, length);
+ backing_buffer, pos + array_offset, length);
pos += length;
return this;
}
@@ -202,11 +202,11 @@ final class CharBufferImpl extends CharBuffer
{
checkIndex(index);
checkIfReadOnly();
-
+
backing_buffer [index + array_offset] = value;
return this;
}
-
+
public ByteOrder order ()
{
return ByteOrder.nativeOrder ();
diff --git a/java/nio/CharSequenceBuffer.java b/java/nio/CharSequenceBuffer.java
index 3003670d8..95c37cc97 100644
--- a/java/nio/CharSequenceBuffer.java
+++ b/java/nio/CharSequenceBuffer.java
@@ -1,4 +1,4 @@
-/* CharBuffer.java --
+/* CharBuffer.java --
Copyright (C) 2007 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -86,7 +86,7 @@ final class CharSequenceBuffer
public CharBuffer asReadOnlyBuffer()
{
return duplicate();
- }
+ }
/**
* This buffer class is not writable by definition and thus throws
diff --git a/java/nio/CharViewBufferImpl.java b/java/nio/CharViewBufferImpl.java
index 98a27a6e6..72e344d66 100644
--- a/java/nio/CharViewBufferImpl.java
+++ b/java/nio/CharViewBufferImpl.java
@@ -1,4 +1,4 @@
-/* CharViewBufferImpl.java --
+/* CharViewBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,25 +45,25 @@ class CharViewBufferImpl extends CharBuffer
private final ByteBuffer bb;
private final boolean readOnly;
private final ByteOrder endian;
-
+
CharViewBufferImpl (ByteBuffer bb, int capacity)
{
super (capacity, capacity, 0, -1, bb.isDirect() ?
VMDirectByteBuffer.adjustAddress(bb.address, bb.position()) : null,
- null, 0);
+ null, 0);
this.bb = bb;
this.offset = bb.position();
this.readOnly = bb.isReadOnly();
this.endian = bb.order();
}
-
+
public CharViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (capacity, limit, position, mark, bb.isDirect() ?
VMDirectByteBuffer.adjustAddress(bb.address, offset) : null,
- null, 0);
+ null, 0);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
@@ -106,7 +106,7 @@ class CharViewBufferImpl extends CharBuffer
position(p + 1);
return this;
}
-
+
public CharBuffer put (int index, char value)
{
ByteBufferHelper.putChar(bb, (index << 1) + offset, value, endian);
@@ -118,26 +118,26 @@ class CharViewBufferImpl extends CharBuffer
if (position () > 0)
{
int count = limit () - position ();
- bb.shiftDown(offset, offset + 2 * position(), 2 * count);
+ bb.shiftDown(offset, offset + 2 * position(), 2 * count);
position (count);
limit (capacity ());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
-
+
public CharBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new CharViewBufferImpl (bb, (position () << 1) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly (), endian);
+ remaining (), remaining (), 0, -1,
+ isReadOnly (), endian);
}
-
+
CharBuffer duplicate (boolean readOnly)
{
int pos = position();
@@ -147,7 +147,7 @@ class CharViewBufferImpl extends CharBuffer
return new CharViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
-
+
public CharBuffer duplicate ()
{
return duplicate(readOnly);
@@ -166,20 +166,20 @@ class CharViewBufferImpl extends CharBuffer
throw new IndexOutOfBoundsException ();
return new CharViewBufferImpl (bb, array_offset, capacity (),
- position () + end, position () + start,
- -1, isReadOnly (), endian);
+ position () + end, position () + start,
+ -1, isReadOnly (), endian);
}
public boolean isReadOnly ()
{
return readOnly;
}
-
+
public boolean isDirect ()
{
return bb.isDirect ();
}
-
+
public ByteOrder order ()
{
return endian;
diff --git a/java/nio/DirectByteBufferImpl.java b/java/nio/DirectByteBufferImpl.java
index 939718e9c..4f34732a8 100644
--- a/java/nio/DirectByteBufferImpl.java
+++ b/java/nio/DirectByteBufferImpl.java
@@ -1,4 +1,4 @@
-/* DirectByteBufferImpl.java --
+/* DirectByteBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -60,8 +60,8 @@ abstract class DirectByteBufferImpl extends ByteBuffer
static final class ReadOnly extends DirectByteBufferImpl
{
ReadOnly(Object owner, Pointer address,
- int capacity, int limit,
- int position)
+ int capacity, int limit,
+ int position)
{
super(owner, address, capacity, limit, position);
}
@@ -93,10 +93,10 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
super(address, capacity);
}
-
+
ReadWrite(Object owner, Pointer address,
- int capacity, int limit,
- int position)
+ int capacity, int limit,
+ int position)
{
super(owner, address, capacity, limit, position);
}
@@ -110,7 +110,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
DirectByteBufferImpl(int capacity)
{
super(capacity, capacity, 0, -1,
- VMDirectByteBuffer.allocate(capacity), null, 0);
+ VMDirectByteBuffer.allocate(capacity), null, 0);
this.owner = this;
}
@@ -119,10 +119,10 @@ abstract class DirectByteBufferImpl extends ByteBuffer
super(capacity, capacity, 0, -1, address, null, 0);
this.owner = null;
}
-
+
DirectByteBufferImpl(Object owner, Pointer address,
- int capacity, int limit,
- int position)
+ int capacity, int limit,
+ int position)
{
super(capacity, limit, position, -1, address, null, 0);
this.owner = owner;
@@ -130,7 +130,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
/**
* Allocates a new direct byte buffer.
- */
+ */
public static ByteBuffer allocate(int capacity)
{
return new DirectByteBufferImpl.ReadWrite(capacity);
@@ -141,7 +141,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
if (owner == this)
VMDirectByteBuffer.free(address);
}
-
+
public byte get()
{
checkForUnderflow();
@@ -180,7 +180,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
position(pos + 1);
return this;
}
-
+
public ByteBuffer put(int index, byte value)
{
checkIndex(index);
@@ -188,7 +188,7 @@ abstract class DirectByteBufferImpl extends ByteBuffer
VMDirectByteBuffer.put(address, index, value);
return this;
}
-
+
public ByteBuffer put (byte[] src, int offset, int length)
{
checkArraySize (src.length, offset, length);
@@ -196,15 +196,15 @@ abstract class DirectByteBufferImpl extends ByteBuffer
int index = position ();
VMDirectByteBuffer.put (address, index, src, offset, length);
position (index + length);
-
+
return this;
}
-
+
void shiftDown(int dst_offset, int src_offset, int count)
{
VMDirectByteBuffer.shiftDown(address, dst_offset, src_offset, count);
}
-
+
public ByteBuffer compact()
{
checkIfReadOnly();
@@ -212,15 +212,15 @@ abstract class DirectByteBufferImpl extends ByteBuffer
int pos = position();
if (pos > 0)
{
- int count = remaining();
- VMDirectByteBuffer.shiftDown(address, 0, pos, count);
- position(count);
- limit(capacity());
+ int count = remaining();
+ VMDirectByteBuffer.shiftDown(address, 0, pos, count);
+ position(count);
+ limit(capacity());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
@@ -255,9 +255,9 @@ abstract class DirectByteBufferImpl extends ByteBuffer
if (mark != pos)
{
- result.position(mark);
- result.mark();
- result.position(pos);
+ result.position(mark);
+ result.mark();
+ result.position(pos);
}
return result;
}
@@ -311,18 +311,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getChar(this, order());
}
-
+
public ByteBuffer putChar(char value)
{
ByteBufferHelper.putChar(this, value, order());
return this;
}
-
+
public char getChar(int index)
{
return ByteBufferHelper.getChar(this, index, order());
}
-
+
public ByteBuffer putChar(int index, char value)
{
ByteBufferHelper.putChar(this, index, value, order());
@@ -333,18 +333,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getShort(this, order());
}
-
+
public ByteBuffer putShort(short value)
{
ByteBufferHelper.putShort(this, value, order());
return this;
}
-
+
public short getShort(int index)
{
return ByteBufferHelper.getShort(this, index, order());
}
-
+
public ByteBuffer putShort(int index, short value)
{
ByteBufferHelper.putShort(this, index, value, order());
@@ -355,18 +355,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getInt(this, order());
}
-
+
public ByteBuffer putInt(int value)
{
ByteBufferHelper.putInt(this, value, order());
return this;
}
-
+
public int getInt(int index)
{
return ByteBufferHelper.getInt(this, index, order());
}
-
+
public ByteBuffer putInt(int index, int value)
{
ByteBufferHelper.putInt(this, index, value, order());
@@ -377,18 +377,18 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getLong(this, order());
}
-
+
public ByteBuffer putLong(long value)
{
ByteBufferHelper.putLong(this, value, order());
return this;
}
-
+
public long getLong(int index)
{
return ByteBufferHelper.getLong(this, index, order());
}
-
+
public ByteBuffer putLong(int index, long value)
{
ByteBufferHelper.putLong(this, index, value, order());
@@ -399,13 +399,13 @@ abstract class DirectByteBufferImpl extends ByteBuffer
{
return ByteBufferHelper.getFloat(this, order());
}
-
+
public ByteBuffer putFloat(float value)
{
ByteBufferHelper.putFloat(this, value, order());
return this;
}
-
+
public float getFloat(int index)
{
return ByteBufferHelper.getFloat(this, index, order());
@@ -427,12 +427,12 @@ abstract class DirectByteBufferImpl extends ByteBuffer
ByteBufferHelper.putDouble(this, value, order());
return this;
}
-
+
public double getDouble(int index)
{
return ByteBufferHelper.getDouble(this, index, order());
}
-
+
public ByteBuffer putDouble(int index, double value)
{
ByteBufferHelper.putDouble(this, index, value, order());
diff --git a/java/nio/DoubleBuffer.java b/java/nio/DoubleBuffer.java
index ffbf1ac3a..fc8c301e9 100644
--- a/java/nio/DoubleBuffer.java
+++ b/java/nio/DoubleBuffer.java
@@ -1,4 +1,4 @@
-/* DoubleBuffer.java --
+/* DoubleBuffer.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ public abstract class DoubleBuffer extends Buffer
final double[] backing_buffer;
DoubleBuffer (int capacity, int limit, int position, int mark,
- Pointer address, double[] backing_buffer, int array_offset)
+ Pointer address, double[] backing_buffer, int array_offset)
{
super (capacity, limit, position, mark, address);
this.backing_buffer = backing_buffer;
@@ -85,11 +85,11 @@ public abstract class DoubleBuffer extends Buffer
{
return wrap (array, 0, array.length);
}
-
+
/**
* This method transfers <code>double</code>s from this buffer into the given
* destination array. Before the transfer, it checks if there are fewer than
- * length <code>double</code>s remaining in this buffer.
+ * length <code>double</code>s remaining in this buffer.
*
* @param dst The destination array
* @param offset The offset within the array of the first <code>double</code>
@@ -168,7 +168,7 @@ public abstract class DoubleBuffer extends Buffer
* must be non-negative and no larger than src.length.
* @param length The number of bytes to be read from the given array;
* must be non-negative and no larger than src.length - offset.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>double</code>s in the source array.
* @exception IndexOutOfBoundsException If the preconditions on the offset
@@ -191,7 +191,7 @@ public abstract class DoubleBuffer extends Buffer
* into the buffer.
*
* @param src The array to copy into the buffer.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>double</code>s in the source array.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -224,7 +224,7 @@ public abstract class DoubleBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return backing_buffer;
}
@@ -241,7 +241,7 @@ public abstract class DoubleBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return array_offset;
}
@@ -253,7 +253,7 @@ public abstract class DoubleBuffer extends Buffer
* <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
* (s[limit()-1]+30)*31**(limit()-1)</code>.
* Where s is the buffer data, in Double.doubleToLongBits() form
- * Note that the hashcode is dependent on buffer content,
+ * Note that the hashcode is dependent on buffer content,
* and therefore is not useful if the buffer content may change.
*
* @return the hash code (casted to int)
@@ -264,8 +264,8 @@ public abstract class DoubleBuffer extends Buffer
long multiplier = 1;
for (int i = position() + 1; i < limit(); ++i)
{
- multiplier *= 31;
- hashCode += (Double.doubleToLongBits(get(i)) + 30)*multiplier;
+ multiplier *= 31;
+ hashCode += (Double.doubleToLongBits(get(i)) + 30)*multiplier;
}
return ((int)hashCode);
}
@@ -294,21 +294,21 @@ public abstract class DoubleBuffer extends Buffer
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
-
+
for (int count = 0; count < num; count++)
{
- double a = get(pos_this++);
- double b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
+ double a = get(pos_this++);
+ double b = other.get(pos_other++);
+
+ if (a == b)
+ continue;
+
+ if (a < b)
+ return -1;
+
+ return 1;
}
-
+
return remaining() - other.remaining();
}
@@ -330,7 +330,7 @@ public abstract class DoubleBuffer extends Buffer
* Writes the <code>double</code> at this buffer's current position,
* and then increments the position.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* <code>double</code>s in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -343,7 +343,7 @@ public abstract class DoubleBuffer extends Buffer
* than the buffer's limit.
*/
public abstract double get (int index);
-
+
/**
* Absolute put method.
*
@@ -355,7 +355,7 @@ public abstract class DoubleBuffer extends Buffer
/**
* Compacts this buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract DoubleBuffer compact ();
diff --git a/java/nio/DoubleBufferImpl.java b/java/nio/DoubleBufferImpl.java
index bc292df64..160841353 100644
--- a/java/nio/DoubleBufferImpl.java
+++ b/java/nio/DoubleBufferImpl.java
@@ -1,4 +1,4 @@
-/* DoubleBufferImpl.java --
+/* DoubleBufferImpl.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,37 +49,37 @@ final class DoubleBufferImpl extends DoubleBuffer
{
this (new double [capacity], 0, capacity, capacity, 0, -1, false);
}
-
+
DoubleBufferImpl (double[] buffer, int offset, int capacity, int limit,
- int position, int mark, boolean readOnly)
+ int position, int mark, boolean readOnly)
{
super (capacity, limit, position, mark, null, buffer, offset);
this.readOnly = readOnly;
}
-
+
public boolean isReadOnly ()
{
return readOnly;
}
-
+
public DoubleBuffer slice ()
{
return new DoubleBufferImpl (backing_buffer, array_offset + position (),
- remaining (), remaining (), 0, -1, isReadOnly ());
+ remaining (), remaining (), 0, -1, isReadOnly ());
}
-
+
public DoubleBuffer duplicate ()
{
return new DoubleBufferImpl (backing_buffer, array_offset, capacity (),
- limit (), position (), mark, isReadOnly ());
+ limit (), position (), mark, isReadOnly ());
}
-
+
public DoubleBuffer asReadOnlyBuffer ()
{
return new DoubleBufferImpl (backing_buffer, array_offset, capacity (),
- limit (), position (), mark, true);
+ limit (), position (), mark, true);
}
-
+
public DoubleBuffer compact ()
{
checkIfReadOnly();
@@ -95,7 +95,7 @@ final class DoubleBufferImpl extends DoubleBuffer
limit(capacity());
return this;
}
-
+
public boolean isDirect ()
{
return false;
@@ -116,12 +116,12 @@ final class DoubleBufferImpl extends DoubleBuffer
position (position () + 1);
return result;
}
-
+
/**
* Relative put method. Writes <code>value</code> to the next position
* in the buffer.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* space in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -129,12 +129,12 @@ final class DoubleBufferImpl extends DoubleBuffer
{
checkIfReadOnly();
checkForOverflow();
-
+
backing_buffer [position ()] = value;
position (position () + 1);
return this;
}
-
+
/**
* Absolute get method. Reads the <code>double</code> at position
* <code>index</code>.
@@ -148,7 +148,7 @@ final class DoubleBufferImpl extends DoubleBuffer
return backing_buffer [index];
}
-
+
/**
* Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
@@ -165,7 +165,7 @@ final class DoubleBufferImpl extends DoubleBuffer
backing_buffer [index] = value;
return this;
}
-
+
public ByteOrder order ()
{
return ByteOrder.nativeOrder ();
diff --git a/java/nio/DoubleViewBufferImpl.java b/java/nio/DoubleViewBufferImpl.java
index d82fa92c4..a78bf2738 100644
--- a/java/nio/DoubleViewBufferImpl.java
+++ b/java/nio/DoubleViewBufferImpl.java
@@ -1,4 +1,4 @@
-/* DoubleViewBufferImpl.java --
+/* DoubleViewBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ final class DoubleViewBufferImpl extends DoubleBuffer
private final ByteBuffer bb;
private final boolean readOnly;
private final ByteOrder endian;
-
+
DoubleViewBufferImpl (ByteBuffer bb, int capacity)
{
super (capacity, capacity, 0, -1, bb.isDirect() ?
@@ -55,7 +55,7 @@ final class DoubleViewBufferImpl extends DoubleBuffer
this.readOnly = bb.isReadOnly();
this.endian = bb.order();
}
-
+
public DoubleViewBufferImpl (ByteBuffer bb, int offset, int capacity,
int limit, int position, int mark,
boolean readOnly, ByteOrder endian)
@@ -102,7 +102,7 @@ final class DoubleViewBufferImpl extends DoubleBuffer
position(p + 1);
return this;
}
-
+
public DoubleBuffer put (int index, double value)
{
ByteBufferHelper.putDouble(bb, (index << 3) + offset, value, endian);
@@ -114,25 +114,25 @@ final class DoubleViewBufferImpl extends DoubleBuffer
if (position () > 0)
{
int count = limit () - position ();
- bb.shiftDown(offset, offset + 8 * position(), 8 * count);
+ bb.shiftDown(offset, offset + 8 * position(), 8 * count);
position (count);
limit (capacity ());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
-
+
public DoubleBuffer slice ()
{
return new DoubleViewBufferImpl (bb, (position () << 3) + offset,
- remaining(), remaining(), 0, -1,
+ remaining(), remaining(), 0, -1,
readOnly, endian);
}
-
+
DoubleBuffer duplicate (boolean readOnly)
{
int pos = position();
@@ -142,7 +142,7 @@ final class DoubleViewBufferImpl extends DoubleBuffer
return new DoubleViewBufferImpl (bb, offset, capacity(), limit(),
pos, mark, readOnly, endian);
}
-
+
public DoubleBuffer duplicate ()
{
return duplicate(readOnly);
@@ -157,12 +157,12 @@ final class DoubleViewBufferImpl extends DoubleBuffer
{
return readOnly;
}
-
+
public boolean isDirect ()
{
return bb.isDirect ();
}
-
+
public ByteOrder order ()
{
return endian;
diff --git a/java/nio/FloatBuffer.java b/java/nio/FloatBuffer.java
index 4eba2eaf7..379faf074 100644
--- a/java/nio/FloatBuffer.java
+++ b/java/nio/FloatBuffer.java
@@ -1,4 +1,4 @@
-/* FloatBuffer.java --
+/* FloatBuffer.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ public abstract class FloatBuffer extends Buffer
final float[] backing_buffer;
FloatBuffer (int capacity, int limit, int position, int mark,
- Pointer address, float[] backing_buffer, int array_offset)
+ Pointer address, float[] backing_buffer, int array_offset)
{
super (capacity, limit, position, mark, address);
this.backing_buffer = backing_buffer;
@@ -85,11 +85,11 @@ public abstract class FloatBuffer extends Buffer
{
return wrap (array, 0, array.length);
}
-
+
/**
* This method transfers <code>float</code>s from this buffer into the given
* destination array. Before the transfer, it checks if there are fewer than
- * length <code>float</code>s remaining in this buffer.
+ * length <code>float</code>s remaining in this buffer.
*
* @param dst The destination array
* @param offset The offset within the array of the first <code>float</code>
@@ -168,7 +168,7 @@ public abstract class FloatBuffer extends Buffer
* must be non-negative and no larger than src.length.
* @param length The number of bytes to be read from the given array;
* must be non-negative and no larger than src.length - offset.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>float</code>s in the source array.
* @exception IndexOutOfBoundsException If the preconditions on the offset
@@ -191,7 +191,7 @@ public abstract class FloatBuffer extends Buffer
* into the buffer.
*
* @param src The array to copy into the buffer.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>float</code>s in the source array.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -224,7 +224,7 @@ public abstract class FloatBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return backing_buffer;
}
@@ -241,7 +241,7 @@ public abstract class FloatBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return array_offset;
}
@@ -253,7 +253,7 @@ public abstract class FloatBuffer extends Buffer
* <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
* (s[limit()-1]+30)*31**(limit()-1)</code>.
* Where s is the buffer data, in Float.floatToIntBits() form
- * Note that the hashcode is dependent on buffer content,
+ * Note that the hashcode is dependent on buffer content,
* and therefore is not useful if the buffer content may change.
*
* @return the hash code
@@ -264,8 +264,8 @@ public abstract class FloatBuffer extends Buffer
int multiplier = 1;
for (int i = position() + 1; i < limit(); ++i)
{
- multiplier *= 31;
- hashCode += (Float.floatToIntBits(get(i)) + 30)*multiplier;
+ multiplier *= 31;
+ hashCode += (Float.floatToIntBits(get(i)) + 30)*multiplier;
}
return hashCode;
}
@@ -294,21 +294,21 @@ public abstract class FloatBuffer extends Buffer
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
-
+
for (int count = 0; count < num; count++)
{
- float a = get(pos_this++);
- float b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
+ float a = get(pos_this++);
+ float b = other.get(pos_other++);
+
+ if (a == b)
+ continue;
+
+ if (a < b)
+ return -1;
+
+ return 1;
}
-
+
return remaining() - other.remaining();
}
@@ -330,7 +330,7 @@ public abstract class FloatBuffer extends Buffer
* Writes the <code>float</code> at this buffer's current position,
* and then increments the position.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* <code>float</code>s in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -343,7 +343,7 @@ public abstract class FloatBuffer extends Buffer
* than the buffer's limit.
*/
public abstract float get (int index);
-
+
/**
* Absolute put method.
*
@@ -355,7 +355,7 @@ public abstract class FloatBuffer extends Buffer
/**
* Compacts this buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract FloatBuffer compact ();
diff --git a/java/nio/FloatBufferImpl.java b/java/nio/FloatBufferImpl.java
index 5d0e7ca85..603832d7a 100644
--- a/java/nio/FloatBufferImpl.java
+++ b/java/nio/FloatBufferImpl.java
@@ -1,4 +1,4 @@
-/* FloatBufferImpl.java --
+/* FloatBufferImpl.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,34 +49,34 @@ final class FloatBufferImpl extends FloatBuffer
{
this (new float [capacity], 0, capacity, capacity, 0, -1, false);
}
-
+
FloatBufferImpl (float[] buffer, int offset, int capacity, int limit,
- int position, int mark, boolean readOnly)
+ int position, int mark, boolean readOnly)
{
super (capacity, limit, position, mark, null, buffer, offset);
this.readOnly = readOnly;
}
-
+
public boolean isReadOnly ()
{
return readOnly;
}
-
+
public FloatBuffer slice ()
{
return new FloatBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
}
-
+
public FloatBuffer duplicate ()
{
return new FloatBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
}
-
+
public FloatBuffer asReadOnlyBuffer ()
{
return new FloatBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
}
-
+
public FloatBuffer compact ()
{
checkIfReadOnly();
@@ -92,7 +92,7 @@ final class FloatBufferImpl extends FloatBuffer
limit(capacity());
return this;
}
-
+
public boolean isDirect ()
{
return false;
@@ -113,12 +113,12 @@ final class FloatBufferImpl extends FloatBuffer
position (position () + 1);
return result;
}
-
+
/**
* Relative put method. Writes <code>value</code> to the next position
* in the buffer.
- *
- * @exception BufferOverflowException If there no remaining
+ *
+ * @exception BufferOverflowException If there no remaining
* space in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -131,7 +131,7 @@ final class FloatBufferImpl extends FloatBuffer
position (position () + 1);
return this;
}
-
+
/**
* Absolute get method. Reads the <code>float</code> at position
* <code>index</code>.
@@ -145,7 +145,7 @@ final class FloatBufferImpl extends FloatBuffer
return backing_buffer [index];
}
-
+
/**
* Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
@@ -162,7 +162,7 @@ final class FloatBufferImpl extends FloatBuffer
backing_buffer [index] = value;
return this;
}
-
+
public ByteOrder order ()
{
return ByteOrder.nativeOrder ();
diff --git a/java/nio/FloatViewBufferImpl.java b/java/nio/FloatViewBufferImpl.java
index 9f10d824f..663b65c4e 100644
--- a/java/nio/FloatViewBufferImpl.java
+++ b/java/nio/FloatViewBufferImpl.java
@@ -1,4 +1,4 @@
-/* FloatViewBufferImpl.java --
+/* FloatViewBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ final class FloatViewBufferImpl extends FloatBuffer
private final ByteBuffer bb;
private final boolean readOnly;
private final ByteOrder endian;
-
+
FloatViewBufferImpl (ByteBuffer bb, int capacity)
{
super (capacity, capacity, 0, -1, bb.isDirect() ?
@@ -55,10 +55,10 @@ final class FloatViewBufferImpl extends FloatBuffer
this.readOnly = bb.isReadOnly();
this.endian = bb.order();
}
-
+
public FloatViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (capacity, limit, position, mark, bb.isDirect() ?
VMDirectByteBuffer.adjustAddress(bb.address, offset):null, null, 0);
@@ -102,7 +102,7 @@ final class FloatViewBufferImpl extends FloatBuffer
position(p + 1);
return this;
}
-
+
public FloatBuffer put (int index, float value)
{
ByteBufferHelper.putFloat(bb, (index << 2) + offset, value, endian);
@@ -114,26 +114,26 @@ final class FloatViewBufferImpl extends FloatBuffer
if (position () > 0)
{
int count = limit () - position ();
- bb.shiftDown(offset, offset + 4 * position(), 4 * count);
+ bb.shiftDown(offset, offset + 4 * position(), 4 * count);
position (count);
limit (capacity ());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
-
+
public FloatBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new FloatViewBufferImpl (bb, (position () << 2) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
-
+
FloatBuffer duplicate (boolean readOnly)
{
int pos = position();
@@ -141,9 +141,9 @@ final class FloatViewBufferImpl extends FloatBuffer
int mark = position();
position(pos);
return new FloatViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
+ pos, mark, readOnly, endian);
}
-
+
public FloatBuffer duplicate ()
{
return duplicate(readOnly);
@@ -158,12 +158,12 @@ final class FloatViewBufferImpl extends FloatBuffer
{
return readOnly;
}
-
+
public boolean isDirect ()
{
return bb.isDirect ();
}
-
+
public ByteOrder order ()
{
return endian;
diff --git a/java/nio/IntBuffer.java b/java/nio/IntBuffer.java
index 8ec10afe2..840290d39 100644
--- a/java/nio/IntBuffer.java
+++ b/java/nio/IntBuffer.java
@@ -1,4 +1,4 @@
-/* IntBuffer.java --
+/* IntBuffer.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ public abstract class IntBuffer extends Buffer
final int[] backing_buffer;
IntBuffer (int capacity, int limit, int position, int mark,
- Pointer address, int[] backing_buffer, int array_offset)
+ Pointer address, int[] backing_buffer, int array_offset)
{
super (capacity, limit, position, mark, address);
this.backing_buffer = backing_buffer;
@@ -75,7 +75,7 @@ public abstract class IntBuffer extends Buffer
public static final IntBuffer wrap (int[] array, int offset, int length)
{
return new IntBufferImpl (array, 0, array.length, offset + length, offset,
- -1, false);
+ -1, false);
}
/**
@@ -86,11 +86,11 @@ public abstract class IntBuffer extends Buffer
{
return wrap (array, 0, array.length);
}
-
+
/**
* This method transfers <code>int</code>s from this buffer into the given
* destination array. Before the transfer, it checks if there are fewer than
- * length <code>int</code>s remaining in this buffer.
+ * length <code>int</code>s remaining in this buffer.
*
* @param dst The destination array
* @param offset The offset within the array of the first <code>int</code>
@@ -169,7 +169,7 @@ public abstract class IntBuffer extends Buffer
* must be non-negative and no larger than src.length.
* @param length The number of bytes to be read from the given array;
* must be non-negative and no larger than src.length - offset.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>int</code>s in the source array.
* @exception IndexOutOfBoundsException If the preconditions on the offset
@@ -192,7 +192,7 @@ public abstract class IntBuffer extends Buffer
* into the buffer.
*
* @param src The array to copy into the buffer.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>int</code>s in the source array.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -225,7 +225,7 @@ public abstract class IntBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return backing_buffer;
}
@@ -242,7 +242,7 @@ public abstract class IntBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return array_offset;
}
@@ -265,8 +265,8 @@ public abstract class IntBuffer extends Buffer
int multiplier = 1;
for (int i = position() + 1; i < limit(); ++i)
{
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
}
return hashCode;
}
@@ -295,21 +295,21 @@ public abstract class IntBuffer extends Buffer
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
-
+
for (int count = 0; count < num; count++)
{
- int a = get(pos_this++);
- int b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
+ int a = get(pos_this++);
+ int b = other.get(pos_other++);
+
+ if (a == b)
+ continue;
+
+ if (a < b)
+ return -1;
+
+ return 1;
}
-
+
return remaining() - other.remaining();
}
@@ -331,7 +331,7 @@ public abstract class IntBuffer extends Buffer
* Writes the <code>int</code> at this buffer's current position,
* and then increments the position.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* <code>int</code>s in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -344,7 +344,7 @@ public abstract class IntBuffer extends Buffer
* than the buffer's limit.
*/
public abstract int get (int index);
-
+
/**
* Absolute put method.
*
@@ -356,7 +356,7 @@ public abstract class IntBuffer extends Buffer
/**
* Compacts this buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract IntBuffer compact ();
diff --git a/java/nio/IntBufferImpl.java b/java/nio/IntBufferImpl.java
index c332715fb..1b31b0795 100644
--- a/java/nio/IntBufferImpl.java
+++ b/java/nio/IntBufferImpl.java
@@ -1,4 +1,4 @@
-/* IntBufferImpl.java --
+/* IntBufferImpl.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,33 +49,33 @@ final class IntBufferImpl extends IntBuffer
{
this (new int [capacity], 0, capacity, capacity, 0, -1, false);
}
-
+
IntBufferImpl (int[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
{
super (capacity, limit, position, mark, null, buffer, offset);
this.readOnly = readOnly;
}
-
+
public boolean isReadOnly ()
{
return readOnly;
}
-
+
public IntBuffer slice ()
{
return new IntBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
}
-
+
public IntBuffer duplicate ()
{
return new IntBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
}
-
+
public IntBuffer asReadOnlyBuffer ()
{
return new IntBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
}
-
+
public IntBuffer compact ()
{
checkIfReadOnly();
@@ -91,7 +91,7 @@ final class IntBufferImpl extends IntBuffer
limit(capacity());
return this;
}
-
+
public boolean isDirect ()
{
return false;
@@ -112,12 +112,12 @@ final class IntBufferImpl extends IntBuffer
position (position () + 1);
return result;
}
-
+
/**
* Relative put method. Writes <code>value</code> to the next position
* in the buffer.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* space in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -130,7 +130,7 @@ final class IntBufferImpl extends IntBuffer
position (position () + 1);
return this;
}
-
+
/**
* Absolute get method. Reads the <code>int</code> at position
* <code>index</code>.
@@ -144,7 +144,7 @@ final class IntBufferImpl extends IntBuffer
return backing_buffer [index];
}
-
+
/**
* Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
@@ -161,7 +161,7 @@ final class IntBufferImpl extends IntBuffer
backing_buffer [index] = value;
return this;
}
-
+
public ByteOrder order ()
{
return ByteOrder.nativeOrder ();
diff --git a/java/nio/IntViewBufferImpl.java b/java/nio/IntViewBufferImpl.java
index 9af5d58a4..dd3d6941a 100644
--- a/java/nio/IntViewBufferImpl.java
+++ b/java/nio/IntViewBufferImpl.java
@@ -1,4 +1,4 @@
-/* IntViewBufferImpl.java --
+/* IntViewBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ final class IntViewBufferImpl extends IntBuffer
private final ByteBuffer bb;
private final boolean readOnly;
private final ByteOrder endian;
-
+
IntViewBufferImpl (ByteBuffer bb, int capacity)
{
super (capacity, capacity, 0, -1, bb.isDirect() ?
@@ -55,10 +55,10 @@ final class IntViewBufferImpl extends IntBuffer
this.readOnly = bb.isReadOnly();
this.endian = bb.order();
}
-
+
public IntViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (capacity, limit, position, mark, bb.isDirect() ?
VMDirectByteBuffer.adjustAddress(bb.address, offset):null, null, 0);
@@ -102,7 +102,7 @@ final class IntViewBufferImpl extends IntBuffer
position(p + 1);
return this;
}
-
+
public IntBuffer put (int index, int value)
{
ByteBufferHelper.putInt(bb, (index << 2) + offset, value, endian);
@@ -114,26 +114,26 @@ final class IntViewBufferImpl extends IntBuffer
if (position () > 0)
{
int count = limit () - position ();
- bb.shiftDown(offset, offset + 4 * position(), 4 * count);
+ bb.shiftDown(offset, offset + 4 * position(), 4 * count);
position (count);
limit (capacity ());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
-
+
public IntBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new IntViewBufferImpl (bb, (position () << 2) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
-
+
IntBuffer duplicate (boolean readOnly)
{
int pos = position();
@@ -141,9 +141,9 @@ final class IntViewBufferImpl extends IntBuffer
int mark = position();
position(pos);
return new IntViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
+ pos, mark, readOnly, endian);
}
-
+
public IntBuffer duplicate ()
{
return duplicate(readOnly);
@@ -158,12 +158,12 @@ final class IntViewBufferImpl extends IntBuffer
{
return readOnly;
}
-
+
public boolean isDirect ()
{
return bb.isDirect ();
}
-
+
public ByteOrder order ()
{
return endian;
diff --git a/java/nio/InvalidMarkException.java b/java/nio/InvalidMarkException.java
index 013f02f79..e13d76f1f 100644
--- a/java/nio/InvalidMarkException.java
+++ b/java/nio/InvalidMarkException.java
@@ -1,4 +1,4 @@
-/* InvalidMarkException.java --
+/* InvalidMarkException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/nio/LongBuffer.java b/java/nio/LongBuffer.java
index 55feb89df..531b27c8a 100644
--- a/java/nio/LongBuffer.java
+++ b/java/nio/LongBuffer.java
@@ -1,4 +1,4 @@
-/* LongBuffer.java --
+/* LongBuffer.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ public abstract class LongBuffer extends Buffer
final long[] backing_buffer;
LongBuffer (int capacity, int limit, int position, int mark,
- Pointer address, long[] backing_buffer, int array_offset)
+ Pointer address, long[] backing_buffer, int array_offset)
{
super (capacity, limit, position, mark, address);
this.backing_buffer = backing_buffer;
@@ -85,11 +85,11 @@ public abstract class LongBuffer extends Buffer
{
return wrap (array, 0, array.length);
}
-
+
/**
* This method transfers <code>long</code>s from this buffer into the given
* destination array. Before the transfer, it checks if there are fewer than
- * length <code>long</code>s remaining in this buffer.
+ * length <code>long</code>s remaining in this buffer.
*
* @param dst The destination array
* @param offset The offset within the array of the first <code>long</code>
@@ -168,7 +168,7 @@ public abstract class LongBuffer extends Buffer
* must be non-negative and no larger than src.length.
* @param length The number of bytes to be read from the given array;
* must be non-negative and no larger than src.length - offset.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>long</code>s in the source array.
* @exception IndexOutOfBoundsException If the preconditions on the offset
@@ -191,7 +191,7 @@ public abstract class LongBuffer extends Buffer
* into the buffer.
*
* @param src The array to copy into the buffer.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>long</code>s in the source array.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -224,7 +224,7 @@ public abstract class LongBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return backing_buffer;
}
@@ -241,7 +241,7 @@ public abstract class LongBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return array_offset;
}
@@ -264,8 +264,8 @@ public abstract class LongBuffer extends Buffer
long multiplier = 1;
for (int i = position() + 1; i < limit(); ++i)
{
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
}
return ((int)hashCode);
}
@@ -294,21 +294,21 @@ public abstract class LongBuffer extends Buffer
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
-
+
for (int count = 0; count < num; count++)
{
- long a = get(pos_this++);
- long b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
+ long a = get(pos_this++);
+ long b = other.get(pos_other++);
+
+ if (a == b)
+ continue;
+
+ if (a < b)
+ return -1;
+
+ return 1;
}
-
+
return remaining() - other.remaining();
}
@@ -330,7 +330,7 @@ public abstract class LongBuffer extends Buffer
* Writes the <code>long</code> at this buffer's current position,
* and then increments the position.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* <code>long</code>s in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -343,7 +343,7 @@ public abstract class LongBuffer extends Buffer
* than the buffer's limit.
*/
public abstract long get (int index);
-
+
/**
* Absolute put method.
*
@@ -355,7 +355,7 @@ public abstract class LongBuffer extends Buffer
/**
* Compacts this buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract LongBuffer compact ();
diff --git a/java/nio/LongBufferImpl.java b/java/nio/LongBufferImpl.java
index 4cf922b14..85502c194 100644
--- a/java/nio/LongBufferImpl.java
+++ b/java/nio/LongBufferImpl.java
@@ -1,4 +1,4 @@
-/* LongBufferImpl.java --
+/* LongBufferImpl.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,37 +49,37 @@ final class LongBufferImpl extends LongBuffer
{
this (new long [capacity], 0, capacity, capacity, 0, -1, false);
}
-
+
LongBufferImpl (long[] buffer, int offset, int capacity, int limit,
- int position, int mark, boolean readOnly)
+ int position, int mark, boolean readOnly)
{
super (capacity, limit, position, mark, null, buffer, offset);
this.readOnly = readOnly;
}
-
+
public boolean isReadOnly ()
{
return readOnly;
}
-
+
public LongBuffer slice ()
{
return new LongBufferImpl (backing_buffer, array_offset + position (),
- remaining (), remaining (), 0, -1, isReadOnly ());
+ remaining (), remaining (), 0, -1, isReadOnly ());
}
-
+
public LongBuffer duplicate ()
{
return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (),
- position (), mark, isReadOnly ());
+ position (), mark, isReadOnly ());
}
-
+
public LongBuffer asReadOnlyBuffer ()
{
return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (),
- position (), mark, true);
+ position (), mark, true);
}
-
+
public LongBuffer compact ()
{
checkIfReadOnly();
@@ -95,7 +95,7 @@ final class LongBufferImpl extends LongBuffer
limit(capacity());
return this;
}
-
+
public boolean isDirect ()
{
return false;
@@ -116,7 +116,7 @@ final class LongBufferImpl extends LongBuffer
position (position () + 1);
return result;
}
-
+
/**
* Relative put method. Writes <code>value</code> to the next position
* in the buffer.
@@ -134,7 +134,7 @@ final class LongBufferImpl extends LongBuffer
position (position () + 1);
return this;
}
-
+
/**
* Absolute get method. Reads the <code>long</code> at position
* <code>index</code>.
@@ -148,7 +148,7 @@ final class LongBufferImpl extends LongBuffer
return backing_buffer [index];
}
-
+
/**
* Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
@@ -165,7 +165,7 @@ final class LongBufferImpl extends LongBuffer
backing_buffer [index] = value;
return this;
}
-
+
public ByteOrder order ()
{
return ByteOrder.nativeOrder ();
diff --git a/java/nio/LongViewBufferImpl.java b/java/nio/LongViewBufferImpl.java
index b775a9946..a0a7cd36a 100644
--- a/java/nio/LongViewBufferImpl.java
+++ b/java/nio/LongViewBufferImpl.java
@@ -1,4 +1,4 @@
-/* LongViewBufferImpl.java --
+/* LongViewBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ final class LongViewBufferImpl extends LongBuffer
private final ByteBuffer bb;
private final boolean readOnly;
private final ByteOrder endian;
-
+
LongViewBufferImpl (ByteBuffer bb, int capacity)
{
super (capacity, capacity, 0, -1, bb.isDirect() ?
@@ -55,10 +55,10 @@ final class LongViewBufferImpl extends LongBuffer
this.readOnly = bb.isReadOnly();
this.endian = bb.order();
}
-
+
public LongViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (capacity, limit, position, mark, bb.isDirect() ?
VMDirectByteBuffer.adjustAddress(bb.address, offset):null, null, 0);
@@ -102,7 +102,7 @@ final class LongViewBufferImpl extends LongBuffer
position(p + 1);
return this;
}
-
+
public LongBuffer put (int index, long value)
{
ByteBufferHelper.putLong(bb, (index << 3) + offset, value, endian);
@@ -114,26 +114,26 @@ final class LongViewBufferImpl extends LongBuffer
if (position () > 0)
{
int count = limit () - position ();
- bb.shiftDown(offset, offset + 8 * position(), 8 * count);
+ bb.shiftDown(offset, offset + 8 * position(), 8 * count);
position (count);
limit (capacity ());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
-
+
public LongBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new LongViewBufferImpl (bb, (position () << 3) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
-
+
LongBuffer duplicate (boolean readOnly)
{
int pos = position();
@@ -141,9 +141,9 @@ final class LongViewBufferImpl extends LongBuffer
int mark = position();
position(pos);
return new LongViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
+ pos, mark, readOnly, endian);
}
-
+
public LongBuffer duplicate ()
{
return duplicate(readOnly);
@@ -158,12 +158,12 @@ final class LongViewBufferImpl extends LongBuffer
{
return readOnly;
}
-
+
public boolean isDirect ()
{
return bb.isDirect ();
}
-
+
public ByteOrder order ()
{
return endian;
diff --git a/java/nio/MappedByteBuffer.java b/java/nio/MappedByteBuffer.java
index f0365cb96..507aa72a7 100644
--- a/java/nio/MappedByteBuffer.java
+++ b/java/nio/MappedByteBuffer.java
@@ -1,4 +1,4 @@
-/* MappedByteBuffer.java --
+/* MappedByteBuffer.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,11 +47,11 @@ import gnu.classpath.Pointer;
public abstract class MappedByteBuffer extends ByteBuffer
{
MappedByteBuffer (int capacity, int limit, int position, int mark,
- Pointer address)
+ Pointer address)
{
super (capacity, limit, position, mark, address, null, 0);
}
-
+
void forceImpl()
{
}
@@ -61,7 +61,7 @@ public abstract class MappedByteBuffer extends ByteBuffer
forceImpl();
return this;
}
-
+
boolean isLoadedImpl()
{
load();
@@ -72,7 +72,7 @@ public abstract class MappedByteBuffer extends ByteBuffer
{
return isLoadedImpl();
}
-
+
void loadImpl()
{
}
diff --git a/java/nio/MappedByteBufferImpl.java b/java/nio/MappedByteBufferImpl.java
index f11d1e72e..58ea635cd 100644
--- a/java/nio/MappedByteBufferImpl.java
+++ b/java/nio/MappedByteBufferImpl.java
@@ -1,4 +1,4 @@
-/* MappedByteBufferImpl.java --
+/* MappedByteBufferImpl.java --
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -52,7 +52,7 @@ final class MappedByteBufferImpl extends MappedByteBuffer
/** Posix uses this for the actual length passed to mmap;
* Win32 uses it for the pointer returned by CreateFileMapping. */
public long implLen;
-
+
public MappedByteBufferImpl(Pointer address, int size, boolean readOnly)
throws IOException
{
@@ -64,7 +64,7 @@ final class MappedByteBufferImpl extends MappedByteBuffer
{
return readOnly;
}
-
+
public byte get()
{
checkForUnderflow();
@@ -121,16 +121,16 @@ final class MappedByteBufferImpl extends MappedByteBuffer
int pos = position();
if (pos > 0)
{
- int count = remaining();
- // Call shiftDown method optimized for direct buffers.
- VMDirectByteBuffer.shiftDown(address, 0, pos, count);
- position(count);
- limit(capacity());
+ int count = remaining();
+ // Call shiftDown method optimized for direct buffers.
+ VMDirectByteBuffer.shiftDown(address, 0, pos, count);
+ position(count);
+ limit(capacity());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
@@ -169,9 +169,9 @@ final class MappedByteBufferImpl extends MappedByteBuffer
if (mark != pos)
{
- result.position(mark);
- result.mark();
- result.position(pos);
+ result.position(mark);
+ result.mark();
+ result.position(pos);
}
return result;
}
@@ -220,18 +220,18 @@ final class MappedByteBufferImpl extends MappedByteBuffer
{
return ByteBufferHelper.getChar(this, order());
}
-
+
public ByteBuffer putChar(char value)
{
ByteBufferHelper.putChar(this, value, order());
return this;
}
-
+
public char getChar(int index)
{
return ByteBufferHelper.getChar(this, index, order());
}
-
+
public ByteBuffer putChar(int index, char value)
{
ByteBufferHelper.putChar(this, index, value, order());
@@ -242,18 +242,18 @@ final class MappedByteBufferImpl extends MappedByteBuffer
{
return ByteBufferHelper.getShort(this, order());
}
-
+
public ByteBuffer putShort(short value)
{
ByteBufferHelper.putShort(this, value, order());
return this;
}
-
+
public short getShort(int index)
{
return ByteBufferHelper.getShort(this, index, order());
}
-
+
public ByteBuffer putShort(int index, short value)
{
ByteBufferHelper.putShort(this, index, value, order());
@@ -264,18 +264,18 @@ final class MappedByteBufferImpl extends MappedByteBuffer
{
return ByteBufferHelper.getInt(this, order());
}
-
+
public ByteBuffer putInt(int value)
{
ByteBufferHelper.putInt(this, value, order());
return this;
}
-
+
public int getInt(int index)
{
return ByteBufferHelper.getInt(this, index, order());
}
-
+
public ByteBuffer putInt(int index, int value)
{
ByteBufferHelper.putInt(this, index, value, order());
@@ -286,18 +286,18 @@ final class MappedByteBufferImpl extends MappedByteBuffer
{
return ByteBufferHelper.getLong(this, order());
}
-
+
public ByteBuffer putLong(long value)
{
ByteBufferHelper.putLong(this, value, order());
return this;
}
-
+
public long getLong(int index)
{
return ByteBufferHelper.getLong(this, index, order());
}
-
+
public ByteBuffer putLong(int index, long value)
{
ByteBufferHelper.putLong(this, index, value, order());
@@ -308,13 +308,13 @@ final class MappedByteBufferImpl extends MappedByteBuffer
{
return ByteBufferHelper.getFloat(this, order());
}
-
+
public ByteBuffer putFloat(float value)
{
ByteBufferHelper.putFloat(this, value, order());
return this;
}
-
+
public float getFloat(int index)
{
return ByteBufferHelper.getFloat(this, index, order());
@@ -336,12 +336,12 @@ final class MappedByteBufferImpl extends MappedByteBuffer
ByteBufferHelper.putDouble(this, value, order());
return this;
}
-
+
public double getDouble(int index)
{
return ByteBufferHelper.getDouble(this, index, order());
}
-
+
public ByteBuffer putDouble(int index, double value)
{
ByteBufferHelper.putDouble(this, index, value, order());
diff --git a/java/nio/ReadOnlyBufferException.java b/java/nio/ReadOnlyBufferException.java
index 22f8a6f73..ea58c375b 100644
--- a/java/nio/ReadOnlyBufferException.java
+++ b/java/nio/ReadOnlyBufferException.java
@@ -1,4 +1,4 @@
-/* ReadOnlyBufferException.java --
+/* ReadOnlyBufferException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/nio/ShortBuffer.java b/java/nio/ShortBuffer.java
index e6bfe1e35..8b733117f 100644
--- a/java/nio/ShortBuffer.java
+++ b/java/nio/ShortBuffer.java
@@ -1,4 +1,4 @@
-/* ShortBuffer.java --
+/* ShortBuffer.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,8 +50,8 @@ public abstract class ShortBuffer extends Buffer
final short[] backing_buffer;
ShortBuffer (int capacity, int limit, int position,
- int mark, Pointer address, short[] backing_buffer,
- int array_offset)
+ int mark, Pointer address, short[] backing_buffer,
+ int array_offset)
{
super (capacity, limit, position, mark, address);
this.backing_buffer = backing_buffer;
@@ -86,11 +86,11 @@ public abstract class ShortBuffer extends Buffer
{
return wrap (array, 0, array.length);
}
-
+
/**
* This method transfers <code>short</code>s from this buffer into the given
* destination array. Before the transfer, it checks if there are fewer than
- * length <code>short</code>s remaining in this buffer.
+ * length <code>short</code>s remaining in this buffer.
*
* @param dst The destination array
* @param offset The offset within the array of the first <code>short</code>
@@ -169,7 +169,7 @@ public abstract class ShortBuffer extends Buffer
* must be non-negative and no larger than src.length.
* @param length The number of bytes to be read from the given array;
* must be non-negative and no larger than src.length - offset.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>short</code>s in the source array.
* @exception IndexOutOfBoundsException If the preconditions on the offset
@@ -192,7 +192,7 @@ public abstract class ShortBuffer extends Buffer
* into the buffer.
*
* @param src The array to copy into the buffer.
- *
+ *
* @exception BufferOverflowException If there is insufficient space in this
* buffer for the remaining <code>short</code>s in the source array.
* @exception ReadOnlyBufferException If this buffer is read-only.
@@ -225,7 +225,7 @@ public abstract class ShortBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return backing_buffer;
}
@@ -242,7 +242,7 @@ public abstract class ShortBuffer extends Buffer
throw new UnsupportedOperationException ();
checkIfReadOnly();
-
+
return array_offset;
}
@@ -265,8 +265,8 @@ public abstract class ShortBuffer extends Buffer
int multiplier = 1;
for (int i = position() + 1; i < limit(); ++i)
{
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
}
return hashCode;
}
@@ -295,21 +295,21 @@ public abstract class ShortBuffer extends Buffer
int num = Math.min(remaining(), other.remaining());
int pos_this = position();
int pos_other = other.position();
-
+
for (int count = 0; count < num; count++)
{
- short a = get(pos_this++);
- short b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
+ short a = get(pos_this++);
+ short b = other.get(pos_other++);
+
+ if (a == b)
+ continue;
+
+ if (a < b)
+ return -1;
+
+ return 1;
}
-
+
return remaining() - other.remaining();
}
@@ -331,7 +331,7 @@ public abstract class ShortBuffer extends Buffer
* Writes the <code>short</code> at this buffer's current position,
* and then increments the position.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* <code>short</code>s in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -344,7 +344,7 @@ public abstract class ShortBuffer extends Buffer
* than the buffer's limit.
*/
public abstract short get (int index);
-
+
/**
* Absolute put method.
*
@@ -356,7 +356,7 @@ public abstract class ShortBuffer extends Buffer
/**
* Compacts this buffer.
- *
+ *
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
public abstract ShortBuffer compact ();
diff --git a/java/nio/ShortBufferImpl.java b/java/nio/ShortBufferImpl.java
index 3a8ff57f8..4d66ec907 100644
--- a/java/nio/ShortBufferImpl.java
+++ b/java/nio/ShortBufferImpl.java
@@ -1,4 +1,4 @@
-/* ShortBufferImpl.java --
+/* ShortBufferImpl.java --
Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,37 +49,37 @@ final class ShortBufferImpl extends ShortBuffer
{
this (new short [capacity], 0, capacity, capacity, 0, -1, false);
}
-
+
ShortBufferImpl (short[] buffer, int offset, int capacity,
- int limit, int position, int mark, boolean readOnly)
+ int limit, int position, int mark, boolean readOnly)
{
super (capacity, limit, position, mark, null, buffer, offset);
this.readOnly = readOnly;
}
-
+
public boolean isReadOnly ()
{
return readOnly;
}
-
+
public ShortBuffer slice ()
{
return new ShortBufferImpl (backing_buffer, array_offset + position (),
- remaining (), remaining (), 0, -1, isReadOnly ());
+ remaining (), remaining (), 0, -1, isReadOnly ());
}
-
+
public ShortBuffer duplicate ()
{
return new ShortBufferImpl (backing_buffer, array_offset, capacity (),
- limit (), position (), mark, isReadOnly ());
+ limit (), position (), mark, isReadOnly ());
}
-
+
public ShortBuffer asReadOnlyBuffer ()
{
return new ShortBufferImpl (backing_buffer, array_offset, capacity (), limit (),
- position (), mark, true);
+ position (), mark, true);
}
-
+
public ShortBuffer compact ()
{
checkIfReadOnly();
@@ -95,7 +95,7 @@ final class ShortBufferImpl extends ShortBuffer
limit(capacity());
return this;
}
-
+
public boolean isDirect ()
{
return false;
@@ -116,12 +116,12 @@ final class ShortBufferImpl extends ShortBuffer
position (position () + 1);
return result;
}
-
+
/**
* Relative put method. Writes <code>value</code> to the next position
* in the buffer.
*
- * @exception BufferOverflowException If there no remaining
+ * @exception BufferOverflowException If there no remaining
* space in this buffer.
* @exception ReadOnlyBufferException If this buffer is read-only.
*/
@@ -134,7 +134,7 @@ final class ShortBufferImpl extends ShortBuffer
position (position () + 1);
return this;
}
-
+
/**
* Absolute get method. Reads the <code>short</code> at position
* <code>index</code>.
@@ -148,7 +148,7 @@ final class ShortBufferImpl extends ShortBuffer
return backing_buffer [index];
}
-
+
/**
* Absolute put method. Writes <code>value</code> to position
* <code>index</code> in the buffer.
@@ -165,7 +165,7 @@ final class ShortBufferImpl extends ShortBuffer
backing_buffer [index] = value;
return this;
}
-
+
public ByteOrder order ()
{
return ByteOrder.nativeOrder ();
diff --git a/java/nio/ShortViewBufferImpl.java b/java/nio/ShortViewBufferImpl.java
index 627085556..f7ef3e346 100644
--- a/java/nio/ShortViewBufferImpl.java
+++ b/java/nio/ShortViewBufferImpl.java
@@ -1,4 +1,4 @@
-/* ShortViewBufferImpl.java --
+/* ShortViewBufferImpl.java --
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,20 +50,20 @@ final class ShortViewBufferImpl extends ShortBuffer
{
super (capacity, capacity, 0, -1, bb.isDirect() ?
VMDirectByteBuffer.adjustAddress(bb.address, bb.position()):null,
- null, 0);
+ null, 0);
this.bb = bb;
this.offset = bb.position();
this.readOnly = bb.isReadOnly();
this.endian = bb.order();
}
-
+
public ShortViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
+ int limit, int position, int mark,
+ boolean readOnly, ByteOrder endian)
{
super (capacity, limit, position, mark, bb.isDirect() ?
VMDirectByteBuffer.adjustAddress(bb.address, offset):null,
- null, 0);
+ null, 0);
this.bb = bb;
this.offset = offset;
this.readOnly = readOnly;
@@ -104,7 +104,7 @@ final class ShortViewBufferImpl extends ShortBuffer
position(p + 1);
return this;
}
-
+
public ShortBuffer put (int index, short value)
{
ByteBufferHelper.putShort(bb, (index << 1) + offset, value, endian);
@@ -116,26 +116,26 @@ final class ShortViewBufferImpl extends ShortBuffer
if (position () > 0)
{
int count = limit () - position ();
- bb.shiftDown(offset, offset + 2 * position(), 2 * count);
+ bb.shiftDown(offset, offset + 2 * position(), 2 * count);
position (count);
limit (capacity ());
}
else
{
- position(limit());
- limit(capacity());
+ position(limit());
+ limit(capacity());
}
return this;
}
-
+
public ShortBuffer slice ()
{
// Create a sliced copy of this object that shares its content.
return new ShortViewBufferImpl (bb, (position () << 1) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
+ remaining(), remaining(), 0, -1,
+ readOnly, endian);
}
-
+
ShortBuffer duplicate (boolean readOnly)
{
int pos = position();
@@ -143,9 +143,9 @@ final class ShortViewBufferImpl extends ShortBuffer
int mark = position();
position(pos);
return new ShortViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
+ pos, mark, readOnly, endian);
}
-
+
public ShortBuffer duplicate ()
{
return duplicate(readOnly);
@@ -160,12 +160,12 @@ final class ShortViewBufferImpl extends ShortBuffer
{
return readOnly;
}
-
+
public boolean isDirect ()
{
return bb.isDirect ();
}
-
+
public ByteOrder order ()
{
return endian;
diff --git a/java/nio/channels/FileChannel.java b/java/nio/channels/FileChannel.java
index 3aa199909..8c8029fe7 100644
--- a/java/nio/channels/FileChannel.java
+++ b/java/nio/channels/FileChannel.java
@@ -71,9 +71,9 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
public String toString()
{
if (this == READ_ONLY)
- return "READ_ONLY";
+ return "READ_ONLY";
else if (this == READ_WRITE)
- return "READ_WRITE";
+ return "READ_WRITE";
return "PRIVATE";
}
diff --git a/java/nio/channels/SocketChannel.java b/java/nio/channels/SocketChannel.java
index 50f21368c..324c9816b 100644
--- a/java/nio/channels/SocketChannel.java
+++ b/java/nio/channels/SocketChannel.java
@@ -64,7 +64,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
* Opens a socket channel.
*
* @return the new <code>SocketChannel</code> object
- *
+ *
* @exception IOException If an error occurs
*/
public static SocketChannel open() throws IOException
@@ -76,7 +76,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
* Opens a channel and connects it to a remote address.
*
* @return the new <code>SocketChannel</code> object
- *
+ *
* @exception AsynchronousCloseException If this channel is already connected.
* @exception ClosedByInterruptException If another thread interrupts the
* current thread while the connect operation is in progress, thereby closing
@@ -120,7 +120,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
* Writes data to the channel.
*
* @return the number of bytes written, zero is valid too
- *
+ *
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
@@ -150,7 +150,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
*
* @return the number of bytes read, zero is valid too, -1 if end of stream
* is reached
- *
+ *
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
@@ -162,7 +162,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
* @return <code>true</code> if the channel got successfully connected,
* <code>false</code> if the channel is in non-blocking mode and connection
* operation is still in progress.
- *
+ *
* @exception AlreadyConnectedException If this channel is already connected.
* @exception AsynchronousCloseException If this channel is already connected.
* @exception ClosedByInterruptException If another thread interrupts the
@@ -211,7 +211,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
*
* @return the number of bytes read, zero is valid too, -1 if end of stream
* is reached
- *
+ *
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
@@ -229,7 +229,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
* Writes data to the channel.
*
* @return the number of bytes written, zero is valid too
- *
+ *
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
@@ -239,7 +239,7 @@ public abstract class SocketChannel extends AbstractSelectableChannel
* Writes data to the channel.
*
* @return the number of bytes written, zero is valid too
- *
+ *
* @exception IOException If an error occurs
* @exception NotYetConnectedException If this channel is not yet connected.
*/
diff --git a/java/nio/channels/spi/AbstractInterruptibleChannel.java b/java/nio/channels/spi/AbstractInterruptibleChannel.java
index 8e5b7b0b1..b1ed7c7f2 100644
--- a/java/nio/channels/spi/AbstractInterruptibleChannel.java
+++ b/java/nio/channels/spi/AbstractInterruptibleChannel.java
@@ -1,4 +1,4 @@
-/* AbstractInterruptibleChannel.java --
+/* AbstractInterruptibleChannel.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,8 +76,8 @@ public abstract class AbstractInterruptibleChannel
{
if (! closed)
{
- closed = true;
- implCloseChannel();
+ closed = true;
+ implCloseChannel();
}
}
@@ -96,7 +96,7 @@ public abstract class AbstractInterruptibleChannel
throws AsynchronousCloseException
{
// FIXME: check more here.
-
+
if (closed) throw new AsynchronousCloseException();
}
@@ -109,8 +109,8 @@ public abstract class AbstractInterruptibleChannel
/**
* Tells whether or not this channel is open.
- *
- * @return true if the channel is open, false otherwise
+ *
+ * @return true if the channel is open, false otherwise
*/
public final boolean isOpen()
{
diff --git a/java/nio/channels/spi/AbstractSelectableChannel.java b/java/nio/channels/spi/AbstractSelectableChannel.java
index 5d5277b4a..97ed685b8 100644
--- a/java/nio/channels/spi/AbstractSelectableChannel.java
+++ b/java/nio/channels/spi/AbstractSelectableChannel.java
@@ -90,11 +90,11 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
{
synchronized (blockingLock())
{
- if (this.blocking != blocking)
- {
- implConfigureBlocking(blocking);
- this.blocking = blocking;
- }
+ if (this.blocking != blocking)
+ {
+ implConfigureBlocking(blocking);
+ this.blocking = blocking;
+ }
}
return this;
@@ -173,14 +173,14 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
try
{
- synchronized (blockingLock())
- {
- return locate(selector);
- }
+ synchronized (blockingLock())
+ {
+ return locate(selector);
+ }
}
catch (Exception e)
{
- return null;
+ return null;
}
}
@@ -200,10 +200,10 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
while (it.hasNext())
{
- SelectionKey key = (SelectionKey) it.next();
+ SelectionKey key = (SelectionKey) it.next();
- if (key.selector() == selector)
- return key;
+ if (key.selector() == selector)
+ return key;
}
return null;
@@ -217,7 +217,7 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
* @param att an attachment for the returned selection key
*
* @return the registered selection key
- *
+ *
* @exception ClosedChannelException If the channel is already closed.
* @exception IllegalBlockingModeException If the channel is configured in
* blocking mode.
@@ -230,29 +230,29 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
if ((ops & ~validOps()) != 0)
throw new IllegalArgumentException();
-
+
SelectionKey key = null;
AbstractSelector selector = (AbstractSelector) selin;
synchronized (blockingLock())
{
- if (blocking)
- throw new IllegalBlockingModeException();
+ if (blocking)
+ throw new IllegalBlockingModeException();
- key = locate(selector);
+ key = locate(selector);
- if (key != null && key.isValid())
- {
+ if (key != null && key.isValid())
+ {
key.interestOps(ops);
key.attach(att);
- }
- else
- {
- key = selector.register(this, ops, att);
-
- if (key != null)
- addSelectionKey(key);
- }
+ }
+ else
+ {
+ key = selector.register(this, ops, att);
+
+ if (key != null)
+ addSelectionKey(key);
+ }
}
return key;
diff --git a/java/nio/channels/spi/AbstractSelectionKey.java b/java/nio/channels/spi/AbstractSelectionKey.java
index 02d09ce10..e0dc03f53 100644
--- a/java/nio/channels/spi/AbstractSelectionKey.java
+++ b/java/nio/channels/spi/AbstractSelectionKey.java
@@ -61,8 +61,8 @@ public abstract class AbstractSelectionKey extends SelectionKey
{
if (isValid())
{
- ((AbstractSelector) selector()).cancelKey(this);
- cancelled = true;
+ ((AbstractSelector) selector()).cancelKey(this);
+ cancelled = true;
}
}
diff --git a/java/nio/channels/spi/AbstractSelector.java b/java/nio/channels/spi/AbstractSelector.java
index 73f5077df..b67d4aecc 100644
--- a/java/nio/channels/spi/AbstractSelector.java
+++ b/java/nio/channels/spi/AbstractSelector.java
@@ -132,7 +132,7 @@ public abstract class AbstractSelector extends Selector
{
synchronized (cancelledKeys)
{
- cancelledKeys.add(key);
+ cancelledKeys.add(key);
}
}
diff --git a/java/nio/channels/spi/SelectorProvider.java b/java/nio/channels/spi/SelectorProvider.java
index b2fb7bb9c..821bc4361 100644
--- a/java/nio/channels/spi/SelectorProvider.java
+++ b/java/nio/channels/spi/SelectorProvider.java
@@ -72,7 +72,7 @@ public abstract class SelectorProvider
* Opens a datagram channel.
*
* @return a new datagram channel object
- *
+ *
* @exception IOException if an error occurs
*/
public abstract DatagramChannel openDatagramChannel()
@@ -82,7 +82,7 @@ public abstract class SelectorProvider
* Opens a pipe.
*
* @return a new pipe object
- *
+ *
* @exception IOException if an error occurs
*/
public abstract Pipe openPipe() throws IOException;
@@ -91,7 +91,7 @@ public abstract class SelectorProvider
* Opens a selector.
*
* @return a new selector object
- *
+ *
* @exception IOException if an error occurs
*/
public abstract AbstractSelector openSelector() throws IOException;
@@ -100,7 +100,7 @@ public abstract class SelectorProvider
* Opens a server socket channel.
*
* @return a new server socket channel object
- *
+ *
* @exception IOException if an error occurs
*/
public abstract ServerSocketChannel openServerSocketChannel()
@@ -110,7 +110,7 @@ public abstract class SelectorProvider
* Opens a socket channel.
*
* @return a new socket channel object
- *
+ *
* @exception IOException if an error occurs
*/
public abstract SocketChannel openSocketChannel() throws IOException;
@@ -151,26 +151,26 @@ public abstract class SelectorProvider
{
if (systemDefaultProvider == null)
{
- String propertyValue =
- System.getProperty("java.nio.channels.spi.SelectorProvider");
-
- if (propertyValue == null || propertyValue.equals(""))
- systemDefaultProvider = new SelectorProviderImpl();
- else
- {
- try
- {
- systemDefaultProvider =
- (SelectorProvider) Class.forName(propertyValue)
- .newInstance();
- }
- catch (Exception e)
- {
- System.err.println("Could not instantiate class: "
- + propertyValue);
- systemDefaultProvider = new SelectorProviderImpl();
- }
- }
+ String propertyValue =
+ System.getProperty("java.nio.channels.spi.SelectorProvider");
+
+ if (propertyValue == null || propertyValue.equals(""))
+ systemDefaultProvider = new SelectorProviderImpl();
+ else
+ {
+ try
+ {
+ systemDefaultProvider =
+ (SelectorProvider) Class.forName(propertyValue)
+ .newInstance();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Could not instantiate class: "
+ + propertyValue);
+ systemDefaultProvider = new SelectorProviderImpl();
+ }
+ }
}
return systemDefaultProvider;
diff --git a/java/nio/charset/CharacterCodingException.java b/java/nio/charset/CharacterCodingException.java
index d0580c955..05f1e3aea 100644
--- a/java/nio/charset/CharacterCodingException.java
+++ b/java/nio/charset/CharacterCodingException.java
@@ -1,4 +1,4 @@
-/* CharacterCodingException.java --
+/* CharacterCodingException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/nio/charset/Charset.java b/java/nio/charset/Charset.java
index 924e005e6..1757b82ea 100644
--- a/java/nio/charset/Charset.java
+++ b/java/nio/charset/Charset.java
@@ -1,4 +1,4 @@
-/* Charset.java --
+/* Charset.java --
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,15 +64,15 @@ public abstract class Charset implements Comparable<Charset>
{
private CharsetEncoder cachedEncoder;
private CharsetDecoder cachedDecoder;
-
+
/**
* Extra Charset providers.
*/
private static CharsetProvider[] providers;
-
+
private final String canonicalName;
private final String[] aliases;
-
+
protected Charset (String canonicalName, String[] aliases)
{
checkName (canonicalName);
@@ -121,45 +121,45 @@ public abstract class Charset implements Comparable<Charset>
*
* This may be set by the user or VM with the file.encoding
* property.
- *
+ *
* @since 1.5
*/
public static Charset defaultCharset()
{
String encoding;
-
- try
+
+ try
{
- encoding = SystemProperties.getProperty("file.encoding");
+ encoding = SystemProperties.getProperty("file.encoding");
}
catch(SecurityException e)
{
- // Use fallback.
- encoding = "ISO-8859-1";
+ // Use fallback.
+ encoding = "ISO-8859-1";
}
catch(IllegalArgumentException e)
{
- // Use fallback.
- encoding = "ISO-8859-1";
+ // Use fallback.
+ encoding = "ISO-8859-1";
}
try
{
- return forName(encoding);
+ return forName(encoding);
}
catch(UnsupportedCharsetException e)
{
- // Ignore.
+ // Ignore.
}
catch(IllegalCharsetNameException e)
{
- // Ignore.
+ // Ignore.
}
catch(IllegalArgumentException e)
{
- // Ignore.
+ // Ignore.
}
-
+
throw new IllegalStateException("Can't get default charset!");
}
@@ -170,7 +170,7 @@ public abstract class Charset implements Comparable<Charset>
/**
* Returns the Charset instance for the charset of the given name.
- *
+ *
* @param charsetName
* @return the Charset instance for the indicated charset
* @throws UnsupportedCharsetException if this VM does not support
@@ -184,7 +184,7 @@ public abstract class Charset implements Comparable<Charset>
// Throws IllegalArgumentException as the JDK does.
if(charsetName == null)
throw new IllegalArgumentException("Charset name must not be null.");
-
+
Charset cs = charsetForName (charsetName);
if (cs == null)
throw new UnsupportedCharsetException (charsetName);
@@ -208,13 +208,13 @@ public abstract class Charset implements Comparable<Charset>
Charset cs = provider().charsetForName(charsetName);
if (cs == null)
{
- CharsetProvider[] providers = providers2();
- for (int i = 0; i < providers.length; i++)
- {
- cs = providers[i].charsetForName(charsetName);
- if (cs != null)
- break;
- }
+ CharsetProvider[] providers = providers2();
+ for (int i = 0; i < providers.length; i++)
+ {
+ cs = providers[i].charsetForName(charsetName);
+ if (cs != null)
+ break;
+ }
}
return cs;
}
@@ -225,8 +225,8 @@ public abstract class Charset implements Comparable<Charset>
= new TreeMap(String.CASE_INSENSITIVE_ORDER);
for (Iterator<Charset> i = provider().charsets(); i.hasNext(); )
{
- Charset cs = i.next();
- charsets.put(cs.name(), cs);
+ Charset cs = i.next();
+ charsets.put(cs.name(), cs);
}
CharsetProvider[] providers = providers2();
@@ -333,21 +333,21 @@ public abstract class Charset implements Comparable<Charset>
{
try
{
- if (cachedEncoder == null)
- {
- cachedEncoder = newEncoder ()
- .onMalformedInput (CodingErrorAction.REPLACE)
- .onUnmappableCharacter (CodingErrorAction.REPLACE);
- } else
- cachedEncoder.reset();
- return cachedEncoder.encode (cb);
+ if (cachedEncoder == null)
+ {
+ cachedEncoder = newEncoder ()
+ .onMalformedInput (CodingErrorAction.REPLACE)
+ .onUnmappableCharacter (CodingErrorAction.REPLACE);
+ } else
+ cachedEncoder.reset();
+ return cachedEncoder.encode (cb);
}
catch (CharacterCodingException e)
{
throw new AssertionError (e);
}
}
-
+
public final ByteBuffer encode (String str)
{
return encode (CharBuffer.wrap (str));
@@ -361,15 +361,15 @@ public abstract class Charset implements Comparable<Charset>
{
try
{
- if (cachedDecoder == null)
- {
- cachedDecoder = newDecoder ()
- .onMalformedInput (CodingErrorAction.REPLACE)
- .onUnmappableCharacter (CodingErrorAction.REPLACE);
- } else
- cachedDecoder.reset();
-
- return cachedDecoder.decode (bb);
+ if (cachedDecoder == null)
+ {
+ cachedDecoder = newDecoder ()
+ .onMalformedInput (CodingErrorAction.REPLACE)
+ .onUnmappableCharacter (CodingErrorAction.REPLACE);
+ } else
+ cachedDecoder.reset();
+
+ return cachedDecoder.decode (bb);
}
catch (CharacterCodingException e)
{
diff --git a/java/nio/charset/CharsetDecoder.java b/java/nio/charset/CharsetDecoder.java
index c86f1c8a4..cf43feafd 100644
--- a/java/nio/charset/CharsetDecoder.java
+++ b/java/nio/charset/CharsetDecoder.java
@@ -1,4 +1,4 @@
-/* CharsetDecoder.java --
+/* CharsetDecoder.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -160,7 +160,7 @@ public abstract class CharsetDecoder
cr = decodeLoop (in, out);
}
catch (RuntimeException e)
- {
+ {
throw new CoderMalfunctionError (e);
}
@@ -199,7 +199,7 @@ public abstract class CharsetDecoder
{
throw new UnsupportedOperationException ();
}
-
+
public final CoderResult flush (CharBuffer out)
{
// It seems weird that you can flush after reset, but Sun's javadoc
diff --git a/java/nio/charset/CharsetEncoder.java b/java/nio/charset/CharsetEncoder.java
index 932fe355d..1f079a3cc 100644
--- a/java/nio/charset/CharsetEncoder.java
+++ b/java/nio/charset/CharsetEncoder.java
@@ -1,4 +1,4 @@
-/* CharsetEncoder.java --
+/* CharsetEncoder.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,7 +50,7 @@ public abstract class CharsetEncoder
private static final int STATE_CODING = 1;
private static final int STATE_END = 2;
private static final int STATE_FLUSHED = 3;
-
+
private static final byte[] DEFAULT_REPLACEMENT = {(byte)'?'};
private final Charset charset;
@@ -71,7 +71,7 @@ public abstract class CharsetEncoder
this (cs, averageBytesPerChar, maxBytesPerChar, DEFAULT_REPLACEMENT);
}
- protected CharsetEncoder (Charset cs, float averageBytesPerChar,
+ protected CharsetEncoder (Charset cs, float averageBytesPerChar,
float maxBytesPerChar, byte[] replacement)
{
if (averageBytesPerChar <= 0.0f)
@@ -87,7 +87,7 @@ public abstract class CharsetEncoder
this.replacement = replacement;
implReplaceWith (replacement);
}
-
+
public final float averageBytesPerChar ()
{
return averageBytesPerChar;
diff --git a/java/nio/charset/CoderMalfunctionError.java b/java/nio/charset/CoderMalfunctionError.java
index 5770aded6..f7a32d207 100644
--- a/java/nio/charset/CoderMalfunctionError.java
+++ b/java/nio/charset/CoderMalfunctionError.java
@@ -1,4 +1,4 @@
-/* CoderMalfunctionError.java --
+/* CoderMalfunctionError.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/nio/charset/CoderResult.java b/java/nio/charset/CoderResult.java
index 304d9d708..b083d840e 100644
--- a/java/nio/charset/CoderResult.java
+++ b/java/nio/charset/CoderResult.java
@@ -1,4 +1,4 @@
-/* CoderResult.java --
+/* CoderResult.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,7 @@ import java.util.HashMap;
* @since 1.4
*/
public class CoderResult
-{
+{
private static final int TYPE_MALFORMED = 0;
private static final int TYPE_OVERFLOW = 1;
private static final int TYPE_UNDERFLOW = 2;
@@ -57,7 +57,7 @@ public class CoderResult
= new CoderResult (TYPE_OVERFLOW, 0);
public static final CoderResult UNDERFLOW
= new CoderResult (TYPE_UNDERFLOW, 0);
-
+
private static final String[] names
= { "MALFORMED", "OVERFLOW", "UNDERFLOW", "UNMAPPABLE" };
@@ -126,7 +126,7 @@ public class CoderResult
{
return malformedCache.get (length);
}
-
+
public void throwException ()
throws CharacterCodingException
{
@@ -152,7 +152,7 @@ public class CoderResult
public static CoderResult unmappableForLength (int length)
{
return unmappableCache.get (length);
- }
+ }
private abstract static class Cache
{
diff --git a/java/nio/charset/CodingErrorAction.java b/java/nio/charset/CodingErrorAction.java
index 592c15934..3b6403097 100644
--- a/java/nio/charset/CodingErrorAction.java
+++ b/java/nio/charset/CodingErrorAction.java
@@ -1,4 +1,4 @@
-/* CodingErrorAction.java --
+/* CodingErrorAction.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,11 +40,11 @@ package java.nio.charset;
public class CodingErrorAction
{
public static final CodingErrorAction IGNORE
- = new CodingErrorAction("ignore");
+ = new CodingErrorAction("ignore");
public static final CodingErrorAction REPLACE
- = new CodingErrorAction("replace");
+ = new CodingErrorAction("replace");
public static final CodingErrorAction REPORT
- = new CodingErrorAction("report");
+ = new CodingErrorAction("report");
private final String name;
diff --git a/java/nio/charset/IllegalCharsetNameException.java b/java/nio/charset/IllegalCharsetNameException.java
index 7baeac323..0e05d4dbf 100644
--- a/java/nio/charset/IllegalCharsetNameException.java
+++ b/java/nio/charset/IllegalCharsetNameException.java
@@ -1,4 +1,4 @@
-/* IllegalCharsetNameException.java --
+/* IllegalCharsetNameException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,9 +47,9 @@ public class IllegalCharsetNameException extends IllegalArgumentException
* Compatible with JDK 1.4+
*/
private static final long serialVersionUID = 1457525358470002989L;
-
+
private String charsetName;
-
+
/**
* Creates the exception
*
diff --git a/java/nio/charset/MalformedInputException.java b/java/nio/charset/MalformedInputException.java
index 463d36868..3870b55be 100644
--- a/java/nio/charset/MalformedInputException.java
+++ b/java/nio/charset/MalformedInputException.java
@@ -1,4 +1,4 @@
-/* MalformedInputException.java --
+/* MalformedInputException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ public class MalformedInputException extends CharacterCodingException
private static final long serialVersionUID = - 3438823399834806194L;
private int inputLength;
-
+
/**
* Creates the exception
*
diff --git a/java/nio/charset/UnmappableCharacterException.java b/java/nio/charset/UnmappableCharacterException.java
index d22a23807..d9cdb49cf 100644
--- a/java/nio/charset/UnmappableCharacterException.java
+++ b/java/nio/charset/UnmappableCharacterException.java
@@ -1,4 +1,4 @@
-/* UnmappableCharacterException.java --
+/* UnmappableCharacterException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ public class UnmappableCharacterException extends CharacterCodingException
private static final long serialVersionUID = - 7026962371537706123L;
private int inputLength;
-
+
/**
* Creates the exception
*/
diff --git a/java/nio/charset/UnsupportedCharsetException.java b/java/nio/charset/UnsupportedCharsetException.java
index 39536baa5..c4f9d17fd 100644
--- a/java/nio/charset/UnsupportedCharsetException.java
+++ b/java/nio/charset/UnsupportedCharsetException.java
@@ -1,4 +1,4 @@
-/* UnsupportedCharsetException.java --
+/* UnsupportedCharsetException.java --
Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,9 +47,9 @@ public class UnsupportedCharsetException extends IllegalArgumentException
* Compatible with JDK 1.4+
*/
private static final long serialVersionUID = 1490765524727386367L;
-
+
String charsetName;
-
+
/**
* Creates the exception
*/
diff --git a/java/rmi/AccessException.java b/java/rmi/AccessException.java
index 40954dfd3..c14b87675 100644
--- a/java/rmi/AccessException.java
+++ b/java/rmi/AccessException.java
@@ -1,5 +1,5 @@
/* AccessException.java -- thrown if the caller does not have access
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/rmi/AlreadyBoundException.java b/java/rmi/AlreadyBoundException.java
index 10f6e4cec..c56a4ee85 100644
--- a/java/rmi/AlreadyBoundException.java
+++ b/java/rmi/AlreadyBoundException.java
@@ -1,5 +1,5 @@
/* AlreadyBoundException.java -- thrown if a binding is already bound
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/rmi/MarshalledObject.java b/java/rmi/MarshalledObject.java
index 180c0a9be..a48e4c009 100644
--- a/java/rmi/MarshalledObject.java
+++ b/java/rmi/MarshalledObject.java
@@ -1,5 +1,5 @@
/* MarshalledObject.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -51,8 +51,8 @@ import java.io.Serializable;
* marshalled according to the RMI specification.
* <p>
* An object passed to the constructor is serialized and tagged with the needed
- * URL to retrieve its class definition for remote usage. If the object is a
- * remote reference its stub is serialized instead. The instance of this
+ * URL to retrieve its class definition for remote usage. If the object is a
+ * remote reference its stub is serialized instead. The instance of this
* marshalled object can be later retrieved by its <code>get()</code> method.
* </p>
*
@@ -70,14 +70,14 @@ public final class MarshalledObject<T>
/**
* Constructs a <code>MarshalledObject</code> from the given object.
- *
+ *
* @param obj the object to marshal
* @throws IOException if an I/O error during serialization occurs.
*/
public MarshalledObject(T obj) throws IOException
{
ByteArrayOutputStream objStream = new ByteArrayOutputStream();
- RMIMarshalledObjectOutputStream stream =
+ RMIMarshalledObjectOutputStream stream =
new RMIMarshalledObjectOutputStream(objStream);
stream.writeObject(obj);
stream.flush();
@@ -88,7 +88,7 @@ public final class MarshalledObject<T>
hash = 0;
for (int i = 0; i < objBytes.length; i++)
hash = hash * 31 + objBytes[i];
-
+
if (locBytes != null)
for (int i = 0; i < locBytes.length; i++)
hash = hash * 31 + locBytes[i];
@@ -96,12 +96,12 @@ public final class MarshalledObject<T>
/**
* Checks if the given object is equal to this marshalled object.
- *
+ *
* <p>Marshalled objects are considered equal if they contain the
- * same serialized object. Codebase annotations where the class
+ * same serialized object. Codebase annotations where the class
* definition can be downloaded are ignored in the equals test.</p>
*
- * @param obj the object to compare.
+ * @param obj the object to compare.
* @return <code>true</code> if equal, <code>false</code> otherwise.
*/
public boolean equals(Object obj)
@@ -129,19 +129,19 @@ public final class MarshalledObject<T>
/**
* Constructs and returns a copy of the internal serialized object.
- *
+ *
* @return The deserialized object.
- *
+ *
* @throws IOException if an I/O exception occurs during deserialization.
- * @throws ClassNotFoundException if the class of the deserialized object
+ * @throws ClassNotFoundException if the class of the deserialized object
* cannot be found.
*/
public T get() throws IOException, ClassNotFoundException
{
if (objBytes == null)
return null;
-
- RMIMarshalledObjectInputStream stream =
+
+ RMIMarshalledObjectInputStream stream =
new RMIMarshalledObjectInputStream(objBytes, locBytes);
return (T) stream.readObject();
}
diff --git a/java/rmi/Naming.java b/java/rmi/Naming.java
index b605da70d..7f74add7a 100644
--- a/java/rmi/Naming.java
+++ b/java/rmi/Naming.java
@@ -1,5 +1,5 @@
/* Naming.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -65,7 +65,7 @@ import java.rmi.registry.Registry;
* </p>
* <p>
* RMI services are registered using one of these names, and the same name
- * is later used by the client to lookup the service and access its methods.
+ * is later used by the client to lookup the service and access its methods.
* Registries can be shared by multiple services, or a service can create
* its own registry using <code>createRegistry()</code>.
* </p>
@@ -87,15 +87,15 @@ public final class Naming
}
/**
- * Looks for the remote object that is associated with the named service.
+ * Looks for the remote object that is associated with the named service.
* Name and location is given in form of a URL without a scheme:
- *
+ *
* <pre>
* //host:port/service-name
* </pre>
- *
+ *
* The port is optional.
- *
+ *
* @param name the service name and location
* @return Remote-object that implements the named service
* @throws NotBoundException if no object implements the service
@@ -112,7 +112,7 @@ public final class Naming
/**
* Try to bind the given object to the given service name.
- *
+ *
* @param name
* @param obj
* @throws AlreadyBoundException
@@ -129,7 +129,7 @@ public final class Naming
/**
* Remove a binding for a given service name.
- *
+ *
* @param name
* @throws RemoteException
* @throws NotBoundException
@@ -146,7 +146,7 @@ public final class Naming
/**
* Forces the binding between the given Remote-object and the given service
* name, even if there was already an object bound to this name.
- *
+ *
* @param name
* @param obj
* @throws RemoteException
@@ -162,7 +162,7 @@ public final class Naming
/**
* Lists all services at the named registry.
- *
+ *
* @param name url that specifies the registry
* @return list of services at the name registry
* @throws RemoteException
@@ -190,7 +190,7 @@ public final class Naming
* Parses the supplied URL and converts it to use the HTTP protocol. From an
* RMI perspective, the scheme is irrelevant and we want to be able to create
* a URL for which a handler is available.
- *
+ *
* @param name the URL in String form.
* @throws MalformedURLException if the URL is invalid.
*/
@@ -216,7 +216,7 @@ public final class Naming
/**
* Checks that the URL contains a name, and removes any leading slashes.
- *
+ *
* @param url the URL to check.
* @throws MalformedURLException if no name is specified.
*/
diff --git a/java/rmi/NoSuchObjectException.java b/java/rmi/NoSuchObjectException.java
index 294390670..a2af433c9 100644
--- a/java/rmi/NoSuchObjectException.java
+++ b/java/rmi/NoSuchObjectException.java
@@ -1,5 +1,5 @@
/* NoSuchObjectException.java -- thrown if the remote object no longer exists
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/rmi/NotBoundException.java b/java/rmi/NotBoundException.java
index 03d4adf8f..fdd646857 100644
--- a/java/rmi/NotBoundException.java
+++ b/java/rmi/NotBoundException.java
@@ -1,5 +1,5 @@
/* NotBoundException.java -- attempt to use a registry name with no binding
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/rmi/RMISecurityException.java b/java/rmi/RMISecurityException.java
index 6f15af852..7a2d214a3 100644
--- a/java/rmi/RMISecurityException.java
+++ b/java/rmi/RMISecurityException.java
@@ -1,5 +1,5 @@
/* RMISecurityException.java -- deprecated version of SecurityException
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,7 @@ exception statement from your version. */
package java.rmi;
/**
- * Never thrown, but originally intended to wrap a
+ * Never thrown, but originally intended to wrap a
* {@link java.lang.SecurityException} in the case of RMI.
*
* @author unknown
diff --git a/java/rmi/RMISecurityManager.java b/java/rmi/RMISecurityManager.java
index a8eb13e1a..3f7e1fbcf 100644
--- a/java/rmi/RMISecurityManager.java
+++ b/java/rmi/RMISecurityManager.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/Remote.java b/java/rmi/Remote.java
index 0306981e9..8c2720e42 100644
--- a/java/rmi/Remote.java
+++ b/java/rmi/Remote.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -42,15 +42,15 @@ package java.rmi;
* from outside of this virtual machine through remote method calls.
* <p>
* Remote invokable methods of remote object implementations are specified
- * as the methods defined in the implemented remote interfaces. Typically
- * remote object implementations are subclasses of the convenience classes
- * {@link java.rmi.server.UnicastRemoteObject} or
+ * as the methods defined in the implemented remote interfaces. Typically
+ * remote object implementations are subclasses of the convenience classes
+ * {@link java.rmi.server.UnicastRemoteObject} or
* {@link java.rmi.activation.Activatable} implementing one or more remote
* interfaces indicating their remotely accessible methods. The convenience
- * classes provide implementations for correct remote object creation,
+ * classes provide implementations for correct remote object creation,
* hash, equals and toString methods.
* </p>
- *
+ *
* @author unknown
*/
public interface Remote {
diff --git a/java/rmi/RemoteException.java b/java/rmi/RemoteException.java
index 929bc80f6..276aa3774 100644
--- a/java/rmi/RemoteException.java
+++ b/java/rmi/RemoteException.java
@@ -1,5 +1,5 @@
/* RemoteException.java -- common superclass for exceptions in java.rmi
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/rmi/StubNotFoundException.java b/java/rmi/StubNotFoundException.java
index 524b418ce..992df1217 100644
--- a/java/rmi/StubNotFoundException.java
+++ b/java/rmi/StubNotFoundException.java
@@ -1,5 +1,5 @@
/* StubNotFoundException.java -- thrown if a valid stub is not found
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
diff --git a/java/rmi/UnknownHostException.java b/java/rmi/UnknownHostException.java
index e21b9944c..7e77dca31 100644
--- a/java/rmi/UnknownHostException.java
+++ b/java/rmi/UnknownHostException.java
@@ -45,7 +45,7 @@ package java.rmi;
* @since 1.1
* @status updated to 1.4
*/
-public class UnknownHostException extends RemoteException
+public class UnknownHostException extends RemoteException
{
/**
* Compatible with JDK 1.1+.
diff --git a/java/rmi/activation/Activatable.java b/java/rmi/activation/Activatable.java
index eb5110030..4a7aaba33 100644
--- a/java/rmi/activation/Activatable.java
+++ b/java/rmi/activation/Activatable.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -63,10 +63,10 @@ import java.rmi.server.UnicastRemoteObject;
* parameter being the {@link ActivationID} and the second the
* {@link MarshalledObject}. Activatable is the main class that developers need
* to use to implement and manage activatable objects. It also contains methods
- * for making activatable remote objects that are not derived from the
+ * for making activatable remote objects that are not derived from the
* Activatable class.
- *
- * @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
*/
public abstract class Activatable
extends RemoteServer
@@ -76,12 +76,12 @@ public abstract class Activatable
* Use SVUID for interoperability.
*/
static final long serialVersionUID = - 3120617863591563455L;
-
+
/**
* The object activation id.
*/
final ActivationID id;
-
+
/**
* This constructor is used to register export the object on the given port. A
* subclass of the Activatable class calls this constructor to register and
@@ -90,7 +90,7 @@ public abstract class Activatable
* with the activation system and "exported" (on an anonymous port, if port is
* zero) to the RMI runtime so that it is available to accept incoming calls
* from clients.
- *
+ *
* @param codebase the object code base url
* @param data the data, needed to activate the object.
* @param restart specifies reactivation mode after crash. If true, the object
@@ -118,7 +118,7 @@ public abstract class Activatable
* additionally specifying the socket factories. A subclass of the Activatable
* class calls this constructor to register and export the object during
* initial construction.
- *
+ *
* @param codebase the object code base url
* @param data the data, needed to activate the object.
* @param restart specifies reactivation mode after crash. If true, the object
@@ -151,7 +151,7 @@ public abstract class Activatable
* "activation" constructor with the two parameters ({@link ActivationID},
* {@link MarshalledObject}). As a side effect, the object is exported and is
* available to accept incomming calls.
- *
+ *
* @param anId the activation id
* @param port the port, on which the activatable will be listening
* @throws RemoteException if the activation failed.
@@ -166,7 +166,7 @@ public abstract class Activatable
catch (Exception e)
{
e.printStackTrace();
- RemoteException acex =
+ RemoteException acex =
new RemoteException("cannot export Activatable", e);
throw acex;
}
@@ -180,12 +180,12 @@ public abstract class Activatable
* "activation" constructor with the two parameters ({@link ActivationID},
* {@link MarshalledObject}). As a side effect, the object is exported and is
* available to accept incomming calls.
- *
+ *
* @param anId the activation id
* @param port the port, on which the activatable will be listening
* @param csf the client socket factory
* @param ssf the server socket factory
- *
+ *
* @throws RemoteException if the remote call failed
*/
protected Activatable(ActivationID anId, int port, RMIClientSocketFactory csf,
@@ -203,17 +203,17 @@ public abstract class Activatable
throw acex;
}
}
-
+
/**
* Get the objects activation identifier.
- *
+ *
* @return the object activation identifier
*/
protected ActivationID getID()
{
return id;
}
-
+
/**
* Obtain the activation Id from the activation descriptor by registering
* within the current group.
@@ -230,11 +230,11 @@ public abstract class Activatable
system = ActivationGroup.currentGroupID().getSystem();
return system.registerObject(descriptor);
}
-
+
/**
* This method registers an activatable object. The object is expected to be
* on the anonymous port (null client and server socket factories).
- *
+ *
* @param desc the object description.
* @return the remote stub for the activatable object (the first call on this
* stub will activate the object).
@@ -258,12 +258,12 @@ public abstract class Activatable
throw new ActivationException("Class not found: "+desc.getClassName());
}
}
-
+
/**
* Inactivates and unexports the object. The subsequent calls will activate
* the object again. The object is not inactivated if it is currently
* executing calls.
- *
+ *
* @param id the id of the object being inactivated
* @return true if the object has been inactivated, false if it has not been
* inactivated because of the running or pending calls.
@@ -278,10 +278,10 @@ public abstract class Activatable
id.group.inactiveObject(id);
return UnicastRemoteObject.unexportObject(id.activate(false), false);
}
-
+
/**
* Unregister the object (the object will no longer be activable with that id)
- *
+ *
* @param id the object id
* @throws UnknownObjectException if the id is unknown
* @throws ActivationException if the activation system is not running
@@ -293,23 +293,23 @@ public abstract class Activatable
ActivationGroup.currentGroupId.getSystem().unregisterObject(id);
UnicastServer.unregisterActivatable(id);
}
-
+
/**
* Register and export the object that activatable object that is not derived
* from the Activatable super class. It creates and registers the object
* activation descriptor. There is no need to call this method if the object
* extends Activable, as its work is done in the constructor
* {@link #Activatable(String, MarshalledObject, boolean, int)}.
- *
+ *
* @param obj the object, that is exported, becoming available at the given
* port.
* @param location the object code location (codebase).
* @param data the data, needed to activate the object
* @param restart the restart mode
* @param port the port, where the object will be available
- *
+ *
* @return the created object activation ID.
- *
+ *
* @throws ActivationException if the activation group is not active
* @throws RemoteException if the registration or export fails
*/
@@ -321,7 +321,7 @@ public abstract class Activatable
ActivationDesc descriptor = new ActivationDesc(obj.getClass().getName(),
location, data, restart);
ActivationID id = obtainId(descriptor);
- Remote stub = exportObject(obj, id, port);
+ Remote stub = exportObject(obj, id, port);
return id;
}
@@ -331,7 +331,7 @@ public abstract class Activatable
* activation descriptor. There is no need to call this method if the object
* extends Activable, as its work is done in the constructor
* {@link #Activatable(String, MarshalledObject, boolean, int, RMIClientSocketFactory, RMIServerSocketFactory)}
- *
+ *
* @param obj the object, that is exported, becoming available at the given
* port.
* @param location the object code location (codebase).
@@ -340,9 +340,9 @@ public abstract class Activatable
* @param port the port, where the object will be available
* @param csf the client socket factory
* @param ssf the server socket factory
- *
+ *
* @return the created object activation ID.
- *
+ *
* @throws ActivationException if the activation group is not active
* @throws RemoteException if the registration or export fails
*/
@@ -356,7 +356,7 @@ public abstract class Activatable
ActivationDesc descriptor = new ActivationDesc(obj.getClass().getName(),
location, data, restart);
ActivationID id = obtainId(descriptor);
- Remote stub = exportObject(obj, id, port, csf, ssf);
+ Remote stub = exportObject(obj, id, port, csf, ssf);
return id;
}
@@ -367,13 +367,13 @@ public abstract class Activatable
* class. There is no need to call this method if the object extends
* Activable, as its work is done in the constructor
* {@link #Activatable(ActivationID, int)}
- *
+ *
* @param obj the object
* @param id the known activation id
* @param port the object port
- *
+ *
* @return the remote stub of the activatable object
- *
+ *
* @throws RemoteException if the object export fails
*/
public static Remote exportObject(Remote obj, ActivationID id, int port)
@@ -389,15 +389,15 @@ public abstract class Activatable
* class. There is no need to call this method if the object extends
* Activable, as its work is done in the constructor
* {@link #Activatable(ActivationID, int)}
- *
+ *
* @param obj the object
* @param id the known activation id
* @param port the object port
* @param csf the client socket factory
* @param ssf the server socket factory
- *
+ *
* @return the remote stub of the activatable object
- *
+ *
* @throws RemoteException if the object export fails
*/
public static Remote exportObject(Remote obj, ActivationID id, int port,
@@ -405,7 +405,7 @@ public abstract class Activatable
RMIServerSocketFactory ssf)
throws RemoteException
{
- Remote stub = export(id, obj, port, ssf);
+ Remote stub = export(id, obj, port, ssf);
return stub;
}
@@ -414,7 +414,7 @@ public abstract class Activatable
* Make the remote object unavailable for incoming calls. This method also
* unregisters the object, so it cannot be activated again by incomming call
* (unless registered).
- *
+ *
* @param obj the object to unexport
* @param force if true, cancel all pending or running calls to that object
* (if false, the object with such calls is not unexported and false
@@ -426,7 +426,7 @@ public abstract class Activatable
throws NoSuchObjectException
{
Object aref = UnicastServer.getExportedRef(obj);
-
+
// Unregister it also (otherwise will be activated during the subsequent
// call.
if (aref instanceof ActivatableServerRef)
@@ -436,9 +436,9 @@ public abstract class Activatable
}
return UnicastRemoteObject.unexportObject(obj, force);
}
-
- static Remote exportObject(Remote obj, int port,
- RMIServerSocketFactory serverSocketFactory)
+
+ static Remote exportObject(Remote obj, int port,
+ RMIServerSocketFactory serverSocketFactory)
throws RemoteException
{
UnicastServerRef sref = null;
@@ -449,52 +449,52 @@ public abstract class Activatable
sref = new UnicastServerRef(new ObjID(), port, serverSocketFactory);
Remote stub = sref.exportObject(obj);
- // addStub(obj, stub);
+ // addStub(obj, stub);
// TODO Need to change the place of the stub repository
return stub;
}
-
+
/**
* Create and export the new remote object, making it available at the given
* port, using sockets, produced by the specified factories.
- *
+ *
* @param port the port, on that the object should become available. Zero
* means anonymous port.
* @param serverSocketFactory the server socket factory
*/
private static Remote export(ActivationID id, Remote obj, int port,
- RMIServerSocketFactory serverSocketFactory)
+ RMIServerSocketFactory serverSocketFactory)
throws RemoteException
{
ActivatableServerRef sref = null;
sref = new ActivatableServerRef(makeId(id), id, port, serverSocketFactory);
return sref.exportObject(obj);
- }
-
+ }
+
/**
* Make the object ID from the activation ID. The same activation ID always
* produces the identical object id.
- *
+ *
* @param aid the activation id
- *
+ *
* @return the object id
*/
private static ObjID makeId(ActivationID aid)
{
ObjID id = new ObjID(0);
-
+
// The fields of both ObjID and ActivationID must be package private,
// so we need to use the reflection to access them anyway.
// Probably other implementations use some very different approach.
-
+
try
{
Field idUid = ObjID.class.getDeclaredField("space");
Field aidUid = ActivationID.class.getDeclaredField("uid");
-
+
aidUid.setAccessible(true);
idUid.setAccessible(true);
-
+
idUid.set(id, aidUid.get(aid));
}
catch (Exception e)
@@ -503,10 +503,10 @@ public abstract class Activatable
ierr.initCause(e);
throw ierr;
}
-
+
return id;
- }
-
+ }
+
/**
* Connect the object to the UnicastServer (export), but not activate it.
* The object will be activated on the first call.
@@ -515,7 +515,7 @@ public abstract class Activatable
{
try
{
- ActivatableServerRef asr =
+ ActivatableServerRef asr =
new ActivatableServerRef(makeId(anId), anId, 0, null);
UnicastServer.exportActivatableObject(asr);
return asr.exportClass(stubFor);
diff --git a/java/rmi/activation/ActivationDesc.java b/java/rmi/activation/ActivationDesc.java
index ae2b78eca..9970cd63b 100644
--- a/java/rmi/activation/ActivationDesc.java
+++ b/java/rmi/activation/ActivationDesc.java
@@ -1,13 +1,13 @@
/* ActivationDesc.java -- record with info to activate an object
Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
-
+
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -51,8 +51,8 @@ import java.rmi.MarshalledObject;
* <li>the object restart mode</li>
* <li>the object specific intialization information</li>
* </ul>
- *
- * @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
+ *
+ * @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
*/
public final class ActivationDesc
implements Serializable
@@ -89,8 +89,8 @@ public final class ActivationDesc
/**
* Create the new activation description, assuming the object group is the
- * {@link ActivationGroup#currentGroupID()}.
- *
+ * {@link ActivationGroup#currentGroupID()}.
+ *
* @param className the object fully qualified class name
* @param location the code base URL
* @param data the object initialization data, contained in a marshalled form
@@ -103,8 +103,8 @@ public final class ActivationDesc
/**
* Create the new activation description, assuming the object group is the
- * {@link ActivationGroup#currentGroupID()}.
- *
+ * {@link ActivationGroup#currentGroupID()}.
+ *
* @param className the object fully qualified class name
* @param location the code base URL
* @param data the object initialization data, contained in a marshalled form
@@ -124,7 +124,7 @@ public final class ActivationDesc
/**
* Create the new activation description. Under crash, the object will only
* be reactivated on demand.
- *
+ *
* @param groupID the object group id.
* @param className the object fully qualified class name
* @param location the code base URL
@@ -138,7 +138,7 @@ public final class ActivationDesc
/**
* Create the new activation description, providing full information.
- *
+ *
* @param groupID the object group id.
* @param className the object fully qualified class name
* @param location the code base URL
@@ -166,7 +166,7 @@ public final class ActivationDesc
/**
* Get the class name of the object being activated
- *
+ *
* @return the fully qualified class name of the object being activated
*/
public String getClassName()
@@ -176,7 +176,7 @@ public final class ActivationDesc
/**
* Get the code location URL ("codebase") of the object being activated.
- *
+ *
* @return the codebase of the object being activated.
*/
public String getLocation()
@@ -191,7 +191,7 @@ public final class ActivationDesc
/**
* Get the object reactivation strategy after crash.
- *
+ *
* @return true ir the object is activated when activator is restarted or the
* activation group is restarted. False if the object is only
* activated on demand. This flag does has no effect during the normal
@@ -201,10 +201,10 @@ public final class ActivationDesc
{
return restart;
}
-
+
/**
* Compare this object with another activation description for equality.
- *
+ *
* @return true if all fields have the equal values, false otherwise.
*/
public boolean equals(Object obj)
@@ -213,25 +213,25 @@ public final class ActivationDesc
{
ActivationDesc that = (ActivationDesc) obj;
return eq(groupid, that.groupid) &&
- eq(classname, that.classname) &&
- eq(location, that.location) &&
+ eq(classname, that.classname) &&
+ eq(location, that.location) &&
eq(data, that.data)
&& restart == that.restart;
}
else
return false;
}
-
+
/**
* Get the hash code of this object (overridden to make the returned value
* consistent with .equals(..).
*/
public int hashCode()
{
- return hash(groupid) ^ hash(classname) ^
+ return hash(groupid) ^ hash(classname) ^
hash(location) ^ hash(data);
}
-
+
/**
* Get the hashcode of x or 0 if x == null.
*/
@@ -239,7 +239,7 @@ public final class ActivationDesc
{
return x == null ? 0 : x.hashCode();
}
-
+
/**
* Compare by .equals if both a and b are not null, compare directly if at
* least one of them is null.
diff --git a/java/rmi/activation/ActivationGroup.java b/java/rmi/activation/ActivationGroup.java
index ad5a05d01..230c71455 100644
--- a/java/rmi/activation/ActivationGroup.java
+++ b/java/rmi/activation/ActivationGroup.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,7 +50,7 @@ import java.rmi.server.UnicastRemoteObject;
/**
* The entity that receives the request to activate object and activates it.
* Frequently there is one activation group per virtual machine.
- *
+ *
* @author Audrius Meskauskas (audriusa@Bioinformatics.org) (from stub)
*/
public abstract class ActivationGroup
@@ -62,12 +62,12 @@ public abstract class ActivationGroup
* Use the SVUID for interoperability.
*/
static final long serialVersionUID = - 7696947875314805420L;
-
+
/**
* The Id of the current group on this VM (null if none).
*/
- static ActivationGroupID currentGroupId = null;
-
+ static ActivationGroupID currentGroupId = null;
+
/**
* The groups identifier.
*/
@@ -77,17 +77,17 @@ public abstract class ActivationGroup
* The groups activation monitor.
*/
ActivationMonitor monitor;
-
+
/**
* The groups incarnation number.
*/
long incarnation;
-
+
/**
* The groups activation system.
*/
static ActivationSystem system;
-
+
/**
* Used during the group creation (required constructor).
*/
@@ -98,34 +98,34 @@ public abstract class ActivationGroup
};
/**
- * Create the new activation group with the given group id.
- *
+ * Create the new activation group with the given group id.
+ *
* @param aGroupId the group Id.
- *
+ *
* @throws RemoteException if the group export fails.
*/
protected ActivationGroup(ActivationGroupID aGroupId) throws RemoteException
{
groupId = aGroupId;
}
-
+
/**
* The method is called when the object is exported. The group must notify
* the activation monitor, if this was not already done before.
- *
+ *
* @param id the object activation id
* @param obj the remote object implementation
- *
+ *
* @throws ActivationException if the group is inactive
* @throws UnknownObjectException if such object is not known
* @throws RemoteException if the call to monitor fails
*/
public abstract void activeObject(ActivationID id, Remote obj)
throws ActivationException, UnknownObjectException, RemoteException;
-
+
/**
* Notifies the monitor about the object being inactivated.
- *
+ *
* @param id the object being inactivated.
* @return true always (must be overridden to return other values).
* @throws ActivationException never
@@ -148,7 +148,7 @@ public abstract class ActivationGroup
* {@link MarshalledObject}. The group must be first be registered with the
* ActivationSystem. Once a group is created, the currentGroupID method
* returns the identifier for this group until the group becomes inactive.
- *
+ *
* @param id the activation group id
* @param desc the group descriptor, providing the information, necessary to
* create the group
@@ -165,7 +165,7 @@ public abstract class ActivationGroup
// passed in the group id.
if (system == null)
system = id.system;
-
+
ActivationGroup group = null;
// TODO at the moment all groups are created on the current jre and the
@@ -220,7 +220,7 @@ public abstract class ActivationGroup
/**
* Get the id of current activation group.
- *
+ *
* @return the id of the current activation group or null if none exists.
*/
public static ActivationGroupID currentGroupID()
@@ -240,16 +240,16 @@ public abstract class ActivationGroup
ierr.initCause(e);
throw ierr;
}
-
+
return currentGroupId;
}
/**
* Set the activation system for this virtual machine. The system can only
- * be set if no group is active.
- *
+ * be set if no group is active.
+ *
* @param aSystem the system to set
- *
+ *
* @throws ActivationException if some group is active now.
*/
public static void setSystem(ActivationSystem aSystem)
@@ -259,7 +259,7 @@ public abstract class ActivationGroup
throw new ActivationException("Group active");
else
{
- try
+ try
{
// Register the default transient activation system and group.
system = aSystem;
@@ -277,9 +277,9 @@ public abstract class ActivationGroup
ierr.initCause(ex);
throw ierr;
}
- }
+ }
}
-
+
/**
* Get the current activation system. If the system is not set via
* {@link #setSystem} method, the default system for this virtual machine is
@@ -293,7 +293,7 @@ public abstract class ActivationGroup
* transient activation system will be created and returned. This internal
* system is highly limited in in capabilities and is not intended to be used
* anywhere apart automated testing.
- *
+ *
* @return the activation system for this virtual machine
* @throws ActivationException
*/
@@ -306,7 +306,7 @@ public abstract class ActivationGroup
/**
* Makes the call back to the groups {@link ActivationMonitor}.
- *
+ *
* @param id the id obj the object being activated
* @param mObject the marshalled object, contains the activated remote object
* stub.
@@ -315,24 +315,24 @@ public abstract class ActivationGroup
* @throws RemoteException on remote call (to monitor) error
*/
protected void activeObject(ActivationID id,
- MarshalledObject<? extends Remote> mObject)
+ MarshalledObject<? extends Remote> mObject)
throws ActivationException, UnknownObjectException, RemoteException
{
if (monitor!=null)
monitor.activeObject(id, mObject);
-
+
id.group = this;
}
/**
* Makes the call back to the groups {@link ActivationMonitor} and sets
* the current group to null.
- */
+ */
protected void inactiveGroup() throws UnknownGroupException, RemoteException
{
if (monitor!=null)
monitor.inactiveGroup(groupId, incarnation);
-
+
if (currentGroupId!=null && currentGroupId.equals(groupId))
currentGroupId = null;
}
diff --git a/java/rmi/activation/ActivationGroupDesc.java b/java/rmi/activation/ActivationGroupDesc.java
index bf7445f17..a0c88ec0a 100644
--- a/java/rmi/activation/ActivationGroupDesc.java
+++ b/java/rmi/activation/ActivationGroupDesc.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -64,7 +64,7 @@ import java.util.zip.Adler32;
* expectes the group class to have the two parameter constructor, the first
* parameter being the {@link ActivationGroupID} and the second the
* {@link MarshalledObject}.
- *
+ *
* @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
*/
public final class ActivationGroupDesc
@@ -74,7 +74,7 @@ public final class ActivationGroupDesc
* Contains the startup options for the {@link ActivationGroup}
* implementations. Allows to override system properties and specify other
* options for the implementation groups.
- *
+ *
* @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
*/
public static class CommandEnvironment
@@ -85,7 +85,7 @@ public final class ActivationGroupDesc
* Use the SVUID for interoperability.
*/
static final long serialVersionUID = 6165754737887770191L;
-
+
/**
* The zero size string array used as argv value when null is passed.
*/
@@ -95,15 +95,15 @@ public final class ActivationGroupDesc
* The path to the java executable (or null for using default jre).
*/
final String command;
-
+
/**
* The extra parameters (may be empty array but never null).
*/
final String[] options;
-
+
/**
* Create the new command environment.
- *
+ *
* @param commandPatch the full path (and name) to the java executable of
* null for using the default executable.
* @param args extra options that will be used when creating the activation
@@ -117,10 +117,10 @@ public final class ActivationGroupDesc
else
options = NO_ARGS;
}
-
+
/**
* Get the path to the java executable.
- *
+ *
* @return the path to the java executable or null for using the default
* jre.
*/
@@ -128,17 +128,17 @@ public final class ActivationGroupDesc
{
return command;
}
-
+
/**
* Get the additional command options.
- *
+ *
* @return the command options array, may be empty string
*/
public String[] getCommandOptions()
{
return options;
}
-
+
/**
* Compare for content equality.
*/
@@ -179,49 +179,49 @@ public final class ActivationGroupDesc
return h;
}
}
-
+
/**
* Use the SVUID for interoperability.
*/
static final long serialVersionUID = - 4936225423168276595L;
-
+
/**
* The group class name or null for the default group class implementation.
*/
final String className;
-
+
/**
* The group class download location URL (codebase), ignored by the
- * default implementation.
+ * default implementation.
*/
final String location;
-
+
/**
* The group initialization data.
*/
final MarshalledObject<?> data;
-
+
/**
* The path to the group jre and the parameters of this jre, may be
* null for the default jre.
*/
final ActivationGroupDesc.CommandEnvironment env;
-
+
/**
* The properties that override the system properties.
*/
final Properties props;
-
+
/**
* The cached hash code.
*/
transient long hash;
-
+
/**
* Create the new activation group descriptor that will use the default
* activation group implementation with the given properties and
* environment.
- *
+ *
* @param aProperties the properties that override the system properties
* @param environment the command line (and parameters), indicating, where to
* find the jre executable and with that parameters to call it. May
@@ -235,10 +235,10 @@ public final class ActivationGroupDesc
this(DefaultActivationGroup.class.getName(), null, null, aProperties,
environment);
}
-
+
/**
* Create the new activation group descriptor.
- *
+ *
* @param aClassName the name of the group implementation class. The null
* value indicates the default implementation.
* @param aLocation the location, from where the group implementation class
@@ -261,20 +261,20 @@ public final class ActivationGroupDesc
props = aProperties;
env = environment;
}
-
+
/**
* Get the activation group class name.
- *
+ *
* @return the activation group class name (null for default implementation)
*/
public String getClassName()
{
return className;
}
-
+
/**
* Get the location, from where the group class will be loaded
- *
+ *
* @return the location, from where the implementation should be loaded (null
* for the default implementation)
*/
@@ -282,10 +282,10 @@ public final class ActivationGroupDesc
{
return location;
}
-
+
/**
* Get the group intialization data.
- *
+ *
* @return the group intialization data in the marshalled form.
*/
public MarshalledObject<?> getData()
@@ -295,18 +295,18 @@ public final class ActivationGroupDesc
/**
* Get the overridded system properties.
- *
+ *
* @return the overridden group system properties.
*/
public Properties getPropertyOverrides()
{
return props;
}
-
+
/**
* Get the group command environment, containing path to the jre executable
* and startup options.
- *
+ *
* @return the command environment or null if the default environment should
* be used.
*/
@@ -314,7 +314,7 @@ public final class ActivationGroupDesc
{
return env;
}
-
+
/**
* Compare for the content equality.
*/
@@ -366,7 +366,7 @@ public final class ActivationGroupDesc
else
return false;
}
-
+
/**
* Compare for direct equality if one or both parameters are null, otherwise
* call .equals.
@@ -378,7 +378,7 @@ public final class ActivationGroupDesc
else
return a.equals(b);
}
-
+
/**
* Return the hashcode.
*/
@@ -401,11 +401,11 @@ public final class ActivationGroupDesc
if (props!=null)
{
Enumeration en = props.propertyNames();
-
+
// Using the intermediate sorted set to ensure that the
// properties are sorted.
TreeSet pr = new TreeSet();
-
+
Object key;
Object value;
while (en.hasMoreElements())
@@ -414,7 +414,7 @@ public final class ActivationGroupDesc
if (key!=null)
pr.add(key);
}
-
+
Iterator it = pr.iterator();
while (it.hasNext())
{
diff --git a/java/rmi/activation/ActivationGroupID.java b/java/rmi/activation/ActivationGroupID.java
index e54b2a05d..77fa4fba1 100644
--- a/java/rmi/activation/ActivationGroupID.java
+++ b/java/rmi/activation/ActivationGroupID.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ import java.rmi.server.UID;
* This identifier identifies the activation group inside the scope of its
* activation system. It also contains (and can provide) the reference to the
* groups activation system.
- *
+ *
* @see ActivationSystem#registerGroup(ActivationGroupDesc)
*/
public class ActivationGroupID
@@ -60,7 +60,7 @@ public class ActivationGroupID
* The associated activation system.
*/
final ActivationSystem system;
-
+
/**
* The object identifier, making the ID unique.
*/
@@ -69,7 +69,7 @@ public class ActivationGroupID
/**
* Create the new activation group id in the scope of the given activation
* system
- *
+ *
* @param aSystem the activation system
*/
public ActivationGroupID(ActivationSystem aSystem)
@@ -80,7 +80,7 @@ public class ActivationGroupID
/**
* Get the associated activation system
- *
+ *
* @return the associated activation system
*/
public ActivationSystem getSystem()
@@ -110,7 +110,7 @@ public class ActivationGroupID
else
return false;
}
-
+
/**
* Get the string representation
*/
diff --git a/java/rmi/activation/ActivationID.java b/java/rmi/activation/ActivationID.java
index e1cc8a712..f89a0edf8 100644
--- a/java/rmi/activation/ActivationID.java
+++ b/java/rmi/activation/ActivationID.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -57,7 +57,7 @@ import java.rmi.server.UID;
* </ul>
* An instance of the ActivationID has the {@link UID} as its component and
* hence is globally unique.
- *
+ *
* @author Audrius Meskauskas (audriusa@bioinformatics.org) (from stub)
*/
public class ActivationID
@@ -72,12 +72,12 @@ public class ActivationID
* The activator.
*/
transient Activator activator;
-
+
/**
* The UID, making this instance unique.
*/
- transient UID uid;
-
+ transient UID uid;
+
/**
* The activation group that has activated the object with this
* activation id. The field is filled in inside the group and is used
@@ -87,7 +87,7 @@ public class ActivationID
/**
* Create a new instance with the given activator.
- *
+ *
* @param an_activator tha activator that should activate the object.
*/
public ActivationID(Activator an_activator)
@@ -95,10 +95,10 @@ public class ActivationID
activator = an_activator;
uid = new UID();
}
-
+
/**
* Activate the object.
- *
+ *
* @param force if true, always contact the group. Otherwise, the cached value
* may be returned.
* @return the activated object
@@ -116,7 +116,7 @@ public class ActivationID
catch (IOException e)
{
ActivationException acex = new ActivationException("id "+uid, e);
- throw acex;
+ throw acex;
}
catch (ClassNotFoundException e)
{
@@ -124,7 +124,7 @@ public class ActivationID
throw acex;
}
}
-
+
/**
* Returns the hash code of the activator.
*/
@@ -132,7 +132,7 @@ public class ActivationID
{
return uid == null ? 0 : uid.hashCode();
}
-
+
/**
* Compares the activators for equality.
*/
@@ -146,12 +146,12 @@ public class ActivationID
else
return false;
}
-
+
/**
* Read the object from the input stream.
- *
+ *
* @param in the stream to read from
- *
+ *
* @throws IOException if thrown by the stream
* @throws ClassNotFoundException
*/
@@ -161,10 +161,10 @@ public class ActivationID
uid = (UID) in.readObject();
activator = (Activator) in.readObject();
}
-
+
/**
* Write the object to the output stream.
- *
+ *
* @param out the stream to write int
* @throws IOException if thrown by the stream
* @throws ClassNotFoundException
@@ -175,7 +175,7 @@ public class ActivationID
out.writeObject(uid);
out.writeObject(activator);
}
-
+
/**
* Compare by .equals if both a and b are not null, compare directly if at
* least one of them is null.
@@ -186,7 +186,7 @@ public class ActivationID
return a == b;
else
return a.equals(b);
- }
+ }
/**
* Return the content based string representation.
@@ -195,5 +195,5 @@ public class ActivationID
{
return uid.toString();
}
-
+
}
diff --git a/java/rmi/activation/ActivationInstantiator.java b/java/rmi/activation/ActivationInstantiator.java
index 3f4b557cb..e4ea54151 100644
--- a/java/rmi/activation/ActivationInstantiator.java
+++ b/java/rmi/activation/ActivationInstantiator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ import java.rmi.RemoteException;
/**
* The implementation of this interface creates (instantiates) the new remote
* objects in response to the activation request. The instantiator is returned
- * by the {@link ActivationGroup} that calls
+ * by the {@link ActivationGroup} that calls
* {@link ActivationSystem#activeGroup(ActivationGroupID, ActivationInstantiator, long)}.
*/
public interface ActivationInstantiator
@@ -60,7 +60,7 @@ public interface ActivationInstantiator
* <li>Creates an instance of the object using its special two parameter
* activation constructor, the first parameter being the {@link ActivationID}
* and the second the {@link MarshalledObject}.</li>
- *
+ *
* @param id the id of the object being instantiated
* @param desc the activation descriptor being instantiated
* @return the MarshalledObject, containing the stub to the newly created
diff --git a/java/rmi/activation/ActivationMonitor.java b/java/rmi/activation/ActivationMonitor.java
index 93def8c44..7c4c17144 100644
--- a/java/rmi/activation/ActivationMonitor.java
+++ b/java/rmi/activation/ActivationMonitor.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,9 +44,9 @@ import java.rmi.Remote;
import java.rmi.RemoteException;
/**
- * The activation and inactivation event listener. The group obtains this
+ * The activation and inactivation event listener. The group obtains this
* listener via {@link ActivationSystem#activeGroup} and must notify it
- * when the group objects are activated or inactivated and also when the
+ * when the group objects are activated or inactivated and also when the
* whole group becomes inactive.
* @author root.
*/
@@ -54,7 +54,7 @@ public interface ActivationMonitor extends Remote
{
/**
* Informs that the object is now active.
- *
+ *
* @param id the activation id of the object that is now active
* @throws UnknownObjectException is such object is not known in this group
* @throws RemoteException if remote call fails
@@ -64,7 +64,7 @@ public interface ActivationMonitor extends Remote
/**
* Informs that the object is not inactive.
- *
+ *
* @param id the activation id of the object that is now inactive
* @throws UnknownObjectException is such object is not known in this group
* @throws RemoteException if remote call fails
@@ -76,7 +76,7 @@ public interface ActivationMonitor extends Remote
* Informs that the whole group is now inactive because all group objects are
* inactive. The group will be recreated upon the later request to activate
* any object, belonging to the group.
- *
+ *
* @param groupId the group id
* @param incarnation the group incarnation number
* @throws UnknownGroupException if the group id is not known
diff --git a/java/rmi/activation/ActivationSystem.java b/java/rmi/activation/ActivationSystem.java
index 719676445..090ce4815 100644
--- a/java/rmi/activation/ActivationSystem.java
+++ b/java/rmi/activation/ActivationSystem.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -66,13 +66,13 @@ public interface ActivationSystem
* .
*/
int SYSTEM_PORT = 1098;
-
+
/**
* Registers the activation descriptor and creates (and returns) its
* activation identifier. The map entry (identifier to descriptor) is stored
* in the stable map and used when the {@link Activator} receives the request
* to activate the object.
- *
+ *
* @param desc the activation descriptor to register.
* @return the created activation identifier that is mapped to the passed
* descriptor.
@@ -84,11 +84,11 @@ public interface ActivationSystem
*/
ActivationID registerObject(ActivationDesc desc) throws ActivationException,
UnknownGroupException, RemoteException;
-
+
/**
* Removes the stored identifier-description map entry. The object will no
* longer be activable using the passed activation id
- *
+ *
* @param id the activation id to remove
* @throws ActivationException if the entry removing operation failed
* (database update problems, etc)
@@ -97,11 +97,11 @@ public interface ActivationSystem
*/
void unregisterObject(ActivationID id) throws ActivationException,
UnknownObjectException, RemoteException;
-
+
/**
* Register the new activation group. For instance, it can be one activation
* group per virtual machine.
- *
+ *
* @param groupDesc the activation group descriptor.
* @return the created activation group ID for the activation group
* @throws ActivationException if the group registration fails
@@ -109,13 +109,13 @@ public interface ActivationSystem
*/
ActivationGroupID registerGroup(ActivationGroupDesc groupDesc)
throws ActivationException, RemoteException;
-
+
/**
* This method is called from the {@link ActivationGroup} to inform the
* ActivatinSystem that the group is now active and there is the
* {@link ActivationInstantiator} for that group. This call is made internally
* from the {@link ActivationGroup#createGroup}.
- *
+ *
* @param id the group id
* @param group the group activation instantiator
* @param incarnation the groups incarnatin number.
@@ -132,7 +132,7 @@ public interface ActivationSystem
/**
* Removes the activation group with the given identifier. The group calls
* back, informing the activator about the shutdown.
- *
+ *
* @param id the group activation id.
* @throws ActivationException if the database update fails
* @throws UnknownGroupException if such group is not registered
@@ -140,10 +140,10 @@ public interface ActivationSystem
*/
void unregisterGroup(ActivationGroupID id) throws ActivationException,
UnknownGroupException, RemoteException;
-
+
/**
* Shutdown the activation system and all associated activation groups
- *
+ *
* @throws RemoteException if the remote call fails
*/
void shutdown() throws RemoteException;
@@ -151,7 +151,7 @@ public interface ActivationSystem
/**
* Replace the activation descriptor for the object with the given activation
* id.
- *
+ *
* @param id the activation id
* @param desc the new activation descriptor
* @return the previous activation descriptor for that object.
@@ -164,11 +164,11 @@ public interface ActivationSystem
ActivationDesc setActivationDesc(ActivationID id, ActivationDesc desc)
throws ActivationException, UnknownObjectException,
UnknownGroupException, RemoteException;
-
+
/**
* Replaces the group descriptor for the group with the given group activation
* id.
- *
+ *
* @param groupId the group id
* @param groupDesc the new group descriptor
* @return the previous group descriptor
@@ -179,10 +179,10 @@ public interface ActivationSystem
ActivationGroupDesc setActivationGroupDesc(ActivationGroupID groupId,
ActivationGroupDesc groupDesc)
throws ActivationException, UnknownGroupException, RemoteException;
-
+
/**
* Get the activation descriptor for the object with the given activation id.
- *
+ *
* @param id the object activation id
* @return the activation descriptor for that object
* @throws ActivationException if the database access fails
@@ -191,10 +191,10 @@ public interface ActivationSystem
*/
ActivationDesc getActivationDesc(ActivationID id) throws ActivationException,
UnknownObjectException, RemoteException;
-
+
/**
* Get the group descriptor for the group with the given id.
- *
+ *
* @param groupId the group id
* @return the group descriptor
* @throws ActivationException if the database access fails
diff --git a/java/rmi/activation/Activator.java b/java/rmi/activation/Activator.java
index d0de12d8c..fc66b2b63 100644
--- a/java/rmi/activation/Activator.java
+++ b/java/rmi/activation/Activator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -58,7 +58,7 @@ public interface Activator
* identifier, determines the object activation group and initiates object
* recreation either via {@link ActivationInstantiator} or via
* {@link Class#newInstance()}.
- *
+ *
* @param id the identifier of the object to activate.
* @param force if true, the activator always contacts the group to obtain the
* reference. If false, it may return the cached value.
diff --git a/java/rmi/activation/UnknownGroupException.java b/java/rmi/activation/UnknownGroupException.java
index 91890a907..3c67aec0c 100644
--- a/java/rmi/activation/UnknownGroupException.java
+++ b/java/rmi/activation/UnknownGroupException.java
@@ -1,4 +1,4 @@
-/* UnknownGroupException.java -- thrown on an invalid ActivationGroupID
+/* UnknownGroupException.java -- thrown on an invalid ActivationGroupID
Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/dgc/DGC.java b/java/rmi/dgc/DGC.java
index 66bfc6dfd..5ec874a5e 100644
--- a/java/rmi/dgc/DGC.java
+++ b/java/rmi/dgc/DGC.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,7 +56,7 @@ public interface DGC
{
/**
* Mark the given objects referecnes as used on the client side.
- *
+ *
* @param ids the ids of the used objects.
* @param sequenceNum the number of the call (used to detect and discard late
* calls).
@@ -68,7 +68,7 @@ public interface DGC
/**
* Mark the given objects as no longer used on the client side.
- *
+ *
* @param ids the ids of the objects that are no longer used.
* @param sequenceNum the number of the call (used to detect and discard late
* @param vmid the VMID of the client.
diff --git a/java/rmi/dgc/Lease.java b/java/rmi/dgc/Lease.java
index 36ff12ad2..58b82cf58 100644
--- a/java/rmi/dgc/Lease.java
+++ b/java/rmi/dgc/Lease.java
@@ -56,7 +56,7 @@ public final class Lease
/**
* Create the new lease with the given id and duration
- *
+ *
* @param id the lease id
* @param duration the lease duration
*/
@@ -68,7 +68,7 @@ public final class Lease
/**
* Get the lease id.
- *
+ *
* @return the lease id
*/
public VMID getVMID()
@@ -78,7 +78,7 @@ public final class Lease
/**
* Get the lease duration
- *
+ *
* @return the lease duration
*/
public long getValue()
@@ -88,7 +88,7 @@ public final class Lease
/**
* Get the string representation of this lease
- *
+ *
* @return the string represenation (lease id, followed by the lease
* duration).
*/
diff --git a/java/rmi/dgc/VMID.java b/java/rmi/dgc/VMID.java
index 22b737367..925c1bfb1 100644
--- a/java/rmi/dgc/VMID.java
+++ b/java/rmi/dgc/VMID.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,24 +49,24 @@ import java.util.Arrays;
* An identifier that is unique accross the all virtual machines. This class is
* used by distributed garbage collector to identify the virtual machine of
* the client, but may also be used in various other cases, when such identifier
- * is required. This class separately stores and transfers the host IP
+ * is required. This class separately stores and transfers the host IP
* address, but will try to do its best also for the case if it failed to
- * determine it. The alternative algorithms are used in {@link UID} that is
+ * determine it. The alternative algorithms are used in {@link UID} that is
* part of this class. The VMID's, created on the same host, but in the two
* separately (parallely) running virtual machines are different.
*/
-public final class VMID implements Serializable
+public final class VMID implements Serializable
{
/**
* Use SVUID for interoperability.
*/
static final long serialVersionUID = -538642295484486218L;
-
+
/**
* If true, the IP of this host can ve reliably determined.
*/
static boolean areWeUnique;
-
+
/**
* The IP address of the local host.
*/
@@ -76,12 +76,12 @@ public final class VMID implements Serializable
* The IP address of the local host.
*/
private byte[] addr;
-
+
/**
* The cached hash code.
*/
transient int hash;
-
+
/**
* The UID of this VMID.
*/
@@ -89,7 +89,7 @@ public final class VMID implements Serializable
static
{
- // This "local host" value usually indicates that the local
+ // This "local host" value usually indicates that the local
// IP address cannot be reliably determined.
byte[] localHost = new byte[] { 127, 0, 0, 1 };
@@ -104,10 +104,10 @@ public final class VMID implements Serializable
areWeUnique = false;
}
}
-
+
/**
* Create the new VMID. All VMID's are unique accross tha all virtual
- * machines.
+ * machines.
*/
public VMID()
{
@@ -119,11 +119,11 @@ public final class VMID implements Serializable
* Return true if it is possible to get the accurate address of this host.
* If false is returned, the created VMID's are less reliable, but the
* starting time and possibly the memory allocation are also taken into
- * consideration in the incorporated UID. Hence the VMID's, created on the
+ * consideration in the incorporated UID. Hence the VMID's, created on the
* different virtual machines, still should be different.
- *
+ *
* @deprecated VMID's are more or less always reliable.
- *
+ *
* @return false if the local host ip address is 127.0.0.1 or unknown,
* true otherwise.
*/
@@ -131,7 +131,7 @@ public final class VMID implements Serializable
{
return areWeUnique;
}
-
+
/**
* Get the hash code of this VMID.
*/
@@ -145,7 +145,7 @@ public final class VMID implements Serializable
}
return hash;
}
-
+
/**
* Returns true if the passed parameter is also VMID and it is equal to this
* VMID. The VMID should only be equal to itself (also if the passed value is
@@ -164,24 +164,24 @@ public final class VMID implements Serializable
return false;
}
-
+
/**
* Get the string representation of this VMID.
*/
public String toString ()
{
CPStringBuilder buf = new CPStringBuilder ("[VMID: ");
-
+
for (int i = 0; i < addr.length; i++)
{
if (i > 0)
{
buf.append (".");
}
-
+
buf.append (Integer.toString (addr [i]));
}
-
+
buf.append (" ");
buf.append (uid.toString ());
buf.append ("]");
diff --git a/java/rmi/registry/LocateRegistry.java b/java/rmi/registry/LocateRegistry.java
index 3547a7ad0..d0918e1b9 100644
--- a/java/rmi/registry/LocateRegistry.java
+++ b/java/rmi/registry/LocateRegistry.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,32 +56,32 @@ public final class LocateRegistry {
private LocateRegistry() {}
public static Registry getRegistry() throws RemoteException {
- return (getRegistry("localhost", Registry.REGISTRY_PORT));
+ return (getRegistry("localhost", Registry.REGISTRY_PORT));
}
public static Registry getRegistry(int port) throws RemoteException {
- return (getRegistry("localhost", port));
+ return (getRegistry("localhost", port));
}
public static Registry getRegistry(String host) throws RemoteException {
- return (getRegistry(host, Registry.REGISTRY_PORT));
+ return (getRegistry(host, Registry.REGISTRY_PORT));
}
public static Registry getRegistry(String host, int port) throws RemoteException {
- return (getRegistry(host, port, RMISocketFactory.getSocketFactory()));
+ return (getRegistry(host, port, RMISocketFactory.getSocketFactory()));
}
public static Registry getRegistry(String host, int port, RMIClientSocketFactory csf) throws RemoteException {
- RemoteRef ref = new UnicastRef(new ObjID(ObjID.REGISTRY_ID), host, port, csf);
- return (new RegistryImpl_Stub(ref));
+ RemoteRef ref = new UnicastRef(new ObjID(ObjID.REGISTRY_ID), host, port, csf);
+ return (new RegistryImpl_Stub(ref));
}
public static Registry createRegistry(int port) throws RemoteException {
- return (createRegistry(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()));
+ return (createRegistry(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()));
}
public static Registry createRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
- return (new RegistryImpl(port, csf, ssf));
+ return (new RegistryImpl(port, csf, ssf));
}
}
diff --git a/java/rmi/registry/Registry.java b/java/rmi/registry/Registry.java
index 02d8c50cc..dabe6549c 100644
--- a/java/rmi/registry/Registry.java
+++ b/java/rmi/registry/Registry.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -47,25 +47,25 @@ import java.rmi.RemoteException;
public interface Registry extends Remote
{
int REGISTRY_PORT = 1099;
-
+
/**
* Find and return the reference to the object that was previously bound
* to the registry by this name. For remote objects, this method returns
* the stub instances, containing the code for remote invocations.
- *
- * Since jdk 1.5 this method does not longer require the stub class
- * (nameImpl_Stub) to be present. If such class is not found, the stub is
- * replaced by the dynamically constructed proxy class. No attempt to find
- * and load the stubs is made if the system property
- * java.rmi.server.ignoreStubClasses is set to true (set to reduce the
+ *
+ * Since jdk 1.5 this method does not longer require the stub class
+ * (nameImpl_Stub) to be present. If such class is not found, the stub is
+ * replaced by the dynamically constructed proxy class. No attempt to find
+ * and load the stubs is made if the system property
+ * java.rmi.server.ignoreStubClasses is set to true (set to reduce the
* starting time if the stubs are surely not present and exclusively 1.2
* RMI is used).
- *
+ *
* @param name the name of the object
- *
+ *
* @return the reference to that object on that it is possible to invoke
* the (usually remote) object methods.
- *
+ *
* @throws RemoteException
* @throws NotBoundException
* @throws AccessException
diff --git a/java/rmi/registry/RegistryHandler.java b/java/rmi/registry/RegistryHandler.java
index b9b450923..19e8caa70 100644
--- a/java/rmi/registry/RegistryHandler.java
+++ b/java/rmi/registry/RegistryHandler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/LoaderHandler.java b/java/rmi/server/LoaderHandler.java
index 8e9661564..de9d6532f 100644
--- a/java/rmi/server/LoaderHandler.java
+++ b/java/rmi/server/LoaderHandler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/LogStream.java b/java/rmi/server/LogStream.java
index a2dfbb47f..a74ffb439 100644
--- a/java/rmi/server/LogStream.java
+++ b/java/rmi/server/LogStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -72,7 +72,7 @@ public class LogStream extends PrintStream
{
return defStream;
}
-
+
/**
* @deprecated
*/
@@ -130,17 +130,17 @@ public class LogStream extends PrintStream
{
return SILENT;
}
-
+
if (s.equalsIgnoreCase ("brief"))
{
return BRIEF;
}
-
+
if (s.equalsIgnoreCase ("verbose"))
{
return VERBOSE;
}
-
+
return SILENT;
}
}
diff --git a/java/rmi/server/ObjID.java b/java/rmi/server/ObjID.java
index 1aaa22360..2bdd44ae0 100644
--- a/java/rmi/server/ObjID.java
+++ b/java/rmi/server/ObjID.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,7 +50,7 @@ import java.io.Serializable;
* Represents the object identifier, unique for the host that generated it.
* The ObjID contains inside the integer object identifier that, if needed,
* may indicated that this is a reference to one of the well known objects
- * on that host (registry, activator or dgc) and the {@link UID} that
+ * on that host (registry, activator or dgc) and the {@link UID} that
* ensures uniqueness.
*/
public final class ObjID
@@ -121,7 +121,7 @@ public final class ObjID
* <li>{@link #DGC_ID} - distributed garbage collector (grants lease
* durations to keep the object before it is garbage collected.</li>
* </ul>
- *
+ *
* @param id the well known object id, one of the above.
*/
public ObjID(int id)
@@ -184,8 +184,8 @@ public final class ObjID
return a == b;
else
return a.equals(b);
- }
-
+ }
+
/**
* Get the string representation.
*/
diff --git a/java/rmi/server/Operation.java b/java/rmi/server/Operation.java
index f7b5f02cc..de30cd08a 100644
--- a/java/rmi/server/Operation.java
+++ b/java/rmi/server/Operation.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,7 +40,7 @@ package java.rmi.server;
/**
* This class was used with jdk 1.1 stubs and skeletons. It is no longer
* needed since jdk 1.2 and higher.
- *
+ *
* @deprecated
*/
public class Operation
@@ -58,7 +58,7 @@ public class Operation
/**
* Get the name of the operation.
- *
+ *
* @deprecated
*/
public String getOperation ()
@@ -68,7 +68,7 @@ public class Operation
/**
* Return the name of the operation.
- *
+ *
* @deprecated
*/
public String toString ()
diff --git a/java/rmi/server/RMIClassLoader.java b/java/rmi/server/RMIClassLoader.java
index 7b69d2f2c..f43a68c5b 100644
--- a/java/rmi/server/RMIClassLoader.java
+++ b/java/rmi/server/RMIClassLoader.java
@@ -74,7 +74,7 @@ public class RMIClassLoader
{
RMIClassLoaderSpi spi = getProviderInstance();
if (spi == null)
- spi = getDefaultProviderInstance();
+ spi = getDefaultProviderInstance();
return spi.loadClass(codebase, name, null);
}
@@ -84,7 +84,7 @@ public class RMIClassLoader
{
RMIClassLoaderSpi spi = getProviderInstance();
if (spi == null)
- spi = getDefaultProviderInstance();
+ spi = getDefaultProviderInstance();
return spi.loadClass(codebase, name, defaultLoader);
}
@@ -120,29 +120,29 @@ public class RMIClassLoader
{
RMIClassLoaderSpi spi = getProviderInstance();
if (spi == null)
- spi = getDefaultProviderInstance();
+ spi = getDefaultProviderInstance();
return spi.loadClass(codeBase.toString(), name, null);
}
/**
* Gets a classloader for the given codebase and with the current
* context classloader as parent.
- *
+ *
* @param codebase
- *
+ *
* @return a classloader for the given codebase
- *
+ *
* @throws MalformedURLException if the codebase contains a malformed URL
*/
- public static ClassLoader getClassLoader(String codebase)
+ public static ClassLoader getClassLoader(String codebase)
throws MalformedURLException
{
RMIClassLoaderSpi spi = getProviderInstance();
if (spi == null)
- spi = getDefaultProviderInstance();
+ spi = getDefaultProviderInstance();
return spi.getClassLoader(codebase);
}
-
+
/**
* Returns a string representation of the network location where a remote
* endpoint can get the class-definition of the given class.
@@ -156,7 +156,7 @@ public class RMIClassLoader
{
RMIClassLoaderSpi spi = getProviderInstance();
if (spi == null)
- spi = getDefaultProviderInstance();
+ spi = getDefaultProviderInstance();
return spi.getClassAnnotation(cl);
}
diff --git a/java/rmi/server/RMIClientSocketFactory.java b/java/rmi/server/RMIClientSocketFactory.java
index a54d11175..ee829fb29 100644
--- a/java/rmi/server/RMIClientSocketFactory.java
+++ b/java/rmi/server/RMIClientSocketFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/RMIFailureHandler.java b/java/rmi/server/RMIFailureHandler.java
index 3496cd6a0..68a5706ed 100644
--- a/java/rmi/server/RMIFailureHandler.java
+++ b/java/rmi/server/RMIFailureHandler.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/RMIServerSocketFactory.java b/java/rmi/server/RMIServerSocketFactory.java
index 88eaff32d..7af8ef069 100644
--- a/java/rmi/server/RMIServerSocketFactory.java
+++ b/java/rmi/server/RMIServerSocketFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/RMISocketFactory.java b/java/rmi/server/RMISocketFactory.java
index 953f1ef33..af5a12072 100644
--- a/java/rmi/server/RMISocketFactory.java
+++ b/java/rmi/server/RMISocketFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/RemoteCall.java b/java/rmi/server/RemoteCall.java
index 35f3bf1a6..cd4b004d8 100644
--- a/java/rmi/server/RemoteCall.java
+++ b/java/rmi/server/RemoteCall.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/RemoteObject.java b/java/rmi/server/RemoteObject.java
index 5b926bfc3..220c1c95b 100644
--- a/java/rmi/server/RemoteObject.java
+++ b/java/rmi/server/RemoteObject.java
@@ -48,7 +48,7 @@ import java.rmi.UnmarshalException;
import java.util.WeakHashMap;
public abstract class RemoteObject
- implements Remote, Serializable {
+ implements Remote, Serializable {
private static final long serialVersionUID = -3215090123894869218l;
@@ -57,15 +57,15 @@ protected transient RemoteRef ref;
private static final WeakHashMap stubs = new WeakHashMap();
protected RemoteObject() {
- this(null);
+ this(null);
}
protected RemoteObject(RemoteRef newref) {
- ref = newref;
+ ref = newref;
}
public RemoteRef getRef() {
- return (ref);
+ return (ref);
}
synchronized static void addStub(Remote obj, Remote stub)
@@ -78,7 +78,7 @@ synchronized static void deleteStub(Remote obj)
stubs.remove(obj);
}
- public static Remote toStub(Remote obj) throws NoSuchObjectException
+ public static Remote toStub(Remote obj) throws NoSuchObjectException
{
Remote stub = (Remote)stubs.get(obj);
@@ -89,36 +89,36 @@ synchronized static void deleteStub(Remote obj)
}
public int hashCode() {
- if (ref == null) {
- return (0);
- }
- else {
- return (ref.hashCode());
- }
+ if (ref == null) {
+ return (0);
+ }
+ else {
+ return (ref.hashCode());
+ }
}
public boolean equals(Object obj) {
- // We only compare references.
- return (this == obj);
+ // We only compare references.
+ return (this == obj);
}
/**
* Get the string representation of this remote object.
*/
- public String toString()
+ public String toString()
{
if (ref == null)
return getClass ().toString ();
return (ref.toString ());
}
-
+
/**
* Read the remote object from the input stream. Expects the class name
* without package first. Then the method creates and assigns the {@link #ref}
* an instance of this class and calls its .readExternal method. The standard
* packageless class names are UnicastRef, UnicastRef2, UnicastServerRef,
* UnicastServerRef2, ActivatableRef or ActivatableServerRef.
- *
+ *
* @param in the stream to read from
* @throws IOException if the IO exception occurs
* @throws ClassNotFoundException if the class with the given name is not
@@ -171,7 +171,7 @@ public boolean equals(Object obj) {
* ActivatableRef or ActivatableServerRef. The empty string with the
* subsequently following serialized ref instance be written if the
* ref.getRefClass returns null.
- *
+ *
* @param out the stream to write to
* @throws IOException if one occurs during writing
* @throws ClassNotFoundException never in this implementation (specified as
diff --git a/java/rmi/server/RemoteObjectInvocationHandler.java b/java/rmi/server/RemoteObjectInvocationHandler.java
index 2c19cd5af..0cf4bca98 100644
--- a/java/rmi/server/RemoteObjectInvocationHandler.java
+++ b/java/rmi/server/RemoteObjectInvocationHandler.java
@@ -60,7 +60,7 @@ import java.util.Hashtable;
* user program. Such instances are automatically created and returned by
* {@link Registry} or {@link UnicastRemoteObject} methods if the remote
* reference is known but the corresponding stub class is not accessible.
- *
+ *
* @see Registry#lookup
*
* @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
@@ -72,32 +72,32 @@ public class RemoteObjectInvocationHandler extends RemoteObject implements
* Use the jdk 1.5 SUID for interoperability.
*/
static final long serialVersionUID = 2L;
-
+
/**
* The RMI method hash codes, computed once as described in the section 8.3
* of the Java Remote Method Invocation (RMI) Specification.
*/
static Hashtable methodHashCodes = new Hashtable();
-
+
/**
* The empty class array to define parameters of .hashCode and .toString.
*/
static final Class[] noArgsC = new Class[0];
-
+
/**
* The class array to define parameters of .equals
*/
static final Class[] anObjectC = new Class[] { Object.class };
-
+
/**
* The empty object array to replace null when no args are passed.
*/
static final Object[] noArgs = new Object[0];
-
+
/**
* Construct the remote invocation handler that forwards calls to the given
* remote object.
- *
+ *
* @param reference the reference to the remote object where the method
* calls should be forwarded.
*/
@@ -121,7 +121,7 @@ public class RemoteObjectInvocationHandler extends RemoteObject implements
* <li>All other methods are converted to remote calls and forwarded to the
* remote reference. </li>
* </ul>
- *
+ *
* @param proxyInstance
* the instance of the proxy stub
* @param method
@@ -148,7 +148,7 @@ public class RemoteObjectInvocationHandler extends RemoteObject implements
throw new IllegalAccessException(name + " does not implement "
+ Remote.class.getName());
}
-
+
if (parameters == null)
parameters = noArgs;
diff --git a/java/rmi/server/RemoteRef.java b/java/rmi/server/RemoteRef.java
index 8bdb66330..e0488fb4c 100644
--- a/java/rmi/server/RemoteRef.java
+++ b/java/rmi/server/RemoteRef.java
@@ -1,5 +1,5 @@
/* RemoteRef.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2004, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,7 +56,7 @@ public interface RemoteRef extends Externalizable
* Indicates compatibility with JDK 1.1.*
*/
long serialVersionUID = 3632638527362204081L;
-
+
/**
* For binary compatibility with the JDK, the string "sun.rmi.server".
* Not actually used for anything.
@@ -67,12 +67,12 @@ public interface RemoteRef extends Externalizable
* @deprecated use {@link #invoke(Remote, Method, Object[], long)} instead.
*/
void invoke (RemoteCall call) throws Exception;
-
+
/**
* Invoke a method. This method either returns the result of remote invocation
* or throws RemoteException if the remote call failed. Other exceptions may
* be thrown if some problem has occured in the application level.
- *
+ *
* @param obj the object, containing the remote reference (for instance,
* remote stub, generated by rmic).
* @param method the method to invoke
@@ -85,7 +85,7 @@ public interface RemoteRef extends Externalizable
*/
Object invoke (Remote obj, Method method, Object[] params, long methodHash)
throws Exception;
-
+
/**
* @deprecated use {@link #invoke(Remote, Method, Object[], long)} instead.
*/
@@ -96,41 +96,41 @@ public interface RemoteRef extends Externalizable
* @deprecated use {@link #invoke(Remote, Method, Object[], long)} instead.
*/
void done (RemoteCall call) throws RemoteException;
-
+
/**
* Compare two remote objects for equality. The references are equal if
* they point to the same remote object.
- *
+ *
* @param ref the reference to compare.
- *
+ *
* @return true if this and passed references both point to the same remote
* object, false otherwise.
*/
boolean remoteEquals (RemoteRef ref);
-
+
/**
* Get the hashcode for a remote object. Two remote object stubs, referring
* to the same remote object, have the same hash code.
- *
+ *
* @return the hashcode of the remote object
*/
int remoteHashCode();
-
-
+
+
/**
* Returns the class name of the reference type that must be written to the
* given stream. When writing, this returned name is passed first, and
* the reference.writeExternal(out) writes the reference specific data.
- *
- * @param out the stream, where the data must be written
- *
- * @return the class name.
+ *
+ * @param out the stream, where the data must be written
+ *
+ * @return the class name.
*/
String getRefClass (ObjectOutput out);
-
+
/**
* Get the string representation of this remote reference.
- *
+ *
* @return the string representation.
*/
String remoteToString();
diff --git a/java/rmi/server/RemoteServer.java b/java/rmi/server/RemoteServer.java
index f022b7326..158c46439 100644
--- a/java/rmi/server/RemoteServer.java
+++ b/java/rmi/server/RemoteServer.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -51,7 +51,7 @@ public abstract class RemoteServer
extends RemoteObject
{
private static final long serialVersionUID = - 4100238210092549637L;
-
+
/**
* Does nothing, delegates to super().
*/
@@ -59,7 +59,7 @@ public abstract class RemoteServer
{
super();
}
-
+
/**
* Does nothing, delegates to super(ref).
*/
@@ -67,13 +67,13 @@ public abstract class RemoteServer
{
super(ref);
}
-
+
/**
* Get the host of the calling client. The current thread must be an instance
* of the {@link RMIIncomingThread}.
- *
+ *
* @return the client host address
- *
+ *
* @throws ServerNotActiveException if the current thread is not an instance
* of the RMIIncomingThread.
*/
@@ -91,20 +91,20 @@ public abstract class RemoteServer
"Unknown client host - current thread not instance of 'RMIIncomingThread'");
}
}
-
+
/**
* Set the stream for logging RMI calls.
- *
+ *
* @param out the stream to set or null to turn the logging off.
*/
public static void setLog(OutputStream out)
{
throw new Error("Not implemented");
}
-
+
/**
* Get the stream for logging RMI calls.
- *
+ *
* @return the associated stream.
*/
public static PrintStream getLog()
diff --git a/java/rmi/server/RemoteStub.java b/java/rmi/server/RemoteStub.java
index d6dff7fad..9fd5846ee 100644
--- a/java/rmi/server/RemoteStub.java
+++ b/java/rmi/server/RemoteStub.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.rmi.server;
/**
- * This is a base class for the automatically generated RMI stubs.
+ * This is a base class for the automatically generated RMI stubs.
*/
public abstract class RemoteStub extends RemoteObject
{
@@ -46,7 +46,7 @@ public abstract class RemoteStub extends RemoteObject
* Use serialVersionUID for interoperability.
*/
static final long serialVersionUID = -1585587260594494182l;
-
+
/**
* Constructs the remote stub with no reference set.
*/
@@ -54,11 +54,11 @@ public abstract class RemoteStub extends RemoteObject
{
super ();
}
-
+
/**
* Constructs the remote stub that uses given remote reference for the
* method invocations.
- *
+ *
* @param ref the remote reference for the method invocation.
*/
protected RemoteStub (RemoteRef ref)
@@ -67,10 +67,10 @@ public abstract class RemoteStub extends RemoteObject
}
/**
- * Sets the given remote reference for the given stub. This method is
+ * Sets the given remote reference for the given stub. This method is
* deprecated. Pass the stub remote reference to the RemoteStub
* constructor instead.
- *
+ *
* @deprecated
*/
protected static void setRef (RemoteStub stub, RemoteRef ref)
diff --git a/java/rmi/server/ServerRef.java b/java/rmi/server/ServerRef.java
index cf1013cf0..5d34ef2e2 100644
--- a/java/rmi/server/ServerRef.java
+++ b/java/rmi/server/ServerRef.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/Skeleton.java b/java/rmi/server/Skeleton.java
index 82f5d3837..94d57986b 100644
--- a/java/rmi/server/Skeleton.java
+++ b/java/rmi/server/Skeleton.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/rmi/server/UID.java b/java/rmi/server/UID.java
index 940339e81..464d3d860 100644
--- a/java/rmi/server/UID.java
+++ b/java/rmi/server/UID.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,8 +49,8 @@ import java.net.InetAddress;
* it. It contains time (when created), counter (the number of the UID
* creation order) and virtual machine id components. The UID can also be
* constructed specifying a "well known" identifier in the for of short:
- * this identifier defines the UID uniqueness alone.
- *
+ * this identifier defines the UID uniqueness alone.
+ *
* @author Audrius Meskauskas (audriusa@bioinformatics.org)
*/
public final class UID
@@ -60,16 +60,16 @@ public final class UID
* Use the serial version uid for interoperability.
*/
private static final long serialVersionUID = 1086053664494604050L;
-
+
/**
* The UID counter (the ordinary number in the sequence of number of UID's,
- * created during the recent millisecond). In the next millisecond, it
+ * created during the recent millisecond). In the next millisecond, it
* starts from the minimal value again. In the unlikely case of creating
* more than 65536 uids per millisecond the process pauses till the next
* ms.
*/
private static short uidCounter = Short.MIN_VALUE;
-
+
/**
* The time, when the last UID has been created.
*/
@@ -94,7 +94,7 @@ public final class UID
* The time stamp, when the UID was created.
*/
private long time;
-
+
/**
* Create the new UID that would have the described features of the
* uniqueness.
@@ -130,19 +130,19 @@ public final class UID
}
}
}
-
+
/**
* Create the new UID with the well known id (number). All UIDs, creates
* with the this constructor having the same parameter are equal to each
* other (regardless to the host and time where they were created.
- *
+ *
* @param wellKnownId the well known UID.
*/
public UID(short wellKnownId)
{
unique = wellKnownId;
}
-
+
/**
* Get the hashCode of this UID.
*/
@@ -150,7 +150,7 @@ public final class UID
{
return (int) (unique ^ time ^ count);
}
-
+
/**
* Compare this UID with another UID for equality (not equal to other types of
* objects).
@@ -165,7 +165,7 @@ public final class UID
else
return false;
}
-
+
public static UID read(DataInput in) throws IOException
{
UID uid = new UID();
@@ -208,10 +208,10 @@ public final class UID
return new Object().hashCode() ^ (int) System.currentTimeMillis()
^ hostIpHash;
}
-
+
/**
* Get the string representation of this UID.
- *
+ *
* @return a string, uniquely identifying this id.
*/
public String toString()
diff --git a/java/rmi/server/UnicastRemoteObject.java b/java/rmi/server/UnicastRemoteObject.java
index 6ef3432b5..b6a972126 100644
--- a/java/rmi/server/UnicastRemoteObject.java
+++ b/java/rmi/server/UnicastRemoteObject.java
@@ -1,5 +1,5 @@
/* UnicastRemoteObject.java --
- Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003, 2006
+ Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003, 2006
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,7 +46,7 @@ import java.rmi.Remote;
import java.rmi.RemoteException;
/**
- * This class obtains stub that communicates with the remote object.
+ * This class obtains stub that communicates with the remote object.
*/
public class UnicastRemoteObject extends RemoteServer
{
@@ -57,19 +57,19 @@ public class UnicastRemoteObject extends RemoteServer
//The following serialized fields are from Java API Documentation
// "Serialized form"
-
+
/**
* The port, on that the created remote object becomes available,
* zero meaning the anonymous port.
*/
private int port;
-
+
/**
* The client socket factory for producing client sockets, used by this
* object.
*/
private RMIClientSocketFactory csf;
-
+
/**
* The server socket factory for producing server sockets, used by this
* object.
@@ -78,44 +78,44 @@ public class UnicastRemoteObject extends RemoteServer
/**
* Create and export new remote object without specifying the port value.
- *
+ *
* @throws RemoteException if the attempt to export the object failed.
*/
protected UnicastRemoteObject()
throws RemoteException
{
- this(0);
+ this(0);
}
-
+
/**
* Create and export the new remote object, making it available at the
* given port, local host.
- *
+ *
* @param port the port, on that the object should become available.
* Zero means anonymous port.
- *
+ *
* @throws RemoteException if the attempt to export the object failed.
*/
protected UnicastRemoteObject(int port)
throws RemoteException
{
- this(port, RMISocketFactory.getSocketFactory(),
+ this(port, RMISocketFactory.getSocketFactory(),
RMISocketFactory.getSocketFactory());
}
/**
* Create and export the new remote object, making it available at the
* given port, using sockets, produced by the specified factories.
- *
+ *
* @param port the port, on that the object should become available.
* Zero means anonymous port.
- *
+ *
* @param clientSocketFactory the client socket factory
* @param serverSocketFactory the server socket factory
- *
+ *
* @throws RemoteException if the attempt to export the object failed.
*/
- protected UnicastRemoteObject(int port,
+ protected UnicastRemoteObject(int port,
RMIClientSocketFactory clientSocketFactory,
RMIServerSocketFactory serverSocketFactory)
throws RemoteException
@@ -131,53 +131,53 @@ public class UnicastRemoteObject extends RemoteServer
protected UnicastRemoteObject(RemoteRef ref)
throws RemoteException
{
- super((UnicastServerRef) ref);
- exportObject(this, 0);
+ super((UnicastServerRef) ref);
+ exportObject(this, 0);
}
public Object clone()
throws CloneNotSupportedException
{
- throw new Error("Not implemented");
+ throw new Error("Not implemented");
}
-
+
/**
- * Export object, making it available for the remote calls at the
- * anonymous port.
- *
+ * Export object, making it available for the remote calls at the
+ * anonymous port.
+ *
* This method returns the instance of the abstract class, not an interface.
* Hence it will not work with the proxy stubs that are supported since
* jdk 1.5 (such stubs cannot be derived from the RemoteStub). Only use
* this method if you are sure that the stub class will be accessible.
- *
+ *
* @param obj the object being exported.
- *
+ *
* @return the remote object stub
- *
+ *
* @throws RemoteException if the attempt to export the object failed.
*/
public static RemoteStub exportObject(Remote obj)
throws RemoteException
{
- return (RemoteStub) exportObject(obj, 0);
+ return (RemoteStub) exportObject(obj, 0);
}
/**
- * Export object, making it available for the remote calls at the
+ * Export object, making it available for the remote calls at the
* specified port.
- *
+ *
* Since jdk 1.5 this method does not longer require the stub class to be
- * present. If such class is not found, the stub is replaced by the
+ * present. If such class is not found, the stub is replaced by the
* dynamically constructed proxy class. No attempt to find and load the stubs
* is made if the system property java.rmi.server.ignoreStubClasses
- * is set to true (set to reduce the starting time if the stubs are
+ * is set to true (set to reduce the starting time if the stubs are
* surely not present and exclusively 1.2 RMI is used).
- *
+ *
* @param obj the object being exported.
* @param port the remote object port
- *
+ *
* @return the remote object stub
- *
+ *
* @throws RemoteException if the attempt to export the object failed.
*/
public static Remote exportObject(Remote obj, int port)
@@ -189,21 +189,21 @@ public class UnicastRemoteObject extends RemoteServer
/**
* Create and export the new remote object, making it available at the
* given port, using sockets, produced by the specified factories.
- *
+ *
* Since jdk 1.5 this method does not longer require the stub class to be
- * present. If such class is not found, the stub is replaced by the
+ * present. If such class is not found, the stub is replaced by the
* dynamically constructed proxy class. No attempt to find and load the stubs
* is made if the system property java.rmi.server.ignoreStubClasses
- * is set to true (set to reduce the starting time if the stubs are
+ * is set to true (set to reduce the starting time if the stubs are
* surely not present and exclusively 1.2 RMI is used).
- *
+ *
* @param port the port, on that the object should become available.
* Zero means anonymous port.
- *
+ *
* @param serverSocketFactory the server socket factory
- */
- static Remote exportObject(Remote obj, int port,
- RMIServerSocketFactory serverSocketFactory)
+ */
+ static Remote exportObject(Remote obj, int port,
+ RMIServerSocketFactory serverSocketFactory)
throws RemoteException
{
UnicastServerRef sref = null;
@@ -224,13 +224,13 @@ public class UnicastRemoteObject extends RemoteServer
public static Remote exportObject(Remote obj, int port,
RMIClientSocketFactory csf,
RMIServerSocketFactory ssf)
- throws RemoteException
+ throws RemoteException
{
return (exportObject(obj, port, ssf));
}
- public static boolean unexportObject(Remote obj, boolean force)
- throws NoSuchObjectException
+ public static boolean unexportObject(Remote obj, boolean force)
+ throws NoSuchObjectException
{
if (obj instanceof RemoteObject)
{
diff --git a/java/rmi/server/Unreferenced.java b/java/rmi/server/Unreferenced.java
index 982aa6445..6d4df48bc 100644
--- a/java/rmi/server/Unreferenced.java
+++ b/java/rmi/server/Unreferenced.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/AccessControlContext.java b/java/security/AccessControlContext.java
index ffcfc0e41..fd964751c 100644
--- a/java/security/AccessControlContext.java
+++ b/java/security/AccessControlContext.java
@@ -40,8 +40,8 @@ package java.security;
import java.util.HashSet;
/**
- * AccessControlContext makes system resource access decsion
- * based on permission rights.
+ * AccessControlContext makes system resource access decsion
+ * based on permission rights.
*
* It is used for a specific context and has only one method
* checkPermission. It is similar to AccessController except
@@ -60,7 +60,7 @@ public final class AccessControlContext
/**
* Construct a new AccessControlContext with the specified
- * ProtectionDomains. <code>context</code> must not be
+ * ProtectionDomains. <code>context</code> must not be
* null and duplicates will be removed.
*
* @param context The ProtectionDomains to use
@@ -87,29 +87,29 @@ public final class AccessControlContext
* @since 1.3
*/
public AccessControlContext(AccessControlContext acc,
- DomainCombiner combiner)
+ DomainCombiner combiner)
{
AccessControlContext acc2 = null;
SecurityManager sm = System.getSecurityManager ();
if (sm != null)
{
- Permission perm =
- new SecurityPermission ("createAccessControlContext");
-
- // The default SecurityManager.checkPermission(perm) just calls
- // AccessController.checkPermission(perm) which in turn just
- // calls AccessController.getContext().checkPermission(perm).
- // This means AccessController.getContext() is called twice,
- // once for the security check and once by us. It's a very
- // expensive call (on gcj at least) so if we're using the
- // default security manager we avoid this duplication.
- if (sm.getClass() == SecurityManager.class)
- {
- acc2 = AccessController.getContext ();
- acc2.checkPermission (perm);
- }
- else
- sm.checkPermission (perm);
+ Permission perm =
+ new SecurityPermission ("createAccessControlContext");
+
+ // The default SecurityManager.checkPermission(perm) just calls
+ // AccessController.checkPermission(perm) which in turn just
+ // calls AccessController.getContext().checkPermission(perm).
+ // This means AccessController.getContext() is called twice,
+ // once for the security check and once by us. It's a very
+ // expensive call (on gcj at least) so if we're using the
+ // default security manager we avoid this duplication.
+ if (sm.getClass() == SecurityManager.class)
+ {
+ acc2 = AccessController.getContext ();
+ acc2.checkPermission (perm);
+ }
+ else
+ sm.checkPermission (perm);
}
if (acc2 == null)
acc2 = AccessController.getContext ();
@@ -137,7 +137,7 @@ public final class AccessControlContext
/**
* Determines whether or not the specific permission is granted
- * depending on the context it is within.
+ * depending on the context it is within.
*
* @param perm a permission to check
*
@@ -146,19 +146,19 @@ public final class AccessControlContext
public void checkPermission(Permission perm) throws AccessControlException
{
if (protectionDomains.length == 0)
- throw new AccessControlException ("permission "
- + perm
- + " not granted: no protection domains");
+ throw new AccessControlException ("permission "
+ + perm
+ + " not granted: no protection domains");
for (int i = 0; i < protectionDomains.length; i++)
{
- final ProtectionDomain domain = protectionDomains[i];
- if (!domain.implies(perm))
- throw new AccessControlException ("permission "
- + perm
- + " not granted: "
- + domain
- + " does not imply it.");
+ final ProtectionDomain domain = protectionDomains[i];
+ if (!domain.implies(perm))
+ throw new AccessControlException ("permission "
+ + perm
+ + " not granted: "
+ + domain
+ + " does not imply it.");
}
}
@@ -176,10 +176,10 @@ public final class AccessControlContext
{
if (obj instanceof AccessControlContext)
{
- AccessControlContext acc = (AccessControlContext) obj;
+ AccessControlContext acc = (AccessControlContext) obj;
- if (acc.protectionDomains.length != protectionDomains.length)
- return false;
+ if (acc.protectionDomains.length != protectionDomains.length)
+ return false;
int i, j;
for (i = 0; i < protectionDomains.length; i++)
diff --git a/java/security/AccessController.java b/java/security/AccessController.java
index 6f8b3ecbd..ec5b14c9e 100644
--- a/java/security/AccessController.java
+++ b/java/security/AccessController.java
@@ -155,7 +155,7 @@ public final class AccessController
}
catch (RuntimeException e)
{
- throw e;
+ throw e;
}
catch (Exception e)
{
@@ -196,7 +196,7 @@ public final class AccessController
}
catch (RuntimeException e)
{
- throw e;
+ throw e;
}
catch (Exception e)
{
diff --git a/java/security/AlgorithmParameterGenerator.java b/java/security/AlgorithmParameterGenerator.java
index da1ea46d2..a92552b9e 100644
--- a/java/security/AlgorithmParameterGenerator.java
+++ b/java/security/AlgorithmParameterGenerator.java
@@ -48,7 +48,7 @@ import java.security.spec.AlgorithmParameterSpec;
/**
* <code>AlgorithmParameterGenerator</code> is used to generate algorithm
* parameters for specified algorithms.
- *
+ *
* <p>In case the client does not explicitly initialize the
* <code>AlgorithmParameterGenerator</code> (via a call to an
* <code>init()</code> method), each provider must supply (and document) a
@@ -73,7 +73,7 @@ public class AlgorithmParameterGenerator
/**
* Constructs a new instance of <code>AlgorithmParameterGenerator</code>.
- *
+ *
* @param paramGenSpi
* the generator to use.
* @param provider
@@ -82,8 +82,8 @@ public class AlgorithmParameterGenerator
* the algorithm to use.
*/
protected AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi
- paramGenSpi, Provider provider,
- String algorithm)
+ paramGenSpi, Provider provider,
+ String algorithm)
{
this.paramGenSpi = paramGenSpi;
this.provider = provider;
@@ -99,7 +99,7 @@ public class AlgorithmParameterGenerator
/**
* Returns a new <code>AlgorithmParameterGenerator</code> instance which
* generates algorithm parameters for the specified algorithm.
- *
+ *
* @param algorithm the name of algorithm to use.
* @return the new instance.
* @throws NoSuchAlgorithmException if <code>algorithm</code> is not
@@ -129,7 +129,7 @@ public class AlgorithmParameterGenerator
/**
* Returns a new <code>AlgorithmParameterGenerator</code> instance which
* generates algorithm parameters for the specified algorithm.
- *
+ *
* @param algorithm the name of algorithm to use.
* @param provider the name of the {@link Provider} to use.
* @return the new instance.
@@ -157,7 +157,7 @@ public class AlgorithmParameterGenerator
/**
* Returns a new <code>AlgorithmParameterGenerator</code> instance which
* generates algorithm parameters for the specified algorithm.
- *
+ *
* @param algorithm the name of algorithm to use.
* @param provider the {@link Provider} to use.
* @return the new instance.
@@ -213,7 +213,7 @@ public class AlgorithmParameterGenerator
/**
* Initializes this instance with the specified size. Since no source of
* randomness is supplied, a default one will be used.
- *
+ *
* @param size
* size (in bits) to use.
*/
@@ -225,7 +225,7 @@ public class AlgorithmParameterGenerator
/**
* Initializes this instance with the specified key-size and source of
* randomness.
- *
+ *
* @param size
* the size (in bits) to use.
* @param random
@@ -239,7 +239,7 @@ public class AlgorithmParameterGenerator
/**
* Initializes this instance with the specified {@link AlgorithmParameterSpec}.
* Since no source of randomness is supplied, a default one will be used.
- *
+ *
* @param genParamSpec
* the {@link AlgorithmParameterSpec} to use.
* @throws InvalidAlgorithmParameterException
@@ -254,7 +254,7 @@ public class AlgorithmParameterGenerator
/**
* Initializes this instance with the specified {@link AlgorithmParameterSpec}
* and source of randomness.
- *
+ *
* @param genParamSpec
* the {@link AlgorithmParameterSpec} to use.
* @param random
diff --git a/java/security/AlgorithmParameterGeneratorSpi.java b/java/security/AlgorithmParameterGeneratorSpi.java
index 3143ea76b..15f39f646 100644
--- a/java/security/AlgorithmParameterGeneratorSpi.java
+++ b/java/security/AlgorithmParameterGeneratorSpi.java
@@ -39,8 +39,8 @@ package java.security;
import java.security.spec.AlgorithmParameterSpec;
/**
- AlgorithmParameterGeneratorSpi is the Service Provider
- Interface for the AlgorithmParameterGenerator class.
+ AlgorithmParameterGeneratorSpi is the Service Provider
+ Interface for the AlgorithmParameterGenerator class.
This class is used to generate the algorithm parameters
for a specific algorithm.
@@ -61,7 +61,7 @@ public abstract class AlgorithmParameterGeneratorSpi
Initializes the parameter generator with the specified size
and SecureRandom
- @param size the size( in number of bits)
+ @param size the size( in number of bits)
@param random the SecureRandom class to use for randomness
*/
protected abstract void engineInit(int size, SecureRandom random);
@@ -80,7 +80,7 @@ public abstract class AlgorithmParameterGeneratorSpi
@throws InvalidAlgorithmParameterException genParamSpec is invalid
*/
protected abstract void engineInit(AlgorithmParameterSpec genParamSpec,
- SecureRandom random) throws
+ SecureRandom random) throws
InvalidAlgorithmParameterException;
diff --git a/java/security/AlgorithmParameters.java b/java/security/AlgorithmParameters.java
index 3de8ad02c..ba805143e 100644
--- a/java/security/AlgorithmParameters.java
+++ b/java/security/AlgorithmParameters.java
@@ -69,7 +69,7 @@ public class AlgorithmParameters
/**
* Constructs a new instance of <code>AlgorithmParameters</code>.
- *
+ *
* @param paramSpi
* the engine to use.
* @param provider
@@ -97,7 +97,7 @@ public class AlgorithmParameters
* <p>
* The returned <code>AlgorithmParameters</code> must still be initialized
* with an <code>init()</code> method.
- *
+ *
* @param algorithm the algorithm to use.
* @return the new instance repesenting the desired algorithm.
* @throws NoSuchAlgorithmException if the algorithm is not implemented by any
@@ -131,7 +131,7 @@ public class AlgorithmParameters
* The returned <code>AlgorithmParameters</code> must still be intialized
* with an <code>init()</code> method.
* </p>
- *
+ *
* @param algorithm the algorithm to use.
* @param provider the name of the {@link Provider} to use.
* @return the new instance repesenting the desired algorithm.
@@ -162,7 +162,7 @@ public class AlgorithmParameters
* <p>
* The returned <code>AlgorithmParameters</code> must still be intialized
* with an <code>init()</code> method.
- *
+ *
* @param algorithm the algorithm to use.
* @param provider the {@link Provider} to use.
* @return the new instance repesenting the desired algorithm.
@@ -213,7 +213,7 @@ public class AlgorithmParameters
/**
* Initializes the engine with the specified {@link AlgorithmParameterSpec}.
- *
+ *
* @param paramSpec
* A {@link AlgorithmParameterSpec} to use.
* @throws InvalidParameterSpecException
@@ -230,7 +230,7 @@ public class AlgorithmParameters
* array and decodes them according to the ASN.1 specification. If the ASN.1
* specification exists then it succeeds otherwise an {@link IOException} is
* thrown.
- *
+ *
* @param params
* the parameters to use.
* @throws IOException
@@ -247,7 +247,7 @@ public class AlgorithmParameters
* If <code>format</code> is <code>null</code>, then this method decodes the
* byte array using the ASN.1 specification if it exists, otherwise it throws
* an {@link IOException}.
- *
+ *
* @param params
* the parameters to use.
* @param format
@@ -263,7 +263,7 @@ public class AlgorithmParameters
/**
* Returns a new instance of <code>AlgorithmParameters</code> as a
* designated parameter specification {@link Class}.
- *
+ *
* @param paramSpec
* the {@link Class} to use.
* @return the parameter specification.
@@ -280,7 +280,7 @@ public class AlgorithmParameters
/**
* Returns the parameters in the default encoding format. The primary encoding
* format is ASN.1 if it exists for the specified type.
- *
+ *
* @return byte array representing the parameters.
*/
public final byte[] getEncoded() throws IOException
@@ -292,7 +292,7 @@ public class AlgorithmParameters
* Returns the parameters in the specified encoding format. If
* <code>format</code> is <code>null</code> then the ASN.1 encoding
* format is used if it exists for the specified type.
- *
+ *
* @param format
* the name of the encoding format to use.
* @return the parameters encoded using the specified encoding scheme.
@@ -307,7 +307,7 @@ public class AlgorithmParameters
/**
* Returns a string representation of the encoded form.
- *
+ *
* @return a string representation of the encoded form.
*/
public final String toString()
diff --git a/java/security/AlgorithmParametersSpi.java b/java/security/AlgorithmParametersSpi.java
index bd61ce7df..15cc1c657 100644
--- a/java/security/AlgorithmParametersSpi.java
+++ b/java/security/AlgorithmParametersSpi.java
@@ -60,7 +60,7 @@ public abstract class AlgorithmParametersSpi
}
/**
- * Initializes the engine with the specified
+ * Initializes the engine with the specified
* AlgorithmParameterSpec class.
*
* @param paramSpec A AlgorithmParameterSpec to initialize with
@@ -72,7 +72,7 @@ public abstract class AlgorithmParametersSpi
throws InvalidParameterSpecException;
/**
- * Initializes the engine with the specified
+ * Initializes the engine with the specified
* parameters stored in the byte array and decodes them
* according to the ASN.1 specification. If the ASN.1
* specification exists then it succeeds or else it throws
@@ -85,10 +85,10 @@ public abstract class AlgorithmParametersSpi
protected abstract void engineInit(byte[]params) throws IOException;
/**
- * Initializes the engine with the specified
+ * Initializes the engine with the specified
* parameters stored in the byte array and decodes them
- * according to the specified decoding specification.
- * If format is null, then it is decoded using the ASN.1
+ * according to the specified decoding specification.
+ * If format is null, then it is decoded using the ASN.1
* specification if it exists or else it throws
* IOException.
*
@@ -113,13 +113,13 @@ public abstract class AlgorithmParametersSpi
* @throws InvalidParameterSpecException if the paramSpec is an
* invalid parameter class
*/
- protected abstract <T extends AlgorithmParameterSpec>
+ protected abstract <T extends AlgorithmParameterSpec>
T engineGetParameterSpec(Class<T> paramSpec)
throws InvalidParameterSpecException;
/**
- * Returns the parameters in the default encoding format.
+ * Returns the parameters in the default encoding format.
* The primary encoding format is ASN.1 format if it exists
* for the specified type.
*
@@ -129,9 +129,9 @@ public abstract class AlgorithmParametersSpi
/**
- * Returns the parameters in the specified encoding format.
- * If <code>format</code> is <code>null</code> then the
- * primary encoding format is used, the ASN.1 format,
+ * Returns the parameters in the specified encoding format.
+ * If <code>format</code> is <code>null</code> then the
+ * primary encoding format is used, the ASN.1 format,
* if it exists for the specified type.
*
* @return byte array representing the parameters
@@ -140,7 +140,7 @@ public abstract class AlgorithmParametersSpi
throws IOException;
/**
- * Returns a string describing the parameters in the
+ * Returns a string describing the parameters in the
* AlgorithmParametersSpi class.
*
* @return A string representing the format of the parameters.
diff --git a/java/security/CodeSource.java b/java/security/CodeSource.java
index 90eb08907..dd353eda0 100644
--- a/java/security/CodeSource.java
+++ b/java/security/CodeSource.java
@@ -195,14 +195,14 @@ public class CodeSource implements Serializable
*
* <p>For example, each of these locations imply the location
* "http://java.sun.com/classes/foo.jar":</p>
- *
+ *
* <pre>
* http:
* http://*.sun.com/classes/*
* http://java.sun.com/classes/-
* http://java.sun.com/classes/foo.jar
* </pre>
- *
+ *
* <p>Note that the code source with null location and null certificates implies
* all other code sources.</p>
*
diff --git a/java/security/DigestInputStream.java b/java/security/DigestInputStream.java
index 0d4a9d05d..c0a74f3ab 100644
--- a/java/security/DigestInputStream.java
+++ b/java/security/DigestInputStream.java
@@ -43,8 +43,8 @@ import java.io.IOException;
import java.io.InputStream;
/**
- * DigestInputStream is a class that ties an InputStream with a
- * MessageDigest. The Message Digest is used by the class to
+ * DigestInputStream is a class that ties an InputStream with a
+ * MessageDigest. The Message Digest is used by the class to
* update it self as bytes are read from the InputStream.
*
* The updating to the digest depends on the on flag which is set
@@ -57,7 +57,7 @@ import java.io.InputStream;
public class DigestInputStream extends FilterInputStream
{
/**
- * The message digest for the DigestInputStream
+ * The message digest for the DigestInputStream
*/
protected MessageDigest digest;
@@ -66,7 +66,7 @@ public class DigestInputStream extends FilterInputStream
/**
* Constructs a new DigestInputStream.
- * It associates a MessageDigest with the stream to
+ * It associates a MessageDigest with the stream to
* compute the stream as data is written.
*
* @param stream An InputStream to associate this stream with
@@ -80,7 +80,7 @@ public class DigestInputStream extends FilterInputStream
}
/**
- * Returns the MessageDigest associated with this DigestInputStream
+ * Returns the MessageDigest associated with this DigestInputStream
*
* @return The MessageDigest used to hash this stream
*/
@@ -99,12 +99,12 @@ public class DigestInputStream extends FilterInputStream
this.digest = digest;
}
- /**
+ /**
* Reads a byte from the input stream and updates the digest.
- * This method reads the underlying input stream and if the
+ * This method reads the underlying input stream and if the
* on flag is true then updates the message digest.
*
- * @return Returns a byte from the input stream, -1 is returned to indicate that
+ * @return Returns a byte from the input stream, -1 is returned to indicate that
* the end of stream was reached before this read call
*
* @throws IOException if an IO error occurs in the underlying input stream,
@@ -120,15 +120,15 @@ public class DigestInputStream extends FilterInputStream
return temp;
}
- /**
+ /**
* Reads bytes from the input stream and updates the digest.
- * This method reads the underlying input stream and if the
+ * This method reads the underlying input stream and if the
* on flag is true then updates the message digest.
*
* @param b a byte array to store the data from the input stream
* @param off an offset to start at in the array
* @param len length of data to read
- * @return Returns count of bytes read, -1 is returned to indicate that
+ * @return Returns count of bytes read, -1 is returned to indicate that
* the end of stream was reached before this read call
*
* @throws IOException if an IO error occurs in the underlying input stream,
diff --git a/java/security/DigestOutputStream.java b/java/security/DigestOutputStream.java
index 037b39e78..748f83d79 100644
--- a/java/security/DigestOutputStream.java
+++ b/java/security/DigestOutputStream.java
@@ -105,7 +105,7 @@ public class DigestOutputStream extends FilterOutputStream
*
* @param b A byte to write to the output stream
*
- * @exception IOException if the underlying output stream
+ * @exception IOException if the underlying output stream
* cannot write the byte, this is thrown.
*/
public void write(int b) throws IOException
@@ -124,7 +124,7 @@ public class DigestOutputStream extends FilterOutputStream
* @param off Offset to start to start at in array
* @param len Length of data to write
*
- * @exception IOException if the underlying output stream
+ * @exception IOException if the underlying output stream
* cannot write the bytes, this is thrown.
*/
public void write(byte[]b, int off, int len) throws IOException
diff --git a/java/security/GeneralSecurityException.java b/java/security/GeneralSecurityException.java
index 87e51ce3b..b2594c5fb 100644
--- a/java/security/GeneralSecurityException.java
+++ b/java/security/GeneralSecurityException.java
@@ -40,7 +40,7 @@ package java.security;
/**
* This class is the common superclass of all security exceptions. All
* exceptions in java.security extend this class with the exception (no
- * pun intended) of <code>AccessControlException</code> and
+ * pun intended) of <code>AccessControlException</code> and
* <code>CertificateException</code> (which extend
* <code>SecurityException</code>), <code>ProviderException</code>
* (<code>RuntimeException</code>), and <code>InvalidParamterException</code>
diff --git a/java/security/Identity.java b/java/security/Identity.java
index c9df0a58f..83ec4c8e1 100644
--- a/java/security/Identity.java
+++ b/java/security/Identity.java
@@ -44,14 +44,14 @@ import java.util.Vector;
* The <code>Identity</code> class is used to represent people and companies
* that can be authenticated using public key encryption. The identities can
* also be abstract objects such as smart cards.
- *
+ *
* <p><code>Identity</code> objects store a name and public key for each
* identity. The names cannot be changed and the identities can be scoped. Each
* identity (name and public key) within a scope are unique to that scope.</p>
- *
+ *
* <p>Each identity has a set of ceritificates which all specify the same
* public key, but not necessarily the same name.</p>
- *
+ *
* <p>The <code>Identity</code> class can be subclassed to allow additional
* information to be attached to it.</p>
*
@@ -81,7 +81,7 @@ public abstract class Identity implements Principal, Serializable
/**
* Constructs a new instance of <code>Identity</code> with the specified
* name and scope.
- *
+ *
* @param name
* the name to use.
* @param scope
@@ -99,7 +99,7 @@ public abstract class Identity implements Principal, Serializable
/**
* Constructs a new instance of <code>Identity</code> with the specified
* name and no scope.
- *
+ *
* @param name
* the name to use.
*/
@@ -133,7 +133,7 @@ public abstract class Identity implements Principal, Serializable
/**
* Sets the public key for this identity. The old key and all certificates
* are removed.
- *
+ *
* @param key
* the public key to use.
* @throws KeyManagementException
@@ -154,7 +154,7 @@ public abstract class Identity implements Principal, Serializable
/**
* Sets the general information string.
- *
+ *
* @param info
* the general information string.
* @throws SecurityException
@@ -183,7 +183,7 @@ public abstract class Identity implements Principal, Serializable
* Adds a certificate to the list of ceritificates for this identity. The
* public key in this certificate must match the existing public key if it
* exists.
- *
+ *
* @param certificate
* the certificate to add.
* @throws KeyManagementException
@@ -202,15 +202,15 @@ public abstract class Identity implements Principal, Serializable
// Check public key of this certificate against the first one in the vector
if (certificates.size() > 0)
{
- if (((Certificate) certificates.firstElement()).getPublicKey() != publicKey)
- throw new KeyManagementException("Public key does not match");
+ if (((Certificate) certificates.firstElement()).getPublicKey() != publicKey)
+ throw new KeyManagementException("Public key does not match");
}
certificates.addElement(certificate);
}
/**
* Removes a certificate from the list of ceritificates for this identity.
- *
+ *
* @param certificate
* the certificate to remove.
* @throws KeyManagementException
@@ -248,7 +248,7 @@ public abstract class Identity implements Principal, Serializable
* checks if they are the same object, then if the name and scope match and
* returns <code>true</code> if successful. If these tests fail, the
* {@link #identityEquals(Identity)} method is called.
- *
+ *
* @return <code>true</code> if they are equal, <code>false</code>
* otherwise.
*/
@@ -256,14 +256,14 @@ public abstract class Identity implements Principal, Serializable
{
if (identity instanceof Identity)
{
- if (identity == this)
- return true;
+ if (identity == this)
+ return true;
- if ((((Identity) identity).getName().equals(this.name)) &&
- (((Identity) identity).getScope().equals(this.scope)))
- return true;
+ if ((((Identity) identity).getName().equals(this.name)) &&
+ (((Identity) identity).getScope().equals(this.scope)))
+ return true;
- return identityEquals((Identity) identity);
+ return identityEquals((Identity) identity);
}
return false;
}
@@ -272,19 +272,19 @@ public abstract class Identity implements Principal, Serializable
* Checks for equality between this Identity and a specified object. A
* subclass should override this method. The default behavior is to return
* <code>true</code> if the public key and names match.
- *
+ *
* @return <code>true</code> if they are equal, <code>false</code>
* otherwise.
*/
protected boolean identityEquals(Identity identity)
{
return ((identity.getName().equals(this.name)) &&
- (identity.getPublicKey().equals(this.publicKey)));
+ (identity.getPublicKey().equals(this.publicKey)));
}
/**
* Returns a string representation of this Identity.
- *
+ *
* @return a string representation of this Identity.
* @throws SecurityException
* if a {@link SecurityManager} is installed which disallows this
@@ -302,7 +302,7 @@ public abstract class Identity implements Principal, Serializable
/**
* Returns a detailed string representation of this Identity.
- *
+ *
* @param detailed
* indicates whether or detailed information is desired.
* @return a string representation of this Identity.
@@ -318,13 +318,13 @@ public abstract class Identity implements Principal, Serializable
if (detailed)
{
- /* TODO: Insert proper detailed format here */
- return (name + ":@" + scope + " Public Key: " + publicKey);
+ /* TODO: Insert proper detailed format here */
+ return (name + ":@" + scope + " Public Key: " + publicKey);
}
else
{
- /* TODO: Insert proper format here */
- return (name + ":@" + scope + " Public Key: " + publicKey);
+ /* TODO: Insert proper format here */
+ return (name + ":@" + scope + " Public Key: " + publicKey);
}
}
diff --git a/java/security/IdentityScope.java b/java/security/IdentityScope.java
index 610d3534c..4391fbd49 100644
--- a/java/security/IdentityScope.java
+++ b/java/security/IdentityScope.java
@@ -43,14 +43,14 @@ import java.util.Enumeration;
* <code>IdentityScope</code> represents a scope of an identity.
* <code>IdentityScope</code> is also an {@link Identity} and can have a name
* and scope along with the other qualitites identities possess.
- *
+ *
* <p>An <code>IdentityScope</code> contains other {@link Identity} objects.
* All {@link Identity} objects are manipulated in the scope the same way. The
* scope is supposed to apply different scope to different type of
* Identities.</p>
- *
+ *
* <p>No identity within the same scope can have the same public key.</p>
- *
+ *
* @author Mark Benvenuto
* @see Identity
* @see Signer
@@ -73,7 +73,7 @@ public abstract class IdentityScope extends Identity
/**
* Constructs a new instance of <code>IdentityScope</code> with the
* specified name and no scope.
- *
+ *
* @param name
* the name to use.
*/
@@ -85,7 +85,7 @@ public abstract class IdentityScope extends Identity
/**
* Constructs a new instance of <code>IdentityScope</code> with the
* specified name and {@link IdentityScope}.
- *
+ *
* @param name
* the name to use.
* @param scope
@@ -101,22 +101,22 @@ public abstract class IdentityScope extends Identity
/**
* Returns the system's Scope.
- *
+ *
* @return the system's Scope.
*/
public static IdentityScope getSystemScope()
{
if (systemScope == null)
{
- //Load it
- //systemScope;
+ //Load it
+ //systemScope;
}
return systemScope;
}
/**
* Sets the scope of the system.
- *
+ *
* @param scope
* the new system scope.
* @throws SecurityException
@@ -134,14 +134,14 @@ public abstract class IdentityScope extends Identity
/**
* Returns the number of entries within this <code>IdentityScope</code>.
- *
+ *
* @return the number of entries within this <code>IdentityScope</code>.
*/
public abstract int size();
/**
* Returns the specified {@link Identity}, by name, within this scope.
- *
+ *
* @param name
* name of {@link Identity} to get.
* @return an {@link Identity} representing the name or <code>null</code> if
@@ -152,7 +152,7 @@ public abstract class IdentityScope extends Identity
/**
* Returns the specified {@link Identity}, by {@link Principal}, within this
* scope.
- *
+ *
* @param principal
* the {@link Principal} to use.
* @return an identity representing the {@link Principal} or <code>null</code>
@@ -165,7 +165,7 @@ public abstract class IdentityScope extends Identity
/**
* Returns the specified {@link Identity}, by public key, within this scope.
- *
+ *
* @param key
* the {@link PublicKey} to use.
* @return an identity representing the public key or <code>null</code> if
@@ -175,7 +175,7 @@ public abstract class IdentityScope extends Identity
/**
* Adds an identity to his scope.
- *
+ *
* @param identity
* the {@link Identity} to add.
* @throws KeyManagementException
@@ -187,7 +187,7 @@ public abstract class IdentityScope extends Identity
/**
* Removes an identity in this scope.
- *
+ *
* @param identity
* the {@link Identity} to remove.
* @throws KeyManagementException
@@ -198,7 +198,7 @@ public abstract class IdentityScope extends Identity
/**
* Returns an {@link Enumeration} of identities in this scope.
- *
+ *
* @return an {@link Enumeration} of the identities in this scope.
*/
public abstract Enumeration<Identity> identities();
@@ -206,7 +206,7 @@ public abstract class IdentityScope extends Identity
/**
* Returns a string representing this instance. It includes the name, the
* scope name, and number of identities.
- *
+ *
* @return a string representation of this instance.
*/
public String toString()
diff --git a/java/security/KeyFactory.java b/java/security/KeyFactory.java
index f06004bad..6f47de044 100644
--- a/java/security/KeyFactory.java
+++ b/java/security/KeyFactory.java
@@ -50,7 +50,7 @@ import java.security.spec.KeySpec;
* Key factories are used to convert keys (opaque cryptographic keys of type
* {@link Key}) into key specifications (transparent representations of the
* underlying key material).
- *
+ *
* <p>Key factories are bi-directional. They allow a key class to be converted
* into a key specification (key material) and back again. For example DSA
* public keys can be specified as <code>DSAPublicKeySpec</code> or
@@ -76,7 +76,7 @@ public class KeyFactory
/**
* Constructs a new instance of <code>KeyFactory</code> with the specified
* parameters.
- *
+ *
* @param keyFacSpi
* the key factory to use.
* @param provider
@@ -85,7 +85,7 @@ public class KeyFactory
* the name of the key algorithm to use.
*/
protected KeyFactory(KeyFactorySpi keyFacSpi, Provider provider,
- String algorithm)
+ String algorithm)
{
this.keyFacSpi = keyFacSpi;
this.provider = provider;
@@ -95,7 +95,7 @@ public class KeyFactory
/**
* Returns a new instance of <code>KeyFactory</code> representing the
* specified key factory.
- *
+ *
* @param algorithm the name of algorithm to use.
* @return a new instance repesenting the desired algorithm.
* @throws NoSuchAlgorithmException if the algorithm is not implemented by any
@@ -125,7 +125,7 @@ public class KeyFactory
/**
* Returns a new instance of <code>KeyFactory</code> representing the
* specified key factory from the specified provider.
- *
+ *
* @param algorithm the name of algorithm to use.
* @param provider the name of the provider to use.
* @return a new instance repesenting the desired algorithm.
@@ -152,7 +152,7 @@ public class KeyFactory
/**
* Returns a new instance of <code>KeyFactory</code> representing the
* specified key factory from the designated {@link Provider}.
- *
+ *
* @param algorithm the name of algorithm to use.
* @param provider the {@link Provider} to use.
* @return a new instance repesenting the desired algorithm.
@@ -195,7 +195,7 @@ public class KeyFactory
/**
* Returns the {@link Provider} of this instance.
- *
+ *
* @return the {@link Provider} of this instance.
*/
public final Provider getProvider()
@@ -205,7 +205,7 @@ public class KeyFactory
/**
* Returns the name of the algorithm used.
- *
+ *
* @return the name of the algorithm used.
*/
public final String getAlgorithm()
@@ -215,7 +215,7 @@ public class KeyFactory
/**
* Generates a public key from the provided key specification.
- *
+ *
* @param keySpec
* the key specification.
* @return the public key.
@@ -230,7 +230,7 @@ public class KeyFactory
/**
* Generates a private key from the provided key specification.
- *
+ *
* @param keySpec
* the key specification.
* @return the private key.
@@ -246,7 +246,7 @@ public class KeyFactory
/**
* Returns a key specification for the given key. <code>keySpec</code>
* identifies the specification class to return the key material in.
- *
+ *
* @param key
* the key to use.
* @param keySpec
@@ -266,7 +266,7 @@ public class KeyFactory
/**
* Translates the key from an unknown or untrusted provider into a key from
* this key factory.
- *
+ *
* @param key
* the key to translate from.
* @return the translated key.
diff --git a/java/security/KeyFactorySpi.java b/java/security/KeyFactorySpi.java
index fa5637812..b8424638f 100644
--- a/java/security/KeyFactorySpi.java
+++ b/java/security/KeyFactorySpi.java
@@ -42,21 +42,21 @@ import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
/**
- * KeyFactorySpi is the Service Provider Interface (SPI) for the
- * KeyFactory class. This is the interface for providers to
+ * KeyFactorySpi is the Service Provider Interface (SPI) for the
+ * KeyFactory class. This is the interface for providers to
* supply to implement a key factory for an algorithm.
*
- * Key factories are used to convert keys (opaque cryptographic
- * keys of type Key) into key specifications (transparent
+ * Key factories are used to convert keys (opaque cryptographic
+ * keys of type Key) into key specifications (transparent
* representations of the underlying key material).
*
- * Key factories are bi-directional. They allow a key class
+ * Key factories are bi-directional. They allow a key class
* to be converted into a key specification (key material) and
* back again.
*
- * For example DSA public keys can be specified as
+ * For example DSA public keys can be specified as
* DSAPublicKeySpec or X509EncodedKeySpec. The key factory
- * translate these key specifications.
+ * translate these key specifications.
*
* @since JDK 1.2
* @author Mark Benvenuto
@@ -98,19 +98,19 @@ public abstract class KeyFactorySpi
throws InvalidKeySpecException;
/**
- * Returns a key specification for the given key. keySpec
- * identifies the specification class to return the key
+ * Returns a key specification for the given key. keySpec
+ * identifies the specification class to return the key
* material in.
*
* @param key the key
- * @param keySpec the specification class to return the
+ * @param keySpec the specification class to return the
* key material in.
*
* @return the key specification in an instance of the requested
* specification class
*
* @throws InvalidKeySpecException the requested key specification
- * is inappropriate for this key or the key is
+ * is inappropriate for this key or the key is
* unrecognized.
*/
protected abstract <T extends KeySpec> T engineGetKeySpec(Key key,
@@ -126,7 +126,7 @@ public abstract class KeyFactorySpi
*
* @return the translated key
*
- * @throws InvalidKeyException if the key cannot be
+ * @throws InvalidKeyException if the key cannot be
* processed by this key factory
*/
protected abstract Key engineTranslateKey(Key key)
diff --git a/java/security/KeyPairGenerator.java b/java/security/KeyPairGenerator.java
index f4ca20611..5e6bb1a3c 100644
--- a/java/security/KeyPairGenerator.java
+++ b/java/security/KeyPairGenerator.java
@@ -48,7 +48,7 @@ import java.security.spec.AlgorithmParameterSpec;
/**
* <code>KeyPairGenerator</code> is a class used to generate key-pairs for a
* security algorithm.
- *
+ *
* <p>The <code>KeyPairGenerator</code> is created with the
* <code>getInstance()</code> Factory methods. It is used to generate a pair of
* public and private keys for a specific algorithm and associate this key-pair
@@ -69,7 +69,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Constructs a new instance of <code>KeyPairGenerator</code>.
- *
+ *
* @param algorithm
* the algorithm to use.
*/
@@ -81,7 +81,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Returns the name of the algorithm used.
- *
+ *
* @return the name of the algorithm used.
*/
public String getAlgorithm()
@@ -92,7 +92,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Returns a new instance of <code>KeyPairGenerator</code> which generates
* key-pairs for the specified algorithm.
- *
+ *
* @param algorithm the name of the algorithm to use.
* @return a new instance repesenting the desired algorithm.
* @throws NoSuchAlgorithmException if the algorithm is not implemented by any
@@ -122,7 +122,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Returns a new instance of <code>KeyPairGenerator</code> which generates
* key-pairs for the specified algorithm from a named provider.
- *
+ *
* @param algorithm the name of the algorithm to use.
* @param provider the name of a {@link Provider} to use.
* @return a new instance repesenting the desired algorithm.
@@ -149,7 +149,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Returns a new instance of <code>KeyPairGenerator</code> which generates
* key-pairs for the specified algorithm from a designated {@link Provider}.
- *
+ *
* @param algorithm
* the name of the algorithm to use.
* @param provider
@@ -163,8 +163,8 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
* @since 1.4
* @see Provider
*/
- public static KeyPairGenerator getInstance(String algorithm,
- Provider provider)
+ public static KeyPairGenerator getInstance(String algorithm,
+ Provider provider)
throws NoSuchAlgorithmException
{
CPStringBuilder sb = new CPStringBuilder("KeyPairGenerator for algorithm [")
@@ -206,7 +206,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Returns the {@link Provider} of this instance.
- *
+ *
* @return the {@link Provider} of this instance.
*/
public final Provider getProvider()
@@ -217,7 +217,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Initializes this instance for the specified key size. Since no source of
* randomness is specified, a default one will be used.
- *
+ *
* @param keysize
* the size of keys to use.
*/
@@ -229,7 +229,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Initializes this instance for the specified key size and
* {@link SecureRandom}.
- *
+ *
* @param keysize
* the size of keys to use.
* @param random
@@ -244,7 +244,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
* Initializes this instance with the specified
* {@link AlgorithmParameterSpec}. Since no source of randomness is specified,
* a default one will be used.
- *
+ *
* @param params
* the {@link AlgorithmParameterSpec} to use.
* @throws InvalidAlgorithmParameterException
@@ -260,7 +260,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Initializes this instance with the specified {@link AlgorithmParameterSpec}
* and {@link SecureRandom}.
- *
+ *
* @param params
* the {@link AlgorithmParameterSpec} to use.
* @param random
@@ -277,9 +277,9 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Generates a new "DSA" {@link KeyPair} from the "GNU" security provider.
- *
+ *
* <p>This method generates a unique key-pair each time it is called.</p>
- *
+ *
* @return a new unique {@link KeyPair}.
* @see #generateKeyPair()
* @since 1.2
@@ -300,9 +300,9 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
/**
* Generates a new "DSA" {@link KeyPair} from the "GNU" security provider.
- *
+ *
* <p>This method generates a unique key pair each time it is called.</p>
- *
+ *
* @return a new unique {@link KeyPair}.
* @see #genKeyPair()
*/
diff --git a/java/security/KeyPairGeneratorSpi.java b/java/security/KeyPairGeneratorSpi.java
index 689fbec12..1eaad9832 100644
--- a/java/security/KeyPairGeneratorSpi.java
+++ b/java/security/KeyPairGeneratorSpi.java
@@ -58,7 +58,7 @@ public abstract class KeyPairGeneratorSpi
key size and source of randomness
@param keysize size of the key to generate
- @param random A SecureRandom source of randomness
+ @param random A SecureRandom source of randomness
*/
public abstract void initialize(int keysize, SecureRandom random);
@@ -72,7 +72,7 @@ public abstract class KeyPairGeneratorSpi
method just throws UnsupportedOperationException.
@param params A AlgorithmParameterSpec to intialize with
- @param random A SecureRandom source of randomness
+ @param random A SecureRandom source of randomness
@throws InvalidAlgorithmParameterException
*/
@@ -84,7 +84,7 @@ public abstract class KeyPairGeneratorSpi
/**
Generates a KeyPair according the rules for the algorithm.
- Unless intialized, algorithm defaults will be used. It
+ Unless intialized, algorithm defaults will be used. It
creates a unique key pair each time.
@return a key pair
diff --git a/java/security/KeyStore.java b/java/security/KeyStore.java
index 1d036c31c..b7a0e2ab1 100644
--- a/java/security/KeyStore.java
+++ b/java/security/KeyStore.java
@@ -49,19 +49,19 @@ import java.util.Date;
import java.util.Enumeration;
/**
- * Keystore represents an in-memory collection of keys and
+ * Keystore represents an in-memory collection of keys and
* certificates. There are two types of entries:
*
* <dl>
* <dt>Key Entry</dt>
*
* <dd><p>This type of keystore entry store sensitive crytographic key
- * information in a protected format.Typically this is a secret
+ * information in a protected format.Typically this is a secret
* key or a private key with a certificate chain.</p></dd>
*
* <dt>Trusted Ceritificate Entry</dt>
*
- * <dd><p>This type of keystore entry contains a single public key
+ * <dd><p>This type of keystore entry contains a single public key
* certificate belonging to annother entity. It is called trusted
* because the keystore owner trusts that the certificates
* belongs to the subject (owner) of the certificate.</p></dd>
@@ -70,10 +70,10 @@ import java.util.Enumeration;
* <p>Entries in a key store are referred to by their "alias": a simple
* unique string.
*
- * <p>The structure and persistentence of the key store is not
- * specified. Any method could be used to protect sensitive
- * (private or secret) keys. Smart cards or integrated
- * cryptographic engines could be used or the keystore could
+ * <p>The structure and persistentence of the key store is not
+ * specified. Any method could be used to protect sensitive
+ * (private or secret) keys. Smart cards or integrated
+ * cryptographic engines could be used or the keystore could
* be simply stored in a file.</p>
*
* @see java.security.cert.Certificate
@@ -112,7 +112,7 @@ public class KeyStore
/**
* Returns an instance of a <code>KeyStore</code> representing the specified
* type, from the first provider that implements it.
- *
+ *
* @param type the type of keystore to create.
* @return a <code>KeyStore</code> repesenting the desired type.
* @throws KeyStoreException if the designated type of is not implemented by
@@ -141,7 +141,7 @@ public class KeyStore
/**
* Returns an instance of a <code>KeyStore</code> representing the specified
* type, from the named provider.
- *
+ *
* @param type the type of keystore to create.
* @param provider the name of the provider to use.
* @return a <code>KeyStore</code> repesenting the desired type.
@@ -168,7 +168,7 @@ public class KeyStore
/**
* Returns an instance of a <code>KeyStore</code> representing the specified
* type, from the specified provider.
- *
+ *
* @param type the type of keystore to create.
* @param provider the provider to use.
* @return a <code>KeyStore</code> repesenting the desired type.
@@ -207,13 +207,13 @@ public class KeyStore
/**
* Returns the default KeyStore type. This method looks up the
- * type in &lt;JAVA_HOME&gt;/lib/security/java.security with the
+ * type in &lt;JAVA_HOME&gt;/lib/security/java.security with the
* property "keystore.type" or if that fails then "gkr" .
*/
public static final String getDefaultType()
{
- // Security reads every property in java.security so it
- // will return this property if it exists.
+ // Security reads every property in java.security so it
+ // will return this property if it exists.
String tmp = Security.getProperty("keystore.type");
if (tmp == null)
@@ -246,7 +246,7 @@ public class KeyStore
}
/**
- Returns the key associated with given alias using the
+ Returns the key associated with given alias using the
supplied password.
@param alias an alias for the key to get
@@ -271,8 +271,8 @@ public class KeyStore
@param alias the alias name
- @return a chain of Certificates ( ordered from the user's
- certificate to the Certificate Authority's ) or
+ @return a chain of Certificates ( ordered from the user's
+ certificate to the Certificate Authority's ) or
null if the alias does not exist or there is no
certificate chain for the alias ( the alias refers
to a trusted certificate entry or there is no entry).
@@ -292,7 +292,7 @@ public class KeyStore
@param alias the alias name
- @return a Certificate or null if the alias does not exist
+ @return a Certificate or null if the alias does not exist
or there is no certificate for the alias
*/
public final java.security.cert.Certificate getCertificate(String alias)
@@ -315,8 +315,8 @@ public class KeyStore
/**
Assign the key to the alias in the keystore, protecting it
- with the given password. It will overwrite an existing
- entry and if the key is a PrivateKey, also add the
+ with the given password. It will overwrite an existing
+ entry and if the key is a PrivateKey, also add the
certificate chain representing the corresponding public key.
@param alias the alias name
@@ -328,16 +328,16 @@ public class KeyStore
@throws KeyStoreException if it fails
*/
public final void setKeyEntry(String alias, Key key, char[]password,
- java.security.cert.
- Certificate[]chain) throws KeyStoreException
+ java.security.cert.
+ Certificate[]chain) throws KeyStoreException
{
keyStoreSpi.engineSetKeyEntry(alias, key, password, chain);
}
/**
Assign the key to the alias in the keystore. It will overwrite
- an existing entry and if the key is a PrivateKey, also
- add the certificate chain representing the corresponding
+ an existing entry and if the key is a PrivateKey, also
+ add the certificate chain representing the corresponding
public key.
@param alias the alias name
@@ -348,14 +348,14 @@ public class KeyStore
@throws KeyStoreException if it fails
*/
public final void setKeyEntry(String alias, byte[]key,
- java.security.cert.
- Certificate[]chain) throws KeyStoreException
+ java.security.cert.
+ Certificate[]chain) throws KeyStoreException
{
keyStoreSpi.engineSetKeyEntry(alias, key, chain);
}
/**
- Assign the certificate to the alias in the keystore. It
+ Assign the certificate to the alias in the keystore. It
will overwrite an existing entry.
@param alias the alias name
@@ -364,8 +364,8 @@ public class KeyStore
@throws KeyStoreException if it fails
*/
public final void setCertificateEntry(String alias,
- java.security.cert.
- Certificate cert) throws
+ java.security.cert.
+ Certificate cert) throws
KeyStoreException
{
keyStoreSpi.engineSetCertificateEntry(alias, cert);
@@ -416,7 +416,7 @@ public class KeyStore
}
/**
- Determines if the keystore contains a key entry for
+ Determines if the keystore contains a key entry for
the specified alias.
@param alias the alias name
@@ -430,7 +430,7 @@ public class KeyStore
/**
- Determines if the keystore contains a certificate entry for
+ Determines if the keystore contains a certificate entry for
the specified alias.
@param alias the alias name
@@ -444,7 +444,7 @@ public class KeyStore
}
/**
- Determines if the keystore contains the specified certificate
+ Determines if the keystore contains the specified certificate
entry and returns the alias.
It checks every entry and for a key entry checks only the
@@ -452,7 +452,7 @@ public class KeyStore
@param cert Certificate to look for
- @return alias of first matching certificate, null if it
+ @return alias of first matching certificate, null if it
does not exist.
*/
public final String getCertificateAlias(java.security.cert.Certificate cert)
@@ -469,7 +469,7 @@ public class KeyStore
@param password the password to protect the keystore integrity with
@throws IOException if an I/O error occurs.
- @throws NoSuchAlgorithmException the data integrity algorithm
+ @throws NoSuchAlgorithmException the data integrity algorithm
used cannot be found.
@throws CertificateException if any certificates could not be
stored in the output stream.
@@ -489,7 +489,7 @@ public class KeyStore
@param password the password to check the keystore integrity with
@throws IOException if an I/O error occurs.
- @throws NoSuchAlgorithmException the data integrity algorithm
+ @throws NoSuchAlgorithmException the data integrity algorithm
used cannot be found.
@throws CertificateException if any certificates could not be
stored in the output stream.
diff --git a/java/security/KeyStoreSpi.java b/java/security/KeyStoreSpi.java
index c8d231663..b44bd84a8 100644
--- a/java/security/KeyStoreSpi.java
+++ b/java/security/KeyStoreSpi.java
@@ -46,9 +46,9 @@ import java.util.Date;
import java.util.Enumeration;
/**
- * KeyStoreSpi is the Service Provider Interface (SPI) for the
- * KeyStore class. This is the interface for providers to
- * supply to implement a keystore for a particular keystore
+ * KeyStoreSpi is the Service Provider Interface (SPI) for the
+ * KeyStore class. This is the interface for providers to
+ * supply to implement a keystore for a particular keystore
* type.
*
* @since 1.2
@@ -64,7 +64,7 @@ public abstract class KeyStoreSpi
}
/**
- * Returns the key associated with given alias using the
+ * Returns the key associated with given alias using the
* supplied password.
*
* @param alias an alias for the key to get
@@ -85,8 +85,8 @@ public abstract class KeyStoreSpi
*
* @param alias the alias name
*
- * @return a chain of Certificates ( ordered from the user's
- * certificate to the Certificate Authority's ) or
+ * @return a chain of Certificates ( ordered from the user's
+ * certificate to the Certificate Authority's ) or
* null if the alias does not exist or there is no
* certificate chain for the alias ( the alias refers
* to a trusted certificate entry or there is no entry).
@@ -104,7 +104,7 @@ public abstract class KeyStoreSpi
*
* @param alias the alias name
*
- * @return a Certificate or null if the alias does not exist
+ * @return a Certificate or null if the alias does not exist
* or there is no certificate for the alias
*/
public abstract java.security.cert.
@@ -121,8 +121,8 @@ public abstract class KeyStoreSpi
/**
* Assign the key to the alias in the keystore, protecting it
- * with the given password. It will overwrite an existing
- * entry and if the key is a PrivateKey, also add the
+ * with the given password. It will overwrite an existing
+ * entry and if the key is a PrivateKey, also add the
* certificate chain representing the corresponding public key.
*
* @param alias the alias name
@@ -134,15 +134,15 @@ public abstract class KeyStoreSpi
* @throws KeyStoreException if it fails
*/
public abstract void engineSetKeyEntry(String alias, Key key,
- char[]password,
- java.security.cert.
- Certificate[]chain) throws
+ char[]password,
+ java.security.cert.
+ Certificate[]chain) throws
KeyStoreException;
/**
* Assign the key to the alias in the keystore. It will overwrite
- * an existing entry and if the key is a PrivateKey, also
- * add the certificate chain representing the corresponding
+ * an existing entry and if the key is a PrivateKey, also
+ * add the certificate chain representing the corresponding
* public key.
*
* @param alias the alias name
@@ -153,13 +153,13 @@ public abstract class KeyStoreSpi
* @throws KeyStoreException if it fails
*/
public abstract void engineSetKeyEntry(String alias, byte[]key,
- java.security.cert.
- Certificate[]chain) throws
+ java.security.cert.
+ Certificate[]chain) throws
KeyStoreException;
/**
- * Assign the certificate to the alias in the keystore. It
+ * Assign the certificate to the alias in the keystore. It
* will overwrite an existing entry.
*
* @param alias the alias name
@@ -168,8 +168,8 @@ public abstract class KeyStoreSpi
* @throws KeyStoreException if it fails
*/
public abstract void engineSetCertificateEntry(String alias,
- java.security.cert.
- Certificate cert) throws
+ java.security.cert.
+ Certificate cert) throws
KeyStoreException;
/**
@@ -206,7 +206,7 @@ public abstract class KeyStoreSpi
public abstract int engineSize();
/**
- * Determines if the keystore contains a key entry for
+ * Determines if the keystore contains a key entry for
* the specified alias.
*
* @param alias the alias name
@@ -216,7 +216,7 @@ public abstract class KeyStoreSpi
public abstract boolean engineIsKeyEntry(String alias);
/**
- * Determines if the keystore contains a certificate entry for
+ * Determines if the keystore contains a certificate entry for
* the specified alias.
*
* @param alias the alias name
@@ -226,7 +226,7 @@ public abstract class KeyStoreSpi
public abstract boolean engineIsCertificateEntry(String alias);
/**
- * Determines if the keystore contains the specified certificate
+ * Determines if the keystore contains the specified certificate
* entry and returns the alias.
*
* It checks every entry and for a key entry checks only the
@@ -234,11 +234,11 @@ public abstract class KeyStoreSpi
*
* @param cert Certificate to look for
*
- * @return alias of first matching certificate, null if it
+ * @return alias of first matching certificate, null if it
* does not exist.
*/
public abstract String engineGetCertificateAlias(java.security.cert.
- Certificate cert);
+ Certificate cert);
/**
* Stores the keystore in the specified output stream and it
@@ -248,7 +248,7 @@ public abstract class KeyStoreSpi
* @param password the password to protect the keystore integrity with
*
* @throws IOException if an I/O error occurs.
- * @throws NoSuchAlgorithmException the data integrity algorithm
+ * @throws NoSuchAlgorithmException the data integrity algorithm
* used cannot be found.
* @throws CertificateException if any certificates could not be
* stored in the output stream.
@@ -265,7 +265,7 @@ public abstract class KeyStoreSpi
* @param password the password to check the keystore integrity with
*
* @throws IOException if an I/O error occurs.
- * @throws NoSuchAlgorithmException the data integrity algorithm
+ * @throws NoSuchAlgorithmException the data integrity algorithm
* used cannot be found.
* @throws CertificateException if any certificates could not be
* stored in the output stream.
diff --git a/java/security/MessageDigest.java b/java/security/MessageDigest.java
index d94d96b1a..a4eeab447 100644
--- a/java/security/MessageDigest.java
+++ b/java/security/MessageDigest.java
@@ -63,7 +63,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Constructs a new instance of <code>MessageDigest</code> representing the
* specified algorithm.
- *
+ *
* @param algorithm
* the name of the digest algorithm to use.
*/
@@ -76,7 +76,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Returns a new instance of <code>MessageDigest</code> representing the
* specified algorithm.
- *
+ *
* @param algorithm the name of the digest algorithm to use.
* @return a new instance representing the desired algorithm.
* @throws NoSuchAlgorithmException if the algorithm is not implemented by any
@@ -106,7 +106,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Returns a new instance of <code>MessageDigest</code> representing the
* specified algorithm from a named provider.
- *
+ *
* @param algorithm the name of the digest algorithm to use.
* @param provider the name of the provider to use.
* @return a new instance representing the desired algorithm.
@@ -133,7 +133,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Returns a new instance of <code>MessageDigest</code> representing the
* specified algorithm from a designated {@link Provider}.
- *
+ *
* @param algorithm the name of the digest algorithm to use.
* @param provider the {@link Provider} to use.
* @return a new instance representing the desired algorithm.
@@ -187,7 +187,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Returns the {@link Provider} of this instance.
- *
+ *
* @return the {@link Provider} of this instance.
*/
public final Provider getProvider()
@@ -197,7 +197,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Updates the digest with the byte.
- *
+ *
* @param input byte to update the digest with.
*/
public void update(byte input)
@@ -208,7 +208,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Updates the digest with the bytes from the array starting from the
* specified offset and using the specified length of bytes.
- *
+ *
* @param input
* bytes to update the digest with.
* @param offset
@@ -223,7 +223,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Updates the digest with the bytes of an array.
- *
+ *
* @param input bytes to update the digest with.
*/
public void update(byte[] input)
@@ -233,7 +233,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Updates the digest with the remaining bytes of a buffer.
- *
+ *
* @param input The input byte buffer.
* @since 1.5
*/
@@ -241,10 +241,10 @@ public abstract class MessageDigest extends MessageDigestSpi
{
engineUpdate (input);
}
-
+
/**
* Computes the final digest of the stored data.
- *
+ *
* @return a byte array representing the message digest.
*/
public byte[] digest()
@@ -254,7 +254,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Computes the final digest of the stored bytes and returns the result.
- *
+ *
* @param buf
* an array of bytes to store the result in.
* @param offset
@@ -272,7 +272,7 @@ public abstract class MessageDigest extends MessageDigestSpi
* Computes a final update using the input array of bytes, then computes a
* final digest and returns it. It calls {@link #update(byte[])} and then
* {@link #digest(byte[])}.
- *
+ *
* @param input
* an array of bytes to perform final update with.
* @return a byte array representing the message digest.
@@ -285,7 +285,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Returns a string representation of this instance.
- *
+ *
* @return a string representation of this instance.
*/
public String toString()
@@ -295,7 +295,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Does a simple byte comparison of the two digests.
- *
+ *
* @param digesta
* first digest to compare.
* @param digestb
@@ -323,7 +323,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Returns the name of message digest algorithm.
- *
+ *
* @return the name of message digest algorithm.
*/
public final String getAlgorithm()
@@ -334,7 +334,7 @@ public abstract class MessageDigest extends MessageDigestSpi
/**
* Returns the length of the message digest. The default is zero which means
* that the concrete implementation does not implement this method.
- *
+ *
* @return length of the message digest.
* @since 1.2
*/
@@ -348,7 +348,7 @@ public abstract class MessageDigest extends MessageDigestSpi
* then a {@link CloneNotSupportedException} is thrown. Cloning depends on
* whether the subclass {@link MessageDigestSpi} implements {@link Cloneable}
* which contains the actual implementation of the appropriate algorithm.
- *
+ *
* @return a clone of this instance.
* @throws CloneNotSupportedException
* the implementation does not support cloning.
diff --git a/java/security/MessageDigestSpi.java b/java/security/MessageDigestSpi.java
index 6615b1d93..63cc96047 100644
--- a/java/security/MessageDigestSpi.java
+++ b/java/security/MessageDigestSpi.java
@@ -101,7 +101,7 @@ public abstract class MessageDigestSpi
/**
* Updates this digest with the remaining bytes of a byte buffer.
- *
+ *
* @param input The input buffer.
* @since 1.5
*/
@@ -115,7 +115,7 @@ public abstract class MessageDigestSpi
engineUpdate (buf, 0, n);
}
}
-
+
/**
Computes the final digest of the stored bytes and returns
them. It performs any necessary padding. The message digest
diff --git a/java/security/Permission.java b/java/security/Permission.java
index 8f3e2a236..cf6399b16 100644
--- a/java/security/Permission.java
+++ b/java/security/Permission.java
@@ -183,20 +183,20 @@ public abstract class Permission implements Guard, Serializable
*/
public String toString()
{
- CPStringBuilder string = new CPStringBuilder();
-
+ CPStringBuilder string = new CPStringBuilder();
+
string = string.append('(');
string = string.append(getClass().getName());
string = string.append(' ');
string = string.append(getName());
-
+
if (!(getActions().equals("")))
{
string = string.append(' ');
string = string.append(getActions());
}
-
+
string = string.append(')');
- return string.toString();
+ return string.toString();
}
} // class Permission
diff --git a/java/security/Permissions.java b/java/security/Permissions.java
index 56f5ad8f5..d814064e0 100644
--- a/java/security/Permissions.java
+++ b/java/security/Permissions.java
@@ -231,13 +231,13 @@ public final class Permissions extends PermissionCollection
public boolean implies(Permission perm)
{
Enumeration elements = elements();
-
+
while (elements.hasMoreElements())
- {
- Permission p = (Permission)elements.nextElement();
- if (p.implies(perm))
- return true;
- }
+ {
+ Permission p = (Permission)elements.nextElement();
+ if (p.implies(perm))
+ return true;
+ }
return false;
}
diff --git a/java/security/Policy.java b/java/security/Policy.java
index de1ab80ef..118626ea1 100644
--- a/java/security/Policy.java
+++ b/java/security/Policy.java
@@ -47,36 +47,36 @@ import java.util.Map;
* policy for the Java application environment. It specifies which permissions
* are available for code from various sources. The security policy is
* represented through a subclass of <code>Policy</code>.
- *
+ *
* <p>Only one <code>Policy</code> is in effect at any time. A
* {@link ProtectionDomain} initializes itself with information from this class
* on the set of permssions to grant.</p>
- *
+ *
* <p>The location for the actual <code>Policy</code> could be anywhere in any
* form because it depends on the Policy implementation. The default system is
* in a flat ASCII file or it could be in a database.</p>
- *
+ *
* <p>The current installed <code>Policy</code> can be accessed with
* {@link #getPolicy()} and changed with {@link #setPolicy(Policy)} if the code
* has the correct permissions.</p>
- *
+ *
* <p>The {@link #refresh()} method causes the <code>Policy</code> instance to
* refresh/reload its configuration. The method used to refresh depends on the
* <code>Policy</code> implementation.</p>
- *
+ *
* <p>When a protection domain initializes its permissions, it uses code like
* the following:</p>
- *
+ *
* <code>
* policy = Policy.getPolicy();
* PermissionCollection perms = policy.getPermissions(myCodeSource);
* </code>
- *
+ *
* <p>The protection domain passes the <code>Policy</code> handler a
* {@link CodeSource} instance which contains the codebase URL and a public key.
* The <code>Policy</code> implementation then returns the proper set of
* permissions for that {@link CodeSource}.</p>
- *
+ *
* <p>The default <code>Policy</code> implementation can be changed by setting
* the "policy.provider" security provider in the "java.security" file to the
* correct <code>Policy</code> implementation class.</p>
@@ -103,7 +103,7 @@ public abstract class Policy
* Returns the currently installed <code>Policy</code> handler. The value
* should not be cached as it can be changed any time by
* {@link #setPolicy(Policy)}.
- *
+ *
* @return the current <code>Policy</code>.
* @throws SecurityException
* if a {@link SecurityManager} is installed which disallows this
@@ -120,7 +120,7 @@ public abstract class Policy
/**
* Sets the <code>Policy</code> handler to a new value.
- *
+ *
* @param policy
* the new <code>Policy</code> to use.
* @throws SecurityException
@@ -177,10 +177,10 @@ public abstract class Policy
{
currentPolicy = (Policy) Class.forName(pp).newInstance();
}
- catch (Exception e)
- {
- // Ignored.
- }
+ catch (Exception e)
+ {
+ // Ignored.
+ }
if (currentPolicy == null)
currentPolicy = new gnu.java.security.provider.DefaultPolicy();
@@ -200,7 +200,7 @@ public abstract class Policy
/**
* Returns the set of Permissions allowed for a given {@link CodeSource}.
- *
+ *
* @param codesource
* the {@link CodeSource} for which, the caller needs to find the
* set of granted permissions.
@@ -214,7 +214,7 @@ public abstract class Policy
/**
* Returns the set of Permissions allowed for a given {@link ProtectionDomain}.
- *
+ *
* @param domain
* the {@link ProtectionDomain} for which, the caller needs to find
* the set of granted permissions.
@@ -257,7 +257,7 @@ public abstract class Policy
/**
* Checks if the designated {@link Permission} is granted to a designated
* {@link ProtectionDomain}.
- *
+ *
* @param domain
* the {@link ProtectionDomain} to test.
* @param permission
diff --git a/java/security/ProtectionDomain.java b/java/security/ProtectionDomain.java
index b1eb049e3..d5d657d61 100644
--- a/java/security/ProtectionDomain.java
+++ b/java/security/ProtectionDomain.java
@@ -47,7 +47,7 @@ import gnu.java.lang.CPStringBuilder;
* class loaded from the specified {@link CodeSource} is treated as part of
* this domain. The set of permissions is represented by an instance of
* {@link PermissionCollection}.
- *
+ *
* <p>Every class in the system will belong to one and only one
* <code>ProtectionDomain</code>.</p>
*
@@ -77,7 +77,7 @@ public class ProtectionDomain
* can be added later to the {@link PermissionCollection} and this contructor
* will call the <code>setReadOnly</code> method on the specified set of
* permissions.
- *
+ *
* @param codesource
* The {@link CodeSource} for this domain.
* @param permissions
@@ -93,11 +93,11 @@ public class ProtectionDomain
* This method initializes a new instance of <code>ProtectionDomain</code>
* given its {@link CodeSource}, granted permissions, associated
* {@link ClassLoader} and {@link Principal}s.
- *
+ *
* <p>Similar to the previous constructor, if the designated set of
* permissions is not <code>null</code>, the <code>setReadOnly</code> method
* is called on that set.</p>
- *
+ *
* @param codesource
* The {@link CodeSource} for this domain.
* @param permissions
@@ -138,7 +138,7 @@ public class ProtectionDomain
/**
* Returns the {@link CodeSource} of this domain.
- *
+ *
* @return the {@link CodeSource} of this domain.
* @since 1.2
*/
@@ -149,7 +149,7 @@ public class ProtectionDomain
/**
* Returns the {@link ClassLoader} of this domain.
- *
+ *
* @return the {@link ClassLoader} of this domain.
* @since 1.4
*/
@@ -160,7 +160,7 @@ public class ProtectionDomain
/**
* Returns a clone of the {@link Principal}s of this domain.
- *
+ *
* @return a clone of the {@link Principal}s of this domain.
* @since 1.4
*/
@@ -171,7 +171,7 @@ public class ProtectionDomain
/**
* Returns the {@link PermissionCollection} of this domain.
- *
+ *
* @return The {@link PermissionCollection} of this domain.
*/
public final PermissionCollection getPermissions()
@@ -182,7 +182,7 @@ public class ProtectionDomain
/**
* Tests whether or not the specified {@link Permission} is implied by the
* set of permissions granted to this domain.
- *
+ *
* @param permission
* the {@link Permission} to test.
* @return <code>true</code> if the specified {@link Permission} is implied
@@ -200,7 +200,7 @@ public class ProtectionDomain
/**
* Returns a string representation of this object. It will include the
* {@link CodeSource} and set of permissions associated with this domain.
- *
+ *
* @return A string representation of this object.
*/
public String toString()
diff --git a/java/security/Provider.java b/java/security/Provider.java
index ea1dd9d3f..b1d6d9ce2 100644
--- a/java/security/Provider.java
+++ b/java/security/Provider.java
@@ -48,7 +48,7 @@ import java.util.Properties;
* Providers are installed by name and version number. See the static
* initializer of the {@link java.security.Security} class for the default
* security providers installed by this class library.
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public abstract class Provider
@@ -99,7 +99,7 @@ public abstract class Provider
/**
* This method retunrs the version number of this <code>Provider</code>.
- *
+ *
* @return The <code>Provider</code>'s version number.
*/
public double getVersion()
@@ -126,7 +126,7 @@ public abstract class Provider
* <code>name</code> is this provider's name. For the default implementation
* this translates into a {@link SecurityManager#checkPermission(Permission)}
* for a <code>SecurityPermission("putProviderProperty." + name)</code>.
- *
+ *
* @param key The property key.
* @param value The property value.
* @return The previous value of the specified property (<code>key</code>),
@@ -162,7 +162,7 @@ public abstract class Provider
* <code>name</code> is this provider's name. For the default implementation
* this translates into a {@link SecurityManager#checkPermission(Permission)}
* for a <code>SecurityPermission("removeProviderProperty." + name)</code>.
- *
+ *
* @param key The key to remove
* @return The previous value for this key, or <code>null</code> if no
* previous value.
@@ -206,7 +206,7 @@ public abstract class Provider
public String toString()
{
return (getClass().getName() + ": name=" + getName() + " version=" +
- version);
+ version);
}
private Object toCanonicalKey(Object key)
diff --git a/java/security/ProviderException.java b/java/security/ProviderException.java
index 4559a1708..a2b469a6a 100644
--- a/java/security/ProviderException.java
+++ b/java/security/ProviderException.java
@@ -39,7 +39,7 @@ package java.security;
/**
* This exception indicates that a runtime problem was encounterd with
- * a security provider.
+ * a security provider.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @status updated to 1.4
diff --git a/java/security/SecureClassLoader.java b/java/security/SecureClassLoader.java
index 6e173007e..1480b7116 100644
--- a/java/security/SecureClassLoader.java
+++ b/java/security/SecureClassLoader.java
@@ -41,7 +41,7 @@ import java.nio.ByteBuffer;
import java.util.HashMap;
/**
- * A Secure Class Loader for loading classes with additional
+ * A Secure Class Loader for loading classes with additional
* support for specifying code source and permissions when
* they are retrieved by the system policy handler.
*
@@ -63,8 +63,8 @@ public class SecureClassLoader extends ClassLoader
{
}
- /**
- * Creates a class using an array of bytes and a
+ /**
+ * Creates a class using an array of bytes and a
* CodeSource.
*
* @param name the name to give the class. null if unknown.
@@ -78,13 +78,13 @@ public class SecureClassLoader extends ClassLoader
* @exception ClassFormatError if the byte array is not in proper classfile format.
*/
protected final Class<?> defineClass(String name, byte[] b, int off, int len,
- CodeSource cs)
+ CodeSource cs)
{
return super.defineClass(name, b, off, len, getProtectionDomain(cs));
}
- /**
- * Creates a class using an ByteBuffer and a
+ /**
+ * Creates a class using an ByteBuffer and a
* CodeSource.
*
* @param name the name to give the class. null if unknown.
@@ -109,31 +109,31 @@ public class SecureClassLoader extends ClassLoader
ProtectionDomain protectionDomain = null;
if (cs != null)
{
- synchronized (protectionDomainCache)
- {
- protectionDomain = protectionDomainCache.get(cs);
- }
-
- if (protectionDomain == null)
- {
- protectionDomain
- = new ProtectionDomain(cs, getPermissions(cs), this, null);
- synchronized (protectionDomainCache)
- {
- ProtectionDomain domain = protectionDomainCache.get(cs);
- if (domain == null)
- protectionDomainCache.put(cs, protectionDomain);
- else
- protectionDomain = domain;
- }
- }
+ synchronized (protectionDomainCache)
+ {
+ protectionDomain = protectionDomainCache.get(cs);
+ }
+
+ if (protectionDomain == null)
+ {
+ protectionDomain
+ = new ProtectionDomain(cs, getPermissions(cs), this, null);
+ synchronized (protectionDomainCache)
+ {
+ ProtectionDomain domain = protectionDomainCache.get(cs);
+ if (domain == null)
+ protectionDomainCache.put(cs, protectionDomain);
+ else
+ protectionDomain = domain;
+ }
+ }
}
return protectionDomain;
}
/**
* Returns a PermissionCollection for the specified CodeSource.
- * The default implementation invokes
+ * The default implementation invokes
* java.security.Policy.getPermissions.
*
* This method is called by defineClass that takes a CodeSource
diff --git a/java/security/SecureRandom.java b/java/security/SecureRandom.java
index 0c7183879..abf4ff308 100644
--- a/java/security/SecureRandom.java
+++ b/java/security/SecureRandom.java
@@ -77,9 +77,9 @@ public class SecureRandom extends Random
private static final long serialVersionUID = 4940670005562187L;
//Serialized Field
- long counter = 0; //Serialized
+ long counter = 0; //Serialized
Provider provider = null;
- byte[] randomBytes = null; //Always null
+ byte[] randomBytes = null; //Always null
int randomBytesUsed = 0;
SecureRandomSpi secureRandomSpi = null;
byte[] state = null;
@@ -91,9 +91,9 @@ public class SecureRandom extends Random
// ------------------------------------------------------------------------
/**
- Default constructor for SecureRandom. It constructs a
- new SecureRandom by instantating the first SecureRandom
- algorithm in the default security provier.
+ Default constructor for SecureRandom. It constructs a
+ new SecureRandom by instantating the first SecureRandom
+ algorithm in the default security provier.
It is not seeded and should be seeded using setSeed or else
on the first call to getnextBytes it will force a seed.
@@ -134,9 +134,9 @@ public class SecureRandom extends Random
throw death;
}
catch (Throwable t)
- {
- // Ignore.
- }
+ {
+ // Ignore.
+ }
}
}
}
@@ -148,9 +148,9 @@ public class SecureRandom extends Random
}
/**
- A constructor for SecureRandom. It constructs a new
- SecureRandom by instantating the first SecureRandom algorithm
- in the default security provier.
+ A constructor for SecureRandom. It constructs a new
+ SecureRandom by instantating the first SecureRandom algorithm
+ in the default security provier.
It is seeded with the passed function and is useful if the user
has access to hardware random device (like a radiation detector).
@@ -167,9 +167,9 @@ public class SecureRandom extends Random
}
/**
- A constructor for SecureRandom. It constructs a new
+ A constructor for SecureRandom. It constructs a new
SecureRandom using the specified SecureRandomSpi from
- the specified security provier.
+ the specified security provier.
@param secureRandomSpi A SecureRandomSpi class
@param provider A Provider class
@@ -183,7 +183,7 @@ public class SecureRandom extends Random
* Private constructor called from the getInstance() method.
*/
private SecureRandom(SecureRandomSpi secureRandomSpi, Provider provider,
- String algorithm)
+ String algorithm)
{
this.secureRandomSpi = secureRandomSpi;
this.provider = provider;
@@ -193,7 +193,7 @@ public class SecureRandom extends Random
/**
* Returns an instance of a <code>SecureRandom</code> from the first provider
* that implements it.
- *
+ *
* @param algorithm The algorithm name.
* @return A new <code>SecureRandom</code> implementing the given algorithm.
* @throws NoSuchAlgorithmException If no installed provider implements the
@@ -223,7 +223,7 @@ public class SecureRandom extends Random
/**
* Returns an instance of a <code>SecureRandom</code> for the specified
* algorithm from the named provider.
- *
+ *
* @param algorithm The algorithm name.
* @param provider The provider name.
* @return A new <code>SecureRandom</code> implementing the chosen
@@ -252,7 +252,7 @@ public class SecureRandom extends Random
/**
* Returns an instance of a <code>SecureRandom</code> for the specified
* algorithm from the given provider.
- *
+ *
* @param algorithm The <code>SecureRandom</code> algorithm to create.
* @param provider The provider to use.
* @throws NoSuchAlgorithmException If the algorithm cannot be found, or if
@@ -313,7 +313,7 @@ public class SecureRandom extends Random
}
/**
- Seeds the SecureRandom. The class is re-seeded for each call and
+ Seeds the SecureRandom. The class is re-seeded for each call and
each seed builds on the previous seed so as not to weaken security.
@param seed seed bytes to seed with
@@ -325,7 +325,7 @@ public class SecureRandom extends Random
}
/**
- Seeds the SecureRandom. The class is re-seeded for each call and
+ Seeds the SecureRandom. The class is re-seeded for each call and
each seed builds on the previous seed so as not to weaken security.
@param seed 8 seed bytes to seed with
@@ -340,13 +340,13 @@ public class SecureRandom extends Random
if (secureRandomSpi != null)
{
byte[] tmp = { (byte) (0xff & (seed >> 56)),
- (byte) (0xff & (seed >> 48)),
- (byte) (0xff & (seed >> 40)),
- (byte) (0xff & (seed >> 32)),
- (byte) (0xff & (seed >> 24)),
- (byte) (0xff & (seed >> 16)),
- (byte) (0xff & (seed >> 8)),
- (byte) (0xff & seed)
+ (byte) (0xff & (seed >> 48)),
+ (byte) (0xff & (seed >> 40)),
+ (byte) (0xff & (seed >> 32)),
+ (byte) (0xff & (seed >> 24)),
+ (byte) (0xff & (seed >> 16)),
+ (byte) (0xff & (seed >> 8)),
+ (byte) (0xff & seed)
};
secureRandomSpi.engineSetSeed(tmp);
isSeeded = true;
@@ -394,7 +394,7 @@ public class SecureRandom extends Random
/**
Returns the given number of seed bytes. This method is
- maintained only for backwards capability.
+ maintained only for backwards capability.
@param numBytes number of seed bytes to get
diff --git a/java/security/SecureRandomSpi.java b/java/security/SecureRandomSpi.java
index 7759097a4..08488ced7 100644
--- a/java/security/SecureRandomSpi.java
+++ b/java/security/SecureRandomSpi.java
@@ -40,11 +40,11 @@ import java.io.Serializable;
/**
SecureRandomSpi is the Service Provider Interface for SecureRandom
- providers. It provides an interface for providers to the
+ providers. It provides an interface for providers to the
SecureRandom engine to write their own pseudo-random number
generator.
- @since JDK 1.2
+ @since JDK 1.2
@author Mark Benvenuto (ivymccough@worldnet.att.net)
*/
@@ -60,7 +60,7 @@ public abstract class SecureRandomSpi implements Serializable
}
/**
- Updates the seed for SecureRandomSpi but does not reset seed.
+ Updates the seed for SecureRandomSpi but does not reset seed.
It does to this so repeated called never decrease randomness.
*/
protected abstract void engineSetSeed(byte[] seed);
@@ -74,7 +74,7 @@ public abstract class SecureRandomSpi implements Serializable
protected abstract void engineNextBytes(byte[] bytes);
/**
- Gets a user specified number of bytes specified by the
+ Gets a user specified number of bytes specified by the
parameter.
@param numBytes number of random bytes to generate
diff --git a/java/security/Security.java b/java/security/Security.java
index 6b7b66428..6cd98b0fb 100644
--- a/java/security/Security.java
+++ b/java/security/Security.java
@@ -70,7 +70,7 @@ public final class Security
private static Vector providers = new Vector();
private static Properties secprops = new Properties();
-
+
static
{
String base = SystemProperties.getProperty("gnu.classpath.home.url");
@@ -78,36 +78,36 @@ public final class Security
// Try VM specific security file
boolean loaded = loadProviders (base, vendor);
-
+
// Append classpath standard provider if possible
if (!loadProviders (base, "classpath")
- && !loaded
- && providers.size() == 0)
- {
- if (Configuration.DEBUG)
- {
- /* No providers found and both security files failed to
- * load properly. Give a warning in case of DEBUG is
- * enabled. Could be done with java.util.logging later.
- */
- System.err.println
- ("WARNING: could not properly read security provider files:");
- System.err.println
- (" " + base + "/security/" + vendor
- + ".security");
- System.err.println
- (" " + base + "/security/" + "classpath"
- + ".security");
- System.err.println
- (" Falling back to standard GNU security provider");
- }
+ && !loaded
+ && providers.size() == 0)
+ {
+ if (Configuration.DEBUG)
+ {
+ /* No providers found and both security files failed to
+ * load properly. Give a warning in case of DEBUG is
+ * enabled. Could be done with java.util.logging later.
+ */
+ System.err.println
+ ("WARNING: could not properly read security provider files:");
+ System.err.println
+ (" " + base + "/security/" + vendor
+ + ".security");
+ System.err.println
+ (" " + base + "/security/" + "classpath"
+ + ".security");
+ System.err.println
+ (" Falling back to standard GNU security provider");
+ }
// Note that this matches our classpath.security file.
- providers.addElement (new gnu.java.security.provider.Gnu());
- providers.addElement(new gnu.javax.crypto.jce.GnuCrypto());
+ providers.addElement (new gnu.java.security.provider.Gnu());
+ providers.addElement(new gnu.javax.crypto.jce.GnuCrypto());
providers.addElement(new gnu.javax.crypto.jce.GnuSasl());
providers.addElement(new gnu.javax.net.ssl.provider.Jessie());
providers.addElement(new gnu.javax.security.auth.callback.GnuCallbacks());
- }
+ }
}
// This class can't be instantiated.
private Security()
@@ -128,44 +128,44 @@ public final class Security
String secfilestr = baseUrl + "/security/" + vendor + ".security";
try
{
- InputStream fin = new URL(secfilestr).openStream();
- secprops.load(fin);
-
- int i = 1;
- String name;
- while ((name = secprops.getProperty("security.provider." + i)) != null)
- {
- Exception exception = null;
- try
- {
- ClassLoader sys = ClassLoader.getSystemClassLoader();
- providers.addElement(Class.forName(name, true, sys).newInstance());
- }
- catch (ClassNotFoundException x)
- {
- exception = x;
- }
- catch (InstantiationException x)
- {
- exception = x;
- }
- catch (IllegalAccessException x)
- {
- exception = x;
- }
-
- if (exception != null)
- {
- System.err.println ("WARNING: Error loading security provider "
- + name + ": " + exception);
- result = false;
- }
- i++;
- }
+ InputStream fin = new URL(secfilestr).openStream();
+ secprops.load(fin);
+
+ int i = 1;
+ String name;
+ while ((name = secprops.getProperty("security.provider." + i)) != null)
+ {
+ Exception exception = null;
+ try
+ {
+ ClassLoader sys = ClassLoader.getSystemClassLoader();
+ providers.addElement(Class.forName(name, true, sys).newInstance());
+ }
+ catch (ClassNotFoundException x)
+ {
+ exception = x;
+ }
+ catch (InstantiationException x)
+ {
+ exception = x;
+ }
+ catch (IllegalAccessException x)
+ {
+ exception = x;
+ }
+
+ if (exception != null)
+ {
+ System.err.println ("WARNING: Error loading security provider "
+ + name + ": " + exception);
+ result = false;
+ }
+ i++;
+ }
}
catch (IOException ignored)
{
- result = false;
+ result = false;
}
return result;
@@ -174,7 +174,7 @@ public final class Security
/**
* Returns the value associated to a designated property name for a given
* algorithm.
- *
+ *
* @param algName
* the algorithm name.
* @param propName
@@ -208,7 +208,7 @@ public final class Security
/**
* Inserts a new designated {@link Provider} at a designated (1-based)
* position in the current list of installed {@link Provider}s,
- *
+ *
* @param provider
* the new {@link Provider} to add.
* @param position
@@ -235,8 +235,8 @@ public final class Security
int max = providers.size ();
for (int i = 0; i < max; i++)
{
- if (((Provider) providers.elementAt(i)).getName().equals(provider.getName()))
- return -1;
+ if (((Provider) providers.elementAt(i)).getName().equals(provider.getName()))
+ return -1;
}
if (position < 0)
@@ -252,7 +252,7 @@ public final class Security
/**
* Appends the designated new {@link Provider} to the current list of
* installed {@link Provider}s.
- *
+ *
* @param provider
* the new {@link Provider} to append.
* @return the position (starting from 1) of <code>provider</code> in the
@@ -273,7 +273,7 @@ public final class Security
/**
* Removes an already installed {@link Provider}, given its name, from the
* current list of installed {@link Provider}s.
- *
+ *
* @param name
* the name of an already installed {@link Provider} to remove.
* @throws SecurityException
@@ -291,18 +291,18 @@ public final class Security
int max = providers.size ();
for (int i = 0; i < max; i++)
{
- if (((Provider) providers.elementAt(i)).getName().equals(name))
- {
- providers.remove(i);
- break;
- }
+ if (((Provider) providers.elementAt(i)).getName().equals(name))
+ {
+ providers.remove(i);
+ break;
+ }
}
}
/**
* Returns the current list of installed {@link Provider}s as an array
* ordered according to their installation preference order.
- *
+ *
* @return an array of all the installed providers.
*/
public static Provider[] getProviders()
@@ -314,7 +314,7 @@ public final class Security
/**
* Returns an already installed {@link Provider} given its name.
- *
+ *
* @param name
* the name of an already installed {@link Provider}.
* @return the {@link Provider} known by <code>name</code>. Returns
@@ -337,16 +337,16 @@ public final class Security
int max = providers.size ();
for (int i = 0; i < max; i++)
{
- p = (Provider) providers.elementAt(i);
- if (p.getName().equals(name))
- return p;
+ p = (Provider) providers.elementAt(i);
+ if (p.getName().equals(name))
+ return p;
}
return null;
}
/**
* Returns the value associated with a Security propery.
- *
+ *
* @param key
* the key of the property to fetch.
* @return the value of the Security property associated with
@@ -372,7 +372,7 @@ public final class Security
/**
* Sets or changes a designated Security property to a designated value.
- *
+ *
* @param key
* the name of the property to set.
* @param datum
@@ -399,7 +399,7 @@ public final class Security
* For a given <i>service</i> (e.g. Signature, MessageDigest, etc...) this
* method returns the {@link Set} of all available algorithm names (instances
* of {@link String}, from all currently installed {@link Provider}s.
- *
+ *
* @param serviceName
* the case-insensitive name of a service (e.g. Signature,
* MessageDigest, etc).
@@ -441,21 +441,21 @@ public final class Security
* Returns an array of currently installed {@link Provider}s, ordered
* according to their installation preference order, which satisfy a given
* <i>selection</i> criterion.
- *
+ *
* <p>This implementation recognizes a <i>selection</i> criterion written in
* one of two following forms:</p>
- *
+ *
* <ul>
* <li>&lt;crypto_service&gt;.&lt;algorithm_or_type&gt;: Where
* <i>crypto_service</i> is a case-insensitive string, similar to what has
* been described in the {@link #getAlgorithms(String)} method, and
* <i>algorithm_or_type</i> is a known case-insensitive name of an
* Algorithm, or one of its aliases.
- *
+ *
* <p>For example, "CertificateFactory.X.509" would return all the installed
* {@link Provider}s which provide a <i>CertificateFactory</i>
* implementation of <i>X.509</i>.</p></li>
- *
+ *
* <li>&lt;crypto_service&gt;.&lt;algorithm_or_type&gt; &lt;attribute_name&gt;:&lt;value&gt;:
* Where <i>crypto_service</i> is a case-insensitive string, similar to what
* has been described in the {@link #getAlgorithms(String)} method,
@@ -463,13 +463,13 @@ public final class Security
* or one of its aliases, <i>attribute_name</i> is a case-insensitive
* property name with no whitespace characters, and no dots, in-between, and
* <i>value</i> is a {@link String} with no whitespace characters in-between.
- *
+ *
* <p>For example, "Signature.Sha1WithDSS KeySize:1024" would return all the
* installed {@link Provider}s which declared their ability to provide
* <i>Signature</i> services, using the <i>Sha1WithDSS</i> algorithm with
* key sizes of <i>1024</i>.</p></li>
* </ul>
- *
+ *
* @param filter
* the <i>selection</i> criterion for selecting among the installed
* {@link Provider}s.
@@ -503,11 +503,11 @@ public final class Security
/**
* Returns an array of currently installed {@link Provider}s which satisfy a
* set of <i>selection</i> criteria.
- *
+ *
* <p>The <i>selection</i> criteria are defined in a {@link Map} where each
* element specifies a <i>selection</i> querry. The <i>Keys</i> in this
* {@link Map} must be in one of the two following forms:</p>
- *
+ *
* <ul>
* <li>&lt;crypto_service&gt;.&lt;algorithm_or_type&gt;: Where
* <i>crypto_service</i> is a case-insensitive string, similar to what has
@@ -517,7 +517,7 @@ public final class Security
* {@link Map} for such a <i>Key</i> MUST be the empty string.
* {@link Provider}s which provide an implementation for the designated
* <i>service algorithm</i> are included in the result.</li>
- *
+ *
* <li>&lt;crypto_service&gt;.&lt;algorithm_or_type&gt; &lt;attribute_name&gt;:
* Where <i>crypto_service</i> is a case-insensitive string, similar to what
* has been described in the {@link #getAlgorithms(String)} method,
@@ -529,7 +529,7 @@ public final class Security
* declare the designated <i>attribute_name</i> and <i>value</i> for the
* designated <i>service algorithm</i> are included in the result.</li>
* </ul>
- *
+ *
* @param filter
* a {@link Map} of <i>selection querries</i>.
* @return all currently installed {@link Provider}s which satisfy ALL the
diff --git a/java/security/Signature.java b/java/security/Signature.java
index 26333b686..d7186395f 100644
--- a/java/security/Signature.java
+++ b/java/security/Signature.java
@@ -52,30 +52,30 @@ import java.security.spec.AlgorithmParameterSpec;
* <code>Signature</code> is used to provide an interface to digital signature
* algorithms. Digital signatures provide authentication and data integrity of
* digital data.
- *
+ *
* <p>The GNU provider provides the NIST standard DSA which uses DSA and SHA-1.
* It can be specified by SHA/DSA, SHA-1/DSA or its OID. If the RSA signature
* algorithm is provided then it could be MD2/RSA. MD5/RSA, or SHA-1/RSA. The
* algorithm must be specified because there is no default.</p>
- *
+ *
* <p>Signature provides implementation-independent algorithms which are
* requested by the user through the <code>getInstance()<?code> methods. It can
* be requested by specifying just the algorithm name or by specifying both the
* algorithm name and provider name.</p>
- *
+ *
* <p>The three phases of using <code>Signature</code> are:</p>
- *
+ *
* <ol>
* <li>Initializing:
* <ul>
* <li>It must be initialized with a private key for signing.</li>
* <li>It must be initialized with a public key for verifying.</li>
* </li>
- *
+ *
* <li>Updating:
* <p>Update the bytes for signing or verifying with calls to update.</p>
* </li>
- *
+ *
* <li>Signing or Verify the signature on the currently stored bytes by
* calling sign or verify.</li>
* </ol>
@@ -117,7 +117,7 @@ public abstract class Signature extends SignatureSpi
/**
* Constructs a new <code>Signature</code> instance for a designated digital
* signature algorithm.
- *
+ *
* @param algorithm
* the algorithm to use.
*/
@@ -130,7 +130,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns an instance of <code>Signature</code> representing the specified
* signature.
- *
+ *
* @param algorithm the algorithm to use.
* @return a new instance repesenting the desired algorithm.
* @throws NoSuchAlgorithmException if the algorithm is not implemented by any
@@ -160,7 +160,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns an instance of <code>Signature</code> representing the specified
* signature from the named provider.
- *
+ *
* @param algorithm the algorithm to use.
* @param provider the name of the provider to use.
* @return a new instance repesenting the desired algorithm.
@@ -187,7 +187,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns an instance of <code>Signature</code> representing the specified
* signature from the specified {@link Provider}.
- *
+ *
* @param algorithm the algorithm to use.
* @param provider the {@link Provider} to use.
* @return a new instance repesenting the desired algorithm.
@@ -239,7 +239,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns the {@link Provider} of this instance.
- *
+ *
* @return the {@link Provider} of this instance.
*/
public final Provider getProvider()
@@ -249,7 +249,7 @@ public abstract class Signature extends SignatureSpi
/**
* Initializes this instance with the public key for verification purposes.
- *
+ *
* @param publicKey
* the public key to verify with.
* @throws InvalidKeyException
@@ -264,11 +264,11 @@ public abstract class Signature extends SignatureSpi
/**
* Verify a signature with a designated {@link Certificate}. This is a FIPS
* 140-1 compatible method since it verifies a signature with a certificate.
- *
+ *
* <p>If the {@link Certificate} is an X.509 one, has a <i>KeyUsage</i>
* parameter and that parameter indicates this key is not to be used for
* signing then an exception is thrown.</p>
- *
+ *
* @param certificate
* a {@link Certificate} containing a public key to verify with.
* @throws InvalidKeyException if the key is invalid.
@@ -290,7 +290,7 @@ public abstract class Signature extends SignatureSpi
/**
* Initializes this class with the private key for signing purposes.
- *
+ *
* @param privateKey
* the private key to sign with.
* @throws InvalidKeyException
@@ -305,7 +305,7 @@ public abstract class Signature extends SignatureSpi
/**
* Initializes this class with the private key and source of randomness for
* signing purposes.
- *
+ *
* @param privateKey
* the private key to sign with.
* @param random
@@ -323,7 +323,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns the signature bytes of all the data fed to this instance. The
* format of the output depends on the underlying signature algorithm.
- *
+ *
* @return the signature bytes.
* @throws SignatureException
* if the engine is not properly initialized.
@@ -340,15 +340,15 @@ public abstract class Signature extends SignatureSpi
* Generates signature bytes of all the data fed to this instance and stores
* it in the designated array. The format of the result depends on the
* underlying signature algorithm.
- *
+ *
* <p>After calling this method, the instance is reset to its initial state
* and can then be used to generate additional signatures.</p>
- *
+ *
* <p><b>IMPLEMENTATION NOTE:</b> Neither this method nor the GNU provider
* will return partial digests. If <code>len</code> is less than the
* signature length, this method will throw a {@link SignatureException}. If
* it is greater than or equal then it is ignored.</p>
- *
+ *
* @param outbuf
* array of bytes of where to store the resulting signature bytes.
* @param offset
@@ -371,7 +371,7 @@ public abstract class Signature extends SignatureSpi
/**
* Verifies a designated signature.
- *
+ *
* @param signature
* the signature bytes to verify.
* @return <code>true</code> if verified, <code>false</code> otherwise.
@@ -389,7 +389,7 @@ public abstract class Signature extends SignatureSpi
/**
* Verifies a designated signature.
- *
+ *
* @param signature
* the signature bytes to verify.
* @param offset
@@ -427,7 +427,7 @@ public abstract class Signature extends SignatureSpi
/**
* Updates the data to be signed or verified with the specified byte.
- *
+ *
* @param b
* the byte to update with.
* @throws SignatureException
@@ -443,7 +443,7 @@ public abstract class Signature extends SignatureSpi
/**
* Updates the data to be signed or verified with the specified bytes.
- *
+ *
* @param data
* the array of bytes to use.
* @throws SignatureException
@@ -459,7 +459,7 @@ public abstract class Signature extends SignatureSpi
/**
* Updates the data to be signed or verified with the specified bytes.
- *
+ *
* @param data
* an array of bytes to use.
* @param off
@@ -477,11 +477,11 @@ public abstract class Signature extends SignatureSpi
else
throw new SignatureException();
}
-
+
/**
* Update this signature with the {@link java.nio.Buffer#remaining()}
* bytes of the input buffer.
- *
+ *
* @param input The input buffer.
* @throws SignatureException If this instance was not properly
* initialized.
@@ -497,7 +497,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns the name of the algorithm currently used. The names of algorithms
* are usually SHA/DSA or SHA/RSA.
- *
+ *
* @return name of algorithm.
*/
public final String getAlgorithm()
@@ -507,7 +507,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns a rstring representation of this instance.
- *
+ *
* @return a rstring representation of this instance.
*/
public String toString()
@@ -517,7 +517,7 @@ public abstract class Signature extends SignatureSpi
/**
* Sets the specified algorithm parameter to the specified value.
- *
+ *
* @param param
* the parameter name.
* @param value
@@ -535,10 +535,10 @@ public abstract class Signature extends SignatureSpi
/**
* Sets the signature engine with the specified {@link AlgorithmParameterSpec}.
- *
+ *
* <p>By default, and unless overriden by the concrete SPI, this method always
* throws an {@link UnsupportedOperationException}.</p>
- *
+ *
* @param params
* the parameters to use for intializing this instance.
* @throws InvalidParameterException
@@ -554,7 +554,7 @@ public abstract class Signature extends SignatureSpi
/**
* Return the parameters of the algorithm used in this instance as an
* {@link AlgorithmParameters}.
- *
+ *
* @return the parameters used with this instance, or <code>null</code> if
* this instance does not use any parameters.
*/
@@ -565,7 +565,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns the value for the specified algorithm parameter.
- *
+ *
* @param param
* the parameter name.
* @return the parameter value.
@@ -581,7 +581,7 @@ public abstract class Signature extends SignatureSpi
/**
* Returns a clone of this instance.
- *
+ *
* @return a clone of this instace.
* @throws CloneNotSupportedException
* if the implementation does not support cloning.
diff --git a/java/security/SignatureSpi.java b/java/security/SignatureSpi.java
index 80ecbfd44..1ed078c0b 100644
--- a/java/security/SignatureSpi.java
+++ b/java/security/SignatureSpi.java
@@ -65,7 +65,7 @@ public abstract class SignatureSpi
/**
* Initializes this instance with the public key for verification purposes.
- *
+ *
* @param publicKey
* the public key to verify with.
* @throws InvalidKeyException
@@ -76,7 +76,7 @@ public abstract class SignatureSpi
/**
* Initializes this instance with the private key for signing purposes.
- *
+ *
* @param privateKey
* the private key to sign with.
* @throws InvalidKeyException
@@ -88,9 +88,9 @@ public abstract class SignatureSpi
/**
* Initializes this instance with the private key and source of randomness for
* signing purposes.
- *
+ *
* <p>This method cannot be abstract for backward compatibility reasons.</p>
- *
+ *
* @param privateKey
* the private key to sign with.
* @param random
@@ -108,7 +108,7 @@ public abstract class SignatureSpi
/**
* Updates the data to be signed or verified with the specified byte.
- *
+ *
* @param b
* byte to update with.
* @throws SignatureException
@@ -118,7 +118,7 @@ public abstract class SignatureSpi
/**
* Updates the data to be signed or verified with the specified bytes.
- *
+ *
* @param b
* the array of bytes to use.
* @param off
@@ -134,7 +134,7 @@ public abstract class SignatureSpi
/**
* Update this signature with the {@link java.nio.Buffer#remaining()}
* bytes of the given buffer.
- *
+ *
* @param input The input buffer.
* @throws IllegalStateException if the engine is not properly initialized.
*/
@@ -155,11 +155,11 @@ public abstract class SignatureSpi
}
}
}
-
+
/**
* Returns the signature bytes of all the data fed to this instance. The
* format of the output depends on the underlying signature algorithm.
- *
+ *
* @return the signature bytes.
* @throws SignatureException
* if the engine is not properly initialized.
@@ -170,16 +170,16 @@ public abstract class SignatureSpi
* Generates signature bytes of all the data fed to this instance and stores
* the result in the designated array. The format of the output depends on
* the underlying signature algorithm.
- *
+ *
* <p>This method cannot be abstract for backward compatibility reasons.
* After calling this method, the signature is reset to its initial state and
* can be used to generate additional signatures.</p>
- *
+ *
* <p><b>IMPLEMENTATION NOTE:</b>: Neither this method nor the GNU provider
* will return partial digests. If <code>len</code> is less than the
* signature length, this method will throw a {@link SignatureException}. If
* it is greater than or equal then it is ignored.</p>
- *
+ *
* @param outbuf
* the array of bytes to store the result in.
* @param offset
@@ -204,7 +204,7 @@ public abstract class SignatureSpi
/**
* Verifies a designated signature.
- *
+ *
* @param sigBytes
* the signature bytes to verify.
* @return <code>true</code> if verified, <code>false</code> otherwise.
@@ -219,7 +219,7 @@ public abstract class SignatureSpi
* Convenience method which calls the method with the same name and one
* argument after copying the designated bytes into a temporary byte array.
* Subclasses may override this method for performance reasons.
- *
+ *
* @param sigBytes
* the array of bytes to use.
* @param offset
@@ -240,7 +240,7 @@ public abstract class SignatureSpi
/**
* Sets the specified algorithm parameter to the specified value.
- *
+ *
* @param param
* the parameter name.
* @param value
@@ -255,11 +255,11 @@ public abstract class SignatureSpi
/**
* Sets the signature engine with the specified {@link AlgorithmParameterSpec}.
- *
+ *
* <p>This method cannot be abstract for backward compatibility reasons. By
* default it always throws {@link UnsupportedOperationException} unless
* overridden.</p>
- *
+ *
* @param params
* the parameters.
* @throws InvalidParameterException
@@ -278,7 +278,7 @@ public abstract class SignatureSpi
* implementations to return the appropriate {@link AlgorithmParameters} for
* this signature engine (or <code>null</code> when that engine does not use
* any parameters.
- *
+ *
* @return the parameters used with this signature engine, or
* <code>null</code> if it does not use any parameters.
* @throws UnsupportedOperationException
@@ -291,7 +291,7 @@ public abstract class SignatureSpi
/**
* Returns the value for the specified algorithm parameter.
- *
+ *
* @param param
* the parameter name.
* @return the parameter value.
@@ -304,7 +304,7 @@ public abstract class SignatureSpi
/**
* Returns a clone of this instance.
- *
+ *
* @return a clone of this instance.
* @throws CloneNotSupportedException
* if the implementation does not support cloning.
diff --git a/java/security/SignedObject.java b/java/security/SignedObject.java
index be5a67461..79f551cce 100644
--- a/java/security/SignedObject.java
+++ b/java/security/SignedObject.java
@@ -48,27 +48,27 @@ import java.io.Serializable;
/**
* <code>SignedObject</code> is used for storing runtime objects whose
* integrity cannot be compromised without being detected.
- *
+ *
* <p><code>SignedObject</code> contains a {@link Serializable} object which is
* yet to be signed and a digital signature of that object.</p>
- *
+ *
* <p>The signed copy is a "deep copy" (in serialized form) of an original
* object. Any changes to that original instance are not reflected in the
* enclosed copy inside this <code>SignedObject</code>.</p>
- *
+ *
* <p>Several things to note are that, first there is no need to initialize the
* signature engine as this class will handle that automatically. Second,
* verification will only succeed if the public key corresponds to the private
* key used to generate the digital signature inside this
* <code>SignedObject</code>.</p>
- *
+ *
* <p>For fexibility, the signature engine can be specified in the constructor
* or the <code>verify()</code> method. Programmers wishing to verify
* <code>SignedObject</code>s should be aware of the {@link Signature} engine
* they use. A malicious or flawed {@link Signature} implementation may always
* return true on verification thus circumventing the intended secrity check
* provided by the <code>SignedObject</code>.</p>
- *
+ *
* <p>The GNU security provider offers an implementation of the standard NIST
* DSA which uses "DSA" and "SHA-1". It can be specified by "SHA/DSA",
* "SHA-1/DSA" or its OID. If the RSA signature algorithm is provided then it
@@ -94,7 +94,7 @@ public final class SignedObject implements Serializable
* Constructs a new instance of <code>SignedObject</code> from a
* {@link Serializable} object. The object is signed with a designated
* private key and a signature engine.
- *
+ *
* @param object
* the object to sign.
* @param signingKey
@@ -109,7 +109,7 @@ public final class SignedObject implements Serializable
* if a signing error occurs.
*/
public SignedObject(Serializable object, PrivateKey signingKey,
- Signature signingEngine)
+ Signature signingEngine)
throws IOException, InvalidKeyException, SignatureException
{
thealgorithm = signingEngine.getAlgorithm();
@@ -130,7 +130,7 @@ public final class SignedObject implements Serializable
/**
* Returns the encapsulated object. The object is de-serialized before being
* returned.
- *
+ *
* @return the encapsulated object.
* @throws IOException
* if a de-serialization error occurs.
@@ -150,7 +150,7 @@ public final class SignedObject implements Serializable
/**
* Returns the signature bytes of the encapsulated object.
- *
+ *
* @return the signature bytes of the encapsulated object.
*/
public byte[] getSignature()
@@ -161,7 +161,7 @@ public final class SignedObject implements Serializable
/**
* Returns the name of the signature algorithm.
- *
+ *
* @return the name of the signature algorithm.
*/
public String getAlgorithm()
@@ -172,7 +172,7 @@ public final class SignedObject implements Serializable
/**
* Verifies the encapsulated digital signature by checking that it was
* generated by the owner of a designated public key.
- *
+ *
* @param verificationKey
* the public key to use.
* @param verificationEngine
diff --git a/java/security/Signer.java b/java/security/Signer.java
index c7780f6d3..18259c863 100644
--- a/java/security/Signer.java
+++ b/java/security/Signer.java
@@ -58,7 +58,7 @@ public abstract class Signer extends Identity
/**
* Constructs a new instance of <code>Signer</code> with the specified
* identity name.
- *
+ *
* @param name
* the name of the identity to use.
*/
@@ -70,7 +70,7 @@ public abstract class Signer extends Identity
/**
* Constructs a new instance of <code>Signer</code> with the specified
* identity name and {@link IdentityScope}.
- *
+ *
* @param name
* the name of the the identity to use.
* @param scope
@@ -86,7 +86,7 @@ public abstract class Signer extends Identity
/**
* Returns the private key of this <code>Signer</code>.
- *
+ *
* @returns the private key of this <code>Signer</code>.
* @throws SecurityException
* if a {@link SecurityManager} is installed which disallows this
@@ -103,7 +103,7 @@ public abstract class Signer extends Identity
/**
* Specifies the {@link KeyPair} associated with this <code>Signer</code>.
- *
+ *
* @param pair
* the {@link KeyPair} to use.
* @throws InvalidParameterException
diff --git a/java/security/acl/Acl.java b/java/security/acl/Acl.java
index 6a3f7d52a..10a59fdf5 100644
--- a/java/security/acl/Acl.java
+++ b/java/security/acl/Acl.java
@@ -50,7 +50,7 @@ import java.util.Enumeration;
* denied, the ACL treats it as if it were never granted or denied. If
* both a <code>Principal</code> and a <code>Group</code> to which the
* <code>Principal</code> belongs have an ACL entry, the permissions for
- * the individual <code>Principal</code> take precedence over the
+ * the individual <code>Principal</code> take precedence over the
* permissions of the <code>Group</code> if there is a conflict.
* <p>
* Additionally, the ACL interface extends the <code>Owner</code> interface
@@ -94,7 +94,7 @@ public interface Acl extends Owner
*
* @exception NotOwnerException If the caller is not an owner of this ACL.
*/
- boolean addEntry(Principal caller, AclEntry entry)
+ boolean addEntry(Principal caller, AclEntry entry)
throws NotOwnerException;
/**
diff --git a/java/security/acl/AclEntry.java b/java/security/acl/AclEntry.java
index ea906f184..47154b285 100644
--- a/java/security/acl/AclEntry.java
+++ b/java/security/acl/AclEntry.java
@@ -42,10 +42,10 @@ import java.util.Enumeration;
/**
* This interface models an entry in an access control list (ACL). Java
- * ACL's consist of a list of entries, where each consists of a
+ * ACL's consist of a list of entries, where each consists of a
* <code>Principal</code> and a list of <code>Permission</code>'s which
* have been granted to that <code>Principal</code>. An ACL can also
- * be <em>negative</em>, which indicates that the list of
+ * be <em>negative</em>, which indicates that the list of
* <code>Permission</code>'s is a list of permissions that are <em>not</em>
* granted to the <code>Principal</code>. A <code>Principal</code> can
* have at most one regular (or positive) ACL entry and one negative
diff --git a/java/security/acl/Group.java b/java/security/acl/Group.java
index ed6d56a57..a0df75526 100644
--- a/java/security/acl/Group.java
+++ b/java/security/acl/Group.java
@@ -81,7 +81,7 @@ public interface Group extends Principal
boolean isMember(Principal member);
/**
- * This method returns a list of all members of the group as an
+ * This method returns a list of all members of the group as an
* <code>Enumeration</code>.
*
* @return The list of all members of the group
diff --git a/java/security/acl/Owner.java b/java/security/acl/Owner.java
index df1605b2e..c671cd362 100644
--- a/java/security/acl/Owner.java
+++ b/java/security/acl/Owner.java
@@ -64,7 +64,7 @@ public interface Owner
*
* @exception NotOwnerException If the caller is not already an owner of this ACL
*/
- boolean addOwner(Principal caller, Principal owner)
+ boolean addOwner(Principal caller, Principal owner)
throws NotOwnerException;
/**
@@ -82,7 +82,7 @@ public interface Owner
* @exception NotOwnerException If the caller is not already an owner of this ACL
* @exception LastOwnerException If completing the operation would delete the last ACL owner
*/
- boolean deleteOwner(Principal caller, Principal owner)
+ boolean deleteOwner(Principal caller, Principal owner)
throws NotOwnerException, LastOwnerException;
/**
diff --git a/java/security/cert/CRL.java b/java/security/cert/CRL.java
index e763663f5..1eaa70fa9 100644
--- a/java/security/cert/CRL.java
+++ b/java/security/cert/CRL.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,11 +43,11 @@ package java.security.cert;
have different formats but the same general use. They
all serve as lists of revoked certificates and can
be queried for a given certificate.
-
+
Specialized CRLs extend this class.
-
+
@author Mark Benvenuto
-
+
@since JDK 1.2
*/
public abstract class CRL
@@ -59,7 +59,7 @@ public abstract class CRL
Creates a new CRL for the specified type. An example
is "X.509".
- @param type the standard name for the CRL type.
+ @param type the standard name for the CRL type.
*/
protected CRL(String type)
{
@@ -90,7 +90,7 @@ public abstract class CRL
@param cert A certificate to check if it is revoked
@return true if the certificate is revoked,
- false otherwise.
+ false otherwise.
*/
public abstract boolean isRevoked(Certificate cert);
diff --git a/java/security/cert/CRLSelector.java b/java/security/cert/CRLSelector.java
index 1fa5a207d..6cd657c7f 100644
--- a/java/security/cert/CRLSelector.java
+++ b/java/security/cert/CRLSelector.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/CertPathBuilder.java b/java/security/cert/CertPathBuilder.java
index 99f7c9752..47bae6db8 100644
--- a/java/security/cert/CertPathBuilder.java
+++ b/java/security/cert/CertPathBuilder.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -116,7 +116,7 @@ public class CertPathBuilder
/**
* Returns an instance of a named <code>CertPathBuilder</code> from the
* first provider that implements it.
- *
+ *
* @param algorithm The name of the <code>CertPathBuilder</code> to create.
* @return The new instance.
* @throws NoSuchAlgorithmException If no installed provider implements the
@@ -146,7 +146,7 @@ public class CertPathBuilder
/**
* Returns an instance of a named <code>CertPathBuilder</code> from a named
* provider.
- *
+ *
* @param algorithm The name of the <code>CertPathBuilder</code> to create.
* @param provider The name of the provider to use.
* @return The new instance.
@@ -171,7 +171,7 @@ public class CertPathBuilder
/**
* Returns an instance of a named <code>CertPathBuilder</code> from the
* specified provider.
- *
+ *
* @param algorithm The name of the <code>CertPathBuilder</code> to create.
* @param provider The provider to use.
* @return The new instance.
diff --git a/java/security/cert/CertPathBuilderResult.java b/java/security/cert/CertPathBuilderResult.java
index 737ba9431..edae88f64 100644
--- a/java/security/cert/CertPathBuilderResult.java
+++ b/java/security/cert/CertPathBuilderResult.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -47,17 +47,17 @@ package java.security.cert;
*/
public interface CertPathBuilderResult extends Cloneable {
- /**
+ /**
* Creates a copy of this builder result.
*
* @return The copy.
*/
- Object clone();
+ Object clone();
/**
* Get the certificate path that was built.
*
* @retrn The certificate path.
*/
- CertPath getCertPath();
+ CertPath getCertPath();
}
diff --git a/java/security/cert/CertPathValidator.java b/java/security/cert/CertPathValidator.java
index af08b54a8..8bd7b58e8 100644
--- a/java/security/cert/CertPathValidator.java
+++ b/java/security/cert/CertPathValidator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -129,7 +129,7 @@ public class CertPathValidator {
/**
* Returns an instance of the given validator from the first provider that
* implements it.
- *
+ *
* @param algorithm The name of the algorithm to get.
* @return The new instance.
* @throws NoSuchAlgorithmException If no installed provider implements the
@@ -158,7 +158,7 @@ public class CertPathValidator {
/**
* Returns an instance of the given validator from the named provider.
- *
+ *
* @param algorithm The name of the algorithm to get.
* @param provider The name of the provider from which to get the
* implementation.
@@ -184,7 +184,7 @@ public class CertPathValidator {
/**
* Returns an instance of the given validator from the given provider.
- *
+ *
* @param algorithm The name of the algorithm to get.
* @param provider The provider from which to get the implementation.
* @return The new instance.
diff --git a/java/security/cert/CertPathValidatorResult.java b/java/security/cert/CertPathValidatorResult.java
index 71aaf89bc..0ccd1be78 100644
--- a/java/security/cert/CertPathValidatorResult.java
+++ b/java/security/cert/CertPathValidatorResult.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/CertPathValidatorSpi.java b/java/security/cert/CertPathValidatorSpi.java
index 282b7a695..d4531e716 100644
--- a/java/security/cert/CertPathValidatorSpi.java
+++ b/java/security/cert/CertPathValidatorSpi.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/CertSelector.java b/java/security/cert/CertSelector.java
index aea614ad9..4a2e7d921 100644
--- a/java/security/cert/CertSelector.java
+++ b/java/security/cert/CertSelector.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/CertStore.java b/java/security/cert/CertStore.java
index 1ebdb5033..630e96762 100644
--- a/java/security/cert/CertStore.java
+++ b/java/security/cert/CertStore.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -128,7 +128,7 @@ public class CertStore
/**
* Returns an instance of the given certificate store type from the first
* installed provider.
- *
+ *
* @param type The type of <code>CertStore</code> to create.
* @param params The parameters to initialize this cert store with.
* @return The new instance.
@@ -161,7 +161,7 @@ public class CertStore
/**
* Returns an instance of the given certificate store type from a named
* provider.
- *
+ *
* @param type The type of <code>CertStore</code> to create.
* @param params The parameters to initialize this cert store with.
* @param provider The name of the provider to use.
diff --git a/java/security/cert/CertStoreParameters.java b/java/security/cert/CertStoreParameters.java
index aab22f01f..71bcd6109 100644
--- a/java/security/cert/CertStoreParameters.java
+++ b/java/security/cert/CertStoreParameters.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/CertStoreSpi.java b/java/security/cert/CertStoreSpi.java
index 976d65ce9..a47978a22 100644
--- a/java/security/cert/CertStoreSpi.java
+++ b/java/security/cert/CertStoreSpi.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/Certificate.java b/java/security/cert/Certificate.java
index 33a14a439..be1713cbf 100644
--- a/java/security/cert/Certificate.java
+++ b/java/security/cert/Certificate.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,18 +49,18 @@ import java.security.PublicKey;
import java.security.SignatureException;
/**
- * The Certificate class is an abstract class used to manage
+ * The Certificate class is an abstract class used to manage
* identity certificates. An identity certificate is a
- * combination of a principal and a public key which is
- * certified by another principal. This is the puprose of
+ * combination of a principal and a public key which is
+ * certified by another principal. This is the puprose of
* Certificate Authorities (CA).
- *
+ *
* <p>This class is used to manage different types of certificates
- * but have important common puposes. Different types of
+ * but have important common puposes. Different types of
* certificates like X.509 and OpenPGP share general certificate
* functions (like encoding and verifying) and information like
* public keys.
- *
+ *
* <p>X.509, OpenPGP, and SDSI can be implemented by subclassing this
* class even though they differ in storage methods and information
* stored.
@@ -74,7 +74,7 @@ import java.security.SignatureException;
public abstract class Certificate implements Serializable
{
private static final long serialVersionUID = -3585440601605666277L;
-
+
private String type;
/**
@@ -111,19 +111,19 @@ public abstract class Certificate implements Serializable
{
if( other instanceof Certificate ) {
try {
- Certificate x = (Certificate) other;
- if( getEncoded().length != x.getEncoded().length )
- return false;
+ Certificate x = (Certificate) other;
+ if( getEncoded().length != x.getEncoded().length )
+ return false;
- byte[] b1 = getEncoded();
- byte[] b2 = x.getEncoded();
+ byte[] b1 = getEncoded();
+ byte[] b2 = x.getEncoded();
- for( int i = 0; i < b1.length; i++ )
- if( b1[i] != b2[i] )
- return false;
+ for( int i = 0; i < b1.length; i++ )
+ if( b1[i] != b2[i] )
+ return false;
- } catch( CertificateEncodingException cee ) {
- return false;
+ } catch( CertificateEncodingException cee ) {
+ return false;
}
return true;
}
@@ -154,7 +154,7 @@ public abstract class Certificate implements Serializable
/**
Verifies that this Certificate was properly signed with the
- PublicKey that corresponds to its private key.
+ PublicKey that corresponds to its private key.
@param key PublicKey to verify with
@@ -174,7 +174,7 @@ public abstract class Certificate implements Serializable
/**
Verifies that this Certificate was properly signed with the
PublicKey that corresponds to its private key and uses
- the signature engine provided by the provider.
+ the signature engine provided by the provider.
@param key PublicKey to verify with
@param sigProvider Provider to use for signature algorithm
@@ -186,7 +186,7 @@ public abstract class Certificate implements Serializable
@throws SignatureException signature error
*/
public abstract void verify(PublicKey key,
- String sigProvider)
+ String sigProvider)
throws CertificateException,
NoSuchAlgorithmException,
InvalidKeyException,
@@ -251,7 +251,7 @@ public abstract class Certificate implements Serializable
/** From JDK1.4. */
private static final long serialVersionUID = -8563758940495660020L;
-
+
/** The certificate type, e.g. "X.509". */
private String type;
diff --git a/java/security/cert/CertificateFactory.java b/java/security/cert/CertificateFactory.java
index d83b8160e..4fd5b3965 100644
--- a/java/security/cert/CertificateFactory.java
+++ b/java/security/cert/CertificateFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -88,7 +88,7 @@ public class CertificateFactory
/**
* Returns an instance of a <code>CertificateFactory</code> representing the
* specified certificate factory type.
- *
+ *
* @param type The type of certificate factory to create.
* @return A <code>CertificateFactory</code> of the desired type.
* @throws CertificateException If the type of certificate factory is not
@@ -118,7 +118,7 @@ public class CertificateFactory
/**
* Returns an instance of a <code>CertificateFactory</code> representing the
* specified certificate factory type from the named provider.
- *
+ *
* @param type The type of certificate factory to create.
* @param provider The name of the provider to use.
* @return A <code>CertificateFactory</code> for the desired type.
@@ -130,7 +130,7 @@ public class CertificateFactory
* <code>type</code> is an empty string.
*/
public static final CertificateFactory getInstance(String type,
- String provider)
+ String provider)
throws CertificateException, NoSuchProviderException
{
if (provider == null)
@@ -144,7 +144,7 @@ public class CertificateFactory
/**
* Returns an instance of a <code>CertificateFactory</code> representing the
* specified certificate factory type from the designated provider.
- *
+ *
* @param type The type of certificate factory to create.
* @param provider The provider from which to get the implementation.
* @return A <code>CertificateFactory</code> for the desired type.
@@ -213,10 +213,10 @@ public class CertificateFactory
* Ex: A X.509 CertificateFactory should return X509Certificate.
*
* <p>For X.509 certificates, the certificate in inStream must be
- * DER encoded and supplied in binary or printable (Base64)
- * encoding. If the certificate is in Base64 encoding, it must be
- * bounded by -----BEGINCERTIFICATE-----, and
- * -----END CERTIFICATE-----.
+ * DER encoded and supplied in binary or printable (Base64)
+ * encoding. If the certificate is in Base64 encoding, it must be
+ * bounded by -----BEGINCERTIFICATE-----, and
+ * -----END CERTIFICATE-----.
*
* @param inStream An input stream containing the certificate data.
* @return A certificate initialized from the decoded InputStream data.
@@ -230,16 +230,16 @@ public class CertificateFactory
}
/**
- * Returns a collection of certificates that were read from the
- * input stream. It may be empty, have only one, or have
+ * Returns a collection of certificates that were read from the
+ * input stream. It may be empty, have only one, or have
* multiple certificates.
*
* For a X.509 certificate factory, the stream may contain a
- * single DER encoded certificate or a PKCS#7 certificate
- * chain. This is a PKCS#7 <I>SignedData</I> object with the
- * most significant field being <I>certificates</I>. If no
+ * single DER encoded certificate or a PKCS#7 certificate
+ * chain. This is a PKCS#7 <I>SignedData</I> object with the
+ * most significant field being <I>certificates</I>. If no
* CRLs are present, then an empty collection is returned.
- *
+ *
* @param inStream An input stream containing the certificate data.
* @return A collection of certificates initialized from the decoded
* InputStream data.
@@ -278,8 +278,8 @@ public class CertificateFactory
* from the InputStream.
*
* <p>For a X.509 certificate factory, the stream may contain a
- * single DER encoded CRL or a PKCS#7 CRL set. This is a
- * PKCS#7 <I>SignedData</I> object with the most significant
+ * single DER encoded CRL or a PKCS#7 CRL set. This is a
+ * PKCS#7 <I>SignedData</I> object with the most significant
* field being <I>crls</I>. If no CRLs are present, then an
* empty collection is returned.
*
diff --git a/java/security/cert/CertificateFactorySpi.java b/java/security/cert/CertificateFactorySpi.java
index e6a22b4eb..2c9ca5d38 100644
--- a/java/security/cert/CertificateFactorySpi.java
+++ b/java/security/cert/CertificateFactorySpi.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -47,15 +47,15 @@ import java.util.List;
/**
CertificateFactorySpi is the abstract class Service Provider
Interface (SPI) for the CertificateFactory class. A provider
- must implement all the abstract methods if they wish to
+ must implement all the abstract methods if they wish to
supply a certificate factory for a particular certificate
type. Ex: X.509
-
+
Certificate factories are used to generate certificates and
certificate revocation lists (CRL) from their encoding.
-
+
@since 1.2
-
+
@author Mark Benvenuto
*/
public abstract class CertificateFactorySpi
@@ -85,10 +85,10 @@ public abstract class CertificateFactorySpi
Ex: A X.509 CertificateFactory should return X509Certificate.
For X.509 certificates, the certificate in inStream must be
- DER encoded and supplied in binary or printable (Base64)
- encoding. If the certificate is in Base64 encoding, it must be
- bounded by -----BEGIN CERTIFICATE-----, and
- -----END CERTIFICATE-----.
+ DER encoded and supplied in binary or printable (Base64)
+ encoding. If the certificate is in Base64 encoding, it must be
+ bounded by -----BEGIN CERTIFICATE-----, and
+ -----END CERTIFICATE-----.
@param inStream an input stream containing the certificate data
@@ -100,19 +100,19 @@ public abstract class CertificateFactorySpi
throws CertificateException;
/**
- Returns a collection of certificates that were read from the
- input stream. It may be empty, have only one, or have
+ Returns a collection of certificates that were read from the
+ input stream. It may be empty, have only one, or have
multiple certificates.
For a X.509 certificate factory, the stream may contain a
- single DER encoded certificate or a PKCS#7 certificate
- chain. This is a PKCS#7 <I>SignedData</I> object with the
- most significant field being <I>certificates</I>. If no
+ single DER encoded certificate or a PKCS#7 certificate
+ chain. This is a PKCS#7 <I>SignedData</I> object with the
+ most significant field being <I>certificates</I>. If no
CRLs are present, then an empty collection is returned.
-
+
@param inStream an input stream containing the certificates
- @return a collection of certificates initialized with
+ @return a collection of certificates initialized with
the InputStream data.
@throws CertificateException Certificate parsing error
@@ -145,14 +145,14 @@ public abstract class CertificateFactorySpi
from the InputStream.
For a X.509 certificate factory, the stream may contain a
- single DER encoded CRL or a PKCS#7 CRL set. This is a
- PKCS#7 <I>SignedData</I> object with the most significant
+ single DER encoded CRL or a PKCS#7 CRL set. This is a
+ PKCS#7 <I>SignedData</I> object with the most significant
field being <I>crls</I>. If no CRLs are present, then an
empty collection is returned.
@param inStream an input stream containing the CRLs
- @return a collection of CRLs initialized with
+ @return a collection of CRLs initialized with
the InputStream data.
@throws CRLException CRL parsing error
@@ -222,4 +222,3 @@ public abstract class CertificateFactorySpi
throw new UnsupportedOperationException("not implemented");
}
}
-
diff --git a/java/security/cert/CollectionCertStoreParameters.java b/java/security/cert/CollectionCertStoreParameters.java
index b3ee93235..389874854 100644
--- a/java/security/cert/CollectionCertStoreParameters.java
+++ b/java/security/cert/CollectionCertStoreParameters.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/LDAPCertStoreParameters.java b/java/security/cert/LDAPCertStoreParameters.java
index 4414e65a0..f2dff764a 100644
--- a/java/security/cert/LDAPCertStoreParameters.java
+++ b/java/security/cert/LDAPCertStoreParameters.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/PKIXBuilderParameters.java b/java/security/cert/PKIXBuilderParameters.java
index fd5f1f87f..3a29b5218 100644
--- a/java/security/cert/PKIXBuilderParameters.java
+++ b/java/security/cert/PKIXBuilderParameters.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/PKIXCertPathBuilderResult.java b/java/security/cert/PKIXCertPathBuilderResult.java
index fa160913c..52984b543 100644
--- a/java/security/cert/PKIXCertPathBuilderResult.java
+++ b/java/security/cert/PKIXCertPathBuilderResult.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/PKIXCertPathChecker.java b/java/security/cert/PKIXCertPathChecker.java
index a69347fcd..0bedf401a 100644
--- a/java/security/cert/PKIXCertPathChecker.java
+++ b/java/security/cert/PKIXCertPathChecker.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/PKIXCertPathValidatorResult.java b/java/security/cert/PKIXCertPathValidatorResult.java
index 5a1660c3b..17b5c86f8 100644
--- a/java/security/cert/PKIXCertPathValidatorResult.java
+++ b/java/security/cert/PKIXCertPathValidatorResult.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/PKIXParameters.java b/java/security/cert/PKIXParameters.java
index bb68cb937..bbb75571f 100644
--- a/java/security/cert/PKIXParameters.java
+++ b/java/security/cert/PKIXParameters.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/PolicyNode.java b/java/security/cert/PolicyNode.java
index b1196037e..5da78c188 100644
--- a/java/security/cert/PolicyNode.java
+++ b/java/security/cert/PolicyNode.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/PolicyQualifierInfo.java b/java/security/cert/PolicyQualifierInfo.java
index d4d9f9984..b53faa935 100644
--- a/java/security/cert/PolicyQualifierInfo.java
+++ b/java/security/cert/PolicyQualifierInfo.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/security/cert/X509CRL.java b/java/security/cert/X509CRL.java
index a00706e67..895ba33e7 100644
--- a/java/security/cert/X509CRL.java
+++ b/java/security/cert/X509CRL.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,48 +56,48 @@ import javax.security.auth.x500.X500Principal;
time stamped entries which indicate which lists have been
revoked. The list is signed by a Certificate Authority (CA)
and made publically available in a repository.
-
- Each revoked certificate in the CRL is identified by its
- certificate serial number. When a piece of code uses a
- certificate, the certificates validity is checked by
+
+ Each revoked certificate in the CRL is identified by its
+ certificate serial number. When a piece of code uses a
+ certificate, the certificates validity is checked by
validating its signature and determing that it is not
only a recently acquired CRL. The recently aquired CRL
is depends on the local policy in affect. The CA issues
- a new CRL periodically and entries are removed as the
+ a new CRL periodically and entries are removed as the
certificate expiration date is reached
-
-
+
+
A description of the X.509 v2 CRL follows below from rfc2459.
-
+
"The X.509 v2 CRL syntax is as follows. For signature calculation,
the data that is to be signed is ASN.1 DER encoded. ASN.1 DER
encoding is a tag, length, value encoding system for each element.
-
- CertificateList ::= SEQUENCE {
- tbsCertList TBSCertList,
- signatureAlgorithm AlgorithmIdentifier,
- signatureValue BIT STRING }
-
- TBSCertList ::= SEQUENCE {
- version Version OPTIONAL,
+
+ CertificateList ::= SEQUENCE {
+ tbsCertList TBSCertList,
+ signatureAlgorithm AlgorithmIdentifier,
+ signatureValue BIT STRING }
+
+ TBSCertList ::= SEQUENCE {
+ version Version OPTIONAL,
-- if present, shall be v2
- signature AlgorithmIdentifier,
- issuer Name,
- thisUpdate Time,
- nextUpdate Time OPTIONAL,
- revokedCertificates SEQUENCE OF SEQUENCE {
- userCertificate CertificateSerialNumber,
- revocationDate Time,
- crlEntryExtensions Extensions OPTIONAL
- -- if present, shall be v2
- } OPTIONAL,
- crlExtensions [0] EXPLICIT Extensions OPTIONAL
- -- if present, shall be v2
- }"
-
- @author Mark Benvenuto
-
- @since 1.2
+ signature AlgorithmIdentifier,
+ issuer Name,
+ thisUpdate Time,
+ nextUpdate Time OPTIONAL,
+ revokedCertificates SEQUENCE OF SEQUENCE {
+ userCertificate CertificateSerialNumber,
+ revocationDate Time,
+ crlEntryExtensions Extensions OPTIONAL
+ -- if present, shall be v2
+ } OPTIONAL,
+ crlExtensions [0] EXPLICIT Extensions OPTIONAL
+ -- if present, shall be v2
+ }"
+
+ @author Mark Benvenuto
+
+ @since 1.2
*/
public abstract class X509CRL extends CRL implements X509Extension
{
@@ -123,19 +123,19 @@ public abstract class X509CRL extends CRL implements X509Extension
{
if( other instanceof X509CRL ) {
try {
- X509CRL x = (X509CRL) other;
- if( getEncoded().length != x.getEncoded().length )
- return false;
+ X509CRL x = (X509CRL) other;
+ if( getEncoded().length != x.getEncoded().length )
+ return false;
- byte[] b1 = getEncoded();
- byte[] b2 = x.getEncoded();
+ byte[] b1 = getEncoded();
+ byte[] b2 = x.getEncoded();
- for( int i = 0; i < b1.length; i++ )
- if( b1[i] != b2[i] )
- return false;
+ for( int i = 0; i < b1.length; i++ )
+ if( b1[i] != b2[i] )
+ return false;
- } catch( CRLException crle ) {
- return false;
+ } catch( CRLException crle ) {
+ return false;
}
return true;
}
@@ -164,7 +164,7 @@ public abstract class X509CRL extends CRL implements X509Extension
/**
Verifies that this CRL was properly signed with the
- PublicKey that corresponds to its private key.
+ PublicKey that corresponds to its private key.
@param key PublicKey to verify with
@@ -184,7 +184,7 @@ public abstract class X509CRL extends CRL implements X509Extension
/**
Verifies that this CRL was properly signed with the
PublicKey that corresponds to its private key and uses
- the signature engine provided by the provider.
+ the signature engine provided by the provider.
@param key PublicKey to verify with
@param sigProvider Provider to use for signature algorithm
@@ -196,7 +196,7 @@ public abstract class X509CRL extends CRL implements X509Extension
@throws SignatureException signature error
*/
public abstract void verify(PublicKey key,
- String sigProvider)
+ String sigProvider)
throws CRLException,
NoSuchAlgorithmException,
InvalidKeyException,
@@ -221,7 +221,7 @@ public abstract class X509CRL extends CRL implements X509Extension
/**
Returns the issuer (issuer distinguished name) of the CRL.
- The issuer is the entity who signed and issued the
+ The issuer is the entity who signed and issued the
Certificate Revocation List.
The ASN.1 DER encoding is:
@@ -307,7 +307,7 @@ public abstract class X509CRL extends CRL implements X509Extension
public abstract Set<? extends X509CRLEntry> getRevokedCertificates();
/**
- Returns the DER ASN.1 encoded tbsCertList which is
+ Returns the DER ASN.1 encoded tbsCertList which is
the basic information of the list and associated certificates
in the encoded state. See top for more information.
@@ -323,7 +323,7 @@ public abstract class X509CRL extends CRL implements X509Extension
/**
- Returns the signature for the CRL.
+ Returns the signature for the CRL.
The ASN.1 DER encoding is:
@@ -334,7 +334,7 @@ public abstract class X509CRL extends CRL implements X509Extension
public abstract byte[] getSignature();
/**
- Returns the signature algorithm used to sign the CRL.
+ Returns the signature algorithm used to sign the CRL.
An examples is "SHA-1/DSA".
The ASN.1 DER encoding is:
@@ -371,9 +371,9 @@ public abstract class X509CRL extends CRL implements X509Extension
/**
Returns the AlgorithmParameters in the encoded form
- for the signature algorithm used.
+ for the signature algorithm used.
- If access to the parameters is need, create an
+ If access to the parameters is need, create an
instance of AlgorithmParameters.
@return byte array containing algorithm parameters, null
diff --git a/java/security/cert/X509CRLEntry.java b/java/security/cert/X509CRLEntry.java
index 4c9cada47..ac5ef4714 100644
--- a/java/security/cert/X509CRLEntry.java
+++ b/java/security/cert/X509CRLEntry.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -42,8 +42,8 @@ import java.math.BigInteger;
import java.util.Date;
/**
- Abstract class for entries in the CRL (Certificate Revocation
- List). The ASN.1 definition for <I>revokedCertificates</I> is
+ Abstract class for entries in the CRL (Certificate Revocation
+ List). The ASN.1 definition for <I>revokedCertificates</I> is
revokedCertificates SEQUENCE OF SEQUENCE {
userCertificate CertificateSerialNumber,
@@ -52,24 +52,24 @@ import java.util.Date;
-- if present, shall be v2
} OPTIONAL,
- CertificateSerialNumber ::= INTEGER
+ CertificateSerialNumber ::= INTEGER
- Time ::= CHOICE {
+ Time ::= CHOICE {
utcTime UTCTime,
- generalTime GeneralizedTime }
+ generalTime GeneralizedTime }
- Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
+ Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
- Extension ::= SEQUENCE {
- extnID OBJECT IDENTIFIER,
+ Extension ::= SEQUENCE {
+ extnID OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
extnValue OCTET STRING }
-
- For more information consult rfc2459.
- @author Mark Benvenuto
+ For more information consult rfc2459.
+
+ @author Mark Benvenuto
- @since JDK 1.2
+ @since JDK 1.2
*/
public abstract class X509CRLEntry implements X509Extension
{
@@ -93,19 +93,19 @@ public abstract class X509CRLEntry implements X509Extension
{
if( other instanceof X509CRLEntry ) {
try {
- X509CRLEntry xe = (X509CRLEntry) other;
- if( getEncoded().length != xe.getEncoded().length )
- return false;
+ X509CRLEntry xe = (X509CRLEntry) other;
+ if( getEncoded().length != xe.getEncoded().length )
+ return false;
- byte[] b1 = getEncoded();
- byte[] b2 = xe.getEncoded();
+ byte[] b1 = getEncoded();
+ byte[] b2 = xe.getEncoded();
- for( int i = 0; i < b1.length; i++ )
- if( b1[i] != b2[i] )
- return false;
+ for( int i = 0; i < b1.length; i++ )
+ if( b1[i] != b2[i] )
+ return false;
- } catch( CRLException crle ) {
- return false;
+ } catch( CRLException crle ) {
+ return false;
}
return true;
}
diff --git a/java/security/cert/X509CertSelector.java b/java/security/cert/X509CertSelector.java
index 4115fffac..8c1230afb 100644
--- a/java/security/cert/X509CertSelector.java
+++ b/java/security/cert/X509CertSelector.java
@@ -102,7 +102,7 @@ public class X509CertSelector implements CertSelector, Cloneable
return (oid != null && oid.length > 2 &&
(oid[0] >= 0 && oid[0] <= 2) && (oid[1] >= 0 && oid[1] <= 39));
}
-
+
private static GeneralName makeName(int id, String name) throws IOException
{
byte[] nameBytes = null;
@@ -114,22 +114,22 @@ public class X509CertSelector implements CertSelector, Cloneable
case uniformResourceIdentifier:
nameBytes = name.getBytes("ASCII");
break;
-
+
case iPAddress:
InetAddress addr = InetAddress.getByName(name);
nameBytes = addr.getAddress();
break;
-
+
case registeredId:
OID oid = new OID(name);
nameBytes = oid.getDER();
break;
-
+
case directoryName:
X500Principal xname = new X500Principal(name);
nameBytes = xname.getEncoded();
break;
-
+
case ediPartyName:
case x400Address:
case otherName:
@@ -138,7 +138,7 @@ public class X509CertSelector implements CertSelector, Cloneable
}
return new GeneralName(kind, nameBytes);
}
-
+
private int basicConstraints;
private X509Certificate cert;
private BigInteger serialNo;
@@ -171,7 +171,7 @@ public class X509CertSelector implements CertSelector, Cloneable
/**
* Add a name to match in the NameConstraints extension. The argument is
* the DER-encoded bytes of a GeneralName structure.
- *
+ *
* See the method {@link #addSubjectAlternativeName(int, byte[])} for the
* format of the GeneralName structure.
*
@@ -208,9 +208,9 @@ public class X509CertSelector implements CertSelector, Cloneable
/**
* Add a name, as DER-encoded bytes, to the subject alternative names
* criterion.
- *
+ *
* The name is a GeneralName structure, which has the ASN.1 format:
- *
+ *
* <pre>
GeneralName ::= CHOICE {
otherName [0] OtherName,
@@ -242,7 +242,7 @@ public class X509CertSelector implements CertSelector, Cloneable
* only recognize certain types of name that have convenient string
* encodings. For robustness, you should use the {@link
* #addSubjectAlternativeName(int, byte[])} method whenever possible.
- *
+ *
* This method can only decode certain name kinds of names as strings.
*
* @param id The type of name this is. Must be in the range [0,8].
@@ -417,7 +417,7 @@ public class X509CertSelector implements CertSelector, Cloneable
n.add(name.name());
names.add(n);
}
-
+
return names;
}
return null;
@@ -735,7 +735,7 @@ public class X509CertSelector implements CertSelector, Cloneable
// ignored
}
}
-
+
if (policies == null)
return false;
if (!policies.getPolicies().containsAll(policy))
@@ -766,7 +766,7 @@ public class X509CertSelector implements CertSelector, Cloneable
}
}
}
-
+
if (nc == null)
return false;
@@ -956,18 +956,18 @@ public class X509CertSelector implements CertSelector, Cloneable
{
// Check if the input is well-formed...
new NameConstraints(nameConstraints);
-
+
// But we just compare raw byte arrays.
this.nameConstraints = nameConstraints != null
? (byte[]) nameConstraints.clone() : null;
}
-
+
/**
- * Sets the pathToNames criterion. The argument is a collection of
+ * Sets the pathToNames criterion. The argument is a collection of
* pairs, the first element of which is an {@link Integer} giving
* the ID of the name, and the second element is either a {@link String}
* or a byte array.
- *
+ *
* See {@link #addPathToName(int, byte[])} and {@link #addPathToName(int, String)}
* for how these arguments are handled.
*
@@ -1249,7 +1249,7 @@ public class X509CertSelector implements CertSelector, Cloneable
else
this.sigId = null;
}
-
+
public String toString()
{
CPStringBuilder str = new CPStringBuilder(X509CertSelector.class.getName());
diff --git a/java/security/cert/X509Certificate.java b/java/security/cert/X509Certificate.java
index b398e093e..ab9e1be37 100644
--- a/java/security/cert/X509Certificate.java
+++ b/java/security/cert/X509Certificate.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,10 +45,10 @@ import java.util.List;
/**
* X509Certificate is the abstract class for X.509 certificates.
- * This provides a stanard class interface for accessing all
+ * This provides a stanard class interface for accessing all
* the attributes of X.509 certificates.
*
- * <p>In June 1996, the basic X.509 v3 format was finished by
+ * <p>In June 1996, the basic X.509 v3 format was finished by
* ISO/IEC and ANSI X.9. The ASN.1 DER format is below:
*
* <blockquote><pre>
@@ -58,22 +58,22 @@ import java.util.List;
* signatureValue BIT STRING }
* </pre></blockquote>
*
- * <p>These certificates are widely used in various Internet
- * protocols to support authentication. It is used in
+ * <p>These certificates are widely used in various Internet
+ * protocols to support authentication. It is used in
* Privacy Enhanced Mail (PEM), Transport Layer Security (TLS),
* Secure Sockets Layer (SSL), code signing for trusted software
* distribution, and Secure Electronic Transactions (SET).
*
- * <p>The certificates are managed and vouched for by
- * <I>Certificate Authorities</I> (CAs). CAs are companies or
- * groups that create certificates by placing the data in the
+ * <p>The certificates are managed and vouched for by
+ * <I>Certificate Authorities</I> (CAs). CAs are companies or
+ * groups that create certificates by placing the data in the
* X.509 certificate format and signing it with their private
* key. CAs serve as trusted third parties by certifying that
* the person or group specified in the certificate is who
- * they say they are.
+ * they say they are.
*
* <p>The ASN.1 defintion for <I>tbsCertificate</I> is
- *
+ *
* <blockquote><pre>
* TBSCertificate ::= SEQUENCE {
* version [0] EXPLICIT Version DEFAULT v1,
@@ -116,7 +116,7 @@ import java.util.List;
* critical BOOLEAN DEFAULT FALSE,
* extnValue OCTET STRING }
* </pre></blockquote>
- *
+ *
* Certificates are created with the CertificateFactory.
*
* <p>References:
@@ -170,7 +170,7 @@ public abstract class X509Certificate
Consult rfc2459 for more information.
@throws CertificateExpiredException if the certificate expired
- @throws CertificateNotYetValidException if the certificate is
+ @throws CertificateNotYetValidException if the certificate is
not yet valid
*/
public abstract void checkValidity()
@@ -178,14 +178,14 @@ public abstract class X509Certificate
CertificateNotYetValidException;
/**
- Checks the validity of the X.509 certificate for the
- specified time and date. It is valid if the specified
- date and time are within the period specified by
+ Checks the validity of the X.509 certificate for the
+ specified time and date. It is valid if the specified
+ date and time are within the period specified by
the certificate.
- @throws CertificateExpiredException if the certificate expired
+ @throws CertificateExpiredException if the certificate expired
based on the date
- @throws CertificateNotYetValidException if the certificate is
+ @throws CertificateNotYetValidException if the certificate is
not yet valid based on the date
*/
public abstract void checkValidity(Date date)
@@ -203,13 +203,13 @@ public abstract class X509Certificate
Consult rfc2459 for more information.
- @return version number of certificate
+ @return version number of certificate
*/
public abstract int getVersion();
/**
Gets the serial number for serial Number in
- this Certifcate. It must be a unique number
+ this Certifcate. It must be a unique number
unique other serial numbers from the granting CA.
The ASN.1 DER encoding is:
@@ -225,8 +225,8 @@ public abstract class X509Certificate
public abstract BigInteger getSerialNumber();
/**
- Returns the issuer (issuer distinguished name) of the
- Certificate. The issuer is the entity who signed
+ Returns the issuer (issuer distinguished name) of the
+ Certificate. The issuer is the entity who signed
and issued the Certificate.
The ASN.1 DER encoding is:
@@ -263,7 +263,7 @@ public abstract class X509Certificate
public abstract Principal getIssuerDN();
/**
- Returns the subject (subject distinguished name) of the
+ Returns the subject (subject distinguished name) of the
Certificate. The subject is the entity who the Certificate
identifies.
@@ -331,7 +331,7 @@ public abstract class X509Certificate
public abstract byte[] getSignature();
/**
- Returns the signature algorithm used to sign the CRL.
+ Returns the signature algorithm used to sign the CRL.
An examples is "SHA-1/DSA".
The ASN.1 DER encoding is:
@@ -370,9 +370,9 @@ public abstract class X509Certificate
/**
Returns the AlgorithmParameters in the encoded form
- for the signature algorithm used.
+ for the signature algorithm used.
- If access to the parameters is need, create an
+ If access to the parameters is need, create an
instance of AlgorithmParameters.
@return byte array containing algorithm parameters, null
@@ -390,7 +390,7 @@ public abstract class X509Certificate
-- If present, version shall be v2 or v3
UniqueIdentifier ::= BIT STRING
-
+
Consult rfc2459 for more information.
@return bit representation of <I>issuerUniqueID</I>
@@ -406,7 +406,7 @@ public abstract class X509Certificate
-- If present, version shall be v2 or v3
UniqueIdentifier ::= BIT STRING
-
+
Consult rfc2459 for more information.
@return bit representation of <I>subjectUniqueID</I>
@@ -414,7 +414,7 @@ public abstract class X509Certificate
public abstract boolean[] getSubjectUniqueID();
/**
- Returns a boolean array representing the <I>KeyUsage</I>
+ Returns a boolean array representing the <I>KeyUsage</I>
extension for the certificate. The KeyUsage (OID = 2.5.29.15)
defines the purpose of the key in the certificate.
@@ -441,15 +441,15 @@ public abstract class X509Certificate
/**
Returns the certificate constraints path length from the
- critical BasicConstraints extension, (OID = 2.5.29.19).
+ critical BasicConstraints extension, (OID = 2.5.29.19).
- The basic constraints extensions is used to determine if
- the subject of the certificate is a Certificate Authority (CA)
- and how deep the certification path may exist. The
+ The basic constraints extensions is used to determine if
+ the subject of the certificate is a Certificate Authority (CA)
+ and how deep the certification path may exist. The
<I>pathLenConstraint</I> only takes affect if <I>cA</I>
- is set to true. "A value of zero indicates that only an
+ is set to true. "A value of zero indicates that only an
end-entity certificate may follow in the path." (rfc2459)
-
+
The ASN.1 DER encoding is:
id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 }
@@ -477,7 +477,7 @@ public abstract class X509Certificate
*
* <p>The ASN.1 definition for this extension is:
*
- * <blockquote><pre>
+ * <blockquote><pre>
* ExtendedKeyUsage ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
*
* KeyPurposeId ::= OBJECT IDENTIFIER
@@ -575,7 +575,7 @@ public abstract class X509Certificate
{
throw new UnsupportedOperationException();
}
-
+
/**
* Returns the X.500 distinguished name of this certificate's issuer.
*
diff --git a/java/security/cert/X509Extension.java b/java/security/cert/X509Extension.java
index bd9473782..a0c24f429 100644
--- a/java/security/cert/X509Extension.java
+++ b/java/security/cert/X509Extension.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,37 +40,37 @@ package java.security.cert;
import java.util.Set;
/**
- Public interface for the X.509 Extension.
+ Public interface for the X.509 Extension.
+
+ This is used for X.509 v3 Certificates and CRL v2 (Certificate
+ Revocation Lists) for managing attributes assoicated with
+ Certificates, for managing the hierarchy of certificates,
+ and for managing the distribution of CRL. This extension
+ format is used to define private extensions.
- This is used for X.509 v3 Certificates and CRL v2 (Certificate
- Revocation Lists) for managing attributes assoicated with
- Certificates, for managing the hierarchy of certificates,
- and for managing the distribution of CRL. This extension
- format is used to define private extensions.
+ Each extensions for a certificate or CRL must be marked
+ either critical or non-critical. If the certificate/CRL
+ system encounters a critical extension not recognized then
+ it must reject the certificate. A non-critical extension
+ may be just ignored if not recognized.
- Each extensions for a certificate or CRL must be marked
- either critical or non-critical. If the certificate/CRL
- system encounters a critical extension not recognized then
- it must reject the certificate. A non-critical extension
- may be just ignored if not recognized.
+ The ASN.1 definition for this class is:
- The ASN.1 definition for this class is:
+ Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
- Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
+ Extension ::= SEQUENCE {
+ extnId OBJECT IDENTIFIER,
+ critical BOOLEAN DEFAULT FALSE,
+ extnValue OCTET STRING
+ -- contains a DER encoding of a value
+ -- of the type registered for use with
+ -- the extnId object identifier value
+ }
- Extension ::= SEQUENCE {
- extnId OBJECT IDENTIFIER,
- critical BOOLEAN DEFAULT FALSE,
- extnValue OCTET STRING
- -- contains a DER encoding of a value
- -- of the type registered for use with
- -- the extnId object identifier value
- }
-
- @author Mark Benvenuto
+ @author Mark Benvenuto
- @since 1.2
+ @since 1.2
*/
public interface X509Extension
{
@@ -79,12 +79,12 @@ public interface X509Extension
Returns true if the certificate contains a critical extension
that is not supported.
- @return true if has unsupported extension, false otherwise
+ @return true if has unsupported extension, false otherwise
*/
boolean hasUnsupportedCriticalExtension();
/**
- Returns a set of the CRITICAL extension OIDs from the
+ Returns a set of the CRITICAL extension OIDs from the
certificate/CRL that the object implementing this interface
manages.
@@ -94,7 +94,7 @@ public interface X509Extension
Set<String> getCriticalExtensionOIDs();
/**
- Returns a set of the NON-CRITICAL extension OIDs from the
+ Returns a set of the NON-CRITICAL extension OIDs from the
certificate/CRL that the object implementing this interface
manages.
diff --git a/java/security/spec/AlgorithmParameterSpec.java b/java/security/spec/AlgorithmParameterSpec.java
index 25506f55c..bc877e312 100644
--- a/java/security/spec/AlgorithmParameterSpec.java
+++ b/java/security/spec/AlgorithmParameterSpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,13 +39,13 @@ exception statement from your version. */
package java.security.spec;
/**
- A transparent interface for Algorithm Parameter Specifications.
- It contains no member functions. It is used to group
- algorithm parameter classes.
+ A transparent interface for Algorithm Parameter Specifications.
+ It contains no member functions. It is used to group
+ algorithm parameter classes.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
public interface AlgorithmParameterSpec
{
diff --git a/java/security/spec/DSAParameterSpec.java b/java/security/spec/DSAParameterSpec.java
index 7e263291c..f7f673110 100644
--- a/java/security/spec/DSAParameterSpec.java
+++ b/java/security/spec/DSAParameterSpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -62,19 +62,19 @@ public class DSAParameterSpec implements AlgorithmParameterSpec, DSAParams
* @param q the sub-prime
* @param g the base
*/
- public DSAParameterSpec(BigInteger p, BigInteger q, BigInteger g)
+ public DSAParameterSpec(BigInteger p, BigInteger q, BigInteger g)
{
this.p = p;
this.q = q;
this.g = g;
}
-
+
/**
* Returns p for the DSA algorithm.
*
* @return Returns the requested BigInteger
*/
- public BigInteger getP()
+ public BigInteger getP()
{
return this.p;
}
@@ -84,7 +84,7 @@ public class DSAParameterSpec implements AlgorithmParameterSpec, DSAParams
*
* @return Returns the requested BigInteger
*/
- public BigInteger getQ()
+ public BigInteger getQ()
{
return this.q;
}
@@ -98,4 +98,4 @@ public class DSAParameterSpec implements AlgorithmParameterSpec, DSAParams
{
return this.g;
}
-} \ No newline at end of file
+}
diff --git a/java/security/spec/DSAPrivateKeySpec.java b/java/security/spec/DSAPrivateKeySpec.java
index 7415fa11a..19af107e6 100644
--- a/java/security/spec/DSAPrivateKeySpec.java
+++ b/java/security/spec/DSAPrivateKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,14 +40,14 @@ package java.security.spec;
import java.math.BigInteger;
/**
- DSA Private Key class Specification. Used to maintain the DSA
- Private Keys.
+ DSA Private Key class Specification. Used to maintain the DSA
+ Private Keys.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
-public class DSAPrivateKeySpec implements KeySpec
+public class DSAPrivateKeySpec implements KeySpec
{
private BigInteger x = null;
private BigInteger p = null;
@@ -62,7 +62,7 @@ public class DSAPrivateKeySpec implements KeySpec
@param q the sub-prime
@param g the base
*/
- public DSAPrivateKeySpec(BigInteger x, BigInteger p, BigInteger q, BigInteger g)
+ public DSAPrivateKeySpec(BigInteger x, BigInteger p, BigInteger q, BigInteger g)
{
this.x = x;
this.p = p;
@@ -75,7 +75,7 @@ public class DSAPrivateKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getX()
+ public BigInteger getX()
{
return this.x;
}
@@ -85,7 +85,7 @@ public class DSAPrivateKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getP()
+ public BigInteger getP()
{
return this.p;
}
@@ -95,7 +95,7 @@ public class DSAPrivateKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getQ()
+ public BigInteger getQ()
{
return this.q;
}
@@ -105,7 +105,7 @@ public class DSAPrivateKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getG()
+ public BigInteger getG()
{
return this.g;
}
diff --git a/java/security/spec/DSAPublicKeySpec.java b/java/security/spec/DSAPublicKeySpec.java
index ac1310c1c..751844bcc 100644
--- a/java/security/spec/DSAPublicKeySpec.java
+++ b/java/security/spec/DSAPublicKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,14 +40,14 @@ package java.security.spec;
import java.math.BigInteger;
/**
- DSA Public Key class Specification. Used to maintain the DSA
- Public Keys.
+ DSA Public Key class Specification. Used to maintain the DSA
+ Public Keys.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
-public class DSAPublicKeySpec implements KeySpec
+public class DSAPublicKeySpec implements KeySpec
{
private BigInteger y = null;
private BigInteger p = null;
@@ -62,7 +62,7 @@ public class DSAPublicKeySpec implements KeySpec
@param q the sub-prime
@param g the base
*/
- public DSAPublicKeySpec(BigInteger y, BigInteger p, BigInteger q, BigInteger g)
+ public DSAPublicKeySpec(BigInteger y, BigInteger p, BigInteger q, BigInteger g)
{
this.y = y;
this.p = p;
@@ -75,7 +75,7 @@ public class DSAPublicKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getY()
+ public BigInteger getY()
{
return this.y;
}
@@ -85,7 +85,7 @@ public class DSAPublicKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getP()
+ public BigInteger getP()
{
return this.p;
}
@@ -95,7 +95,7 @@ public class DSAPublicKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getQ()
+ public BigInteger getQ()
{
return this.q;
}
@@ -105,7 +105,7 @@ public class DSAPublicKeySpec implements KeySpec
@return Returns the requested BigInteger
*/
- public BigInteger getG()
+ public BigInteger getG()
{
return this.g;
}
diff --git a/java/security/spec/EncodedKeySpec.java b/java/security/spec/EncodedKeySpec.java
index c5baf55fd..93e158385 100644
--- a/java/security/spec/EncodedKeySpec.java
+++ b/java/security/spec/EncodedKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,12 +39,12 @@ exception statement from your version. */
package java.security.spec;
/**
- Encoded Key Specification class which is used to store
- byte encoded keys.
+ Encoded Key Specification class which is used to store
+ byte encoded keys.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
public abstract class EncodedKeySpec implements KeySpec
{
@@ -56,7 +56,7 @@ public abstract class EncodedKeySpec implements KeySpec
@param encodedKey A key to store
*/
- public EncodedKeySpec(byte[] encodedKey)
+ public EncodedKeySpec(byte[] encodedKey)
{
this.encodedKey = encodedKey;
}
@@ -66,7 +66,7 @@ public abstract class EncodedKeySpec implements KeySpec
@returns the encoded key
*/
- public byte[] getEncoded()
+ public byte[] getEncoded()
{
return this.encodedKey;
}
@@ -75,8 +75,8 @@ public abstract class EncodedKeySpec implements KeySpec
Returns the name of the key format used.
This name is the format such as "PKCS#8" or "X.509" which
- if it matches a Key class name of the same type can be
- transformed using the apporiate KeyFactory.
+ if it matches a Key class name of the same type can be
+ transformed using the apporiate KeyFactory.
@return a string representing the name
*/
diff --git a/java/security/spec/InvalidParameterSpecException.java b/java/security/spec/InvalidParameterSpecException.java
index 481e11e30..ff34565f1 100644
--- a/java/security/spec/InvalidParameterSpecException.java
+++ b/java/security/spec/InvalidParameterSpecException.java
@@ -60,7 +60,7 @@ public class InvalidParameterSpecException extends GeneralSecurityException
/**
* Constructs an InvalidParameterSpecException without a message string.
*/
- public InvalidParameterSpecException()
+ public InvalidParameterSpecException()
{
}
diff --git a/java/security/spec/KeySpec.java b/java/security/spec/KeySpec.java
index 93f1a6db2..13c7dad42 100644
--- a/java/security/spec/KeySpec.java
+++ b/java/security/spec/KeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,14 +39,14 @@ exception statement from your version. */
package java.security.spec;
/**
- A transparent interface for Key Specifications.
- It contains no member functions. It is used to group
- key classes.
+ A transparent interface for Key Specifications.
+ It contains no member functions. It is used to group
+ key classes.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
-public interface KeySpec
+public interface KeySpec
{
}
diff --git a/java/security/spec/PKCS8EncodedKeySpec.java b/java/security/spec/PKCS8EncodedKeySpec.java
index 4a4f1ecce..53b68de47 100644
--- a/java/security/spec/PKCS8EncodedKeySpec.java
+++ b/java/security/spec/PKCS8EncodedKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,12 +39,12 @@ exception statement from your version. */
package java.security.spec;
/**
- PKCS8 Encoded Key Specification class which is used to store
- "PKCS#8" byte encoded keys.
+ PKCS8 Encoded Key Specification class which is used to store
+ "PKCS#8" byte encoded keys.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
public class PKCS8EncodedKeySpec extends EncodedKeySpec
{
@@ -59,9 +59,9 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec
}
/**
- Gets the encoded key in byte format.
+ Gets the encoded key in byte format.
- @returns the encoded key
+ @returns the encoded key
*/
public byte[] getEncoded()
{
@@ -69,9 +69,9 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec
}
/**
- Returns the name of the key format used which is "PKCS#8"
+ Returns the name of the key format used which is "PKCS#8"
- @return a string representing the name
+ @return a string representing the name
*/
public final String getFormat()
{
diff --git a/java/security/spec/PSSParameterSpec.java b/java/security/spec/PSSParameterSpec.java
index f2a83d967..92a6c9edd 100644
--- a/java/security/spec/PSSParameterSpec.java
+++ b/java/security/spec/PSSParameterSpec.java
@@ -40,7 +40,7 @@ package java.security.spec;
/**
* An implementation of {@link AlgorithmParameterSpec} for the RSA PSS encoding
* scheme.
- *
+ *
* @since 1.4
* @see AlgorithmParameterSpec
* @see java.security.Signature
@@ -58,7 +58,7 @@ public class PSSParameterSpec implements AlgorithmParameterSpec
/**
* Construct a new instance of <code>PSSParameterSpec</code> given a salt
* length.
- *
+ *
* @param saltLen
* the length in bits of the salt.
* @throws IllegalArgumentException
diff --git a/java/security/spec/RSAKeyGenParameterSpec.java b/java/security/spec/RSAKeyGenParameterSpec.java
index ad5511177..5a1dafe2a 100644
--- a/java/security/spec/RSAKeyGenParameterSpec.java
+++ b/java/security/spec/RSAKeyGenParameterSpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -63,7 +63,7 @@ public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec
public static final BigInteger F4 = BigInteger.valueOf(65537L);
/**
- Create a new RSAKeyGenParameterSpec to store the RSA key's keysize
+ Create a new RSAKeyGenParameterSpec to store the RSA key's keysize
and public exponent
@param keysize Modulus size of key in bits
@@ -74,7 +74,7 @@ public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec
this.keysize = keysize;
this.publicExponent = publicExponent;
}
-
+
/**
Return the size of the key.
@@ -84,7 +84,7 @@ public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec
{
return keysize;
}
-
+
/**
Return the public exponent.
diff --git a/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java b/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
index 9e8ad0da7..09b8438df 100644
--- a/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
+++ b/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
@@ -72,10 +72,10 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec
/**
* Constructs a new instance of <code>RSAMultiPrimePrivateCrtKeySpec</code>
* given the various PKCS#1 v2.1 parameters.
- *
+ *
* <p>Note that <code>otherPrimeInfo</code> is cloned when constructing this
* object.</p>
- *
+ *
* @param modulus
* the modulus n.
* @param publicExponent
diff --git a/java/security/spec/RSAOtherPrimeInfo.java b/java/security/spec/RSAOtherPrimeInfo.java
index 03cdca227..45dd53fab 100644
--- a/java/security/spec/RSAOtherPrimeInfo.java
+++ b/java/security/spec/RSAOtherPrimeInfo.java
@@ -61,7 +61,7 @@ public class RSAOtherPrimeInfo
/**
* Constructs a new <code>RSAOtherPrimeInfo</code> given the PKCS#1 MPIs.
- *
+ *
* @param prime
* the prime factor of n.
* @param primeExponent
diff --git a/java/security/spec/RSAPrivateCrtKeySpec.java b/java/security/spec/RSAPrivateCrtKeySpec.java
index a904c305d..6d327e62b 100644
--- a/java/security/spec/RSAPrivateCrtKeySpec.java
+++ b/java/security/spec/RSAPrivateCrtKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,13 +40,13 @@ package java.security.spec;
import java.math.BigInteger;
/**
- RSA Private Certificate Key class Specification. Used to
- maintain the RSA Private Certificate Keys with the
- <I>Chinese Remainder Theorem</I>(CRT) as specified by PKCS#1.
+ RSA Private Certificate Key class Specification. Used to
+ maintain the RSA Private Certificate Keys with the
+ <I>Chinese Remainder Theorem</I>(CRT) as specified by PKCS#1.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
public class RSAPrivateCrtKeySpec extends RSAPrivateKeySpec
{
@@ -71,13 +71,13 @@ public class RSAPrivateCrtKeySpec extends RSAPrivateKeySpec
@param crtCoefficient the CRT coefficient
*/
public RSAPrivateCrtKeySpec(BigInteger modulus,
- BigInteger publicExponent,
- BigInteger privateExponent,
- BigInteger primeP,
- BigInteger primeQ,
- BigInteger primeExponentP,
- BigInteger primeExponentQ,
- BigInteger crtCoefficient)
+ BigInteger publicExponent,
+ BigInteger privateExponent,
+ BigInteger primeP,
+ BigInteger primeQ,
+ BigInteger primeExponentP,
+ BigInteger primeExponentQ,
+ BigInteger crtCoefficient)
{
super( modulus, privateExponent);
this.publicExponent = publicExponent;
diff --git a/java/security/spec/RSAPrivateKeySpec.java b/java/security/spec/RSAPrivateKeySpec.java
index d29f261cf..f812766ba 100644
--- a/java/security/spec/RSAPrivateKeySpec.java
+++ b/java/security/spec/RSAPrivateKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,12 +40,12 @@ package java.security.spec;
import java.math.BigInteger;
/**
- RSA Private Key class Specification. Used to maintain the RSA
- Private Keys.
+ RSA Private Key class Specification. Used to maintain the RSA
+ Private Keys.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
public class RSAPrivateKeySpec implements KeySpec
{
diff --git a/java/security/spec/RSAPublicKeySpec.java b/java/security/spec/RSAPublicKeySpec.java
index 21283aa64..acee6bcdf 100644
--- a/java/security/spec/RSAPublicKeySpec.java
+++ b/java/security/spec/RSAPublicKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,12 +40,12 @@ package java.security.spec;
import java.math.BigInteger;
/**
- RSA Public Key class Specification. Used to maintain the RSA
- Public Keys.
+ RSA Public Key class Specification. Used to maintain the RSA
+ Public Keys.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
public class RSAPublicKeySpec implements KeySpec
{
diff --git a/java/security/spec/X509EncodedKeySpec.java b/java/security/spec/X509EncodedKeySpec.java
index de3596029..8b50aaae1 100644
--- a/java/security/spec/X509EncodedKeySpec.java
+++ b/java/security/spec/X509EncodedKeySpec.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,12 +39,12 @@ exception statement from your version. */
package java.security.spec;
/**
- X.509 Encoded Key Specification class which is used to store
- "X.509" byte encoded keys.
+ X.509 Encoded Key Specification class which is used to store
+ "X.509" byte encoded keys.
- @since JDK 1.2
+ @since JDK 1.2
- @author Mark Benvenuto
+ @author Mark Benvenuto
*/
public class X509EncodedKeySpec extends EncodedKeySpec
{
diff --git a/java/sql/Array.java b/java/sql/Array.java
index cdd60a42f..5cea23e8a 100644
--- a/java/sql/Array.java
+++ b/java/sql/Array.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,7 +44,7 @@ import java.util.Map;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface Array
+public interface Array
{
/**
* Returns the name of the SQL type of the elements in this
@@ -57,7 +57,7 @@ public interface Array
/**
* Returns the JDBC type identifier of the elements in this
- * array. This will be one of the values defined in the
+ * array. This will be one of the values defined in the
* <code>Types</code> class.
*
* @return The JDBC type of the elements in this array.
@@ -77,9 +77,9 @@ public interface Array
/**
* Returns the contents of this array. The specified
- * <code>Map</code> will be used to override selected mappings
+ * <code>Map</code> will be used to override selected mappings
* between SQL types and Java classes.
- *
+ *
* @param map A mapping of SQL types to Java classes.
* @return The contents of the array as an array of Java objects.
* @exception SQLException If an error occurs.
@@ -162,7 +162,7 @@ public interface Array
* @see ResultSet
*/
ResultSet getResultSet(long start, int count) throws SQLException;
-
+
/**
* This method returns a portion of the array as a <code>ResultSet</code>.
* The returned portion will start at <code>start</code> into the
@@ -180,7 +180,7 @@ public interface Array
* @return The requested elements of this array as a <code>ResultSet</code>.
* @exception SQLException If an error occurs.
* @see ResultSet
- */
+ */
ResultSet getResultSet(long start, int count, Map<String, Class<?>> map)
throws SQLException;
}
diff --git a/java/sql/BatchUpdateException.java b/java/sql/BatchUpdateException.java
index c2e186548..6b88bbad7 100644
--- a/java/sql/BatchUpdateException.java
+++ b/java/sql/BatchUpdateException.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,12 +39,12 @@ package java.sql;
/**
* This class extends <code>SQLException</code> to count the successful
- * updates in each statement in a batch that was successfully updated prior
+ * updates in each statement in a batch that was successfully updated prior
* to the error.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class BatchUpdateException extends SQLException
+public class BatchUpdateException extends SQLException
{
static final long serialVersionUID = 5977529877145521757L;
@@ -84,7 +84,7 @@ public class BatchUpdateException extends SQLException
int[] updateCounts)
{
super(message, SQLState);
- this.updateCounts = updateCounts;
+ this.updateCounts = updateCounts;
}
/**
@@ -118,7 +118,7 @@ public class BatchUpdateException extends SQLException
/**
* Initializes a new instance of <code>BatchUpdateException</code>
* with no descriptive error message. The SQL state and update count will
- * be initialized to <code>null</code> and the vendor specific error code will
+ * be initialized to <code>null</code> and the vendor specific error code will
* initialized to 0.
*/
public BatchUpdateException()
diff --git a/java/sql/Blob.java b/java/sql/Blob.java
index c662aad5f..00fe49f70 100644
--- a/java/sql/Blob.java
+++ b/java/sql/Blob.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ import java.io.OutputStream;
/**
* This interface specified methods for accessing a SQL BLOB (Binary Large
* OBject) type.
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.2
*/
@@ -51,7 +51,7 @@ public interface Blob
{
/**
* This method returns the number of bytes in this <code>Blob</code>.
- *
+ *
* @return The number of bytes in this <code>Blob</code>.
* @exception SQLException If an error occurs.
*/
@@ -60,7 +60,7 @@ public interface Blob
/**
* This method returns up to the requested bytes of this <code>Blob</code>
* as a <code>byte</code> array.
- *
+ *
* @param start The index into this <code>Blob</code> to start returning
* bytes from.
* @param count The requested number of bytes to return.
@@ -72,7 +72,7 @@ public interface Blob
/**
* This method returns a stream that will read the bytes of this
* <code>Blob</code>.
- *
+ *
* @return A stream that will read the bytes of this <code>Blob</code>.
* @exception SQLException If an error occurs.
*/
@@ -82,7 +82,7 @@ public interface Blob
* This method returns the index into this <code>Blob</code> at which the
* first instance of the specified bytes occur. The searching starts at the
* specified index into this <code>Blob</code>.
- *
+ *
* @param pattern The byte pattern to search for.
* @param start The index into this <code>Blob</code> to start searching for
* the pattern.
@@ -97,7 +97,7 @@ public interface Blob
* first instance of the specified pattern occurs. The searching starts at the
* specified index into this <code>Blob</code>. The bytes in the specified
* <code>Blob</code> are used as the search pattern.
- *
+ *
* @param pattern The <code>Blob</code> containing the byte pattern to
* search for.
* @param start The index into this <code>Blob</code> to start searching for
@@ -111,7 +111,7 @@ public interface Blob
/**
* Writes the specified data into this <code>Blob</code>, starting at the
* specified index.
- *
+ *
* @param start The index at which the writing starts.
* @param bytes The data to write.
* @exception SQLException If an error occurs.
@@ -122,7 +122,7 @@ public interface Blob
/**
* Writes a portion of the specified data into this <code>Blob</code>,
* starting at the specified index.
- *
+ *
* @param startWrite The index into this <code>Blob</code> at which writing
* starts.
* @param bytes The data to write a portion of.
@@ -137,7 +137,7 @@ public interface Blob
/**
* Returns a binary stream that writes into this <code>Blob</code>,
* starting at the specified index.
- *
+ *
* @param start The index at which the writing starts.
* @return A binary stream to write into this <code>Blob</code>.
* @exception SQLException If an error occurs.
@@ -148,7 +148,7 @@ public interface Blob
/**
* Truncates this <code>Blob</code> to be at most the specified number of
* bytes long.
- *
+ *
* @param count The length this <code>Blob</code> is truncated to.
* @exception SQLException If an error occurs.
* @since 1.4
diff --git a/java/sql/CallableStatement.java b/java/sql/CallableStatement.java
index e605b381d..09d58704e 100644
--- a/java/sql/CallableStatement.java
+++ b/java/sql/CallableStatement.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,7 +49,7 @@ import java.util.Map;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface CallableStatement extends PreparedStatement
+public interface CallableStatement extends PreparedStatement
{
/**
* This method registers the specified parameter as an output parameter
@@ -58,7 +58,7 @@ public interface CallableStatement extends PreparedStatement
* @param index The index of the parameter to register as output.
* @param sqlType The SQL type value from <code>Types</code>.
* @exception SQLException If an error occurs.
- */
+ */
void registerOutParameter(int index, int sqlType)
throws SQLException;
@@ -70,7 +70,7 @@ public interface CallableStatement extends PreparedStatement
* @param sqlType The SQL type value from <code>Types</code>.
* @param scale The scale of the value that will be returned.
* @exception SQLException If an error occurs.
- */
+ */
void registerOutParameter(int index, int sqlType, int scale)
throws SQLException;
@@ -271,7 +271,7 @@ public interface CallableStatement extends PreparedStatement
* @return The parameter value as a <code>Blob</code>.
* @exception SQLException If an error occurs.
* @since 1.2
- */
+ */
Blob getBlob(int index) throws SQLException;
/**
@@ -359,7 +359,7 @@ public interface CallableStatement extends PreparedStatement
/**
* This method registers the specified parameter as an output parameter
- * of the specified SQL type. This version of registerOutParameter is used
+ * of the specified SQL type. This version of registerOutParameter is used
* for NUMERIC or DECIMAL types.
*
* @param name The name of the parameter to register as output.
@@ -374,7 +374,7 @@ public interface CallableStatement extends PreparedStatement
/**
* This method registers the specified parameter as an output parameter
- * of the specified SQL type. This version of registerOutParameter is used
+ * of the specified SQL type. This version of registerOutParameter is used
* for user-named or REF types. If the type of the output parameter does
* not have such a type, the typeName argument is ignored.
*
@@ -384,7 +384,7 @@ public interface CallableStatement extends PreparedStatement
* @exception SQLException If an error occurs.
* @since 1.4
*/
- void registerOutParameter(String name, int sqlType, String typeName)
+ void registerOutParameter(String name, int sqlType, String typeName)
throws SQLException;
/**
@@ -401,7 +401,7 @@ public interface CallableStatement extends PreparedStatement
/**
* This method sets the value of the specified parameter to the specified
* <code>java.net.URL</code>
- *
+ *
* @param name The name of the parameter to set.
* @param value The value the parameter.
* @since 1.4
@@ -413,7 +413,7 @@ public interface CallableStatement extends PreparedStatement
* for the specified type.
*
* @param name The name of the parameter to set.
- * @param sqlType The SQL type identifier of the parameter from
+ * @param sqlType The SQL type identifier of the parameter from
* <code>Types</code>
* @exception SQLException If an error occurs.
* @since 1.4
@@ -597,7 +597,7 @@ public interface CallableStatement extends PreparedStatement
*
* @param name The name of the parameter value to set.
* @param value The value of the parameter.
- * @param sqlType The SQL type to use for the parameter, from
+ * @param sqlType The SQL type to use for the parameter, from
* <code>Types</code>
* @param scale The scale of the value, for numeric values only.
* @exception SQLException If an error occurs.
@@ -613,7 +613,7 @@ public interface CallableStatement extends PreparedStatement
*
* @param name The name of the parameter value to set.
* @param value The value of the parameter.
- * @param sqlType The SQL type to use for the parameter, from
+ * @param sqlType The SQL type to use for the parameter, from
* <code>Types</code>
* @exception SQLException If an error occurs.
* @see Types
diff --git a/java/sql/Clob.java b/java/sql/Clob.java
index 53bf6393c..483276e69 100644
--- a/java/sql/Clob.java
+++ b/java/sql/Clob.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,14 +46,14 @@ import java.io.Writer;
/**
* This interface contains methods for accessing a SQL CLOB (Character Large
* OBject) type.
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public interface Clob
{
/**
* This method returns the number of characters in this <code>Clob</code>.
- *
+ *
* @return The number of characters in this <code>Clob</code>.
* @exception SQLException If an error occurs.
* @since 1.2
@@ -63,7 +63,7 @@ public interface Clob
/**
* This method returns the specified portion of this <code>Clob</code> as a
* <code>String</code>.
- *
+ *
* @param start The index into this <code>Clob</code> (index values
* start at 1) to start returning characters from.
* @param count The requested number of characters to return.
@@ -76,7 +76,7 @@ public interface Clob
/**
* This method returns a character stream that reads the contents of this
* <code>Clob</code>.
- *
+ *
* @return A character stream to read this <code>Clob</code>'s contents.
* @exception SQLException If an error occurs.
* @since 1.2
@@ -86,7 +86,7 @@ public interface Clob
/**
* This method returns a byte stream that reads the contents of this
* <code>Clob</code> as a series of ASCII bytes.
- *
+ *
* @return A stream to read this <code>Clob</code>'s contents.
* @exception SQLException If an error occurs.
* @since 1.2
@@ -97,7 +97,7 @@ public interface Clob
* This method returns the index into this <code>Clob</code> of the first
* occurrence of the specified character pattern (supplied by the caller as a
* <code>String</code>). The search begins at the specified index.
- *
+ *
* @param pattern The character pattern to search for, passed as a
* <code>String</code>.
* @param start The index into this <code>Clob</code> to start searching
@@ -113,7 +113,7 @@ public interface Clob
* This method returns the index into this <code>Clob</code> of the first
* occurrence of the specified character pattern (supplied by the caller as a
* <code>Clob</code>). The search begins at the specified index.
- *
+ *
* @param pattern The character pattern to search for, passed as a
* <code>Clob</code>.
* @param start The index into this <code>Clob</code> to start searching
@@ -128,7 +128,7 @@ public interface Clob
/**
* Writes the specified string into this <code>Clob</code>, starting at the
* specified index.
- *
+ *
* @param start The index at which the writing starts.
* @param value The string to write.
* @return The number of characters written.
@@ -140,7 +140,7 @@ public interface Clob
/**
* Writes the specified portion of a string into this <code>Clob</code>,
* starting at the specified index.
- *
+ *
* @param startWrite The index at which the writing starts.
* @param value The string to write a portion of.
* @param startRead The offset into the string where the portion to copy
@@ -156,7 +156,7 @@ public interface Clob
/**
* Returns an ASCII text stream that writes into this <code>Clob</code>,
* starting at the specified index.
- *
+ *
* @param start The index at which the writing starts.
* @return An ASCII text stream to write into this <code>Clob</code>.
* @exception SQLException If an error occurs.
@@ -167,7 +167,7 @@ public interface Clob
/**
* Returns a character stream that writes into this <code>Clob</code>,
* starting at the specified index.
- *
+ *
* @param start The index at which the writing starts.
* @return A character stream to write into this <code>Clob</code>.
* @exception SQLException If an error occurs.
@@ -178,7 +178,7 @@ public interface Clob
/**
* Truncates this <code>Clob</code> to be at most the specified number of
* characters long.
- *
+ *
* @param count The length this <code>Clob</code> is truncated to.
* @exception SQLException If an error occurs.
* @since 1.4
diff --git a/java/sql/Connection.java b/java/sql/Connection.java
index 8dc7544c7..f37527625 100644
--- a/java/sql/Connection.java
+++ b/java/sql/Connection.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ import java.util.Map;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface Connection
+public interface Connection
{
/**
* This transaction isolation level indicates that transactions are not
@@ -90,7 +90,7 @@ public interface Connection
* This method creates a new SQL statement. The default result set type
* and concurrency will be used.
*
- * @return A new <code>Statement</code> object.
+ * @return A new <code>Statement</code> object.
* @exception SQLException If an error occurs.
* @see Statement
*/
@@ -101,7 +101,7 @@ public interface Connection
* SQL string. This method is designed for use with parameterized
* statements. The default result set type and concurrency will be used.
*
- * @param sql The SQL statement to use in creating this
+ * @param sql The SQL statement to use in creating this
* <code>PreparedStatement</code>.
* @return A new <code>PreparedStatement</code>.
* @exception SQLException If an error occurs.
@@ -110,12 +110,12 @@ public interface Connection
PreparedStatement prepareStatement(String sql) throws SQLException;
/**
- * This method creates a new <code>CallableStatement</code> for the
+ * This method creates a new <code>CallableStatement</code> for the
* specified SQL string. Thie method is designed to be used with
* stored procedures. The default result set type and concurrency
* will be used.
*
- * @param sql The SQL statement to use in creating this
+ * @param sql The SQL statement to use in creating this
* <code>CallableStatement</code>.
* @return A new <code>CallableStatement</code>.
* @exception SQLException If an error occurs.
@@ -151,7 +151,7 @@ public interface Connection
* In auto commit mode, every SQL statement is committed its own transaction.
* Otherwise a transaction must be explicitly committed or rolled back.
*
- * @return <code>true</code> if auto commit mode is enabled,
+ * @return <code>true</code> if auto commit mode is enabled,
* <code>false</code> otherwise.
* @exception SQLException If an error occurs.
* @see #commit()
@@ -160,7 +160,7 @@ public interface Connection
boolean getAutoCommit() throws SQLException;
/**
- * This method commits any SQL statements executed on this connection since
+ * This method commits any SQL statements executed on this connection since
* the last commit or rollback.
*
* @exception SQLException If an error occurs.
@@ -183,7 +183,7 @@ public interface Connection
void close() throws SQLException;
/**
- * This method tests whether or not this connection has been closed.
+ * This method tests whether or not this connection has been closed.
*
* @return <code>true</code> if the connection is closed, <code>false</code>
* otherwise.
@@ -233,7 +233,7 @@ public interface Connection
* This method returns the name of the catalog in use by this connection,
* if any.
*
- * @return The name of the catalog, or <code>null</code> if none
+ * @return The name of the catalog, or <code>null</code> if none
* exists or catalogs are not supported by this database.
* @exception SQLException If an error occurs.
*/
@@ -262,7 +262,7 @@ public interface Connection
* if any. If there were any subsequence warnings, they will be chained
* to the first one.
*
- * @return The first <code>SQLWarning</code> that occurred, or
+ * @return The first <code>SQLWarning</code> that occurred, or
* <code>null</code> if there have been no warnings.
* @exception SQLException If an error occurs.
*/
@@ -298,7 +298,7 @@ public interface Connection
* Valid values for these parameters are specified in the
* <code>ResultSet</code> class.
*
- * @param sql The SQL statement to use in creating this
+ * @param sql The SQL statement to use in creating this
* <code>PreparedStatement</code>.
* @param resultSetType The type of result set to use for this statement.
* @param resultSetConcurrency The type of concurrency to be used in
@@ -308,17 +308,17 @@ public interface Connection
* @see PreparedStatement
* @see ResultSet
*/
- PreparedStatement prepareStatement(String sql, int resultSetType,
+ PreparedStatement prepareStatement(String sql, int resultSetType,
int resultSetConcurrency) throws SQLException;
/**
- * This method creates a new <code>CallableStatement</code> for the
+ * This method creates a new <code>CallableStatement</code> for the
* specified SQL string. Thie method is designed to be used with
* stored procedures. The specified result set type and concurrency
* will be used. Valid values for these parameters are specified in the
* <code>ResultSet</code> class.
*
- * @param sql The SQL statement to use in creating this
+ * @param sql The SQL statement to use in creating this
* <code>PreparedStatement</code>.
* @param resultSetType The type of result set to use for this statement.
* @param resultSetConcurrency The type of concurrency to be used in
@@ -353,7 +353,7 @@ public interface Connection
/**
* Sets the default holdability of <code>ResultSet</code>S that are created
* from <code>Statement</code>S using this <code>Connection</code>.
- *
+ *
* @param holdability The default holdability value to set, this must be one
* of <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
* <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>.
@@ -366,7 +366,7 @@ public interface Connection
/**
* Gets the default holdability of <code>ResultSet</code>S that are created
* from <code>Statement</code>S using this <code>Connection</code>.
- *
+ *
* @return The current default holdability value, this must be one of
* <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
* <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>.
@@ -378,7 +378,7 @@ public interface Connection
/**
* Creates a new unnamed savepoint for this <code>Connection</code>
- *
+ *
* @return The <code>Savepoint</code> object representing the savepoint.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -388,7 +388,7 @@ public interface Connection
/**
* Creates a new savepoint with the specifiend name for this
* <code>Connection</code>.
- *
+ *
* @param name The name of the savepoint.
* @return The <code>Savepoint</code> object representing the savepoint.
* @exception SQLException If an error occurs.
@@ -398,7 +398,7 @@ public interface Connection
/**
* Undoes all changes made after the specified savepoint was set.
- *
+ *
* @param savepoint The safepoint to roll back to.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -409,7 +409,7 @@ public interface Connection
* Removes the specified savepoint from this <code>Connection</code>.
* Refering to a savepoint after it was removed is an error and will throw an
* SQLException.
- *
+ *
* @param savepoint The savepoint to release.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -420,7 +420,7 @@ public interface Connection
* This method creates a new SQL statement with the specified type,
* concurrency and holdability, instead of using the defaults. Valid values
* for these parameters are specified in the <code>ResultSet</code> class.
- *
+ *
* @param resultSetType The type of result set to use for this statement.
* @param resultSetConcurrency The type of concurrency to be used in
* the result set for this statement.
@@ -441,7 +441,7 @@ public interface Connection
* will be used. Valid values for these parameters are specified in the
* <code>ResultSet</code> class.
*
- * @param sql The SQL statement to use in creating this
+ * @param sql The SQL statement to use in creating this
* <code>PreparedStatement</code>.
* @param resultSetType The type of result set to use for this statement.
* @param resultSetConcurrency The type of concurrency to be used in
@@ -458,13 +458,13 @@ public interface Connection
resultSetConcurrency, int resultSetHoldability) throws SQLException;
/**
- * This method creates a new <code>CallableStatement</code> for the
+ * This method creates a new <code>CallableStatement</code> for the
* specified SQL string. Thie method is designed to be used with
* stored procedures. The specified result set type, concurrency and
* holdability will be used. Valid values for these parameters are specified
* in the <code>ResultSet</code> class.
*
- * @param sql The SQL statement to use in creating this
+ * @param sql The SQL statement to use in creating this
* <code>PreparedStatement</code>.
* @param resultSetType The type of result set to use for this statement.
* @param resultSetConcurrency The type of concurrency to be used in
diff --git a/java/sql/DataTruncation.java b/java/sql/DataTruncation.java
index ec522c025..efa4487b3 100644
--- a/java/sql/DataTruncation.java
+++ b/java/sql/DataTruncation.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -38,12 +38,12 @@ exception statement from your version. */
package java.sql;
/**
- * This exception is thrown when a piece of data is unexpectedly
+ * This exception is thrown when a piece of data is unexpectedly
* truncated in JDBC.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class DataTruncation extends SQLWarning
+public class DataTruncation extends SQLWarning
{
static final long serialVersionUID = 6464298989504059473L;
@@ -74,7 +74,7 @@ public class DataTruncation extends SQLWarning
/**
* This method initializes a new instance of <code>DataTruncation</code>
- * with the specified values. The descriptive error message for this
+ * with the specified values. The descriptive error message for this
* exception will be "Data truncation", the SQL state will be "01004"
* and the vendor specific error code will be set to 0.
*
diff --git a/java/sql/DatabaseMetaData.java b/java/sql/DatabaseMetaData.java
index 48c2d9afc..3ffd5b0df 100644
--- a/java/sql/DatabaseMetaData.java
+++ b/java/sql/DatabaseMetaData.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -37,7 +37,7 @@ exception statement from your version. */
package java.sql;
-public interface DatabaseMetaData
+public interface DatabaseMetaData
{
/**
* It is unknown whether or not the procedure returns a result.
@@ -409,7 +409,7 @@ public interface DatabaseMetaData
* This method tests whether or not the database uses local files to
* store tables.
*
- * @return <code>true</code> if the database uses local files,
+ * @return <code>true</code> if the database uses local files,
* <code>false</code> otherwise.
*
* @exception SQLException If an error occurs.
@@ -459,7 +459,7 @@ public interface DatabaseMetaData
boolean storesLowerCaseIdentifiers() throws SQLException;
/**
- * This method tests whether or not the database stores mixed case
+ * This method tests whether or not the database stores mixed case
* identifers even if it treats them as case insensitive.
*
* @return <code>true</code> if the database stores mixed case identifiers,
@@ -482,7 +482,7 @@ public interface DatabaseMetaData
* This method tests whether or not the database treats mixed case
* quoted identifiers as all upper case.
*
- * @return <code>true</code> if the database treats all quoted identifiers
+ * @return <code>true</code> if the database treats all quoted identifiers
* as upper case, <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -492,17 +492,17 @@ public interface DatabaseMetaData
* This method tests whether or not the database treats mixed case
* quoted identifiers as all lower case.
*
- * @return <code>true</code> if the database treats all quoted identifiers
+ * @return <code>true</code> if the database treats all quoted identifiers
* as lower case, <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
boolean storesLowerCaseQuotedIdentifiers() throws SQLException;
/**
- * This method tests whether or not the database stores mixed case
+ * This method tests whether or not the database stores mixed case
* quoted identifers even if it treats them as case insensitive.
*
- * @return <code>true</code> if the database stores mixed case quoted
+ * @return <code>true</code> if the database stores mixed case quoted
* identifiers, <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -552,7 +552,7 @@ public interface DatabaseMetaData
/**
* This method returns comma separated list of time/date functions.
- *
+ *
* @return The list of time/date functions.
* @exception SQLException If an error occurs.
*/
@@ -567,7 +567,7 @@ public interface DatabaseMetaData
String getSearchStringEscape() throws SQLException;
/**
- * This methods returns non-standard characters that can appear in
+ * This methods returns non-standard characters that can appear in
* unquoted identifiers.
*
* @return Non-standard characters that can appear in unquoted identifiers.
@@ -638,7 +638,7 @@ public interface DatabaseMetaData
SQLException;
/**
- * This method tests whether or not table correlation names are
+ * This method tests whether or not table correlation names are
* supported. This will be always be <code>true</code> in a fully JDBC
* compliant driver.
*
@@ -722,7 +722,7 @@ public interface DatabaseMetaData
* This method tests whether multiple result sets for a single statement are
* supported.
*
- * @return <code>true</code> if multiple result sets are supported for a
+ * @return <code>true</code> if multiple result sets are supported for a
* single statement, <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -789,7 +789,7 @@ public interface DatabaseMetaData
/**
* This method tests whether or not the ANSI92 intermediate SQL
- * grammar is supported.
+ * grammar is supported.
*
* @return <code>true</code> if the ANSI92 intermediate SQL grammar is
* supported, <code>false</code> otherwise.
@@ -799,7 +799,7 @@ public interface DatabaseMetaData
/**
* This method tests whether or not the ANSI92 full SQL
- * grammar is supported.
+ * grammar is supported.
*
* @return <code>true</code> if the ANSI92 full SQL grammar is
* supported, <code>false</code> otherwise.
@@ -829,7 +829,7 @@ public interface DatabaseMetaData
/**
* This method tests whether or not the database supports full outer joins.
*
- * @return <code>true</code> if full outer joins are supported,
+ * @return <code>true</code> if full outer joins are supported,
* <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -838,7 +838,7 @@ public interface DatabaseMetaData
/**
* This method tests whether or not the database supports limited outer joins.
*
- * @return <code>true</code> if limited outer joins are supported,
+ * @return <code>true</code> if limited outer joins are supported,
* <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -1005,7 +1005,7 @@ public interface DatabaseMetaData
* This method tests whether or not SELECT FOR UPDATE is supported by the
* database.
*
- * @return <code>true</code> if SELECT FOR UPDATE is supported
+ * @return <code>true</code> if SELECT FOR UPDATE is supported
* <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -1036,7 +1036,7 @@ public interface DatabaseMetaData
* expressions. A fully JDBC compliant driver will always return
* <code>true</code>.
*
- * @return <code>true</code> if subqueries are allowed in exists
+ * @return <code>true</code> if subqueries are allowed in exists
* expressions, <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -1057,7 +1057,7 @@ public interface DatabaseMetaData
* expressions. A fully JDBC compliant driver will always return
* <code>true</code>.
*
- * @return <code>true</code> if subqueries are allowed in quantified
+ * @return <code>true</code> if subqueries are allowed in quantified
* expressions, <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -1143,7 +1143,7 @@ public interface DatabaseMetaData
/**
* This method returns the maximum length of a character literal.
- *
+ *
* @return The maximum length of a character literal.
* @exception SQLException If an error occurs.
*/
@@ -1338,7 +1338,7 @@ public interface DatabaseMetaData
SQLException;
/**
- * This method tests whether or not DDL and DML statements allowed within
+ * This method tests whether or not DDL and DML statements allowed within
* the same transaction.
*
* @return <code>true</code> if DDL and DML statements are allowed in the
@@ -1385,7 +1385,7 @@ public interface DatabaseMetaData
* a <code>ResultSet</code> with the following columns:
* <p>
* <ol>
- * <li>PROCEDURE_CAT - The catalog the procedure is in, which may be
+ * <li>PROCEDURE_CAT - The catalog the procedure is in, which may be
* <code>null</code>.</li>
* <li>PROCEDURE_SCHEM - The schema the procedures is in, which may be
* <code>null</code>.</li>
@@ -1394,8 +1394,8 @@ public interface DatabaseMetaData
* <li>Unused</li>
* <li>Unused</li>
* <li>REMARKS - A description of the procedure</li>
- * <li>PROCEDURE_TYPE - Indicates the return type of the procedure, which
- * is one of the contstants defined in this class
+ * <li>PROCEDURE_TYPE - Indicates the return type of the procedure, which
+ * is one of the contstants defined in this class
* (<code>procedureResultUnknown</code>, <code>procedureNoResult</code>, or
* <code>procedureReturnsResult</code>).</li>
* </ol>
@@ -1417,7 +1417,7 @@ public interface DatabaseMetaData
* <code>ResultSet</code> with the following columns:
* <p>
* <ol>
- * <li>PROCEDURE_CAT - The catalog the procedure is in, which may be
+ * <li>PROCEDURE_CAT - The catalog the procedure is in, which may be
* <code>null</code>.</li>
* <li>PROCEDURE_SCHEM - The schema the procedures is in, which may be
* <code>null</code>.</li>
@@ -1455,7 +1455,7 @@ public interface DatabaseMetaData
SQLException;
/**
- * This method returns a list of the requested table as a
+ * This method returns a list of the requested table as a
* <code>ResultSet</code> with the following columns:
*
* <ol>
@@ -1466,7 +1466,7 @@ public interface DatabaseMetaData
* of the values returned by the <code>getTableTypes()</code> method.</li>
* <li>REMARKS - Comments about the table.</li>
* </ol>
- *
+ *
* @param catalog The name of the catalog to return tables from,
* or "" to return tables from all catalogs.
* @param schemaPattern A schema pattern for the schemas to return tables
@@ -1480,7 +1480,7 @@ public interface DatabaseMetaData
tablePattern, String[] types) throws SQLException;
/**
- * This method returns the list of database schemas as a
+ * This method returns the list of database schemas as a
* <code>ResultSet</code>, with one column - TABLE_SCHEM - that is the
* name of the schema.
*
@@ -1515,7 +1515,7 @@ public interface DatabaseMetaData
* <code>ResultSet</code> with the following columns:
* <p>
* <ol>
- * <li>TABLE_CAT - The catalog the table is in, which may be
+ * <li>TABLE_CAT - The catalog the table is in, which may be
* <code>null</code>.</li>
* <li>TABLE_SCHEM - The schema the tables is in, which may be
* <code>null</code>.</li>
@@ -1543,7 +1543,7 @@ public interface DatabaseMetaData
*
* @param catalog The name of the catalog to return table from,
* or "" to return tables from all catalogs.
- * @param schemaPattern A schema pattern for the schemas to return
+ * @param schemaPattern A schema pattern for the schemas to return
* tables from, or "" to return tables from all schemas.
* @param tablePattern The pattern of table names to return.
* @param columnPattern The pattern of column names to return.
@@ -1559,7 +1559,7 @@ public interface DatabaseMetaData
* with the following columns:
*
* <ol>
- * <li>TABLE_CAT - The catalog the table is in, which may be
+ * <li>TABLE_CAT - The catalog the table is in, which may be
* <code>null</code>.</li>
* <li>TABLE_SCHEM - The schema the tables is in, which may be
* <code>null</code>.</li>
@@ -1591,7 +1591,7 @@ public interface DatabaseMetaData
* with the following columns:
*
* <ol>
- * <li>TABLE_CAT - The catalog the table is in, which may be
+ * <li>TABLE_CAT - The catalog the table is in, which may be
* <code>null</code>.</li>
* <li>TABLE_SCHEM - The schema the tables is in, which may be
* <code>null</code>.</li>
@@ -1608,7 +1608,7 @@ public interface DatabaseMetaData
* to return information from all catalogs.
* @param schemaPattern The schema to retrieve information from, or the empty string
* to return entities not associated with a schema.
- * @param tablePattern The table name pattern of tables to return
+ * @param tablePattern The table name pattern of tables to return
* information for.
* @return A <code>ResultSet</code> with all the requested privileges.
* @exception SQLException If an error occurs.
@@ -1622,7 +1622,7 @@ public interface DatabaseMetaData
* the following columns:
*
* <ol>
- * <li>SCOPE - The scope of the results returned. This is one of the
+ * <li>SCOPE - The scope of the results returned. This is one of the
* constants defined in this class (<code>bestRowTemporary</code>,
* <code>bestRowTransaction</code>, or <code>bestRowSession</code>).</li>
* <li>COLUMN_NAME - The name of the column.</li>
@@ -1633,7 +1633,7 @@ public interface DatabaseMetaData
* <li>BUFFER_LENGTH - Unused</li>
* <li>DECIMAL_DIGITS - The scale of the column.</li>
* <li>PSEUDO_COLUMN - Whether or not the best row identifier is a
- * pseudo_column. This is one of the constants defined in this class
+ * pseudo_column. This is one of the constants defined in this class
* (<code>bestRowUnknown</code>, <code>bestRowNotPseudo</code>, or
* <code>bestRowPseudo</code>).</li>
* </ol>
@@ -1655,7 +1655,7 @@ public interface DatabaseMetaData
/**
* This method returns the set of columns that are automatically updated
- * when the row is update. It returns this information as a
+ * when the row is update. It returns this information as a
* <code>ResultSet</code> with the following columns:
*
* <ol>
@@ -1668,7 +1668,7 @@ public interface DatabaseMetaData
* <li>BUFFER_LENGTH - Unused</li>
* <li>DECIMAL_DIGITS - The scale of the column.</li>
* <li>PSEUDO_COLUMN - Whether or not the best row identifier is a
- * pseudo_column. This is one of the constants defined in this class
+ * pseudo_column. This is one of the constants defined in this class
* (<code>versionRowUnknown</code>, <code>versionRowNotPseudo</code>, or
* <code>versionRowPseudo</code>).</li>
* </ol>
@@ -1725,12 +1725,12 @@ public interface DatabaseMetaData
* <li>FKCOLUMN_NAME - The foreign key column name.</li>
* <li>KEY_SEQ - The sequence number of the column within the foreign key.</li>
* <li>UPDATE_RULE - How the foreign key behaves when the primary key is
- * updated. This is one of the constants defined in this class
+ * updated. This is one of the constants defined in this class
* (<code>importedNoAction</code>, <code>importedKeyCascade</code>,
* <code>importedKeySetNull</code>, <code>importedKeySetDefault</code>, or
* <code>importedKeyRestrict</code>).</li>
* <li>DELETE_RULE - How the foreign key behaves when the primary key is
- * deleted. This is one of the constants defined in this class
+ * deleted. This is one of the constants defined in this class
* (<code>importedNoAction</code>, <code>importedKeyCascade</code>,
* <code>importedKeySetNull</code>, or <code>importedKeySetDefault</code>)</li>
* <li>FK_NAME - The name of the foreign key.</li>
@@ -1769,12 +1769,12 @@ public interface DatabaseMetaData
* <li>FKCOLUMN_NAME - The foreign key column name.</li>
* <li>KEY_SEQ - The sequence number of the column within the foreign key.</li>
* <li>UPDATE_RULE - How the foreign key behaves when the primary key is
- * updated. This is one of the constants defined in this class
+ * updated. This is one of the constants defined in this class
* (<code>importedNoAction</code>, <code>importedKeyCascade</code>,
* <code>importedKeySetNull</code>, <code>importedKeySetDefault</code>, or
* <code>importedKeyRestrict</code>).</li>
* <li>DELETE_RULE - How the foreign key behaves when the primary key is
- * deleted. This is one of the constants defined in this class
+ * deleted. This is one of the constants defined in this class
* (<code>importedNoAction</code>, <code>importedKeyCascade</code>,
* <code>importedKeySetNull</code>, or <code>importedKeySetDefault</code>)</li>
* <li>FK_NAME - The name of the foreign key.</li>
@@ -1813,12 +1813,12 @@ public interface DatabaseMetaData
* <li>FKCOLUMN_NAME - The foreign key column name.</li>
* <li>KEY_SEQ - The sequence number of the column within the foreign key.</li>
* <li>UPDATE_RULE - How the foreign key behaves when the primary key is
- * updated. This is one of the constants defined in this class
+ * updated. This is one of the constants defined in this class
* (<code>importedNoAction</code>, <code>importedKeyCascade</code>,
* <code>importedKeySetNull</code>, <code>importedKeySetDefault</code>, or
* <code>importedKeyRestrict</code>).</li>
* <li>DELETE_RULE - How the foreign key behaves when the primary key is
- * deleted. This is one of the constants defined in this class
+ * deleted. This is one of the constants defined in this class
* (<code>importedNoAction</code>, <code>importedKeyCascade</code>,
* <code>importedKeySetNull</code>, or <code>importedKeySetDefault</code>)</li>
* <li>FK_NAME - The name of the foreign key.</li>
@@ -1871,7 +1871,7 @@ public interface DatabaseMetaData
* <li>CREATE_PARAMS - The parameters used to create the type, which may be
* <code>null</code>.</li>
* <li>NULLABLE - Whether or not this type supports NULL values. This will
- * be one of the constants defined in this interface
+ * be one of the constants defined in this interface
* (<code>typeNoNulls</code>, <code>typeNullable</code>, or
* <code>typeNullableUnknown</code>).</li>
* <li>CASE_SENSITIVE - Whether or not the value is case sensitive.</li>
@@ -1889,7 +1889,7 @@ public interface DatabaseMetaData
* <li>SQL_DATETIME_SUB - Unused.</li>
* <li>NUM_PREC_RADIX - The radix of this data type.</li>
* </ol>
- *
+ *
* @return A <code>ResultSet</code> with the list of available data types.
* @exception SQLException If an error occurs.
*/
@@ -1925,12 +1925,12 @@ public interface DatabaseMetaData
* </ol>
*
* @param catalog The catalog to retrieve information from, or the empty string
- * to return entities not associated with a catalog, or
+ * to return entities not associated with a catalog, or
* <code>null</code> to return information from all catalogs.
* @param schema The schema to retrieve information from, or the empty string
* to return entities not associated with a schema.
* @param tableName The table name to return information for.
- * @param unique <code>true</code> to return only unique indexes,
+ * @param unique <code>true</code> to return only unique indexes,
* <code>false</code> otherwise.
* @param approximate <code>true</code> if data values can be approximations,
* <code>false</code> otherwise.
@@ -2012,7 +2012,7 @@ public interface DatabaseMetaData
boolean ownInsertsAreVisible(int type) throws SQLException;
/**
- * This method tests whether or not the specified result set type sees
+ * This method tests whether or not the specified result set type sees
* updates committed by others.
*
* @param type The desired result type, which is one of the constants
@@ -2025,7 +2025,7 @@ public interface DatabaseMetaData
boolean othersUpdatesAreVisible(int type) throws SQLException;
/**
- * This method tests whether or not the specified result set type sees
+ * This method tests whether or not the specified result set type sees
* deletes committed by others.
*
* @param type The desired result type, which is one of the constants
@@ -2038,7 +2038,7 @@ public interface DatabaseMetaData
boolean othersDeletesAreVisible(int type) throws SQLException;
/**
- * This method tests whether or not the specified result set type sees
+ * This method tests whether or not the specified result set type sees
* inserts committed by others.
*
* @param type The desired result type, which is one of the constants
@@ -2075,7 +2075,7 @@ public interface DatabaseMetaData
* @see ResultSet
*/
boolean deletesAreDetected(int type) throws SQLException;
-
+
/**
* This method tests whether or not the specified result set type can detect
* a visible insert by calling the <code>rowUpdated</code> method.
@@ -2138,7 +2138,7 @@ public interface DatabaseMetaData
/**
* This method tests whether the databse supports savepoints.
- *
+ *
* @return <code>true</code> if the database supports savepoints,
* <code>false</code> if it does not.
* @exception SQLException If an error occurs.
@@ -2149,7 +2149,7 @@ public interface DatabaseMetaData
/**
* This method tests whether the database supports named parameters.
- *
+ *
* @return <code>true</code> if the database supports named parameters,
* <code>false</code> if it does not.
* @exception SQLException If an error occurs.
@@ -2160,7 +2160,7 @@ public interface DatabaseMetaData
/**
* This method tests whether the database supports returning multiple
* <code>ResultSet</code>S from a <code>CallableStatement</code> at once.
- *
+ *
* @return <code>true</code> if the database supports returnig multiple
* results at once, <code>false</code> if it does not.
* @exception SQLException If an error occurs.
@@ -2195,7 +2195,7 @@ public interface DatabaseMetaData
* This method tests if the database supports the specified holdability type.
* Valid values for this parameter are specified in the
* <code>ResultSet</code> class.
- *
+ *
* @param holdability The holdability type to test.
* @return <code>true</code> if the database supports the holdability type,
* <code>false</code> if it does not.
@@ -2210,7 +2210,7 @@ public interface DatabaseMetaData
* This method returns the default holdability type of <code>ResultSet</code>S
* retrieved from this database. The possible values are specified in the
* <code>ResultSet</code> class.
- *
+ *
* @return The default holdability type.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -2219,7 +2219,7 @@ public interface DatabaseMetaData
/**
* This method returns the major version number of the database.
- *
+ *
* @return The major version number of the database.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -2228,7 +2228,7 @@ public interface DatabaseMetaData
/**
* This method returns the minor version number of the database.
- *
+ *
* @return The minor version number of the database.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -2237,7 +2237,7 @@ public interface DatabaseMetaData
/**
* This method returns the major version number of the JDBC driver.
- *
+ *
* @return The major version number of the JDBC driver.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -2246,7 +2246,7 @@ public interface DatabaseMetaData
/**
* This method returns the minor version number of the JDBC driver.
- *
+ *
* @return The minor version number of the database.
* @exception SQLException If an error occurs.
* @since 1.4
diff --git a/java/sql/Date.java b/java/sql/Date.java
index f4c330709..f5eea1a2d 100644
--- a/java/sql/Date.java
+++ b/java/sql/Date.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,7 +46,7 @@ import java.text.SimpleDateFormat;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class Date extends java.util.Date
+public class Date extends java.util.Date
{
static final long serialVersionUID = 1511598038487230103L;
@@ -67,12 +67,12 @@ public class Date extends java.util.Date
*/
public Date(int year, int month, int day)
{
- super(year, month, day);
+ super(year, month, day);
}
/**
* This method initializes a new instance of this class with the
- * specified time value representing the number of milliseconds since
+ * specified time value representing the number of milliseconds since
* Jan 1, 1970 at 12:00 midnight GMT.
*
* @param date The time value to intialize this date to.
@@ -157,18 +157,18 @@ public class Date extends java.util.Date
*/
public static Date valueOf (String str)
{
- try
+ try
{
- java.util.Date d = (java.util.Date) sdf.parseObject(str);
+ java.util.Date d = (java.util.Date) sdf.parseObject(str);
- if (d == null)
- throw new IllegalArgumentException(str);
- else
- return new Date(d.getTime());
+ if (d == null)
+ throw new IllegalArgumentException(str);
+ else
+ return new Date(d.getTime());
}
catch (ParseException e)
{
- throw new IllegalArgumentException(str);
+ throw new IllegalArgumentException(str);
}
}
diff --git a/java/sql/Driver.java b/java/sql/Driver.java
index 277dd1713..d7b2e8a17 100644
--- a/java/sql/Driver.java
+++ b/java/sql/Driver.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,17 +43,17 @@ import java.util.Properties;
* This interface specifies a mechanism for accessing a JDBC database
* driver. When the class implementing this method is loaded, it should
* register an instance of itself with the <code>DriverManager</code> in
- * a static initializer.
+ * a static initializer.
* <p>
* Because the <code>DriverManager</code> might attempt to use several
- * drivers to find one that can connect to the requested database,
+ * drivers to find one that can connect to the requested database,
* this driver should not cause large numbers of classes and code to
* be loaded. If another driver is the one that ends up performing the
* request, any loading done by this driver would be wasted.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface Driver
+public interface Driver
{
/**
* This method connects to the specified database using the connection
@@ -61,7 +61,7 @@ public interface Driver
* URL, it should return <code>null</code> instead of throwing an
* exception since the <code>DriverManager</code> will probe a driver
* in this manner.
- *
+ *
* @param url The URL string for this connection.
* @param properties The list of database connection properties.
* @return A <code>Connection</code> object for the newly established
@@ -72,12 +72,12 @@ public interface Driver
/**
* This method tests whether or not the driver believes it can connect to
- * the specified database. The driver should only test whether it
- * understands and accepts the URL. It should not necessarily attempt to
+ * the specified database. The driver should only test whether it
+ * understands and accepts the URL. It should not necessarily attempt to
* probe the database for a connection.
*
* @param url The database URL string.
- * @return <code>true</code> if the drivers can connect to the database,
+ * @return <code>true</code> if the drivers can connect to the database,
* <code>false</code> otherwise.
* @exception SQLException If an error occurs.
*/
@@ -101,7 +101,7 @@ public interface Driver
* This method returns the major version number of the driver.
*
* @return The major version number of the driver.
- */
+ */
int getMajorVersion();
/**
diff --git a/java/sql/DriverManager.java b/java/sql/DriverManager.java
index 7d1ef07c1..86ed02930 100644
--- a/java/sql/DriverManager.java
+++ b/java/sql/DriverManager.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -55,7 +55,7 @@ import java.util.Vector;
* property should be a colon separated list of fully qualified driver
* class names. Additional drivers can be loaded at any time by
* simply loading the driver class with <code>class.forName(String)</code>.
- * The driver should automatically register itself in a static
+ * The driver should automatically register itself in a static
* initializer.
* <p>
* The methods in this class are all <code>static</code>. This class
@@ -63,7 +63,7 @@ import java.util.Vector;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class DriverManager
+public class DriverManager
{
/**
* This is the log stream for JDBC drivers.
@@ -95,19 +95,19 @@ public class DriverManager
String driver_string = System.getProperty("jdbc.drivers");
if (driver_string != null)
{
- StringTokenizer st = new StringTokenizer(driver_string);
- while (st.hasMoreTokens())
+ StringTokenizer st = new StringTokenizer(driver_string);
+ while (st.hasMoreTokens())
{
String driver_classname = st.nextToken();
try
{
- Class.forName(driver_classname); // The driver registers itself
+ Class.forName(driver_classname); // The driver registers itself
}
catch (Exception e)
- {
- // Ignore not founds
- }
+ {
+ // Ignore not founds
+ }
}
}
@@ -129,11 +129,11 @@ public class DriverManager
{
return log_writer;
}
-
+
/**
* This method sets the log writer being used by JDBC drivers. This is a
* system-wide parameter that affects all drivers. Note that since there
- * is no way to retrieve a <code>PrintStream</code> from a
+ * is no way to retrieve a <code>PrintStream</code> from a
* <code>PrintWriter</code>, this method cannot set the log stream in
* use by JDBC. Thus any older drivers may not see this setting.
*
@@ -223,8 +223,8 @@ public class DriverManager
Enumeration e = drivers.elements();
while(e.hasMoreElements())
{
- Driver d = (Driver)e.nextElement();
- if (d.acceptsURL(url))
+ Driver d = (Driver)e.nextElement();
+ if (d.acceptsURL(url))
return d;
}
@@ -242,7 +242,7 @@ public class DriverManager
public static void registerDriver(Driver driver) throws SQLException
{
if (! drivers.contains(driver))
- drivers.addElement(driver);
+ drivers.addElement(driver);
}
/**
@@ -274,17 +274,17 @@ public class DriverManager
while(e.hasMoreElements())
{
- Object obj = e.nextElement();
+ Object obj = e.nextElement();
- ClassLoader loader = obj.getClass().getClassLoader();
+ ClassLoader loader = obj.getClass().getClassLoader();
- if (loader == null)
- loader = ClassLoader.getSystemClassLoader();
- if (! loader.equals(cl))
- continue;
+ if (loader == null)
+ loader = ClassLoader.getSystemClassLoader();
+ if (! loader.equals(cl))
+ continue;
- v.addElement(obj);
- }
+ v.addElement(obj);
+ }
return v.elements();
}
@@ -297,7 +297,7 @@ public class DriverManager
*/
public static void setLoginTimeout(int seconds)
{
- DriverManager.login_timeout = seconds;
+ DriverManager.login_timeout = seconds;
}
/**
diff --git a/java/sql/DriverPropertyInfo.java b/java/sql/DriverPropertyInfo.java
index 34e40fa0c..c191fa5ef 100644
--- a/java/sql/DriverPropertyInfo.java
+++ b/java/sql/DriverPropertyInfo.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,7 +44,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class DriverPropertyInfo
+public class DriverPropertyInfo
{
/**
* The name of the property.
diff --git a/java/sql/ParameterMetaData.java b/java/sql/ParameterMetaData.java
index b3a75fd20..722d78bec 100644
--- a/java/sql/ParameterMetaData.java
+++ b/java/sql/ParameterMetaData.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -40,7 +40,7 @@ package java.sql;
/**
* @since 1.4
*/
-public interface ParameterMetaData
+public interface ParameterMetaData
{
int parameterNoNulls = 0;
diff --git a/java/sql/PreparedStatement.java b/java/sql/PreparedStatement.java
index ca7eb2c5d..4490b5bab 100644
--- a/java/sql/PreparedStatement.java
+++ b/java/sql/PreparedStatement.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -48,12 +48,12 @@ import java.util.Calendar;
* statements. This provides greater efficiency when calling the same
* statement multiple times. Parameters are allowed in a statement,
* providings for maximum reusability.
- *
+ *
* <p> Note that in this class parameter indices start at 1, not 0.</p>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface PreparedStatement extends Statement
+public interface PreparedStatement extends Statement
{
/**
* This method executes a prepared SQL query and returns its ResultSet.
@@ -78,7 +78,7 @@ public interface PreparedStatement extends Statement
* for the specified type.
*
* @param index The index of the parameter to set.
- * @param sqlType The SQL type identifier of the parameter from
+ * @param sqlType The SQL type identifier of the parameter from
* <code>Types</code>
*
* @exception SQLException If an error occurs.
@@ -268,7 +268,7 @@ public interface PreparedStatement extends Statement
*
* @param index The index of the parameter value to set.
* @param value The value of the parameter.
- * @param sqlType The SQL type to use for the parameter, from
+ * @param sqlType The SQL type to use for the parameter, from
* <code>Types</code>
* @param scale The scale of the value, for numeric values only.
* @exception SQLException If an error occurs.
@@ -283,7 +283,7 @@ public interface PreparedStatement extends Statement
*
* @param index The index of the parameter value to set.
* @param value The value of the parameter.
- * @param sqlType The SQL type to use for the parameter, from
+ * @param sqlType The SQL type to use for the parameter, from
* <code>Types</code>
* @exception SQLException If an error occurs.
* @see Types
@@ -348,7 +348,7 @@ public interface PreparedStatement extends Statement
* will be used.
*
* @param index The index of the parameter value to set.
- * @param value The <code>Blob</code> used to set the
+ * @param value The <code>Blob</code> used to set the
* value of the parameter.
* @exception SQLException If an error occurs.
*/
@@ -437,7 +437,7 @@ public interface PreparedStatement extends Statement
/**
* This method sets the specified parameter from the given Java
* <code>java.net.URL</code> value.
- *
+ *
* @param index The index of the parameter to set.
* @param value The value of the parameter.
* @exception SQLException If an error occurs.
@@ -446,10 +446,10 @@ public interface PreparedStatement extends Statement
void setURL(int index, URL value) throws SQLException;
/**
- * Returns information about the parameters set on this
+ * Returns information about the parameters set on this
* <code>PreparedStatement</code> (see {@link ParameterMetaData} for a
* detailed description of the provided information).
- *
+ *
* @return Meta data for the parameters of this statement.
* @see ParameterMetaData
* @since 1.4
diff --git a/java/sql/Ref.java b/java/sql/Ref.java
index c5c54eefe..f37c8fe4d 100644
--- a/java/sql/Ref.java
+++ b/java/sql/Ref.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,7 +46,7 @@ import java.util.Map;
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.2
*/
-public interface Ref
+public interface Ref
{
/**
* This method returns the fully qualified name of the SQL structured
diff --git a/java/sql/ResultSet.java b/java/sql/ResultSet.java
index 573deb3e1..3b49a6a0d 100644
--- a/java/sql/ResultSet.java
+++ b/java/sql/ResultSet.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -59,7 +59,7 @@ import java.util.Map;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface ResultSet
+public interface ResultSet
{
/**
* The rows will be processed in order from first to last.
@@ -119,7 +119,7 @@ public interface ResultSet
/**
* This method closes the result set and frees any associated resources.
- *
+ *
* @exception SQLException If an error occurs.
*/
void close() throws SQLException;
@@ -268,9 +268,9 @@ public interface ResultSet
Timestamp getTimestamp(int columnIndex) throws SQLException;
/**
- * This method returns the value of the specified column as an ASCII
+ * This method returns the value of the specified column as an ASCII
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -283,7 +283,7 @@ public interface ResultSet
/**
* This method returns the value of the specified column as a Unicode UTF-8
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -297,7 +297,7 @@ public interface ResultSet
/**
* This method returns the value of the specified column as a raw byte
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -440,9 +440,9 @@ public interface ResultSet
Timestamp getTimestamp(String columnName) throws SQLException;
/**
- * This method returns the value of the specified column as an ASCII
+ * This method returns the value of the specified column as an ASCII
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -455,7 +455,7 @@ public interface ResultSet
/**
* This method returns the value of the specified column as a Unicode UTF-8
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -469,7 +469,7 @@ public interface ResultSet
/**
* This method returns the value of the specified column as a raw byte
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -546,7 +546,7 @@ public interface ResultSet
/**
* This method returns the value of the specified column as a character
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -559,7 +559,7 @@ public interface ResultSet
/**
* This method returns the value of the specified column as a character
* stream. Note that all the data from this stream must be read before
- * fetching the value of any other column. Please also be aware that
+ * fetching the value of any other column. Please also be aware that
* calling <code>next()</code> or <code>close()</code> on this result set
* will close this stream as well.
*
@@ -632,7 +632,7 @@ public interface ResultSet
/**
* This method repositions the cursor to before the first row in the
* result set.
- *
+ *
* @exception SQLException If an error occurs.
*/
void beforeFirst() throws SQLException;
@@ -640,7 +640,7 @@ public interface ResultSet
/**
* This method repositions the cursor to after the last row in the result
* set.
- *
+ *
* @exception SQLException If an error occurs.
*/
void afterLast() throws SQLException;
@@ -658,7 +658,7 @@ public interface ResultSet
/**
* This method repositions the cursor on the last row in the result
* set.
- *
+ *
* @return <code>true</code> if the cursor is on a valid row;
* <code>false</code> if there are no rows in the result set.
* @exception SQLException If an error occurs.
@@ -711,7 +711,7 @@ public interface ResultSet
/**
* This method provides a hint to the driver about which direction the
- * result set will be processed in.
+ * result set will be processed in.
*
* @param direction The direction in which rows will be processed. The
* allowed values are the <code>FETCH_*</code> constants
@@ -738,7 +738,7 @@ public interface ResultSet
void setFetchSize(int rows) throws SQLException;
/**
- * This method returns the current number of rows that will be fetched
+ * This method returns the current number of rows that will be fetched
* from the database at a time.
*
* @return The current fetch size for this result set.
@@ -941,7 +941,7 @@ public interface ResultSet
void updateTime(int columnIndex, Time value) throws SQLException;
/**
- * This method updates the specified column to have a java.sql.Timestamp value.
+ * This method updates the specified column to have a java.sql.Timestamp value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
*
@@ -992,7 +992,7 @@ public interface ResultSet
throws SQLException;
/**
- * This method updates the specified column to have an Object value.
+ * This method updates the specified column to have an Object value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
*
@@ -1006,7 +1006,7 @@ public interface ResultSet
throws SQLException;
/**
- * This method updates the specified column to have an Object value.
+ * This method updates the specified column to have an Object value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
*
@@ -1160,7 +1160,7 @@ public interface ResultSet
void updateTime(String columnName, Time value) throws SQLException;
/**
- * This method updates the specified column to have a java.sql.Timestamp value.
+ * This method updates the specified column to have a java.sql.Timestamp value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
*
@@ -1211,7 +1211,7 @@ public interface ResultSet
throws SQLException;
/**
- * This method updates the specified column to have an Object value.
+ * This method updates the specified column to have an Object value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
*
@@ -1225,7 +1225,7 @@ public interface ResultSet
throws SQLException;
/**
- * This method updates the specified column to have an Object value.
+ * This method updates the specified column to have an Object value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
*
@@ -1266,7 +1266,7 @@ public interface ResultSet
void refreshRow() throws SQLException;
/**
- * This method cancels any changes that have been made to a row. If
+ * This method cancels any changes that have been made to a row. If
* the <code>rowUpdate</code> method has been called, then the changes
* cannot be undone.
*
@@ -1358,7 +1358,7 @@ public interface ResultSet
* @return The value of the column as an <code>Object</code>.
* @exception SQLException If an error occurs.
*/
- Object getObject(String columnName, Map<String, Class<?>> map)
+ Object getObject(String columnName, Map<String, Class<?>> map)
throws SQLException;
/**
@@ -1399,7 +1399,7 @@ public interface ResultSet
Array getArray(String columnName) throws SQLException;
/**
- * This method returns the specified column value as a
+ * This method returns the specified column value as a
* <code>java.sql.Date</code>. The specified <code>Calendar</code> is used
* to generate a value for the date if the database does not support
* timezones.
@@ -1412,7 +1412,7 @@ public interface ResultSet
Date getDate(int columnIndex, Calendar cal) throws SQLException;
/**
- * This method returns the specified column value as a
+ * This method returns the specified column value as a
* <code>java.sql.Date</code>. The specified <code>Calendar</code> is used
* to generate a value for the date if the database does not support
* timezones.
@@ -1425,7 +1425,7 @@ public interface ResultSet
Date getDate(String columnName, Calendar cal) throws SQLException;
/**
- * This method returns the specified column value as a
+ * This method returns the specified column value as a
* <code>java.sql.Time</code>. The specified <code>Calendar</code> is used
* to generate a value for the time if the database does not support
* timezones.
@@ -1438,7 +1438,7 @@ public interface ResultSet
Time getTime(int columnIndex, Calendar cal) throws SQLException;
/**
- * This method returns the specified column value as a
+ * This method returns the specified column value as a
* <code>java.sql.Time</code>. The specified <code>Calendar</code> is used
* to generate a value for the time if the database does not support
* timezones.
@@ -1451,7 +1451,7 @@ public interface ResultSet
Time getTime(String columnName, Calendar cal) throws SQLException;
/**
- * This method returns the specified column value as a
+ * This method returns the specified column value as a
* <code>java.sql.Timestamp</code>. The specified <code>Calendar</code> is used
* to generate a value for the timestamp if the database does not support
* timezones.
@@ -1465,7 +1465,7 @@ public interface ResultSet
throws SQLException;
/**
- * This method returns the specified column value as a
+ * This method returns the specified column value as a
* <code>java.sql.Timestamp</code>. The specified <code>Calendar</code> is used
* to generate a value for the timestamp if the database does not support
* timezones.
@@ -1481,9 +1481,9 @@ public interface ResultSet
throws SQLException;
/**
- * This method returns the specified column value as a
+ * This method returns the specified column value as a
* <code>java.net.URL</code>.
- *
+ *
* @param columnIndex The index of the column value to return.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1493,7 +1493,7 @@ public interface ResultSet
/**
* This method returns the specified column value as a
* <code>java.net.URL</code>.
- *
+ *
* @param columnName The name of the column value to return.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1501,13 +1501,13 @@ public interface ResultSet
URL getURL(String columnName) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sql.Ref</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sql.Ref</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnIndex The index of the column value to update.
- * @parm value The <code>java.sql.Ref</code> used to set the new value
+ * @parm value The <code>java.sql.Ref</code> used to set the new value
* of the column.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1515,13 +1515,13 @@ public interface ResultSet
void updateRef(int columnIndex, Ref value) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sql.Ref</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sql.Ref</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnName The name of the column value to update.
- * @parm value The <code>java.sql.Ref</code> used to set the new value
+ * @parm value The <code>java.sql.Ref</code> used to set the new value
* of the column.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1529,13 +1529,13 @@ public interface ResultSet
void updateRef(String columnName, Ref value) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sql.Blob</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sql.Blob</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnIndex The index of the column value to update.
- * @parm value The <code>java.sql.Blob</code> used to set the new value
+ * @parm value The <code>java.sql.Blob</code> used to set the new value
* of the column.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1543,13 +1543,13 @@ public interface ResultSet
void updateBlob(int columnIndex, Blob value) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sql.Blob</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sql.Blob</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnName The name of the column value to update.
- * @parm value The <code>java.sql.Blob</code> used to set the new value
+ * @parm value The <code>java.sql.Blob</code> used to set the new value
* of the column.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1557,13 +1557,13 @@ public interface ResultSet
void updateBlob(String columnName, Blob value) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sql.Clob</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sql.Clob</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnIndex The index of the column value to update.
- * @parm value The <code>java.sql.Clob</code> used to set the new value
+ * @parm value The <code>java.sql.Clob</code> used to set the new value
* of the column.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1571,13 +1571,13 @@ public interface ResultSet
void updateClob(int columnIndex, Clob value) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sql.Clob</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sql.Clob</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnName The name of the column value to update.
- * @parm value The <code>java.sql.Clob</code> used to set the new value
+ * @parm value The <code>java.sql.Clob</code> used to set the new value
* of the column.
* @exception SQLException If an error occurs.
* @since 1.4
@@ -1585,11 +1585,11 @@ public interface ResultSet
void updateClob(String columnName, Clob value) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sqlArray</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sqlArray</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnIndex The index of the column value to update.
* @parm value The new value of the column.
* @exception SQLException If an error occurs.
@@ -1598,11 +1598,11 @@ public interface ResultSet
void updateArray(int columnIndex, Array value) throws SQLException;
/**
- * This method updates the specified column to have a
- * <code>java.sqlArray</code> value.
+ * This method updates the specified column to have a
+ * <code>java.sqlArray</code> value.
* This does not update the actual database. <code>updateRow</code> must be
* called in order to do that.
- *
+ *
* @parm columnName The name of the column value to update.
* @parm value The new value of the column.
* @exception SQLException If an error occurs.
diff --git a/java/sql/ResultSetMetaData.java b/java/sql/ResultSetMetaData.java
index 5a62c549e..98485e3d3 100644
--- a/java/sql/ResultSetMetaData.java
+++ b/java/sql/ResultSetMetaData.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,12 +41,12 @@ package java.sql;
/**
* This interface provides a mechanism for obtaining information about
* the columns that are present in a <code>ResultSet</code>.
- *
+ *
* <p> Note that in this class column indices start at 1, not 0.</p>
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface ResultSetMetaData
+public interface ResultSetMetaData
{
/**
* The column does not allow NULL's.
@@ -93,7 +93,7 @@ public interface ResultSetMetaData
boolean isCaseSensitive(int columnIndex) throws SQLException;
/**
- * This method tests whether not the specified column can be used in
+ * This method tests whether not the specified column can be used in
* a WHERE clause.
*
* @param columnIndex The index of the column to test.
diff --git a/java/sql/SQLData.java b/java/sql/SQLData.java
index cf006e15a..97a42a443 100644
--- a/java/sql/SQLData.java
+++ b/java/sql/SQLData.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface SQLData
+public interface SQLData
{
/**
* This method returns the user defined datatype name for this object.
diff --git a/java/sql/SQLException.java b/java/sql/SQLException.java
index 8c502f2df..d8d845c6b 100644
--- a/java/sql/SQLException.java
+++ b/java/sql/SQLException.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class SQLException extends Exception
+public class SQLException extends Exception
{
static final long serialVersionUID = 2135244094396331484L;
@@ -75,7 +75,7 @@ public class SQLException extends Exception
{
super(message);
this.SQLState = SQLState;
- this.vendorCode = vendorCode;
+ this.vendorCode = vendorCode;
}
/**
@@ -100,7 +100,7 @@ public class SQLException extends Exception
*/
public SQLException(String message)
{
- this(message, null, 0);
+ this(message, null, 0);
}
/**
@@ -110,7 +110,7 @@ public class SQLException extends Exception
*/
public SQLException()
{
- this(null, null, 0);
+ this(null, null, 0);
}
/**
@@ -126,7 +126,7 @@ public class SQLException extends Exception
}
/**
- * This method returns the vendor specific error code associated with
+ * This method returns the vendor specific error code associated with
* this error.
*
* @return The vendor specific error code associated with this error.
@@ -139,7 +139,7 @@ public class SQLException extends Exception
/**
* This method returns the exception that is chained to this object.
*
- * @return The exception chained to this object, which may be
+ * @return The exception chained to this object, which may be
* <code>null</code>.
*/
public SQLException getNextException()
diff --git a/java/sql/SQLInput.java b/java/sql/SQLInput.java
index 730627d9a..e277a5020 100644
--- a/java/sql/SQLInput.java
+++ b/java/sql/SQLInput.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,7 +50,7 @@ import java.net.URL;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface SQLInput
+public interface SQLInput
{
/**
* This method reads the next item from the stream a Java
@@ -137,7 +137,7 @@ public interface SQLInput
* This method reads the next item from the stream a Java
* byte array
*
- * @return The value read from the stream as a byte array.
+ * @return The value read from the stream as a byte array.
* @exception SQLException If an error occurs.
*/
byte[] readBytes() throws SQLException;
@@ -256,4 +256,3 @@ public interface SQLInput
*/
URL readURL() throws SQLException;
}
-
diff --git a/java/sql/SQLOutput.java b/java/sql/SQLOutput.java
index e210258fa..cd075f1d2 100644
--- a/java/sql/SQLOutput.java
+++ b/java/sql/SQLOutput.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,7 +50,7 @@ import java.net.URL;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface SQLOutput
+public interface SQLOutput
{
/**
* This method writes the specified Java <code>String</code>
@@ -143,7 +143,7 @@ public interface SQLOutput
void writeBytes(byte[] value) throws SQLException;
/**
- * This method writes the specified Java <code>java.sql.Date</code>
+ * This method writes the specified Java <code>java.sql.Date</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
@@ -152,7 +152,7 @@ public interface SQLOutput
void writeDate(Date value) throws SQLException;
/**
- * This method writes the specified Java <code>java.sql.Time</code>
+ * This method writes the specified Java <code>java.sql.Time</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
@@ -161,7 +161,7 @@ public interface SQLOutput
void writeTime(Time value) throws SQLException;
/**
- * This method writes the specified Java <code>java.sql.Timestamp</code>
+ * This method writes the specified Java <code>java.sql.Timestamp</code>
* to the SQL stream.
*
* @param value The value to write to the stream.
@@ -256,9 +256,9 @@ public interface SQLOutput
void writeArray(Array value) throws SQLException;
/**
- * This method writes the specified <code>java.net.URL</code> object to the
+ * This method writes the specified <code>java.net.URL</code> object to the
* SQL stream.
- *
+ *
* @param value The value to write to the stream.
* @exception SQLException If an error occurs.
* @since 1.4
diff --git a/java/sql/SQLPermission.java b/java/sql/SQLPermission.java
index 101fa0161..ed3dd7f9e 100644
--- a/java/sql/SQLPermission.java
+++ b/java/sql/SQLPermission.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ import java.security.BasicPermission;
/**
* @since 1.3
*/
-public final class SQLPermission extends BasicPermission
+public final class SQLPermission extends BasicPermission
{
public SQLPermission(String name)
{
diff --git a/java/sql/SQLWarning.java b/java/sql/SQLWarning.java
index d9c7e354e..c2cee0ad5 100644
--- a/java/sql/SQLWarning.java
+++ b/java/sql/SQLWarning.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class SQLWarning extends SQLException
+public class SQLWarning extends SQLException
{
static final long serialVersionUID = 3917336774604784856L;
@@ -99,7 +99,7 @@ public class SQLWarning extends SQLException
/**
* This method returns the exception that is chained to this object.
*
- * @return The exception chained to this object, which may be
+ * @return The exception chained to this object, which may be
* <code>null</code>.
*/
public SQLWarning getNextWarning()
diff --git a/java/sql/Savepoint.java b/java/sql/Savepoint.java
index a4d89ae6e..6526dfb44 100644
--- a/java/sql/Savepoint.java
+++ b/java/sql/Savepoint.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,7 +41,7 @@ package java.sql;
/**
* @since 1.4
*/
-public interface Savepoint
+public interface Savepoint
{
/**
* @since 1.4
diff --git a/java/sql/Statement.java b/java/sql/Statement.java
index 195600eaa..1b57fb3ce 100644
--- a/java/sql/Statement.java
+++ b/java/sql/Statement.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface Statement
+public interface Statement
{
int CLOSE_CURRENT_RESULT = 1;
int KEEP_CURRENT_RESULT = 2;
@@ -66,7 +66,7 @@ public interface Statement
/**
* This method executes the specified SQL INSERT, UPDATE, or DELETE statement
* and returns the number of rows affected, which may be 0.
- *
+ *
* @param sql The SQL statement to execute.
* @return The number of rows affected by the SQL statement.
* @exception SQLException If an error occurs.
@@ -117,7 +117,7 @@ public interface Statement
* This method sets the local escape processing mode on or off. The
* default value is on.
*
- * @param escape <code>true</code> to enable local escape processing,
+ * @param escape <code>true</code> to enable local escape processing,
* <code>false</code> to disable it.
* @exception SQLException If an error occurs.
*/
@@ -214,10 +214,10 @@ public interface Statement
int getUpdateCount() throws SQLException;
/**
- * This method advances the result set pointer to the next result set,
+ * This method advances the result set pointer to the next result set,
* which can then be retrieved using <code>getResultSet</code>
*
- * @return <code>true</code> if there is another result set,
+ * @return <code>true</code> if there is another result set,
* <code>false</code> otherwise (for example, the next result is an
* update count).
* @exception SQLException If an error occurs.
diff --git a/java/sql/Struct.java b/java/sql/Struct.java
index ce8db22bb..897344b98 100644
--- a/java/sql/Struct.java
+++ b/java/sql/Struct.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,12 +41,12 @@ package java.sql;
import java.util.Map;
/**
- * This interface implements the standard type mapping for a SQL
+ * This interface implements the standard type mapping for a SQL
* structured type.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public interface Struct
+public interface Struct
{
/**
* This method returns the name of the SQL structured type for this
diff --git a/java/sql/Time.java b/java/sql/Time.java
index 2d1a433fa..8de163683 100644
--- a/java/sql/Time.java
+++ b/java/sql/Time.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -145,16 +145,16 @@ public class Time extends java.util.Date
{
try
{
- java.util.Date d = (java.util.Date) sdf.parseObject(str);
+ java.util.Date d = (java.util.Date) sdf.parseObject(str);
- if (d == null)
- throw new IllegalArgumentException(str);
- else
- return new Time(d.getTime());
+ if (d == null)
+ throw new IllegalArgumentException(str);
+ else
+ return new Time(d.getTime());
}
catch (ParseException e)
{
- throw new IllegalArgumentException(str);
+ throw new IllegalArgumentException(str);
}
}
@@ -178,7 +178,7 @@ public class Time extends java.util.Date
/**
* This method initializes a new instance of this class with the
- * specified time value representing the number of milliseconds since
+ * specified time value representing the number of milliseconds since
* Jan 1, 1970 at 12:00 midnight GMT.
*
* @param date The time value to intialize this <code>Time</code> to.
@@ -199,4 +199,3 @@ public class Time extends java.util.Date
}
}
-
diff --git a/java/sql/Timestamp.java b/java/sql/Timestamp.java
index 18ccda557..9488f8e2d 100644
--- a/java/sql/Timestamp.java
+++ b/java/sql/Timestamp.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -45,7 +45,7 @@ import java.text.SimpleDateFormat;
/**
* This class is a wrapper around java.util.Date to allow the JDBC
* driver to identify the value as a SQL Timestamp. Note that this
- * class also adds an additional field for nano-seconds, and so
+ * class also adds an additional field for nano-seconds, and so
* is not completely identical to <code>java.util.Date</code> as
* the <code>java.sql.Date</code> and <code>java.sql.Time</code>
* classes are.
@@ -74,7 +74,7 @@ public class Timestamp extends java.util.Date
* date in JDBC format into a Java date.
*
* @param str The string to parse.
- * @return The resulting <code>java.sql.Timestamp</code> value.
+ * @return The resulting <code>java.sql.Timestamp</code> value.
*/
public static Timestamp valueOf(String str)
{
@@ -82,18 +82,18 @@ public class Timestamp extends java.util.Date
int dot = str.indexOf('.');
if (dot != -1)
{
- if (str.lastIndexOf('.') != dot)
- throw new IllegalArgumentException(str);
+ if (str.lastIndexOf('.') != dot)
+ throw new IllegalArgumentException(str);
+
+ int len = str.length() - dot - 1;
+ if (len < 1 || len > 9)
+ throw new IllegalArgumentException(str);
- int len = str.length() - dot - 1;
- if (len < 1 || len > 9)
- throw new IllegalArgumentException(str);
+ nanos = Integer.parseInt(str.substring(dot + 1));
+ for (int i = len; i < 9; i++)
+ nanos *= 10;
- nanos = Integer.parseInt(str.substring(dot + 1));
- for (int i = len; i < 9; i++)
- nanos *= 10;
-
- str = str.substring(0, dot);
+ str = str.substring(0, dot);
}
@@ -101,20 +101,20 @@ public class Timestamp extends java.util.Date
{
java.util.Date d;
synchronized (dateFormat)
- {
- d = (java.util.Date) dateFormat.parseObject(str);
- }
+ {
+ d = (java.util.Date) dateFormat.parseObject(str);
+ }
- if (d == null)
- throw new IllegalArgumentException(str);
+ if (d == null)
+ throw new IllegalArgumentException(str);
- Timestamp ts = new Timestamp(d.getTime() + nanos / 1000000);
- ts.nanos = nanos;
- return ts;
+ Timestamp ts = new Timestamp(d.getTime() + nanos / 1000000);
+ ts.nanos = nanos;
+ return ts;
}
catch (ParseException e)
{
- throw new IllegalArgumentException(str);
+ throw new IllegalArgumentException(str);
}
}
@@ -131,7 +131,7 @@ public class Timestamp extends java.util.Date
* @param nanos The nanosecond value for this Timestamp (0 to 999,999,9999)
* @deprecated
*/
- public Timestamp(int year, int month, int day, int hour, int minute,
+ public Timestamp(int year, int month, int day, int hour, int minute,
int second, int nanos)
{
super(year, month, day, hour, minute, second);
@@ -140,7 +140,7 @@ public class Timestamp extends java.util.Date
/**
* This method initializes a new instance of this class with the
- * specified time value representing the number of milliseconds since
+ * specified time value representing the number of milliseconds since
* Jan 1, 1970 at 12:00 midnight GMT.
*
* @param date The time value to intialize this <code>Time</code> to.
@@ -152,7 +152,7 @@ public class Timestamp extends java.util.Date
}
/**
- * Return the value of this Timestamp as the number of milliseconds
+ * Return the value of this Timestamp as the number of milliseconds
* since Jan 1, 1970 at 12:00 midnight GMT.
*/
public long getTime()
@@ -170,13 +170,13 @@ public class Timestamp extends java.util.Date
synchronized (dateFormat)
{
sbuf.setLength(0);
- dateFormat.format(this, sbuf, null);
- sbuf.append('.');
- decimalFormat.format(nanos, sbuf, null);
- int end = sbuf.length() - 1;
- while (end > 20 && sbuf.charAt(end) == '0')
- end--;
- return sbuf.substring(0, end + 1);
+ dateFormat.format(this, sbuf, null);
+ sbuf.append('.');
+ decimalFormat.format(nanos, sbuf, null);
+ int end = sbuf.length() - 1;
+ while (end > 20 && sbuf.charAt(end) == '0')
+ end--;
+ return sbuf.substring(0, end + 1);
}
}
@@ -280,7 +280,7 @@ public class Timestamp extends java.util.Date
/**
* Compares this <code>Timestamp</code> to another one.
- *
+ *
* @param ts The other Timestamp.
* @return <code>0</code>, if both <code>Timestamp</code>'s represent exactly
* the same date, a negative value if this <code>Timestamp</code> is
@@ -302,7 +302,7 @@ public class Timestamp extends java.util.Date
* <code>compareTo(Timestamp)</code>, but it may throw a
* <code>ClassCastException</code>, if the specified object is not of type
* <code>Timestamp</code>.
- *
+ *
* @param obj The object to compare with.
* @return <code>0</code>, if both <code>Timestamp</code>'s represent exactly
* the same date, a negative value if this <code>Timestamp</code> is
diff --git a/java/sql/Types.java b/java/sql/Types.java
index 7dd41411a..c07ef1353 100644
--- a/java/sql/Types.java
+++ b/java/sql/Types.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.sql;
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
-public class Types
+public class Types
{
// These should be self explanatory. People need a SQL book, not
// Javadoc comments for these.
diff --git a/java/text/Annotation.java b/java/text/Annotation.java
index cecb44aaf..7c4d001f6 100644
--- a/java/text/Annotation.java
+++ b/java/text/Annotation.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -110,4 +110,3 @@ toString()
}
} // class Annotation
-
diff --git a/java/text/AttributedCharacterIterator.java b/java/text/AttributedCharacterIterator.java
index 4f9c762b3..72c0ebbfe 100644
--- a/java/text/AttributedCharacterIterator.java
+++ b/java/text/AttributedCharacterIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -54,7 +54,7 @@ import java.util.Set;
* characters or which is undefined over a range of characters.
*
* @since 1.2
- *
+ *
* @author Aaron M. Renn (arenn@urbanophile.com)
* @since 1.2
*/
@@ -77,7 +77,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
* This is the attribute for the reading form of text. This is used
* for storing pronunciation along with the written text for languages
* which need it. The value of attributes of this key type are
- * instances of <code>Annotation</code> which wrappers a
+ * instances of <code>Annotation</code> which wrappers a
* <code>String</code>.
*/
public static final Attribute READING = new Attribute("reading");
@@ -117,7 +117,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
}
/**
- * Resolves an instance of
+ * Resolves an instance of
* <code>AttributedCharacterIterator.Attribute</code>
* that is being deserialized to one of the three pre-defined attribute
* constants. It does this by comparing the names of the attributes. The
@@ -125,7 +125,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
*
* @return The resolved contant value
*
- * @exception InvalidObjectException If the object being deserialized
+ * @exception InvalidObjectException If the object being deserialized
* cannot be resolved.
*/
protected Object readResolve() throws InvalidObjectException
@@ -139,31 +139,31 @@ public interface AttributedCharacterIterator extends CharacterIterator
if (getName().equals(INPUT_METHOD_SEGMENT.getName()))
return INPUT_METHOD_SEGMENT;
- throw new InvalidObjectException ("Can't resolve Attribute: "
+ throw new InvalidObjectException ("Can't resolve Attribute: "
+ getName());
}
-
+
/**
* Tests this object for equality against the specified object.
* The two objects will be considered equal if and only if:
* <ul>
* <li>The specified object is not <code>null</code>.
- * <li>The specified object is an instance of
+ * <li>The specified object is an instance of
* <code>AttributedCharacterIterator.Attribute</code>.
* <li>The specified object has the same attribute name as this object.
* </ul>
*
- * @param obj the <code>Object</code> to test for equality against this
+ * @param obj the <code>Object</code> to test for equality against this
* object.
*
- * @return <code>true</code> if the specified object is equal to this one,
+ * @return <code>true</code> if the specified object is equal to this one,
* <code>false</code> otherwise.
*/
public final boolean equals(Object obj)
{
if (obj == this)
return true;
- else
+ else
return false;
}
@@ -190,15 +190,15 @@ public interface AttributedCharacterIterator extends CharacterIterator
} // Inner class Attribute
/**
- * Returns a list of all keys that are defined for the
+ * Returns a list of all keys that are defined for the
* text range. This can be an empty list if no attributes are defined.
*
- * @return A list of keys
+ * @return A list of keys
*/
Set<Attribute> getAllAttributeKeys();
/**
- * Returns a <code>Map</code> of the attributes defined for the current
+ * Returns a <code>Map</code> of the attributes defined for the current
* character.
*
* @return A <code>Map</code> of the attributes for the current character.
@@ -234,7 +234,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
* @return The start index of the run.
*/
int getRunStart(Set<? extends Attribute> attribs);
-
+
/**
* Returns the index of the first character in the run that
* contains the specified attribute defined for the current character.
@@ -244,7 +244,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
* @return The start index of the run.
*/
int getRunStart(AttributedCharacterIterator.Attribute attrib);
-
+
/**
* Returns the index of the character after the end of the run
* that contains all attributes defined for the current character.
@@ -252,7 +252,7 @@ public interface AttributedCharacterIterator extends CharacterIterator
* @return The end index of the run.
*/
int getRunLimit();
-
+
/**
* Returns the index of the character after the end of the run
* that contains all attributes in the specified <code>Set</code> defined
@@ -263,13 +263,13 @@ public interface AttributedCharacterIterator extends CharacterIterator
* @return The end index of the run.
*/
int getRunLimit(Set<? extends Attribute> attribs);
-
+
/**
* Returns the index of the character after the end of the run
* that contains the specified attribute defined for the current character.
*
* @param attrib The attribute.
- *
+ *
* @return The end index of the run.
*/
int getRunLimit(AttributedCharacterIterator.Attribute attrib);
diff --git a/java/text/AttributedString.java b/java/text/AttributedString.java
index cb338bfe8..7ffb3d4c0 100644
--- a/java/text/AttributedString.java
+++ b/java/text/AttributedString.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -50,9 +50,9 @@ import java.util.Set;
/**
* This class models a <code>String</code> with attributes over various
- * subranges of the string. It allows applications to access this
+ * subranges of the string. It allows applications to access this
* information via the <code>AttributedCharacterIterator</code> interface.
- *
+ *
* @since 1.2
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -61,8 +61,8 @@ import java.util.Set;
public class AttributedString
{
- /**
- * The attributes and ranges of text over which those attributes apply.
+ /**
+ * The attributes and ranges of text over which those attributes apply.
*/
final class AttributeRange
{
@@ -78,12 +78,12 @@ public class AttributedString
/**
* Creates a new attribute range.
- *
+ *
* @param attribs the attributes.
* @param beginIndex the start index.
* @param endIndex the end index.
*/
- AttributeRange(Map attribs, int beginIndex, int endIndex)
+ AttributeRange(Map attribs, int beginIndex, int endIndex)
{
this.attribs = attribs;
this.beginIndex = beginIndex;
@@ -104,7 +104,7 @@ public class AttributedString
*
* @param str The <code>String</code> to be attributed (<code>null</code> not
* permitted).
- *
+ *
* @throws NullPointerException if <code>str</code> is <code>null</code>.
*/
public AttributedString(String str)
@@ -135,10 +135,10 @@ public class AttributedString
* that will use the text and attribute information from the specified
* <code>AttributedCharacterIterator</code>.
*
- * @param aci The <code>AttributedCharacterIterator</code> containing the
- * text and attribute information (<code>null</code> not
+ * @param aci The <code>AttributedCharacterIterator</code> containing the
+ * text and attribute information (<code>null</code> not
* permitted).
- *
+ *
* @throws NullPointerException if <code>aci</code> is <code>null</code>.
*/
public AttributedString(AttributedCharacterIterator aci)
@@ -151,7 +151,7 @@ public class AttributedString
* that will use the text and attribute information from the specified
* subrange of the specified <code>AttributedCharacterIterator</code>.
*
- * @param aci The <code>AttributedCharacterIterator</code> containing the
+ * @param aci The <code>AttributedCharacterIterator</code> containing the
* text and attribute information.
* @param beginIndex The beginning index of the text subrange.
* @param endIndex The ending index of the text subrange.
@@ -170,14 +170,14 @@ public class AttributedString
* specified array of attributes will be included in the attribute list
* for this object.
*
- * @param aci The <code>AttributedCharacterIterator</code> containing the
+ * @param aci The <code>AttributedCharacterIterator</code> containing the
* text and attribute information.
* @param begin The beginning index of the text subrange.
* @param end The ending index of the text subrange.
- * @param attributes A list of attributes to include from the iterator, or
+ * @param attributes A list of attributes to include from the iterator, or
* <code>null</code> to include all attributes.
*/
- public AttributedString(AttributedCharacterIterator aci, int begin, int end,
+ public AttributedString(AttributedCharacterIterator aci, int begin, int end,
AttributedCharacterIterator.Attribute[] attributes)
{
// Validate some arguments
@@ -196,7 +196,7 @@ public class AttributedString
ArrayList accum = new ArrayList();
do
- {
+ {
sb.append(c);
Iterator iter = allAttribs.iterator();
@@ -208,7 +208,7 @@ public class AttributedString
if (!(obj instanceof AttributedCharacterIterator.Attribute))
continue;
- AttributedCharacterIterator.Attribute attrib =
+ AttributedCharacterIterator.Attribute attrib =
(AttributedCharacterIterator.Attribute)obj;
// Make sure the attribute is defined.
@@ -260,7 +260,7 @@ public class AttributedString
* @param attrib The attribute to add.
* @param value The value of the attribute.
*/
- public void addAttribute(AttributedCharacterIterator.Attribute attrib,
+ public void addAttribute(AttributedCharacterIterator.Attribute attrib,
Object value)
{
addAttribute(attrib, value, 0, sci.getEndIndex());
@@ -275,10 +275,10 @@ public class AttributedString
* @param begin The beginning index of the subrange.
* @param end The ending index of the subrange.
*
- * @exception IllegalArgumentException If attribute is <code>null</code> or
+ * @exception IllegalArgumentException If attribute is <code>null</code> or
* the subrange is not valid.
*/
- public void addAttribute(AttributedCharacterIterator.Attribute attrib,
+ public void addAttribute(AttributedCharacterIterator.Attribute attrib,
Object value, int begin, int end)
{
if (attrib == null)
@@ -299,12 +299,12 @@ public class AttributedString
* @param beginIndex The beginning index.
* @param endIndex The ending index
*
- * @throws NullPointerException if <code>attributes</code> is
+ * @throws NullPointerException if <code>attributes</code> is
* <code>null</code>.
* @throws IllegalArgumentException if the subrange is not valid.
*/
public void addAttributes(Map<? extends AttributedCharacterIterator.Attribute, ?> attributes,
- int beginIndex, int endIndex)
+ int beginIndex, int endIndex)
{
if (attributes == null)
throw new NullPointerException("null attribute");
@@ -316,19 +316,19 @@ public class AttributedString
AttributeRange[] new_list = new AttributeRange[attribs.length + 1];
System.arraycopy(attribs, 0, new_list, 0, attribs.length);
attribs = new_list;
- attribs[attribs.length - 1] = new AttributeRange(attributes, beginIndex,
+ attribs[attribs.length - 1] = new AttributeRange(attributes, beginIndex,
endIndex);
- }
+ }
/**
- * Returns an <code>AttributedCharacterIterator</code> that
+ * Returns an <code>AttributedCharacterIterator</code> that
* will iterate over the entire string.
*
* @return An <code>AttributedCharacterIterator</code> for the entire string.
*/
public AttributedCharacterIterator getIterator()
{
- return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(),
+ return(new AttributedStringIterator(sci, attribs, 0, sci.getEndIndex(),
null));
}
@@ -351,11 +351,11 @@ public class AttributedString
/**
* Returns an <code>AttributedCharacterIterator</code> that
- * will iterate over the specified subrange. This iterator will return
- * information about the list of attributes in the specified array.
- * Attributes not in the array may or may not be returned by the iterator.
- * If the specified array is <code>null</code>, all attributes will be
- * returned.
+ * will iterate over the specified subrange. This iterator will return
+ * information about the list of attributes in the specified array.
+ * Attributes not in the array may or may not be returned by the iterator.
+ * If the specified array is <code>null</code>, all attributes will be
+ * returned.
*
* @param attributes A list of attributes to include in the returned iterator.
* @param beginIndex The beginning index of the subrange.
@@ -364,7 +364,7 @@ public class AttributedString
* @return An <code>AttributedCharacterIterator</code> for this string.
*/
public AttributedCharacterIterator getIterator(
- AttributedCharacterIterator.Attribute[] attributes,
+ AttributedCharacterIterator.Attribute[] attributes,
int beginIndex, int endIndex)
{
if ((beginIndex < 0) || (endIndex > sci.getEndIndex()) ||
diff --git a/java/text/AttributedStringIterator.java b/java/text/AttributedStringIterator.java
index 2f970feba..429bd7063 100644
--- a/java/text/AttributedStringIterator.java
+++ b/java/text/AttributedStringIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -73,14 +73,14 @@ class AttributedStringIterator implements AttributedCharacterIterator
/**
* Creates a new instance.
- *
+ *
* @param sci an iterator for the string content.
* @param attribs the attribute ranges.
* @param beginIndex the start index.
* @param endIndex the end index.
* @param restricts the attributes that the user is interested in.
*/
- AttributedStringIterator(StringCharacterIterator sci,
+ AttributedStringIterator(StringCharacterIterator sci,
AttributedString.AttributeRange[] attribs,
int beginIndex, int endIndex,
AttributedCharacterIterator.Attribute[] restricts)
@@ -132,7 +132,7 @@ class AttributedStringIterator implements AttributedCharacterIterator
public char setIndex(int index)
{
- return(ci.setIndex(index));
+ return(ci.setIndex(index));
}
public int getBeginIndex()
@@ -147,7 +147,7 @@ class AttributedStringIterator implements AttributedCharacterIterator
/*
* Here is where the AttributedCharacterIterator methods start.
- */
+ */
/*************************************************************************/
@@ -164,8 +164,8 @@ class AttributedStringIterator implements AttributedCharacterIterator
for (int i = 0; i < attribs.length; i++)
{
if (attribs[i].beginIndex > getEndIndex()
- || attribs[i].endIndex <= getBeginIndex())
- continue;
+ || attribs[i].endIndex <= getBeginIndex())
+ continue;
Set key_set = attribs[i].attribs.keySet();
Iterator iter = key_set.iterator();
@@ -201,30 +201,30 @@ class AttributedStringIterator implements AttributedCharacterIterator
{
if (attributeSet == null)
return ci.getEndIndex();
-
+
int current = ci.getIndex();
int end = ci.getEndIndex();
int limit = current;
- if (current == end)
+ if (current == end)
return end;
Map runValues = getAttributes();
- while (limit < end)
+ while (limit < end)
{
Iterator iterator = attributeSet.iterator();
- while (iterator.hasNext())
+ while (iterator.hasNext())
{
Attribute attributeKey = (Attribute) iterator.next();
Object v1 = runValues.get(attributeKey);
Object v2 = getAttribute(attributeKey, limit + 1);
boolean changed = false;
// check for equal or both null, if NO return start
- if (v1 != null)
+ if (v1 != null)
{
changed = !v1.equals(v2);
}
- else
+ else
{
- changed = (v2 != null);
+ changed = (v2 != null);
}
if (changed)
return limit + 1;
@@ -246,7 +246,7 @@ class AttributedStringIterator implements AttributedCharacterIterator
* Returns the index of the first character in the run containing the current
* character and defined by all the attributes defined for that character
* position.
- *
+ *
* @return The run start index.
*/
public int getRunStart()
@@ -255,11 +255,11 @@ class AttributedStringIterator implements AttributedCharacterIterator
}
/**
- * Returns the index of the first character in the run, defined by the
+ * Returns the index of the first character in the run, defined by the
* specified attribute, that contains the current character.
- *
+ *
* @param attrib the attribute (<code>null</code> permitted).
- *
+ *
* return The index of the first character in the run.
*/
public int getRunStart(AttributedCharacterIterator.Attribute attrib)
@@ -272,42 +272,42 @@ class AttributedStringIterator implements AttributedCharacterIterator
}
/**
- * Returns the index of the first character in the run, defined by the
+ * Returns the index of the first character in the run, defined by the
* specified attribute set, that contains the current character.
- *
+ *
* @param attributeSet the attribute set (<code>null</code> permitted).
- *
+ *
* return The index of the first character in the run.
*/
public int getRunStart(Set attributeSet)
{
if (attributeSet == null)
return ci.getBeginIndex();
-
+
int current = ci.getIndex();
int begin = ci.getBeginIndex();
int start = current;
- if (start == begin)
+ if (start == begin)
return begin;
Map runValues = getAttributes();
int prev = start - 1;
- while (start > begin)
+ while (start > begin)
{
Iterator iterator = attributeSet.iterator();
- while (iterator.hasNext())
+ while (iterator.hasNext())
{
Attribute attributeKey = (Attribute) iterator.next();
Object v1 = runValues.get(attributeKey);
Object v2 = getAttribute(attributeKey, prev);
boolean changed = false;
// check for equal or both null, if NO return start
- if (v1 != null)
+ if (v1 != null)
{
changed = !v1.equals(v2);
}
- else
+ else
{
- changed = (v2 != null);
+ changed = (v2 != null);
}
if (changed)
return start;
@@ -325,13 +325,13 @@ class AttributedStringIterator implements AttributedCharacterIterator
* Returns the value for an attribute at the specified position. If the
* attribute key (<code>key</code>) is <code>null</code>, the method returns
* <code>null</code>.
- *
+ *
* @param key the key (<code>null</code> permitted).
* @param pos the character position.
- *
+ *
* @return The attribute value (possibly <code>null</code>).
*/
- private Object getAttribute(AttributedCharacterIterator.Attribute key,
+ private Object getAttribute(AttributedCharacterIterator.Attribute key,
int pos)
{
if (attribs == null)
@@ -341,22 +341,22 @@ class AttributedStringIterator implements AttributedCharacterIterator
if (pos >= attribs[i].beginIndex && pos < attribs[i].endIndex)
{
Set keys = attribs[i].attribs.keySet();
- if (keys.contains(key))
+ if (keys.contains(key))
{
return attribs[i].attribs.get(key);
}
}
}
- return null;
+ return null;
}
-
+
/**
* Returns the value for an attribute at the current position. If the
* attribute key (<code>key</code>) is <code>null</code>, the method returns
* <code>null</code>.
- *
+ *
* @param key the key (<code>null</code> permitted).
- *
+ *
* @return The attribute value (possibly <code>null</code>).
*/
public Object getAttribute(AttributedCharacterIterator.Attribute key)
@@ -375,7 +375,7 @@ class AttributedStringIterator implements AttributedCharacterIterator
HashMap m = new HashMap();
if (attribs == null)
return(m);
-
+
for (int i = 0; i < attribs.length; i++)
{
if ((ci.getIndex() >= attribs[i].beginIndex) &&
diff --git a/java/text/Bidi.java b/java/text/Bidi.java
index 491f9e36e..6a7bd0750 100644
--- a/java/text/Bidi.java
+++ b/java/text/Bidi.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -111,7 +111,7 @@ public final class Bidi
// the codes have been removed.
private ArrayList formatterIndices;
- // Indices of the starts of runs in the text.
+ // Indices of the starts of runs in the text.
private int[] runs;
// A convenience field where we keep track of what kinds of runs
@@ -128,11 +128,11 @@ public final class Bidi
* {@link TextAttribute#RUN_DIRECTION_RTL}. If neither is given,
* {@link #DIRECTION_DEFAULT_LEFT_TO_RIGHT} is assumed.
* </li>
- *
+ *
* <li> If {@link TextAttribute#NUMERIC_SHAPING} is seen, then numeric
* shaping will be done before the Bidi algorithm is run.
* </li>
- *
+ *
* <li> If {@link TextAttribute#BIDI_EMBEDDING} is seen on a given
* character, then the value of this attribute will be used as an
* embedding level override.
@@ -192,12 +192,12 @@ public final class Bidi
/**
* Create a new Bidi object with the indicated text and, possibly, explicit
* embedding settings.
- *
+ *
* If the embeddings array is null, it is ignored. Otherwise it is taken to
* be explicit embedding settings corresponding to the text. Positive values
* from 1 to 61 are embedding levels, and negative values from -1 to -61 are
* embedding overrides. (FIXME: not at all clear what this really means.)
- *
+ *
* @param text the text to use
* @param offset the offset of the first character of the text
* @param embeddings the explicit embeddings, or null if there are none
@@ -321,7 +321,7 @@ public final class Bidi
// It isn't at all clear what we're supposed to do here.
// What does a negative value really mean?
// Should we push on the embedding stack here?
- currentEmbedding = embeddings[embeddingOffset + i];
+ currentEmbedding = embeddings[embeddingOffset + i];
if (currentEmbedding < 0)
{
currentEmbedding = (byte) -currentEmbedding;
@@ -486,7 +486,7 @@ public final class Bidi
private void resolveWeakTypes()
{
final int runCount = getRunCount();
-
+
int previousLevel = baseEmbedding;
for (int run = 0; run < runCount; ++run)
{
@@ -600,7 +600,7 @@ public final class Bidi
{
// This implements rules N1 and N2.
final int runCount = getRunCount();
-
+
int previousLevel = baseEmbedding;
for (int run = 0; run < runCount; ++run)
{
@@ -644,7 +644,7 @@ public final class Bidi
case Character.DIRECTIONALITY_OTHER_NEUTRALS:
case Character.DIRECTIONALITY_SEGMENT_SEPARATOR:
case Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR:
- case Character.DIRECTIONALITY_WHITESPACE:
+ case Character.DIRECTIONALITY_WHITESPACE:
if (neutralStart == -1)
neutralStart = i;
break;
@@ -983,17 +983,17 @@ public final class Bidi
{
for (int i = start; i < end; i++)
{
- byte dir = Character.getDirectionality(text[i]);
- if (dir != Character.DIRECTIONALITY_LEFT_TO_RIGHT
- && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER
- && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
- && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
- && dir != Character.DIRECTIONALITY_ARABIC_NUMBER
- && dir != Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
- && dir != Character.DIRECTIONALITY_SEGMENT_SEPARATOR
- && dir != Character.DIRECTIONALITY_WHITESPACE
+ byte dir = Character.getDirectionality(text[i]);
+ if (dir != Character.DIRECTIONALITY_LEFT_TO_RIGHT
+ && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER
+ && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
+ && dir != Character.DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR
+ && dir != Character.DIRECTIONALITY_ARABIC_NUMBER
+ && dir != Character.DIRECTIONALITY_COMMON_NUMBER_SEPARATOR
+ && dir != Character.DIRECTIONALITY_SEGMENT_SEPARATOR
+ && dir != Character.DIRECTIONALITY_WHITESPACE
&& dir != Character.DIRECTIONALITY_PARAGRAPH_SEPARATOR)
- return true;
+ return true;
}
return false;
diff --git a/java/text/BreakIterator.java b/java/text/BreakIterator.java
index 30e5f2b94..628cb7235 100644
--- a/java/text/BreakIterator.java
+++ b/java/text/BreakIterator.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -105,7 +105,7 @@ public abstract class BreakIterator implements Cloneable
return null;
}
}
-
+
/**
* This method returns the index of the current text element boundary.
*
@@ -149,31 +149,31 @@ public abstract class BreakIterator implements Cloneable
String className;
try
{
- ResourceBundle res
- = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- loc, ClassLoader.getSystemClassLoader());
- className = res.getString(type);
+ ResourceBundle res
+ = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+ loc, ClassLoader.getSystemClassLoader());
+ className = res.getString(type);
}
catch (MissingResourceException x)
{
- return null;
+ return null;
}
try
{
- Class k = Class.forName(className);
- return (BreakIterator) k.newInstance();
+ Class k = Class.forName(className);
+ return (BreakIterator) k.newInstance();
}
catch (ClassNotFoundException x1)
{
- return null;
+ return null;
}
catch (InstantiationException x2)
{
- return null;
+ return null;
}
catch (IllegalAccessException x3)
{
- return null;
+ return null;
}
}
@@ -202,18 +202,18 @@ public abstract class BreakIterator implements Cloneable
if (r != null)
return r;
for (BreakIteratorProvider p :
- ServiceLoader.load(BreakIteratorProvider.class))
+ ServiceLoader.load(BreakIteratorProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- BreakIterator bi = p.getCharacterInstance(locale);
- if (bi != null)
- return bi;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ BreakIterator bi = p.getCharacterInstance(locale);
+ if (bi != null)
+ return bi;
+ break;
+ }
+ }
}
if (locale.equals(Locale.ROOT))
return new CharacterBreakIterator();
@@ -245,18 +245,18 @@ public abstract class BreakIterator implements Cloneable
if (r != null)
return r;
for (BreakIteratorProvider p :
- ServiceLoader.load(BreakIteratorProvider.class))
+ ServiceLoader.load(BreakIteratorProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- BreakIterator bi = p.getLineInstance(locale);
- if (bi != null)
- return bi;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ BreakIterator bi = p.getLineInstance(locale);
+ if (bi != null)
+ return bi;
+ break;
+ }
+ }
}
if (locale.equals(Locale.ROOT))
return new LineBreakIterator();
@@ -288,18 +288,18 @@ public abstract class BreakIterator implements Cloneable
if (r != null)
return r;
for (BreakIteratorProvider p :
- ServiceLoader.load(BreakIteratorProvider.class))
+ ServiceLoader.load(BreakIteratorProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- BreakIterator bi = p.getSentenceInstance(locale);
- if (bi != null)
- return bi;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ BreakIterator bi = p.getSentenceInstance(locale);
+ if (bi != null)
+ return bi;
+ break;
+ }
+ }
}
if (locale.equals(Locale.ROOT))
return new SentenceBreakIterator();
@@ -327,7 +327,7 @@ public abstract class BreakIterator implements Cloneable
/**
* This method returns an instance of <code>BreakIterator</code> that will
- * iterate over words as defined in the specified locale.
+ * iterate over words as defined in the specified locale.
*
* @param locale The desired locale.
*
@@ -339,18 +339,18 @@ public abstract class BreakIterator implements Cloneable
if (r != null)
return r;
for (BreakIteratorProvider p :
- ServiceLoader.load(BreakIteratorProvider.class))
+ ServiceLoader.load(BreakIteratorProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- BreakIterator bi = p.getWordInstance(locale);
- if (bi != null)
- return bi;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ BreakIterator bi = p.getWordInstance(locale);
+ if (bi != null)
+ return bi;
+ break;
+ }
+ }
}
if (locale.equals(Locale.ROOT))
return new WordBreakIterator();
@@ -364,7 +364,7 @@ public abstract class BreakIterator implements Cloneable
* @param pos The text position to test.
*
* @return <code>true</code> if the position is a boundary,
- * <code>false</code> otherwise.
+ * <code>false</code> otherwise.
*/
public boolean isBoundary (int pos)
{
@@ -403,7 +403,7 @@ public abstract class BreakIterator implements Cloneable
* This methdod returns the offset of the text element boundary preceding
* the specified offset.
*
- * @param pos The text index from which to find the preceding text boundary.
+ * @param pos The text index from which to find the preceding text boundary.
*
* @returns The next text boundary preceding the specified index.
*/
@@ -437,7 +437,7 @@ public abstract class BreakIterator implements Cloneable
/**
* This method sets the text to iterate over from the specified
* <code>CharacterIterator</code>.
- *
+ *
* @param newText The desired <code>CharacterIterator</code>.
*/
public abstract void setText (CharacterIterator newText);
diff --git a/java/text/CharacterIterator.java b/java/text/CharacterIterator.java
index 42da33c43..e202d91df 100644
--- a/java/text/CharacterIterator.java
+++ b/java/text/CharacterIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.text;
* characters. For a given range of text, a beginning and ending index,
* as well as a current index are defined. These values can be queried
* by the methods in this interface. Additionally, various methods allow
- * the index to be set.
+ * the index to be set.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
@@ -64,7 +64,7 @@ public interface CharacterIterator extends Cloneable
/**
* This method increments the current index and then returns the character
- * at the new index value. If the index is already at
+ * at the new index value. If the index is already at
* <code>getEndIndex() - 1</code>, it will not be incremented.
*
* @return The character at the position of the incremented index value,
@@ -87,7 +87,7 @@ public interface CharacterIterator extends Cloneable
* This method sets the index value to the beginning of the range and returns
* the character there.
*
- * @return The character at the beginning of the range, or {@link #DONE} if
+ * @return The character at the beginning of the range, or {@link #DONE} if
* the range is empty.
*/
char first();
@@ -97,10 +97,10 @@ public interface CharacterIterator extends Cloneable
* returns the character there. If the range is empty, then the index value
* will be set equal to the beginning index.
*
- * @return The character at the end of the range, or {@link #DONE} if the
+ * @return The character at the end of the range, or {@link #DONE} if the
* range is empty.
*/
- char last();
+ char last();
/**
* This method returns the current value of the index.
diff --git a/java/text/ChoiceFormat.java b/java/text/ChoiceFormat.java
index a552dd4a6..4842f491d 100644
--- a/java/text/ChoiceFormat.java
+++ b/java/text/ChoiceFormat.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -46,10 +46,10 @@ import java.util.Vector;
/**
* This class allows a format to be specified based on a range of numbers.
* To use this class, first specify two lists of formats and range terminators.
- * These lists must be arrays of equal length. The format of index
- * <code>i</code> will be selected for value <code>X</code> if
+ * These lists must be arrays of equal length. The format of index
+ * <code>i</code> will be selected for value <code>X</code> if
* <code>terminator[i] &lt;= X &lt; limit[i + 1]</code>. If the value X is not
- * included in any range, then either the first or last format will be
+ * included in any range, then either the first or last format will be
* used depending on whether the value X falls outside the range.
* <p>
* This sounds complicated, but that is because I did a poor job of
@@ -85,7 +85,7 @@ public class ChoiceFormat extends NumberFormat
{
/**
* This method sets new range terminators and format strings for this
- * object based on the specified pattern. This pattern is of the form
+ * object based on the specified pattern. This pattern is of the form
* "term#string|term#string...". For example "1#Sunday|2#Monday|#Tuesday".
*
* @param newPattern The pattern of terminators and format strings.
@@ -104,53 +104,53 @@ public class ChoiceFormat extends NumberFormat
while (true)
{
- // Find end of double.
- int dstart = index;
- while (index < max)
- {
- char c = newPattern.charAt(index);
- if (c == '#' || c == '\u2064' || c == '<')
- break;
- ++index;
- }
-
- if (index == max)
- throw new IllegalArgumentException ("unexpected end of text");
- Double d = Double.valueOf (newPattern.substring(dstart, index));
-
- if (newPattern.charAt(index) == '<')
- d = Double.valueOf (nextDouble (d.doubleValue()));
-
- limitVec.addElement(d);
-
- // Scan text.
- ++index;
- buf.setLength(0);
- while (index < max)
- {
- char c = newPattern.charAt(index);
- if (c == '\'' && index < max + 1
- && newPattern.charAt(index + 1) == '\'')
- {
- buf.append(c);
- ++index;
- }
- else if (c == '\'' && index < max + 2)
- {
- buf.append(newPattern.charAt(index + 1));
- index += 2;
- }
- else if (c == '|')
- break;
- else
- buf.append(c);
- ++index;
- }
-
- stringVec.addElement(buf.toString());
- if (index == max)
- break;
- ++index;
+ // Find end of double.
+ int dstart = index;
+ while (index < max)
+ {
+ char c = newPattern.charAt(index);
+ if (c == '#' || c == '\u2064' || c == '<')
+ break;
+ ++index;
+ }
+
+ if (index == max)
+ throw new IllegalArgumentException ("unexpected end of text");
+ Double d = Double.valueOf (newPattern.substring(dstart, index));
+
+ if (newPattern.charAt(index) == '<')
+ d = Double.valueOf (nextDouble (d.doubleValue()));
+
+ limitVec.addElement(d);
+
+ // Scan text.
+ ++index;
+ buf.setLength(0);
+ while (index < max)
+ {
+ char c = newPattern.charAt(index);
+ if (c == '\'' && index < max + 1
+ && newPattern.charAt(index + 1) == '\'')
+ {
+ buf.append(c);
+ ++index;
+ }
+ else if (c == '\'' && index < max + 2)
+ {
+ buf.append(newPattern.charAt(index + 1));
+ index += 2;
+ }
+ else if (c == '|')
+ break;
+ else
+ buf.append(c);
+ ++index;
+ }
+
+ stringVec.addElement(buf.toString());
+ if (index == max)
+ break;
+ ++index;
}
choiceFormats = new String[stringVec.size()];
@@ -159,15 +159,15 @@ public class ChoiceFormat extends NumberFormat
choiceLimits = new double[limitVec.size()];
for (int i = 0; i < choiceLimits.length; ++i)
{
- Double d = (Double) limitVec.elementAt(i);
- choiceLimits[i] = d.doubleValue();
+ Double d = (Double) limitVec.elementAt(i);
+ choiceLimits[i] = d.doubleValue();
}
}
/**
* This method initializes a new instance of <code>ChoiceFormat</code> that
* generates its range terminator and format string arrays from the
- * specified pattern. This pattern is of the form
+ * specified pattern. This pattern is of the form
* "term#string|term#string...". For example "1#Sunday|2#Monday|#Tuesday".
* This is the same pattern type used by the <code>applyPattern</code>
* method.
@@ -196,7 +196,7 @@ public class ChoiceFormat extends NumberFormat
}
/**
- * This method tests this object for equality with the specified
+ * This method tests this object for equality with the specified
* object. This will be true if and only if:
* <ul>
* <li>The specified object is not <code>null</code>.</li>
@@ -208,7 +208,7 @@ public class ChoiceFormat extends NumberFormat
* @param obj The object to test for equality against.
*
* @return <code>true</code> if the specified object is equal to
- * this one, <code>false</code> otherwise.
+ * this one, <code>false</code> otherwise.
*/
public boolean equals (Object obj)
{
@@ -219,9 +219,9 @@ public class ChoiceFormat extends NumberFormat
return false;
for (int i = choiceLimits.length - 1; i >= 0; --i)
{
- if (choiceLimits[i] != cf.choiceLimits[i]
- || !choiceFormats[i].equals(cf.choiceFormats[i]))
- return false;
+ if (choiceLimits[i] != cf.choiceLimits[i]
+ || !choiceFormats[i].equals(cf.choiceFormats[i]))
+ return false;
}
return true;
}
@@ -232,15 +232,15 @@ public class ChoiceFormat extends NumberFormat
* argument.
*
* @param num The number used for determine (based on the range
- * terminators) which format string to append.
- * @param appendBuf The <code>StringBuffer</code> to append the format string
+ * terminators) which format string to append.
+ * @param appendBuf The <code>StringBuffer</code> to append the format string
* to.
* @param pos Unused.
*
* @return The <code>StringBuffer</code> with the format string appended.
*/
public StringBuffer format (long num, StringBuffer appendBuf,
- FieldPosition pos)
+ FieldPosition pos)
{
return format ((double) num, appendBuf, pos);
}
@@ -251,14 +251,14 @@ public class ChoiceFormat extends NumberFormat
* argument.
*
* @param num The number used for determine (based on the range
- * terminators) which format string to append.
+ * terminators) which format string to append.
* @param appendBuf The <code>StringBuffer</code> to append the format string to.
* @param pos Unused.
*
* @return The <code>StringBuffer</code> with the format string appended.
*/
public StringBuffer format (double num, StringBuffer appendBuf,
- FieldPosition pos)
+ FieldPosition pos)
{
if (choiceLimits.length == 0)
return appendBuf;
@@ -266,11 +266,11 @@ public class ChoiceFormat extends NumberFormat
int index = 0;
if (! Double.isNaN(num) && num >= choiceLimits[0])
{
- for (; index < choiceLimits.length - 1; ++index)
- {
- if (choiceLimits[index] <= num && num < choiceLimits[index + 1])
- break;
- }
+ for (; index < choiceLimits.length - 1; ++index)
+ {
+ if (choiceLimits[index] <= num && num < choiceLimits[index + 1])
+ break;
+ }
}
return appendBuf.append(choiceFormats[index]);
@@ -298,7 +298,7 @@ public class ChoiceFormat extends NumberFormat
/**
* This method returns a hash value for this object
- *
+ *
* @return A hash value for this object.
*/
public int hashCode ()
@@ -306,15 +306,15 @@ public class ChoiceFormat extends NumberFormat
int hash = 0;
for (int i = 0; i < choiceLimits.length; ++i)
{
- long v = Double.doubleToLongBits(choiceLimits[i]);
- hash ^= (v ^ (v >>> 32));
- hash ^= choiceFormats[i].hashCode();
+ long v = Double.doubleToLongBits(choiceLimits[i]);
+ hash ^= (v ^ (v >>> 32));
+ hash ^= choiceFormats[i].hashCode();
}
return hash;
}
/**
- * This method returns the lowest possible double greater than the
+ * This method returns the lowest possible double greater than the
* specified double. If the specified double value is equal to
* <code>Double.NaN</code> then that is the value returned.
*
@@ -331,13 +331,13 @@ public class ChoiceFormat extends NumberFormat
* This method returns a double that is either the next highest double
* or next lowest double compared to the specified double depending on the
* value of the passed boolean parameter. If the boolean parameter is
- * <code>true</code>, then the lowest possible double greater than the
+ * <code>true</code>, then the lowest possible double greater than the
* specified double will be returned. Otherwise the highest possible
* double less than the specified double will be returned.
*
* @param d The specified double
* @param next <code>true</code> to return the next highest
- * double, <code>false</code> otherwise.
+ * double, <code>false</code> otherwise.
*
* @return The next highest or lowest double value.
*/
@@ -356,36 +356,36 @@ public class ChoiceFormat extends NumberFormat
if (next ^ (bits < 0)) // Increment magnitude
{
- if (mantissa == (1L << mantissaBits) - 1)
- {
- mantissa = 0L;
- exponent++;
-
- // Check for absolute overflow.
- if (exponent >= (1L << mantissaBits))
- return (bits > 0) ? Double.POSITIVE_INFINITY
- : Double.NEGATIVE_INFINITY;
- }
- else
- mantissa++;
+ if (mantissa == (1L << mantissaBits) - 1)
+ {
+ mantissa = 0L;
+ exponent++;
+
+ // Check for absolute overflow.
+ if (exponent >= (1L << mantissaBits))
+ return (bits > 0) ? Double.POSITIVE_INFINITY
+ : Double.NEGATIVE_INFINITY;
+ }
+ else
+ mantissa++;
}
else // Decrement magnitude
{
- if (exponent == 0L && mantissa == 0L)
- {
- // The only case where there is a change of sign
- return next ? Double.MIN_VALUE : -Double.MIN_VALUE;
- }
- else
- {
- if (mantissa == 0L)
- {
- mantissa = (1L << mantissaBits) - 1;
- exponent--;
- }
- else
- mantissa--;
- }
+ if (exponent == 0L && mantissa == 0L)
+ {
+ // The only case where there is a change of sign
+ return next ? Double.MIN_VALUE : -Double.MIN_VALUE;
+ }
+ else
+ {
+ if (mantissa == 0L)
+ {
+ mantissa = (1L << mantissaBits) - 1;
+ exponent--;
+ }
+ else
+ mantissa--;
+ }
}
long result = bits < 0 ? 1 : 0;
@@ -403,18 +403,18 @@ public class ChoiceFormat extends NumberFormat
int index = pos.getIndex();
for (int i = 0; i < choiceLimits.length; ++i)
{
- if (sourceStr.startsWith(choiceFormats[i], index))
- {
- pos.setIndex(index + choiceFormats[i].length());
- return Double.valueOf (choiceLimits[i]);
- }
+ if (sourceStr.startsWith(choiceFormats[i], index))
+ {
+ pos.setIndex(index + choiceFormats[i].length());
+ return Double.valueOf (choiceLimits[i]);
+ }
}
pos.setErrorIndex(index);
return Double.valueOf (Double.NaN);
}
/**
- * This method returns the highest possible double less than the
+ * This method returns the highest possible double less than the
* specified double. If the specified double value is equal to
* <code>Double.NaN</code> then that is the value returned.
*
@@ -449,26 +449,26 @@ public class ChoiceFormat extends NumberFormat
int max = text.length();
for (int i = 0; i < max; ++i)
{
- char c = text.charAt(i);
- if (c == '\'')
- {
- dest.append(c);
- dest.append(c);
- }
- else if (c == '#' || c == '|' || c == '\u2064' || c == '<')
- {
- dest.append('\'');
- dest.append(c);
- dest.append('\'');
- }
- else
- dest.append(c);
+ char c = text.charAt(i);
+ if (c == '\'')
+ {
+ dest.append(c);
+ dest.append(c);
+ }
+ else if (c == '#' || c == '|' || c == '\u2064' || c == '<')
+ {
+ dest.append('\'');
+ dest.append(c);
+ dest.append('\'');
+ }
+ else
+ dest.append(c);
}
}
/**
* This method returns the range terminator list and format string list
- * as a <code>String</code> suitable for using with the
+ * as a <code>String</code> suitable for using with the
* <code>applyPattern</code> method.
*
* @return A pattern string for this object
@@ -478,9 +478,9 @@ public class ChoiceFormat extends NumberFormat
CPStringBuilder result = new CPStringBuilder ();
for (int i = 0; i < choiceLimits.length; ++i)
{
- result.append(choiceLimits[i]);
- result.append('#');
- quoteString (result, choiceFormats[i]);
+ result.append(choiceLimits[i]);
+ result.append('#');
+ quoteString (result, choiceFormats[i]);
}
return result.toString();
}
diff --git a/java/text/CollationElementIterator.java b/java/text/CollationElementIterator.java
index f6e0022aa..0ca23d074 100644
--- a/java/text/CollationElementIterator.java
+++ b/java/text/CollationElementIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -48,11 +48,11 @@ import java.util.ArrayList;
*/
/**
- * This class walks through the character collation elements of a
- * <code>String</code> as defined by the collation rules in an instance of
+ * This class walks through the character collation elements of a
+ * <code>String</code> as defined by the collation rules in an instance of
* <code>RuleBasedCollator</code>. There is no public constructor for
* this class. An instance is created by calling the
- * <code>getCollationElementIterator</code> method on
+ * <code>getCollationElementIterator</code> method on
* <code>RuleBasedCollator</code>.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -62,7 +62,7 @@ import java.util.ArrayList;
public final class CollationElementIterator
{
/**
- * This is a constant value that is returned to indicate that the end of
+ * This is a constant value that is returned to indicate that the end of
* the string was encountered.
*/
public static final int NULLORDER = -1;
@@ -109,8 +109,8 @@ public final class CollationElementIterator
CollationElementIterator(RuleBasedCollator collator, String text)
{
this.collator = collator;
-
- setText (text);
+
+ setText (text);
}
/**
@@ -124,17 +124,17 @@ public final class CollationElementIterator
CollationElementIterator(RuleBasedCollator collator, CharacterIterator text)
{
this.collator = collator;
-
- setText (text);
+
+ setText (text);
}
RuleBasedCollator.CollationElement nextBlock()
{
if (index >= text_decomposition.length)
return null;
-
+
RuleBasedCollator.CollationElement e = text_decomposition[index];
-
+
textIndex = text_indexes[index+1];
index++;
@@ -146,12 +146,12 @@ public final class CollationElementIterator
{
if (index == 0)
return null;
-
+
index--;
RuleBasedCollator.CollationElement e = text_decomposition[index];
textIndex = text_indexes[index+1];
-
+
return e;
}
@@ -169,7 +169,7 @@ public final class CollationElementIterator
if (e == null)
return NULLORDER;
-
+
return e.getValue();
}
@@ -186,7 +186,7 @@ public final class CollationElementIterator
if (e == null)
return NULLORDER;
-
+
return e.getValue();
}
@@ -194,7 +194,7 @@ public final class CollationElementIterator
* This method returns the primary order value for the given collation
* value.
*
- * @param order The collation value returned from <code>next()</code> or
+ * @param order The collation value returned from <code>next()</code> or
* <code>previous()</code>.
*
* @return The primary order value of the specified collation value. This is
@@ -220,10 +220,10 @@ public final class CollationElementIterator
* This method returns the secondary order value for the given collation
* value.
*
- * @param order The collation value returned from <code>next()</code> or
+ * @param order The collation value returned from <code>next()</code> or
* <code>previous()</code>.
*
- * @return The secondary order value of the specified collation value. This
+ * @return The secondary order value of the specified collation value. This
* is the bits 8-15.
*/
public static short secondaryOrder(int order)
@@ -236,10 +236,10 @@ public final class CollationElementIterator
* This method returns the tertiary order value for the given collation
* value.
*
- * @param order The collation value returned from <code>next()</code> or
+ * @param order The collation value returned from <code>next()</code> or
* <code>previous()</code>.
*
- * @return The tertiary order value of the specified collation value. This
+ * @return The tertiary order value of the specified collation value. This
* is the low eight bits.
*/
public static short tertiaryOrder(int order)
@@ -274,136 +274,136 @@ public final class CollationElementIterator
// Build element collection ordered as they come in "text".
while (idx < work_text.length())
{
- String key, key_old;
-
- Object object = null;
- int p = 1;
-
- // IMPROVE: use a TreeMap with a prefix-ordering rule.
- key_old = key = null;
- do
- {
- if (object != null)
- key_old = key;
- key = work_text.substring (idx, idx+p);
- object = collator.prefix_tree.get (key);
- if (object != null && idx < alreadyExpanded)
- {
- RuleBasedCollator.CollationElement prefix = (RuleBasedCollator.CollationElement)object;
- if (prefix.expansion != null &&
- prefix.expansion.startsWith(work_text.substring(0, idx)))
- {
- object = null;
- key = key_old;
- }
- }
- p++;
- }
- while (idx+p <= work_text.length());
-
- if (object == null)
- key = key_old;
-
- RuleBasedCollator.CollationElement prefix =
- (RuleBasedCollator.CollationElement) collator.prefix_tree.get (key);
-
- /*
- * First case: There is no such sequence in the database.
- * We will have to build one from the context.
- */
- if (prefix == null)
- {
- /*
- * We are dealing with sequences in an expansion. They
- * are treated as accented characters (tertiary order).
- */
- if (alreadyExpanded > 0)
- {
- RuleBasedCollator.CollationElement e =
- collator.getDefaultAccentedElement (work_text.charAt (idx));
-
- a_element.add (e);
- a_idx.add (new Integer(idx_idx));
- idx++;
- alreadyExpanded--;
- if (alreadyExpanded == 0)
- {
- /* There is not any characters left in the expansion set.
- * We can increase the pointer in the source string.
- */
- idx_idx += idxToMove;
- idxToMove = 0;
- }
- else
- idx_idx++;
- }
- else
- {
- /* This is a normal character. */
- RuleBasedCollator.CollationElement e =
- collator.getDefaultElement (work_text.charAt (idx));
- Integer i_ref = new Integer(idx_idx);
-
- /* Don't forget to mark it as a special sequence so the
- * string can be ordered.
- */
- a_element.add (RuleBasedCollator.SPECIAL_UNKNOWN_SEQ);
- a_idx.add (i_ref);
- a_element.add (e);
- a_idx.add (i_ref);
- idx_idx++;
- idx++;
- }
- continue;
- }
-
- /*
- * Second case: Here we have found a matching sequence.
- * Here we have an expansion string prepend it to the "work text" and
- * add the corresponding sorting element. We must also mark
- */
- if (prefix.expansion != null)
- {
- work_text = prefix.expansion
- + work_text.substring (idx+prefix.key.length());
- idx = 0;
- a_element.add (prefix);
- a_idx.add (new Integer(idx_idx));
- if (alreadyExpanded == 0)
- idxToMove = prefix.key.length();
- alreadyExpanded += prefix.expansion.length()-prefix.key.length();
- }
- else
- {
- /* Third case: the simplest. We have got the prefix and it
- * has not to be expanded.
- */
- a_element.add (prefix);
- a_idx.add (new Integer(idx_idx));
- idx += prefix.key.length();
- /* If the sequence is in an expansion, we must decrease the
- * counter.
- */
- if (alreadyExpanded > 0)
- {
- alreadyExpanded -= prefix.key.length();
- if (alreadyExpanded == 0)
- {
- idx_idx += idxToMove;
- idxToMove = 0;
- }
- }
- else
- idx_idx += prefix.key.length();
- }
+ String key, key_old;
+
+ Object object = null;
+ int p = 1;
+
+ // IMPROVE: use a TreeMap with a prefix-ordering rule.
+ key_old = key = null;
+ do
+ {
+ if (object != null)
+ key_old = key;
+ key = work_text.substring (idx, idx+p);
+ object = collator.prefix_tree.get (key);
+ if (object != null && idx < alreadyExpanded)
+ {
+ RuleBasedCollator.CollationElement prefix = (RuleBasedCollator.CollationElement)object;
+ if (prefix.expansion != null &&
+ prefix.expansion.startsWith(work_text.substring(0, idx)))
+ {
+ object = null;
+ key = key_old;
+ }
+ }
+ p++;
+ }
+ while (idx+p <= work_text.length());
+
+ if (object == null)
+ key = key_old;
+
+ RuleBasedCollator.CollationElement prefix =
+ (RuleBasedCollator.CollationElement) collator.prefix_tree.get (key);
+
+ /*
+ * First case: There is no such sequence in the database.
+ * We will have to build one from the context.
+ */
+ if (prefix == null)
+ {
+ /*
+ * We are dealing with sequences in an expansion. They
+ * are treated as accented characters (tertiary order).
+ */
+ if (alreadyExpanded > 0)
+ {
+ RuleBasedCollator.CollationElement e =
+ collator.getDefaultAccentedElement (work_text.charAt (idx));
+
+ a_element.add (e);
+ a_idx.add (new Integer(idx_idx));
+ idx++;
+ alreadyExpanded--;
+ if (alreadyExpanded == 0)
+ {
+ /* There is not any characters left in the expansion set.
+ * We can increase the pointer in the source string.
+ */
+ idx_idx += idxToMove;
+ idxToMove = 0;
+ }
+ else
+ idx_idx++;
+ }
+ else
+ {
+ /* This is a normal character. */
+ RuleBasedCollator.CollationElement e =
+ collator.getDefaultElement (work_text.charAt (idx));
+ Integer i_ref = new Integer(idx_idx);
+
+ /* Don't forget to mark it as a special sequence so the
+ * string can be ordered.
+ */
+ a_element.add (RuleBasedCollator.SPECIAL_UNKNOWN_SEQ);
+ a_idx.add (i_ref);
+ a_element.add (e);
+ a_idx.add (i_ref);
+ idx_idx++;
+ idx++;
+ }
+ continue;
+ }
+
+ /*
+ * Second case: Here we have found a matching sequence.
+ * Here we have an expansion string prepend it to the "work text" and
+ * add the corresponding sorting element. We must also mark
+ */
+ if (prefix.expansion != null)
+ {
+ work_text = prefix.expansion
+ + work_text.substring (idx+prefix.key.length());
+ idx = 0;
+ a_element.add (prefix);
+ a_idx.add (new Integer(idx_idx));
+ if (alreadyExpanded == 0)
+ idxToMove = prefix.key.length();
+ alreadyExpanded += prefix.expansion.length()-prefix.key.length();
+ }
+ else
+ {
+ /* Third case: the simplest. We have got the prefix and it
+ * has not to be expanded.
+ */
+ a_element.add (prefix);
+ a_idx.add (new Integer(idx_idx));
+ idx += prefix.key.length();
+ /* If the sequence is in an expansion, we must decrease the
+ * counter.
+ */
+ if (alreadyExpanded > 0)
+ {
+ alreadyExpanded -= prefix.key.length();
+ if (alreadyExpanded == 0)
+ {
+ idx_idx += idxToMove;
+ idxToMove = 0;
+ }
+ }
+ else
+ idx_idx += prefix.key.length();
+ }
}
-
+
text_decomposition = (RuleBasedCollator.CollationElement[])
- a_element.toArray(new RuleBasedCollator.CollationElement[a_element.size()]);
+ a_element.toArray(new RuleBasedCollator.CollationElement[a_element.size()]);
text_indexes = new int[a_idx.size()+1];
- for (int i = 0; i < a_idx.size(); i++)
+ for (int i = 0; i < a_idx.size(); i++)
{
- text_indexes[i] = ((Integer)a_idx.get(i)).intValue();
+ text_indexes[i] = ((Integer)a_idx.get(i)).intValue();
}
text_indexes[a_idx.size()] = text.length();
}
@@ -422,8 +422,8 @@ public final class CollationElementIterator
// For now assume we read from the beginning of the string.
for (char c = source.first();
- c != CharacterIterator.DONE;
- c = source.next())
+ c != CharacterIterator.DONE;
+ c = source.next())
expand.append(c);
setText(expand.toString());
@@ -459,11 +459,11 @@ public final class CollationElementIterator
if (offset > (text.getEndIndex() - 1))
throw new IllegalArgumentException("Offset too large: " + offset);
-
+
for (index = 0; index < text_decomposition.length; index++)
- {
- if (offset <= text_indexes[index])
- break;
+ {
+ if (offset <= text_indexes[index])
+ break;
}
/*
* As text_indexes[0] == 0, we should not have to take care whether index is
diff --git a/java/text/CollationKey.java b/java/text/CollationKey.java
index 1ae8abc55..ce9db5f0d 100644
--- a/java/text/CollationKey.java
+++ b/java/text/CollationKey.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -53,11 +53,11 @@ import java.util.Arrays;
* <code>Collator</code> in a manner than is usually more efficient than
* using the raw <code>Collator</code> compare methods. There is overhead
* associated with calculating this value, so it is generally not
- * advisable to compute <code>CollationKey</code>'s unless multiple
+ * advisable to compute <code>CollationKey</code>'s unless multiple
* comparisons against a <code>String</code> will be done. (For example,
* in a sort routine).
* <p>
- * This class cannot be instantiated directly. Instead, a
+ * This class cannot be instantiated directly. Instead, a
* <code>CollationKey</code> is created by calling the
* <code>getCollationKey</code> method on an instance of <code>Collator</code>.
*
@@ -90,8 +90,8 @@ public class CollationKey implements Comparable<CollationKey>
}
/**
- * This method compares the specified object to this one. An integer is
- * returned which indicates whether the specified object is less than,
+ * This method compares the specified object to this one. An integer is
+ * returned which indicates whether the specified object is less than,
* greater than, or equal to this object.
*
* @param ck The <code>CollationKey</code> to compare against this one.
@@ -104,8 +104,8 @@ public class CollationKey implements Comparable<CollationKey>
for (int i = 0; i < max; ++i)
{
- if (key[i] != ck.key[i])
- return key[i] - ck.key[i];
+ if (key[i] != ck.key[i])
+ return key[i] - ck.key[i];
}
return key.length - ck.key.length;
@@ -173,7 +173,7 @@ public class CollationKey implements Comparable<CollationKey>
h ^= key[i] * (i + 1);
return (int) ((h >> 32) ^ h);
}
-
+
/**
* This method returns the collation bit sequence as a byte array.
*
diff --git a/java/text/Collator.java b/java/text/Collator.java
index d6cb5ac0e..a9fc55ccf 100644
--- a/java/text/Collator.java
+++ b/java/text/Collator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -49,14 +49,14 @@ import java.util.ResourceBundle;
import java.util.ServiceLoader;
/**
- * This class is the abstract superclass of classes which perform
+ * This class is the abstract superclass of classes which perform
* locale dependent <code>String</code> comparisons. A caller requests
* an instance of <code>Collator</code> for a particular locale using
* the <code>getInstance()</code> static method in this class. That method
* will return a locale specific subclass of <code>Collator</code> which
* can be used to perform <code>String</code> comparisons for that locale.
* If a subclass of <code>Collator</code> cannot be located for a particular
- * locale, a default instance for the current locale will be returned.
+ * locale, a default instance for the current locale will be returned.
*
* In addition to setting the correct locale, there are two additional
* settings that can be adjusted to affect <code>String</code> comparisons:
@@ -82,7 +82,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* are considered to have a primary difference.
*/
public static final int PRIMARY = 0;
-
+
/**
* This constant is a strength value which indicates that only secondary
* or primary differences between characters will be considered
@@ -90,7 +90,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* are instances of the same letter with different accented forms.
*/
public static final int SECONDARY = 1;
-
+
/**
* This constant is a strength value which indicates that tertiary,
* secondary, and primary differences will be considered during sorting.
@@ -98,13 +98,13 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* This is the default value for the strength setting.
*/
public static final int TERTIARY = 2;
-
+
/**
* This constant is a strength value which indicates that any difference
* at all between character values are considered significant.
*/
public static final int IDENTICAL = 3;
-
+
/**
* This constant indicates that accented characters won't be decomposed
* when performing comparisons. This will yield the fastest results, but
@@ -112,7 +112,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* use accents such as English.
*/
public static final int NO_DECOMPOSITION = 0;
-
+
/**
* This constant indicates that only characters which are canonical variants
* in Unicode 2.0 will be decomposed prior to performing comparisons. This
@@ -120,7 +120,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* default decomposition value.
*/
public static final int CANONICAL_DECOMPOSITION = 1;
-
+
/**
* This constant indicates that both canonical variants and compatibility
* variants in Unicode 2.0 will be decomposed prior to performing
@@ -131,7 +131,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
/**
* This method initializes a new instance of <code>Collator</code> to have
- * the default strength (TERTIARY) and decomposition
+ * the default strength (TERTIARY) and decomposition
* (CANONICAL_DECOMPOSITION) settings. This constructor is protected and
* is for use by subclasses only. Non-subclass callers should use the
* static <code>getInstance()</code> methods of this class to instantiate
@@ -147,7 +147,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* This method compares the two <code>String</code>'s and returns an
* integer indicating whether or not the first argument is less than,
* equal to, or greater than the second argument. The comparison is
- * performed according to the rules of the locale for this
+ * performed according to the rules of the locale for this
* <code>Collator</code> and the strength and decomposition rules in
* effect.
*
@@ -155,7 +155,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* @param target The second object to compare
*
* @return A negative integer if str1 &lt; str2, 0 if str1 == str2, or
- * a positive integer if str1 &gt; str2.
+ * a positive integer if str1 &gt; str2.
*/
public abstract int compare (String source, String target);
@@ -169,10 +169,10 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* @param o2 The second object to compare
*
* @return A negative integer if obj1 &lt; obj2, 0 if obj1 == obj2, or
- * a positive integer if obj1 &gt; obj2.
+ * a positive integer if obj1 &gt; obj2.
*
* @exception ClassCastException If the arguments are not instances
- * of <code>String</code>.
+ * of <code>String</code>.
*/
public int compare (Object o1, Object o2)
{
@@ -191,7 +191,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* </ul>
*
* @param obj The <code>Object</code> to test for equality against
- * this object.
+ * this object.
*
* @return <code>true</code> if the specified object is equal to
* this one, <code>false</code> otherwise.
@@ -213,7 +213,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* @param target The second <code>String</code> to compare
*
* @return <code>true</code> if the two strings are equal,
- * <code>false</code> otherwise.
+ * <code>false</code> otherwise.
*/
public boolean equals (String source, String target)
{
@@ -229,11 +229,11 @@ public abstract class Collator implements Comparator<Object>, Cloneable
{
try
{
- return super.clone ();
+ return super.clone ();
}
catch (CloneNotSupportedException _)
{
- return null;
+ return null;
}
}
@@ -300,46 +300,46 @@ public abstract class Collator implements Comparator<Object>, Cloneable
String pattern;
try
{
- ResourceBundle res =
- ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- loc, ClassLoader.getSystemClassLoader());
- return new RuleBasedCollator(res.getString("collation_rules"));
+ ResourceBundle res =
+ ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+ loc, ClassLoader.getSystemClassLoader());
+ return new RuleBasedCollator(res.getString("collation_rules"));
}
catch (MissingResourceException x)
{
- /* This means runtime support for the locale
- * is not available, so we check providers. */
+ /* This means runtime support for the locale
+ * is not available, so we check providers. */
}
catch (ParseException x)
{
- throw (InternalError)new InternalError().initCause(x);
+ throw (InternalError)new InternalError().initCause(x);
}
for (CollatorProvider p : ServiceLoader.load(CollatorProvider.class))
{
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(loc))
- {
- Collator c = p.getInstance(loc);
- if (c != null)
- return c;
- break;
- }
- }
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(loc))
+ {
+ Collator c = p.getInstance(loc);
+ if (c != null)
+ return c;
+ break;
+ }
+ }
}
if (loc.equals(Locale.ROOT))
{
- try
- {
- return new RuleBasedCollator("<0<1<2<3<4<5<6<7<8<9<A,a<b,B<c," +
- "C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K" +
- "<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,"+
- "T<u,U<v,V<w,W<x,X<y,Y<z,Z");
- }
- catch (ParseException x)
- {
- throw (InternalError)new InternalError().initCause(x);
- }
+ try
+ {
+ return new RuleBasedCollator("<0<1<2<3<4<5<6<7<8<9<A,a<b,B<c," +
+ "C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K" +
+ "<l,L<m,M<n,N<o,O<p,P<q,Q<r,R<s,S<t,"+
+ "T<u,U<v,V<w,W<x,X<y,Y<z,Z");
+ }
+ catch (ParseException x)
+ {
+ throw (InternalError)new InternalError().initCause(x);
+ }
}
return getInstance(LocaleHelper.getFallbackLocale(loc));
}
@@ -378,8 +378,8 @@ public abstract class Collator implements Comparator<Object>, Cloneable
public synchronized void setDecomposition (int mode)
{
if (mode != NO_DECOMPOSITION
- && mode != CANONICAL_DECOMPOSITION
- && mode != FULL_DECOMPOSITION)
+ && mode != CANONICAL_DECOMPOSITION
+ && mode != FULL_DECOMPOSITION)
throw new IllegalArgumentException ();
decmp = mode;
}
@@ -389,7 +389,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
* value. This must be one of PRIMARY, SECONDARY, TERTIARY, or IDENTICAL.
* Otherwise an exception is thrown. See the documentation for these
* constants for an explanation of this setting.
- *
+ *
* @param strength The new strength setting.
*
* @exception IllegalArgumentException If the requested strength
@@ -398,7 +398,7 @@ public abstract class Collator implements Comparator<Object>, Cloneable
public synchronized void setStrength (int strength)
{
if (strength != PRIMARY && strength != SECONDARY
- && strength != TERTIARY && strength != IDENTICAL)
+ && strength != TERTIARY && strength != IDENTICAL)
throw new IllegalArgumentException ();
this.strength = strength;
}
diff --git a/java/text/DateFormat.java b/java/text/DateFormat.java
index dabcb8670..1757a0cb9 100644
--- a/java/text/DateFormat.java
+++ b/java/text/DateFormat.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -89,11 +89,11 @@ public abstract class DateFormat extends Format implements Cloneable
/**
* Represents the position of the era
* pattern character in the array of
- * localized pattern characters.
+ * localized pattern characters.
* For example, 'AD' is an era used
* in the Gregorian calendar system.
* In the U.S. locale, this is 'G'.
- */
+ */
public static final int ERA_FIELD = 0;
/**
* Represents the position of the year
@@ -197,7 +197,7 @@ public abstract class DateFormat extends Format implements Cloneable
*/
public static final int AM_PM_FIELD = 14;
/**
- * Represents the position of the 12
+ * Represents the position of the 12
* hour pattern character in the array of
* localized pattern characters.
* In the U.S. locale, this is 'h'.
@@ -205,7 +205,7 @@ public abstract class DateFormat extends Format implements Cloneable
*/
public static final int HOUR1_FIELD = 15;
/**
- * Represents the position of the 12
+ * Represents the position of the 12
* hour pattern character in the array of
* localized pattern characters.
* In the U.S. locale, this is 'K'.
@@ -223,45 +223,45 @@ public abstract class DateFormat extends Format implements Cloneable
public static class Field extends Format.Field
{
static final long serialVersionUID = 7441350119349544720L;
-
+
private int calendarField;
public static final DateFormat.Field ERA
- = new Field("era", Calendar.ERA);
+ = new Field("era", Calendar.ERA);
public static final DateFormat.Field YEAR
- = new Field("year", Calendar.YEAR);
+ = new Field("year", Calendar.YEAR);
public static final DateFormat.Field MONTH
- = new Field("month", Calendar.MONTH);
+ = new Field("month", Calendar.MONTH);
public static final DateFormat.Field DAY_OF_MONTH
- = new Field("day of month", Calendar.DAY_OF_MONTH);
+ = new Field("day of month", Calendar.DAY_OF_MONTH);
public static final DateFormat.Field HOUR_OF_DAY1
- = new Field("hour of day 1", Calendar.HOUR_OF_DAY);
+ = new Field("hour of day 1", Calendar.HOUR_OF_DAY);
public static final DateFormat.Field HOUR_OF_DAY0
- = new Field("hour of day 0", Calendar.HOUR_OF_DAY);
+ = new Field("hour of day 0", Calendar.HOUR_OF_DAY);
public static final DateFormat.Field MINUTE
- = new Field("minute", Calendar.MINUTE);
+ = new Field("minute", Calendar.MINUTE);
public static final DateFormat.Field SECOND
- = new Field("second", Calendar.SECOND);
+ = new Field("second", Calendar.SECOND);
public static final DateFormat.Field MILLISECOND
- = new Field("millisecond", Calendar.MILLISECOND);
+ = new Field("millisecond", Calendar.MILLISECOND);
public static final DateFormat.Field DAY_OF_WEEK
- = new Field("day of week", Calendar.DAY_OF_WEEK);
+ = new Field("day of week", Calendar.DAY_OF_WEEK);
public static final DateFormat.Field DAY_OF_YEAR
- = new Field("day of year", Calendar.DAY_OF_YEAR);
+ = new Field("day of year", Calendar.DAY_OF_YEAR);
public static final DateFormat.Field DAY_OF_WEEK_IN_MONTH
- = new Field("day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH);
+ = new Field("day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH);
public static final DateFormat.Field WEEK_OF_YEAR
- = new Field("week of year", Calendar.WEEK_OF_YEAR);
+ = new Field("week of year", Calendar.WEEK_OF_YEAR);
public static final DateFormat.Field WEEK_OF_MONTH
- = new Field("week of month", Calendar.WEEK_OF_MONTH);
+ = new Field("week of month", Calendar.WEEK_OF_MONTH);
public static final DateFormat.Field AM_PM
- = new Field("am/pm", Calendar.AM_PM);
+ = new Field("am/pm", Calendar.AM_PM);
public static final DateFormat.Field HOUR1
- = new Field("hour1", Calendar.HOUR);
+ = new Field("hour1", Calendar.HOUR);
public static final DateFormat.Field HOUR0
- = new Field("hour0", Calendar.HOUR);
+ = new Field("hour0", Calendar.HOUR);
public static final DateFormat.Field TIME_ZONE
- = new Field("timezone", Calendar.ZONE_OFFSET);
+ = new Field("timezone", Calendar.ZONE_OFFSET);
static final DateFormat.Field[] allFields =
{
@@ -283,7 +283,7 @@ public abstract class DateFormat extends Format implements Cloneable
super(name);
this.calendarField = calendarField;
}
-
+
public int getCalendarField()
{
return calendarField;
@@ -292,20 +292,20 @@ public abstract class DateFormat extends Format implements Cloneable
public static Field ofCalendarField(int calendarField)
{
if (calendarField >= allFields.length || calendarField < 0)
- throw new IllegalArgumentException("no such calendar field ("
- + calendarField + ")");
-
+ throw new IllegalArgumentException("no such calendar field ("
+ + calendarField + ")");
+
return allFields[calendarField];
}
-
+
protected Object readResolve() throws InvalidObjectException
{
String s = getName();
for (int i=0;i<allFields.length;i++)
- if (s.equals(allFields[i].getName()))
- return allFields[i];
-
+ if (s.equals(allFields[i].getName()))
+ return allFields[i];
+
throw new InvalidObjectException("no such DateFormat field called " + s);
}
}
@@ -327,7 +327,7 @@ public abstract class DateFormat extends Format implements Cloneable
* <li>Is an instance of <code>DateFormat</code>.</li>
* <li>Has equal numberFormat field as this object.</li>
* <li>Has equal (Calendar) TimeZone rules as this object.</li>
- * <li>Has equal (Calendar) isLenient results.</li>
+ * <li>Has equal (Calendar) isLenient results.</li>
* <li>Has equal Calendar first day of week and minimal days in week
* values.</li>
* </ul>
@@ -339,7 +339,7 @@ public abstract class DateFormat extends Format implements Cloneable
* are not taken into account.
*
* @param obj The object to test for equality against.
- *
+ *
* @return <code>true</code> if the specified object is equal to this object,
* <code>false</code> otherwise.
*/
@@ -353,18 +353,18 @@ public abstract class DateFormat extends Format implements Cloneable
TimeZone tzd = d.getTimeZone();
if (tz.hasSameRules(tzd))
if (isLenient() == d.isLenient())
- {
- Calendar c = getCalendar();
- Calendar cd = d.getCalendar();
- if ((c == null && cd == null)
- ||
- (c.getFirstDayOfWeek() == cd.getFirstDayOfWeek()
- &&
- c.getMinimalDaysInFirstWeek()
- == cd.getMinimalDaysInFirstWeek()))
- return ((numberFormat == null && d.numberFormat == null)
- || numberFormat.equals(d.numberFormat));
- }
+ {
+ Calendar c = getCalendar();
+ Calendar cd = d.getCalendar();
+ if ((c == null && cd == null)
+ ||
+ (c.getFirstDayOfWeek() == cd.getFirstDayOfWeek()
+ &&
+ c.getMinimalDaysInFirstWeek()
+ == cd.getMinimalDaysInFirstWeek()))
+ return ((numberFormat == null && d.numberFormat == null)
+ || numberFormat.equals(d.numberFormat));
+ }
return false;
}
@@ -397,19 +397,19 @@ public abstract class DateFormat extends Format implements Cloneable
* formatted date/time appended.
*/
public final StringBuffer format (Object obj,
- StringBuffer buf, FieldPosition pos)
+ StringBuffer buf, FieldPosition pos)
{
if (obj instanceof Number)
obj = new Date(((Number) obj).longValue());
else if (! (obj instanceof Date))
throw new IllegalArgumentException
- ("Cannot format given Object as a Date");
+ ("Cannot format given Object as a Date");
return format ((Date) obj, buf, pos);
}
- /**
- * Formats the date argument according to the pattern specified.
+ /**
+ * Formats the date argument according to the pattern specified.
*
* @param date The formatted date.
*/
@@ -434,7 +434,7 @@ public abstract class DateFormat extends Format implements Cloneable
* formatted date/time appended.
*/
public abstract StringBuffer format (Date date,
- StringBuffer buf, FieldPosition pos);
+ StringBuffer buf, FieldPosition pos);
/**
* This method returns a list of available locales supported by this
@@ -474,136 +474,136 @@ public abstract class DateFormat extends Format implements Cloneable
ResourceBundle res =
ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- loc, ClassLoader.getSystemClassLoader());
+ loc, ClassLoader.getSystemClassLoader());
String pattern = null;
if (use_date)
{
- String name, def;
- switch (dateStyle)
- {
- case FULL:
- name = "fullDateFormat";
- def = "EEEE MMMM d, yyyy G";
- break;
- case LONG:
- name = "longDateFormat";
- def = "MMMM d, yyyy";
- break;
- case MEDIUM:
- name = "mediumDateFormat";
- def = "d-MMM-yy";
- break;
- case SHORT:
- name = "shortDateFormat";
- def = "M/d/yy";
- break;
- default:
- throw new IllegalArgumentException ();
- }
- try
- {
- pattern = res == null ? def : res.getString(name);
- }
- catch (MissingResourceException x)
- {
- pattern = def;
- }
+ String name, def;
+ switch (dateStyle)
+ {
+ case FULL:
+ name = "fullDateFormat";
+ def = "EEEE MMMM d, yyyy G";
+ break;
+ case LONG:
+ name = "longDateFormat";
+ def = "MMMM d, yyyy";
+ break;
+ case MEDIUM:
+ name = "mediumDateFormat";
+ def = "d-MMM-yy";
+ break;
+ case SHORT:
+ name = "shortDateFormat";
+ def = "M/d/yy";
+ break;
+ default:
+ throw new IllegalArgumentException ();
+ }
+ try
+ {
+ pattern = res == null ? def : res.getString(name);
+ }
+ catch (MissingResourceException x)
+ {
+ pattern = def;
+ }
}
if (use_time)
{
- if (pattern == null)
- pattern = "";
- else
- pattern += " ";
-
- String name, def;
- switch (timeStyle)
- {
- case FULL:
- name = "fullTimeFormat";
- def = "h:mm:ss;S 'o''clock' a z";
- break;
- case LONG:
- name = "longTimeFormat";
- def = "h:mm:ss a z";
- break;
- case MEDIUM:
- name = "mediumTimeFormat";
- def = "h:mm:ss a";
- break;
- case SHORT:
- name = "shortTimeFormat";
- def = "h:mm a";
- break;
- default:
- throw new IllegalArgumentException ();
- }
-
- String s;
- try
- {
- s = res == null ? def : res.getString(name);
- }
- catch (MissingResourceException x)
- {
- s = def;
- }
- pattern += s;
+ if (pattern == null)
+ pattern = "";
+ else
+ pattern += " ";
+
+ String name, def;
+ switch (timeStyle)
+ {
+ case FULL:
+ name = "fullTimeFormat";
+ def = "h:mm:ss;S 'o''clock' a z";
+ break;
+ case LONG:
+ name = "longTimeFormat";
+ def = "h:mm:ss a z";
+ break;
+ case MEDIUM:
+ name = "mediumTimeFormat";
+ def = "h:mm:ss a";
+ break;
+ case SHORT:
+ name = "shortTimeFormat";
+ def = "h:mm a";
+ break;
+ default:
+ throw new IllegalArgumentException ();
+ }
+
+ String s;
+ try
+ {
+ s = res == null ? def : res.getString(name);
+ }
+ catch (MissingResourceException x)
+ {
+ s = def;
+ }
+ pattern += s;
}
return new SimpleDateFormat (pattern, loc);
}
private static DateFormat computeDefault (int dateStyle, int timeStyle,
- boolean use_date, boolean use_time)
+ boolean use_date, boolean use_time)
{
String pattern = null;
if (use_date)
{
- switch (dateStyle)
- {
- case FULL:
- pattern = "EEEE MMMM d, yyyy G";
- break;
- case LONG:
- pattern = "MMMM d, yyyy";
- break;
- case MEDIUM:
- pattern = "d-MMM-yy";
- break;
- case SHORT:
- pattern = "M/d/yy";
- default:
- throw new IllegalArgumentException ();
- }
+ switch (dateStyle)
+ {
+ case FULL:
+ pattern = "EEEE MMMM d, yyyy G";
+ break;
+ case LONG:
+ pattern = "MMMM d, yyyy";
+ break;
+ case MEDIUM:
+ pattern = "d-MMM-yy";
+ break;
+ case SHORT:
+ pattern = "M/d/yy";
+ default:
+ throw new IllegalArgumentException ();
+ }
}
-
+
if (use_time)
{
- if (pattern == null)
- pattern = "";
- else
- pattern += " ";
-
- switch (timeStyle)
- {
- case FULL:
- pattern += "h:mm:ss;S 'o''clock' a z";
- break;
- case LONG:
- pattern += "h:mm:ss a z";
- break;
- case MEDIUM:
- pattern += "h:mm:ss a";
- break;
- case SHORT:
- pattern += "h:mm a";
- break;
- default:
- throw new IllegalArgumentException ();
- }
+ if (pattern == null)
+ pattern = "";
+ else
+ pattern += " ";
+
+ switch (timeStyle)
+ {
+ case FULL:
+ pattern += "h:mm:ss;S 'o''clock' a z";
+ break;
+ case LONG:
+ pattern += "h:mm:ss a z";
+ break;
+ case MEDIUM:
+ pattern += "h:mm:ss a";
+ break;
+ case SHORT:
+ pattern += "h:mm a";
+ break;
+ default:
+ throw new IllegalArgumentException ();
+ }
}
return new SimpleDateFormat (pattern, Locale.ROOT);
@@ -624,8 +624,8 @@ public abstract class DateFormat extends Format implements Cloneable
* This method returns an instance of <code>DateFormat</code> that will
* format using the specified formatting style for dates.
*
- * @param style The type of formatting to perform.
- *
+ * @param style The type of formatting to perform.
+ *
* @return A new <code>DateFormat</code> instance.
*/
public static final DateFormat getDateInstance (int style)
@@ -638,35 +638,35 @@ public abstract class DateFormat extends Format implements Cloneable
* format using the specified formatting style for dates. The specified
* localed will be used in place of the default.
*
- * @param style The type of formatting to perform.
+ * @param style The type of formatting to perform.
* @param loc The desired locale.
- *
+ *
* @return A new <code>DateFormat</code> instance.
*/
public static final DateFormat getDateInstance (int style, Locale loc)
{
try
{
- return computeInstance (style, loc, true, false);
+ return computeInstance (style, loc, true, false);
}
catch (MissingResourceException e)
{
- for (DateFormatProvider p :
- ServiceLoader.load(DateFormatProvider.class))
- {
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(loc))
- {
- DateFormat df = p.getDateInstance(style, loc);
- if (df != null)
- return df;
- break;
- }
- }
- }
- return getDateInstance(style,
- LocaleHelper.getFallbackLocale(loc));
+ for (DateFormatProvider p :
+ ServiceLoader.load(DateFormatProvider.class))
+ {
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(loc))
+ {
+ DateFormat df = p.getDateInstance(style, loc);
+ if (df != null)
+ return df;
+ break;
+ }
+ }
+ }
+ return getDateInstance(style,
+ LocaleHelper.getFallbackLocale(loc));
}
}
@@ -687,8 +687,8 @@ public abstract class DateFormat extends Format implements Cloneable
*
* @return A new <code>DateFormat</code>instance.
*/
- public static final DateFormat getDateTimeInstance (int dateStyle,
- int timeStyle)
+ public static final DateFormat getDateTimeInstance (int dateStyle,
+ int timeStyle)
{
return getDateTimeInstance (dateStyle, timeStyle, Locale.getDefault());
}
@@ -696,39 +696,39 @@ public abstract class DateFormat extends Format implements Cloneable
/**
* This method returns a new instance of <code>DateFormat</code> that
* formats both dates and times using the specified styles.
- *
+ *
* @param dateStyle The desired style for date formatting.
* @param timeStyle The desired style for time formatting
*
* @return A new <code>DateFormat</code>instance.
*/
- public static final DateFormat getDateTimeInstance (int dateStyle,
- int timeStyle,
- Locale loc)
+ public static final DateFormat getDateTimeInstance (int dateStyle,
+ int timeStyle,
+ Locale loc)
{
try
{
- return computeInstance (dateStyle, timeStyle, loc, true, true);
+ return computeInstance (dateStyle, timeStyle, loc, true, true);
}
catch (MissingResourceException e)
{
- for (DateFormatProvider p :
- ServiceLoader.load(DateFormatProvider.class))
- {
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(loc))
- {
- DateFormat df = p.getDateTimeInstance(dateStyle,
- timeStyle, loc);
- if (df != null)
- return df;
- break;
- }
- }
- }
- return getDateTimeInstance(dateStyle, timeStyle,
- LocaleHelper.getFallbackLocale(loc));
+ for (DateFormatProvider p :
+ ServiceLoader.load(DateFormatProvider.class))
+ {
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(loc))
+ {
+ DateFormat df = p.getDateTimeInstance(dateStyle,
+ timeStyle, loc);
+ if (df != null)
+ return df;
+ break;
+ }
+ }
+ }
+ return getDateTimeInstance(dateStyle, timeStyle,
+ LocaleHelper.getFallbackLocale(loc));
}
}
@@ -770,8 +770,8 @@ public abstract class DateFormat extends Format implements Cloneable
* This method returns an instance of <code>DateFormat</code> that will
* format using the specified formatting style for times.
*
- * @param style The type of formatting to perform.
- *
+ * @param style The type of formatting to perform.
+ *
* @return A new <code>DateFormat</code> instance.
*/
public static final DateFormat getTimeInstance (int style)
@@ -784,35 +784,35 @@ public abstract class DateFormat extends Format implements Cloneable
* format using the specified formatting style for times. The specified
* localed will be used in place of the default.
*
- * @param style The type of formatting to perform.
+ * @param style The type of formatting to perform.
* @param loc The desired locale.
- *
+ *
* @return A new <code>DateFormat</code> instance.
*/
public static final DateFormat getTimeInstance (int style, Locale loc)
{
try
{
- return computeInstance (style, loc, false, true);
+ return computeInstance (style, loc, false, true);
}
catch (MissingResourceException e)
{
- for (DateFormatProvider p :
- ServiceLoader.load(DateFormatProvider.class))
- {
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(loc))
- {
- DateFormat df = p.getTimeInstance(style, loc);
- if (df != null)
- return df;
- break;
- }
- }
- }
- return getTimeInstance(style,
- LocaleHelper.getFallbackLocale(loc));
+ for (DateFormatProvider p :
+ ServiceLoader.load(DateFormatProvider.class))
+ {
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(loc))
+ {
+ DateFormat df = p.getTimeInstance(style, loc);
+ if (df != null)
+ return df;
+ break;
+ }
+ }
+ }
+ return getTimeInstance(style,
+ LocaleHelper.getFallbackLocale(loc));
}
}
@@ -829,7 +829,7 @@ public abstract class DateFormat extends Format implements Cloneable
/**
* This method returns a hash value for this object.
- *
+ *
* @return A hash value for this object.
*/
public int hashCode ()
@@ -866,17 +866,17 @@ public abstract class DateFormat extends Format implements Cloneable
Date result = parse (source, pos);
if (result == null)
{
- int index = pos.getErrorIndex();
- if (index < 0)
- index = pos.getIndex();
- throw new ParseException("invalid Date syntax in \""
- + source + '\"', index);
+ int index = pos.getErrorIndex();
+ if (index < 0)
+ index = pos.getIndex();
+ throw new ParseException("invalid Date syntax in \""
+ + source + '\"', index);
}
return result;
}
- /**
- * This method parses the specified <code>String</code> into a
+ /**
+ * This method parses the specified <code>String</code> into a
* <code>Date</code>. The <code>pos</code> argument contains the
* starting parse position on method entry and the ending parse
* position on method exit.
@@ -894,7 +894,7 @@ public abstract class DateFormat extends Format implements Cloneable
* This method is identical to <code>parse(String, ParsePosition)</code>,
* but returns its result as an <code>Object</code> instead of a
* <code>Date</code>.
- *
+ *
* @param source The string to parse.
* @param pos The starting parse position in entry, the ending parse
* position on exit.
@@ -908,7 +908,7 @@ public abstract class DateFormat extends Format implements Cloneable
}
/**
- * This method specified the <code>Calendar</code> that should be used
+ * This method specified the <code>Calendar</code> that should be used
* by this object to parse/format datetimes.
*
* @param calendar The new <code>Calendar</code> for this object.
@@ -921,7 +921,7 @@ public abstract class DateFormat extends Format implements Cloneable
}
/**
- * This method specifies whether or not this object should be lenient in
+ * This method specifies whether or not this object should be lenient in
* the syntax it accepts while parsing date/time values.
*
* @param lenient <code>true</code> if parsing should be lenient,
diff --git a/java/text/DateFormatSymbols.java b/java/text/DateFormatSymbols.java
index ed953dd07..c22dd38f7 100644
--- a/java/text/DateFormatSymbols.java
+++ b/java/text/DateFormatSymbols.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -89,7 +89,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
static
{
properties = new Properties();
- try
+ try
{
properties.load(DateFormatSymbols.class.getResourceAsStream("metazones.properties"));
}
@@ -126,7 +126,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
transient String[] timeFormats;
private static String[] getStringArray(ResourceBundle res, String name)
- {
+ {
return res.getString(name).split("\u00ae");
}
@@ -135,116 +135,116 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
List<String[]> allZones = new ArrayList<String[]>();
try
{
- Map<String,String[]> systemZones = new HashMap<String,String[]>();
- while (true)
- {
- int index = 0;
- String country = locale.getCountry();
- String data = res.getString("zoneStrings");
- String[] zones = data.split("\u00a9");
- for (int a = 0; a < zones.length; ++a)
- {
- String[] strings = zones[a].split("\u00ae");
- String type = properties.getProperty(strings[0] + "." + country);
- if (type == null)
- type = properties.getProperty(strings[0] + ".DEFAULT");
- if (type != null)
- strings[0] = type;
- if (strings.length < 5)
- {
- String[] newStrings = new String[5];
- System.arraycopy(strings, 0, newStrings, 0, strings.length);
- for (int b = strings.length; b < newStrings.length; ++b)
- newStrings[b] = "";
- strings = newStrings;
- }
- String[] existing = systemZones.get(strings[0]);
- if (existing != null && existing.length > 1)
- {
- for (int b = 1; b < existing.length; ++b)
- if (!existing[b].equals(""))
- strings[b] = existing[b];
- }
- systemZones.put(strings[0], strings);
- }
- if (res.getLocale() == Locale.ROOT)
- break;
- else
- res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- LocaleHelper.getFallbackLocale(res.getLocale()),
- ClassLoader.getSystemClassLoader());
- }
- /* Final sanity check for missing values */
- for (String[] zstrings : systemZones.values())
- {
- if (zstrings[1].equals("") && zstrings[2].equals(""))
- {
- for (Map.Entry<Object,Object> entry : properties.entrySet())
- {
- String val = (String) entry.getValue();
- if (val.equals(zstrings[0]))
- {
- String key = (String) entry.getKey();
- String metazone = key.substring(0, key.indexOf("."));
- String type = properties.getProperty(metazone + "." + locale.getCountry());
- if (type == null)
- type = properties.getProperty(metazone + ".DEFAULT");
- if (type != null)
- {
- String[] ostrings = systemZones.get(type);
- zstrings[1] = ostrings[1];
- zstrings[2] = ostrings[2];
- }
- }
- }
- }
- }
- allZones.addAll(systemZones.values());
+ Map<String,String[]> systemZones = new HashMap<String,String[]>();
+ while (true)
+ {
+ int index = 0;
+ String country = locale.getCountry();
+ String data = res.getString("zoneStrings");
+ String[] zones = data.split("\u00a9");
+ for (int a = 0; a < zones.length; ++a)
+ {
+ String[] strings = zones[a].split("\u00ae");
+ String type = properties.getProperty(strings[0] + "." + country);
+ if (type == null)
+ type = properties.getProperty(strings[0] + ".DEFAULT");
+ if (type != null)
+ strings[0] = type;
+ if (strings.length < 5)
+ {
+ String[] newStrings = new String[5];
+ System.arraycopy(strings, 0, newStrings, 0, strings.length);
+ for (int b = strings.length; b < newStrings.length; ++b)
+ newStrings[b] = "";
+ strings = newStrings;
+ }
+ String[] existing = systemZones.get(strings[0]);
+ if (existing != null && existing.length > 1)
+ {
+ for (int b = 1; b < existing.length; ++b)
+ if (!existing[b].equals(""))
+ strings[b] = existing[b];
+ }
+ systemZones.put(strings[0], strings);
+ }
+ if (res.getLocale() == Locale.ROOT)
+ break;
+ else
+ res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+ LocaleHelper.getFallbackLocale(res.getLocale()),
+ ClassLoader.getSystemClassLoader());
+ }
+ /* Final sanity check for missing values */
+ for (String[] zstrings : systemZones.values())
+ {
+ if (zstrings[1].equals("") && zstrings[2].equals(""))
+ {
+ for (Map.Entry<Object,Object> entry : properties.entrySet())
+ {
+ String val = (String) entry.getValue();
+ if (val.equals(zstrings[0]))
+ {
+ String key = (String) entry.getKey();
+ String metazone = key.substring(0, key.indexOf("."));
+ String type = properties.getProperty(metazone + "." + locale.getCountry());
+ if (type == null)
+ type = properties.getProperty(metazone + ".DEFAULT");
+ if (type != null)
+ {
+ String[] ostrings = systemZones.get(type);
+ zstrings[1] = ostrings[1];
+ zstrings[2] = ostrings[2];
+ }
+ }
+ }
+ }
+ }
+ allZones.addAll(systemZones.values());
}
catch (MissingResourceException e)
{
- /* This means runtime support for the locale
- * is not available, so we just include providers. */
+ /* This means runtime support for the locale
+ * is not available, so we just include providers. */
}
for (TimeZoneNameProvider p :
- ServiceLoader.load(TimeZoneNameProvider.class))
+ ServiceLoader.load(TimeZoneNameProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- for (String id : TimeZone.getAvailableIDs())
- {
- String[] z = new String[5];
- z[0] = id;
- z[1] = p.getDisplayName(id, false,
- TimeZone.LONG,
- locale);
- z[2] = p.getDisplayName(id, false,
- TimeZone.SHORT,
- locale);
- z[3] = p.getDisplayName(id, true,
- TimeZone.LONG,
- locale);
- z[4] = p.getDisplayName(id, true,
- TimeZone.SHORT,
- locale);
- allZones.add(z);
- }
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ for (String id : TimeZone.getAvailableIDs())
+ {
+ String[] z = new String[5];
+ z[0] = id;
+ z[1] = p.getDisplayName(id, false,
+ TimeZone.LONG,
+ locale);
+ z[2] = p.getDisplayName(id, false,
+ TimeZone.SHORT,
+ locale);
+ z[3] = p.getDisplayName(id, true,
+ TimeZone.LONG,
+ locale);
+ z[4] = p.getDisplayName(id, true,
+ TimeZone.SHORT,
+ locale);
+ allZones.add(z);
+ }
+ break;
+ }
+ }
}
return allZones.toArray(new String[allZones.size()][]);
}
-
- private String[] formatsForKey(ResourceBundle res, String key)
+
+ private String[] formatsForKey(ResourceBundle res, String key)
{
String[] values = new String[formatPrefixes.length];
-
+
for (int i = 0; i < formatPrefixes.length; i++)
values[i] = res.getString(formatPrefixes[i] + key);
-
+
return values;
}
@@ -256,7 +256,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* call {@link #getInstance(java.util.Locale)} instead.
*
* @param locale The locale for which date formatting symbols should
- * be loaded.
+ * be loaded.
* @throws MissingResourceException if the resources for the specified
* locale could not be found or loaded.
* @see #getInstance(java.util.Locale)
@@ -266,7 +266,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
{
ResourceBundle res
= ResourceBundle.getBundle("gnu.java.locale.LocaleInformation", locale,
- ClassLoader.getSystemClassLoader());
+ ClassLoader.getSystemClassLoader());
ampms = getStringArray(res, "ampms");
eras = getStringArray(res, "eras");
@@ -290,7 +290,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* locale could not be found or loaded.
* @see #getInstance()
*/
- public DateFormatSymbols()
+ public DateFormatSymbols()
throws MissingResourceException
{
this (Locale.getDefault());
@@ -323,7 +323,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
/**
* This method returns the pattern character information for this
* object. This is an 18 character string that contains the characters
- * that are used in creating the date formatting strings in
+ * that are used in creating the date formatting strings in
* <code>SimpleDateFormat</code>. The following are the character
* positions in the string and which format character they correspond
* to (the character in parentheses is the default value in the US English
@@ -386,7 +386,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
}
/**
- * This method returns the list of strings used for displaying abbreviated
+ * This method returns the list of strings used for displaying abbreviated
* weekday names (e.g., "Sun" and "Mon"). This is an eight element
* <code>String</code> array indexed by <code>Calendar.SUNDAY</code>
* through <code>Calendar.SATURDAY</code>. Note that the first element
@@ -476,7 +476,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* This method sets the list of characters used to specific date/time
* formatting strings.
* This is an 18 character string that contains the characters
- * that are used in creating the date formatting strings in
+ * that are used in creating the date formatting strings in
* <code>SimpleDateFormat</code>. The following are the character
* positions in the string and which format character they correspond
* to (the character in parentheses is the default value in the US English
@@ -615,8 +615,8 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
return false;
for (int i = xa.length; --i >= 0; )
{
- if (! equals(xa[i], ya[i]))
- return false;
+ if (! equals(xa[i], ya[i]))
+ return false;
}
return true;
}
@@ -643,7 +643,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* <li> Is an instance of <code>DateFormatSymbols</code>.</li>
* <li> Contains identical formatting symbols to this object.</li>
* </ul>
- *
+ *
* @param obj The <code>Object</code> to test for equality against.
*
* @return <code>true</code> if the specified object is equal to this one,
@@ -655,13 +655,13 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
return false;
DateFormatSymbols other = (DateFormatSymbols) obj;
return (equals(ampms, other.ampms)
- && equals(eras, other.eras)
- && equals(localPatternChars, other.localPatternChars)
- && equals(months, other.months)
- && equals(shortMonths, other.shortMonths)
- && equals(shortWeekdays, other.shortWeekdays)
- && equals(weekdays, other.weekdays)
- && equals(zoneStrings, other.zoneStrings));
+ && equals(eras, other.eras)
+ && equals(localPatternChars, other.localPatternChars)
+ && equals(months, other.months)
+ && equals(shortMonths, other.shortMonths)
+ && equals(shortWeekdays, other.shortWeekdays)
+ && equals(weekdays, other.weekdays)
+ && equals(zoneStrings, other.zoneStrings));
}
/**
@@ -674,8 +674,8 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
try
{
return super.clone ();
- }
- catch (CloneNotSupportedException e)
+ }
+ catch (CloneNotSupportedException e)
{
return null;
}
@@ -689,13 +689,13 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
public int hashCode ()
{
return (hashCode(ampms)
- ^ hashCode(eras)
- ^ hashCode(localPatternChars)
- ^ hashCode(months)
- ^ hashCode(shortMonths)
- ^ hashCode(shortWeekdays)
- ^ hashCode(weekdays)
- ^ hashCode(zoneStrings));
+ ^ hashCode(eras)
+ ^ hashCode(localPatternChars)
+ ^ hashCode(months)
+ ^ hashCode(shortMonths)
+ ^ hashCode(shortWeekdays)
+ ^ hashCode(weekdays)
+ ^ hashCode(zoneStrings));
}
/**
@@ -705,7 +705,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* {@link java.text.spi.DateFormatSymbolsProvider} instances.
* This is equivalent to calling
* <code>getInstance(Locale.getDefault())</code>.
- *
+ *
* @return a {@link DateFormatSymbols} instance for the default
* locale.
* @since 1.6
@@ -720,7 +720,7 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
* specified locale obtained from either the runtime itself
* or one of the installed
* {@link java.text.spi.DateFormatSymbolsProvider} instances.
- *
+ *
* @param locale the locale for which an instance should be
* returned.
* @return a {@link DateFormatSymbols} instance for the specified
@@ -733,27 +733,27 @@ public class DateFormatSymbols implements java.io.Serializable, Cloneable
{
try
{
- DateFormatSymbols syms = new DateFormatSymbols(locale);
- return syms;
+ DateFormatSymbols syms = new DateFormatSymbols(locale);
+ return syms;
}
catch (MissingResourceException e)
{
- /* This means runtime support for the locale
- * is not available, so we check providers. */
+ /* This means runtime support for the locale
+ * is not available, so we check providers. */
}
for (DateFormatSymbolsProvider p :
- ServiceLoader.load(DateFormatSymbolsProvider.class))
+ ServiceLoader.load(DateFormatSymbolsProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- DateFormatSymbols syms = p.getInstance(locale);
- if (syms != null)
- return syms;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ DateFormatSymbols syms = p.getInstance(locale);
+ if (syms != null)
+ return syms;
+ break;
+ }
+ }
}
return getInstance(LocaleHelper.getFallbackLocale(locale));
}
diff --git a/java/text/DecimalFormat.java b/java/text/DecimalFormat.java
index 425174437..9f02bb8d4 100644
--- a/java/text/DecimalFormat.java
+++ b/java/text/DecimalFormat.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -35,7 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-/*
+/*
* This class contains few bits from ICU4J (http://icu.sourceforge.net/),
* Copyright by IBM and others and distributed under the
* distributed under MIT/X.
@@ -55,7 +55,7 @@ import java.util.Locale;
/*
* This note is here for historical reasons and because I had not the courage
* to remove it :)
- *
+ *
* @author Tom Tromey (tromey@cygnus.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @date March 4, 1999
@@ -72,7 +72,7 @@ import java.util.Locale;
* decimal numbers. The class can format numbers given a specific locale.
* Generally, to get an instance of DecimalFormat you should call the factory
* methods in the <code>NumberFormat</code> base class.
- *
+ *
* @author Mario Torre (neugens@limasoftware.net)
* @author Tom Tromey (tromey@cygnus.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
@@ -81,104 +81,104 @@ public class DecimalFormat extends NumberFormat
{
/** serialVersionUID for serializartion. */
private static final long serialVersionUID = 864413376551465018L;
-
+
/** Defines the default number of digits allowed while formatting integers. */
- private static final int DEFAULT_INTEGER_DIGITS = 309;
+ private static final int DEFAULT_INTEGER_DIGITS = 309;
/**
* Defines the default number of digits allowed while formatting
* fractions.
*/
private static final int DEFAULT_FRACTION_DIGITS = 340;
-
+
/**
* Locale-independent pattern symbols.
*/
// Happen to be the same as the US symbols.
private static final DecimalFormatSymbols nonLocalizedSymbols
= new DecimalFormatSymbols (Locale.US);
-
+
/**
* Defines if parse should return a BigDecimal or not.
*/
private boolean parseBigDecimal;
-
+
/**
* Defines if we have to use the monetary decimal separator or
* the decimal separator while formatting numbers.
*/
private boolean useCurrencySeparator;
-
+
/** Defines if the decimal separator is always shown or not. */
private boolean decimalSeparatorAlwaysShown;
-
+
/**
* Defines if the decimal separator has to be shown.
- *
+ *
* This is different then <code>decimalSeparatorAlwaysShown</code>,
* as it defines if the format string contains a decimal separator or no.
*/
private boolean showDecimalSeparator;
-
+
/**
* This field is used to determine if the grouping
* separator is included in the format string or not.
* This is only needed to match the behaviour of the RI.
*/
private boolean groupingSeparatorInPattern;
-
+
/** Defines the size of grouping groups when grouping is used. */
private byte groupingSize;
-
+
/**
* This is an internal parameter used to keep track of the number
* of digits the form the exponent, when exponential notation is used.
* It is used with <code>exponentRound</code>
*/
private byte minExponentDigits;
-
+
/** This field is used to set the exponent in the engineering notation. */
private int exponentRound;
-
+
/** Multiplier used in percent style formats. */
private int multiplier;
-
+
/** Multiplier used in percent style formats. */
private int negativePatternMultiplier;
-
+
/** The negative prefix. */
private String negativePrefix;
-
+
/** The negative suffix. */
private String negativeSuffix;
-
+
/** The positive prefix. */
private String positivePrefix;
-
+
/** The positive suffix. */
private String positiveSuffix;
-
+
/** Decimal Format Symbols for the given locale. */
private DecimalFormatSymbols symbols;
-
+
/** Determine if we have to use exponential notation or not. */
private boolean useExponentialNotation;
-
+
/**
* Defines the maximum number of integer digits to show when we use
* the exponential notation.
*/
private int maxIntegerDigitsExponent;
-
+
/** Defines if the format string has a negative prefix or not. */
private boolean hasNegativePrefix;
-
+
/** Defines if the format string has a fractional pattern or not. */
private boolean hasFractionalPattern;
-
+
/** Stores a list of attributes for use by formatToCharacterIterator. */
private ArrayList attributes = new ArrayList();
-
+
/**
* Constructs a <code>DecimalFormat</code> which uses the default
* pattern and symbols.
@@ -187,7 +187,7 @@ public class DecimalFormat extends NumberFormat
{
this ("#,##0.###");
}
-
+
/**
* Constructs a <code>DecimalFormat</code> which uses the given
* pattern and the default symbols for formatting and parsing.
@@ -204,7 +204,7 @@ public class DecimalFormat extends NumberFormat
/**
* Constructs a <code>DecimalFormat</code> using the given pattern
* and formatting symbols. This construction method is used to give
- * complete control over the formatting process.
+ * complete control over the formatting process.
*
* @param pattern the non-localized pattern to use.
* @param symbols the set of symbols used for parsing and formatting.
@@ -216,10 +216,10 @@ public class DecimalFormat extends NumberFormat
this.symbols = (DecimalFormatSymbols) symbols.clone();
applyPatternWithSymbols(pattern, nonLocalizedSymbols);
}
-
+
/**
* Apply the given localized patern to the current DecimalFormat object.
- *
+ *
* @param pattern The localized pattern to apply.
* @throws IllegalArgumentException if the given pattern is invalid.
* @throws NullPointerException if the input pattern is null.
@@ -231,7 +231,7 @@ public class DecimalFormat extends NumberFormat
/**
* Apply the given localized pattern to the current DecimalFormat object.
- *
+ *
* @param pattern The localized pattern to apply.
* @throws IllegalArgumentException if the given pattern is invalid.
* @throws NullPointerException if the input pattern is null.
@@ -256,9 +256,9 @@ public class DecimalFormat extends NumberFormat
* <li><code>obj</code> is an instance of <code>DecimalFormat</code>;</li>
* <li>this instance and <code>obj</code> have the same attributes;</li>
* </ul>
- *
+ *
* @param obj the object (<code>null</code> permitted).
- *
+ *
* @return A boolean.
*/
public boolean equals(Object obj)
@@ -266,9 +266,9 @@ public class DecimalFormat extends NumberFormat
if (! (obj instanceof DecimalFormat))
return false;
DecimalFormat dup = (DecimalFormat) obj;
- return (decimalSeparatorAlwaysShown == dup.decimalSeparatorAlwaysShown
+ return (decimalSeparatorAlwaysShown == dup.decimalSeparatorAlwaysShown
&& groupingUsed == dup.groupingUsed
- && groupingSeparatorInPattern == dup.groupingSeparatorInPattern
+ && groupingSeparatorInPattern == dup.groupingSeparatorInPattern
&& groupingSize == dup.groupingSize
&& multiplier == dup.multiplier
&& useExponentialNotation == dup.useExponentialNotation
@@ -301,13 +301,13 @@ public class DecimalFormat extends NumberFormat
{
return toPattern().hashCode();
}
-
+
/**
* Produce a formatted {@link String} representation of this object.
- * The passed object must be of type number.
- *
+ * The passed object must be of type number.
+ *
* @param obj The {@link Number} to format.
- * @param sbuf The destination String; text will be appended to this String.
+ * @param sbuf The destination String; text will be appended to this String.
* @param pos If used on input can be used to define an alignment
* field. If used on output defines the offsets of the alignment field.
* @return The String representation of this long.
@@ -325,22 +325,22 @@ public class DecimalFormat extends NumberFormat
formatInternal((BigDecimal) obj, true, sbuf, pos);
return sbuf;
}
-
+
return super.format(obj, sbuf, pos);
}
-
+
/**
* Produce a formatted {@link String} representation of this double.
- *
+ *
* @param number The double to format.
- * @param dest The destination String; text will be appended to this String.
+ * @param dest The destination String; text will be appended to this String.
* @param fieldPos If used on input can be used to define an alignment
* field. If used on output defines the offsets of the alignment field.
* @return The String representation of this long.
* @throws NullPointerException if <code>dest</code> or fieldPos are null
*/
public StringBuffer format(double number, StringBuffer dest,
- FieldPosition fieldPos)
+ FieldPosition fieldPos)
{
// special cases for double: NaN and negative or positive infinity
if (Double.isNaN(number))
@@ -348,7 +348,7 @@ public class DecimalFormat extends NumberFormat
// 1. NaN
String nan = symbols.getNaN();
dest.append(nan);
-
+
// update field position if required
if ((fieldPos.getField() == INTEGER_FIELD ||
fieldPos.getFieldAttribute() == NumberFormat.Field.INTEGER))
@@ -365,14 +365,14 @@ public class DecimalFormat extends NumberFormat
dest.append(this.negativePrefix);
else
dest.append(this.positivePrefix);
-
+
dest.append(symbols.getInfinity());
-
+
if (number < 0)
dest.append(this.negativeSuffix);
else
dest.append(this.positiveSuffix);
-
+
if ((fieldPos.getField() == INTEGER_FIELD ||
fieldPos.getFieldAttribute() == NumberFormat.Field.INTEGER))
{
@@ -386,15 +386,15 @@ public class DecimalFormat extends NumberFormat
BigDecimal bigDecimal = new BigDecimal(String.valueOf(number));
formatInternal(bigDecimal, false, dest, fieldPos);
}
-
+
return dest;
}
/**
* Produce a formatted {@link String} representation of this long.
- *
+ *
* @param number The long to format.
- * @param dest The destination String; text will be appended to this String.
+ * @param dest The destination String; text will be appended to this String.
* @param fieldPos If used on input can be used to define an alignment
* field. If used on output defines the offsets of the alignment field.
* @return The String representation of this long.
@@ -406,13 +406,13 @@ public class DecimalFormat extends NumberFormat
formatInternal(bigDecimal, true, dest, fieldPos);
return dest;
}
-
+
/**
* Return an <code>AttributedCharacterIterator</code> as a result of
* the formatting of the passed {@link Object}.
- *
+ *
* @return An {@link AttributedCharacterIterator}.
- * @throws NullPointerException if value is <code>null</code>.
+ * @throws NullPointerException if value is <code>null</code>.
* @throws IllegalArgumentException if value is not an instance of
* {@link Number}.
*/
@@ -422,13 +422,13 @@ public class DecimalFormat extends NumberFormat
* This method implementation derives directly from the
* ICU4J (http://icu.sourceforge.net/) library, distributed under MIT/X.
*/
-
+
if (value == null)
throw new NullPointerException("Passed Object is null");
-
+
if (!(value instanceof Number)) throw new
IllegalArgumentException("Cannot format given Object as a Number");
-
+
StringBuffer text = new StringBuffer();
attributes.clear();
super.format(value, text, new FieldPosition(0));
@@ -440,15 +440,15 @@ public class DecimalFormat extends NumberFormat
{
FieldPosition pos = (FieldPosition) attributes.get(i);
Format.Field attribute = pos.getFieldAttribute();
-
+
as.addAttribute(attribute, attribute, pos.getBeginIndex(),
pos.getEndIndex());
}
-
+
// return the CharacterIterator from AttributedString
return as.getIterator();
}
-
+
/**
* Returns the currency corresponding to the currency symbol stored
* in the instance of <code>DecimalFormatSymbols</code> used by this
@@ -461,25 +461,25 @@ public class DecimalFormat extends NumberFormat
{
return symbols.getCurrency();
}
-
+
/**
* Returns a copy of the symbols used by this instance.
- *
+ *
* @return A copy of the symbols.
*/
public DecimalFormatSymbols getDecimalFormatSymbols()
{
return (DecimalFormatSymbols) symbols.clone();
}
-
+
/**
* Gets the interval used between a grouping separator and the next.
* For example, a grouping size of 3 means that the number 1234 is
* formatted as 1,234.
- *
+ *
* The actual character used as grouping separator depends on the
* locale and is defined by {@link DecimalFormatSymbols#getDecimalSeparator()}
- *
+ *
* @return The interval used between a grouping separator and the next.
*/
public int getGroupingSize()
@@ -489,17 +489,17 @@ public class DecimalFormat extends NumberFormat
/**
* Gets the multiplier used in percent and similar formats.
- *
+ *
* @return The multiplier used in percent and similar formats.
*/
public int getMultiplier()
{
return multiplier;
}
-
+
/**
* Gets the negative prefix.
- *
+ *
* @return The negative prefix.
*/
public String getNegativePrefix()
@@ -509,56 +509,56 @@ public class DecimalFormat extends NumberFormat
/**
* Gets the negative suffix.
- *
+ *
* @return The negative suffix.
*/
public String getNegativeSuffix()
{
return negativeSuffix;
}
-
+
/**
* Gets the positive prefix.
- *
+ *
* @return The positive prefix.
*/
public String getPositivePrefix()
{
return positivePrefix;
}
-
+
/**
* Gets the positive suffix.
- *
+ *
* @return The positive suffix.
*/
public String getPositiveSuffix()
{
return positiveSuffix;
}
-
+
public boolean isDecimalSeparatorAlwaysShown()
{
return decimalSeparatorAlwaysShown;
}
-
+
/**
* Define if <code>parse(java.lang.String, java.text.ParsePosition)</code>
- * should return a {@link BigDecimal} or not.
- *
+ * should return a {@link BigDecimal} or not.
+ *
* @param newValue
*/
public void setParseBigDecimal(boolean newValue)
{
this.parseBigDecimal = newValue;
}
-
+
/**
* Returns <code>true</code> if
* <code>parse(java.lang.String, java.text.ParsePosition)</code> returns
* a <code>BigDecimal</code>, <code>false</code> otherwise.
* The default return value for this method is <code>false</code>.
- *
+ *
* @return <code>true</code> if the parse method returns a {@link BigDecimal},
* <code>false</code> otherwise.
* @since 1.5
@@ -568,15 +568,15 @@ public class DecimalFormat extends NumberFormat
{
return this.parseBigDecimal;
}
-
+
/**
* This method parses the specified string into a <code>Number</code>.
- *
+ *
* The parsing starts at <code>pos</code>, which is updated as the parser
* consume characters in the passed string.
* On error, the <code>Position</code> object index is not updated, while
* error position is set appropriately, an <code>null</code> is returned.
- *
+ *
* @param str The string to parse.
* @param pos The desired <code>ParsePosition</code>.
*
@@ -588,30 +588,30 @@ public class DecimalFormat extends NumberFormat
// NaN
if (str.contains(this.symbols.getNaN()))
return Double.valueOf(Double.NaN);
-
+
// this will be our final number
CPStringBuilder number = new CPStringBuilder();
-
+
// special character
char minus = symbols.getMinusSign();
-
+
// starting parsing position
int start = pos.getIndex();
-
- // validate the string, it have to be in the
+
+ // validate the string, it have to be in the
// same form as the format string or parsing will fail
String _negativePrefix = (this.negativePrefix.compareTo("") == 0
? minus + positivePrefix
: this.negativePrefix);
-
+
// we check both prefixes, because one might be empty.
// We want to pick the longest prefix that matches.
int positiveLen = positivePrefix.length();
int negativeLen = _negativePrefix.length();
-
+
boolean isNegative = str.startsWith(_negativePrefix);
boolean isPositive = str.startsWith(positivePrefix);
-
+
if (isPositive && isNegative)
{
// By checking this way, we preserve ambiguity in the case
@@ -644,31 +644,31 @@ public class DecimalFormat extends NumberFormat
pos.setErrorIndex(start);
return null;
}
-
+
// other special characters used by the parser
char decimalSeparator = symbols.getDecimalSeparator();
char zero = symbols.getZeroDigit();
- char exponent = symbols.getExponential();
-
+ char exponent = symbols.getExponential();
+
// stop parsing position in the string
int stop = start + this.maximumIntegerDigits + maximumFractionDigits + 2;
-
+
if (useExponentialNotation)
stop += minExponentDigits + 1;
-
+
boolean inExponent = false;
// correct the size of the end parsing flag
int len = str.length();
if (len < stop) stop = len;
char groupingSeparator = symbols.getGroupingSeparator();
-
+
int i = start;
while (i < stop)
{
char ch = str.charAt(i);
i++;
-
+
if (ch >= zero && ch <= (zero + 9))
{
number.append(ch);
@@ -692,43 +692,43 @@ public class DecimalFormat extends NumberFormat
if (inExponent)
number.append(ch);
else
- {
- i--;
- break;
- }
+ {
+ i--;
+ break;
+ }
+ }
+ else
+ {
+ if (!groupingUsed || ch != groupingSeparator)
+ {
+ i--;
+ break;
+ }
}
- else
- {
- if (!groupingUsed || ch != groupingSeparator)
- {
- i--;
- break;
- }
- }
}
// 2nd special case: infinity
// XXX: need to be tested
if (str.contains(symbols.getInfinity()))
{
- int inf = str.indexOf(symbols.getInfinity());
+ int inf = str.indexOf(symbols.getInfinity());
pos.setIndex(inf);
-
+
// FIXME: ouch, this is really ugly and lazy code...
if (this.parseBigDecimal)
{
if (isNegative)
return BigDecimal.valueOf(Double.NEGATIVE_INFINITY);
-
+
return BigDecimal.valueOf(Double.POSITIVE_INFINITY);
}
-
+
if (isNegative)
return Double.valueOf(Double.NEGATIVE_INFINITY);
return Double.valueOf(Double.POSITIVE_INFINITY);
}
-
+
// no number...
if (i == start || number.length() == 0)
{
@@ -744,7 +744,7 @@ public class DecimalFormat extends NumberFormat
positiveLen = positiveSuffix.length();
negativeLen = negativeSuffix.length();
-
+
if (isNegative && !hasNegativeSuffix)
{
pos.setErrorIndex(i);
@@ -761,16 +761,16 @@ public class DecimalFormat extends NumberFormat
pos.setErrorIndex(i);
return null;
}
-
+
if (isNegative) number.insert(0, '-');
-
+
pos.setIndex(i);
-
+
// now we handle the return type
BigDecimal bigDecimal = new BigDecimal(number.toString());
if (this.parseBigDecimal)
return bigDecimal;
-
+
// want integer?
if (this.parseIntegerOnly)
return Long.valueOf(bigDecimal.longValue());
@@ -778,7 +778,7 @@ public class DecimalFormat extends NumberFormat
// 3th special case -0.0
if (isNegative && (bigDecimal.compareTo(BigDecimal.ZERO) == 0))
return Double.valueOf(-0.0);
-
+
try
{
BigDecimal integer
@@ -795,7 +795,7 @@ public class DecimalFormat extends NumberFormat
* Sets the <code>Currency</code> on the
* <code>DecimalFormatSymbols</code> used, which also sets the
* currency symbols on those symbols.
- *
+ *
* @param currency The new <code>Currency</code> on the
* <code>DecimalFormatSymbols</code>.
*/
@@ -804,46 +804,46 @@ public class DecimalFormat extends NumberFormat
Currency current = symbols.getCurrency();
if (current != currency)
{
- String oldSymbol = symbols.getCurrencySymbol();
- int len = oldSymbol.length();
- symbols.setCurrency(currency);
- String newSymbol = symbols.getCurrencySymbol();
- int posPre = positivePrefix.indexOf(oldSymbol);
- if (posPre != -1)
- positivePrefix = positivePrefix.substring(0, posPre) +
- newSymbol + positivePrefix.substring(posPre+len);
- int negPre = negativePrefix.indexOf(oldSymbol);
- if (negPre != -1)
- negativePrefix = negativePrefix.substring(0, negPre) +
- newSymbol + negativePrefix.substring(negPre+len);
- int posSuf = positiveSuffix.indexOf(oldSymbol);
- if (posSuf != -1)
- positiveSuffix = positiveSuffix.substring(0, posSuf) +
- newSymbol + positiveSuffix.substring(posSuf+len);
- int negSuf = negativeSuffix.indexOf(oldSymbol);
- if (negSuf != -1)
- negativeSuffix = negativeSuffix.substring(0, negSuf) +
- newSymbol + negativeSuffix.substring(negSuf+len);
+ String oldSymbol = symbols.getCurrencySymbol();
+ int len = oldSymbol.length();
+ symbols.setCurrency(currency);
+ String newSymbol = symbols.getCurrencySymbol();
+ int posPre = positivePrefix.indexOf(oldSymbol);
+ if (posPre != -1)
+ positivePrefix = positivePrefix.substring(0, posPre) +
+ newSymbol + positivePrefix.substring(posPre+len);
+ int negPre = negativePrefix.indexOf(oldSymbol);
+ if (negPre != -1)
+ negativePrefix = negativePrefix.substring(0, negPre) +
+ newSymbol + negativePrefix.substring(negPre+len);
+ int posSuf = positiveSuffix.indexOf(oldSymbol);
+ if (posSuf != -1)
+ positiveSuffix = positiveSuffix.substring(0, posSuf) +
+ newSymbol + positiveSuffix.substring(posSuf+len);
+ int negSuf = negativeSuffix.indexOf(oldSymbol);
+ if (negSuf != -1)
+ negativeSuffix = negativeSuffix.substring(0, negSuf) +
+ newSymbol + negativeSuffix.substring(negSuf+len);
}
}
-
+
/**
- * Sets the symbols used by this instance. This method makes a copy of
+ * Sets the symbols used by this instance. This method makes a copy of
* the supplied symbols.
- *
+ *
* @param newSymbols the symbols (<code>null</code> not permitted).
*/
public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols)
{
symbols = (DecimalFormatSymbols) newSymbols.clone();
}
-
+
/**
* Define if the decimal separator should be always visible or only
* visible when needed. This method as effect only on integer values.
* Pass <code>true</code> if you want the decimal separator to be
* always shown, <code>false</code> otherwise.
- *
+ *
* @param newValue true</code> if you want the decimal separator to be
* always shown, <code>false</code> otherwise.
*/
@@ -851,12 +851,12 @@ public class DecimalFormat extends NumberFormat
{
decimalSeparatorAlwaysShown = newValue;
}
-
+
/**
* Sets the number of digits used to group portions of the integer part of
* the number. For example, the number <code>123456</code>, with a grouping
* size of 3, is rendered <code>123,456</code>.
- *
+ *
* @param groupSize The number of digits used while grouping portions
* of the integer part of a number.
*/
@@ -864,14 +864,14 @@ public class DecimalFormat extends NumberFormat
{
groupingSize = (byte) groupSize;
}
-
+
/**
* Sets the maximum number of digits allowed in the integer
* portion of a number to the specified value.
* The new value will be the choosen as the minimum between
* <code>newvalue</code> and 309. Any value below zero will be
* replaced by zero.
- *
+ *
* @param newValue The new maximum integer digits value.
*/
public void setMaximumIntegerDigits(int newValue)
@@ -879,14 +879,14 @@ public class DecimalFormat extends NumberFormat
newValue = (newValue > 0) ? newValue : 0;
super.setMaximumIntegerDigits(Math.min(newValue, DEFAULT_INTEGER_DIGITS));
}
-
+
/**
* Sets the minimum number of digits allowed in the integer
* portion of a number to the specified value.
* The new value will be the choosen as the minimum between
* <code>newvalue</code> and 309. Any value below zero will be
* replaced by zero.
- *
+ *
* @param newValue The new minimum integer digits value.
*/
public void setMinimumIntegerDigits(int newValue)
@@ -894,14 +894,14 @@ public class DecimalFormat extends NumberFormat
newValue = (newValue > 0) ? newValue : 0;
super.setMinimumIntegerDigits(Math.min(newValue, DEFAULT_INTEGER_DIGITS));
}
-
+
/**
* Sets the maximum number of digits allowed in the fraction
* portion of a number to the specified value.
* The new value will be the choosen as the minimum between
* <code>newvalue</code> and 309. Any value below zero will be
* replaced by zero.
- *
+ *
* @param newValue The new maximum fraction digits value.
*/
public void setMaximumFractionDigits(int newValue)
@@ -909,14 +909,14 @@ public class DecimalFormat extends NumberFormat
newValue = (newValue > 0) ? newValue : 0;
super.setMaximumFractionDigits(Math.min(newValue, DEFAULT_FRACTION_DIGITS));
}
-
+
/**
* Sets the minimum number of digits allowed in the fraction
* portion of a number to the specified value.
* The new value will be the choosen as the minimum between
* <code>newvalue</code> and 309. Any value below zero will be
* replaced by zero.
- *
+ *
* @param newValue The new minimum fraction digits value.
*/
public void setMinimumFractionDigits(int newValue)
@@ -924,22 +924,22 @@ public class DecimalFormat extends NumberFormat
newValue = (newValue > 0) ? newValue : 0;
super.setMinimumFractionDigits(Math.min(newValue, DEFAULT_FRACTION_DIGITS));
}
-
+
/**
* Sets the multiplier for use in percent and similar formats.
* For example, for percent set the multiplier to 100, for permille, set the
* miltiplier to 1000.
- *
+ *
* @param newValue the new value for multiplier.
*/
public void setMultiplier(int newValue)
{
multiplier = newValue;
}
-
+
/**
* Sets the negative prefix.
- *
+ *
* @param newValue The new negative prefix.
*/
public void setNegativePrefix(String newValue)
@@ -949,38 +949,38 @@ public class DecimalFormat extends NumberFormat
/**
* Sets the negative suffix.
- *
+ *
* @param newValue The new negative suffix.
*/
public void setNegativeSuffix(String newValue)
{
negativeSuffix = newValue;
}
-
+
/**
* Sets the positive prefix.
- *
+ *
* @param newValue The new positive prefix.
*/
public void setPositivePrefix(String newValue)
{
positivePrefix = newValue;
}
-
+
/**
* Sets the new positive suffix.
- *
+ *
* @param newValue The new positive suffix.
*/
public void setPositiveSuffix(String newValue)
{
positiveSuffix = newValue;
}
-
+
/**
* This method returns a string with the formatting pattern being used
* by this object. The string is localized.
- *
+ *
* @return A localized <code>String</code> with the formatting pattern.
* @see #toPattern()
*/
@@ -988,11 +988,11 @@ public class DecimalFormat extends NumberFormat
{
return computePattern(this.symbols);
}
-
+
/**
* This method returns a string with the formatting pattern being used
* by this object. The string is not localized.
- *
+ *
* @return A <code>String</code> with the formatting pattern.
* @see #toLocalizedPattern()
*/
@@ -1000,13 +1000,13 @@ public class DecimalFormat extends NumberFormat
{
return computePattern(nonLocalizedSymbols);
}
-
+
/* ***** private methods ***** */
-
+
/**
* This is an shortcut helper method used to test if two given strings are
* equals.
- *
+ *
* @param s1 The first string to test for equality.
* @param s2 The second string to test for equality.
* @return <code>true</code> if the strings are both <code>null</code> or
@@ -1018,10 +1018,10 @@ public class DecimalFormat extends NumberFormat
return s1 == s2;
return s1.equals(s2);
}
-
-
+
+
/* ****** PATTERN ****** */
-
+
/**
* This helper function creates a string consisting of all the
* characters which can appear in a pattern and must be quoted.
@@ -1029,7 +1029,7 @@ public class DecimalFormat extends NumberFormat
private String patternChars (DecimalFormatSymbols syms)
{
CPStringBuilder buf = new CPStringBuilder ();
-
+
buf.append(syms.getDecimalSeparator());
buf.append(syms.getDigit());
buf.append(syms.getExponential());
@@ -1041,14 +1041,14 @@ public class DecimalFormat extends NumberFormat
buf.append(syms.getZeroDigit());
buf.append('\'');
buf.append('\u00a4');
-
+
return buf.toString();
}
/**
* Quote special characters as defined by <code>patChars</code> in the
* input string.
- *
+ *
* @param text
* @param patChars
* @return A StringBuffer with special characters quoted.
@@ -1056,7 +1056,7 @@ public class DecimalFormat extends NumberFormat
private CPStringBuilder quoteFix(String text, String patChars)
{
CPStringBuilder buf = new CPStringBuilder();
-
+
int len = text.length();
char ch;
for (int index = 0; index < len; ++index)
@@ -1073,10 +1073,10 @@ public class DecimalFormat extends NumberFormat
buf.append(ch);
}
}
-
+
return buf;
}
-
+
/**
* Returns the format pattern, localized to follow the given
* symbols.
@@ -1084,23 +1084,23 @@ public class DecimalFormat extends NumberFormat
private String computePattern(DecimalFormatSymbols symbols)
{
StringBuilder mainPattern = new StringBuilder();
-
+
// We have to at least emit a zero for the minimum number of
// digits. Past that we need hash marks up to the grouping
// separator (and one beyond).
int _groupingSize = groupingUsed ? groupingSize + 1: groupingSize;
int totalDigits = Math.max(minimumIntegerDigits, _groupingSize);
-
+
// if it is not in exponential notiation,
// we always have a # prebended
if (!useExponentialNotation) mainPattern.append(symbols.getDigit());
-
+
for (int i = 1; i < totalDigits - minimumIntegerDigits; i++)
mainPattern.append(symbols.getDigit());
-
+
for (int i = totalDigits - minimumIntegerDigits; i < totalDigits; i++)
mainPattern.append(symbols.getZeroDigit());
-
+
if (groupingUsed)
{
mainPattern.insert(mainPattern.length() - groupingSize,
@@ -1113,33 +1113,33 @@ public class DecimalFormat extends NumberFormat
{
mainPattern.append(symbols.getDecimalSeparator());
}
-
+
for (int i = 0; i < minimumFractionDigits; ++i)
mainPattern.append(symbols.getZeroDigit());
-
+
for (int i = minimumFractionDigits; i < maximumFractionDigits; ++i)
mainPattern.append(symbols.getDigit());
-
+
if (useExponentialNotation)
{
mainPattern.append(symbols.getExponential());
-
+
for (int i = 0; i < minExponentDigits; ++i)
mainPattern.append(symbols.getZeroDigit());
-
+
if (minExponentDigits == 0)
mainPattern.append(symbols.getDigit());
}
-
+
// save the pattern
String pattern = mainPattern.toString();
-
+
// so far we have the pattern itself, now we need to add
// the positive and the optional negative prefixes and suffixes
String patternChars = patternChars(symbols);
mainPattern.insert(0, quoteFix(positivePrefix, patternChars));
mainPattern.append(quoteFix(positiveSuffix, patternChars));
-
+
if (hasNegativePrefix)
{
mainPattern.append(symbols.getPatternSeparator());
@@ -1147,17 +1147,17 @@ public class DecimalFormat extends NumberFormat
mainPattern.append(pattern);
mainPattern.append(quoteFix(negativeSuffix, patternChars));
}
-
+
// finally, return the pattern string
return mainPattern.toString();
}
-
+
/* ****** FORMAT PARSING ****** */
-
+
/**
* Scan the input string and define a pattern suitable for use
* with this decimal format.
- *
+ *
* @param pattern
* @param symbols
*/
@@ -1175,11 +1175,11 @@ public class DecimalFormat extends NumberFormat
// the parameters we need for formatting (which is basicly what
// a descendent recursive parser would do - but without recursion).
// I'm sure that there are smarter methods to do this.
-
+
// Restore default values. Most of these will be overwritten
// but we want to be sure that nothing is left out.
setDefaultValues();
-
+
int len = pattern.length();
if (len == 0)
{
@@ -1188,16 +1188,16 @@ public class DecimalFormat extends NumberFormat
this.maximumIntegerDigits = DEFAULT_INTEGER_DIGITS;
this.minimumFractionDigits = 0;
this.maximumFractionDigits = DEFAULT_FRACTION_DIGITS;
-
+
// FIXME: ...and these values may not be valid in all locales
this.minExponentDigits = 0;
this.showDecimalSeparator = true;
this.groupingUsed = true;
this.groupingSize = 3;
-
+
return;
}
-
+
int start = scanFix(pattern, symbols, 0, true);
if (start < len) start = scanNumberInteger(pattern, symbols, start);
if (start < len)
@@ -1213,16 +1213,16 @@ public class DecimalFormat extends NumberFormat
//this.decimalSeparatorAlwaysShown = false;
//this.showDecimalSeparator = false;
}
-
+
// XXX: this fixes a compatibility test with the RI.
// If new uses cases fail, try removing this line first.
//if (!this.hasIntegerPattern && !this.hasFractionalPattern)
// throw new IllegalArgumentException("No valid pattern found!");
-
+
if (start < len) start = scanExponent(pattern, symbols, start);
if (start < len) start = scanFix(pattern, symbols, start, false);
if (start < len) scanNegativePattern(pattern, symbols, start);
-
+
if (useExponentialNotation &&
(maxIntegerDigitsExponent > minimumIntegerDigits) &&
(maxIntegerDigitsExponent > 1))
@@ -1230,20 +1230,20 @@ public class DecimalFormat extends NumberFormat
minimumIntegerDigits = 1;
exponentRound = maxIntegerDigitsExponent;
}
-
+
if (useExponentialNotation)
maximumIntegerDigits = maxIntegerDigitsExponent;
-
+
if (!this.hasFractionalPattern && this.showDecimalSeparator == true)
{
this.decimalSeparatorAlwaysShown = true;
}
}
-
+
/**
* Scans for the prefix or suffix portion of the pattern string.
* This method handles the positive subpattern of the pattern string.
- *
+ *
* @param pattern The pattern string to parse.
* @return The position in the pattern string where parsing ended.
*/
@@ -1251,7 +1251,7 @@ public class DecimalFormat extends NumberFormat
int start, boolean prefix)
{
CPStringBuilder buffer = new CPStringBuilder();
-
+
// the number portion is always delimited by one of those
// characters
char decimalSeparator = sourceSymbols.getDecimalSeparator();
@@ -1260,15 +1260,15 @@ public class DecimalFormat extends NumberFormat
char digit = sourceSymbols.getDigit();
char zero = sourceSymbols.getZeroDigit();
char minus = sourceSymbols.getMinusSign();
-
+
// other special characters, cached here to avoid method calls later
char percent = sourceSymbols.getPercent();
char permille = sourceSymbols.getPerMill();
-
+
String currencySymbol = this.symbols.getCurrencySymbol();
-
+
boolean quote = false;
-
+
char ch = pattern.charAt(start);
if (ch == patternSeparator)
{
@@ -1277,7 +1277,7 @@ public class DecimalFormat extends NumberFormat
++start;
return start;
}
-
+
int len = pattern.length();
int i;
for (i = start; i < len; i++)
@@ -1292,12 +1292,12 @@ public class DecimalFormat extends NumberFormat
throw new IllegalArgumentException("Invalid pattern found: "
+ start);
}
-
+
this.hasNegativePrefix = true;
++i;
break;
}
-
+
// this means we are inside the number portion
if (!quote &&
(ch == minus || ch == digit || ch == zero ||
@@ -1314,7 +1314,7 @@ public class DecimalFormat extends NumberFormat
buffer.append(ch);
continue;
}
-
+
if (ch == '\u00A4')
{
// CURRENCY
@@ -1347,7 +1347,7 @@ public class DecimalFormat extends NumberFormat
// QUOTE
if ((i + 1) < len && pattern.charAt(i + 1) == '\'')
{
- // we need to add ' to the buffer
+ // we need to add ' to the buffer
buffer.append(ch);
i++;
}
@@ -1362,7 +1362,7 @@ public class DecimalFormat extends NumberFormat
buffer.append(ch);
}
}
-
+
if (prefix)
{
this.positivePrefix = buffer.toString();
@@ -1372,15 +1372,15 @@ public class DecimalFormat extends NumberFormat
{
this.positiveSuffix = buffer.toString();
}
-
+
return i;
}
-
+
/**
* Scan the given string for number patterns, starting
* from <code>start</code>.
* This method searches the integer part of the pattern only.
- *
+ *
* @param pattern The pattern string to parse.
* @param start The starting parse position in the string.
* @return The position in the pattern string where parsing ended,
@@ -1395,33 +1395,33 @@ public class DecimalFormat extends NumberFormat
char decimalSeparator = symbols.getDecimalSeparator();
char exponent = symbols.getExponential();
char patternSeparator = symbols.getPatternSeparator();
-
+
// count the number of zeroes in the pattern
// this number defines the minum digits in the integer portion
int zeros = 0;
-
+
// count the number of digits used in grouping
int _groupingSize = 0;
-
+
this.maxIntegerDigitsExponent = 0;
-
+
boolean intPartTouched = false;
-
+
char ch;
int len = pattern.length();
int i;
for (i = start; i < len; i++)
{
ch = pattern.charAt(i);
-
+
// break on decimal separator or exponent or pattern separator
if (ch == decimalSeparator || ch == exponent)
break;
-
+
if (this.hasNegativePrefix && ch == patternSeparator)
throw new IllegalArgumentException("Invalid pattern found: "
+ start);
-
+
if (ch == digit)
{
// in our implementation we could relax this strict
@@ -1430,7 +1430,7 @@ public class DecimalFormat extends NumberFormat
if (zeros > 0) throw new
IllegalArgumentException("digit mark following zero in " +
"positive subpattern, not allowed. Position: " + i);
-
+
_groupingSize++;
intPartTouched = true;
this.maxIntegerDigitsExponent++;
@@ -1454,10 +1454,10 @@ public class DecimalFormat extends NumberFormat
break;
}
}
-
+
if (groupingSeparatorInPattern) this.groupingSize = (byte) _groupingSize;
this.minimumIntegerDigits = zeros;
-
+
// XXX: compatibility code with the RI: the number of minimum integer
// digits is at least one when maximumIntegerDigits is more than zero
if (intPartTouched && this.maximumIntegerDigits > 0 &&
@@ -1466,12 +1466,12 @@ public class DecimalFormat extends NumberFormat
return i;
}
-
+
/**
* Scan the given string for number patterns, starting
* from <code>start</code>.
* This method searches the fractional part of the pattern only.
- *
+ *
* @param pattern The pattern string to parse.
* @param start The starting parse position in the string.
* @return The position in the pattern string where parsing ended,
@@ -1487,7 +1487,7 @@ public class DecimalFormat extends NumberFormat
char decimalSeparator = symbols.getDecimalSeparator();
char exponent = symbols.getExponential();
char patternSeparator = symbols.getPatternSeparator();
-
+
// first character needs to be '.' otherwise we are not parsing the
// fractional portion
char ch = pattern.charAt(start);
@@ -1497,29 +1497,29 @@ public class DecimalFormat extends NumberFormat
this.maximumFractionDigits = 0;
return start;
}
-
+
++start;
-
+
this.hasFractionalPattern = true;
-
+
this.minimumFractionDigits = 0;
int digits = 0;
-
+
int len = pattern.length();
int i;
for (i = start; i < len; i++)
{
ch = pattern.charAt(i);
-
+
// we hit the exponential or negative subpattern
if (ch == exponent || ch == patternSeparator)
break;
-
+
// pattern error
if (ch == groupingSeparator || ch == decimalSeparator) throw new
IllegalArgumentException("unexpected character '" + ch + "' " +
"in fractional subpattern. Position: " + i);
-
+
if (ch == digit)
{
digits++;
@@ -1529,7 +1529,7 @@ public class DecimalFormat extends NumberFormat
if (digits > 0) throw new
IllegalArgumentException("digit mark following zero in " +
"positive subpattern, not allowed. Position: " + i);
-
+
this.minimumFractionDigits++;
}
else
@@ -1538,20 +1538,20 @@ public class DecimalFormat extends NumberFormat
break;
}
}
-
+
if (i == start) this.hasFractionalPattern = false;
-
+
this.maximumFractionDigits = this.minimumFractionDigits + digits;
this.showDecimalSeparator = true;
-
+
return i;
}
-
+
/**
* Scan the given string for number patterns, starting
* from <code>start</code>.
* This method searches the expoential part of the pattern only.
- *
+ *
* @param pattern The pattern string to parse.
* @param start The starting parse position in the string.
* @return The position in the pattern string where parsing ended,
@@ -1565,36 +1565,36 @@ public class DecimalFormat extends NumberFormat
char groupingSeparator = symbols.getGroupingSeparator();
char decimalSeparator = symbols.getDecimalSeparator();
char exponent = symbols.getExponential();
-
+
char ch = pattern.charAt(start);
-
+
if (ch == decimalSeparator)
{
// ignore dots
++start;
}
-
+
if (ch != exponent)
{
this.useExponentialNotation = false;
return start;
}
-
+
++start;
-
+
this.minExponentDigits = 0;
-
+
int len = pattern.length();
int i;
for (i = start; i < len; i++)
{
ch = pattern.charAt(i);
-
+
if (ch == groupingSeparator || ch == decimalSeparator ||
ch == digit || ch == exponent) throw new
- IllegalArgumentException("unexpected character '" + ch + "' " +
+ IllegalArgumentException("unexpected character '" + ch + "' " +
"in exponential subpattern. Position: " + i);
-
+
if (ch == zero)
{
this.minExponentDigits++;
@@ -1605,18 +1605,18 @@ public class DecimalFormat extends NumberFormat
break;
}
}
-
- this.useExponentialNotation = true;
-
+
+ this.useExponentialNotation = true;
+
return i;
}
-
+
/**
* Scan the given string for number patterns, starting
* from <code>start</code>.
* This method searches the negative part of the pattern only and scan
* throught the end of the string.
- *
+ *
* @param pattern The pattern string to parse.
* @param start The starting parse position in the string.
*/
@@ -1625,7 +1625,7 @@ public class DecimalFormat extends NumberFormat
int start)
{
StringBuilder buffer = new StringBuilder();
-
+
// the number portion is always delimited by one of those
// characters
char decimalSeparator = sourceSymbols.getDecimalSeparator();
@@ -1634,35 +1634,35 @@ public class DecimalFormat extends NumberFormat
char digit = sourceSymbols.getDigit();
char zero = sourceSymbols.getZeroDigit();
char minus = sourceSymbols.getMinusSign();
-
+
// other special charcaters, cached here to avoid method calls later
char percent = sourceSymbols.getPercent();
char permille = sourceSymbols.getPerMill();
-
+
String CURRENCY_SYMBOL = this.symbols.getCurrencySymbol();
String currencySymbol = CURRENCY_SYMBOL;
-
+
boolean quote = false;
boolean prefixDone = false;
-
+
int len = pattern.length();
if (len > 0) this.hasNegativePrefix = true;
-
+
char ch = pattern.charAt(start);
if (ch == patternSeparator)
{
// no pattern separator in the negative pattern
if ((start + 1) > len) throw new
IllegalArgumentException("unexpected character '" + ch + "' " +
- "in negative subpattern.");
+ "in negative subpattern.");
start++;
}
-
+
int i;
for (i = start; i < len; i++)
{
ch = pattern.charAt(i);
-
+
// this means we are inside the number portion
if (!quote &&
(ch == digit || ch == zero || ch == decimalSeparator ||
@@ -1699,7 +1699,7 @@ public class DecimalFormat extends NumberFormat
// change prefix and suffix, so leave it as commented
// unless in case of bug report/errors
//this.useCurrencySeparator = true;
-
+
buffer.append(currencySymbol);
}
else if (ch == percent)
@@ -1719,7 +1719,7 @@ public class DecimalFormat extends NumberFormat
// QUOTE
if ((i + 1) < len && pattern.charAt(i + 1) == '\'')
{
- // we need to add ' to the buffer
+ // we need to add ' to the buffer
buffer.append(ch);
i++;
}
@@ -1739,25 +1739,25 @@ public class DecimalFormat extends NumberFormat
buffer.append(ch);
}
}
-
+
if (prefixDone)
this.negativeSuffix = buffer.toString();
else
this.negativePrefix = buffer.toString();
}
-
+
/* ****** FORMATTING ****** */
-
+
/**
* Handles the real formatting.
- *
+ *
* We use a BigDecimal to format the number without precision loss.
* All the rounding is done by methods in BigDecimal.
* The <code>isLong</code> parameter is used to determine if we are
* formatting a long or BigInteger. In this case, we avoid to format
* the fractional part of the number (unless specified otherwise in the
* format string) that would consist only of a 0 digit.
- *
+ *
* @param number A BigDecimal representation fo the input number.
* @param dest The destination buffer.
* @param isLong A boolean that indicates if this BigDecimal is a real
@@ -1766,7 +1766,7 @@ public class DecimalFormat extends NumberFormat
*/
private void formatInternal(BigDecimal number, boolean isLong,
StringBuffer dest, FieldPosition fieldPos)
- {
+ {
// The specs says that fieldPos should not be null, and that we
// should throw a NPE, but it seems that in few classes that
// reference this one, fieldPos is set to null.
@@ -1775,28 +1775,28 @@ public class DecimalFormat extends NumberFormat
// null. If it cause harms or regressions, just remove this line and
// fix the classes in the point of call, insted.
if (fieldPos == null) fieldPos = new FieldPosition(0);
-
+
int _multiplier = this.multiplier;
-
+
// used to track attribute starting position for each attribute
int attributeStart = -1;
-
+
// now get the sign this will be used by the special case Inifinity
// and by the normal cases.
boolean isNegative = (number.signum() < 0) ? true : false;
if (isNegative)
{
attributeStart = dest.length();
-
+
// append the negative prefix to the string
dest.append(negativePrefix);
-
+
// once got the negative prefix, we can use
// the absolute value.
number = number.abs();
-
+
_multiplier = negativePatternMultiplier;
-
+
addAttribute(Field.SIGN, attributeStart, dest.length());
}
else
@@ -1804,16 +1804,16 @@ public class DecimalFormat extends NumberFormat
// not negative, use the positive prefix
dest.append(positivePrefix);
}
-
+
// these are used ot update the field position
int beginIndexInt = dest.length();
int endIndexInt = 0;
int beginIndexFract = 0;
int endIndexFract = 0;
-
+
// compute the multiplier to use with percent and similar
number = number.multiply(BigDecimal.valueOf(_multiplier));
-
+
// XXX: special case, not sure if it belongs here or if it is
// correct at all. There may be other special cases as well
// these should be handled in the format string parser.
@@ -1823,54 +1823,54 @@ public class DecimalFormat extends NumberFormat
this.maximumIntegerDigits = 1;
this.minimumIntegerDigits = 1;
}
-
+
// get the absolute number
number = number.abs();
// the scaling to use while formatting this number
int scale = this.maximumFractionDigits;
-
+
// this is the actual number we will use
// it is corrected later on to handle exponential
// notation, if needed
long exponent = 0;
-
+
// are we using exponential notation?
if (this.useExponentialNotation)
{
exponent = getExponent(number);
number = number.movePointLeft((int) exponent);
-
+
// FIXME: this makes the test ##.###E0 to pass,
// but all all the other tests to fail...
// this should be really something like
// min + max - what is already shown...
//scale = this.minimumIntegerDigits + this.maximumFractionDigits;
}
-
+
// round the number to the nearest neighbor
number = number.setScale(scale, BigDecimal.ROUND_HALF_EVEN);
// now get the integer and fractional part of the string
// that will be processed later
String plain = number.toPlainString();
-
+
String intPart = null;
String fractPart = null;
-
+
// remove - from the integer part, this is needed as
// the Narrowing Primitive Conversions algorithm used may loose
// information about the sign
int minusIndex = plain.lastIndexOf('-', 0);
if (minusIndex > -1) plain = plain.substring(minusIndex + 1);
-
+
// strip the decimal portion
int dot = plain.indexOf('.');
if (dot > -1)
{
intPart = plain.substring(0, dot);
dot++;
-
+
if (useExponentialNotation)
fractPart = plain.substring(dot, dot + scale);
else
@@ -1880,11 +1880,11 @@ public class DecimalFormat extends NumberFormat
{
intPart = plain;
}
-
+
// used in various places later on
int intPartLen = intPart.length();
endIndexInt = intPartLen;
-
+
// if the number of digits in our intPart is not greater than the
// minimum we have to display, we append zero to the destination
// buffer before adding the integer portion of the number.
@@ -1901,7 +1901,7 @@ public class DecimalFormat extends NumberFormat
// the sum of the minimum integer and maximum fraction
// digits, and does not take into account the maximun integer
// digits to display.
-
+
if (attributeStart < 0)
attributeStart = Math.max(dest.length() - 1, 0);
appendDigit(intPart, dest, this.groupingUsed);
@@ -1911,12 +1911,12 @@ public class DecimalFormat extends NumberFormat
// non exponential notation
intPartLen = intPart.length();
int canary = Math.min(intPartLen, this.maximumIntegerDigits);
-
+
// remove from the string the number in excess
// use only latest digits
intPart = intPart.substring(intPartLen - canary);
endIndexInt = intPart.length() + 1;
-
+
// append it
if (maximumIntegerDigits > 0 &&
!(this.minimumIntegerDigits == 0 &&
@@ -1927,10 +1927,10 @@ public class DecimalFormat extends NumberFormat
appendDigit(intPart, dest, this.groupingUsed);
}
}
-
+
// add the INTEGER attribute
addAttribute(Field.INTEGER, attributeStart, dest.length());
-
+
// ...update field position, if needed, and return...
if ((fieldPos.getField() == INTEGER_FIELD ||
fieldPos.getFieldAttribute() == NumberFormat.Field.INTEGER))
@@ -1938,41 +1938,41 @@ public class DecimalFormat extends NumberFormat
fieldPos.setBeginIndex(beginIndexInt);
fieldPos.setEndIndex(endIndexInt);
}
-
+
handleFractionalPart(dest, fractPart, fieldPos, isLong);
-
+
// and the exponent
if (this.useExponentialNotation)
{
attributeStart = dest.length();
-
+
dest.append(symbols.getExponential());
-
+
addAttribute(Field.EXPONENT_SYMBOL, attributeStart, dest.length());
attributeStart = dest.length();
-
+
if (exponent < 0)
{
dest.append(symbols.getMinusSign());
exponent = -exponent;
-
+
addAttribute(Field.EXPONENT_SIGN, attributeStart, dest.length());
}
-
+
attributeStart = dest.length();
-
+
String exponentString = String.valueOf(exponent);
int exponentLength = exponentString.length();
-
+
for (int i = 0; i < minExponentDigits - exponentLength; i++)
dest.append(symbols.getZeroDigit());
-
+
for (int i = 0; i < exponentLength; ++i)
dest.append(exponentString.charAt(i));
-
+
addAttribute(Field.EXPONENT, attributeStart, dest.length());
}
-
+
// now include the suffixes...
if (isNegative)
{
@@ -1987,7 +1987,7 @@ public class DecimalFormat extends NumberFormat
/**
* Add to the input buffer the result of formatting the fractional
* portion of the number.
- *
+ *
* @param dest
* @param fractPart
* @param fieldPos
@@ -1999,46 +1999,46 @@ public class DecimalFormat extends NumberFormat
int dotStart = 0;
int dotEnd = 0;
boolean addDecimal = false;
-
+
if (this.decimalSeparatorAlwaysShown ||
((!isLong || this.useExponentialNotation) &&
this.showDecimalSeparator && this.maximumFractionDigits > 0) ||
this.minimumFractionDigits > 0)
{
dotStart = dest.length();
-
+
if (this.useCurrencySeparator)
dest.append(symbols.getMonetaryDecimalSeparator());
else
dest.append(symbols.getDecimalSeparator());
-
+
dotEnd = dest.length();
addDecimal = true;
}
-
+
// now handle the fraction portion of the number
int fractStart = 0;
int fractEnd = 0;
boolean addFractional = false;
-
+
if ((!isLong || this.useExponentialNotation)
&& this.maximumFractionDigits > 0
|| this.minimumFractionDigits > 0)
{
fractStart = dest.length();
fractEnd = fractStart;
-
+
int digits = this.minimumFractionDigits;
-
+
if (this.useExponentialNotation)
{
digits = (this.minimumIntegerDigits + this.minimumFractionDigits)
- dest.length();
if (digits < 0) digits = 0;
}
-
+
fractPart = adjustTrailingZeros(fractPart, digits);
-
+
// FIXME: this code must be improved
// now check if the factional part is just 0, in this case
// we need to remove the '.' unless requested
@@ -2049,12 +2049,12 @@ public class DecimalFormat extends NumberFormat
if (fracts[i] != '0')
allZeros = false;
}
-
+
if (!allZeros || (minimumFractionDigits > 0))
{
appendDigit(fractPart, dest, false);
fractEnd = dest.length();
-
+
addDecimal = true;
addFractional = true;
}
@@ -2069,13 +2069,13 @@ public class DecimalFormat extends NumberFormat
addFractional = true;
}
}
-
+
if (addDecimal)
addAttribute(Field.DECIMAL_SEPARATOR, dotStart, dotEnd);
-
+
if (addFractional)
addAttribute(Field.FRACTION, fractStart, fractEnd);
-
+
if ((fieldPos.getField() == FRACTION_FIELD ||
fieldPos.getFieldAttribute() == NumberFormat.Field.FRACTION))
{
@@ -2083,7 +2083,7 @@ public class DecimalFormat extends NumberFormat
fieldPos.setEndIndex(fractEnd);
}
}
-
+
/**
* Append to <code>dest</code>the give number of zeros.
* Grouping is added if needed.
@@ -2094,7 +2094,7 @@ public class DecimalFormat extends NumberFormat
{
char ch = symbols.getZeroDigit();
char gSeparator = symbols.getGroupingSeparator();
-
+
int i = 0;
int gPos = totalDigitCount;
for (i = 0; i < zeroes; i++, gPos--)
@@ -2103,20 +2103,20 @@ public class DecimalFormat extends NumberFormat
(this.groupingUsed && this.groupingSize != 0) &&
(gPos % groupingSize == 0 && i > 0))
dest.append(gSeparator);
-
+
dest.append(ch);
}
-
+
// special case, that requires adding an additional separator
if (this.groupingSeparatorInPattern &&
(this.groupingUsed && this.groupingSize != 0) &&
(gPos % groupingSize == 0))
dest.append(gSeparator);
}
-
+
/**
* Append src to <code>dest</code>.
- *
+ *
* Grouping is added if <code>groupingUsed</code> is set
* to <code>true</code>.
*/
@@ -2124,10 +2124,10 @@ public class DecimalFormat extends NumberFormat
boolean groupingUsed)
{
int zero = symbols.getZeroDigit() - '0';
-
+
int ch;
char gSeparator = symbols.getGroupingSeparator();
-
+
int len = src.length();
for (int i = 0, gPos = len; i < len; i++, gPos--)
{
@@ -2139,7 +2139,7 @@ public class DecimalFormat extends NumberFormat
dest.append((char) (zero + ch));
}
}
-
+
/**
* Calculate the exponent to use if eponential notation is used.
* The exponent is calculated as a power of ten.
@@ -2149,15 +2149,15 @@ public class DecimalFormat extends NumberFormat
private long getExponent(BigDecimal number)
{
long exponent = 0;
-
+
if (number.signum() > 0)
{
double _number = number.doubleValue();
exponent = (long) Math.floor (Math.log10(_number));
-
+
// get the right value for the exponent
exponent = exponent - (exponent % this.exponentRound);
-
+
// if the minimumIntegerDigits is more than zero
// we display minimumIntegerDigits of digits.
// so, for example, if minimumIntegerDigits == 2
@@ -2168,31 +2168,31 @@ public class DecimalFormat extends NumberFormat
if (minimumIntegerDigits > 0)
exponent -= minimumIntegerDigits - 1;
}
-
+
return exponent;
}
-
+
/**
* Remove contiguos zeros from the end of the <code>src</code> string,
* if src contains more than <code>minimumDigits</code> digits.
* if src contains less that <code>minimumDigits</code>,
* then append zeros to the string.
- *
+ *
* Only the first block of zero digits is removed from the string
* and only if they fall in the src.length - minimumDigits
* portion of the string.
- *
+ *
* @param src The string with the correct number of zeros.
*/
private String adjustTrailingZeros(String src, int minimumDigits)
{
int len = src.length();
String result;
-
+
// remove all trailing zero
if (len > minimumDigits)
{
- int zeros = 0;
+ int zeros = 0;
for (int i = len - 1; i > minimumDigits; i--)
{
if (src.charAt(i) == '0')
@@ -2200,7 +2200,7 @@ public class DecimalFormat extends NumberFormat
else
break;
}
- result = src.substring(0, len - zeros);
+ result = src.substring(0, len - zeros);
}
else
{
@@ -2212,13 +2212,13 @@ public class DecimalFormat extends NumberFormat
}
result = _result.toString();
}
-
+
return result;
}
-
+
/**
* Adds an attribute to the attributes list.
- *
+ *
* @param field
* @param begin
* @param end
@@ -2229,13 +2229,13 @@ public class DecimalFormat extends NumberFormat
* This method and its implementation derives directly from the
* ICU4J (http://icu.sourceforge.net/) library, distributed under MIT/X.
*/
-
+
FieldPosition pos = new FieldPosition(field);
pos.setBeginIndex(begin);
pos.setEndIndex(end);
attributes.add(pos);
}
-
+
/**
* Sets the default values for the various properties in this DecimaFormat.
*/
@@ -2245,34 +2245,34 @@ public class DecimalFormat extends NumberFormat
// the most appropriate for them for any locale.
// Anyway, these seem to be good values for a default in most languages.
// Note that most of these will change based on the format string.
-
+
this.negativePrefix = String.valueOf(symbols.getMinusSign());
this.negativeSuffix = "";
this.positivePrefix = "";
this.positiveSuffix = "";
-
+
this.multiplier = 1;
this.negativePatternMultiplier = 1;
this.exponentRound = 1;
-
+
this.hasNegativePrefix = false;
-
+
this.minimumIntegerDigits = 1;
this.maximumIntegerDigits = DEFAULT_INTEGER_DIGITS;
this.minimumFractionDigits = 0;
this.maximumFractionDigits = DEFAULT_FRACTION_DIGITS;
this.minExponentDigits = 0;
-
+
this.groupingSize = 0;
-
+
this.decimalSeparatorAlwaysShown = false;
this.showDecimalSeparator = false;
this.useExponentialNotation = false;
this.groupingUsed = false;
this.groupingSeparatorInPattern = false;
-
+
this.useCurrencySeparator = false;
-
+
this.hasFractionalPattern = false;
}
}
diff --git a/java/text/DecimalFormatSymbols.java b/java/text/DecimalFormatSymbols.java
index b7edf39c4..fa33f34e4 100644
--- a/java/text/DecimalFormatSymbols.java
+++ b/java/text/DecimalFormatSymbols.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -53,7 +53,7 @@ import java.util.ResourceBundle;
import java.util.ServiceLoader;
/**
- * This class is a container for the symbols used by
+ * This class is a container for the symbols used by
* <code>DecimalFormat</code> to format numbers and currency
* for a particular locale. These are
* normally handled automatically, but an application can override
@@ -79,7 +79,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
}
catch(CloneNotSupportedException e)
{
- return null;
+ return null;
}
}
@@ -110,13 +110,13 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
{
if (bundle != null)
{
- try
- {
- return bundle.getString(name);
- }
- catch (MissingResourceException x)
- {
- }
+ try
+ {
+ return bundle.getString(name);
+ }
+ catch (MissingResourceException x)
+ {
+ }
}
return def;
}
@@ -127,13 +127,13 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
String r = null;
if (bundle != null)
{
- try
- {
- r = bundle.getString(name);
- }
- catch (MissingResourceException x)
- {
- }
+ try
+ {
+ r = bundle.getString(name);
+ }
+ catch (MissingResourceException x)
+ {
+ }
}
if (r == null || r.length() < 1)
return def;
@@ -163,12 +163,12 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
try
{
- res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- loc, ClassLoader.getSystemClassLoader());
+ res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+ loc, ClassLoader.getSystemClassLoader());
}
catch (MissingResourceException x)
{
- res = null;
+ res = null;
}
locale = loc;
currency = Currency.getInstance("XXX");
@@ -176,15 +176,15 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
intlCurrencySymbol = "XXX";
try
{
- Currency localeCurrency = Currency.getInstance(loc);
- if (localeCurrency != null)
- {
- setCurrency(localeCurrency);
- }
+ Currency localeCurrency = Currency.getInstance(loc);
+ if (localeCurrency != null)
+ {
+ setCurrency(localeCurrency);
+ }
}
catch(IllegalArgumentException exception)
{
- /* Locale has an invalid currency */
+ /* Locale has an invalid currency */
}
decimalSeparator = safeGetChar (res, "decimalSeparator", '.');
digit = safeGetChar (res, "digit", '#');
@@ -193,11 +193,11 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
infinity = safeGetString (res, "infinity", "\u221e");
try
{
- monetarySeparator = safeGetChar (res, "monetarySeparator", '.');
+ monetarySeparator = safeGetChar (res, "monetarySeparator", '.');
}
catch (MissingResourceException x)
{
- monetarySeparator = decimalSeparator;
+ monetarySeparator = decimalSeparator;
}
minusSign = safeGetChar (res, "minusSign", '-');
NaN = safeGetString (res, "NaN", "\ufffd");
@@ -227,19 +227,19 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
return false;
DecimalFormatSymbols dfs = (DecimalFormatSymbols) obj;
return (currencySymbol.equals(dfs.currencySymbol)
- && decimalSeparator == dfs.decimalSeparator
- && digit == dfs.digit
- && exponential == dfs.exponential
- && groupingSeparator == dfs.groupingSeparator
- && infinity.equals(dfs.infinity)
- && intlCurrencySymbol.equals(dfs.intlCurrencySymbol)
- && minusSign == dfs.minusSign
- && monetarySeparator == dfs.monetarySeparator
- && NaN.equals(dfs.NaN)
- && patternSeparator == dfs.patternSeparator
- && percent == dfs.percent
- && perMill == dfs.perMill
- && zeroDigit == dfs.zeroDigit);
+ && decimalSeparator == dfs.decimalSeparator
+ && digit == dfs.digit
+ && exponential == dfs.exponential
+ && groupingSeparator == dfs.groupingSeparator
+ && infinity.equals(dfs.infinity)
+ && intlCurrencySymbol.equals(dfs.intlCurrencySymbol)
+ && minusSign == dfs.minusSign
+ && monetarySeparator == dfs.monetarySeparator
+ && NaN.equals(dfs.NaN)
+ && patternSeparator == dfs.patternSeparator
+ && percent == dfs.percent
+ && perMill == dfs.perMill
+ && zeroDigit == dfs.zeroDigit);
}
/**
@@ -281,7 +281,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
* format pattern string.
*
* @return The character used to represent a digit in a format
- * pattern string.
+ * pattern string.
*/
public char getDigit ()
{
@@ -503,7 +503,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
* used for the currency attribute, and the currency symbol
* is set to the corresponding value from this instance.
* Otherwise, the currency attribute is set to null and the
- * symbol is left unmodified.
+ * symbol is left unmodified.
*
* @param currencyCode The new international currency symbol.
*/
@@ -512,11 +512,11 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
intlCurrencySymbol = currencyCode;
try
{
- currency = Currency.getInstance(currencyCode);
+ currency = Currency.getInstance(currencyCode);
}
catch (IllegalArgumentException exception)
{
- currency = null;
+ currency = null;
}
if (currency != null)
{
@@ -538,7 +538,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
* This method sets the character used for the decimal point in currency
* values.
*
- * @param decimalSep The decimal point character used in currency values.
+ * @param decimalSep The decimal point character used in currency values.
*/
public void setMonetaryDecimalSeparator (char decimalSep)
{
@@ -547,7 +547,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
/**
* This method sets the string used to represent the NaN (not a
- * number) value.
+ * number) value.
*
* @param nan The string used to represent NaN
*/
@@ -692,10 +692,10 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
if (serialVersionOnStream < 1)
{
monetarySeparator = decimalSeparator;
- exponential = 'E';
+ exponential = 'E';
}
if (serialVersionOnStream < 2)
- locale = Locale.getDefault();
+ locale = Locale.getDefault();
serialVersionOnStream = 2;
}
@@ -707,7 +707,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
* {@link java.text.spi.DecimalFormatSymbolsProvider} instances.
* This is equivalent to calling
* <code>getInstance(Locale.getDefault())</code>.
- *
+ *
* @return a {@link DecimalFormatSymbols} instance for the default
* locale.
* @since 1.6
@@ -722,7 +722,7 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
* specified locale obtained from either the runtime itself
* or one of the installed
* {@link java.text.spi.DecimalFormatSymbolsProvider} instances.
- *
+ *
* @param locale the locale for which an instance should be
* returned.
* @return a {@link DecimalFormatSymbols} instance for the specified
@@ -735,30 +735,30 @@ public class DecimalFormatSymbols implements Cloneable, Serializable
{
try
{
- if (!locale.equals(Locale.ROOT))
- ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- locale,
- ClassLoader.getSystemClassLoader());
- return new DecimalFormatSymbols(locale);
+ if (!locale.equals(Locale.ROOT))
+ ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+ locale,
+ ClassLoader.getSystemClassLoader());
+ return new DecimalFormatSymbols(locale);
}
catch (MissingResourceException x)
{
- /* This means runtime support for the locale
- * is not available, so we check providers. */
+ /* This means runtime support for the locale
+ * is not available, so we check providers. */
}
for (DecimalFormatSymbolsProvider p :
- ServiceLoader.load(DecimalFormatSymbolsProvider.class))
+ ServiceLoader.load(DecimalFormatSymbolsProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- DecimalFormatSymbols syms = p.getInstance(locale);
- if (syms != null)
- return syms;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ DecimalFormatSymbols syms = p.getInstance(locale);
+ if (syms != null)
+ return syms;
+ break;
+ }
+ }
}
return getInstance(LocaleHelper.getFallbackLocale(locale));
}
diff --git a/java/text/FieldPosition.java b/java/text/FieldPosition.java
index 427c07e8e..3a92a6778 100644
--- a/java/text/FieldPosition.java
+++ b/java/text/FieldPosition.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -169,14 +169,14 @@ public class FieldPosition
* <ul>
* <li>The specified object is not <code>null</code>.
* <li>The specified object has the same class as this object.
- * <li>The specified object has the same field identifier, field attribute
+ * <li>The specified object has the same field identifier, field attribute
* and beginning and ending index as this object.
* </ul>
*
* @param obj The object to test for equality to this object.
*
* @return <code>true</code> if the specified object is equal to
- * this object, <code>false</code> otherwise.
+ * this object, <code>false</code> otherwise.
*/
public boolean equals (Object obj)
{
@@ -188,17 +188,17 @@ public class FieldPosition
FieldPosition fp = (FieldPosition) obj;
return (field_id == fp.field_id
- && (field_attribute == fp.field_attribute
- || (field_attribute != null
- && field_attribute.equals(fp.field_attribute)))
- && begin == fp.begin
- && end == fp.end);
+ && (field_attribute == fp.field_attribute
+ || (field_attribute != null
+ && field_attribute.equals(fp.field_attribute)))
+ && begin == fp.begin
+ && end == fp.end);
}
/**
* This method returns a hash value for this object
- *
+ *
* @return A hash value for this object.
*/
public int hashCode ()
@@ -208,7 +208,7 @@ public class FieldPosition
hash = 31 * hash + field_id;
hash = 31 * hash + begin;
hash = 31 * hash + end;
- hash = 31 * hash +
+ hash = 31 * hash +
(null == field_attribute ? 0 : field_attribute.hashCode());
return hash;
@@ -223,10 +223,10 @@ public class FieldPosition
public String toString ()
{
return (getClass ().getName ()
- + "[field=" + getField ()
- + ",attribute=" + getFieldAttribute ()
- + ",beginIndex=" + getBeginIndex ()
- + ",endIndex=" + getEndIndex ()
- + "]");
+ + "[field=" + getField ()
+ + ",attribute=" + getFieldAttribute ()
+ + ",beginIndex=" + getBeginIndex ()
+ + ",endIndex=" + getEndIndex ()
+ + "]");
}
}
diff --git a/java/text/Format.java b/java/text/Format.java
index 7159f4685..29edf0552 100644
--- a/java/text/Format.java
+++ b/java/text/Format.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -44,16 +44,16 @@ import java.io.Serializable;
/**
* This class is the abstract superclass of classes that format and parse
- * data to/from <code>Strings</code>. It is guaranteed that any
+ * data to/from <code>Strings</code>. It is guaranteed that any
* <code>String</code> produced by a concrete subclass of <code>Format</code>
* will be parseable by that same subclass.
* <p>
* In addition to implementing the abstract methods in this class, subclasses
- * should provide static factory methods of the form
+ * should provide static factory methods of the form
* <code>getInstance()</code> and <code>getInstance(Locale)</code> if the
* subclass loads different formatting/parsing schemes based on locale.
* These subclasses should also implement a static method called
- * <code>getAvailableLocales()</code> which returns an array of
+ * <code>getAvailableLocales()</code> which returns an array of
* available locales in the current runtime environment.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
@@ -69,13 +69,13 @@ public abstract class Format implements Serializable, Cloneable
public static class Field extends AttributedCharacterIterator.Attribute
{
static final long serialVersionUID = 276966692217360283L;
-
+
protected Field(String name)
{
super(name);
}
}
-
+
/**
* This method initializes a new instance of <code>Format</code>.
* It performs no actions, but acts as a default constructor for
@@ -87,13 +87,13 @@ public abstract class Format implements Serializable, Cloneable
/**
* This method formats an <code>Object</code> into a <code>String</code>.
- *
+ *
* @param obj The <code>Object</code> to format.
*
* @return The formatted <code>String</code>.
*
* @exception IllegalArgumentException If the <code>Object</code>
- * cannot be formatted.
+ * cannot be formatted.
*/
public final String format(Object obj) throws IllegalArgumentException
{
@@ -109,19 +109,19 @@ public abstract class Format implements Serializable, Cloneable
* @param obj The <code>Object</code> to format.
* @param sb The <code>StringBuffer</code> to append to.
* @param pos The desired <code>FieldPosition</code>, which is also
- * updated by this call.
+ * updated by this call.
*
* @return The updated <code>StringBuffer</code>.
*
* @exception IllegalArgumentException If the <code>Object</code>
- * cannot be formatted.
+ * cannot be formatted.
*/
public abstract StringBuffer format (Object obj, StringBuffer sb,
- FieldPosition pos)
+ FieldPosition pos)
throws IllegalArgumentException;
/**
- * This method parses a <code>String</code> and converts the parsed
+ * This method parses a <code>String</code> and converts the parsed
* contents into an <code>Object</code>.
*
* @param str The <code>String</code> to parse.
@@ -136,21 +136,21 @@ public abstract class Format implements Serializable, Cloneable
Object result = parseObject (str, pos);
if (result == null)
{
- int index = pos.getErrorIndex();
- if (index < 0)
- index = pos.getIndex();
- throw new ParseException("parseObject failed", index);
+ int index = pos.getErrorIndex();
+ if (index < 0)
+ index = pos.getIndex();
+ throw new ParseException("parseObject failed", index);
}
return result;
}
/**
* This method parses a <code>String</code> and converts the parsed
- * contents into an <code>Object</code>.
+ * contents into an <code>Object</code>.
*
* @param str The <code>String</code> to parse.
* @param pos The starting parse index on input, the ending parse
- * index on output.
+ * index on output.
*
* @return The parsed <code>Object</code>, or <code>null</code> in
* case of error.
@@ -171,11 +171,11 @@ public abstract class Format implements Serializable, Cloneable
{
try
{
- return super.clone ();
+ return super.clone ();
}
catch (CloneNotSupportedException e)
{
- return null;
+ return null;
}
}
}
diff --git a/java/text/MessageFormat.java b/java/text/MessageFormat.java
index 700b187fe..ba5805aa0 100644
--- a/java/text/MessageFormat.java
+++ b/java/text/MessageFormat.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -99,7 +99,7 @@ public class MessageFormat extends Format
else if (style.equals("percent"))
format = NumberFormat.getPercentInstance(loc);
else if (style.equals("integer"))
- format = NumberFormat.getIntegerInstance(loc);
+ format = NumberFormat.getIntegerInstance(loc);
else
{
format = NumberFormat.getNumberInstance(loc);
@@ -126,7 +126,7 @@ public class MessageFormat extends Format
else
styleIsPattern = true;
}
-
+
if (type.equals("time"))
format = DateFormat.getTimeInstance(val, loc);
else
@@ -169,7 +169,7 @@ public class MessageFormat extends Format
{
super("");
}
-
+
protected Field(String s)
{
super(s);
@@ -184,7 +184,7 @@ public class MessageFormat extends Format
protected Object readResolve() throws InvalidObjectException
{
if (getName().equals(ARGUMENT.getName()))
- return ARGUMENT;
+ return ARGUMENT;
throw new InvalidObjectException("no such MessageFormat field called " + getName());
}
@@ -201,30 +201,30 @@ public class MessageFormat extends Format
boolean quoted = false;
for (; index < max; ++index)
{
- char c = pat.charAt(index);
- if (quoted)
- {
- // In a quoted context, a single quote ends the quoting.
- if (c == '\'')
- quoted = false;
- else
- buffer.append(c);
- }
- // Check for '', which is a single quote.
- else if (c == '\'' && index + 1 < max && pat.charAt(index + 1) == '\'')
- {
- buffer.append(c);
- ++index;
- }
- else if (c == '\'')
- {
- // Start quoting.
- quoted = true;
- }
- else if (c == '{')
- break;
- else
- buffer.append(c);
+ char c = pat.charAt(index);
+ if (quoted)
+ {
+ // In a quoted context, a single quote ends the quoting.
+ if (c == '\'')
+ quoted = false;
+ else
+ buffer.append(c);
+ }
+ // Check for '', which is a single quote.
+ else if (c == '\'' && index + 1 < max && pat.charAt(index + 1) == '\'')
+ {
+ buffer.append(c);
+ ++index;
+ }
+ else if (c == '\'')
+ {
+ // Start quoting.
+ quoted = true;
+ }
+ else if (c == '{')
+ break;
+ else
+ buffer.append(c);
}
// Note that we explicitly allow an unterminated quote. This is
// done for compatibility.
@@ -243,38 +243,38 @@ public class MessageFormat extends Format
for (; index < max; ++index)
{
- char c = pat.charAt(index);
- // First see if we should turn off quoting.
- if (quoted)
- {
- if (c == '\'')
- quoted = false;
- // In both cases we fall through to inserting the
- // character here.
- }
- // See if we have just a plain quote to insert.
- else if (c == '\'' && index + 1 < max
- && pat.charAt(index + 1) == '\'')
- {
- buffer.append(c);
- ++index;
- }
- // See if quoting should turn on.
- else if (c == '\'')
- quoted = true;
- else if (c == '{')
- ++brace_depth;
- else if (c == '}')
- {
- if (--brace_depth == 0)
- break;
- }
- // Check for TERM after braces, because TERM might be `}'.
- else if (c == term)
- break;
- // All characters, including opening and closing quotes, are
- // inserted here.
- buffer.append(c);
+ char c = pat.charAt(index);
+ // First see if we should turn off quoting.
+ if (quoted)
+ {
+ if (c == '\'')
+ quoted = false;
+ // In both cases we fall through to inserting the
+ // character here.
+ }
+ // See if we have just a plain quote to insert.
+ else if (c == '\'' && index + 1 < max
+ && pat.charAt(index + 1) == '\'')
+ {
+ buffer.append(c);
+ ++index;
+ }
+ // See if quoting should turn on.
+ else if (c == '\'')
+ quoted = true;
+ else if (c == '{')
+ ++brace_depth;
+ else if (c == '}')
+ {
+ if (--brace_depth == 0)
+ break;
+ }
+ // Check for TERM after braces, because TERM might be `}'.
+ else if (c == term)
+ break;
+ // All characters, including opening and closing quotes, are
+ // inserted here.
+ buffer.append(c);
}
return index;
}
@@ -296,27 +296,27 @@ public class MessageFormat extends Format
index = scanFormatElement (pat, index, buffer, ',');
try
{
- mfe.argNumber = Integer.parseInt(buffer.toString());
+ mfe.argNumber = Integer.parseInt(buffer.toString());
}
catch (NumberFormatException nfx)
{
- IllegalArgumentException iae = new IllegalArgumentException(pat);
- iae.initCause(nfx);
- throw iae;
+ IllegalArgumentException iae = new IllegalArgumentException(pat);
+ iae.initCause(nfx);
+ throw iae;
}
// Extract the element format.
if (index < max && pat.charAt(index) == ',')
{
- index = scanFormatElement (pat, index + 1, buffer, ',');
- mfe.type = buffer.toString();
-
- // Extract the style.
- if (index < max && pat.charAt(index) == ',')
- {
- index = scanFormatElement (pat, index + 1, buffer, '}');
- mfe.style = buffer.toString ();
- }
+ index = scanFormatElement (pat, index + 1, buffer, ',');
+ mfe.type = buffer.toString();
+
+ // Extract the style.
+ if (index < max && pat.charAt(index) == ',')
+ {
+ index = scanFormatElement (pat, index + 1, buffer, '}');
+ mfe.style = buffer.toString ();
+ }
}
// Advance past the last terminator.
@@ -373,7 +373,7 @@ public class MessageFormat extends Format
return false;
MessageFormat mf = (MessageFormat) obj;
return (pattern.equals(mf.pattern)
- && locale.equals(mf.locale));
+ && locale.equals(mf.locale));
}
/**
@@ -385,9 +385,9 @@ public class MessageFormat extends Format
{
Object[] arguments_array = (Object[])arguments;
FormatCharacterIterator iterator = new FormatCharacterIterator();
-
+
formatInternal(arguments_array, new StringBuffer(), null, iterator);
-
+
return iterator;
}
@@ -413,15 +413,15 @@ public class MessageFormat extends Format
* @param fp A FieldPosition object (it is ignored).
*/
public final StringBuffer format (Object arguments[], StringBuffer appendBuf,
- FieldPosition fp)
+ FieldPosition fp)
{
return formatInternal(arguments, appendBuf, fp, null);
}
private StringBuffer formatInternal (Object arguments[],
StringBuffer appendBuf,
- FieldPosition fp,
- FormatCharacterIterator output_iterator)
+ FieldPosition fp,
+ FormatCharacterIterator output_iterator)
{
appendBuf.append(leader);
if (output_iterator != null)
@@ -429,93 +429,93 @@ public class MessageFormat extends Format
for (int i = 0; i < elements.length; ++i)
{
- Object thisArg = null;
- boolean unavailable = false;
- if (arguments == null || elements[i].argNumber >= arguments.length)
- unavailable = true;
- else
- thisArg = arguments[elements[i].argNumber];
-
- AttributedCharacterIterator iterator = null;
-
- Format formatter = null;
-
- if (fp != null && i == fp.getField() && fp.getFieldAttribute() == Field.ARGUMENT)
- fp.setBeginIndex(appendBuf.length());
-
- if (unavailable)
- appendBuf.append("{" + elements[i].argNumber + "}");
- else
- {
- if (elements[i].setFormat != null)
- formatter = elements[i].setFormat;
- else if (elements[i].format != null)
- {
- if (elements[i].formatClass != null
- && ! elements[i].formatClass.isInstance(thisArg))
- throw new IllegalArgumentException("Wrong format class");
-
- formatter = elements[i].format;
- }
- else if (thisArg instanceof Number)
- formatter = NumberFormat.getInstance(locale);
- else if (thisArg instanceof Date)
- formatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, locale);
- else
- appendBuf.append(thisArg);
- }
-
- if (fp != null && fp.getField() == i && fp.getFieldAttribute() == Field.ARGUMENT)
- fp.setEndIndex(appendBuf.length());
-
- if (formatter != null)
- {
- // Special-case ChoiceFormat.
- if (formatter instanceof ChoiceFormat)
- {
- StringBuffer buf = new StringBuffer ();
- formatter.format(thisArg, buf, fp);
- MessageFormat mf = new MessageFormat ();
- mf.setLocale(locale);
- mf.applyPattern(buf.toString());
- mf.format(arguments, appendBuf, fp);
- }
- else
- {
- if (output_iterator != null)
- iterator = formatter.formatToCharacterIterator(thisArg);
- else
- formatter.format(thisArg, appendBuf, fp);
- }
-
- elements[i].format = formatter;
- }
-
- if (output_iterator != null)
- {
- HashMap<MessageFormat.Field, Integer> hash_argument =
- new HashMap<MessageFormat.Field, Integer>();
- int position = output_iterator.getEndIndex();
-
- hash_argument.put (MessageFormat.Field.ARGUMENT,
- Integer.valueOf(elements[i].argNumber));
-
-
- if (iterator != null)
- {
- output_iterator.append(iterator);
- output_iterator.addAttributes(hash_argument, position,
- output_iterator.getEndIndex());
- }
- else
- output_iterator.append(thisArg.toString(), hash_argument);
-
- output_iterator.append(elements[i].trailer);
- }
-
- appendBuf.append(elements[i].trailer);
+ Object thisArg = null;
+ boolean unavailable = false;
+ if (arguments == null || elements[i].argNumber >= arguments.length)
+ unavailable = true;
+ else
+ thisArg = arguments[elements[i].argNumber];
+
+ AttributedCharacterIterator iterator = null;
+
+ Format formatter = null;
+
+ if (fp != null && i == fp.getField() && fp.getFieldAttribute() == Field.ARGUMENT)
+ fp.setBeginIndex(appendBuf.length());
+
+ if (unavailable)
+ appendBuf.append("{" + elements[i].argNumber + "}");
+ else
+ {
+ if (elements[i].setFormat != null)
+ formatter = elements[i].setFormat;
+ else if (elements[i].format != null)
+ {
+ if (elements[i].formatClass != null
+ && ! elements[i].formatClass.isInstance(thisArg))
+ throw new IllegalArgumentException("Wrong format class");
+
+ formatter = elements[i].format;
+ }
+ else if (thisArg instanceof Number)
+ formatter = NumberFormat.getInstance(locale);
+ else if (thisArg instanceof Date)
+ formatter = DateFormat.getTimeInstance(DateFormat.DEFAULT, locale);
+ else
+ appendBuf.append(thisArg);
+ }
+
+ if (fp != null && fp.getField() == i && fp.getFieldAttribute() == Field.ARGUMENT)
+ fp.setEndIndex(appendBuf.length());
+
+ if (formatter != null)
+ {
+ // Special-case ChoiceFormat.
+ if (formatter instanceof ChoiceFormat)
+ {
+ StringBuffer buf = new StringBuffer ();
+ formatter.format(thisArg, buf, fp);
+ MessageFormat mf = new MessageFormat ();
+ mf.setLocale(locale);
+ mf.applyPattern(buf.toString());
+ mf.format(arguments, appendBuf, fp);
+ }
+ else
+ {
+ if (output_iterator != null)
+ iterator = formatter.formatToCharacterIterator(thisArg);
+ else
+ formatter.format(thisArg, appendBuf, fp);
+ }
+
+ elements[i].format = formatter;
+ }
+
+ if (output_iterator != null)
+ {
+ HashMap<MessageFormat.Field, Integer> hash_argument =
+ new HashMap<MessageFormat.Field, Integer>();
+ int position = output_iterator.getEndIndex();
+
+ hash_argument.put (MessageFormat.Field.ARGUMENT,
+ Integer.valueOf(elements[i].argNumber));
+
+
+ if (iterator != null)
+ {
+ output_iterator.append(iterator);
+ output_iterator.addAttributes(hash_argument, position,
+ output_iterator.getEndIndex());
+ }
+ else
+ output_iterator.append(thisArg.toString(), hash_argument);
+
+ output_iterator.append(elements[i].trailer);
+ }
+
+ appendBuf.append(elements[i].trailer);
}
-
+
return appendBuf;
}
@@ -529,7 +529,7 @@ public class MessageFormat extends Format
* @param fpos A FieldPosition object (it is ignored).
*/
public final StringBuffer format (Object objectArray, StringBuffer appendBuf,
- FieldPosition fpos)
+ FieldPosition fpos)
{
return format ((Object[])objectArray, appendBuf, fpos);
}
@@ -601,15 +601,15 @@ public class MessageFormat extends Format
* @param pos the current parse position (and eventually the error position).
* @return the array of parsed objects sorted according to their argument number
* in the pattern.
- */
+ */
public Object[] parse (String sourceStr, ParsePosition pos)
{
// Check initial text.
int index = pos.getIndex();
if (! sourceStr.startsWith(leader, index))
{
- pos.setErrorIndex(index);
- return null;
+ pos.setErrorIndex(index);
+ return null;
}
index += leader.length();
@@ -617,79 +617,79 @@ public class MessageFormat extends Format
// Now check each format.
for (int i = 0; i < elements.length; ++i)
{
- Format formatter = null;
- if (elements[i].setFormat != null)
- formatter = elements[i].setFormat;
- else if (elements[i].format != null)
- formatter = elements[i].format;
-
- Object value = null;
- if (formatter instanceof ChoiceFormat)
- {
- // We must special-case a ChoiceFormat because it might
- // have recursive formatting.
- ChoiceFormat cf = (ChoiceFormat) formatter;
- String[] formats = (String[]) cf.getFormats();
- double[] limits = cf.getLimits();
- MessageFormat subfmt = new MessageFormat ();
- subfmt.setLocale(locale);
- ParsePosition subpos = new ParsePosition (index);
-
- int j;
- for (j = 0; value == null && j < limits.length; ++j)
- {
- subfmt.applyPattern(formats[j]);
- subpos.setIndex(index);
- value = subfmt.parse(sourceStr, subpos);
- }
- if (value != null)
- {
- index = subpos.getIndex();
- value = new Double (limits[j]);
- }
- }
- else if (formatter != null)
- {
- pos.setIndex(index);
- value = formatter.parseObject(sourceStr, pos);
- if (value != null)
- index = pos.getIndex();
- }
- else
- {
- // We have a String format. This can lose in a number
- // of ways, but we give it a shot.
- int next_index;
- if (elements[i].trailer.length() > 0)
- next_index = sourceStr.indexOf(elements[i].trailer, index);
- else
- next_index = sourceStr.length();
- if (next_index == -1)
- {
- pos.setErrorIndex(index);
- return null;
- }
- value = sourceStr.substring(index, next_index);
- index = next_index;
- }
-
- if (value == null
- || ! sourceStr.startsWith(elements[i].trailer, index))
- {
- pos.setErrorIndex(index);
- return null;
- }
-
- if (elements[i].argNumber >= results.size())
- {
- // Emulate padding behaviour of Vector.setSize() with ArrayList
- results.ensureCapacity(elements[i].argNumber + 1);
- for (int a = results.size(); a <= elements[i].argNumber; ++a)
- results.add(a, null);
- }
- results.set(elements[i].argNumber, value);
-
- index += elements[i].trailer.length();
+ Format formatter = null;
+ if (elements[i].setFormat != null)
+ formatter = elements[i].setFormat;
+ else if (elements[i].format != null)
+ formatter = elements[i].format;
+
+ Object value = null;
+ if (formatter instanceof ChoiceFormat)
+ {
+ // We must special-case a ChoiceFormat because it might
+ // have recursive formatting.
+ ChoiceFormat cf = (ChoiceFormat) formatter;
+ String[] formats = (String[]) cf.getFormats();
+ double[] limits = cf.getLimits();
+ MessageFormat subfmt = new MessageFormat ();
+ subfmt.setLocale(locale);
+ ParsePosition subpos = new ParsePosition (index);
+
+ int j;
+ for (j = 0; value == null && j < limits.length; ++j)
+ {
+ subfmt.applyPattern(formats[j]);
+ subpos.setIndex(index);
+ value = subfmt.parse(sourceStr, subpos);
+ }
+ if (value != null)
+ {
+ index = subpos.getIndex();
+ value = new Double (limits[j]);
+ }
+ }
+ else if (formatter != null)
+ {
+ pos.setIndex(index);
+ value = formatter.parseObject(sourceStr, pos);
+ if (value != null)
+ index = pos.getIndex();
+ }
+ else
+ {
+ // We have a String format. This can lose in a number
+ // of ways, but we give it a shot.
+ int next_index;
+ if (elements[i].trailer.length() > 0)
+ next_index = sourceStr.indexOf(elements[i].trailer, index);
+ else
+ next_index = sourceStr.length();
+ if (next_index == -1)
+ {
+ pos.setErrorIndex(index);
+ return null;
+ }
+ value = sourceStr.substring(index, next_index);
+ index = next_index;
+ }
+
+ if (value == null
+ || ! sourceStr.startsWith(elements[i].trailer, index))
+ {
+ pos.setErrorIndex(index);
+ return null;
+ }
+
+ if (elements[i].argNumber >= results.size())
+ {
+ // Emulate padding behaviour of Vector.setSize() with ArrayList
+ results.ensureCapacity(elements[i].argNumber + 1);
+ for (int a = results.size(); a <= elements[i].argNumber; ++a)
+ results.add(a, null);
+ }
+ results.set(elements[i].argNumber, value);
+
+ index += elements[i].trailer.length();
}
return results.toArray(new Object[results.size()]);
@@ -746,8 +746,8 @@ public class MessageFormat extends Format
locale = loc;
if (elements != null)
{
- for (int i = 0; i < elements.length; ++i)
- elements[i].setLocale(loc);
+ for (int i = 0; i < elements.length; ++i)
+ elements[i].setLocale(loc);
}
}
@@ -777,15 +777,15 @@ public class MessageFormat extends Format
// First, find the greatest argument number.
for (int i=0;i<elements.length;i++)
if (elements[i].argNumber > argNumMax)
- argNumMax = elements[i].argNumber;
+ argNumMax = elements[i].argNumber;
Format[] formats = new Format[argNumMax];
for (int i=0;i<elements.length;i++)
{
- if (elements[i].setFormat != null)
- formats[elements[i].argNumber] = elements[i].setFormat;
- else if (elements[i].format != null)
- formats[elements[i].argNumber] = elements[i].format;
+ if (elements[i].setFormat != null)
+ formats[elements[i].argNumber] = elements[i].setFormat;
+ else if (elements[i].format != null)
+ formats[elements[i].argNumber] = elements[i].format;
}
return formats;
}
@@ -797,12 +797,12 @@ public class MessageFormat extends Format
* @param newFormat the format to use for this argument.
*/
public void setFormatByArgumentIndex(int argumentIndex,
- Format newFormat)
+ Format newFormat)
{
for (int i=0;i<elements.length;i++)
{
- if (elements[i].argNumber == argumentIndex)
- elements[i].setFormat = newFormat;
+ if (elements[i].argNumber == argumentIndex)
+ elements[i].setFormat = newFormat;
}
}
@@ -820,8 +820,8 @@ public class MessageFormat extends Format
{
for (int i=0;i<newFormats.length;i++)
{
- // Nothing better than that can exist here.
- setFormatByArgumentIndex(i, newFormats[i]);
+ // Nothing better than that can exist here.
+ setFormatByArgumentIndex(i, newFormats[i]);
}
}
diff --git a/java/text/NumberFormat.java b/java/text/NumberFormat.java
index 294f8917c..fef986bc3 100644
--- a/java/text/NumberFormat.java
+++ b/java/text/NumberFormat.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -55,7 +55,7 @@ import java.util.ResourceBundle;
import java.util.ServiceLoader;
/**
- * This is the abstract superclass of all classes which format and
+ * This is the abstract superclass of all classes which format and
* parse numeric values such as decimal numbers, integers, currency values,
* and percentages. These classes perform their parsing and formatting
* in a locale specific manner, accounting for such items as differing
@@ -63,9 +63,9 @@ import java.util.ServiceLoader;
* <p>
* To create an instance of a concrete subclass of <code>NumberFormat</code>,
* do not call a class constructor directly. Instead, use one of the
- * static factory methods in this class such as
+ * static factory methods in this class such as
* <code>getCurrencyInstance</code>.
- *
+ *
* @author Tom Tromey (tromey@cygnus.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
* @date March 4, 1999
@@ -195,7 +195,7 @@ public abstract class NumberFormat extends Format implements Cloneable
/**
* This function is used by the deserializer to know which object
- * to use when it encounters an encoded NumberFormat.Field in a
+ * to use when it encounters an encoded NumberFormat.Field in a
* serialization stream. If the stream is valid it should return
* one of the above field. In the other case we throw an exception.
*
@@ -207,11 +207,11 @@ public abstract class NumberFormat extends Format implements Cloneable
{
String s = getName();
for (int i = 0; i < allFields.length; i++)
- if (s.equals(allFields[i].getName()))
- return allFields[i];
+ if (s.equals(allFields[i].getName()))
+ return allFields[i];
throw new InvalidObjectException("no such NumberFormat field called "
- + s);
+ + s);
}
}
@@ -238,7 +238,7 @@ public abstract class NumberFormat extends Format implements Cloneable
{
if (obj instanceof Number)
return format(((Number) obj).doubleValue(), sbuf, pos);
-
+
throw new
IllegalArgumentException("Cannot format given Object as a Number");
}
@@ -246,30 +246,30 @@ public abstract class NumberFormat extends Format implements Cloneable
/**
* This method formats the specified <code>double</code> and appends it to
* a <code>StringBuffer</code>.
- *
+ *
* @param number The <code>double</code> to format.
- * @param sbuf The <code>StringBuffer</code> to append the formatted number
+ * @param sbuf The <code>StringBuffer</code> to append the formatted number
* to.
* @param pos The desired <code>FieldPosition</code>.
*
* @return The <code>StringBuffer</code> with the appended number.
*/
public abstract StringBuffer format (double number,
- StringBuffer sbuf, FieldPosition pos);
+ StringBuffer sbuf, FieldPosition pos);
/**
* This method formats the specified <code>long</code> and appends it to
* a <code>StringBuffer</code>.
- *
+ *
* @param number The <code>long</code> to format.
- * @param sbuf The <code>StringBuffer</code> to append the formatted number
+ * @param sbuf The <code>StringBuffer</code> to append the formatted number
* to.
* @param pos The desired <code>FieldPosition</code>.
*
* @return The <code>StringBuffer</code> with the appended number.
*/
public abstract StringBuffer format (long number,
- StringBuffer sbuf, FieldPosition pos);
+ StringBuffer sbuf, FieldPosition pos);
/**
* This method tests the specified object for equality against this object.
@@ -280,14 +280,14 @@ public abstract class NumberFormat extends Format implements Cloneable
* <li>The specified object is an instance of <code>NumberFormat</code>.
* </ul>
* <p>
- * Since this method does not test much, it is highly advised that
+ * Since this method does not test much, it is highly advised that
* concrete subclasses override this method.
*
* @param obj The <code>Object</code> to test against equality with
- * this object.
- *
+ * this object.
+ *
* @return <code>true</code> if the specified object is equal to
- * this object, <code>false</code> otherwise.
+ * this object, <code>false</code> otherwise.
*/
public boolean equals (Object obj)
{
@@ -295,11 +295,11 @@ public abstract class NumberFormat extends Format implements Cloneable
return false;
NumberFormat nf = (NumberFormat) obj;
return (groupingUsed == nf.groupingUsed
- && maximumFractionDigits == nf.maximumFractionDigits
- && maximumIntegerDigits == nf.maximumIntegerDigits
- && minimumFractionDigits == nf.minimumFractionDigits
- && minimumIntegerDigits == nf.minimumIntegerDigits
- && parseIntegerOnly == nf.parseIntegerOnly);
+ && maximumFractionDigits == nf.maximumFractionDigits
+ && maximumIntegerDigits == nf.maximumIntegerDigits
+ && minimumFractionDigits == nf.minimumFractionDigits
+ && minimumIntegerDigits == nf.minimumIntegerDigits
+ && parseIntegerOnly == nf.parseIntegerOnly);
}
/**
@@ -320,18 +320,18 @@ public abstract class NumberFormat extends Format implements Cloneable
throws MissingResourceException
{
if (loc.equals(Locale.ROOT))
- return new DecimalFormat(def, DecimalFormatSymbols.getInstance(loc));
+ return new DecimalFormat(def, DecimalFormatSymbols.getInstance(loc));
ResourceBundle res =
ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- loc, ClassLoader.getSystemClassLoader());
+ loc, ClassLoader.getSystemClassLoader());
String fmt;
try
{
- fmt = res == null ? def : res.getString(resource);
+ fmt = res == null ? def : res.getString(resource);
}
catch (MissingResourceException x)
{
- fmt = def;
+ fmt = def;
}
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc);
return new DecimalFormat (fmt, dfs);
@@ -358,36 +358,36 @@ public abstract class NumberFormat extends Format implements Cloneable
{
try
{
- NumberFormat format;
-
- format = computeInstance (loc, "currencyFormat",
- "\u00A4#,##0.00;(\u00A4#,##0.00)");
- format.setMaximumFractionDigits(format.getCurrency().getDefaultFractionDigits());
- return format;
+ NumberFormat format;
+
+ format = computeInstance (loc, "currencyFormat",
+ "\u00A4#,##0.00;(\u00A4#,##0.00)");
+ format.setMaximumFractionDigits(format.getCurrency().getDefaultFractionDigits());
+ return format;
}
catch (MissingResourceException e)
{
- for (NumberFormatProvider p :
- ServiceLoader.load(NumberFormatProvider.class))
- {
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(loc))
- {
- NumberFormat nf = p.getCurrencyInstance(loc);
- if (nf != null)
- return nf;
- break;
- }
- }
- }
- return getCurrencyInstance(LocaleHelper.getFallbackLocale(loc));
+ for (NumberFormatProvider p :
+ ServiceLoader.load(NumberFormatProvider.class))
+ {
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(loc))
+ {
+ NumberFormat nf = p.getCurrencyInstance(loc);
+ if (nf != null)
+ return nf;
+ break;
+ }
+ }
+ }
+ return getCurrencyInstance(LocaleHelper.getFallbackLocale(loc));
}
}
/**
* This method returns a default instance for the default locale. This
- * will be a concrete subclass of <code>NumberFormat</code>, but the
+ * will be a concrete subclass of <code>NumberFormat</code>, but the
* actual class returned is dependent on the locale.
*
* @return An instance of the default <code>NumberFormat</code> class.
@@ -399,7 +399,7 @@ public abstract class NumberFormat extends Format implements Cloneable
/**
* This method returns a default instance for the specified locale. This
- * will be a concrete subclass of <code>NumberFormat</code>, but the
+ * will be a concrete subclass of <code>NumberFormat</code>, but the
* actual class returned is dependent on the locale.
*
* @param loc The desired locale.
@@ -417,7 +417,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* portion of a number.
*
* @return The maximum number of digits allowed in the fraction
- * portion of a number.
+ * portion of a number.
*/
public int getMaximumFractionDigits ()
{
@@ -429,7 +429,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* portion of a number.
*
* @return The maximum number of digits allowed in the integer
- * portion of a number.
+ * portion of a number.
*/
public int getMaximumIntegerDigits ()
{
@@ -441,7 +441,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* portion of a number.
*
* @return The minimum number of digits allowed in the fraction
- * portion of a number.
+ * portion of a number.
*/
public int getMinimumFractionDigits ()
{
@@ -453,7 +453,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* portion of a number.
*
* @return The minimum number of digits allowed in the integer
- * portion of a number.
+ * portion of a number.
*/
public int getMinimumIntegerDigits ()
{
@@ -462,7 +462,7 @@ public abstract class NumberFormat extends Format implements Cloneable
/**
* This method returns a default instance for the specified locale. This
- * will be a concrete subclass of <code>NumberFormat</code>, but the
+ * will be a concrete subclass of <code>NumberFormat</code>, but the
* actual class returned is dependent on the locale.
*
* @return An instance of the default <code>NumberFormat</code> class.
@@ -484,25 +484,25 @@ public abstract class NumberFormat extends Format implements Cloneable
{
try
{
- return computeInstance (loc, "numberFormat", "#,##0.###");
+ return computeInstance (loc, "numberFormat", "#,##0.###");
}
catch (MissingResourceException e)
{
- for (NumberFormatProvider p :
- ServiceLoader.load(NumberFormatProvider.class))
- {
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(loc))
- {
- NumberFormat nf = p.getNumberInstance(loc);
- if (nf != null)
- return nf;
- break;
- }
- }
- }
- return getNumberInstance(LocaleHelper.getFallbackLocale(loc));
+ for (NumberFormatProvider p :
+ ServiceLoader.load(NumberFormatProvider.class))
+ {
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(loc))
+ {
+ NumberFormat nf = p.getNumberInstance(loc);
+ if (nf != null)
+ return nf;
+ break;
+ }
+ }
+ }
+ return getNumberInstance(LocaleHelper.getFallbackLocale(loc));
}
}
@@ -512,7 +512,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* but the actual class returned is dependent on the locale.
*
* @return An instance of an integer number formatter for the default locale.
- * @since 1.4
+ * @since 1.4
*/
public static final NumberFormat getIntegerInstance()
{
@@ -527,35 +527,35 @@ public abstract class NumberFormat extends Format implements Cloneable
* @param locale the desired locale.
*
* @return An instance of an integer number formatter for the desired locale.
- * @since 1.4
+ * @since 1.4
*/
public static NumberFormat getIntegerInstance(Locale locale)
{
try
{
- NumberFormat format = computeInstance (locale,
- "integerFormat", "#,##0");
- format.setMaximumFractionDigits(0);
- format.setParseIntegerOnly (true);
- return format;
+ NumberFormat format = computeInstance (locale,
+ "integerFormat", "#,##0");
+ format.setMaximumFractionDigits(0);
+ format.setParseIntegerOnly (true);
+ return format;
}
catch (MissingResourceException e)
{
- for (NumberFormatProvider p :
- ServiceLoader.load(NumberFormatProvider.class))
- {
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(locale))
- {
- NumberFormat nf = p.getIntegerInstance(locale);
- if (nf != null)
- return nf;
- break;
- }
- }
- }
- return getIntegerInstance(LocaleHelper.getFallbackLocale(locale));
+ for (NumberFormatProvider p :
+ ServiceLoader.load(NumberFormatProvider.class))
+ {
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(locale))
+ {
+ NumberFormat nf = p.getIntegerInstance(locale);
+ if (nf != null)
+ return nf;
+ break;
+ }
+ }
+ }
+ return getIntegerInstance(LocaleHelper.getFallbackLocale(locale));
}
}
@@ -582,25 +582,25 @@ public abstract class NumberFormat extends Format implements Cloneable
{
try
{
- return computeInstance (loc, "percentFormat", "#,##0%");
+ return computeInstance (loc, "percentFormat", "#,##0%");
}
catch (MissingResourceException e)
{
- for (NumberFormatProvider p :
- ServiceLoader.load(NumberFormatProvider.class))
- {
- for (Locale l : p.getAvailableLocales())
- {
- if (l.equals(loc))
- {
- NumberFormat nf = p.getPercentInstance(loc);
- if (nf != null)
- return nf;
- break;
- }
- }
- }
- return getPercentInstance(LocaleHelper.getFallbackLocale(loc));
+ for (NumberFormatProvider p :
+ ServiceLoader.load(NumberFormatProvider.class))
+ {
+ for (Locale l : p.getAvailableLocales())
+ {
+ if (l.equals(loc))
+ {
+ NumberFormat nf = p.getPercentInstance(loc);
+ if (nf != null)
+ return nf;
+ break;
+ }
+ }
+ }
+ return getPercentInstance(LocaleHelper.getFallbackLocale(loc));
}
}
@@ -613,7 +613,7 @@ public abstract class NumberFormat extends Format implements Cloneable
{
int hash = super.hashCode();
hash ^= (maximumFractionDigits + maximumIntegerDigits
- + minimumFractionDigits + minimumIntegerDigits);
+ + minimumFractionDigits + minimumIntegerDigits);
if (groupingUsed)
hash ^= 0xf0f0;
if (parseIntegerOnly)
@@ -631,7 +631,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* locale).
*
* @return <code>true</code> if grouping is enabled,
- * <code>false</code> otherwise.
+ * <code>false</code> otherwise.
*/
public boolean isGroupingUsed ()
{
@@ -644,7 +644,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* point.
*
* @return <code>true</code> if only integers are parsed,
- * <code>false</code> otherwise.
+ * <code>false</code> otherwise.
*/
public boolean isParseIntegerOnly ()
{
@@ -689,10 +689,10 @@ public abstract class NumberFormat extends Format implements Cloneable
Number r = parse (sourceStr, pp);
if (r == null)
{
- int index = pp.getErrorIndex();
- if (index < 0)
- index = pp.getIndex();
- throw new ParseException ("couldn't parse number", index);
+ int index = pp.getErrorIndex();
+ if (index < 0)
+ index = pp.getIndex();
+ throw new ParseException ("couldn't parse number", index);
}
return r;
}
@@ -723,7 +723,7 @@ public abstract class NumberFormat extends Format implements Cloneable
* locale).
*
* @param newValue <code>true</code> to enable grouping,
- * <code>false</code> to disable it.
+ * <code>false</code> to disable it.
*/
public void setGroupingUsed (boolean newValue)
{
@@ -790,12 +790,12 @@ public abstract class NumberFormat extends Format implements Cloneable
setMaximumIntegerDigits (minimumIntegerDigits);
}
- /**
- * This method sets the parsing behavior of this object to parse only
+ /**
+ * This method sets the parsing behavior of this object to parse only
* integers or not.
*
* @param value <code>true</code> to parse only integers,
- * <code>false</code> otherwise.
+ * <code>false</code> otherwise.
*/
public void setParseIntegerOnly (boolean value)
{
@@ -814,7 +814,7 @@ public abstract class NumberFormat extends Format implements Cloneable
{
StringBuffer sbuf = new StringBuffer(50);
FieldPosition position = new FieldPosition(0);
-
+
format (number, sbuf, position);
return sbuf.toString();
}
@@ -840,10 +840,10 @@ public abstract class NumberFormat extends Format implements Cloneable
if (serialVersionOnStream < 1)
{
maximumFractionDigits = maxFractionDigits;
- maximumIntegerDigits = maxIntegerDigits;
- minimumFractionDigits = minFractionDigits;
- minimumIntegerDigits = minIntegerDigits;
- serialVersionOnStream = 1;
+ maximumIntegerDigits = maxIntegerDigits;
+ minimumFractionDigits = minFractionDigits;
+ minimumIntegerDigits = minIntegerDigits;
+ serialVersionOnStream = 1;
}
}
@@ -897,7 +897,7 @@ public abstract class NumberFormat extends Format implements Cloneable
{
if (currency == null)
throw new NullPointerException("currency may not be null");
-
+
throw new UnsupportedOperationException();
}
}
diff --git a/java/text/ParsePosition.java b/java/text/ParsePosition.java
index b0a8a4a0b..80652161d 100644
--- a/java/text/ParsePosition.java
+++ b/java/text/ParsePosition.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -123,7 +123,7 @@ public class ParsePosition
* </ul>
*
* @param obj The <code>Object</code> to test for equality against
- * this object.
+ * this object.
*
* @return <code>true</code> if the specified object is equal to
* this object, <code>false</code> otherwise.
@@ -136,7 +136,7 @@ public class ParsePosition
ParsePosition other = (ParsePosition) obj;
return index == other.index && error_index == other.error_index;
}
-
+
/**
* Return the hash code for this object.
* @return the hash code
@@ -155,6 +155,6 @@ public class ParsePosition
public String toString ()
{
return (getClass ().getName () + "[index=" + getIndex ()
- + ",errorIndex=" + getErrorIndex () + "]");
+ + ",errorIndex=" + getErrorIndex () + "]");
}
}
diff --git a/java/text/RuleBasedCollator.java b/java/text/RuleBasedCollator.java
index b761039ad..c7fc549fe 100644
--- a/java/text/RuleBasedCollator.java
+++ b/java/text/RuleBasedCollator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -66,7 +66,7 @@ import java.util.HashMap;
* case with French. The modifier applies to all rules <b>after</b>
* the modifier but before the next primary sequence. If placed at the end
* of the sequence if applies to all unknown accented character.
- * The relational operators specify how the text
+ * The relational operators specify how the text
* argument relates to the previous term. The relation characters have
* the following meanings:
* <ul>
@@ -81,9 +81,9 @@ import java.util.HashMap;
* <p>
* As for the text argument itself, this is any sequence of Unicode
* characters not in the following ranges: 0x0009-0x000D, 0x0020-0x002F,
- * 0x003A-0x0040, 0x005B-0x0060, and 0x007B-0x007E. If these characters are
- * desired, they must be enclosed in single quotes. If any whitespace is
- * encountered, it is ignored. (For example, "a b" is equal to "ab").
+ * 0x003A-0x0040, 0x005B-0x0060, and 0x007B-0x007E. If these characters are
+ * desired, they must be enclosed in single quotes. If any whitespace is
+ * encountered, it is ignored. (For example, "a b" is equal to "ab").
* <p>
* The reset operation inserts the following rule at the point where the
* text argument to it exists in the previously declared rule string. This
@@ -91,7 +91,7 @@ import java.util.HashMap;
* them in a reset sequence at the end. Note that the text argument, or
* at least the first character of it, must be present somewhere in the
* previously declared rules in order to be inserted properly. If this
- * is not satisfied, a <code>ParseException</code> will be thrown.
+ * is not satisfied, a <code>ParseException</code> will be thrown.
* <p>
* This system of configuring <code>RuleBasedCollator</code> is needlessly
* complex and the people at Taligent who developed it (along with the folks
@@ -100,7 +100,7 @@ import java.util.HashMap;
* <p>
* Here are a couple of example of rule strings:
* <p>
- * "&lt; a &lt; b &lt; c" - This string says that a is greater than b which is
+ * "&lt; a &lt; b &lt; c" - This string says that a is greater than b which is
* greater than c, with all differences being primary differences.
* <p>
* "&lt; a,A &lt; b,B &lt; c,C" - This string says that 'A' is greater than 'a' with
@@ -108,7 +108,7 @@ import java.util.HashMap;
* 'A' during a primary strength comparison. But 'B' is greater than 'b'
* under a tertiary strength comparison.
* <p>
- * "&lt; a &lt; c &amp; a &lt; b " - This sequence is identical in function to the
+ * "&lt; a &lt; c &amp; a &lt; b " - This sequence is identical in function to the
* "&lt; a &lt; b &lt; c" rule string above. The '&amp;' reset symbol indicates that
* the rule "&lt; b" is to be inserted after the text argument "a" in the
* previous rule string segment.
@@ -125,7 +125,7 @@ import java.util.HashMap;
* <p>
* As an additional complication to this already overly complex rule scheme,
* if any characters precede the first rule, these characters are considered
- * ignorable. They will be treated as if they did not exist during
+ * ignorable. They will be treated as if they did not exist during
* comparisons. For example, "- &lt; a &lt; b ..." would make '-' an ignorable
* character such that the strings "high-tech" and "hightech" would
* be considered identical.
@@ -146,7 +146,7 @@ import java.util.HashMap;
public class RuleBasedCollator extends Collator
{
/**
- * This class describes what rank has a character (or a sequence of characters)
+ * This class describes what rank has a character (or a sequence of characters)
* in the lexicographic order. Each element in a rule has a collation element.
*/
static final class CollationElement
@@ -160,7 +160,7 @@ public class RuleBasedCollator extends Collator
final String expansion;
CollationElement(String key, int primary, short secondary, short tertiary,
- short equality, String expansion, boolean ignore)
+ short equality, String expansion, boolean ignore)
{
this.key = key;
this.primary = primary;
@@ -193,7 +193,7 @@ public class RuleBasedCollator extends Collator
static final int EQUAL = 3;
static final int RESET = 4;
static final int INVERSE_SECONDARY = 5;
-
+
final int comparisonType;
final String textElement;
final int hashText;
@@ -203,7 +203,7 @@ public class RuleBasedCollator extends Collator
String expansionOrdering;
private CollationSorter(final int comparisonType, final String textElement,
- final int offset, final boolean ignore)
+ final int offset, final boolean ignore)
{
this.comparisonType = comparisonType;
this.textElement = textElement;
@@ -254,10 +254,10 @@ public class RuleBasedCollator extends Collator
* The JDK uses it to mark and sort the characters which has
* no collation rules.
*/
- static final CollationElement SPECIAL_UNKNOWN_SEQ =
+ static final CollationElement SPECIAL_UNKNOWN_SEQ =
new CollationElement("", (short) 32767, (short) 0, (short) 0,
- (short) 0, null, false);
-
+ (short) 0, null, false);
+
/**
* This method initializes a new instance of <code>RuleBasedCollator</code>
* with the specified collation rules. Note that an application normally
@@ -273,7 +273,7 @@ public class RuleBasedCollator extends Collator
{
if (rules.equals(""))
throw new ParseException("empty rule set", 0);
-
+
this.rules = rules;
buildCollationVector(parseString(rules));
@@ -296,8 +296,8 @@ public class RuleBasedCollator extends Collator
for (index = 0; index < len && index < s.length(); ++index)
{
- if (prefix.charAt(index) != s.charAt(index))
- return index;
+ if (prefix.charAt(index) != s.charAt(index))
+ return index;
}
@@ -317,45 +317,45 @@ public class RuleBasedCollator extends Collator
* @throws ParseException if it is impossible to find an anchor point for the new rules.
*/
private void mergeRules(int offset, String starter, ArrayList<CollationSorter> main,
- ArrayList<CollationSorter> patch)
- throws ParseException
+ ArrayList<CollationSorter> patch)
+ throws ParseException
{
int insertion_point = -1;
int max_length = 0;
-
+
/* We must check that no rules conflict with another already present. If it
- * is the case delete the old rule.
+ * is the case delete the old rule.
*/
-
+
/* For the moment good old O(N^2) algorithm.
*/
for (int i = 0; i < patch.size(); i++)
{
- int j = 0;
-
- while (j < main.size())
- {
- CollationSorter rule1 = patch.get(i);
- CollationSorter rule2 = main.get(j);
-
- if (rule1.textElement.equals(rule2.textElement))
- main.remove(j);
- else
- j++;
- }
+ int j = 0;
+
+ while (j < main.size())
+ {
+ CollationSorter rule1 = patch.get(i);
+ CollationSorter rule2 = main.get(j);
+
+ if (rule1.textElement.equals(rule2.textElement))
+ main.remove(j);
+ else
+ j++;
+ }
}
// Find the insertion point... O(N)
for (int i = 0; i < main.size(); i++)
{
- CollationSorter sorter = main.get(i);
- int length = findPrefixLength(starter, sorter.textElement);
-
- if (length > max_length)
- {
- max_length = length;
- insertion_point = i+1;
- }
+ CollationSorter sorter = main.get(i);
+ int length = findPrefixLength(starter, sorter.textElement);
+
+ if (length > max_length)
+ {
+ max_length = length;
+ insertion_point = i+1;
+ }
}
if (insertion_point < 0)
@@ -363,28 +363,28 @@ public class RuleBasedCollator extends Collator
if (max_length < starter.length())
{
- /*
- * We need to expand the first entry. It must be sorted
- * like if it was the reference key itself (like the spec
- * said. So the first entry is special: the element is
- * replaced by the specified text element for the sorting.
- * This text replace the old one for comparisons. However
- * to preserve the behaviour we replace the first key (corresponding
- * to the found prefix) by a new code rightly ordered in the
- * sequence. The rest of the subsequence must be appended
- * to the end of the sequence.
- */
- CollationSorter sorter = patch.get(0);
-
- sorter.expansionOrdering = starter.substring(max_length); // Skip the first good prefix element
-
- main.add(insertion_point, sorter);
-
- /*
- * This is a new set of rules. Append to the list.
- */
- patch.remove(0);
- insertion_point++;
+ /*
+ * We need to expand the first entry. It must be sorted
+ * like if it was the reference key itself (like the spec
+ * said. So the first entry is special: the element is
+ * replaced by the specified text element for the sorting.
+ * This text replace the old one for comparisons. However
+ * to preserve the behaviour we replace the first key (corresponding
+ * to the found prefix) by a new code rightly ordered in the
+ * sequence. The rest of the subsequence must be appended
+ * to the end of the sequence.
+ */
+ CollationSorter sorter = patch.get(0);
+
+ sorter.expansionOrdering = starter.substring(max_length); // Skip the first good prefix element
+
+ main.add(insertion_point, sorter);
+
+ /*
+ * This is a new set of rules. Append to the list.
+ */
+ patch.remove(0);
+ insertion_point++;
}
// Now insert all elements of patch at the insertion point.
@@ -395,7 +395,7 @@ public class RuleBasedCollator extends Collator
/**
* This method parses a string and build a set of sorting instructions. The parsing
* may only be partial on the case the rules are to be merged sometime later.
- *
+ *
* @param stop_on_reset If this parameter is true then the parser stops when it
* encounters a reset instruction. In the other case, it tries to parse the subrules
* and merged it in the same repository.
@@ -403,12 +403,12 @@ public class RuleBasedCollator extends Collator
* @param base_offset Offset in the string to begin parsing.
* @param rules Rules to be parsed.
* @return -1 if the parser reached the end of the string, an integer representing the
- * offset in the string at which it stopped parsing.
+ * offset in the string at which it stopped parsing.
* @throws ParseException if something turned wrong during the parsing. To get details
* decode the message.
*/
private int subParseString(boolean stop_on_reset, ArrayList<CollationSorter> v,
- int base_offset, String rules)
+ int base_offset, String rules)
throws ParseException
{
boolean ignoreChars = (base_offset == 0);
@@ -419,155 +419,155 @@ public class RuleBasedCollator extends Collator
boolean nextIsModifier = false;
boolean isModifier = false;
int i;
-
+
main_parse_loop:
for (i = 0; i < rules.length(); i++)
{
- char c = rules.charAt(i);
- int type = -1;
-
- if (!eatingChars &&
- ((c >= 0x09 && c <= 0x0D) || (c == 0x20)))
- continue;
-
- isModifier = nextIsModifier;
- nextIsModifier = false;
-
- if (eatingChars && c != '\'')
- {
- doubleQuote = false;
- sb.append(c);
- continue;
- }
- if (doubleQuote && eatingChars)
- {
- sb.append(c);
- doubleQuote = false;
- continue;
- }
-
- switch (c)
- {
- case '!':
- throw new ParseException
- ("Modifier '!' is not yet supported by Classpath", i + base_offset);
- case '<':
- type = CollationSorter.GREATERP;
- break;
- case ';':
- type = CollationSorter.GREATERS;
- break;
- case ',':
- type = CollationSorter.GREATERT;
- break;
- case '=':
- type = CollationSorter.EQUAL;
- break;
- case '\'':
- eatingChars = !eatingChars;
- doubleQuote = true;
- break;
- case '@':
- if (ignoreChars)
- throw new ParseException
- ("comparison list has not yet been started. You may only use"
- + "(<,;=&)", i + base_offset);
- // Inverse the order of secondaries from now on.
- nextIsModifier = true;
- type = CollationSorter.INVERSE_SECONDARY;
- break;
- case '&':
- type = CollationSorter.RESET;
- if (stop_on_reset)
- break main_parse_loop;
- break;
- default:
- if (operator < 0)
- throw new ParseException
- ("operator missing at " + (i + base_offset), i + base_offset);
- if (! eatingChars
- && ((c >= 0x21 && c <= 0x2F)
- || (c >= 0x3A && c <= 0x40)
- || (c >= 0x5B && c <= 0x60)
- || (c >= 0x7B && c <= 0x7E)))
- throw new ParseException
- ("unquoted punctuation character '" + c + "'", i + base_offset);
-
- //type = ignoreChars ? CollationSorter.IGNORE : -1;
- sb.append(c);
- break;
- }
-
- if (type < 0)
- continue;
-
- if (operator < 0)
- {
- operator = type;
- continue;
- }
-
- if (sb.length() == 0 && !isModifier)
- throw new ParseException
- ("text element empty at " + (i+base_offset), i+base_offset);
-
- if (operator == CollationSorter.RESET)
- {
- /* Reposition in the sorting list at the position
- * indicated by the text element.
- */
- String subrules = rules.substring(i);
- ArrayList<CollationSorter> sorted_rules = new ArrayList<CollationSorter>();
- int idx;
-
- // Parse the subrules but do not iterate through all
- // sublist. This is the privilege of the first call.
- idx = subParseString(true, sorted_rules, base_offset+i, subrules);
-
- // Merge new parsed rules into the list.
- mergeRules(base_offset+i, sb.toString(), v, sorted_rules);
- sb.setLength(0);
-
- // Reset state to none.
- operator = -1;
- type = -1;
- // We have found a new subrule at 'idx' but it has not been parsed.
- if (idx >= 0)
- {
- i += idx-1;
- continue main_parse_loop;
- }
- else
- // No more rules.
- break main_parse_loop;
- }
-
- String textElement = sb.toString();
- if (operator == CollationSorter.GREATERP)
- ignoreChars = false;
- CollationSorter sorter = new CollationSorter(operator, textElement,
- base_offset + rules.length(),
- ignoreChars);
- sb.setLength(0);
-
- v.add(sorter);
- operator = type;
+ char c = rules.charAt(i);
+ int type = -1;
+
+ if (!eatingChars &&
+ ((c >= 0x09 && c <= 0x0D) || (c == 0x20)))
+ continue;
+
+ isModifier = nextIsModifier;
+ nextIsModifier = false;
+
+ if (eatingChars && c != '\'')
+ {
+ doubleQuote = false;
+ sb.append(c);
+ continue;
+ }
+ if (doubleQuote && eatingChars)
+ {
+ sb.append(c);
+ doubleQuote = false;
+ continue;
+ }
+
+ switch (c)
+ {
+ case '!':
+ throw new ParseException
+ ("Modifier '!' is not yet supported by Classpath", i + base_offset);
+ case '<':
+ type = CollationSorter.GREATERP;
+ break;
+ case ';':
+ type = CollationSorter.GREATERS;
+ break;
+ case ',':
+ type = CollationSorter.GREATERT;
+ break;
+ case '=':
+ type = CollationSorter.EQUAL;
+ break;
+ case '\'':
+ eatingChars = !eatingChars;
+ doubleQuote = true;
+ break;
+ case '@':
+ if (ignoreChars)
+ throw new ParseException
+ ("comparison list has not yet been started. You may only use"
+ + "(<,;=&)", i + base_offset);
+ // Inverse the order of secondaries from now on.
+ nextIsModifier = true;
+ type = CollationSorter.INVERSE_SECONDARY;
+ break;
+ case '&':
+ type = CollationSorter.RESET;
+ if (stop_on_reset)
+ break main_parse_loop;
+ break;
+ default:
+ if (operator < 0)
+ throw new ParseException
+ ("operator missing at " + (i + base_offset), i + base_offset);
+ if (! eatingChars
+ && ((c >= 0x21 && c <= 0x2F)
+ || (c >= 0x3A && c <= 0x40)
+ || (c >= 0x5B && c <= 0x60)
+ || (c >= 0x7B && c <= 0x7E)))
+ throw new ParseException
+ ("unquoted punctuation character '" + c + "'", i + base_offset);
+
+ //type = ignoreChars ? CollationSorter.IGNORE : -1;
+ sb.append(c);
+ break;
+ }
+
+ if (type < 0)
+ continue;
+
+ if (operator < 0)
+ {
+ operator = type;
+ continue;
+ }
+
+ if (sb.length() == 0 && !isModifier)
+ throw new ParseException
+ ("text element empty at " + (i+base_offset), i+base_offset);
+
+ if (operator == CollationSorter.RESET)
+ {
+ /* Reposition in the sorting list at the position
+ * indicated by the text element.
+ */
+ String subrules = rules.substring(i);
+ ArrayList<CollationSorter> sorted_rules = new ArrayList<CollationSorter>();
+ int idx;
+
+ // Parse the subrules but do not iterate through all
+ // sublist. This is the privilege of the first call.
+ idx = subParseString(true, sorted_rules, base_offset+i, subrules);
+
+ // Merge new parsed rules into the list.
+ mergeRules(base_offset+i, sb.toString(), v, sorted_rules);
+ sb.setLength(0);
+
+ // Reset state to none.
+ operator = -1;
+ type = -1;
+ // We have found a new subrule at 'idx' but it has not been parsed.
+ if (idx >= 0)
+ {
+ i += idx-1;
+ continue main_parse_loop;
+ }
+ else
+ // No more rules.
+ break main_parse_loop;
+ }
+
+ String textElement = sb.toString();
+ if (operator == CollationSorter.GREATERP)
+ ignoreChars = false;
+ CollationSorter sorter = new CollationSorter(operator, textElement,
+ base_offset + rules.length(),
+ ignoreChars);
+ sb.setLength(0);
+
+ v.add(sorter);
+ operator = type;
}
if (operator >= 0)
{
- int pos = rules.length() + base_offset;
+ int pos = rules.length() + base_offset;
- if ((sb.length() != 0 && nextIsModifier)
- || (sb.length() == 0 && !nextIsModifier && !eatingChars))
- throw new ParseException("text element empty at " + pos, pos);
+ if ((sb.length() != 0 && nextIsModifier)
+ || (sb.length() == 0 && !nextIsModifier && !eatingChars))
+ throw new ParseException("text element empty at " + pos, pos);
- if (operator == CollationSorter.GREATERP)
- ignoreChars = false;
+ if (operator == CollationSorter.GREATERP)
+ ignoreChars = false;
- CollationSorter sorter = new CollationSorter(operator, sb.toString(),
- base_offset+pos, ignoreChars);
- v.add(sorter);
+ CollationSorter sorter = new CollationSorter(operator, sb.toString(),
+ base_offset+pos, ignoreChars);
+ v.add(sorter);
}
if (i == rules.length())
@@ -589,12 +589,12 @@ main_parse_loop:
/**
* This method completely parses a string 'rules' containing sorting rules.
*
- * @param rules String containing the rules to be parsed.
+ * @param rules String containing the rules to be parsed.
* @return A set of sorting instructions stored in a Vector.
* @throws ParseException if something turned wrong during the parsing. To get details
* decode the message.
*/
- private ArrayList<CollationSorter> parseString(String rules)
+ private ArrayList<CollationSorter> parseString(String rules)
throws ParseException
{
ArrayList<CollationSorter> v = new ArrayList<CollationSorter>();
@@ -602,7 +602,7 @@ main_parse_loop:
// result of the first subParseString is not absolute (may be -1 or a
// positive integer). But we do not care.
subParseString(false, v, 0, rules);
-
+
return v;
}
@@ -631,60 +631,60 @@ main_parse_loop:
element_loop:
for (int i = 0; i < parsedElements.size(); i++)
{
- CollationSorter elt = parsedElements.get(i);
-
- switch (elt.comparisonType)
- {
- case CollationSorter.GREATERP:
- primary_seq++;
- if (inverseComparisons)
- {
- secondary_seq = Short.MAX_VALUE;
- secondaryType = DECREASING;
- }
- else
- {
- secondary_seq = 0;
- secondaryType = INCREASING;
- }
- tertiary_seq = 0;
- equality_seq = 0;
- inverseComparisons = false;
- break;
- case CollationSorter.GREATERS:
- if (secondaryType == DECREASING)
- secondary_seq--;
- else
- secondary_seq++;
- tertiary_seq = 0;
- equality_seq = 0;
- break;
- case CollationSorter.INVERSE_SECONDARY:
- inverseComparisons = true;
- continue element_loop;
- case CollationSorter.GREATERT:
- tertiary_seq++;
- if (primary_seq == 0)
- last_tertiary_seq = tertiary_seq;
- equality_seq = 0;
- break;
- case CollationSorter.EQUAL:
- equality_seq++;
- break;
- case CollationSorter.RESET:
- throw new ParseException
- ("Invalid reached state 'RESET'. Internal error", elt.offset);
- default:
- throw new ParseException
- ("Invalid unknown state '" + elt.comparisonType + "'", elt.offset);
- }
-
- v.add(new CollationElement(elt.textElement, primary_seq,
- secondary_seq, tertiary_seq,
- equality_seq, elt.expansionOrdering, elt.ignore));
+ CollationSorter elt = parsedElements.get(i);
+
+ switch (elt.comparisonType)
+ {
+ case CollationSorter.GREATERP:
+ primary_seq++;
+ if (inverseComparisons)
+ {
+ secondary_seq = Short.MAX_VALUE;
+ secondaryType = DECREASING;
+ }
+ else
+ {
+ secondary_seq = 0;
+ secondaryType = INCREASING;
+ }
+ tertiary_seq = 0;
+ equality_seq = 0;
+ inverseComparisons = false;
+ break;
+ case CollationSorter.GREATERS:
+ if (secondaryType == DECREASING)
+ secondary_seq--;
+ else
+ secondary_seq++;
+ tertiary_seq = 0;
+ equality_seq = 0;
+ break;
+ case CollationSorter.INVERSE_SECONDARY:
+ inverseComparisons = true;
+ continue element_loop;
+ case CollationSorter.GREATERT:
+ tertiary_seq++;
+ if (primary_seq == 0)
+ last_tertiary_seq = tertiary_seq;
+ equality_seq = 0;
+ break;
+ case CollationSorter.EQUAL:
+ equality_seq++;
+ break;
+ case CollationSorter.RESET:
+ throw new ParseException
+ ("Invalid reached state 'RESET'. Internal error", elt.offset);
+ default:
+ throw new ParseException
+ ("Invalid unknown state '" + elt.comparisonType + "'", elt.offset);
+ }
+
+ v.add(new CollationElement(elt.textElement, primary_seq,
+ secondary_seq, tertiary_seq,
+ equality_seq, elt.expansionOrdering, elt.ignore));
}
- this.inverseAccentComparison = inverseComparisons;
+ this.inverseAccentComparison = inverseComparisons;
ce_table = v.toArray(new CollationElement[v.size()]);
@@ -703,9 +703,9 @@ element_loop:
for (int i = 0; i < ce_table.length; i++)
{
- CollationElement e = ce_table[i];
+ CollationElement e = ce_table[i];
- prefix_tree.put(e.key, e);
+ prefix_tree.put(e.key, e);
}
}
@@ -734,72 +734,72 @@ element_loop:
for(;;)
{
- int ord1;
- int ord2;
-
- /*
- * We have to check whether the characters are ignorable.
- * If it is the case then forget them.
- */
- if (advance_block_1)
- {
- ord1block = cs.nextBlock();
- if (ord1block != null && ord1block.ignore)
- continue;
- }
-
- if (advance_block_2)
- {
- ord2block = ct.nextBlock();
- if (ord2block != null && ord2block.ignore)
- {
- advance_block_1 = false;
- continue;
- }
- }
- else
- advance_block_2 = true;
-
- if (!advance_block_1)
- advance_block_1 = true;
-
- if (ord1block != null)
- ord1 = ord1block.getValue();
- else
- {
- if (ord2block == null)
- return 0;
- return -1;
- }
-
- if (ord2block == null)
- return 1;
-
- ord2 = ord2block.getValue();
-
- // We know chars are totally equal, so skip
+ int ord1;
+ int ord2;
+
+ /*
+ * We have to check whether the characters are ignorable.
+ * If it is the case then forget them.
+ */
+ if (advance_block_1)
+ {
+ ord1block = cs.nextBlock();
+ if (ord1block != null && ord1block.ignore)
+ continue;
+ }
+
+ if (advance_block_2)
+ {
+ ord2block = ct.nextBlock();
+ if (ord2block != null && ord2block.ignore)
+ {
+ advance_block_1 = false;
+ continue;
+ }
+ }
+ else
+ advance_block_2 = true;
+
+ if (!advance_block_1)
+ advance_block_1 = true;
+
+ if (ord1block != null)
+ ord1 = ord1block.getValue();
+ else
+ {
+ if (ord2block == null)
+ return 0;
+ return -1;
+ }
+
+ if (ord2block == null)
+ return 1;
+
+ ord2 = ord2block.getValue();
+
+ // We know chars are totally equal, so skip
if (ord1 == ord2)
- {
- if (getStrength() == IDENTICAL)
- if (!ord1block.key.equals(ord2block.key))
- return ord1block.key.compareTo(ord2block.key);
- continue;
- }
+ {
+ if (getStrength() == IDENTICAL)
+ if (!ord1block.key.equals(ord2block.key))
+ return ord1block.key.compareTo(ord2block.key);
+ continue;
+ }
// Check for primary strength differences
- int prim1 = CollationElementIterator.primaryOrder(ord1);
- int prim2 = CollationElementIterator.primaryOrder(ord2);
-
- if (prim1 == 0 && getStrength() < TERTIARY)
- {
+ int prim1 = CollationElementIterator.primaryOrder(ord1);
+ int prim2 = CollationElementIterator.primaryOrder(ord2);
+
+ if (prim1 == 0 && getStrength() < TERTIARY)
+ {
advance_block_2 = false;
- continue;
- }
- else if (prim2 == 0 && getStrength() < TERTIARY)
- {
- advance_block_1 = false;
- continue;
- }
+ continue;
+ }
+ else if (prim2 == 0 && getStrength() < TERTIARY)
+ {
+ advance_block_1 = false;
+ continue;
+ }
if (prim1 < prim2)
return -1;
@@ -812,7 +812,7 @@ element_loop:
int sec1 = CollationElementIterator.secondaryOrder(ord1);
int sec2 = CollationElementIterator.secondaryOrder(ord2);
- if (sec1 < sec2)
+ if (sec1 < sec2)
return -1;
else if (sec1 > sec2)
return 1;
@@ -827,16 +827,16 @@ element_loop:
return -1;
else if (tert1 > tert2)
return 1;
- else if (getStrength() == TERTIARY)
- continue;
+ else if (getStrength() == TERTIARY)
+ continue;
- // Apparently JDK does this (at least for my test case).
- return ord1block.key.compareTo(ord2block.key);
+ // Apparently JDK does this (at least for my test case).
+ return ord1block.key.compareTo(ord2block.key);
}
}
/**
- * This method tests this object for equality against the specified
+ * This method tests this object for equality against the specified
* object. This will be true if and only if the specified object is
* another reference to this object.
*
@@ -872,7 +872,7 @@ element_loop:
else
v = (short) c;
return new CollationElement("" + c, last_primary_value + v,
- (short) 0, (short) 0, (short) 0, null, false);
+ (short) 0, (short) 0, (short) 0, null, false);
}
/**
@@ -894,7 +894,7 @@ element_loop:
else
v = (short) c;
return new CollationElement("" + c, (short) 0,
- (short) 0, (short) (last_tertiary_value + v), (short) 0, null, false);
+ (short) 0, (short) (last_tertiary_value + v), (short) 0, null, false);
}
/**
@@ -948,29 +948,29 @@ element_loop:
while (ord != CollationElementIterator.NULLORDER)
{
- // If the primary order is null, it means this is an ignorable
- // character.
- if (CollationElementIterator.primaryOrder(ord) == 0)
- {
+ // If the primary order is null, it means this is an ignorable
+ // character.
+ if (CollationElementIterator.primaryOrder(ord) == 0)
+ {
ord = cei.next();
- continue;
- }
+ continue;
+ }
switch (getStrength())
{
case PRIMARY:
- ord = CollationElementIterator.primaryOrder(ord);
- break;
-
+ ord = CollationElementIterator.primaryOrder(ord);
+ break;
+
case SECONDARY:
- ord = CollationElementIterator.primaryOrder(ord) << 8;
- ord |= CollationElementIterator.secondaryOrder(ord);
+ ord = CollationElementIterator.primaryOrder(ord) << 8;
+ ord |= CollationElementIterator.secondaryOrder(ord);
default:
break;
}
- vect.add(Integer.valueOf(ord));
- ord = cei.next(); //increment to next key
+ vect.add(Integer.valueOf(ord));
+ ord = cei.next(); //increment to next key
}
Integer[] objarr = vect.toArray(new Integer[vect.size()]);
diff --git a/java/text/SimpleDateFormat.java b/java/text/SimpleDateFormat.java
index b09c7caa2..05fa4cf15 100644
--- a/java/text/SimpleDateFormat.java
+++ b/java/text/SimpleDateFormat.java
@@ -1,4 +1,4 @@
-/* SimpleDateFormat.java -- A class for parsing/formating simple
+/* SimpleDateFormat.java -- A class for parsing/formating simple
date constructs
Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005
Free Software Foundation, Inc.
@@ -9,7 +9,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -62,13 +62,13 @@ import java.util.regex.Pattern;
/**
* SimpleDateFormat provides convenient methods for parsing and formatting
- * dates using Gregorian calendars (see java.util.GregorianCalendar).
+ * dates using Gregorian calendars (see java.util.GregorianCalendar).
* This class is not thread-safe; external synchronisation should be applied
* if an instance is to be accessed from multiple threads.
*/
-public class SimpleDateFormat extends DateFormat
+public class SimpleDateFormat extends DateFormat
{
- /**
+ /**
* This class is used by <code>SimpleDateFormat</code> as a
* compiled representation of a format string. The field
* ID, size, and character used are stored for each sequence
@@ -93,7 +93,7 @@ public class SimpleDateFormat extends DateFormat
*/
private char character;
- /**
+ /**
* Constructs a compiled field using the
* the given field ID, size and character
* values.
@@ -238,12 +238,12 @@ public class SimpleDateFormat extends DateFormat
// This string is specified in the root of the CLDR.
private static final String standardChars = "GyMdkHmsSEDFwWahKzYeugAZvcL";
- /**
+ /**
* Represents the position of the RFC822 timezone pattern character
* in the array of localized pattern characters. In the
* U.S. locale, this is 'Z'. The value is the offset of the current
* time from GMT e.g. -0500 would be five hours prior to GMT.
- */
+ */
private static final int RFC822_TIMEZONE_FIELD = 23;
/**
@@ -259,7 +259,7 @@ public class SimpleDateFormat extends DateFormat
* @throws ClassNotFoundException if the class of the serialized data
* could not be found.
* @throws InvalidObjectException if the pattern is invalid.
- */
+ */
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
@@ -267,7 +267,7 @@ public class SimpleDateFormat extends DateFormat
if (serialVersionOnStream < 1)
{
computeCenturyStart ();
- serialVersionOnStream = 1;
+ serialVersionOnStream = 1;
}
else
// Ensure that defaultCentury gets set.
@@ -277,11 +277,11 @@ public class SimpleDateFormat extends DateFormat
tokens = new ArrayList<Object>();
try
{
- compileFormat(pattern);
+ compileFormat(pattern);
}
catch (IllegalArgumentException e)
{
- throw new InvalidObjectException("The stream pattern was invalid.");
+ throw new InvalidObjectException("The stream pattern was invalid.");
}
}
@@ -294,7 +294,7 @@ public class SimpleDateFormat extends DateFormat
* @param pattern the non-localized pattern to compile.
* @throws IllegalArgumentException if the pattern is invalid.
*/
- private void compileFormat(String pattern)
+ private void compileFormat(String pattern)
{
// Any alphabetical characters are treated as pattern characters
// unless enclosed in single quotes.
@@ -306,70 +306,70 @@ public class SimpleDateFormat extends DateFormat
for (int i = 0; i < pattern.length(); i++)
{
- thisChar = pattern.charAt(i);
- field = standardChars.indexOf(thisChar);
- if (field == -1)
- {
- current = null;
- if ((thisChar >= 'A' && thisChar <= 'Z')
- || (thisChar >= 'a' && thisChar <= 'z'))
- {
- // Not a valid letter
- throw new IllegalArgumentException("Invalid letter "
- + thisChar +
- " encountered at character "
- + i + ".");
- }
- else if (thisChar == '\'')
- {
- // Quoted text section; skip to next single quote
- pos = pattern.indexOf('\'', i + 1);
- // First look for '' -- meaning a single quote.
- if (pos == i + 1)
- tokens.add("'");
- else
- {
- // Look for the terminating quote. However, if we
- // see a '', that represents a literal quote and
- // we must iterate.
- CPStringBuilder buf = new CPStringBuilder();
- int oldPos = i + 1;
- do
- {
- if (pos == -1)
- throw new IllegalArgumentException("Quotes starting at character "
- + i +
- " not closed.");
- buf.append(pattern.substring(oldPos, pos));
- if (pos + 1 >= pattern.length()
- || pattern.charAt(pos + 1) != '\'')
- break;
- buf.append('\'');
- oldPos = pos + 2;
- pos = pattern.indexOf('\'', pos + 2);
- }
- while (true);
- tokens.add(buf.toString());
- }
- i = pos;
- }
- else
- {
- // A special character
- tokens.add(Character.valueOf(thisChar));
- }
- }
- else
- {
- // A valid field
- if ((current != null) && (field == current.field))
- current.size++;
- else
- {
- current = new CompiledField(field, 1, thisChar);
- tokens.add(current);
- }
- }
+ thisChar = pattern.charAt(i);
+ field = standardChars.indexOf(thisChar);
+ if (field == -1)
+ {
+ current = null;
+ if ((thisChar >= 'A' && thisChar <= 'Z')
+ || (thisChar >= 'a' && thisChar <= 'z'))
+ {
+ // Not a valid letter
+ throw new IllegalArgumentException("Invalid letter "
+ + thisChar +
+ " encountered at character "
+ + i + ".");
+ }
+ else if (thisChar == '\'')
+ {
+ // Quoted text section; skip to next single quote
+ pos = pattern.indexOf('\'', i + 1);
+ // First look for '' -- meaning a single quote.
+ if (pos == i + 1)
+ tokens.add("'");
+ else
+ {
+ // Look for the terminating quote. However, if we
+ // see a '', that represents a literal quote and
+ // we must iterate.
+ CPStringBuilder buf = new CPStringBuilder();
+ int oldPos = i + 1;
+ do
+ {
+ if (pos == -1)
+ throw new IllegalArgumentException("Quotes starting at character "
+ + i +
+ " not closed.");
+ buf.append(pattern.substring(oldPos, pos));
+ if (pos + 1 >= pattern.length()
+ || pattern.charAt(pos + 1) != '\'')
+ break;
+ buf.append('\'');
+ oldPos = pos + 2;
+ pos = pattern.indexOf('\'', pos + 2);
+ }
+ while (true);
+ tokens.add(buf.toString());
+ }
+ i = pos;
+ }
+ else
+ {
+ // A special character
+ tokens.add(Character.valueOf(thisChar));
+ }
+ }
+ else
+ {
+ // A valid field
+ if ((current != null) && (field == current.field))
+ current.size++;
+ else
+ {
+ current = new CompiledField(field, 1, thisChar);
+ tokens.add(current);
+ }
+ }
}
}
@@ -380,7 +380,7 @@ public class SimpleDateFormat extends DateFormat
* @return a string representation of the <code>SimpleDateFormat</code>
* instance.
*/
- public String toString()
+ public String toString()
{
CPStringBuilder output = new CPStringBuilder(getClass().getName());
output.append("[tokens=");
@@ -405,10 +405,10 @@ public class SimpleDateFormat extends DateFormat
* Constructs a SimpleDateFormat using the default pattern for
* the default locale.
*/
- public SimpleDateFormat()
+ public SimpleDateFormat()
{
/*
- * There does not appear to be a standard API for determining
+ * There does not appear to be a standard API for determining
* what the default pattern for a locale is, so use package-scope
* variables in DateFormatSymbols to encapsulate this.
*/
@@ -419,14 +419,14 @@ public class SimpleDateFormat extends DateFormat
tokens = new ArrayList<Object>();
formatData = new DateFormatSymbols(locale);
pattern = (formatData.dateFormats[DEFAULT] + ' '
- + formatData.timeFormats[DEFAULT]);
+ + formatData.timeFormats[DEFAULT]);
compileFormat(pattern);
numberFormat = NumberFormat.getInstance(locale);
numberFormat.setGroupingUsed (false);
numberFormat.setParseIntegerOnly (true);
numberFormat.setMaximumFractionDigits (0);
}
-
+
/**
* Creates a date formatter using the specified non-localized pattern,
* with the default DateFormatSymbols for the default locale.
@@ -435,7 +435,7 @@ public class SimpleDateFormat extends DateFormat
* @throws NullPointerException if the pattern is null.
* @throws IllegalArgumentException if the pattern is invalid.
*/
- public SimpleDateFormat(String pattern)
+ public SimpleDateFormat(String pattern)
{
this(pattern, Locale.getDefault());
}
@@ -449,7 +449,7 @@ public class SimpleDateFormat extends DateFormat
* @throws NullPointerException if the pattern is null.
* @throws IllegalArgumentException if the pattern is invalid.
*/
- public SimpleDateFormat(String pattern, Locale locale)
+ public SimpleDateFormat(String pattern, Locale locale)
{
super();
calendar = new GregorianCalendar(locale);
@@ -561,28 +561,28 @@ public class SimpleDateFormat extends DateFormat
* <code>newChars</code>.
*/
private String translateLocalizedPattern(String pattern,
- String oldChars, String newChars)
+ String oldChars, String newChars)
{
int len = pattern.length();
CPStringBuilder buf = new CPStringBuilder(len);
boolean quoted = false;
for (int i = 0; i < len; i++)
{
- char ch = pattern.charAt(i);
- if (ch == '\'')
- quoted = ! quoted;
- if (! quoted)
- {
- int j = oldChars.indexOf(ch);
- if (j >= 0)
- ch = newChars.charAt(j);
- }
- buf.append(ch);
+ char ch = pattern.charAt(i);
+ if (ch == '\'')
+ quoted = ! quoted;
+ if (! quoted)
+ {
+ int j = oldChars.indexOf(ch);
+ if (j >= 0)
+ ch = newChars.charAt(j);
+ }
+ buf.append(ch);
}
return buf.toString();
}
- /**
+ /**
* Returns the start of the century used for two digit years.
*
* @return A <code>Date</code> representing the start of the century
@@ -630,8 +630,8 @@ public class SimpleDateFormat extends DateFormat
{
if (formatData == null)
{
- throw new
- NullPointerException("The supplied format data was null.");
+ throw new
+ NullPointerException("The supplied format data was null.");
}
this.formatData = formatData;
}
@@ -703,143 +703,143 @@ public class SimpleDateFormat extends DateFormat
Iterator<Object> iter = tokens.iterator();
while (iter.hasNext())
{
- Object o = iter.next();
- if (o instanceof CompiledField)
- {
- CompiledField cf = (CompiledField) o;
- int beginIndex = buffer.length();
-
- switch (cf.getField())
- {
- case ERA_FIELD:
- buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA);
- break;
- case YEAR_FIELD:
- // If we have two digits, then we truncate. Otherwise, we
- // use the size of the pattern, and zero pad.
- buffer.setDefaultAttribute (DateFormat.Field.YEAR);
- if (cf.getSize() == 2)
- {
- temp = "00"+String.valueOf (calendar.get (Calendar.YEAR));
- buffer.append (temp.substring (temp.length() - 2));
- }
- else
- withLeadingZeros (calendar.get (Calendar.YEAR), cf.getSize(), buffer);
- break;
- case MONTH_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.MONTH);
- if (cf.getSize() < 3)
- withLeadingZeros (calendar.get (Calendar.MONTH) + 1, cf.getSize(), buffer);
- else if (cf.getSize() < 4)
- buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]);
- else
- buffer.append (formatData.months[calendar.get (Calendar.MONTH)]);
- break;
- case DATE_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH);
- withLeadingZeros (calendar.get (Calendar.DATE), cf.getSize(), buffer);
- break;
- case HOUR_OF_DAY1_FIELD: // 1-24
- buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1);
- withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1,
- cf.getSize(), buffer);
- break;
- case HOUR_OF_DAY0_FIELD: // 0-23
- buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0);
- withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), cf.getSize(), buffer);
- break;
- case MINUTE_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.MINUTE);
- withLeadingZeros (calendar.get (Calendar.MINUTE),
- cf.getSize(), buffer);
- break;
- case SECOND_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.SECOND);
- withLeadingZeros(calendar.get (Calendar.SECOND),
- cf.getSize(), buffer);
- break;
- case MILLISECOND_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND);
- withLeadingZeros (calendar.get (Calendar.MILLISECOND), cf.getSize(), buffer);
- break;
- case DAY_OF_WEEK_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK);
- if (cf.getSize() < 4)
- buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
- else
- buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
- break;
- case DAY_OF_YEAR_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR);
- withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), cf.getSize(), buffer);
- break;
- case DAY_OF_WEEK_IN_MONTH_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH);
- withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH),
- cf.getSize(), buffer);
- break;
- case WEEK_OF_YEAR_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR);
- withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR),
- cf.getSize(), buffer);
- break;
- case WEEK_OF_MONTH_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH);
- withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH),
- cf.getSize(), buffer);
- break;
- case AM_PM_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.AM_PM);
- buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]);
- break;
- case HOUR1_FIELD: // 1-12
- buffer.setDefaultAttribute (DateFormat.Field.HOUR1);
- withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1,
- cf.getSize(), buffer);
- break;
- case HOUR0_FIELD: // 0-11
- buffer.setDefaultAttribute (DateFormat.Field.HOUR0);
- withLeadingZeros (calendar.get (Calendar.HOUR), cf.getSize(), buffer);
- break;
- case TIMEZONE_FIELD:
- buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE);
- TimeZone zone = calendar.getTimeZone();
- boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0;
- // FIXME: XXX: This should be a localized time zone.
- String zoneID = zone.getDisplayName
- (isDST, cf.getSize() > 3 ? TimeZone.LONG : TimeZone.SHORT);
- buffer.append (zoneID);
- break;
- case RFC822_TIMEZONE_FIELD:
- buffer.setDefaultAttribute(DateFormat.Field.TIME_ZONE);
- int pureMinutes = (calendar.get(Calendar.ZONE_OFFSET) +
- calendar.get(Calendar.DST_OFFSET)) / (1000 * 60);
- String sign = (pureMinutes < 0) ? "-" : "+";
+ Object o = iter.next();
+ if (o instanceof CompiledField)
+ {
+ CompiledField cf = (CompiledField) o;
+ int beginIndex = buffer.length();
+
+ switch (cf.getField())
+ {
+ case ERA_FIELD:
+ buffer.append (formatData.eras[calendar.get (Calendar.ERA)], DateFormat.Field.ERA);
+ break;
+ case YEAR_FIELD:
+ // If we have two digits, then we truncate. Otherwise, we
+ // use the size of the pattern, and zero pad.
+ buffer.setDefaultAttribute (DateFormat.Field.YEAR);
+ if (cf.getSize() == 2)
+ {
+ temp = "00"+String.valueOf (calendar.get (Calendar.YEAR));
+ buffer.append (temp.substring (temp.length() - 2));
+ }
+ else
+ withLeadingZeros (calendar.get (Calendar.YEAR), cf.getSize(), buffer);
+ break;
+ case MONTH_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.MONTH);
+ if (cf.getSize() < 3)
+ withLeadingZeros (calendar.get (Calendar.MONTH) + 1, cf.getSize(), buffer);
+ else if (cf.getSize() < 4)
+ buffer.append (formatData.shortMonths[calendar.get (Calendar.MONTH)]);
+ else
+ buffer.append (formatData.months[calendar.get (Calendar.MONTH)]);
+ break;
+ case DATE_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_MONTH);
+ withLeadingZeros (calendar.get (Calendar.DATE), cf.getSize(), buffer);
+ break;
+ case HOUR_OF_DAY1_FIELD: // 1-24
+ buffer.setDefaultAttribute(DateFormat.Field.HOUR_OF_DAY1);
+ withLeadingZeros ( ((calendar.get (Calendar.HOUR_OF_DAY) + 23) % 24) + 1,
+ cf.getSize(), buffer);
+ break;
+ case HOUR_OF_DAY0_FIELD: // 0-23
+ buffer.setDefaultAttribute (DateFormat.Field.HOUR_OF_DAY0);
+ withLeadingZeros (calendar.get (Calendar.HOUR_OF_DAY), cf.getSize(), buffer);
+ break;
+ case MINUTE_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.MINUTE);
+ withLeadingZeros (calendar.get (Calendar.MINUTE),
+ cf.getSize(), buffer);
+ break;
+ case SECOND_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.SECOND);
+ withLeadingZeros(calendar.get (Calendar.SECOND),
+ cf.getSize(), buffer);
+ break;
+ case MILLISECOND_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.MILLISECOND);
+ withLeadingZeros (calendar.get (Calendar.MILLISECOND), cf.getSize(), buffer);
+ break;
+ case DAY_OF_WEEK_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK);
+ if (cf.getSize() < 4)
+ buffer.append (formatData.shortWeekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
+ else
+ buffer.append (formatData.weekdays[calendar.get (Calendar.DAY_OF_WEEK)]);
+ break;
+ case DAY_OF_YEAR_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_YEAR);
+ withLeadingZeros (calendar.get (Calendar.DAY_OF_YEAR), cf.getSize(), buffer);
+ break;
+ case DAY_OF_WEEK_IN_MONTH_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.DAY_OF_WEEK_IN_MONTH);
+ withLeadingZeros (calendar.get (Calendar.DAY_OF_WEEK_IN_MONTH),
+ cf.getSize(), buffer);
+ break;
+ case WEEK_OF_YEAR_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_YEAR);
+ withLeadingZeros (calendar.get (Calendar.WEEK_OF_YEAR),
+ cf.getSize(), buffer);
+ break;
+ case WEEK_OF_MONTH_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.WEEK_OF_MONTH);
+ withLeadingZeros (calendar.get (Calendar.WEEK_OF_MONTH),
+ cf.getSize(), buffer);
+ break;
+ case AM_PM_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.AM_PM);
+ buffer.append (formatData.ampms[calendar.get (Calendar.AM_PM)]);
+ break;
+ case HOUR1_FIELD: // 1-12
+ buffer.setDefaultAttribute (DateFormat.Field.HOUR1);
+ withLeadingZeros (((calendar.get (Calendar.HOUR) + 11) % 12) + 1,
+ cf.getSize(), buffer);
+ break;
+ case HOUR0_FIELD: // 0-11
+ buffer.setDefaultAttribute (DateFormat.Field.HOUR0);
+ withLeadingZeros (calendar.get (Calendar.HOUR), cf.getSize(), buffer);
+ break;
+ case TIMEZONE_FIELD:
+ buffer.setDefaultAttribute (DateFormat.Field.TIME_ZONE);
+ TimeZone zone = calendar.getTimeZone();
+ boolean isDST = calendar.get (Calendar.DST_OFFSET) != 0;
+ // FIXME: XXX: This should be a localized time zone.
+ String zoneID = zone.getDisplayName
+ (isDST, cf.getSize() > 3 ? TimeZone.LONG : TimeZone.SHORT);
+ buffer.append (zoneID);
+ break;
+ case RFC822_TIMEZONE_FIELD:
+ buffer.setDefaultAttribute(DateFormat.Field.TIME_ZONE);
+ int pureMinutes = (calendar.get(Calendar.ZONE_OFFSET) +
+ calendar.get(Calendar.DST_OFFSET)) / (1000 * 60);
+ String sign = (pureMinutes < 0) ? "-" : "+";
pureMinutes = Math.abs(pureMinutes);
- int hours = pureMinutes / 60;
- int minutes = pureMinutes % 60;
- buffer.append(sign);
- withLeadingZeros(hours, 2, buffer);
- withLeadingZeros(minutes, 2, buffer);
- break;
- default:
- throw new IllegalArgumentException ("Illegal pattern character " +
- cf.getCharacter());
- }
- if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute()
- || cf.getField() == pos.getField()))
- {
- pos.setBeginIndex(beginIndex);
- pos.setEndIndex(buffer.length());
- }
- }
+ int hours = pureMinutes / 60;
+ int minutes = pureMinutes % 60;
+ buffer.append(sign);
+ withLeadingZeros(hours, 2, buffer);
+ withLeadingZeros(minutes, 2, buffer);
+ break;
+ default:
+ throw new IllegalArgumentException ("Illegal pattern character " +
+ cf.getCharacter());
+ }
+ if (pos != null && (buffer.getDefaultAttribute() == pos.getFieldAttribute()
+ || cf.getField() == pos.getField()))
+ {
+ pos.setBeginIndex(beginIndex);
+ pos.setEndIndex(buffer.length());
+ }
+ }
else
- {
- buffer.append(o.toString(), null);
- }
+ {
+ buffer.append(o.toString(), null);
+ }
}
}
-
+
public StringBuffer format(Date date, StringBuffer buffer, FieldPosition pos)
{
formatWithAttribute(date, new StringFormatBuffer (buffer), pos);
@@ -857,15 +857,15 @@ public class SimpleDateFormat extends DateFormat
AttributedFormatBuffer buf = new AttributedFormatBuffer();
formatWithAttribute((Date)date, buf,
- null);
+ null);
buf.sync();
-
+
return new FormatCharacterIterator(buf.getBuffer().toString(),
- buf.getRanges(),
- buf.getAttributes());
+ buf.getRanges(),
+ buf.getAttributes());
}
- private void withLeadingZeros(int value, int length, FormatBuffer buffer)
+ private void withLeadingZeros(int value, int length, FormatBuffer buffer)
{
String valStr = String.valueOf(value);
for (length -= valStr.length(); length > 0; length--)
@@ -886,7 +886,7 @@ public class SimpleDateFormat extends DateFormat
/**
* This method parses the specified string into a date.
- *
+ *
* @param dateStr The date string to parse.
* @param pos The input and output parse position
*
@@ -904,27 +904,27 @@ public class SimpleDateFormat extends DateFormat
boolean is2DigitYear = false;
try
{
- for (; fmt_index < fmt_max; ++fmt_index)
- {
- char ch = pattern.charAt(fmt_index);
- if (ch == '\'')
- {
- if (fmt_index < fmt_max - 1
- && pattern.charAt(fmt_index + 1) == '\'')
- {
- if (! expect (dateStr, pos, ch))
- return null;
- ++fmt_index;
- }
- else
- quote_start = quote_start < 0 ? fmt_index : -1;
- continue;
- }
-
- if (quote_start != -1
- || ((ch < 'a' || ch > 'z')
- && (ch < 'A' || ch > 'Z')))
- {
+ for (; fmt_index < fmt_max; ++fmt_index)
+ {
+ char ch = pattern.charAt(fmt_index);
+ if (ch == '\'')
+ {
+ if (fmt_index < fmt_max - 1
+ && pattern.charAt(fmt_index + 1) == '\'')
+ {
+ if (! expect (dateStr, pos, ch))
+ return null;
+ ++fmt_index;
+ }
+ else
+ quote_start = quote_start < 0 ? fmt_index : -1;
+ continue;
+ }
+
+ if (quote_start != -1
+ || ((ch < 'a' || ch > 'z')
+ && (ch < 'A' || ch > 'Z')))
+ {
if (quote_start == -1 && ch == ' ')
{
// A single unquoted space in the pattern may match
@@ -944,275 +944,275 @@ public class SimpleDateFormat extends DateFormat
}
}
else if (! expect (dateStr, pos, ch))
- return null;
- continue;
- }
-
- // We've arrived at a potential pattern character in the
- // pattern.
- int fmt_count = 1;
- while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch)
- {
- ++fmt_count;
- }
-
- // We might need to limit the number of digits to parse in
- // some cases. We look to the next pattern character to
- // decide.
- boolean limit_digits = false;
- if (fmt_index < fmt_max
- && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0)
- limit_digits = true;
- --fmt_index;
-
- // We can handle most fields automatically: most either are
- // numeric or are looked up in a string vector. In some cases
- // we need an offset. When numeric, `offset' is added to the
- // resulting value. When doing a string lookup, offset is the
- // initial index into the string array.
- int calendar_field;
- boolean is_numeric = true;
- int offset = 0;
- boolean maybe2DigitYear = false;
- boolean oneBasedHour = false;
- boolean oneBasedHourOfDay = false;
- Integer simpleOffset;
- String[] set1 = null;
- String[] set2 = null;
- switch (ch)
- {
- case 'd':
- calendar_field = Calendar.DATE;
- break;
- case 'D':
- calendar_field = Calendar.DAY_OF_YEAR;
- break;
- case 'F':
- calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH;
- break;
- case 'E':
- is_numeric = false;
- offset = 1;
- calendar_field = Calendar.DAY_OF_WEEK;
- set1 = formatData.getWeekdays();
- set2 = formatData.getShortWeekdays();
- break;
- case 'w':
- calendar_field = Calendar.WEEK_OF_YEAR;
- break;
- case 'W':
- calendar_field = Calendar.WEEK_OF_MONTH;
- break;
- case 'M':
- calendar_field = Calendar.MONTH;
- if (fmt_count <= 2)
- offset = -1;
- else
- {
- is_numeric = false;
- set1 = formatData.getMonths();
- set2 = formatData.getShortMonths();
- }
- break;
- case 'y':
- calendar_field = Calendar.YEAR;
- if (fmt_count <= 2)
- maybe2DigitYear = true;
- break;
- case 'K':
- calendar_field = Calendar.HOUR;
- break;
- case 'h':
- calendar_field = Calendar.HOUR;
- oneBasedHour = true;
- break;
- case 'H':
- calendar_field = Calendar.HOUR_OF_DAY;
- break;
- case 'k':
- calendar_field = Calendar.HOUR_OF_DAY;
- oneBasedHourOfDay = true;
- break;
- case 'm':
- calendar_field = Calendar.MINUTE;
- break;
- case 's':
- calendar_field = Calendar.SECOND;
- break;
- case 'S':
- calendar_field = Calendar.MILLISECOND;
- break;
- case 'a':
- is_numeric = false;
- calendar_field = Calendar.AM_PM;
- set1 = formatData.getAmPmStrings();
- break;
- case 'z':
- case 'Z':
- // We need a special case for the timezone, because it
- // uses a different data structure than the other cases.
- is_numeric = false;
- calendar_field = Calendar.ZONE_OFFSET;
- String[][] zoneStrings = formatData.getZoneStrings();
- int zoneCount = zoneStrings.length;
- int index = pos.getIndex();
- boolean found_zone = false;
- simpleOffset = computeOffset(dateStr.substring(index), pos);
- if (simpleOffset != null)
- {
- found_zone = true;
- saw_timezone = true;
- calendar.set(Calendar.DST_OFFSET, 0);
- offset = simpleOffset.intValue();
- }
- else
- {
- for (int j = 0; j < zoneCount; j++)
- {
- String[] strings = zoneStrings[j];
- int k;
- for (k = 0; k < strings.length; ++k)
- {
- if (dateStr.startsWith(strings[k], index))
- break;
- }
- if (k != strings.length)
- {
- found_zone = true;
- saw_timezone = true;
- TimeZone tz = TimeZone.getTimeZone (strings[0]);
- // Check if it's a DST zone or ordinary
- if(k == 3 || k == 4)
- calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings());
- else
- calendar.set (Calendar.DST_OFFSET, 0);
+ return null;
+ continue;
+ }
+
+ // We've arrived at a potential pattern character in the
+ // pattern.
+ int fmt_count = 1;
+ while (++fmt_index < fmt_max && pattern.charAt(fmt_index) == ch)
+ {
+ ++fmt_count;
+ }
+
+ // We might need to limit the number of digits to parse in
+ // some cases. We look to the next pattern character to
+ // decide.
+ boolean limit_digits = false;
+ if (fmt_index < fmt_max
+ && standardChars.indexOf(pattern.charAt(fmt_index)) >= 0)
+ limit_digits = true;
+ --fmt_index;
+
+ // We can handle most fields automatically: most either are
+ // numeric or are looked up in a string vector. In some cases
+ // we need an offset. When numeric, `offset' is added to the
+ // resulting value. When doing a string lookup, offset is the
+ // initial index into the string array.
+ int calendar_field;
+ boolean is_numeric = true;
+ int offset = 0;
+ boolean maybe2DigitYear = false;
+ boolean oneBasedHour = false;
+ boolean oneBasedHourOfDay = false;
+ Integer simpleOffset;
+ String[] set1 = null;
+ String[] set2 = null;
+ switch (ch)
+ {
+ case 'd':
+ calendar_field = Calendar.DATE;
+ break;
+ case 'D':
+ calendar_field = Calendar.DAY_OF_YEAR;
+ break;
+ case 'F':
+ calendar_field = Calendar.DAY_OF_WEEK_IN_MONTH;
+ break;
+ case 'E':
+ is_numeric = false;
+ offset = 1;
+ calendar_field = Calendar.DAY_OF_WEEK;
+ set1 = formatData.getWeekdays();
+ set2 = formatData.getShortWeekdays();
+ break;
+ case 'w':
+ calendar_field = Calendar.WEEK_OF_YEAR;
+ break;
+ case 'W':
+ calendar_field = Calendar.WEEK_OF_MONTH;
+ break;
+ case 'M':
+ calendar_field = Calendar.MONTH;
+ if (fmt_count <= 2)
+ offset = -1;
+ else
+ {
+ is_numeric = false;
+ set1 = formatData.getMonths();
+ set2 = formatData.getShortMonths();
+ }
+ break;
+ case 'y':
+ calendar_field = Calendar.YEAR;
+ if (fmt_count <= 2)
+ maybe2DigitYear = true;
+ break;
+ case 'K':
+ calendar_field = Calendar.HOUR;
+ break;
+ case 'h':
+ calendar_field = Calendar.HOUR;
+ oneBasedHour = true;
+ break;
+ case 'H':
+ calendar_field = Calendar.HOUR_OF_DAY;
+ break;
+ case 'k':
+ calendar_field = Calendar.HOUR_OF_DAY;
+ oneBasedHourOfDay = true;
+ break;
+ case 'm':
+ calendar_field = Calendar.MINUTE;
+ break;
+ case 's':
+ calendar_field = Calendar.SECOND;
+ break;
+ case 'S':
+ calendar_field = Calendar.MILLISECOND;
+ break;
+ case 'a':
+ is_numeric = false;
+ calendar_field = Calendar.AM_PM;
+ set1 = formatData.getAmPmStrings();
+ break;
+ case 'z':
+ case 'Z':
+ // We need a special case for the timezone, because it
+ // uses a different data structure than the other cases.
+ is_numeric = false;
+ calendar_field = Calendar.ZONE_OFFSET;
+ String[][] zoneStrings = formatData.getZoneStrings();
+ int zoneCount = zoneStrings.length;
+ int index = pos.getIndex();
+ boolean found_zone = false;
+ simpleOffset = computeOffset(dateStr.substring(index), pos);
+ if (simpleOffset != null)
+ {
+ found_zone = true;
+ saw_timezone = true;
+ calendar.set(Calendar.DST_OFFSET, 0);
+ offset = simpleOffset.intValue();
+ }
+ else
+ {
+ for (int j = 0; j < zoneCount; j++)
+ {
+ String[] strings = zoneStrings[j];
+ int k;
+ for (k = 0; k < strings.length; ++k)
+ {
+ if (dateStr.startsWith(strings[k], index))
+ break;
+ }
+ if (k != strings.length)
+ {
+ found_zone = true;
+ saw_timezone = true;
+ TimeZone tz = TimeZone.getTimeZone (strings[0]);
+ // Check if it's a DST zone or ordinary
+ if(k == 3 || k == 4)
+ calendar.set (Calendar.DST_OFFSET, tz.getDSTSavings());
+ else
+ calendar.set (Calendar.DST_OFFSET, 0);
offset = tz.getRawOffset ();
- pos.setIndex(index + strings[k].length());
- break;
- }
- }
- }
- if (! found_zone)
- {
- pos.setErrorIndex(pos.getIndex());
- return null;
- }
- break;
- default:
- pos.setErrorIndex(pos.getIndex());
- return null;
- }
-
- // Compute the value we should assign to the field.
- int value;
- int index = -1;
- if (is_numeric)
- {
- numberFormat.setMinimumIntegerDigits(fmt_count);
- if (maybe2DigitYear)
- index = pos.getIndex();
- Number n = null;
- if (limit_digits)
- {
- // numberFormat.setMaximumIntegerDigits(fmt_count) may
- // not work as expected. So we explicitly use substring
- // of dateStr.
- int origPos = pos.getIndex();
- pos.setIndex(0);
- n = numberFormat.parse(dateStr.substring(origPos, origPos + fmt_count), pos);
- pos.setIndex(origPos + pos.getIndex());
- }
- else
- n = numberFormat.parse(dateStr, pos);
- if (pos == null || ! (n instanceof Long))
- return null;
- value = n.intValue() + offset;
- }
- else if (set1 != null)
- {
- index = pos.getIndex();
- int i;
- boolean found = false;
- for (i = offset; i < set1.length; ++i)
- {
- if (set1[i] != null)
- if (dateStr.toUpperCase().startsWith(set1[i].toUpperCase(),
- index))
- {
- found = true;
- pos.setIndex(index + set1[i].length());
- break;
- }
- }
- if (!found && set2 != null)
- {
- for (i = offset; i < set2.length; ++i)
- {
- if (set2[i] != null)
- if (dateStr.toUpperCase().startsWith(set2[i].toUpperCase(),
- index))
- {
- found = true;
- pos.setIndex(index + set2[i].length());
- break;
- }
- }
- }
- if (!found)
- {
- pos.setErrorIndex(index);
- return null;
- }
- value = i;
- }
- else
- value = offset;
-
- if (maybe2DigitYear)
- {
- // Parse into default century if the numeric year string has
- // exactly 2 digits.
- int digit_count = pos.getIndex() - index;
- if (digit_count == 2)
- {
- is2DigitYear = true;
- value += defaultCentury;
- }
- }
-
- // Calendar uses 0-based hours.
- // I.e. 00:00 AM is midnight, not 12 AM or 24:00
- if (oneBasedHour && value == 12)
- value = 0;
-
- if (oneBasedHourOfDay && value == 24)
- value = 0;
-
- // Assign the value and move on.
- calendar.set(calendar_field, value);
- }
-
- if (is2DigitYear)
- {
- // Apply the 80-20 heuristic to dermine the full year based on
- // defaultCenturyStart.
- int year = calendar.get(Calendar.YEAR);
- if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
- calendar.set(Calendar.YEAR, year + 100);
- }
- if (! saw_timezone)
- {
- // Use the real rules to determine whether or not this
- // particular time is in daylight savings.
- calendar.clear (Calendar.DST_OFFSET);
- calendar.clear (Calendar.ZONE_OFFSET);
- }
+ pos.setIndex(index + strings[k].length());
+ break;
+ }
+ }
+ }
+ if (! found_zone)
+ {
+ pos.setErrorIndex(pos.getIndex());
+ return null;
+ }
+ break;
+ default:
+ pos.setErrorIndex(pos.getIndex());
+ return null;
+ }
+
+ // Compute the value we should assign to the field.
+ int value;
+ int index = -1;
+ if (is_numeric)
+ {
+ numberFormat.setMinimumIntegerDigits(fmt_count);
+ if (maybe2DigitYear)
+ index = pos.getIndex();
+ Number n = null;
+ if (limit_digits)
+ {
+ // numberFormat.setMaximumIntegerDigits(fmt_count) may
+ // not work as expected. So we explicitly use substring
+ // of dateStr.
+ int origPos = pos.getIndex();
+ pos.setIndex(0);
+ n = numberFormat.parse(dateStr.substring(origPos, origPos + fmt_count), pos);
+ pos.setIndex(origPos + pos.getIndex());
+ }
+ else
+ n = numberFormat.parse(dateStr, pos);
+ if (pos == null || ! (n instanceof Long))
+ return null;
+ value = n.intValue() + offset;
+ }
+ else if (set1 != null)
+ {
+ index = pos.getIndex();
+ int i;
+ boolean found = false;
+ for (i = offset; i < set1.length; ++i)
+ {
+ if (set1[i] != null)
+ if (dateStr.toUpperCase().startsWith(set1[i].toUpperCase(),
+ index))
+ {
+ found = true;
+ pos.setIndex(index + set1[i].length());
+ break;
+ }
+ }
+ if (!found && set2 != null)
+ {
+ for (i = offset; i < set2.length; ++i)
+ {
+ if (set2[i] != null)
+ if (dateStr.toUpperCase().startsWith(set2[i].toUpperCase(),
+ index))
+ {
+ found = true;
+ pos.setIndex(index + set2[i].length());
+ break;
+ }
+ }
+ }
+ if (!found)
+ {
+ pos.setErrorIndex(index);
+ return null;
+ }
+ value = i;
+ }
+ else
+ value = offset;
+
+ if (maybe2DigitYear)
+ {
+ // Parse into default century if the numeric year string has
+ // exactly 2 digits.
+ int digit_count = pos.getIndex() - index;
+ if (digit_count == 2)
+ {
+ is2DigitYear = true;
+ value += defaultCentury;
+ }
+ }
+
+ // Calendar uses 0-based hours.
+ // I.e. 00:00 AM is midnight, not 12 AM or 24:00
+ if (oneBasedHour && value == 12)
+ value = 0;
+
+ if (oneBasedHourOfDay && value == 24)
+ value = 0;
+
+ // Assign the value and move on.
+ calendar.set(calendar_field, value);
+ }
+
+ if (is2DigitYear)
+ {
+ // Apply the 80-20 heuristic to dermine the full year based on
+ // defaultCenturyStart.
+ int year = calendar.get(Calendar.YEAR);
+ if (calendar.getTime().compareTo(defaultCenturyStart) < 0)
+ calendar.set(Calendar.YEAR, year + 100);
+ }
+ if (! saw_timezone)
+ {
+ // Use the real rules to determine whether or not this
+ // particular time is in daylight savings.
+ calendar.clear (Calendar.DST_OFFSET);
+ calendar.clear (Calendar.ZONE_OFFSET);
+ }
return calendar.getTime();
}
catch (IllegalArgumentException x)
{
pos.setErrorIndex(pos.getIndex());
- return null;
+ return null;
}
}
@@ -1244,7 +1244,7 @@ public class SimpleDateFormat extends DateFormat
* order to allow such failure to be represented.
* </p>
*
- * @param zoneString a string in the form
+ * @param zoneString a string in the form
* (GMT)? sign hours : minutes
* where sign = '+' or '-', hours
* is a one or two digits representing
@@ -1256,7 +1256,7 @@ public class SimpleDateFormat extends DateFormat
*/
private Integer computeOffset(String zoneString, ParsePosition pos)
{
- Pattern pattern =
+ Pattern pattern =
Pattern.compile("(GMT)?([+-])([012])?([0-9]):?([0-9]{2})");
Matcher matcher = pattern.matcher(zoneString);
@@ -1264,35 +1264,35 @@ public class SimpleDateFormat extends DateFormat
boolean hasAll = matcher.lookingAt();
try
{
- // Do we have at least the sign, hour and minute?
- matcher.group(2);
- matcher.group(4);
- matcher.group(5);
+ // Do we have at least the sign, hour and minute?
+ matcher.group(2);
+ matcher.group(4);
+ matcher.group(5);
}
catch (IllegalStateException ise)
{
- hasAll = false;
+ hasAll = false;
}
if (hasAll)
{
- int sign = matcher.group(2).equals("+") ? 1 : -1;
- int hour = Integer.parseInt(matcher.group(4));
- if (!matcher.group(3).equals(""))
- hour += (Integer.parseInt(matcher.group(3)) * 10);
- int minutes = Integer.parseInt(matcher.group(5));
-
- if (hour > 23)
- return null;
- int offset = sign * ((hour * 60) + minutes) * 60000;
-
- // advance the index
- pos.setIndex(pos.getIndex() + matcher.end());
- return Integer.valueOf(offset);
+ int sign = matcher.group(2).equals("+") ? 1 : -1;
+ int hour = Integer.parseInt(matcher.group(4));
+ if (!matcher.group(3).equals(""))
+ hour += (Integer.parseInt(matcher.group(3)) * 10);
+ int minutes = Integer.parseInt(matcher.group(5));
+
+ if (hour > 23)
+ return null;
+ int offset = sign * ((hour * 60) + minutes) * 60000;
+
+ // advance the index
+ pos.setIndex(pos.getIndex() + matcher.end());
+ return Integer.valueOf(offset);
}
else if (zoneString.startsWith("GMT"))
{
- pos.setIndex(pos.getIndex() + 3);
- return Integer.valueOf(0);
+ pos.setIndex(pos.getIndex() + 3);
+ return Integer.valueOf(0);
}
return null;
}
diff --git a/java/text/StringCharacterIterator.java b/java/text/StringCharacterIterator.java
index 85ca302cb..e94e0fbef 100644
--- a/java/text/StringCharacterIterator.java
+++ b/java/text/StringCharacterIterator.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -39,11 +39,11 @@ exception statement from your version. */
package java.text;
/**
- * This class iterates over a range of characters in a <code>String</code>.
+ * This class iterates over a range of characters in a <code>String</code>.
* For a given range of text, a beginning and ending index,
* as well as a current index are defined. These values can be queried
* by the methods in this interface. Additionally, various methods allow
- * the index to be set.
+ * the index to be set.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey (tromey@cygnus.com)
@@ -76,9 +76,9 @@ public final class StringCharacterIterator implements CharacterIterator
* text of the specified <code>String</code>. The initial index
* value will be set to the first character in the string.
*
- * @param text The <code>String</code> to iterate through (<code>null</code>
+ * @param text The <code>String</code> to iterate through (<code>null</code>
* not permitted).
- *
+ *
* @throws NullPointerException if <code>text</code> is <code>null</code>.
*/
public StringCharacterIterator (String text)
@@ -209,7 +209,7 @@ public final class StringCharacterIterator implements CharacterIterator
* the character there.
*
* @return The character at the beginning of the range, or
- * <code>DONE</code> if the range is empty.
+ * <code>DONE</code> if the range is empty.
*/
public char first ()
{
@@ -225,7 +225,7 @@ public final class StringCharacterIterator implements CharacterIterator
* will be set equal to the beginning index.
*
* @return The character at the end of the range, or
- * <code>DONE</code> if the range is empty.
+ * <code>DONE</code> if the range is empty.
*/
public char last ()
{
@@ -257,7 +257,7 @@ public final class StringCharacterIterator implements CharacterIterator
* @param index The new index value.
*
* @return The character at the new index value or <code>DONE</code>
- * if the index value is equal to <code>getEndIndex</code>.
+ * if the index value is equal to <code>getEndIndex</code>.
*
* @exception IllegalArgumentException If the specified index is not valid
*/
@@ -313,7 +313,7 @@ public final class StringCharacterIterator implements CharacterIterator
/*************************************************************************/
/**
- * This method tests this object for equality againt the specified
+ * This method tests this object for equality againt the specified
* object. This will be true if and only if the specified object:
* <p>
* <ul>
@@ -336,11 +336,11 @@ public final class StringCharacterIterator implements CharacterIterator
StringCharacterIterator sci = (StringCharacterIterator) obj;
return (begin == sci.begin
- && end == sci.end
- && index == sci.index
- && text.equals (sci.text));
+ && end == sci.end
+ && index == sci.index
+ && text.equals (sci.text));
}
-
+
/**
* Return the hash code for this object.
* @return the hash code
diff --git a/java/text/spi/DateFormatProvider.java b/java/text/spi/DateFormatProvider.java
index 43d54a0c6..ea7ecd39e 100644
--- a/java/text/spi/DateFormatProvider.java
+++ b/java/text/spi/DateFormatProvider.java
@@ -80,7 +80,7 @@ public abstract class DateFormatProvider
* @see java.text.DateFormat#getDateInstance(int,java.util.Locale)
*/
public abstract DateFormat getDateInstance(int style,
- Locale locale);
+ Locale locale);
/**
* Returns a {@link java.text.DateFormat} instance
@@ -103,8 +103,8 @@ public abstract class DateFormatProvider
* @see java.text.DateFormat#getDateInstance(java.util.Locale)
*/
public abstract DateFormat getDateTimeInstance(int dateStyle,
- int timeStyle,
- Locale locale);
+ int timeStyle,
+ Locale locale);
/**
* Returns a {@link java.text.DateFormat} instance
@@ -124,6 +124,6 @@ public abstract class DateFormatProvider
* @see java.text.DateFormat#getTimeInstance(int,java.util.Locale)
*/
public abstract DateFormat getTimeInstance(int style,
- Locale locale);
+ Locale locale);
}
diff --git a/java/text/spi/NumberFormatProvider.java b/java/text/spi/NumberFormatProvider.java
index 2a252701f..e8a72e44c 100644
--- a/java/text/spi/NumberFormatProvider.java
+++ b/java/text/spi/NumberFormatProvider.java
@@ -80,7 +80,7 @@ public abstract class NumberFormatProvider
/**
* Returns a {@link java.text.NumberFormat} instance
* for integers in the specified {@link java.util.Locale}.
- * The returned instance should be configured to round
+ * The returned instance should be configured to round
* floating point numbers to the nearest integer using
* {@link java.math.RoundingMode#HALF_EVEN} rounding,
* and to parse only the integer part of a number.
diff --git a/java/util/AbstractCollection.java b/java/util/AbstractCollection.java
index a11654ebb..d3406c230 100644
--- a/java/util/AbstractCollection.java
+++ b/java/util/AbstractCollection.java
@@ -441,11 +441,11 @@ public abstract class AbstractCollection<E>
while (hasNext)
{
Object o = itr.next();
- if (o == this)
- r.append("<this>");
- else
- r.append(o);
- hasNext = itr.hasNext();
+ if (o == this)
+ r.append("<this>");
+ else
+ r.append(o);
+ hasNext = itr.hasNext();
if (hasNext)
r.append(", ");
}
diff --git a/java/util/AbstractList.java b/java/util/AbstractList.java
index c47b59b21..13ee28a04 100644
--- a/java/util/AbstractList.java
+++ b/java/util/AbstractList.java
@@ -243,7 +243,7 @@ public abstract class AbstractList<E>
* Obtains a hash code for this list. In order to obey the general
* contract of the hashCode method of class Object, this value is
* calculated as follows:
- *
+ *
<pre>hashCode = 1;
Iterator i = list.iterator();
while (i.hasNext())
@@ -591,7 +591,7 @@ while (i.hasNext())
/**
* Adds the supplied object before the element that would be returned
* by a call to <code>next()</code>, if the list supports addition.
- *
+ *
* @param o The object to add to the list.
* @throws UnsupportedOperationException if the list doesn't support
* the addition of new elements.
@@ -713,7 +713,7 @@ while (i.hasNext())
*
* All methods first check to see if the actual modCount of the backing
* list is equal to its expected value, and throw a
- * ConcurrentModificationException if it is not.
+ * ConcurrentModificationException if it is not.
*
* @param fromIndex the index that the returned list should start from
* (inclusive)
@@ -756,7 +756,7 @@ while (i.hasNext())
final int offset;
/** The size of the sublist. */
int size;
-
+
/**
* Construct the sublist.
*
@@ -771,7 +771,7 @@ while (i.hasNext())
offset = fromIndex;
size = toIndex - fromIndex;
}
-
+
/**
* This method checks the two modCount fields to ensure that there has
* not been a concurrent modification, returning if all is okay.
@@ -783,9 +783,9 @@ while (i.hasNext())
void checkMod()
{
if (modCount != backingList.modCount)
- throw new ConcurrentModificationException();
+ throw new ConcurrentModificationException();
}
-
+
/**
* This method checks that a value is between 0 and size (inclusive). If
* it is not, an exception is thrown.
@@ -797,10 +797,10 @@ while (i.hasNext())
private void checkBoundsInclusive(int index)
{
if (index < 0 || index > size)
- throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
- + size);
+ throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
+ + size);
}
-
+
/**
* This method checks that a value is between 0 (inclusive) and size
* (exclusive). If it is not, an exception is thrown.
@@ -812,10 +812,10 @@ while (i.hasNext())
private void checkBoundsExclusive(int index)
{
if (index < 0 || index >= size)
- throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
- + size);
+ throw new IndexOutOfBoundsException("Index: " + index + ", Size:"
+ + size);
}
-
+
/**
* Specified by AbstractList.subList to return the private field size.
*
@@ -828,7 +828,7 @@ while (i.hasNext())
checkMod();
return size;
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -851,7 +851,7 @@ while (i.hasNext())
checkBoundsExclusive(index);
return backingList.set(index + offset, o);
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -867,7 +867,7 @@ while (i.hasNext())
checkBoundsExclusive(index);
return backingList.get(index + offset);
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -891,7 +891,7 @@ while (i.hasNext())
size++;
modCount = backingList.modCount;
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -912,7 +912,7 @@ while (i.hasNext())
modCount = backingList.modCount;
return o;
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
* This does no bounds checking, as it assumes it will only be called
@@ -928,12 +928,12 @@ while (i.hasNext())
protected void removeRange(int fromIndex, int toIndex)
{
checkMod();
-
+
backingList.removeRange(offset + fromIndex, offset + toIndex);
size -= toIndex - fromIndex;
modCount = backingList.modCount;
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -961,7 +961,7 @@ while (i.hasNext())
modCount = backingList.modCount;
return result;
}
-
+
/**
* Specified by AbstractList.subList to return addAll(size, c).
*
@@ -981,7 +981,7 @@ while (i.hasNext())
{
return addAll(size, c);
}
-
+
/**
* Specified by AbstractList.subList to return listIterator().
*
@@ -991,7 +991,7 @@ while (i.hasNext())
{
return listIterator();
}
-
+
/**
* Specified by AbstractList.subList to return a wrapper around the
* backing list's iterator.
@@ -1006,176 +1006,176 @@ while (i.hasNext())
{
checkMod();
checkBoundsInclusive(index);
-
+
return new ListIterator<E>()
- {
- private final ListIterator<E> i
- = backingList.listIterator(index + offset);
- private int position = index;
-
- /**
- * Tests to see if there are any more objects to
- * return.
- *
- * @return True if the end of the list has not yet been
- * reached.
- */
- public boolean hasNext()
- {
- return position < size;
- }
-
- /**
- * Tests to see if there are objects prior to the
- * current position in the list.
- *
- * @return True if objects exist prior to the current
- * position of the iterator.
- */
- public boolean hasPrevious()
- {
- return position > 0;
- }
-
- /**
- * Retrieves the next object from the list.
- *
- * @return The next object.
- * @throws NoSuchElementException if there are no
- * more objects to retrieve.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public E next()
- {
- if (position == size)
- throw new NoSuchElementException();
- position++;
- return i.next();
- }
-
- /**
- * Retrieves the previous object from the list.
- *
- * @return The next object.
- * @throws NoSuchElementException if there are no
- * previous objects to retrieve.
- * @throws ConcurrentModificationException if the
- * list has been modified elsewhere.
- */
- public E previous()
- {
- if (position == 0)
- throw new NoSuchElementException();
- position--;
- return i.previous();
- }
-
- /**
- * Returns the index of the next element in the
- * list, which will be retrieved by <code>next()</code>
- *
- * @return The index of the next element.
- */
- public int nextIndex()
- {
- return i.nextIndex() - offset;
- }
-
- /**
- * Returns the index of the previous element in the
- * list, which will be retrieved by <code>previous()</code>
- *
- * @return The index of the previous element.
- */
- public int previousIndex()
- {
- return i.previousIndex() - offset;
- }
-
- /**
- * Removes the last object retrieved by <code>next()</code>
- * from the list, if the list supports object removal.
- *
- * @throws IllegalStateException if the iterator is positioned
- * before the start of the list or the last object has already
- * been removed.
- * @throws UnsupportedOperationException if the list does
- * not support removing elements.
- */
- public void remove()
- {
- i.remove();
- size--;
- position = nextIndex();
- modCount = backingList.modCount;
- }
-
-
- /**
- * Replaces the last object retrieved by <code>next()</code>
- * or <code>previous</code> with o, if the list supports object
- * replacement and an add or remove operation has not already
- * been performed.
- *
- * @throws IllegalStateException if the iterator is positioned
- * before the start of the list or the last object has already
- * been removed.
- * @throws UnsupportedOperationException if the list doesn't support
- * the addition or removal of elements.
- * @throws ClassCastException if the type of o is not a valid type
- * for this list.
- * @throws IllegalArgumentException if something else related to o
- * prevents its addition.
- * @throws ConcurrentModificationException if the list
- * has been modified elsewhere.
- */
- public void set(E o)
- {
- i.set(o);
- }
-
- /**
- * Adds the supplied object before the element that would be returned
- * by a call to <code>next()</code>, if the list supports addition.
- *
- * @param o The object to add to the list.
- * @throws UnsupportedOperationException if the list doesn't support
- * the addition of new elements.
- * @throws ClassCastException if the type of o is not a valid type
- * for this list.
- * @throws IllegalArgumentException if something else related to o
- * prevents its addition.
- * @throws ConcurrentModificationException if the list
- * has been modified elsewhere.
- */
- public void add(E o)
- {
- i.add(o);
- size++;
- position++;
- modCount = backingList.modCount;
- }
-
- // Here is the reason why the various modCount fields are mostly
- // ignored in this wrapper listIterator.
- // If the backing listIterator is failfast, then the following holds:
- // Using any other method on this list will call a corresponding
- // method on the backing list *after* the backing listIterator
- // is created, which will in turn cause a ConcurrentModException
- // when this listIterator comes to use the backing one. So it is
- // implicitly failfast.
- // If the backing listIterator is NOT failfast, then the whole of
- // this list isn't failfast, because the modCount field of the
- // backing list is not valid. It would still be *possible* to
- // make the iterator failfast wrt modifications of the sublist
- // only, but somewhat pointless when the list can be changed under
- // us.
- // Either way, no explicit handling of modCount is needed.
- // However modCount = backingList.modCount must be executed in add
- // and remove, and size must also be updated in these two methods,
- // since they do not go through the corresponding methods of the subList.
- };
+ {
+ private final ListIterator<E> i
+ = backingList.listIterator(index + offset);
+ private int position = index;
+
+ /**
+ * Tests to see if there are any more objects to
+ * return.
+ *
+ * @return True if the end of the list has not yet been
+ * reached.
+ */
+ public boolean hasNext()
+ {
+ return position < size;
+ }
+
+ /**
+ * Tests to see if there are objects prior to the
+ * current position in the list.
+ *
+ * @return True if objects exist prior to the current
+ * position of the iterator.
+ */
+ public boolean hasPrevious()
+ {
+ return position > 0;
+ }
+
+ /**
+ * Retrieves the next object from the list.
+ *
+ * @return The next object.
+ * @throws NoSuchElementException if there are no
+ * more objects to retrieve.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public E next()
+ {
+ if (position == size)
+ throw new NoSuchElementException();
+ position++;
+ return i.next();
+ }
+
+ /**
+ * Retrieves the previous object from the list.
+ *
+ * @return The next object.
+ * @throws NoSuchElementException if there are no
+ * previous objects to retrieve.
+ * @throws ConcurrentModificationException if the
+ * list has been modified elsewhere.
+ */
+ public E previous()
+ {
+ if (position == 0)
+ throw new NoSuchElementException();
+ position--;
+ return i.previous();
+ }
+
+ /**
+ * Returns the index of the next element in the
+ * list, which will be retrieved by <code>next()</code>
+ *
+ * @return The index of the next element.
+ */
+ public int nextIndex()
+ {
+ return i.nextIndex() - offset;
+ }
+
+ /**
+ * Returns the index of the previous element in the
+ * list, which will be retrieved by <code>previous()</code>
+ *
+ * @return The index of the previous element.
+ */
+ public int previousIndex()
+ {
+ return i.previousIndex() - offset;
+ }
+
+ /**
+ * Removes the last object retrieved by <code>next()</code>
+ * from the list, if the list supports object removal.
+ *
+ * @throws IllegalStateException if the iterator is positioned
+ * before the start of the list or the last object has already
+ * been removed.
+ * @throws UnsupportedOperationException if the list does
+ * not support removing elements.
+ */
+ public void remove()
+ {
+ i.remove();
+ size--;
+ position = nextIndex();
+ modCount = backingList.modCount;
+ }
+
+
+ /**
+ * Replaces the last object retrieved by <code>next()</code>
+ * or <code>previous</code> with o, if the list supports object
+ * replacement and an add or remove operation has not already
+ * been performed.
+ *
+ * @throws IllegalStateException if the iterator is positioned
+ * before the start of the list or the last object has already
+ * been removed.
+ * @throws UnsupportedOperationException if the list doesn't support
+ * the addition or removal of elements.
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this list.
+ * @throws IllegalArgumentException if something else related to o
+ * prevents its addition.
+ * @throws ConcurrentModificationException if the list
+ * has been modified elsewhere.
+ */
+ public void set(E o)
+ {
+ i.set(o);
+ }
+
+ /**
+ * Adds the supplied object before the element that would be returned
+ * by a call to <code>next()</code>, if the list supports addition.
+ *
+ * @param o The object to add to the list.
+ * @throws UnsupportedOperationException if the list doesn't support
+ * the addition of new elements.
+ * @throws ClassCastException if the type of o is not a valid type
+ * for this list.
+ * @throws IllegalArgumentException if something else related to o
+ * prevents its addition.
+ * @throws ConcurrentModificationException if the list
+ * has been modified elsewhere.
+ */
+ public void add(E o)
+ {
+ i.add(o);
+ size++;
+ position++;
+ modCount = backingList.modCount;
+ }
+
+ // Here is the reason why the various modCount fields are mostly
+ // ignored in this wrapper listIterator.
+ // If the backing listIterator is failfast, then the following holds:
+ // Using any other method on this list will call a corresponding
+ // method on the backing list *after* the backing listIterator
+ // is created, which will in turn cause a ConcurrentModException
+ // when this listIterator comes to use the backing one. So it is
+ // implicitly failfast.
+ // If the backing listIterator is NOT failfast, then the whole of
+ // this list isn't failfast, because the modCount field of the
+ // backing list is not valid. It would still be *possible* to
+ // make the iterator failfast wrt modifications of the sublist
+ // only, but somewhat pointless when the list can be changed under
+ // us.
+ // Either way, no explicit handling of modCount is needed.
+ // However modCount = backingList.modCount must be executed in add
+ // and remove, and size must also be updated in these two methods,
+ // since they do not go through the corresponding methods of the subList.
+ };
}
} // class SubList
@@ -1200,5 +1200,5 @@ while (i.hasNext())
super(backing, fromIndex, toIndex);
}
} // class RandomAccessSubList
-
+
} // class AbstractList
diff --git a/java/util/AbstractMap.java b/java/util/AbstractMap.java
index 5d59db9a6..e0e35712a 100644
--- a/java/util/AbstractMap.java
+++ b/java/util/AbstractMap.java
@@ -71,14 +71,14 @@ import java.io.Serializable;
*/
public abstract class AbstractMap<K, V> implements Map<K, V>
{
- /**
+ /**
* A class containing an immutable key and value. The
* implementation of {@link Entry#setValue(V)} for this class
* simply throws an {@link UnsupportedOperationException},
* thus preventing changes being made. This is useful when
* a static thread-safe view of a map is required.
*
- * @since 1.6
+ * @since 1.6
*/
public static class SimpleImmutableEntry<K, V>
implements Entry<K, V>, Serializable
@@ -251,8 +251,8 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
public boolean equals(Object o)
{
return (o == this
- || (o instanceof Map
- && entrySet().equals(((Map<K, V>) o).entrySet())));
+ || (o instanceof Map
+ && entrySet().equals(((Map<K, V>) o).entrySet())));
}
/**
@@ -330,76 +330,76 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
if (keys == null)
keys = new AbstractSet<K>()
{
- /**
- * Retrieves the number of keys in the backing map.
- *
- * @return The number of keys.
- */
+ /**
+ * Retrieves the number of keys in the backing map.
+ *
+ * @return The number of keys.
+ */
public int size()
{
return AbstractMap.this.size();
}
- /**
- * Returns true if the backing map contains the
- * supplied key.
- *
- * @param key The key to search for.
- * @return True if the key was found, false otherwise.
- */
+ /**
+ * Returns true if the backing map contains the
+ * supplied key.
+ *
+ * @param key The key to search for.
+ * @return True if the key was found, false otherwise.
+ */
public boolean contains(Object key)
{
return containsKey(key);
}
- /**
- * Returns an iterator which iterates over the keys
- * in the backing map, using a wrapper around the
- * iterator returned by <code>entrySet()</code>.
- *
- * @return An iterator over the keys.
- */
+ /**
+ * Returns an iterator which iterates over the keys
+ * in the backing map, using a wrapper around the
+ * iterator returned by <code>entrySet()</code>.
+ *
+ * @return An iterator over the keys.
+ */
public Iterator<K> iterator()
{
return new Iterator<K>()
{
- /**
- * The iterator returned by <code>entrySet()</code>.
- */
+ /**
+ * The iterator returned by <code>entrySet()</code>.
+ */
private final Iterator<Map.Entry<K, V>> map_iterator
- = entrySet().iterator();
-
- /**
- * Returns true if a call to <code>next()</code> will
- * return another key.
- *
- * @return True if the iterator has not yet reached
- * the last key.
- */
+ = entrySet().iterator();
+
+ /**
+ * Returns true if a call to <code>next()</code> will
+ * return another key.
+ *
+ * @return True if the iterator has not yet reached
+ * the last key.
+ */
public boolean hasNext()
{
return map_iterator.hasNext();
}
- /**
- * Returns the key from the next entry retrieved
- * by the underlying <code>entrySet()</code> iterator.
- *
- * @return The next key.
- */
+ /**
+ * Returns the key from the next entry retrieved
+ * by the underlying <code>entrySet()</code> iterator.
+ *
+ * @return The next key.
+ */
public K next()
{
return map_iterator.next().getKey();
}
- /**
- * Removes the map entry which has a key equal
- * to that returned by the last call to
- * <code>next()</code>.
- *
- * @throws UnsupportedOperationException if the
- * map doesn't support removal.
- */
+ /**
+ * Removes the map entry which has a key equal
+ * to that returned by the last call to
+ * <code>next()</code>.
+ *
+ * @throws UnsupportedOperationException if the
+ * map doesn't support removal.
+ */
public void remove()
{
map_iterator.remove();
@@ -565,77 +565,77 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
if (values == null)
values = new AbstractCollection<V>()
{
- /**
- * Returns the number of values stored in
- * the backing map.
- *
- * @return The number of values.
- */
+ /**
+ * Returns the number of values stored in
+ * the backing map.
+ *
+ * @return The number of values.
+ */
public int size()
{
return AbstractMap.this.size();
}
- /**
- * Returns true if the backing map contains
- * the supplied value.
- *
- * @param value The value to search for.
- * @return True if the value was found, false otherwise.
- */
+ /**
+ * Returns true if the backing map contains
+ * the supplied value.
+ *
+ * @param value The value to search for.
+ * @return True if the value was found, false otherwise.
+ */
public boolean contains(Object value)
{
return containsValue(value);
}
- /**
- * Returns an iterator which iterates over the
- * values in the backing map, by using a wrapper
- * around the iterator returned by <code>entrySet()</code>.
- *
- * @return An iterator over the values.
- */
+ /**
+ * Returns an iterator which iterates over the
+ * values in the backing map, by using a wrapper
+ * around the iterator returned by <code>entrySet()</code>.
+ *
+ * @return An iterator over the values.
+ */
public Iterator<V> iterator()
{
return new Iterator<V>()
{
- /**
- * The iterator returned by <code>entrySet()</code>.
- */
+ /**
+ * The iterator returned by <code>entrySet()</code>.
+ */
private final Iterator<Map.Entry<K, V>> map_iterator
- = entrySet().iterator();
-
- /**
- * Returns true if a call to <code>next()</call> will
- * return another value.
- *
- * @return True if the iterator has not yet reached
- * the last value.
- */
+ = entrySet().iterator();
+
+ /**
+ * Returns true if a call to <code>next()</call> will
+ * return another value.
+ *
+ * @return True if the iterator has not yet reached
+ * the last value.
+ */
public boolean hasNext()
{
return map_iterator.hasNext();
}
- /**
- * Returns the value from the next entry retrieved
- * by the underlying <code>entrySet()</code> iterator.
- *
- * @return The next value.
- */
+ /**
+ * Returns the value from the next entry retrieved
+ * by the underlying <code>entrySet()</code> iterator.
+ *
+ * @return The next value.
+ */
public V next()
{
return map_iterator.next().getValue();
}
- /**
- * Removes the map entry which has a key equal
- * to that returned by the last call to
- * <code>next()</code>.
- *
- * @throws UnsupportedOperationException if the
- * map doesn't support removal.
- */
+ /**
+ * Removes the map entry which has a key equal
+ * to that returned by the last call to
+ * <code>next()</code>.
+ *
+ * @throws UnsupportedOperationException if the
+ * map doesn't support removal.
+ */
public void remove()
{
map_iterator.remove();
@@ -680,7 +680,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
*
* @author Jon Zeppieri
* @author Eric Blake (ebb9@email.byu.edu)
- *
+ *
* @since 1.6
*/
public static class SimpleEntry<K, V> implements Entry<K, V>, Serializable
@@ -711,7 +711,7 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
key = newKey;
value = newValue;
}
-
+
public SimpleEntry(Entry<? extends K, ? extends V> entry)
{
this(entry.getKey(), entry.getValue());
@@ -814,6 +814,6 @@ public abstract class AbstractMap<K, V> implements Map<K, V>
return key + "=" + value;
}
} // class SimpleEntry
-
-
+
+
}
diff --git a/java/util/AbstractSet.java b/java/util/AbstractSet.java
index 423ac8083..af1e4d125 100644
--- a/java/util/AbstractSet.java
+++ b/java/util/AbstractSet.java
@@ -83,8 +83,8 @@ public abstract class AbstractSet<E>
public boolean equals(Object o)
{
return (o == this
- || (o instanceof Set && ((Set) o).size() == size()
- && containsAll((Collection) o)));
+ || (o instanceof Set && ((Set) o).size() == size()
+ && containsAll((Collection) o)));
}
/**
@@ -128,18 +128,18 @@ public abstract class AbstractSet<E>
int count = c.size();
if (oldsize < count)
{
- Iterator<E> i;
- for (i = iterator(), count = oldsize; count > 0; count--)
- {
- if (c.contains(i.next()))
- i.remove();
- }
+ Iterator<E> i;
+ for (i = iterator(), count = oldsize; count > 0; count--)
+ {
+ if (c.contains(i.next()))
+ i.remove();
+ }
}
else
{
- Iterator<?> i;
- for (i = c.iterator(); count > 0; count--)
- remove(i.next());
+ Iterator<?> i;
+ for (i = c.iterator(); count > 0; count--)
+ remove(i.next());
}
return oldsize != size();
}
diff --git a/java/util/ArrayList.java b/java/util/ArrayList.java
index 1fb25d801..0da2193af 100644
--- a/java/util/ArrayList.java
+++ b/java/util/ArrayList.java
@@ -503,8 +503,8 @@ public class ArrayList<E> extends AbstractList<E>
// do so).
throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size);
}
-
-
+
+
/**
* Remove from this list all elements contained in the given collection.
* This is not public, due to Sun's API, but this performs in linear
diff --git a/java/util/Arrays.java b/java/util/Arrays.java
index d154eb1d1..dad55c459 100644
--- a/java/util/Arrays.java
+++ b/java/util/Arrays.java
@@ -76,7 +76,7 @@ public class Arrays
{
}
-
+
// binarySearch
/**
* Perform a binary search of a byte array for a key. The array must be
@@ -122,10 +122,10 @@ public class Arrays
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
int mid = 0;
while (low <= hi)
{
@@ -186,10 +186,10 @@ public class Arrays
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
int mid = 0;
while (low <= hi)
{
@@ -250,10 +250,10 @@ public class Arrays
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
int mid = 0;
while (low <= hi)
{
@@ -314,10 +314,10 @@ public class Arrays
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
int mid = 0;
while (low <= hi)
{
@@ -378,10 +378,10 @@ public class Arrays
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
int mid = 0;
while (low <= hi)
{
@@ -442,10 +442,10 @@ public class Arrays
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
// Must use Float.compare to take into account NaN, +-0.
int mid = 0;
while (low <= hi)
@@ -507,10 +507,10 @@ public class Arrays
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
// Must use Double.compare to take into account NaN, +-0.
int mid = 0;
while (low <= hi)
@@ -629,21 +629,21 @@ public class Arrays
* <code>hi > a.length</code>.
*/
public static <T> int binarySearch(T[] a, int low, int hi, T key,
- Comparator<? super T> c)
+ Comparator<? super T> c)
{
if (low > hi)
throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
+ "the finish index.");
if (low < 0 || hi > a.length)
throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
+ "of bounds.");
int mid = 0;
while (low <= hi)
{
mid = (low + hi) >>> 1;
- // NOTE: Please keep the order of a[mid] and key. Although
- // not required by the specs, the RI has it in this order as
- // well, and real programs (erroneously) depend on it.
+ // NOTE: Please keep the order of a[mid] and key. Although
+ // not required by the specs, the RI has it in this order as
+ // well, and real programs (erroneously) depend on it.
final int d = Collections.compare(a[mid], key, c);
if (d == 0)
return mid;
@@ -656,7 +656,7 @@ public class Arrays
return -mid - 1;
}
-
+
// equals
/**
* Compare two boolean arrays for equality.
@@ -675,15 +675,15 @@ public class Arrays
if (null == a1 || null == a2)
return false;
-
+
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (a1[i] != a2[i])
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (a1[i] != a2[i])
+ return false;
+ return true;
}
return false;
}
@@ -709,11 +709,11 @@ public class Arrays
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (a1[i] != a2[i])
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (a1[i] != a2[i])
+ return false;
+ return true;
}
return false;
}
@@ -735,15 +735,15 @@ public class Arrays
if (null == a1 || null == a2)
return false;
-
+
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (a1[i] != a2[i])
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (a1[i] != a2[i])
+ return false;
+ return true;
}
return false;
}
@@ -769,11 +769,11 @@ public class Arrays
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (a1[i] != a2[i])
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (a1[i] != a2[i])
+ return false;
+ return true;
}
return false;
}
@@ -799,11 +799,11 @@ public class Arrays
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (a1[i] != a2[i])
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (a1[i] != a2[i])
+ return false;
+ return true;
}
return false;
}
@@ -829,11 +829,11 @@ public class Arrays
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (a1[i] != a2[i])
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (a1[i] != a2[i])
+ return false;
+ return true;
}
return false;
}
@@ -860,11 +860,11 @@ public class Arrays
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (Float.compare(a1[i], a2[i]) != 0)
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (Float.compare(a1[i], a2[i]) != 0)
+ return false;
+ return true;
}
return false;
}
@@ -886,16 +886,16 @@ public class Arrays
if (null == a1 || null == a2)
return false;
-
+
// Must use Double.compare to take into account NaN, +-0.
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (Double.compare(a1[i], a2[i]) != 0)
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (Double.compare(a1[i], a2[i]) != 0)
+ return false;
+ return true;
}
return false;
}
@@ -918,20 +918,20 @@ public class Arrays
if (null == a1 || null == a2)
return false;
-
+
// If they're the same length, test each element
if (a1.length == a2.length)
{
- int i = a1.length;
- while (--i >= 0)
- if (! AbstractCollection.equals(a1[i], a2[i]))
- return false;
- return true;
+ int i = a1.length;
+ while (--i >= 0)
+ if (! AbstractCollection.equals(a1[i], a2[i]))
+ return false;
+ return true;
}
return false;
}
-
+
// fill
/**
* Fill an array with a boolean value.
@@ -1207,7 +1207,7 @@ public class Arrays
a[i] = val;
}
-
+
// sort
// Thanks to Paul Fisher (rao@gnu.org) for finding this quicksort algorithm
// as specified by Sun and porting it to Java. The algorithm is an optimised
@@ -1633,8 +1633,8 @@ public class Arrays
if (count <= 7)
{
for (int i = from + 1; i < from + count; i++)
- for (int j = i; j > from && array[j - 1] > array[j]; j--)
- swap(j, j - 1, array);
+ for (int j = i; j > from && array[j - 1] > array[j]; j--)
+ swap(j, j - 1, array);
return;
}
@@ -2488,7 +2488,7 @@ public class Arrays
* ordering (only possible when c is null)
*/
public static <T> void sort(T[] a, int fromIndex, int toIndex,
- Comparator<? super T> c)
+ Comparator<? super T> c)
{
if (fromIndex > toIndex)
throw new IllegalArgumentException("fromIndex " + fromIndex
@@ -2618,7 +2618,7 @@ public class Arrays
*
* @param a the array to return a view of (<code>null</code> not permitted)
* @return a fixed-size list, changes to which "write through" to the array
- *
+ *
* @throws NullPointerException if <code>a</code> is <code>null</code>.
* @see Serializable
* @see RandomAccess
@@ -2629,7 +2629,7 @@ public class Arrays
return new Arrays.ArrayList(a);
}
- /**
+ /**
* Returns the hashcode of an array of long numbers. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2640,7 +2640,7 @@ public class Arrays
* @param v an array of long numbers for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(long[] v)
{
@@ -2649,13 +2649,13 @@ public class Arrays
int result = 1;
for (int i = 0; i < v.length; ++i)
{
- int elt = (int) (v[i] ^ (v[i] >>> 32));
- result = 31 * result + elt;
+ int elt = (int) (v[i] ^ (v[i] >>> 32));
+ result = 31 * result + elt;
}
return result;
}
- /**
+ /**
* Returns the hashcode of an array of integer numbers. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2666,7 +2666,7 @@ public class Arrays
* @param v an array of integer numbers for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(int[] v)
{
@@ -2678,7 +2678,7 @@ public class Arrays
return result;
}
- /**
+ /**
* Returns the hashcode of an array of short numbers. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2689,7 +2689,7 @@ public class Arrays
* @param v an array of short numbers for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(short[] v)
{
@@ -2701,7 +2701,7 @@ public class Arrays
return result;
}
- /**
+ /**
* Returns the hashcode of an array of characters. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2712,7 +2712,7 @@ public class Arrays
* @param v an array of characters for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(char[] v)
{
@@ -2724,7 +2724,7 @@ public class Arrays
return result;
}
- /**
+ /**
* Returns the hashcode of an array of bytes. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2735,7 +2735,7 @@ public class Arrays
* @param v an array of bytes for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(byte[] v)
{
@@ -2747,7 +2747,7 @@ public class Arrays
return result;
}
- /**
+ /**
* Returns the hashcode of an array of booleans. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2758,7 +2758,7 @@ public class Arrays
* @param v an array of booleans for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(boolean[] v)
{
@@ -2770,7 +2770,7 @@ public class Arrays
return result;
}
- /**
+ /**
* Returns the hashcode of an array of floats. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2781,7 +2781,7 @@ public class Arrays
* @param v an array of floats for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(float[] v)
{
@@ -2793,7 +2793,7 @@ public class Arrays
return result;
}
- /**
+ /**
* Returns the hashcode of an array of doubles. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
@@ -2804,7 +2804,7 @@ public class Arrays
* @param v an array of doubles for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(double[] v)
{
@@ -2813,24 +2813,24 @@ public class Arrays
int result = 1;
for (int i = 0; i < v.length; ++i)
{
- long l = Double.doubleToLongBits(v[i]);
- int elt = (int) (l ^ (l >>> 32));
- result = 31 * result + elt;
+ long l = Double.doubleToLongBits(v[i]);
+ int elt = (int) (l ^ (l >>> 32));
+ result = 31 * result + elt;
}
return result;
}
- /**
+ /**
* Returns the hashcode of an array of objects. If two arrays
* are equal, according to <code>equals()</code>, they should have the
* same hashcode. The hashcode returned by the method is equal to that
- * obtained by the corresponding <code>List</code> object.
+ * obtained by the corresponding <code>List</code> object.
* For <code>null</code>, 0 is returned.
*
* @param v an array of integer numbers for which the hash code should be
* computed.
* @return the hash code of the array, or 0 if null was given.
- * @since 1.5
+ * @since 1.5
*/
public static int hashCode(Object[] v)
{
@@ -2839,8 +2839,8 @@ public class Arrays
int result = 1;
for (int i = 0; i < v.length; ++i)
{
- int elt = v[i] == null ? 0 : v[i].hashCode();
- result = 31 * result + elt;
+ int elt = v[i] == null ? 0 : v[i].hashCode();
+ result = 31 * result + elt;
}
return result;
}
@@ -2852,30 +2852,30 @@ public class Arrays
int result = 1;
for (int i = 0; i < v.length; ++i)
{
- int elt;
- if (v[i] == null)
- elt = 0;
- else if (v[i] instanceof boolean[])
- elt = hashCode((boolean[]) v[i]);
- else if (v[i] instanceof byte[])
- elt = hashCode((byte[]) v[i]);
- else if (v[i] instanceof char[])
- elt = hashCode((char[]) v[i]);
- else if (v[i] instanceof short[])
- elt = hashCode((short[]) v[i]);
- else if (v[i] instanceof int[])
- elt = hashCode((int[]) v[i]);
- else if (v[i] instanceof long[])
- elt = hashCode((long[]) v[i]);
- else if (v[i] instanceof float[])
- elt = hashCode((float[]) v[i]);
- else if (v[i] instanceof double[])
- elt = hashCode((double[]) v[i]);
- else if (v[i] instanceof Object[])
- elt = hashCode((Object[]) v[i]);
- else
- elt = v[i].hashCode();
- result = 31 * result + elt;
+ int elt;
+ if (v[i] == null)
+ elt = 0;
+ else if (v[i] instanceof boolean[])
+ elt = hashCode((boolean[]) v[i]);
+ else if (v[i] instanceof byte[])
+ elt = hashCode((byte[]) v[i]);
+ else if (v[i] instanceof char[])
+ elt = hashCode((char[]) v[i]);
+ else if (v[i] instanceof short[])
+ elt = hashCode((short[]) v[i]);
+ else if (v[i] instanceof int[])
+ elt = hashCode((int[]) v[i]);
+ else if (v[i] instanceof long[])
+ elt = hashCode((long[]) v[i]);
+ else if (v[i] instanceof float[])
+ elt = hashCode((float[]) v[i]);
+ else if (v[i] instanceof double[])
+ elt = hashCode((double[]) v[i]);
+ else if (v[i] instanceof Object[])
+ elt = hashCode((Object[]) v[i]);
+ else
+ elt = v[i].hashCode();
+ result = 31 * result + elt;
}
return result;
}
@@ -2890,37 +2890,37 @@ public class Arrays
for (int i = 0; i < v1.length; ++i)
{
- Object e1 = v1[i];
- Object e2 = v2[i];
-
- if (e1 == e2)
- continue;
- if (e1 == null || e2 == null)
- return false;
-
- boolean check;
- if (e1 instanceof boolean[] && e2 instanceof boolean[])
- check = equals((boolean[]) e1, (boolean[]) e2);
- else if (e1 instanceof byte[] && e2 instanceof byte[])
- check = equals((byte[]) e1, (byte[]) e2);
- else if (e1 instanceof char[] && e2 instanceof char[])
- check = equals((char[]) e1, (char[]) e2);
- else if (e1 instanceof short[] && e2 instanceof short[])
- check = equals((short[]) e1, (short[]) e2);
- else if (e1 instanceof int[] && e2 instanceof int[])
- check = equals((int[]) e1, (int[]) e2);
- else if (e1 instanceof long[] && e2 instanceof long[])
- check = equals((long[]) e1, (long[]) e2);
- else if (e1 instanceof float[] && e2 instanceof float[])
- check = equals((float[]) e1, (float[]) e2);
- else if (e1 instanceof double[] && e2 instanceof double[])
- check = equals((double[]) e1, (double[]) e2);
- else if (e1 instanceof Object[] && e2 instanceof Object[])
- check = equals((Object[]) e1, (Object[]) e2);
- else
- check = e1.equals(e2);
- if (! check)
- return false;
+ Object e1 = v1[i];
+ Object e2 = v2[i];
+
+ if (e1 == e2)
+ continue;
+ if (e1 == null || e2 == null)
+ return false;
+
+ boolean check;
+ if (e1 instanceof boolean[] && e2 instanceof boolean[])
+ check = equals((boolean[]) e1, (boolean[]) e2);
+ else if (e1 instanceof byte[] && e2 instanceof byte[])
+ check = equals((byte[]) e1, (byte[]) e2);
+ else if (e1 instanceof char[] && e2 instanceof char[])
+ check = equals((char[]) e1, (char[]) e2);
+ else if (e1 instanceof short[] && e2 instanceof short[])
+ check = equals((short[]) e1, (short[]) e2);
+ else if (e1 instanceof int[] && e2 instanceof int[])
+ check = equals((int[]) e1, (int[]) e2);
+ else if (e1 instanceof long[] && e2 instanceof long[])
+ check = equals((long[]) e1, (long[]) e2);
+ else if (e1 instanceof float[] && e2 instanceof float[])
+ check = equals((float[]) e1, (float[]) e2);
+ else if (e1 instanceof double[] && e2 instanceof double[])
+ check = equals((double[]) e1, (double[]) e2);
+ else if (e1 instanceof Object[] && e2 instanceof Object[])
+ check = equals((Object[]) e1, (Object[]) e2);
+ else
+ check = e1.equals(e2);
+ if (! check)
+ return false;
}
return true;
@@ -2940,9 +2940,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -2962,9 +2962,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -2984,9 +2984,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -3006,9 +3006,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -3028,9 +3028,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -3050,9 +3050,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -3072,9 +3072,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -3094,9 +3094,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -3116,9 +3116,9 @@ public class Arrays
CPStringBuilder b = new CPStringBuilder("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- b.append(v[i]);
+ if (i > 0)
+ b.append(", ");
+ b.append(v[i]);
}
b.append("]");
return b.toString();
@@ -3129,40 +3129,40 @@ public class Arrays
b.append("[");
for (int i = 0; i < v.length; ++i)
{
- if (i > 0)
- b.append(", ");
- Object elt = v[i];
- if (elt == null)
- b.append("null");
- else if (elt instanceof boolean[])
- b.append(toString((boolean[]) elt));
- else if (elt instanceof byte[])
- b.append(toString((byte[]) elt));
- else if (elt instanceof char[])
- b.append(toString((char[]) elt));
- else if (elt instanceof short[])
- b.append(toString((short[]) elt));
- else if (elt instanceof int[])
- b.append(toString((int[]) elt));
- else if (elt instanceof long[])
- b.append(toString((long[]) elt));
- else if (elt instanceof float[])
- b.append(toString((float[]) elt));
- else if (elt instanceof double[])
- b.append(toString((double[]) elt));
- else if (elt instanceof Object[])
- {
- Object[] os = (Object[]) elt;
- if (seen.contains(os))
- b.append("[...]");
- else
- {
- seen.add(os);
- deepToString(os, b, seen);
- }
- }
- else
- b.append(elt);
+ if (i > 0)
+ b.append(", ");
+ Object elt = v[i];
+ if (elt == null)
+ b.append("null");
+ else if (elt instanceof boolean[])
+ b.append(toString((boolean[]) elt));
+ else if (elt instanceof byte[])
+ b.append(toString((byte[]) elt));
+ else if (elt instanceof char[])
+ b.append(toString((char[]) elt));
+ else if (elt instanceof short[])
+ b.append(toString((short[]) elt));
+ else if (elt instanceof int[])
+ b.append(toString((int[]) elt));
+ else if (elt instanceof long[])
+ b.append(toString((long[]) elt));
+ else if (elt instanceof float[])
+ b.append(toString((float[]) elt));
+ else if (elt instanceof double[])
+ b.append(toString((double[]) elt));
+ else if (elt instanceof Object[])
+ {
+ Object[] os = (Object[]) elt;
+ if (seen.contains(os))
+ b.append("[...]");
+ else
+ {
+ seen.add(os);
+ deepToString(os, b, seen);
+ }
+ }
+ else
+ b.append(elt);
}
b.append("]");
}
@@ -3223,7 +3223,7 @@ public class Arrays
*
* @param index The index to retrieve an object from.
* @return The object at the array index specified.
- */
+ */
public E get(int index)
{
return a[index];
@@ -3325,7 +3325,7 @@ public class Arrays
int size = a.length;
if (array.length < size)
array = (T[]) Array.newInstance(array.getClass().getComponentType(),
- size);
+ size);
else if (array.length > size)
array[size] = null;
@@ -3390,13 +3390,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
boolean[] newArray = new boolean[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, false);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, false);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3459,13 +3459,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
byte[] newArray = new byte[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, (byte)0);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, (byte)0);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3528,13 +3528,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
char[] newArray = new char[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, '\0');
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, '\0');
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3597,13 +3597,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
double[] newArray = new double[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, 0d);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, 0d);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3666,13 +3666,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
float[] newArray = new float[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, 0f);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, 0f);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3735,13 +3735,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
int[] newArray = new int[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, 0);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, 0);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3804,13 +3804,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
long[] newArray = new long[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, 0L);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, 0L);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3873,13 +3873,13 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
short[] newArray = new short[to - from];
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, (short)0);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, (short)0);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3942,14 +3942,14 @@ public class Arrays
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
Class elemType = original.getClass().getComponentType();
T[] newArray = (T[]) Array.newInstance(elemType, to - from);
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, null);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, null);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
@@ -3977,7 +3977,7 @@ public class Arrays
* @see #copyOfRange(U[],int,int,Class)
*/
public static <T,U> T[] copyOf(U[] original, int newLength,
- Class<? extends T[]> newType)
+ Class<? extends T[]> newType)
{
if (newLength < 0)
throw new NegativeArraySizeException("The array size is negative.");
@@ -4014,18 +4014,18 @@ public class Arrays
* @see #copyOf(T[],int)
*/
public static <T,U> T[] copyOfRange(U[] original, int from, int to,
- Class<? extends T[]> newType)
+ Class<? extends T[]> newType)
{
if (from > to)
throw new IllegalArgumentException("The initial index is after " +
- "the final index.");
+ "the final index.");
T[] newArray = (T[]) Array.newInstance(newType.getComponentType(),
- to - from);
+ to - from);
if (to > original.length)
{
- System.arraycopy(original, from, newArray, 0,
- original.length - from);
- fill(newArray, original.length, newArray.length, null);
+ System.arraycopy(original, from, newArray, 0,
+ original.length - from);
+ fill(newArray, original.length, newArray.length, null);
}
else
System.arraycopy(original, from, newArray, 0, to - from);
diff --git a/java/util/BitSet.java b/java/util/BitSet.java
index 13bf8a13c..1072978a4 100644
--- a/java/util/BitSet.java
+++ b/java/util/BitSet.java
@@ -107,7 +107,7 @@ public class BitSet implements Cloneable, Serializable
{
if (nbits < 0)
throw new NegativeArraySizeException();
-
+
int length = nbits >>> 6;
if ((nbits & LONG_MASK) != 0)
++length;
@@ -412,7 +412,7 @@ public class BitSet implements Cloneable, Serializable
* Then the following definition of the hashCode method
* would be a correct implementation of the actual algorithm:
*
- *
+ *
<pre>public int hashCode()
{
long h = 1234;
@@ -535,7 +535,7 @@ public class BitSet implements Cloneable, Serializable
* Returns the index of the next true bit, from the specified bit
* (inclusive). If there is none, -1 is returned. You can iterate over
* all true bits with this loop:<br>
- *
+ *
<pre>for (int i = bs.nextSetBit(0); i &gt;= 0; i = bs.nextSetBit(i + 1))
{
// operate on i here
@@ -750,8 +750,8 @@ public class BitSet implements Cloneable, Serializable
{
for (int i = other.bits.length - 1; i >= 0; i--)
{
- if ((bits[i] & other.bits[i]) != other.bits[i])
- return false;
+ if ((bits[i] & other.bits[i]) != other.bits[i])
+ return false;
}
return true;
}
diff --git a/java/util/Calendar.java b/java/util/Calendar.java
index 0449e126d..8123b1706 100644
--- a/java/util/Calendar.java
+++ b/java/util/Calendar.java
@@ -1,5 +1,5 @@
/* Calendar.java --
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -487,7 +487,7 @@ public abstract class Calendar
}
/**
- * The set of properties for obtaining the minimum number of days in
+ * The set of properties for obtaining the minimum number of days in
* the first week.
*/
private static transient final Properties properties;
@@ -498,7 +498,7 @@ public abstract class Calendar
static
{
properties = new Properties();
- try
+ try
{
properties.load(Calendar.class.getResourceAsStream("weeks.properties"));
}
@@ -538,19 +538,19 @@ public abstract class Calendar
first = properties.getProperty("firstDay.DEFAULT");
try
{
- if (min != null)
- minimalDaysInFirstWeek = Integer.parseInt(min);
+ if (min != null)
+ minimalDaysInFirstWeek = Integer.parseInt(min);
}
catch (NumberFormatException ex)
{
- minimalDaysInFirstWeek = 1;
+ minimalDaysInFirstWeek = 1;
}
firstDayOfWeek = 1;
if (first != null)
for (int i = 0; i < 8; i++)
- if (days[i].equals(first))
- firstDayOfWeek = i;
+ if (days[i].equals(first))
+ firstDayOfWeek = i;
clear();
}
@@ -558,7 +558,7 @@ public abstract class Calendar
/**
* Creates a calendar representing the actual time, using the default
* time zone and locale.
- *
+ *
* @return The new calendar.
*/
public static synchronized Calendar getInstance()
@@ -569,11 +569,11 @@ public abstract class Calendar
/**
* Creates a calendar representing the actual time, using the given
* time zone and the default locale.
- *
+ *
* @param zone a time zone (<code>null</code> not permitted).
- *
+ *
* @return The new calendar.
- *
+ *
* @throws NullPointerException if <code>zone</code> is <code>null</code>.
*/
public static synchronized Calendar getInstance(TimeZone zone)
@@ -584,11 +584,11 @@ public abstract class Calendar
/**
* Creates a calendar representing the actual time, using the default
* time zone and the given locale.
- *
+ *
* @param locale a locale (<code>null</code> not permitted).
- *
+ *
* @return The new calendar.
- *
+ *
* @throws NullPointerException if <code>locale</code> is <code>null</code>.
*/
public static synchronized Calendar getInstance(Locale locale)
@@ -611,12 +611,12 @@ public abstract class Calendar
/**
* Creates a calendar representing the actual time, using the given
* time zone and locale.
- *
+ *
* @param zone a time zone (<code>null</code> not permitted).
* @param locale a locale (<code>null</code> not permitted).
- *
+ *
* @return The new calendar.
- *
+ *
* @throws NullPointerException if <code>zone</code> or <code>locale</code>
* is <code>null</code>.
*/
@@ -627,43 +627,43 @@ public abstract class Calendar
try
{
- if (calendarClass == null)
- {
- calendarClass = Class.forName(calendarClassName);
- if (Calendar.class.isAssignableFrom(calendarClass))
- cache.put(locale, calendarClass);
- }
-
- // GregorianCalendar is by far the most common case. Optimize by
- // avoiding reflection.
- if (calendarClass == GregorianCalendar.class)
- return new GregorianCalendar(zone, locale);
-
- if (Calendar.class.isAssignableFrom(calendarClass))
- {
- Constructor ctor = calendarClass.getConstructor(ctorArgTypes);
- return (Calendar) ctor.newInstance(new Object[] { zone, locale });
- }
+ if (calendarClass == null)
+ {
+ calendarClass = Class.forName(calendarClassName);
+ if (Calendar.class.isAssignableFrom(calendarClass))
+ cache.put(locale, calendarClass);
+ }
+
+ // GregorianCalendar is by far the most common case. Optimize by
+ // avoiding reflection.
+ if (calendarClass == GregorianCalendar.class)
+ return new GregorianCalendar(zone, locale);
+
+ if (Calendar.class.isAssignableFrom(calendarClass))
+ {
+ Constructor ctor = calendarClass.getConstructor(ctorArgTypes);
+ return (Calendar) ctor.newInstance(new Object[] { zone, locale });
+ }
}
catch (ClassNotFoundException ex)
{
- exception = ex;
+ exception = ex;
}
catch (IllegalAccessException ex)
{
- exception = ex;
+ exception = ex;
}
catch (NoSuchMethodException ex)
{
- exception = ex;
+ exception = ex;
}
catch (InstantiationException ex)
{
- exception = ex;
+ exception = ex;
}
catch (InvocationTargetException ex)
{
- exception = ex;
+ exception = ex;
}
throw new RuntimeException("Error instantiating calendar for locale "
@@ -710,9 +710,9 @@ public abstract class Calendar
/**
* Sets this Calendar's time to the given Date. All time fields
* are invalidated by this method.
- *
+ *
* @param date the date (<code>null</code> not permitted).
- *
+ *
* @throws NullPointerException if <code>date</code> is <code>null</code>.
*/
public final void setTime(Date date)
@@ -794,7 +794,7 @@ public abstract class Calendar
{
if (isTimeSet)
for (int i = 0; i < FIELD_COUNT; i++)
- isSet[i] = false;
+ isSet[i] = false;
isTimeSet = false;
fields[field] = value;
isSet[field] = true;
@@ -808,74 +808,74 @@ public abstract class Calendar
switch (field)
{
case MONTH: // pattern 1,2 or 3
- isSet[DAY_OF_YEAR] = false;
- isSet[WEEK_OF_YEAR] = false;
- break;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
case DAY_OF_MONTH: // pattern 1
- isSet[YEAR] = true;
- isSet[MONTH] = true;
- isSet[WEEK_OF_MONTH] = true;
- isSet[DAY_OF_WEEK] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- isSet[WEEK_OF_YEAR] = false;
- break;
+ isSet[YEAR] = true;
+ isSet[MONTH] = true;
+ isSet[WEEK_OF_MONTH] = true;
+ isSet[DAY_OF_WEEK] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
case WEEK_OF_MONTH: // pattern 2
- if (! isSet[DAY_OF_WEEK])
- fields[DAY_OF_WEEK] = getFirstDayOfWeek();
- isSet[YEAR] = true;
- isSet[MONTH] = true;
- isSet[DAY_OF_WEEK] = true;
- isSet[DAY_OF_MONTH] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- isSet[WEEK_OF_YEAR] = false;
- break;
+ if (! isSet[DAY_OF_WEEK])
+ fields[DAY_OF_WEEK] = getFirstDayOfWeek();
+ isSet[YEAR] = true;
+ isSet[MONTH] = true;
+ isSet[DAY_OF_WEEK] = true;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
case DAY_OF_WEEK_IN_MONTH: // pattern 3
- if (! isSet[DAY_OF_WEEK])
- fields[DAY_OF_WEEK] = getFirstDayOfWeek();
- isSet[YEAR] = true;
- isSet[MONTH] = true;
- isSet[DAY_OF_WEEK] = true;
- isSet[DAY_OF_YEAR] = false;
- isSet[DAY_OF_MONTH] = false;
- isSet[WEEK_OF_MONTH] = false;
- isSet[WEEK_OF_YEAR] = false;
- break;
+ if (! isSet[DAY_OF_WEEK])
+ fields[DAY_OF_WEEK] = getFirstDayOfWeek();
+ isSet[YEAR] = true;
+ isSet[MONTH] = true;
+ isSet[DAY_OF_WEEK] = true;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
case DAY_OF_YEAR: // pattern 4
- isSet[YEAR] = true;
- isSet[MONTH] = false;
- isSet[WEEK_OF_MONTH] = false;
- isSet[DAY_OF_MONTH] = false;
- isSet[DAY_OF_WEEK] = false;
- isSet[WEEK_OF_YEAR] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- break;
+ isSet[YEAR] = true;
+ isSet[MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ break;
case WEEK_OF_YEAR: // pattern 5
- if (! isSet[DAY_OF_WEEK])
- fields[DAY_OF_WEEK] = getFirstDayOfWeek();
- isSet[YEAR] = true;
- isSet[DAY_OF_WEEK] = true;
- isSet[MONTH] = false;
- isSet[DAY_OF_MONTH] = false;
- isSet[WEEK_OF_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- break;
+ if (! isSet[DAY_OF_WEEK])
+ fields[DAY_OF_WEEK] = getFirstDayOfWeek();
+ isSet[YEAR] = true;
+ isSet[DAY_OF_WEEK] = true;
+ isSet[MONTH] = false;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ break;
case AM_PM:
- isSet[HOUR] = true;
- isSet[HOUR_OF_DAY] = false;
- break;
+ isSet[HOUR] = true;
+ isSet[HOUR_OF_DAY] = false;
+ break;
case HOUR_OF_DAY:
- isSet[AM_PM] = false;
- isSet[HOUR] = false;
- break;
+ isSet[AM_PM] = false;
+ isSet[HOUR] = false;
+ break;
case HOUR:
- isSet[AM_PM] = true;
- isSet[HOUR_OF_DAY] = false;
- break;
+ isSet[AM_PM] = true;
+ isSet[HOUR_OF_DAY] = false;
+ break;
case DST_OFFSET:
- explicitDSTOffset = true;
+ explicitDSTOffset = true;
}
// May have crossed over a DST boundary.
@@ -950,7 +950,7 @@ public abstract class Calendar
isTimeSet = false;
areFieldsSet = false;
int zoneOffs = zone.getRawOffset();
- int[] tempFields =
+ int[] tempFields =
{
1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, 0, 0, 0,
0, 0, zoneOffs, 0
@@ -969,7 +969,7 @@ public abstract class Calendar
*/
public final void clear(int field)
{
- int[] tempFields =
+ int[] tempFields =
{
1, 1970, JANUARY, 1, 1, 1, 1, THURSDAY, 1, AM, 0, 0, 0,
0, 0, zone.getRawOffset(), 0
@@ -1118,13 +1118,13 @@ public abstract class Calendar
{
while (amount > 0)
{
- roll(field, true);
- amount--;
+ roll(field, true);
+ amount--;
}
while (amount < 0)
{
- roll(field, false);
- amount++;
+ roll(field, false);
+ amount++;
}
}
@@ -1260,9 +1260,9 @@ public abstract class Calendar
tmp.set(field, min);
for (; min > end; min--)
{
- tmp.add(field, -1); // Try to get smaller
- if (tmp.get(field) != min - 1)
- break; // Done if not successful
+ tmp.add(field, -1); // Try to get smaller
+ if (tmp.get(field) != min - 1)
+ break; // Done if not successful
}
return min;
}
@@ -1285,9 +1285,9 @@ public abstract class Calendar
tmp.set(field, max);
for (; max < end; max++)
{
- tmp.add(field, 1);
- if (tmp.get(field) != max + 1)
- break;
+ tmp.add(field, 1);
+ if (tmp.get(field) != max + 1)
+ break;
}
return max;
}
@@ -1295,14 +1295,14 @@ public abstract class Calendar
/**
* Compares the time of two calendar instances.
* @param cal the calendar to which the time should be compared.
- * @return 0 if the two calendars are set to the same time,
- * less than 0 if the time of this calendar is before that of
+ * @return 0 if the two calendars are set to the same time,
+ * less than 0 if the time of this calendar is before that of
* <code>cal</code>, or more than 0 if the time of this calendar is after
* that of <code>cal</code>.
*
* @param cal the calendar to compare this instance with.
* @throws NullPointerException if <code>cal</code> is null.
- * @throws IllegalArgumentException if either calendar has fields set to
+ * @throws IllegalArgumentException if either calendar has fields set to
* invalid values.
* @since 1.5
*/
@@ -1324,18 +1324,18 @@ public abstract class Calendar
{
try
{
- Calendar cal = (Calendar) super.clone();
- cal.fields = (int[]) fields.clone();
- cal.isSet = (boolean[]) isSet.clone();
- return cal;
+ Calendar cal = (Calendar) super.clone();
+ cal.fields = (int[]) fields.clone();
+ cal.isSet = (boolean[]) isSet.clone();
+ return cal;
}
catch (CloneNotSupportedException ex)
{
- return null;
+ return null;
}
}
- private static final String[] fieldNames =
+ private static final String[] fieldNames =
{
",ERA=", ",YEAR=", ",MONTH=",
",WEEK_OF_YEAR=",
@@ -1367,11 +1367,11 @@ public abstract class Calendar
sb.append(",areFieldsSet=" + areFieldsSet);
for (int i = 0; i < FIELD_COUNT; i++)
{
- sb.append(fieldNames[i]);
- if (isSet[i])
- sb.append(fields[i]);
- else
- sb.append("?");
+ sb.append(fieldNames[i]);
+ if (isSet[i])
+ sb.append(fields[i]);
+ else
+ sb.append("?");
}
sb.append(",lenient=").append(lenient);
sb.append(",firstDayOfWeek=").append(firstDayOfWeek);
@@ -1407,13 +1407,13 @@ public abstract class Calendar
if (serialVersionOnStream > 1)
{
- // This is my interpretation of the serial number:
- // Sun wants to remove all fields from the stream someday
- // and will then increase the serialVersion number again.
- // We prepare to be compatible.
- fields = new int[FIELD_COUNT];
- isSet = new boolean[FIELD_COUNT];
- areFieldsSet = false;
+ // This is my interpretation of the serial number:
+ // Sun wants to remove all fields from the stream someday
+ // and will then increase the serialVersion number again.
+ // We prepare to be compatible.
+ fields = new int[FIELD_COUNT];
+ isSet = new boolean[FIELD_COUNT];
+ areFieldsSet = false;
}
}
@@ -1449,15 +1449,15 @@ public abstract class Calendar
{
if (field < 0 || field >= FIELD_COUNT)
throw new IllegalArgumentException("The field value, " + field +
- ", is invalid.");
+ ", is invalid.");
if (style != SHORT && style != LONG)
throw new IllegalArgumentException("The style must be either " +
- "short or long.");
+ "short or long.");
if (field == YEAR || field == WEEK_OF_YEAR ||
- field == WEEK_OF_MONTH || field == DAY_OF_MONTH ||
- field == DAY_OF_YEAR || field == DAY_OF_WEEK_IN_MONTH ||
- field == HOUR || field == HOUR_OF_DAY || field == MINUTE ||
- field == SECOND || field == MILLISECOND)
+ field == WEEK_OF_MONTH || field == DAY_OF_MONTH ||
+ field == DAY_OF_YEAR || field == DAY_OF_WEEK_IN_MONTH ||
+ field == HOUR || field == HOUR_OF_DAY || field == MINUTE ||
+ field == SECOND || field == MILLISECOND)
return null;
int value = get(field);
@@ -1466,30 +1466,30 @@ public abstract class Calendar
return syms.getEras()[value];
if (field == MONTH)
if (style == LONG)
- return syms.getMonths()[value];
- else
- return syms.getShortMonths()[value];
+ return syms.getMonths()[value];
+ else
+ return syms.getShortMonths()[value];
if (field == DAY_OF_WEEK)
if (style == LONG)
- return syms.getWeekdays()[value];
+ return syms.getWeekdays()[value];
else
- return syms.getShortWeekdays()[value];
+ return syms.getShortWeekdays()[value];
if (field == AM_PM)
return syms.getAmPmStrings()[value];
if (field == ZONE_OFFSET)
if (style == LONG)
- return syms.getZoneStrings()[value][1];
+ return syms.getZoneStrings()[value][1];
else
- return syms.getZoneStrings()[value][2];
+ return syms.getZoneStrings()[value][2];
if (field == DST_OFFSET)
if (style == LONG)
- return syms.getZoneStrings()[value][3];
+ return syms.getZoneStrings()[value][3];
else
- return syms.getZoneStrings()[value][4];
+ return syms.getZoneStrings()[value][4];
throw new InternalError("Failed to resolve field " + field +
- " with style " + style + " for locale " +
- locale);
+ " with style " + style + " for locale " +
+ locale);
}
/**
@@ -1528,93 +1528,93 @@ public abstract class Calendar
{
if (field < 0 || field >= FIELD_COUNT)
throw new IllegalArgumentException("The field value, " + field +
- ", is invalid.");
+ ", is invalid.");
if (style != SHORT && style != LONG && style != ALL_STYLES)
throw new IllegalArgumentException("The style must be either " +
- "short, long or all styles.");
+ "short, long or all styles.");
if (field == YEAR || field == WEEK_OF_YEAR ||
- field == WEEK_OF_MONTH || field == DAY_OF_MONTH ||
- field == DAY_OF_YEAR || field == DAY_OF_WEEK_IN_MONTH ||
- field == HOUR || field == HOUR_OF_DAY || field == MINUTE ||
- field == SECOND || field == MILLISECOND)
+ field == WEEK_OF_MONTH || field == DAY_OF_MONTH ||
+ field == DAY_OF_YEAR || field == DAY_OF_WEEK_IN_MONTH ||
+ field == HOUR || field == HOUR_OF_DAY || field == MINUTE ||
+ field == SECOND || field == MILLISECOND)
return null;
DateFormatSymbols syms = DateFormatSymbols.getInstance(locale);
Map<String,Integer> map = new HashMap<String,Integer>();
if (field == ERA)
{
- String[] eras = syms.getEras();
- for (int a = 0; a < eras.length; ++a)
- map.put(eras[a], a);
- return map;
+ String[] eras = syms.getEras();
+ for (int a = 0; a < eras.length; ++a)
+ map.put(eras[a], a);
+ return map;
}
if (field == MONTH)
{
- if (style == LONG || style == ALL_STYLES)
- {
- String[] months = syms.getMonths();
- for (int a = 0; a < months.length; ++a)
- map.put(months[a], a);
- }
- if (style == SHORT || style == ALL_STYLES)
- {
- String[] months = syms.getShortMonths();
- for (int a = 0; a < months.length; ++a)
- map.put(months[a], a);
- }
- return map;
+ if (style == LONG || style == ALL_STYLES)
+ {
+ String[] months = syms.getMonths();
+ for (int a = 0; a < months.length; ++a)
+ map.put(months[a], a);
+ }
+ if (style == SHORT || style == ALL_STYLES)
+ {
+ String[] months = syms.getShortMonths();
+ for (int a = 0; a < months.length; ++a)
+ map.put(months[a], a);
+ }
+ return map;
}
if (field == DAY_OF_WEEK)
{
- if (style == LONG || style == ALL_STYLES)
- {
- String[] weekdays = syms.getWeekdays();
- for (int a = SUNDAY; a < weekdays.length; ++a)
- map.put(weekdays[a], a);
- }
- if (style == SHORT || style == ALL_STYLES)
- {
- String[] weekdays = syms.getShortWeekdays();
- for (int a = SUNDAY; a < weekdays.length; ++a)
- map.put(weekdays[a], a);
- }
- return map;
+ if (style == LONG || style == ALL_STYLES)
+ {
+ String[] weekdays = syms.getWeekdays();
+ for (int a = SUNDAY; a < weekdays.length; ++a)
+ map.put(weekdays[a], a);
+ }
+ if (style == SHORT || style == ALL_STYLES)
+ {
+ String[] weekdays = syms.getShortWeekdays();
+ for (int a = SUNDAY; a < weekdays.length; ++a)
+ map.put(weekdays[a], a);
+ }
+ return map;
}
if (field == AM_PM)
{
- String[] ampms = syms.getAmPmStrings();
- for (int a = 0; a < ampms.length; ++a)
- map.put(ampms[a], a);
- return map;
+ String[] ampms = syms.getAmPmStrings();
+ for (int a = 0; a < ampms.length; ++a)
+ map.put(ampms[a], a);
+ return map;
}
if (field == ZONE_OFFSET)
{
- String[][] zones = syms.getZoneStrings();
- for (int a = 0; a < zones.length; ++a)
- {
- if (style == LONG || style == ALL_STYLES)
- map.put(zones[a][1], a);
- if (style == SHORT || style == ALL_STYLES)
- map.put(zones[a][2], a);
- }
- return map;
+ String[][] zones = syms.getZoneStrings();
+ for (int a = 0; a < zones.length; ++a)
+ {
+ if (style == LONG || style == ALL_STYLES)
+ map.put(zones[a][1], a);
+ if (style == SHORT || style == ALL_STYLES)
+ map.put(zones[a][2], a);
+ }
+ return map;
}
if (field == DST_OFFSET)
{
- String[][] zones = syms.getZoneStrings();
- for (int a = 0; a < zones.length; ++a)
- {
- if (style == LONG || style == ALL_STYLES)
- map.put(zones[a][3], a);
- if (style == SHORT || style == ALL_STYLES)
- map.put(zones[a][4], a);
- }
- return map;
+ String[][] zones = syms.getZoneStrings();
+ for (int a = 0; a < zones.length; ++a)
+ {
+ if (style == LONG || style == ALL_STYLES)
+ map.put(zones[a][3], a);
+ if (style == SHORT || style == ALL_STYLES)
+ map.put(zones[a][4], a);
+ }
+ return map;
}
-
+
throw new InternalError("Failed to resolve field " + field +
- " with style " + style + " for locale " +
- locale);
+ " with style " + style + " for locale " +
+ locale);
}
}
diff --git a/java/util/Collections.java b/java/util/Collections.java
index 066c9d538..828c6ecea 100644
--- a/java/util/Collections.java
+++ b/java/util/Collections.java
@@ -354,7 +354,7 @@ public class Collections
* This is true only if the given collection is also empty.
* @param c The collection of objects, which should be compared
* against the members of this list.
- * @return <code>true</code> if c is also empty.
+ * @return <code>true</code> if c is also empty.
*/
public boolean containsAll(Collection<?> c)
{
@@ -552,7 +552,7 @@ public class Collections
/**
* No mappings, so this returns null.
* @param o The key of the object to retrieve.
- * @return null.
+ * @return null.
*/
public V get(Object o)
{
@@ -617,7 +617,7 @@ public class Collections
}
} // class EmptyMap
-
+
/**
* Compare two objects with or without a Comparator. If c is null, uses the
* natural ordering. Slightly slower than doing it inline if the JVM isn't
@@ -653,8 +653,8 @@ public class Collections
* @throws NullPointerException if a null element has compareTo called
* @see #sort(List)
*/
- public static <T> int binarySearch(List<? extends Comparable<? super T>> l,
- T key)
+ public static <T> int binarySearch(List<? extends Comparable<? super T>> l,
+ T key)
{
return binarySearch(l, key, null);
}
@@ -687,7 +687,7 @@ public class Collections
* @see #sort(List, Comparator)
*/
public static <T> int binarySearch(List<? extends T> l, T key,
- Comparator<? super T> c)
+ Comparator<? super T> c)
{
int pos = 0;
int low = 0;
@@ -697,53 +697,53 @@ public class Collections
// if the list is sequential-access.
if (isSequential(l))
{
- ListIterator<T> itr = ((List<T>) l).listIterator();
+ ListIterator<T> itr = ((List<T>) l).listIterator();
int i = 0;
- T o = itr.next(); // Assumes list is not empty (see isSequential)
- boolean forward = true;
+ T o = itr.next(); // Assumes list is not empty (see isSequential)
+ boolean forward = true;
while (low <= hi)
{
pos = (low + hi) >>> 1;
if (i < pos)
- {
- if (!forward)
- itr.next(); // Changing direction first.
- for ( ; i != pos; i++, o = itr.next())
+ {
+ if (!forward)
+ itr.next(); // Changing direction first.
+ for ( ; i != pos; i++, o = itr.next())
;
- forward = true;
- }
+ forward = true;
+ }
else
- {
- if (forward)
- itr.previous(); // Changing direction first.
- for ( ; i != pos; i--, o = itr.previous())
+ {
+ if (forward)
+ itr.previous(); // Changing direction first.
+ for ( ; i != pos; i--, o = itr.previous())
;
- forward = false;
- }
- final int d = compare(o, key, c);
- if (d == 0)
+ forward = false;
+ }
+ final int d = compare(o, key, c);
+ if (d == 0)
return pos;
- else if (d > 0)
+ else if (d > 0)
hi = pos - 1;
- else
+ else
// This gets the insertion point right on the last loop
low = ++pos;
}
}
else
{
- while (low <= hi)
- {
- pos = (low + hi) >>> 1;
- final int d = compare(((List<T>) l).get(pos), key, c);
- if (d == 0)
+ while (low <= hi)
+ {
+ pos = (low + hi) >>> 1;
+ final int d = compare(((List<T>) l).get(pos), key, c);
+ if (d == 0)
return pos;
- else if (d > 0)
+ else if (d > 0)
hi = pos - 1;
- else
+ else
// This gets the insertion point right on the last loop
low = ++pos;
- }
+ }
}
// If we failed to find it, we do the same whichever search we did.
@@ -799,7 +799,7 @@ public class Collections
*/
public final boolean hasMoreElements()
{
- return i.hasNext();
+ return i.hasNext();
}
/**
@@ -810,7 +810,7 @@ public class Collections
*/
public final T nextElement()
{
- return i.next();
+ return i.next();
}
};
}
@@ -829,8 +829,8 @@ public class Collections
ListIterator<? super T> itr = l.listIterator();
for (int i = l.size() - 1; i >= 0; --i)
{
- itr.next();
- itr.set(val);
+ itr.next();
+ itr.set(val);
}
}
@@ -928,16 +928,16 @@ public class Collections
* (only possible when order is null)
*/
public static <T> T max(Collection<? extends T> c,
- Comparator<? super T> order)
+ Comparator<? super T> order)
{
Iterator<? extends T> itr = c.iterator();
T max = itr.next(); // throws NoSuchElementException
int csize = c.size();
for (int i = 1; i < csize; i++)
{
- T o = itr.next();
- if (compare(max, o, order) < 0)
- max = o;
+ T o = itr.next();
+ if (compare(max, o, order) < 0)
+ max = o;
}
return max;
}
@@ -974,16 +974,16 @@ public class Collections
* (only possible when order is null)
*/
public static <T> T min(Collection<? extends T> c,
- Comparator<? super T> order)
+ Comparator<? super T> order)
{
Iterator<? extends T> itr = c.iterator();
- T min = itr.next(); // throws NoSuchElementExcception
+ T min = itr.next(); // throws NoSuchElementExcception
int csize = c.size();
for (int i = 1; i < csize; i++)
{
- T o = itr.next();
- if (compare(min, o, order) > 0)
- min = o;
+ T o = itr.next();
+ if (compare(min, o, order) > 0)
+ min = o;
}
return min;
}
@@ -1044,7 +1044,7 @@ public class Collections
CopiesList(int n, T o)
{
if (n < 0)
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException();
this.n = n;
element = o;
}
@@ -1190,12 +1190,12 @@ public class Collections
ListIterator i2 = l.listIterator(pos2);
while (pos1 < pos2)
{
- Object o1 = i1.next();
+ Object o1 = i1.next();
Object o2 = i2.previous();
- i1.set(o2);
- i2.set(o1);
- ++pos1;
- --pos2;
+ i1.set(o2);
+ i2.set(o1);
+ ++pos1;
+ --pos2;
}
}
@@ -1221,7 +1221,7 @@ public class Collections
{
public int compare(T a, T b)
{
- return - c.compare(a, b);
+ return - c.compare(a, b);
}
};
}
@@ -1344,7 +1344,7 @@ public class Collections
// Now, make the swaps. We must take the remainder every time through
// the inner loop so that we don't overflow i to negative values.
- List<Object> objList = (List<Object>) list;
+ List<Object> objList = (List<Object>) list;
while (--lcm >= 0)
{
Object o = objList.get(lcm);
@@ -1381,10 +1381,10 @@ public class Collections
if (defaultRandom == null)
{
synchronized (Collections.class)
- {
- if (defaultRandom == null)
- defaultRandom = new Random();
- }
+ {
+ if (defaultRandom == null)
+ defaultRandom = new Random();
+ }
}
shuffle(l, defaultRandom);
}
@@ -1432,12 +1432,12 @@ public class Collections
for (int pos = lsize - 1; pos > 0; --pos)
{
- // Obtain a random position to swap with. pos + 1 is used so that the
- // range of the random number includes the current position.
- int swap = r.nextInt(pos + 1);
+ // Obtain a random position to swap with. pos + 1 is used so that the
+ // range of the random number includes the current position.
+ int swap = r.nextInt(pos + 1);
- // Swap the desired element.
- Object o;
+ // Swap the desired element.
+ Object o;
if (sequential)
{
o = a[swap];
@@ -1446,7 +1446,7 @@ public class Collections
else
o = list.set(swap, i.previous());
- i.set(o);
+ i.set(o);
}
}
@@ -1455,11 +1455,11 @@ public class Collections
* collection. The frequency represents the number of occurrences of
* elements within the collection which return <code>true</code> when
* compared with the object using the <code>equals</code> method.
- *
+ *
* @param c the collection to scan for occurrences of the object.
* @param o the object to locate occurrances of within the collection.
* @throws NullPointerException if the collection is <code>null</code>.
- * @since 1.5
+ * @since 1.5
*/
public static int frequency (Collection<?> c, Object o)
{
@@ -1467,9 +1467,9 @@ public class Collections
final Iterator<?> it = c.iterator();
while (it.hasNext())
{
- Object v = it.next();
- if (AbstractCollection.equals(o, v))
- ++result;
+ Object v = it.next();
+ if (AbstractCollection.equals(o, v))
+ ++result;
}
return result;
}
@@ -1505,9 +1505,9 @@ public class Collections
for (T element : a)
{
- boolean result = c.add(element);
- if (result)
- overall = true;
+ boolean result = c.add(element);
+ if (result)
+ overall = true;
}
return overall;
}
@@ -1531,11 +1531,11 @@ public class Collections
final Iterator<Object> it = oc1.iterator();
while (it.hasNext())
if (c2.contains(it.next()))
- return false;
+ return false;
return true;
}
-
+
/**
* Obtain an immutable Set consisting of a single element. The return value
* of this method is Serializable.
@@ -1595,30 +1595,30 @@ public class Collections
{
return new Iterator<T>()
{
- /**
- * Flag to indicate whether or not the element has
- * been retrieved.
- */
+ /**
+ * Flag to indicate whether or not the element has
+ * been retrieved.
+ */
private boolean hasNext = true;
- /**
- * Returns <code>true</code> if elements still remain to be
- * iterated through.
- *
- * @return <code>true</code> if the element has not yet been returned.
- */
+ /**
+ * Returns <code>true</code> if elements still remain to be
+ * iterated through.
+ *
+ * @return <code>true</code> if the element has not yet been returned.
+ */
public boolean hasNext()
{
return hasNext;
}
- /**
- * Returns the element.
- *
- * @return The element used by this singleton.
- * @throws NoSuchElementException if the object
- * has already been retrieved.
- */
+ /**
+ * Returns the element.
+ *
+ * @return The element used by this singleton.
+ * @throws NoSuchElementException if the object
+ * has already been retrieved.
+ */
public T next()
{
if (hasNext)
@@ -1630,15 +1630,15 @@ public class Collections
throw new NoSuchElementException();
}
- /**
- * Removes the element from the singleton.
- * As this set is immutable, this will always
- * throw an exception.
- *
- * @throws UnsupportedOperationException as the
- * singleton set doesn't support
- * <code>remove()</code>.
- */
+ /**
+ * Removes the element from the singleton.
+ * As this set is immutable, this will always
+ * throw an exception.
+ *
+ * @throws UnsupportedOperationException as the
+ * singleton set doesn't support
+ * <code>remove()</code>.
+ */
public void remove()
{
throw new UnsupportedOperationException();
@@ -1678,7 +1678,7 @@ public class Collections
/**
* The hash is just that of the element.
- *
+ *
* @return The hashcode of the element.
*/
public int hashCode()
@@ -1842,7 +1842,7 @@ public class Collections
/**
* Sublists are limited in scope.
- *
+ *
* @param from The starting bound for the sublist.
* @param to The ending bound for the sublist.
* @return Either an empty list if both bounds are
@@ -1876,7 +1876,7 @@ public class Collections
* Obvious string.
*
* @return The string surrounded by enclosing
- * square brackets.
+ * square brackets.
*/
public String toString()
{
@@ -1949,25 +1949,25 @@ public class Collections
public Set<Map.Entry<K, V>> entrySet()
{
if (entries == null)
- {
- Map.Entry<K,V> entry = new AbstractMap.SimpleEntry<K, V>(k, v)
- {
- /**
- * Sets the value of the map entry to the supplied value.
- * An exception is always thrown, as the map is immutable.
- *
- * @param o The new value.
- * @return The old value.
- * @throws UnsupportedOperationException as setting the value
- * is not supported.
- */
- public V setValue(V o)
- {
- throw new UnsupportedOperationException();
- }
- };
- entries = singleton(entry);
- }
+ {
+ Map.Entry<K,V> entry = new AbstractMap.SimpleEntry<K, V>(k, v)
+ {
+ /**
+ * Sets the value of the map entry to the supplied value.
+ * An exception is always thrown, as the map is immutable.
+ *
+ * @param o The new value.
+ * @return The old value.
+ * @throws UnsupportedOperationException as setting the value
+ * is not supported.
+ */
+ public V setValue(V o)
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ entries = singleton(entry);
+ }
return entries;
}
@@ -2100,10 +2100,10 @@ public class Collections
* <code>null</code> for natural ordering
* @throws ClassCastException if c will not compare some pair of items
* @throws UnsupportedOperationException if the List is not modifiable
- * @throws NullPointerException if the List is <code>null</code> or
- * <code>null</code> is compared by natural ordering (only possible
+ * @throws NullPointerException if the List is <code>null</code> or
+ * <code>null</code> is compared by natural ordering (only possible
* when c is <code>null</code>)
- *
+ *
* @see Arrays#sort(Object[], Comparator)
*/
public static <T> void sort(List<T> l, Comparator<? super T> c)
@@ -2113,8 +2113,8 @@ public class Collections
ListIterator<T> i = l.listIterator();
for (int pos = 0, alen = a.length; pos < alen; pos++)
{
- i.next();
- i.set(a[pos]);
+ i.next();
+ i.set(a[pos]);
}
}
@@ -2136,7 +2136,7 @@ public class Collections
list.set(i, list.set(j, list.get(i)));
}
-
+
/**
* Returns a synchronized (thread-safe) collection wrapper backed by the
* given collection. Notice that element access through the iterators
@@ -2536,7 +2536,7 @@ public class Collections
/**
* Retrieves the next object in the underlying collection.
* A lock is obtained on the mutex before the collection is accessed.
- *
+ *
* @return The next object in the collection.
* @throws NoSuchElementException if there are no more elements
*/
@@ -2695,7 +2695,7 @@ public class Collections
/**
* Add the contents of a collection to the underlying list at the given
- * index (optional operation). If the list imposes restraints on what
+ * index (optional operation). If the list imposes restraints on what
* can be inserted, such as no null elements, this should be documented.
* A lock is obtained on the mutex before any of the elements are added.
*
@@ -2854,7 +2854,7 @@ public class Collections
synchronized (mutex)
{
return new SynchronizedListIterator<T>(mutex,
- list.listIterator(index));
+ list.listIterator(index));
}
}
@@ -2926,7 +2926,7 @@ public class Collections
synchronized (mutex)
{
return new SynchronizedList<T>(mutex,
- list.subList(fromIndex, toIndex));
+ list.subList(fromIndex, toIndex));
}
}
} // class SynchronizedList
@@ -2991,8 +2991,8 @@ public class Collections
synchronized (mutex)
{
return new SynchronizedRandomAccessList<T>(mutex,
- list.subList(fromIndex,
- toIndex));
+ list.subList(fromIndex,
+ toIndex));
}
}
} // class SynchronizedRandomAccessList
@@ -3308,14 +3308,14 @@ public class Collections
e = o;
}
- /**
- * Returns <code>true</code> if the object, o, implements <code>Map.Entry</code>
- * with the same key and value as the underlying entry. A lock is
- * obtained on the mutex before the comparison takes place.
- *
- * @param o The object to compare with this entry.
- * @return <code>true</code> if o is equivalent to the underlying map entry.
- */
+ /**
+ * Returns <code>true</code> if the object, o, implements <code>Map.Entry</code>
+ * with the same key and value as the underlying entry. A lock is
+ * obtained on the mutex before the comparison takes place.
+ *
+ * @param o The object to compare with this entry.
+ * @return <code>true</code> if o is equivalent to the underlying map entry.
+ */
public boolean equals(Object o)
{
synchronized (mutex)
@@ -3324,12 +3324,12 @@ public class Collections
}
}
- /**
- * Returns the key used in the underlying map entry. A lock is obtained
- * on the mutex before the key is retrieved.
- *
- * @return The key of the underlying map entry.
- */
+ /**
+ * Returns the key used in the underlying map entry. A lock is obtained
+ * on the mutex before the key is retrieved.
+ *
+ * @return The key of the underlying map entry.
+ */
public K getKey()
{
synchronized (mutex)
@@ -3338,12 +3338,12 @@ public class Collections
}
}
- /**
- * Returns the value used in the underlying map entry. A lock is obtained
- * on the mutex before the value is retrieved.
- *
- * @return The value of the underlying map entry.
- */
+ /**
+ * Returns the value used in the underlying map entry. A lock is obtained
+ * on the mutex before the value is retrieved.
+ *
+ * @return The value of the underlying map entry.
+ */
public V getValue()
{
synchronized (mutex)
@@ -3352,15 +3352,15 @@ public class Collections
}
}
- /**
- * Computes the hash code for the underlying map entry.
- * This computation is described in the documentation for the
- * <code>Map</code> interface. A lock is obtained on the mutex
- * before the underlying map is accessed.
- *
- * @return The hash code of the underlying map entry.
- * @see Map#hashCode()
- */
+ /**
+ * Computes the hash code for the underlying map entry.
+ * This computation is described in the documentation for the
+ * <code>Map</code> interface. A lock is obtained on the mutex
+ * before the underlying map is accessed.
+ *
+ * @return The hash code of the underlying map entry.
+ * @see Map#hashCode()
+ */
public int hashCode()
{
synchronized (mutex)
@@ -3369,22 +3369,22 @@ public class Collections
}
}
- /**
- * Replaces the value in the underlying map entry with the specified
- * object (optional operation). A lock is obtained on the mutex
- * before the map is altered. The map entry, in turn, will alter
- * the underlying map object. The operation is undefined if the
- * <code>remove()</code> method of the iterator has been called
- * beforehand.
- *
- * @param value the new value to store
- * @return the old value
- * @throws UnsupportedOperationException if the operation is not supported.
- * @throws ClassCastException if the value is of the wrong type.
- * @throws IllegalArgumentException if something about the value
- * prevents it from existing in this map.
- * @throws NullPointerException if the map forbids null values.
- */
+ /**
+ * Replaces the value in the underlying map entry with the specified
+ * object (optional operation). A lock is obtained on the mutex
+ * before the map is altered. The map entry, in turn, will alter
+ * the underlying map object. The operation is undefined if the
+ * <code>remove()</code> method of the iterator has been called
+ * beforehand.
+ *
+ * @param value the new value to store
+ * @return the old value
+ * @throws UnsupportedOperationException if the operation is not supported.
+ * @throws ClassCastException if the value is of the wrong type.
+ * @throws IllegalArgumentException if something about the value
+ * prevents it from existing in this map.
+ * @throws NullPointerException if the map forbids null values.
+ */
public V setValue(V value)
{
synchronized (mutex)
@@ -3393,12 +3393,12 @@ public class Collections
}
}
- /**
- * Returns a textual representation of the underlying map entry.
- * A lock is obtained on the mutex before the entry is accessed.
- *
- * @return The contents of the map entry in <code>String</code> form.
- */
+ /**
+ * Returns a textual representation of the underlying map entry.
+ * A lock is obtained on the mutex before the entry is accessed.
+ *
+ * @return The contents of the map entry in <code>String</code> form.
+ */
public String toString()
{
synchronized (mutex)
@@ -3414,29 +3414,29 @@ public class Collections
{
entries = new SynchronizedSet<Map.Entry<K, V>>(mutex, m.entrySet())
{
- /**
- * Returns an iterator over the set. The iterator has no specific order,
- * unless further specified. A lock is obtained on the set's mutex
- * before the iterator is created. The created iterator is also
- * thread-safe.
- *
- * @return A synchronized set iterator.
- */
+ /**
+ * Returns an iterator over the set. The iterator has no specific order,
+ * unless further specified. A lock is obtained on the set's mutex
+ * before the iterator is created. The created iterator is also
+ * thread-safe.
+ *
+ * @return A synchronized set iterator.
+ */
public Iterator<Map.Entry<K, V>> iterator()
{
synchronized (super.mutex)
{
return new SynchronizedIterator<Map.Entry<K, V>>(super.mutex,
- c.iterator())
+ c.iterator())
{
- /**
- * Retrieves the next map entry from the iterator.
- * A lock is obtained on the iterator's mutex before
- * the entry is created. The new map entry is enclosed in
- * a thread-safe wrapper.
- *
- * @return A synchronized map entry.
- */
+ /**
+ * Retrieves the next map entry from the iterator.
+ * A lock is obtained on the iterator's mutex before
+ * the entry is created. The new map entry is enclosed in
+ * a thread-safe wrapper.
+ *
+ * @return A synchronized map entry.
+ */
public Map.Entry<K, V> next()
{
synchronized (super.mutex)
@@ -3658,7 +3658,7 @@ public class Collections
* <code>add</code> or <code>addAll</code>, is not supported via this
* collection. A lock is obtained on the mutex before the collection
* is created.
- *
+ *
* @return the collection of all values in the underlying map.
*/
public Collection<V> values()
@@ -3946,7 +3946,7 @@ public class Collections
synchronized (mutex)
{
return new SynchronizedSortedMap<K, V>(mutex,
- sm.subMap(fromKey, toKey));
+ sm.subMap(fromKey, toKey));
}
}
@@ -4144,8 +4144,8 @@ public class Collections
synchronized (mutex)
{
return new SynchronizedSortedSet<T>(mutex,
- ss.subSet(fromElement,
- toElement));
+ ss.subSet(fromElement,
+ toElement));
}
}
@@ -4174,7 +4174,7 @@ public class Collections
}
} // class SynchronizedSortedSet
-
+
/**
* Returns an unmodifiable view of the given collection. This allows
* "read-only" access, although changes in the backing collection show up
@@ -4497,7 +4497,7 @@ public class Collections
* via sublists, will fail with {@link UnsupportedOperationException}.
* Although this view prevents changes to the structure of the list and
* its elements, the values referenced by the objects in the list can
- * still be modified.
+ * still be modified.
* <p>
*
* The returned List implements Serializable, but can only be serialized if
@@ -4868,7 +4868,7 @@ public class Collections
* iterators will fail with {@link UnsupportedOperationException}.
* Although this view prevents changes to the structure of the map and its
* entries, the values referenced by the objects in the map can still be
- * modified.
+ * modified.
* <p>
*
* The returned Map implements Serializable, but can only be serialized if
@@ -4879,7 +4879,7 @@ public class Collections
* @see Serializable
*/
public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K,
- ? extends V> m)
+ ? extends V> m)
{
return new UnmodifiableMap<K, V>(m);
}
@@ -5019,7 +5019,7 @@ public class Collections
/**
* Returns <code>true</code> if the object, o, is also a map entry
* with an identical key and value.
- *
+ *
* @param o the object to compare.
* @return <code>true</code> if o is an equivalent map entry.
*/
@@ -5030,7 +5030,7 @@ public class Collections
/**
* Returns the key of this map entry.
- *
+ *
* @return the key.
*/
public K getKey()
@@ -5040,7 +5040,7 @@ public class Collections
/**
* Returns the value of this map entry.
- *
+ *
* @return the value.
*/
public V getValue()
@@ -5051,7 +5051,7 @@ public class Collections
/**
* Computes the hash code of this map entry. The computation is
* described in the <code>Map</code> interface documentation.
- *
+ *
* @return the hash code of this entry.
* @see Map#hashCode()
*/
@@ -5063,7 +5063,7 @@ public class Collections
/**
* Blocks the alteration of the value of this map entry. This method
* never returns, throwing an exception instead.
- *
+ *
* @param value The new value.
* @throws UnsupportedOperationException as an unmodifiable map entry
* does not support the <code>setValue()</code> operation.
@@ -5075,7 +5075,7 @@ public class Collections
/**
* Returns a textual representation of the map entry.
- *
+ *
* @return The map entry as a <code>String</code>.
*/
public String toString()
@@ -5102,20 +5102,20 @@ public class Collections
public Iterator<Map.Entry<K,V>> iterator()
{
return new UnmodifiableIterator<Map.Entry<K,V>>(c.iterator())
- {
- /**
- * Obtains the next element from the underlying set of
- * map entries.
- *
- * @return the next element in the collection.
- * @throws NoSuchElementException if there are no more elements.
- */
+ {
+ /**
+ * Obtains the next element from the underlying set of
+ * map entries.
+ *
+ * @return the next element in the collection.
+ * @throws NoSuchElementException if there are no more elements.
+ */
public Map.Entry<K,V> next()
{
final Map.Entry<K,V> e = super.next();
- return new UnmodifiableMapEntry<K,V>(e);
- }
- };
+ return new UnmodifiableMapEntry<K,V>(e);
+ }
+ };
}
// The array returned is an array of UnmodifiableMapEntry instead of
@@ -5124,14 +5124,14 @@ public class Collections
{
Object[] mapEntryResult = super.toArray();
UnmodifiableMapEntry<K,V> result[] = null;
-
+
if (mapEntryResult != null)
{
result = (UnmodifiableMapEntry<K,V>[])
- new UnmodifiableMapEntry[mapEntryResult.length];
+ new UnmodifiableMapEntry[mapEntryResult.length];
for (int i = 0; i < mapEntryResult.length; ++i)
- result[i] = new UnmodifiableMapEntry<K,V>((Map.Entry<K,V>)mapEntryResult[i]);
- }
+ result[i] = new UnmodifiableMapEntry<K,V>((Map.Entry<K,V>)mapEntryResult[i]);
+ }
return result;
}
@@ -5140,14 +5140,14 @@ public class Collections
public <S> S[] toArray(S[] array)
{
S[] result = super.toArray(array);
-
+
if (result != null)
- for (int i = 0; i < result.length; i++)
- array[i] =
- (S) new UnmodifiableMapEntry<K,V>((Map.Entry<K,V>) result[i]);
+ for (int i = 0; i < result.length; i++)
+ array[i] =
+ (S) new UnmodifiableMapEntry<K,V>((Map.Entry<K,V>) result[i]);
return array;
}
-
+
} // class UnmodifiableEntrySet
@@ -5311,7 +5311,7 @@ public class Collections
* will fail with {@link UnsupportedOperationException}.
* Although this view prevents changes to the structure of the set and its
* entries, the values referenced by the objects in the set can still be
- * modified.
+ * modified.
* <p>
*
* The returned Set implements Serializable, but can only be serialized if
@@ -5366,7 +5366,7 @@ public class Collections
* hash codes of all elements within the set.
*
* @return the hash code of the set.
- */
+ */
public int hashCode()
{
return c.hashCode();
@@ -5380,7 +5380,7 @@ public class Collections
* views, or iterators, will fail with {@link UnsupportedOperationException}.
* Although this view prevents changes to the structure of the map and its
* entries, the values referenced by the objects in the map can still be
- * modified.
+ * modified.
* <p>
*
* The returned SortedMap implements Serializable, but can only be
@@ -5391,7 +5391,7 @@ public class Collections
* @see Serializable
*/
public static <K, V> SortedMap<K, V> unmodifiableSortedMap(SortedMap<K,
- ? extends V> m)
+ ? extends V> m)
{
return new UnmodifiableSortedMap<K, V>(m);
}
@@ -5555,7 +5555,7 @@ public class Collections
* iterators, will fail with {@link UnsupportedOperationException}.
* Although this view prevents changes to the structure of the set and its
* entries, the values referenced by the objects in the set can still be
- * modified.
+ * modified.
* <p>
*
* The returns SortedSet implements Serializable, but can only be
@@ -5724,7 +5724,7 @@ public class Collections
} // class UnmodifiableSortedSet
/**
- * <p>
+ * <p>
* Returns a dynamically typesafe view of the given collection,
* where any modification is first checked to ensure that the type
* of the new data is appropriate. Although the addition of
@@ -5740,7 +5740,7 @@ public class Collections
* <code>ClassCastException</code> caused by erroneous casting, or
* for protecting collections from corruption by external libraries.
* </p>
- * <p>
+ * <p>
* Since the collection might be a List or a Set, and those
* have incompatible equals and hashCode requirements, this relies
* on Object's implementation rather than passing those calls on to
@@ -5748,7 +5748,7 @@ public class Collections
* Serializable, but can only be serialized if the collection it
* wraps is likewise Serializable.
* </p>
- *
+ *
* @param c the collection to wrap in a dynamically typesafe wrapper
* @param type the type of elements the collection should hold.
* @return a dynamically typesafe view of the collection.
@@ -5756,7 +5756,7 @@ public class Collections
* @since 1.5
*/
public static <E> Collection<E> checkedCollection(Collection<E> c,
- Class<E> type)
+ Class<E> type)
{
return new CheckedCollection<E>(c, type);
}
@@ -5775,7 +5775,7 @@ public class Collections
* Compatible with JDK 1.5.
*/
private static final long serialVersionUID = 1578914078182001775L;
-
+
/**
* The wrapped collection. Package visible for use by subclasses.
* @serial the real collection
@@ -5814,9 +5814,9 @@ public class Collections
public boolean add(E o)
{
if (type.isInstance(o))
- return c.add(o);
+ return c.add(o);
else
- throw new ClassCastException("The element is of the incorrect type.");
+ throw new ClassCastException("The element is of the incorrect type.");
}
/**
@@ -5834,11 +5834,11 @@ public class Collections
Collection<E> typedColl = (Collection<E>) c;
final Iterator<E> it = typedColl.iterator();
while (it.hasNext())
- {
- final E element = it.next();
- if (!type.isInstance(element))
- throw new ClassCastException("A member of the collection is not of the correct type.");
- }
+ {
+ final E element = it.next();
+ if (!type.isInstance(element))
+ throw new ClassCastException("A member of the collection is not of the correct type.");
+ }
return c.addAll(typedColl);
}
@@ -6075,7 +6075,7 @@ public class Collections
} // class CheckedIterator
/**
- * <p>
+ * <p>
* Returns a dynamically typesafe view of the given list,
* where any modification is first checked to ensure that the type
* of the new data is appropriate. Although the addition of
@@ -6118,7 +6118,7 @@ public class Collections
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
- private static class CheckedList<E>
+ private static class CheckedList<E>
extends CheckedCollection<E>
implements List<E>
{
@@ -6158,9 +6158,9 @@ public class Collections
public void add(int index, E o)
{
if (type.isInstance(o))
- list.add(index, o);
+ list.add(index, o);
else
- throw new ClassCastException("The object is of the wrong type.");
+ throw new ClassCastException("The object is of the wrong type.");
}
/**
@@ -6178,10 +6178,10 @@ public class Collections
Collection<E> typedColl = (Collection<E>) coll;
final Iterator<E> it = typedColl.iterator();
while (it.hasNext())
- {
- if (!type.isInstance(it.next()))
- throw new ClassCastException("A member of the collection is not of the correct type.");
- }
+ {
+ if (!type.isInstance(it.next()))
+ throw new ClassCastException("A member of the collection is not of the correct type.");
+ }
return list.addAll(index, coll);
}
@@ -6399,9 +6399,9 @@ public class Collections
public void add(E o)
{
if (type.isInstance(o))
- li.add(o);
+ li.add(o);
else
- throw new ClassCastException("The object is of the wrong type.");
+ throw new ClassCastException("The object is of the wrong type.");
}
/**
@@ -6466,14 +6466,14 @@ public class Collections
public void set(E o)
{
if (type.isInstance(o))
- li.set(o);
+ li.set(o);
else
- throw new ClassCastException("The object is of the wrong type.");
+ throw new ClassCastException("The object is of the wrong type.");
}
} // class CheckedListIterator
/**
- * <p>
+ * <p>
* Returns a dynamically typesafe view of the given map,
* where any modification is first checked to ensure that the type
* of the new data is appropriate. Although the addition of
@@ -6501,7 +6501,7 @@ public class Collections
* @see Serializable
*/
public static <K, V> Map<K, V> checkedMap(Map<K, V> m, Class<K> keyType,
- Class<V> valueType)
+ Class<V> valueType)
{
return new CheckedMap<K, V>(m, keyType, valueType);
}
@@ -6513,7 +6513,7 @@ public class Collections
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
- private static class CheckedMap<K, V>
+ private static class CheckedMap<K, V>
implements Map<K, V>, Serializable
{
/**
@@ -6621,7 +6621,7 @@ public class Collections
* <p>
* The set is backed by the map, so that changes in one show up in the
* other. Modifications made while an iterator is in progress cause
- * undefined behavior.
+ * undefined behavior.
* </p>
*
* @return the checked set view of all mapping entries.
@@ -6630,14 +6630,14 @@ public class Collections
public Set<Map.Entry<K, V>> entrySet()
{
if (entries == null)
- {
- Class<Map.Entry<K,V>> klass =
- (Class<Map.Entry<K,V>>) (Class) Map.Entry.class;
- entries = new CheckedEntrySet<Map.Entry<K,V>,K,V>(m.entrySet(),
- klass,
- keyType,
- valueType);
- }
+ {
+ Class<Map.Entry<K,V>> klass =
+ (Class<Map.Entry<K,V>>) (Class) Map.Entry.class;
+ entries = new CheckedEntrySet<Map.Entry<K,V>,K,V>(m.entrySet(),
+ klass,
+ keyType,
+ valueType);
+ }
return entries;
}
@@ -6656,13 +6656,13 @@ public class Collections
* @serial the key type.
*/
private final Class<SK> keyType;
-
+
/**
* The type of the map's values.
* @serial the value type.
*/
private final Class<SV> valueType;
-
+
/**
* Wrap a given set of map entries.
*
@@ -6672,104 +6672,104 @@ public class Collections
* @param valueType the type of the map's values.
*/
CheckedEntrySet(Set<E> s, Class<E> type, Class<SK> keyType,
- Class<SV> valueType)
+ Class<SV> valueType)
{
super(s, type);
- this.keyType = keyType;
- this.valueType = valueType;
+ this.keyType = keyType;
+ this.valueType = valueType;
}
// The iterator must return checked map entries.
public Iterator<E> iterator()
{
return new CheckedIterator<E>(c.iterator(), type)
- {
- /**
- * Obtains the next element from the underlying set of
- * map entries.
- *
- * @return the next element in the collection.
- * @throws NoSuchElementException if there are no more elements.
- */
+ {
+ /**
+ * Obtains the next element from the underlying set of
+ * map entries.
+ *
+ * @return the next element in the collection.
+ * @throws NoSuchElementException if there are no more elements.
+ */
public E next()
{
final Map.Entry e = (Map.Entry) super.next();
return (E) new Map.Entry()
- {
- /**
- * Returns <code>true</code> if the object, o, is also a map
- * entry with an identical key and value.
- *
- * @param o the object to compare.
- * @return <code>true</code> if o is an equivalent map entry.
- */
+ {
+ /**
+ * Returns <code>true</code> if the object, o, is also a map
+ * entry with an identical key and value.
+ *
+ * @param o the object to compare.
+ * @return <code>true</code> if o is an equivalent map entry.
+ */
public boolean equals(Object o)
{
return e.equals(o);
}
-
- /**
- * Returns the key of this map entry.
- *
- * @return the key.
- */
+
+ /**
+ * Returns the key of this map entry.
+ *
+ * @return the key.
+ */
public Object getKey()
{
return e.getKey();
}
- /**
- * Returns the value of this map entry.
- *
- * @return the value.
- */
+ /**
+ * Returns the value of this map entry.
+ *
+ * @return the value.
+ */
public Object getValue()
{
return e.getValue();
}
- /**
- * Computes the hash code of this map entry.
- * The computation is described in the <code>Map</code>
- * interface documentation.
- *
- * @return the hash code of this entry.
- * @see Map#hashCode()
- */
- public int hashCode()
+ /**
+ * Computes the hash code of this map entry.
+ * The computation is described in the <code>Map</code>
+ * interface documentation.
+ *
+ * @return the hash code of this entry.
+ * @see Map#hashCode()
+ */
+ public int hashCode()
{
return e.hashCode();
}
- /**
- * Sets the value of this map entry, provided it is of the
- * right type.
- *
- * @param value The new value.
- * @throws ClassCastException if the type of the value is not
- * a valid type for the underlying
- * map.
- */
+ /**
+ * Sets the value of this map entry, provided it is of the
+ * right type.
+ *
+ * @param value The new value.
+ * @throws ClassCastException if the type of the value is not
+ * a valid type for the underlying
+ * map.
+ */
public Object setValue(Object value)
{
- if (valueType.isInstance(value))
- return e.setValue(value);
- else
- throw new ClassCastException("The value is of the wrong type.");
+ if (valueType.isInstance(value))
+ return e.setValue(value);
+ else
+ throw new ClassCastException("The value is of the wrong type.");
}
- /**
- * Returns a textual representation of the map entry.
- *
- * @return The map entry as a <code>String</code>.
- */
+ /**
+ * Returns a textual representation of the map entry.
+ *
+ * @return The map entry as a <code>String</code>.
+ */
public String toString()
{
return e.toString();
}
- };
+ };
}
- };
+ };
}
} // class CheckedEntrySet
@@ -6811,17 +6811,17 @@ public class Collections
* @param value The new value.
* @return the previous value of the key, or null if there was no mapping.
* @throws ClassCastException if the type of the key or the value is
- * not a valid type for the underlying map.
+ * not a valid type for the underlying map.
*/
public V put(K key, V value)
{
if (keyType.isInstance(key))
- {
- if (valueType.isInstance(value))
- return m.put(key,value);
- else
- throw new ClassCastException("The value is of the wrong type.");
- }
+ {
+ if (valueType.isInstance(value))
+ return m.put(key,value);
+ else
+ throw new ClassCastException("The value is of the wrong type.");
+ }
throw new ClassCastException("The key is of the wrong type.");
}
@@ -6875,20 +6875,20 @@ public class Collections
* @param map the map, the entries of which should be added
* to the underlying map.
* @throws ClassCastException if the type of a key or value is
- * not a valid type for the underlying map.
+ * not a valid type for the underlying map.
*/
public void putAll(Map<? extends K, ? extends V> map)
{
Map<K,V> typedMap = (Map<K,V>) map;
final Iterator<Map.Entry<K,V>> it = typedMap.entrySet().iterator();
while (it.hasNext())
- {
- final Map.Entry<K,V> entry = it.next();
- if (!keyType.isInstance(entry.getKey()))
- throw new ClassCastException("A key is of the wrong type.");
- if (!valueType.isInstance(entry.getValue()))
- throw new ClassCastException("A value is of the wrong type.");
- }
+ {
+ final Map.Entry<K,V> entry = it.next();
+ if (!keyType.isInstance(entry.getKey()))
+ throw new ClassCastException("A key is of the wrong type.");
+ if (!valueType.isInstance(entry.getValue()))
+ throw new ClassCastException("A value is of the wrong type.");
+ }
m.putAll(typedMap);
}
@@ -6941,7 +6941,7 @@ public class Collections
* behavior. These modifications are again limited to the values of
* the keys.
* </p>
- *
+ *
* @return the collection view of all values.
*/
public Collection<V> values()
@@ -6953,7 +6953,7 @@ public class Collections
} // class CheckedMap
/**
- * <p>
+ * <p>
* Returns a dynamically typesafe view of the given set,
* where any modification is first checked to ensure that the type
* of the new data is appropriate. Although the addition of
@@ -6991,7 +6991,7 @@ public class Collections
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
- private static class CheckedSet<E>
+ private static class CheckedSet<E>
extends CheckedCollection<E>
implements Set<E>
{
@@ -7027,7 +7027,7 @@ public class Collections
* hash codes of all elements within the set.
*
* @return the hash code of the set.
- */
+ */
public int hashCode()
{
return c.hashCode();
@@ -7035,7 +7035,7 @@ public class Collections
} // class CheckedSet
/**
- * <p>
+ * <p>
* Returns a dynamically typesafe view of the given sorted map,
* where any modification is first checked to ensure that the type
* of the new data is appropriate. Although the addition of
@@ -7063,8 +7063,8 @@ public class Collections
* @see Serializable
*/
public static <K, V> SortedMap<K, V> checkedSortedMap(SortedMap<K, V> m,
- Class<K> keyType,
- Class<V> valueType)
+ Class<K> keyType,
+ Class<V> valueType)
{
return new CheckedSortedMap<K, V>(m, keyType, valueType);
}
@@ -7199,8 +7199,8 @@ public class Collections
*/
public SortedMap<K, V> subMap(K fromKey, K toKey)
{
- return new CheckedSortedMap<K, V>(sm.subMap(fromKey, toKey), keyType,
- valueType);
+ return new CheckedSortedMap<K, V>(sm.subMap(fromKey, toKey), keyType,
+ valueType);
}
/**
@@ -7231,7 +7231,7 @@ public class Collections
public SortedMap<K, V> tailMap(K fromKey)
{
return new CheckedSortedMap<K, V>(sm.tailMap(fromKey), keyType,
- valueType);
+ valueType);
}
} // class CheckedSortedMap
@@ -7263,7 +7263,7 @@ public class Collections
* @see Serializable
*/
public static <E> SortedSet<E> checkedSortedSet(SortedSet<E> s,
- Class<E> type)
+ Class<E> type)
{
return new CheckedSortedSet<E>(s, type);
}
@@ -7275,7 +7275,7 @@ public class Collections
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.5
*/
- private static class CheckedSortedSet<E>
+ private static class CheckedSortedSet<E>
extends CheckedSet<E>
implements SortedSet<E>
{
@@ -7287,7 +7287,7 @@ public class Collections
/**
* The wrapped set; stored both here and in the superclass to avoid
* excessive casting.
- *
+ *
* @serial the wrapped set
*/
private SortedSet<E> ss;
@@ -7388,7 +7388,7 @@ public class Collections
* new Integer(highlimit.intValue() + 1))</code> to reverse
* the inclusiveness of both endpoints.
* </p>
- *
+ *
* @param fromElement the inclusive lower range of the subset.
* @param toElement the exclusive upper range of the subset.
* @return the subset.
@@ -7471,7 +7471,7 @@ public class Collections
}
/**
- * The implementation of {@link #asLIFOQueue(Deque)}.
+ * The implementation of {@link #asLIFOQueue(Deque)}.
*
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.6
@@ -7479,7 +7479,7 @@ public class Collections
private static class LIFOQueue<T>
extends AbstractQueue<T>
{
-
+
/**
* The backing deque.
*/
@@ -7500,36 +7500,36 @@ public class Collections
{
return deque.offerFirst(e);
}
-
+
public boolean addAll(Collection<? extends T> c)
{
boolean result = false;
final Iterator<? extends T> it = c.iterator();
while (it.hasNext())
- result |= deque.offerFirst(it.next());
+ result |= deque.offerFirst(it.next());
return result;
}
-
+
public void clear()
{
deque.clear();
}
-
+
public boolean isEmpty()
{
return deque.isEmpty();
}
-
+
public Iterator<T> iterator()
{
return deque.iterator();
}
-
+
public boolean offer(T e)
{
return deque.offerFirst(e);
}
-
+
public T peek()
{
return deque.peek();
@@ -7539,7 +7539,7 @@ public class Collections
{
return deque.poll();
}
-
+
public int size()
{
return deque.size();
@@ -7547,7 +7547,7 @@ public class Collections
} // class LIFOQueue
/**
- * The implementation of {@link #newSetFromMap(Map)}.
+ * The implementation of {@link #newSetFromMap(Map)}.
*
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.6
@@ -7555,7 +7555,7 @@ public class Collections
private static class MapSet<E>
extends AbstractSet<E>
{
-
+
/**
* The backing map.
*/
@@ -7571,7 +7571,7 @@ public class Collections
public MapSet(Map<E,Boolean> map)
{
if (!map.isEmpty())
- throw new IllegalArgumentException("The map must be empty.");
+ throw new IllegalArgumentException("The map must be empty.");
this.map = map;
}
@@ -7579,45 +7579,45 @@ public class Collections
{
return map.put(e, true) == null;
}
-
+
public boolean addAll(Collection<? extends E> c)
{
boolean result = false;
final Iterator<? extends E> it = c.iterator();
while (it.hasNext())
- result |= (map.put(it.next(), true) == null);
+ result |= (map.put(it.next(), true) == null);
return result;
}
-
+
public void clear()
{
map.clear();
}
-
+
public boolean contains(Object o)
{
return map.containsKey(o);
}
-
+
public boolean isEmpty()
{
return map.isEmpty();
}
-
+
public Iterator<E> iterator()
{
return map.keySet().iterator();
}
-
+
public boolean remove(Object o)
{
return map.remove(o) != null;
}
-
+
public int size()
{
return map.size();
}
} // class MapSet
-
+
} // class Collections
diff --git a/java/util/Currency.java b/java/util/Currency.java
index 11235f14b..d58082c17 100644
--- a/java/util/Currency.java
+++ b/java/util/Currency.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -60,7 +60,7 @@ import java.util.spi.CurrencyNameProvider;
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.4
*/
-public final class Currency
+public final class Currency
implements Serializable
{
/**
@@ -95,7 +95,7 @@ public final class Currency
* @serial the number of fraction digits
*/
private transient int fractionDigits;
-
+
/**
* A cached map of country codes
* instances to international currency code
@@ -115,7 +115,7 @@ public final class Currency
* is the international currency code.
*
* @see #getInstance(java.util.Locale)
- * @see #getInstance(java.lang.String)
+ * @see #getInstance(java.lang.String)
* @see #readResolve()
* @serial ignored.
*/
@@ -133,7 +133,7 @@ public final class Currency
/* Create the properties object */
properties = new Properties();
/* Try and load the properties from our iso4217.properties resource */
- try
+ try
{
properties.load(Currency.class.getResourceAsStream("iso4217.properties"));
}
@@ -157,7 +157,7 @@ public final class Currency
* country code, are ignored. The results of calling this
* method may vary over time, as the currency associated with
* a particular country changes. For countries without
- * a given currency (e.g. Antarctica), the result is null.
+ * a given currency (e.g. Antarctica), the result is null.
*
* @param loc the locale for the new currency, or null if
* there is no country code specified or a currency
@@ -176,8 +176,8 @@ public final class Currency
if (countryCode.equals(""))
{
throw new
- IllegalArgumentException("Invalid (empty) country code for locale:"
- + loc);
+ IllegalArgumentException("Invalid (empty) country code for locale:"
+ + loc);
}
/* Construct the key for the currency */
currencyKey = countryCode + ".currency";
@@ -206,7 +206,7 @@ public final class Currency
* currency code.
*
* @param code the code to use.
- */
+ */
private Currency(String code)
{
currencyCode = code;
@@ -234,19 +234,19 @@ public final class Currency
* currencies, such as IMF Special Drawing Rights, -1 is returned.
*
* @return the number of digits after the decimal separator for this currency.
- */
+ */
public int getDefaultFractionDigits()
{
return fractionDigits;
}
-
+
/**
* Builds a new currency instance for this locale.
* All components of the given locale, other than the
* country code, are ignored. The results of calling this
* method may vary over time, as the currency associated with
* a particular country changes. For countries without
- * a given currency (e.g. Antarctica), the result is null.
+ * a given currency (e.g. Antarctica), the result is null.
*
* @param locale a <code>Locale</code> instance.
* @return a new <code>Currency</code> instance.
@@ -254,7 +254,7 @@ public final class Currency
* country code is null.
* @throws IllegalArgumentException if the country of
* the given locale is not a supported ISO3166 code.
- */
+ */
public static Currency getInstance(Locale locale)
{
/**
@@ -270,39 +270,39 @@ public final class Currency
String country = locale.getCountry();
if (locale == null || country == null)
{
- throw new
- NullPointerException("The locale or its country is null.");
+ throw new
+ NullPointerException("The locale or its country is null.");
}
-
+
/* Check that country of locale given is valid. */
if (country.length() != 2)
throw new IllegalArgumentException();
-
+
/* Attempt to get the currency from the cache */
String code = (String) countryMap.get(country);
if (code == null)
{
/* Create the currency for this locale */
newCurrency = new Currency(locale);
- /*
+ /*
* If the currency code is null, then creation failed
* and we return null.
*/
- code = newCurrency.getCurrencyCode();
+ code = newCurrency.getCurrencyCode();
if (code == null)
{
return null;
}
- else
+ else
{
/* Cache it */
countryMap.put(country, code);
- cache.put(code, newCurrency);
+ cache.put(code, newCurrency);
}
}
else
{
- newCurrency = (Currency) cache.get(code);
+ newCurrency = (Currency) cache.get(code);
}
/* Return the instance */
return newCurrency;
@@ -321,10 +321,10 @@ public final class Currency
{
Locale[] allLocales;
- /*
+ /*
* Throw a null pointer exception explicitly if currencyCode is null.
* One is not thrown otherwise. It results in an
- * IllegalArgumentException.
+ * IllegalArgumentException.
*/
if (currencyCode == null)
{
@@ -336,35 +336,35 @@ public final class Currency
Currency newCurrency = (Currency) cache.get(currencyCode);
if (newCurrency == null)
{
- /* Get all locales */
- allLocales = Locale.getAvailableLocales();
- /* Loop through each locale, looking for the code */
- for (int i = 0;i < allLocales.length; i++)
- {
- try
- {
- Currency testCurrency = getInstance (allLocales[i]);
- if (testCurrency != null &&
- testCurrency.getCurrencyCode().equals(currencyCode))
- {
- return testCurrency;
- }
- }
- catch (IllegalArgumentException exception)
- {
- /* Ignore locales without valid countries */
- }
- }
- /*
- * If we get this far, the code is not supported by any of
- * our locales.
- */
- throw new IllegalArgumentException("The currency code, " + currencyCode +
- ", is not supported.");
+ /* Get all locales */
+ allLocales = Locale.getAvailableLocales();
+ /* Loop through each locale, looking for the code */
+ for (int i = 0;i < allLocales.length; i++)
+ {
+ try
+ {
+ Currency testCurrency = getInstance (allLocales[i]);
+ if (testCurrency != null &&
+ testCurrency.getCurrencyCode().equals(currencyCode))
+ {
+ return testCurrency;
+ }
+ }
+ catch (IllegalArgumentException exception)
+ {
+ /* Ignore locales without valid countries */
+ }
+ }
+ /*
+ * If we get this far, the code is not supported by any of
+ * our locales.
+ */
+ throw new IllegalArgumentException("The currency code, " + currencyCode +
+ ", is not supported.");
}
else
{
- return newCurrency;
+ return newCurrency;
}
}
@@ -413,27 +413,27 @@ public final class Currency
try
{
return ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
- locale).getString(property);
+ locale).getString(property);
}
catch (MissingResourceException exception)
{
- /* This means runtime support for the locale
- * is not available, so we check providers. */
+ /* This means runtime support for the locale
+ * is not available, so we check providers. */
}
for (CurrencyNameProvider p :
- ServiceLoader.load(CurrencyNameProvider.class))
+ ServiceLoader.load(CurrencyNameProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(locale))
- {
- String localizedString = p.getSymbol(currencyCode,
- locale);
- if (localizedString != null)
- return localizedString;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(locale))
+ {
+ String localizedString = p.getSymbol(currencyCode,
+ locale);
+ if (localizedString != null)
+ return localizedString;
+ break;
+ }
+ }
}
if (locale.equals(Locale.ROOT)) // Base case
return currencyCode;
diff --git a/java/util/Date.java b/java/util/Date.java
index 5f83cd06c..3f7ba6f59 100644
--- a/java/util/Date.java
+++ b/java/util/Date.java
@@ -49,11 +49,11 @@ import java.text.SimpleDateFormat;
/**
* <p>
* This class represents a specific time in milliseconds since the epoch.
- * The epoch is 1970, January 1 00:00:00.0000 UTC.
+ * The epoch is 1970, January 1 00:00:00.0000 UTC.
* </p>
* <p>
* <code>Date</code> is intended to reflect universal time coordinate (UTC),
- * but this depends on the underlying host environment. Most operating systems
+ * but this depends on the underlying host environment. Most operating systems
* don't handle the leap second, which occurs about once every year or
* so. The leap second is added to the last minute of the day on either
* the 30th of June or the 31st of December, creating a minute 61 seconds
@@ -127,13 +127,13 @@ public class Date
* An array of week names used to map names to integer values.
*/
private static final String[] weekNames = { "Sun", "Mon", "Tue", "Wed",
- "Thu", "Fri", "Sat" };
+ "Thu", "Fri", "Sat" };
/**
* An array of month names used to map names to integer values.
*/
private static final String[] monthNames = { "Jan", "Feb", "Mar", "Apr",
- "May", "Jun", "Jul", "Aug",
- "Sep", "Oct", "Nov", "Dec" };
+ "May", "Jun", "Jul", "Aug",
+ "Sep", "Oct", "Nov", "Dec" };
/**
* Creates a new Date Object representing the current time.
*/
@@ -187,7 +187,7 @@ public class Date
* Creates a new Date Object representing the given time.
*
* @deprecated use <code>new GregorianCalendar(year+1900, month,
- * day, hour, min, sec)</code> instead.
+ * day, hour, min, sec)</code> instead.
* @param year the difference between the required year and 1900.
* @param month the month as a value between 0 and 11.
* @param day the day as a value between 0 and 31.
@@ -200,7 +200,7 @@ public class Date
public Date(int year, int month, int day, int hour, int min, int sec)
{
GregorianCalendar cal =
- new GregorianCalendar(year + 1900, month, day, hour, min, sec);
+ new GregorianCalendar(year + 1900, month, day, hour, min, sec);
time = cal.getTimeInMillis();
}
@@ -208,7 +208,7 @@ public class Date
* Creates a new Date from the given string representation. This
* does the same as <code>new Date(Date.parse(s))</code>
* @see #parse
- * @deprecated use <code>java.text.DateFormat.parse(s)</code> instead.
+ * @deprecated use <code>java.text.DateFormat.parse(s)</code> instead.
*/
public Date(String s)
{
@@ -226,11 +226,11 @@ public class Date
{
try
{
- return super.clone();
+ return super.clone();
}
catch (CloneNotSupportedException ex)
{
- return null;
+ return null;
}
}
@@ -253,7 +253,7 @@ public class Date
* @return the time in milliseconds since the epoch.
*/
public static long UTC(int year, int month, int date,
- int hrs, int min, int sec)
+ int hrs, int min, int sec)
{
GregorianCalendar cal =
new GregorianCalendar(year + 1900, month, date, hrs, min, sec);
@@ -278,7 +278,7 @@ public class Date
* from this object is also used to determine whether or not daylight savings
* time is in effect. For example, the offset for the UK would be 0 if the
* month of the date object was January, and 1 if the month was August.
- *
+ *
* @deprecated use
* <code>Calendar.get(Calendar.ZONE_OFFSET)+Calendar.get(Calendar.DST_OFFSET)</code>
* instead.
@@ -291,13 +291,13 @@ public class Date
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(time);
return - (cal.get(Calendar.ZONE_OFFSET)
- + cal.get(Calendar.DST_OFFSET)) / (60 * 1000);
+ + cal.get(Calendar.DST_OFFSET)) / (60 * 1000);
}
/**
* Sets the time which this object should represent.
*
- * @param time the time in milliseconds since the epoch.
+ * @param time the time in milliseconds since the epoch.
*/
public void setTime(long time)
{
@@ -309,7 +309,7 @@ public class Date
*
* @param when the other date
* @return true, if the date represented by this object is
- * strictly later than the time represented by when.
+ * strictly later than the time represented by when.
*/
public boolean after(Date when)
{
@@ -334,7 +334,7 @@ public class Date
* @param obj the object to compare.
* @return true, if obj is a Date object and the time represented
* by obj is exactly the same as the time represented by this
- * object.
+ * object.
*/
public boolean equals(Object obj)
{
@@ -348,7 +348,7 @@ public class Date
* @return 0, if the date represented
* by obj is exactly the same as the time represented by this
* object, a negative if this Date is before the other Date, and
- * a positive value otherwise.
+ * a positive value otherwise.
*/
public int compareTo(Date when)
{
@@ -414,7 +414,7 @@ public class Date
* </li>
* </ul>
* <p>
- * The <code>DateFormat</code> class should now be
+ * The <code>DateFormat</code> class should now be
* preferred over using this method.
* </p>
*
@@ -439,11 +439,11 @@ public class Date
+ sec.substring(sec.length() - 2) + " "
+
cal.getTimeZone().getDisplayName(cal.getTimeZone().inDaylightTime(this),
- TimeZone.SHORT) + " " +
+ TimeZone.SHORT) + " " +
year.substring(year.length() - 4);
}
- /**
+ /**
* Returns a locale-dependent string representation of this
* <code>Date</code> object.
*
@@ -457,7 +457,7 @@ public class Date
return java.text.DateFormat.getInstance().format(this);
}
- /**
+ /**
* <p>
* Returns a string representation of this <code>Date</code>
* object using GMT rather than the local timezone.
@@ -497,7 +497,7 @@ public class Date
* the local timezone.
* </li>
* </ul>
- *
+ *
* @deprecated Use DateFormat.format(Date) with a GMT TimeZone.
* @return A string of the form 'd mon yyyy hh:mm:ss GMT' using
* GMT as opposed to the local timezone.
@@ -526,12 +526,12 @@ public class Date
try
{
- // parseInt doesn't handle '+' so strip off sign.
- num = Integer.parseInt(tok.substring(1));
+ // parseInt doesn't handle '+' so strip off sign.
+ num = Integer.parseInt(tok.substring(1));
}
catch (NumberFormatException ex)
{
- throw new IllegalArgumentException(tok);
+ throw new IllegalArgumentException(tok);
}
// Convert hours to minutes.
@@ -557,8 +557,8 @@ public class Date
// We could possibly use the fields of DateFormatSymbols but that is
// localized and thus might not match the English words specified.
String months[] = { "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY",
- "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER",
- "NOVEMBER", "DECEMBER" };
+ "JUNE", "JULY", "AUGUST", "SEPTEMBER", "OCTOBER",
+ "NOVEMBER", "DECEMBER" };
int i;
for (i = 0; i < 12; i++)
@@ -581,7 +581,7 @@ public class Date
// We could possibly use the fields of DateFormatSymbols but that is
// localized and thus might not match the English words specified.
String daysOfWeek[] = { "SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY",
- "THURSDAY", "FRIDAY", "SATURDAY" };
+ "THURSDAY", "FRIDAY", "SATURDAY" };
int i;
for (i = 0; i < 7; i++)
@@ -591,7 +591,7 @@ public class Date
return false;
}
- /**
+ /**
* <p>
* Parses a String and returns the time, in milliseconds since the
* epoch, it represents. Most syntaxes are handled, including
@@ -612,7 +612,7 @@ public class Date
* failure. The ASCII characters A-Z, a-z, 0-9, and ',', '+', '-',
* ':' and '/' are the only characters permitted within the string,
* besides whitespace and characters enclosed within parantheses
- * '(' and ')'.
+ * '(' and ')'.
* </p>
* <p>
* A sequence of consecutive digits are recognised as a number,
@@ -729,15 +729,15 @@ public class Date
int len = string.length();
for (int i = 0; i < len; i++)
{
- char ch = string.charAt(i);
- if (ch >= 'a' && ch <= 'z')
- ch -= 'a' - 'A';
- if (ch == '(')
- parenNesting++;
- else if (parenNesting == 0)
- buf.append(ch);
- else if (ch == ')')
- parenNesting--;
+ char ch = string.charAt(i);
+ if (ch >= 'a' && ch <= 'z')
+ ch -= 'a' - 'A';
+ if (ch == '(')
+ parenNesting++;
+ else if (parenNesting == 0)
+ buf.append(ch);
+ else if (ch == ')')
+ parenNesting--;
}
int tmpMonth;
@@ -747,163 +747,163 @@ public class Date
while (strtok.hasMoreTokens())
{
- String tok = strtok.nextToken();
- char firstch = tok.charAt(0);
- if ((firstch == '+' || firstch == '-') && year >= 0)
- {
- timezone = parseTz(tok, firstch);
- localTimezone = false;
- }
- else if (firstch >= '0' && firstch <= '9')
- {
- int lastPunct = -1;
- while (tok != null && tok.length() > 0)
- {
- int punctOffset = tok.length();
- int num = 0;
- int punct;
- for (int i = 0; ; i++)
- {
- if (i >= punctOffset)
- {
- punct = -1;
- break;
- }
- else
- {
- punct = tok.charAt(i);
- if (punct >= '0' && punct <= '9')
- {
- if (num > 999999999) // in case of overflow
- throw new IllegalArgumentException(tok);
- num = 10 * num + (punct - '0');
- }
- else
- {
- punctOffset = i;
- break;
- }
- }
-
- }
-
- if (punct == ':')
- {
- if (hour < 0)
- hour = num;
- else
- minute = num;
- }
- else if (lastPunct == ':' && hour >= 0 && (minute < 0 || second < 0))
- {
- if (minute < 0)
- minute = num;
- else
- second = num;
- }
- else if ((num >= 70
- && (punct == ' ' || punct == ','
- || punct == '/' || punct < 0))
- || (num < 70 && day >= 0 && month >= 0 && year < 0))
- {
- if (num >= 100)
- year = num;
- else
- {
- int curYear = 1900 + new Date().getYear();
- int firstYear = curYear - 80;
- year = firstYear / 100 * 100 + num;
- if (year < firstYear)
- year += 100;
- }
- }
- else if (punct == '/')
- {
- if (month < 0)
- month = num - 1;
- else
- day = num;
- }
- else if (hour >= 0 && minute < 0)
- minute = num;
- else if (minute >= 0 && second < 0)
- second = num;
- else if (day < 0)
- day = num;
- else
- throw new IllegalArgumentException(tok);
-
- // Advance string if there's more to process in this token.
- if (punct < 0 || punctOffset + 1 >= tok.length())
- tok = null;
- else
- tok = tok.substring(punctOffset + 1);
- lastPunct = punct;
- }
- }
- else if (firstch >= 'A' && firstch <= 'Z')
- {
- if (tok.equals("AM"))
- {
- if (hour < 1 || hour > 12)
- throw new IllegalArgumentException(tok);
- if (hour == 12)
- hour = 0;
- }
- else if (tok.equals("PM"))
- {
- if (hour < 1 || hour > 12)
- throw new IllegalArgumentException(tok);
- if (hour < 12)
- hour += 12;
- }
- else if (parseDayOfWeek(tok))
- { /* Ignore it; throw the token away. */ }
- else if (tok.equals("UT") || tok.equals("UTC") || tok.equals("GMT"))
- localTimezone = false;
- else if (tok.startsWith("UT") || tok.startsWith("GMT"))
- {
- int signOffset = 3;
- if (tok.charAt(1) == 'T' && tok.charAt(2) != 'C')
- signOffset = 2;
-
- char sign = tok.charAt(signOffset);
- if (sign != '+' && sign != '-')
- throw new IllegalArgumentException(tok);
-
- timezone = parseTz(tok.substring(signOffset), sign);
- localTimezone = false;
- }
- else if ((tmpMonth = parseMonth(tok)) >= 0)
- month = tmpMonth;
- else if (tok.length() == 3 && tok.charAt(2) == 'T')
- {
- // Convert timezone offset from hours to minutes.
- char ch = tok.charAt(0);
- if (ch == 'E')
- timezone = -5 * 60;
- else if (ch == 'C')
- timezone = -6 * 60;
- else if (ch == 'M')
- timezone = -7 * 60;
- else if (ch == 'P')
- timezone = -8 * 60;
- else
- throw new IllegalArgumentException(tok);
-
- // Shift 60 minutes for Daylight Savings Time.
- if (tok.charAt(1) == 'D')
- timezone += 60;
- else if (tok.charAt(1) != 'S')
- throw new IllegalArgumentException(tok);
-
- localTimezone = false;
- }
- else
- throw new IllegalArgumentException(tok);
- }
- else
- throw new IllegalArgumentException(tok);
+ String tok = strtok.nextToken();
+ char firstch = tok.charAt(0);
+ if ((firstch == '+' || firstch == '-') && year >= 0)
+ {
+ timezone = parseTz(tok, firstch);
+ localTimezone = false;
+ }
+ else if (firstch >= '0' && firstch <= '9')
+ {
+ int lastPunct = -1;
+ while (tok != null && tok.length() > 0)
+ {
+ int punctOffset = tok.length();
+ int num = 0;
+ int punct;
+ for (int i = 0; ; i++)
+ {
+ if (i >= punctOffset)
+ {
+ punct = -1;
+ break;
+ }
+ else
+ {
+ punct = tok.charAt(i);
+ if (punct >= '0' && punct <= '9')
+ {
+ if (num > 999999999) // in case of overflow
+ throw new IllegalArgumentException(tok);
+ num = 10 * num + (punct - '0');
+ }
+ else
+ {
+ punctOffset = i;
+ break;
+ }
+ }
+
+ }
+
+ if (punct == ':')
+ {
+ if (hour < 0)
+ hour = num;
+ else
+ minute = num;
+ }
+ else if (lastPunct == ':' && hour >= 0 && (minute < 0 || second < 0))
+ {
+ if (minute < 0)
+ minute = num;
+ else
+ second = num;
+ }
+ else if ((num >= 70
+ && (punct == ' ' || punct == ','
+ || punct == '/' || punct < 0))
+ || (num < 70 && day >= 0 && month >= 0 && year < 0))
+ {
+ if (num >= 100)
+ year = num;
+ else
+ {
+ int curYear = 1900 + new Date().getYear();
+ int firstYear = curYear - 80;
+ year = firstYear / 100 * 100 + num;
+ if (year < firstYear)
+ year += 100;
+ }
+ }
+ else if (punct == '/')
+ {
+ if (month < 0)
+ month = num - 1;
+ else
+ day = num;
+ }
+ else if (hour >= 0 && minute < 0)
+ minute = num;
+ else if (minute >= 0 && second < 0)
+ second = num;
+ else if (day < 0)
+ day = num;
+ else
+ throw new IllegalArgumentException(tok);
+
+ // Advance string if there's more to process in this token.
+ if (punct < 0 || punctOffset + 1 >= tok.length())
+ tok = null;
+ else
+ tok = tok.substring(punctOffset + 1);
+ lastPunct = punct;
+ }
+ }
+ else if (firstch >= 'A' && firstch <= 'Z')
+ {
+ if (tok.equals("AM"))
+ {
+ if (hour < 1 || hour > 12)
+ throw new IllegalArgumentException(tok);
+ if (hour == 12)
+ hour = 0;
+ }
+ else if (tok.equals("PM"))
+ {
+ if (hour < 1 || hour > 12)
+ throw new IllegalArgumentException(tok);
+ if (hour < 12)
+ hour += 12;
+ }
+ else if (parseDayOfWeek(tok))
+ { /* Ignore it; throw the token away. */ }
+ else if (tok.equals("UT") || tok.equals("UTC") || tok.equals("GMT"))
+ localTimezone = false;
+ else if (tok.startsWith("UT") || tok.startsWith("GMT"))
+ {
+ int signOffset = 3;
+ if (tok.charAt(1) == 'T' && tok.charAt(2) != 'C')
+ signOffset = 2;
+
+ char sign = tok.charAt(signOffset);
+ if (sign != '+' && sign != '-')
+ throw new IllegalArgumentException(tok);
+
+ timezone = parseTz(tok.substring(signOffset), sign);
+ localTimezone = false;
+ }
+ else if ((tmpMonth = parseMonth(tok)) >= 0)
+ month = tmpMonth;
+ else if (tok.length() == 3 && tok.charAt(2) == 'T')
+ {
+ // Convert timezone offset from hours to minutes.
+ char ch = tok.charAt(0);
+ if (ch == 'E')
+ timezone = -5 * 60;
+ else if (ch == 'C')
+ timezone = -6 * 60;
+ else if (ch == 'M')
+ timezone = -7 * 60;
+ else if (ch == 'P')
+ timezone = -8 * 60;
+ else
+ throw new IllegalArgumentException(tok);
+
+ // Shift 60 minutes for Daylight Savings Time.
+ if (tok.charAt(1) == 'D')
+ timezone += 60;
+ else if (tok.charAt(1) != 'S')
+ throw new IllegalArgumentException(tok);
+
+ localTimezone = false;
+ }
+ else
+ throw new IllegalArgumentException(tok);
+ }
+ else
+ throw new IllegalArgumentException(tok);
}
// Unspecified hours, minutes, or seconds should default to 0.
@@ -925,8 +925,8 @@ public class Date
= new GregorianCalendar(year, month, day, hour, minute, second);
if (!localTimezone)
{
- cal.set(Calendar.ZONE_OFFSET, timezone * 60 * 1000);
- cal.set(Calendar.DST_OFFSET, 0);
+ cal.set(Calendar.ZONE_OFFSET, timezone * 60 * 1000);
+ cal.set(Calendar.DST_OFFSET, 0);
}
return cal.getTimeInMillis();
}
@@ -965,7 +965,7 @@ public class Date
* @param year the year minus 1900.
* @deprecated Use Calendar instead of Date, and use
* set(Calendar.YEAR, year) instead. Note about the 1900
- * difference in year.
+ * difference in year.
* @see #getYear()
* @see Calendar
*/
@@ -1008,13 +1008,13 @@ public class Date
* in the seconds value being reset to 0 and the minutes
* value being incremented by 1, if the new time does
* not include a leap second.
- *
+ *
* @param month the month, with a zero-based index
* from January.
* @deprecated Use Calendar instead of Date, and use
* set(Calendar.MONTH, month) instead.
* @see #getMonth()
- * @see Calendar
+ * @see Calendar
*/
public void setMonth(int month)
{
@@ -1059,7 +1059,7 @@ public class Date
*
* @param date the date.
* @deprecated Use Calendar instead of Date, and use
- * set(Calendar.DATE, date) instead.
+ * set(Calendar.DATE, date) instead.
* @see Calendar
* @see #getDate()
*/
@@ -1121,7 +1121,7 @@ public class Date
* @deprecated Use Calendar instead of Date, and use
* set(Calendar.HOUR_OF_DAY, hours) instead.
* @see Calendar
- * @see #getHours()
+ * @see #getHours()
*/
public void setHours(int hours)
{
@@ -1162,7 +1162,7 @@ public class Date
*
* @param minutes the minutes.
* @deprecated Use Calendar instead of Date, and use
- * set(Calendar.MINUTE, minutes) instead.
+ * set(Calendar.MINUTE, minutes) instead.
* @see Calendar
* @see #getMinutes()
*/
@@ -1207,7 +1207,7 @@ public class Date
* @deprecated Use Calendar instead of Date, and use
* set(Calendar.SECOND, seconds) instead.
* @see Calendar
- * @see #getSeconds()
+ * @see #getSeconds()
*/
public void setSeconds(int seconds)
{
diff --git a/java/util/Dictionary.java b/java/util/Dictionary.java
index 7b82a9f64..acd90eb04 100644
--- a/java/util/Dictionary.java
+++ b/java/util/Dictionary.java
@@ -1,4 +1,4 @@
-/* Dictionary.java -- an abstract (and essentially worthless)
+/* Dictionary.java -- an abstract (and essentially worthless)
class which is Hashtable's superclass
Copyright (C) 1998, 2001, 2002, 2004 Free Software Foundation, Inc.
@@ -42,12 +42,12 @@ package java.util;
/**
* A Dictionary maps keys to values; <i>how</i> it does that is
* implementation-specific.
- *
+ *
* This is an abstract class which has really gone by the wayside.
* People at Javasoft are probably embarrassed by it. At this point,
* it might as well be an interface rather than a class, but it remains
* this poor, laughable skeleton for the sake of backwards compatibility.
- * At any rate, this was what came before the {@link Map} interface
+ * At any rate, this was what came before the {@link Map} interface
* in the Collections framework.
*
* @author Jon Zeppieri
@@ -77,7 +77,7 @@ public abstract class Dictionary<K, V>
*/
public abstract Enumeration<V> elements();
- /**
+ /**
* Returns the value associated with the supplied key, or null
* if no such value exists. Since Dictionaries are not allowed null keys
* or elements, a null result always means the key is not present.
diff --git a/java/util/DuplicateFormatFlagsException.java b/java/util/DuplicateFormatFlagsException.java
index c180605cd..38c37669d 100644
--- a/java/util/DuplicateFormatFlagsException.java
+++ b/java/util/DuplicateFormatFlagsException.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the flags supplied to the {@link Formatter#format()}
* method of a {@link Formatter} contain duplicates.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class DuplicateFormatFlagsException
+public class DuplicateFormatFlagsException
extends IllegalFormatException
{
private static final long serialVersionUID = 18890531L;
@@ -72,7 +72,7 @@ public class DuplicateFormatFlagsException
super("Duplicate flag passed in " + flags);
if (flags == null)
throw new
- NullPointerException("Null flags value passed to constructor.");
+ NullPointerException("Null flags value passed to constructor.");
this.flags = flags;
}
diff --git a/java/util/EnumMap.java b/java/util/EnumMap.java
index f4286bd10..4c1997845 100644
--- a/java/util/EnumMap.java
+++ b/java/util/EnumMap.java
@@ -40,10 +40,10 @@ package java.util;
import java.io.Serializable;
-/**
+/**
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
public class EnumMap<K extends Enum<K>, V>
@@ -82,29 +82,29 @@ public class EnumMap<K extends Enum<K>, V>
{
if (map instanceof EnumMap)
{
- EnumMap<K, ? extends V> other = (EnumMap<K, ? extends V>) map;
- store = (V[]) other.store.clone();
- cardinality = other.cardinality;
- enumClass = other.enumClass;
+ EnumMap<K, ? extends V> other = (EnumMap<K, ? extends V>) map;
+ store = (V[]) other.store.clone();
+ cardinality = other.cardinality;
+ enumClass = other.enumClass;
}
else
{
- for (K key : map.keySet())
- {
- V value = map.get(key);
- if (store == null)
- {
- enumClass = key.getDeclaringClass();
- store = (V[]) new Object[enumClass.getEnumConstants().length];
- }
- int o = key.ordinal();
- if (store[o] == emptySlot)
- ++cardinality;
- store[o] = value;
- }
- // There must be a single element.
- if (store == null)
- throw new IllegalArgumentException("no elements in map");
+ for (K key : map.keySet())
+ {
+ V value = map.get(key);
+ if (store == null)
+ {
+ enumClass = key.getDeclaringClass();
+ store = (V[]) new Object[enumClass.getEnumConstants().length];
+ }
+ int o = key.ordinal();
+ if (store[o] == emptySlot)
+ ++cardinality;
+ store[o] = value;
+ }
+ // There must be a single element.
+ if (store == null)
+ throw new IllegalArgumentException("no elements in map");
}
}
@@ -117,8 +117,8 @@ public class EnumMap<K extends Enum<K>, V>
{
for (V i : store)
{
- if (i != emptySlot && AbstractCollection.equals(i , value))
- return true;
+ if (i != emptySlot && AbstractCollection.equals(i , value))
+ return true;
}
return false;
}
@@ -150,8 +150,8 @@ public class EnumMap<K extends Enum<K>, V>
V result;
if (store[o] == emptySlot)
{
- result = null;
- ++cardinality;
+ result = null;
+ ++cardinality;
}
else
result = store[o];
@@ -179,12 +179,12 @@ public class EnumMap<K extends Enum<K>, V>
{
for (K key : map.keySet())
{
- V value = map.get(key);
+ V value = map.get(key);
- int o = key.ordinal();
- if (store[o] == emptySlot)
- ++cardinality;
- store[o] = value;
+ int o = key.ordinal();
+ if (store[o] == emptySlot)
+ ++cardinality;
+ store[o] = value;
}
}
@@ -198,56 +198,56 @@ public class EnumMap<K extends Enum<K>, V>
{
if (keys == null)
{
- keys = new AbstractSet<K>()
- {
- public int size()
- {
- return cardinality;
- }
-
- public Iterator<K> iterator()
- {
- return new Iterator<K>()
- {
- int count = 0;
- int index = -1;
-
- public boolean hasNext()
- {
- return count < cardinality;
- }
-
- public K next()
- {
- ++count;
- for (++index; store[index] == emptySlot; ++index)
- ;
- return enumClass.getEnumConstants()[index];
- }
-
- public void remove()
- {
- --cardinality;
- store[index] = (V) emptySlot;
- }
- };
- }
-
- public void clear()
- {
- EnumMap.this.clear();
- }
-
- public boolean contains(Object o)
- {
- return contains(o);
- }
-
- public boolean remove(Object o)
- {
- return EnumMap.this.remove(o) != null;
- }
- };
+ keys = new AbstractSet<K>()
+ {
+ public int size()
+ {
+ return cardinality;
+ }
+
+ public Iterator<K> iterator()
+ {
+ return new Iterator<K>()
+ {
+ int count = 0;
+ int index = -1;
+
+ public boolean hasNext()
+ {
+ return count < cardinality;
+ }
+
+ public K next()
+ {
+ ++count;
+ for (++index; store[index] == emptySlot; ++index)
+ ;
+ return enumClass.getEnumConstants()[index];
+ }
+
+ public void remove()
+ {
+ --cardinality;
+ store[index] = (V) emptySlot;
+ }
+ };
+ }
+
+ public void clear()
+ {
+ EnumMap.this.clear();
+ }
+
+ public boolean contains(Object o)
+ {
+ return contains(o);
+ }
+
+ public boolean remove(Object o)
+ {
+ return EnumMap.this.remove(o) != null;
+ }
+ };
}
return keys;
}
@@ -256,46 +256,46 @@ public class EnumMap<K extends Enum<K>, V>
{
if (values == null)
{
- values = new AbstractCollection<V>()
- {
- public int size()
- {
- return cardinality;
- }
-
- public Iterator<V> iterator()
- {
- return new Iterator<V>()
- {
- int count = 0;
- int index = -1;
-
- public boolean hasNext()
- {
- return count < cardinality;
- }
-
- public V next()
- {
- ++count;
- for (++index; store[index] == emptySlot; ++index)
- ;
- return store[index];
- }
-
- public void remove()
- {
- --cardinality;
- store[index] = (V) emptySlot;
- }
- };
- }
-
- public void clear()
- {
- EnumMap.this.clear();
- }
- };
+ values = new AbstractCollection<V>()
+ {
+ public int size()
+ {
+ return cardinality;
+ }
+
+ public Iterator<V> iterator()
+ {
+ return new Iterator<V>()
+ {
+ int count = 0;
+ int index = -1;
+
+ public boolean hasNext()
+ {
+ return count < cardinality;
+ }
+
+ public V next()
+ {
+ ++count;
+ for (++index; store[index] == emptySlot; ++index)
+ ;
+ return store[index];
+ }
+
+ public void remove()
+ {
+ --cardinality;
+ store[index] = (V) emptySlot;
+ }
+ };
+ }
+
+ public void clear()
+ {
+ EnumMap.this.clear();
+ }
+ };
}
return values;
}
@@ -304,74 +304,74 @@ public class EnumMap<K extends Enum<K>, V>
{
if (entries == null)
{
- entries = new AbstractSet<Map.Entry<K, V>>()
- {
- public int size()
- {
- return cardinality;
- }
-
- public Iterator<Map.Entry<K, V>> iterator()
- {
- return new Iterator<Map.Entry<K, V>>()
- {
- int count = 0;
- int index = -1;
-
- public boolean hasNext()
- {
- return count < cardinality;
- }
-
- public Map.Entry<K,V> next()
- {
- ++count;
- for (++index; store[index] == emptySlot; ++index)
- ;
- // FIXME: we could just return something that
- // only knows the index. That would be cleaner.
- return new AbstractMap.SimpleEntry<K, V>(enumClass.getEnumConstants()[index],
- store[index])
- {
- public V setValue(V newVal)
- {
- value = newVal;
- return put(key, newVal);
- }
- };
- }
-
- public void remove()
- {
- --cardinality;
- store[index] = (V) emptySlot;
- }
- };
- }
-
- public void clear()
- {
- EnumMap.this.clear();
- }
-
- public boolean contains(Object o)
- {
- if (! (o instanceof Map.Entry))
- return false;
- Map.Entry<K, V> other = (Map.Entry<K, V>) o;
- return (containsKey(other.getKey())
- && AbstractCollection.equals(get(other.getKey()),
- other.getValue()));
- }
-
- public boolean remove(Object o)
- {
- if (! (o instanceof Map.Entry))
- return false;
- Map.Entry<K, V> other = (Map.Entry<K, V>) o;
- return EnumMap.this.remove(other.getKey()) != null;
- }
- };
+ entries = new AbstractSet<Map.Entry<K, V>>()
+ {
+ public int size()
+ {
+ return cardinality;
+ }
+
+ public Iterator<Map.Entry<K, V>> iterator()
+ {
+ return new Iterator<Map.Entry<K, V>>()
+ {
+ int count = 0;
+ int index = -1;
+
+ public boolean hasNext()
+ {
+ return count < cardinality;
+ }
+
+ public Map.Entry<K,V> next()
+ {
+ ++count;
+ for (++index; store[index] == emptySlot; ++index)
+ ;
+ // FIXME: we could just return something that
+ // only knows the index. That would be cleaner.
+ return new AbstractMap.SimpleEntry<K, V>(enumClass.getEnumConstants()[index],
+ store[index])
+ {
+ public V setValue(V newVal)
+ {
+ value = newVal;
+ return put(key, newVal);
+ }
+ };
+ }
+
+ public void remove()
+ {
+ --cardinality;
+ store[index] = (V) emptySlot;
+ }
+ };
+ }
+
+ public void clear()
+ {
+ EnumMap.this.clear();
+ }
+
+ public boolean contains(Object o)
+ {
+ if (! (o instanceof Map.Entry))
+ return false;
+ Map.Entry<K, V> other = (Map.Entry<K, V>) o;
+ return (containsKey(other.getKey())
+ && AbstractCollection.equals(get(other.getKey()),
+ other.getValue()));
+ }
+
+ public boolean remove(Object o)
+ {
+ if (! (o instanceof Map.Entry))
+ return false;
+ Map.Entry<K, V> other = (Map.Entry<K, V>) o;
+ return EnumMap.this.remove(other.getKey()) != null;
+ }
+ };
}
return entries;
}
@@ -391,12 +391,12 @@ public class EnumMap<K extends Enum<K>, V>
EnumMap<K, V> result;
try
{
- result = (EnumMap<K, V>) super.clone();
+ result = (EnumMap<K, V>) super.clone();
}
catch (CloneNotSupportedException ignore)
{
- // Can't happen.
- result = null;
+ // Can't happen.
+ result = null;
}
result.store = store.clone();
return result;
diff --git a/java/util/EnumSet.java b/java/util/EnumSet.java
index 31b03684a..60d010654 100644
--- a/java/util/EnumSet.java
+++ b/java/util/EnumSet.java
@@ -52,7 +52,7 @@ import java.io.Serializable;
* </p>
* <p>
* This class is designed to provide an alternative to using integer bit flags
- * by providing a typesafe {@link Collection} interface with an underlying
+ * by providing a typesafe {@link Collection} interface with an underlying
* implementation that utilises the assumptions above to give an equivalent level
* of efficiency. The values in a {@link EnumSet} must all be from the same
* {@link Enum} type, which allows the contents to be packed into a bit vector.
@@ -76,7 +76,7 @@ import java.io.Serializable;
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @author Dalibor Topic (robilad@kaffe.org)
- * @since 1.5
+ * @since 1.5
*/
// FIXME: serialization is special, uses SerializationProxy.
@@ -115,7 +115,7 @@ public abstract class EnumSet<T extends Enum<T>>
/**
* Returns a clone of the set.
- *
+ *
* @return a clone of the set.
*/
public EnumSet<T> clone()
@@ -124,12 +124,12 @@ public abstract class EnumSet<T extends Enum<T>>
try
{
- r = (EnumSet<T>) super.clone();
+ r = (EnumSet<T>) super.clone();
}
catch (CloneNotSupportedException _)
{
- /* Can't happen */
- return null;
+ /* Can't happen */
+ return null;
}
r.store = (BitSet) store.clone();
return r;
@@ -190,16 +190,16 @@ public abstract class EnumSet<T extends Enum<T>>
if (other instanceof EnumSet)
return copyOf((EnumSet<T>) other);
if (other.isEmpty())
- throw new IllegalArgumentException("Collection is empty");
+ throw new IllegalArgumentException("Collection is empty");
EnumSet<T> r = null;
for (T val : other)
{
- if (r == null)
- r = of(val);
- else
- r.add(val);
+ if (r == null)
+ r = of(val);
+ else
+ r.add(val);
}
return r;
@@ -225,7 +225,7 @@ public abstract class EnumSet<T extends Enum<T>>
/**
* Creates a new {@link EnumSet} populated with the given element.
- *
+ *
* @param first the element to use to populate the new set.
* @return an {@link EnumSet} containing the element.
* @throws NullPointerException if <code>first</code> is <code>null</code>.
@@ -236,149 +236,149 @@ public abstract class EnumSet<T extends Enum<T>>
{
public boolean add(T val)
{
- if (store.get(val.ordinal()))
- return false;
+ if (store.get(val.ordinal()))
+ return false;
- store.set(val.ordinal());
- ++cardinality;
- return true;
+ store.set(val.ordinal());
+ ++cardinality;
+ return true;
}
public boolean addAll(Collection<? extends T> c)
{
- boolean result = false;
- if (c instanceof EnumSet)
- {
- EnumSet<T> other = (EnumSet<T>) c;
- if (enumClass == other.enumClass)
- {
- store.or(other.store);
- int save = cardinality;
- cardinality = store.cardinality();
- result = save != cardinality;
- }
- }
- else
- {
- for (T val : c)
- {
- if (add (val))
- result = true;
- }
- }
- return result;
+ boolean result = false;
+ if (c instanceof EnumSet)
+ {
+ EnumSet<T> other = (EnumSet<T>) c;
+ if (enumClass == other.enumClass)
+ {
+ store.or(other.store);
+ int save = cardinality;
+ cardinality = store.cardinality();
+ result = save != cardinality;
+ }
+ }
+ else
+ {
+ for (T val : c)
+ {
+ if (add (val))
+ result = true;
+ }
+ }
+ return result;
}
public void clear()
{
- store.clear();
- cardinality = 0;
+ store.clear();
+ cardinality = 0;
}
public boolean contains(Object o)
{
- if (! (o instanceof Enum))
- return false;
+ if (! (o instanceof Enum))
+ return false;
- Enum<T> e = (Enum<T>) o;
- if (e.getDeclaringClass() != enumClass)
- return false;
+ Enum<T> e = (Enum<T>) o;
+ if (e.getDeclaringClass() != enumClass)
+ return false;
- return store.get(e.ordinal());
+ return store.get(e.ordinal());
}
public boolean containsAll(Collection<?> c)
{
- if (c instanceof EnumSet)
- {
- EnumSet<T> other = (EnumSet<T>) c;
- if (enumClass == other.enumClass)
- return store.containsAll(other.store);
-
- return false;
- }
- return super.containsAll(c);
+ if (c instanceof EnumSet)
+ {
+ EnumSet<T> other = (EnumSet<T>) c;
+ if (enumClass == other.enumClass)
+ return store.containsAll(other.store);
+
+ return false;
+ }
+ return super.containsAll(c);
}
public Iterator<T> iterator()
{
- return new Iterator<T>()
- {
- int next = -1;
- int count = 0;
-
- public boolean hasNext()
- {
- return count < cardinality;
- }
-
- public T next()
- {
- next = store.nextSetBit(next + 1);
- ++count;
- return enumClass.getEnumConstants()[next];
- }
-
- public void remove()
- {
- if (! store.get(next))
- {
- store.clear(next);
- --cardinality;
- }
- }
- };
+ return new Iterator<T>()
+ {
+ int next = -1;
+ int count = 0;
+
+ public boolean hasNext()
+ {
+ return count < cardinality;
+ }
+
+ public T next()
+ {
+ next = store.nextSetBit(next + 1);
+ ++count;
+ return enumClass.getEnumConstants()[next];
+ }
+
+ public void remove()
+ {
+ if (! store.get(next))
+ {
+ store.clear(next);
+ --cardinality;
+ }
+ }
+ };
}
public boolean remove(Object o)
{
- if (! (o instanceof Enum))
- return false;
+ if (! (o instanceof Enum))
+ return false;
- Enum<T> e = (Enum<T>) o;
- if (e.getDeclaringClass() != enumClass)
- return false;
+ Enum<T> e = (Enum<T>) o;
+ if (e.getDeclaringClass() != enumClass)
+ return false;
- store.clear(e.ordinal());
- --cardinality;
- return true;
+ store.clear(e.ordinal());
+ --cardinality;
+ return true;
}
public boolean removeAll(Collection<?> c)
{
- if (c instanceof EnumSet)
- {
- EnumSet<T> other = (EnumSet<T>) c;
- if (enumClass != other.enumClass)
- return false;
-
- store.andNot(other.store);
- int save = cardinality;
- cardinality = store.cardinality();
- return save != cardinality;
- }
- return super.removeAll(c);
+ if (c instanceof EnumSet)
+ {
+ EnumSet<T> other = (EnumSet<T>) c;
+ if (enumClass != other.enumClass)
+ return false;
+
+ store.andNot(other.store);
+ int save = cardinality;
+ cardinality = store.cardinality();
+ return save != cardinality;
+ }
+ return super.removeAll(c);
}
public boolean retainAll(Collection<?> c)
{
- if (c instanceof EnumSet)
- {
- EnumSet<T> other = (EnumSet<T>) c;
- if (enumClass != other.enumClass)
- return false;
-
- store.and(other.store);
- int save = cardinality;
- cardinality = store.cardinality();
- return save != cardinality;
- }
- return super.retainAll(c);
+ if (c instanceof EnumSet)
+ {
+ EnumSet<T> other = (EnumSet<T>) c;
+ if (enumClass != other.enumClass)
+ return false;
+
+ store.and(other.store);
+ int save = cardinality;
+ cardinality = store.cardinality();
+ return save != cardinality;
+ }
+ return super.retainAll(c);
}
public int size()
{
- return cardinality;
+ return cardinality;
}
};
@@ -392,7 +392,7 @@ public abstract class EnumSet<T extends Enum<T>>
/**
* Creates a new {@link EnumSet} populated with the given two elements.
- *
+ *
* @param first the first element to use to populate the new set.
* @param second the second element to use.
* @return an {@link EnumSet} containing the elements.
@@ -407,7 +407,7 @@ public abstract class EnumSet<T extends Enum<T>>
/**
* Creates a new {@link EnumSet} populated with the given three elements.
- *
+ *
* @param first the first element to use to populate the new set.
* @param second the second element to use.
* @param third the third element to use.
@@ -423,7 +423,7 @@ public abstract class EnumSet<T extends Enum<T>>
/**
* Creates a new {@link EnumSet} populated with the given four elements.
- *
+ *
* @param first the first element to use to populate the new set.
* @param second the second element to use.
* @param third the third element to use.
@@ -432,7 +432,7 @@ public abstract class EnumSet<T extends Enum<T>>
* @throws NullPointerException if any of the parameters are <code>null</code>.
*/
public static <T extends Enum<T>> EnumSet<T> of(T first, T second, T third,
- T fourth)
+ T fourth)
{
EnumSet<T> r = of(first, second, third);
r.add(fourth);
@@ -441,7 +441,7 @@ public abstract class EnumSet<T extends Enum<T>>
/**
* Creates a new {@link EnumSet} populated with the given five elements.
- *
+ *
* @param first the first element to use to populate the new set.
* @param second the second element to use.
* @param third the third element to use.
@@ -451,7 +451,7 @@ public abstract class EnumSet<T extends Enum<T>>
* @throws NullPointerException if any of the parameters are <code>null</code>.
*/
public static <T extends Enum<T>> EnumSet<T> of(T first, T second, T third,
- T fourth, T fifth)
+ T fourth, T fifth)
{
EnumSet<T> r = of(first, second, third, fourth);
r.add(fifth);
@@ -460,7 +460,7 @@ public abstract class EnumSet<T extends Enum<T>>
/**
* Creates a new {@link EnumSet} populated with the given elements.
- *
+ *
* @param first the first element to use to populate the new set.
* @param rest the other elements to use.
* @return an {@link EnumSet} containing the elements.
diff --git a/java/util/FormatFlagsConversionMismatchException.java b/java/util/FormatFlagsConversionMismatchException.java
index ec3177305..b28ded187 100644
--- a/java/util/FormatFlagsConversionMismatchException.java
+++ b/java/util/FormatFlagsConversionMismatchException.java
@@ -38,14 +38,14 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the flags supplied to the {@link Formatter#format()}
* method of a {@link Formatter} contains a flag that does not match
* the conversion character specified for it.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
public class FormatFlagsConversionMismatchException
extends IllegalFormatException
@@ -83,7 +83,7 @@ public class FormatFlagsConversionMismatchException
super("Invalid flag " + f + " for conversion " + c);
if (f == null)
throw new
- NullPointerException("Null flag value passed to constructor.");
+ NullPointerException("Null flag value passed to constructor.");
this.f = f;
this.c = c;
}
diff --git a/java/util/Formattable.java b/java/util/Formattable.java
index 27e26a701..6a83ed5d2 100644
--- a/java/util/Formattable.java
+++ b/java/util/Formattable.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.util;
-/**
+/**
* <p>
* The <code>Formattable</code> interface is used to provide customised
* formatting to arbitrary objects via the {@link Formatter}. The
@@ -54,7 +54,7 @@ package java.util;
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
public interface Formattable
{
@@ -88,5 +88,5 @@ public interface Formattable
* between it and the arguments.
*/
public void formatTo(Formatter formatter, int flags, int width,
- int precision);
+ int precision);
}
diff --git a/java/util/FormattableFlags.java b/java/util/FormattableFlags.java
index 648b3c038..2c5e199ba 100644
--- a/java/util/FormattableFlags.java
+++ b/java/util/FormattableFlags.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.util;
-/**
+/**
* This class contains a set of flags used
* by the {@link Formattable#formatTo()} method.
* They are used to modify the output of the
@@ -48,7 +48,7 @@ package java.util;
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
public class FormattableFlags
{
diff --git a/java/util/Formatter.java b/java/util/Formatter.java
index 9217d93b6..04ae8058d 100644
--- a/java/util/Formatter.java
+++ b/java/util/Formatter.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -56,7 +56,7 @@ import java.text.DecimalFormatSymbols;
import gnu.classpath.SystemProperties;
-/**
+/**
* <p>
* A Java formatter for <code>printf</code>-style format strings,
* as seen in the C programming language. This differs from the
@@ -79,12 +79,12 @@ import gnu.classpath.SystemProperties;
* <strong>Note</strong>: the formatter is not thread-safe. For
* multi-threaded access, external synchronization should be provided.
* </p>
- *
+ *
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public final class Formatter
+public final class Formatter
implements Closeable, Flushable
{
@@ -211,7 +211,7 @@ public final class Formatter
* @throws SecurityException if a security manager is present
* and doesn't allow writing to the file.
*/
- public Formatter(File file)
+ public Formatter(File file)
throws FileNotFoundException
{
this(new OutputStreamWriter(new FileOutputStream(file)));
@@ -257,7 +257,7 @@ public final class Formatter
throws FileNotFoundException, UnsupportedEncodingException
{
this(new OutputStreamWriter(new FileOutputStream(file), charset),
- loc);
+ loc);
}
/**
@@ -373,7 +373,7 @@ public final class Formatter
throws FileNotFoundException, UnsupportedEncodingException
{
this(new OutputStreamWriter(new FileOutputStream(file), charset),
- loc);
+ loc);
}
/**
@@ -390,13 +390,13 @@ public final class Formatter
return;
try
{
- if (out instanceof Closeable)
- ((Closeable) out).close();
+ if (out instanceof Closeable)
+ ((Closeable) out).close();
}
catch (IOException _)
{
- // FIXME: do we ignore these or do we set ioException?
- // The docs seem to indicate that we should ignore.
+ // FIXME: do we ignore these or do we set ioException?
+ // The docs seem to indicate that we should ignore.
}
closed = true;
}
@@ -414,13 +414,13 @@ public final class Formatter
throw new FormatterClosedException();
try
{
- if (out instanceof Flushable)
- ((Flushable) out).flush();
+ if (out instanceof Flushable)
+ ((Flushable) out).flush();
}
catch (IOException _)
{
- // FIXME: do we ignore these or do we set ioException?
- // The docs seem to indicate that we should ignore.
+ // FIXME: do we ignore these or do we set ioException?
+ // The docs seem to indicate that we should ignore.
}
}
@@ -450,7 +450,7 @@ public final class Formatter
flags &= ~allowed;
if (flags != 0)
throw new FormatFlagsConversionMismatchException(getName(flags),
- conversion);
+ conversion);
}
/**
@@ -473,7 +473,7 @@ public final class Formatter
* @param isNegative true if the value is negative.
*/
private void applyLocalization(CPStringBuilder builder, int flags, int width,
- boolean isNegative)
+ boolean isNegative)
{
DecimalFormatSymbols dfsyms;
if (fmtLocale == null)
@@ -486,52 +486,52 @@ public final class Formatter
int decimalOffset = -1;
for (int i = builder.length() - 1; i >= 0; --i)
{
- char c = builder.charAt(i);
- if (c >= '0' && c <= '9')
- builder.setCharAt(i, (char) (c - '0' + zeroDigit));
- else if (c == '.')
- {
- assert decimalOffset == -1;
- decimalOffset = i;
- }
+ char c = builder.charAt(i);
+ if (c >= '0' && c <= '9')
+ builder.setCharAt(i, (char) (c - '0' + zeroDigit));
+ else if (c == '.')
+ {
+ assert decimalOffset == -1;
+ decimalOffset = i;
+ }
}
// Localize the decimal separator.
if (decimalOffset != -1)
{
- builder.deleteCharAt(decimalOffset);
- builder.insert(decimalOffset, dfsyms.getDecimalSeparator());
+ builder.deleteCharAt(decimalOffset);
+ builder.insert(decimalOffset, dfsyms.getDecimalSeparator());
}
-
+
// Insert the grouping separators.
if ((flags & FormattableFlags.COMMA) != 0)
{
- char groupSeparator = dfsyms.getGroupingSeparator();
- int groupSize = 3; // FIXME
- int offset = (decimalOffset == -1) ? builder.length() : decimalOffset;
- // We use '>' because we don't want to insert a separator
- // before the first digit.
- for (int i = offset - groupSize; i > 0; i -= groupSize)
- builder.insert(i, groupSeparator);
+ char groupSeparator = dfsyms.getGroupingSeparator();
+ int groupSize = 3; // FIXME
+ int offset = (decimalOffset == -1) ? builder.length() : decimalOffset;
+ // We use '>' because we don't want to insert a separator
+ // before the first digit.
+ for (int i = offset - groupSize; i > 0; i -= groupSize)
+ builder.insert(i, groupSeparator);
}
if ((flags & FormattableFlags.ZERO) != 0)
{
- // Zero fill. Note that according to the algorithm we do not
- // insert grouping separators here.
- for (int i = width - builder.length(); i > 0; --i)
- builder.insert(0, zeroDigit);
+ // Zero fill. Note that according to the algorithm we do not
+ // insert grouping separators here.
+ for (int i = width - builder.length(); i > 0; --i)
+ builder.insert(0, zeroDigit);
}
if (isNegative)
{
- if ((flags & FormattableFlags.PAREN) != 0)
- {
- builder.insert(0, '(');
- builder.append(')');
- }
- else
- builder.insert(0, '-');
+ if ((flags & FormattableFlags.PAREN) != 0)
+ {
+ builder.insert(0, '(');
+ builder.append(')');
+ }
+ else
+ builder.insert(0, '-');
}
else if ((flags & FormattableFlags.PLUS) != 0)
builder.insert(0, '+');
@@ -554,10 +554,10 @@ public final class Formatter
{
if ((flags & FormattableFlags.UPPERCASE) != 0)
{
- if (fmtLocale == null)
- arg = arg.toUpperCase();
- else
- arg = arg.toUpperCase(fmtLocale);
+ if (fmtLocale == null)
+ arg = arg.toUpperCase();
+ else
+ arg = arg.toUpperCase(fmtLocale);
}
if (precision >= 0 && arg.length() > precision)
@@ -568,19 +568,19 @@ public final class Formatter
throw new MissingFormatWidthException("fixme");
if (! leftJustify && arg.length() < width)
{
- for (int i = width - arg.length(); i > 0; --i)
- out.append(' ');
+ for (int i = width - arg.length(); i > 0; --i)
+ out.append(' ');
}
out.append(arg);
if (leftJustify && arg.length() < width)
{
- for (int i = width - arg.length(); i > 0; --i)
- out.append(' ');
+ for (int i = width - arg.length(); i > 0; --i)
+ out.append(' ');
}
}
- /**
- * Emit a boolean.
+ /**
+ * Emit a boolean.
*
* @param arg the boolean to emit.
* @param flags the formatting flags to use.
@@ -590,12 +590,12 @@ public final class Formatter
* @throws IOException if the output stream throws an I/O error.
*/
private void booleanFormat(Object arg, int flags, int width, int precision,
- char conversion)
+ char conversion)
throws IOException
{
checkFlags(flags,
- FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
- conversion);
+ FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
+ conversion);
String result;
if (arg instanceof Boolean)
result = String.valueOf((Boolean) arg);
@@ -604,8 +604,8 @@ public final class Formatter
genericFormat(result, flags, width, precision);
}
- /**
- * Emit a hash code.
+ /**
+ * Emit a hash code.
*
* @param arg the hash code to emit.
* @param flags the formatting flags to use.
@@ -615,18 +615,18 @@ public final class Formatter
* @throws IOException if the output stream throws an I/O error.
*/
private void hashCodeFormat(Object arg, int flags, int width, int precision,
- char conversion)
+ char conversion)
throws IOException
{
checkFlags(flags,
- FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
- conversion);
+ FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
+ conversion);
genericFormat(arg == null ? "null" : Integer.toHexString(arg.hashCode()),
- flags, width, precision);
+ flags, width, precision);
}
- /**
- * Emit a String or Formattable conversion.
+ /**
+ * Emit a String or Formattable conversion.
*
* @param arg the String or Formattable to emit.
* @param flags the formatting flags to use.
@@ -636,31 +636,31 @@ public final class Formatter
* @throws IOException if the output stream throws an I/O error.
*/
private void stringFormat(Object arg, int flags, int width, int precision,
- char conversion)
+ char conversion)
throws IOException
{
if (arg instanceof Formattable)
{
- checkFlags(flags,
- (FormattableFlags.LEFT_JUSTIFY
- | FormattableFlags.UPPERCASE
- | FormattableFlags.ALTERNATE),
- conversion);
- Formattable fmt = (Formattable) arg;
- fmt.formatTo(this, flags, width, precision);
+ checkFlags(flags,
+ (FormattableFlags.LEFT_JUSTIFY
+ | FormattableFlags.UPPERCASE
+ | FormattableFlags.ALTERNATE),
+ conversion);
+ Formattable fmt = (Formattable) arg;
+ fmt.formatTo(this, flags, width, precision);
}
else
{
- checkFlags(flags,
- FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
- conversion);
- genericFormat(arg == null ? "null" : arg.toString(), flags, width,
- precision);
+ checkFlags(flags,
+ FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
+ conversion);
+ genericFormat(arg == null ? "null" : arg.toString(), flags, width,
+ precision);
}
}
- /**
- * Emit a character.
+ /**
+ * Emit a character.
*
* @param arg the character to emit.
* @param flags the formatting flags to use.
@@ -670,12 +670,12 @@ public final class Formatter
* @throws IOException if the output stream throws an I/O error.
*/
private void characterFormat(Object arg, int flags, int width, int precision,
- char conversion)
+ char conversion)
throws IOException
{
checkFlags(flags,
- FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
- conversion);
+ FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
+ conversion);
noPrecision(precision);
int theChar;
@@ -687,9 +687,9 @@ public final class Formatter
theChar = (char) (((Short) arg).shortValue ());
else if (arg instanceof Integer)
{
- theChar = ((Integer) arg).intValue();
- if (! Character.isValidCodePoint(theChar))
- throw new IllegalFormatCodePointException(theChar);
+ theChar = ((Integer) arg).intValue();
+ if (! Character.isValidCodePoint(theChar))
+ throw new IllegalFormatCodePointException(theChar);
}
else
throw new IllegalFormatConversionException(conversion, arg.getClass());
@@ -697,7 +697,7 @@ public final class Formatter
genericFormat(result, flags, width, precision);
}
- /**
+ /**
* Emit a '%'.
*
* @param flags the formatting flags to use.
@@ -713,7 +713,7 @@ public final class Formatter
genericFormat("%", flags, width, precision);
}
- /**
+ /**
* Emit a newline.
*
* @param flags the formatting flags to use.
@@ -744,15 +744,15 @@ public final class Formatter
* @return the result.
*/
private CPStringBuilder basicIntegralConversion(Object arg, int flags,
- int width, int precision,
- int radix, char conversion)
+ int width, int precision,
+ int radix, char conversion)
{
assert radix == 8 || radix == 10 || radix == 16;
noPrecision(precision);
// Some error checking.
if ((flags & FormattableFlags.PLUS) != 0
- && (flags & FormattableFlags.SPACE) != 0)
+ && (flags & FormattableFlags.SPACE) != 0)
throw new IllegalFormatFlagsException(getName(flags));
if ((flags & FormattableFlags.LEFT_JUSTIFY) != 0 && width == -1)
@@ -761,41 +761,41 @@ public final class Formatter
// Do the base translation of the value to a string.
String result;
int basicFlags = (FormattableFlags.LEFT_JUSTIFY
- // We already handled any possible error when
- // parsing.
- | FormattableFlags.UPPERCASE
- | FormattableFlags.ZERO);
+ // We already handled any possible error when
+ // parsing.
+ | FormattableFlags.UPPERCASE
+ | FormattableFlags.ZERO);
if (radix == 10)
basicFlags |= (FormattableFlags.PLUS
- | FormattableFlags.SPACE
- | FormattableFlags.COMMA
- | FormattableFlags.PAREN);
+ | FormattableFlags.SPACE
+ | FormattableFlags.COMMA
+ | FormattableFlags.PAREN);
else
basicFlags |= FormattableFlags.ALTERNATE;
if (arg instanceof BigInteger)
{
- checkFlags(flags,
- (basicFlags
- | FormattableFlags.PLUS
- | FormattableFlags.SPACE
- | FormattableFlags.PAREN),
- conversion);
- BigInteger bi = (BigInteger) arg;
- result = bi.toString(radix);
+ checkFlags(flags,
+ (basicFlags
+ | FormattableFlags.PLUS
+ | FormattableFlags.SPACE
+ | FormattableFlags.PAREN),
+ conversion);
+ BigInteger bi = (BigInteger) arg;
+ result = bi.toString(radix);
}
else if (arg instanceof Number
- && ! (arg instanceof Float)
- && ! (arg instanceof Double))
+ && ! (arg instanceof Float)
+ && ! (arg instanceof Double))
{
- checkFlags(flags, basicFlags, conversion);
- long value = ((Number) arg).longValue ();
- if (radix == 8)
- result = Long.toOctalString(value);
- else if (radix == 16)
- result = Long.toHexString(value);
- else
- result = Long.toString(value);
+ checkFlags(flags, basicFlags, conversion);
+ long value = ((Number) arg).longValue ();
+ if (radix == 8)
+ result = Long.toOctalString(value);
+ else if (radix == 16)
+ result = Long.toHexString(value);
+ else
+ result = Long.toString(value);
}
else
throw new IllegalFormatConversionException(conversion, arg.getClass());
@@ -803,9 +803,9 @@ public final class Formatter
return new CPStringBuilder(result);
}
- /**
- * Emit a hex or octal value.
- *
+ /**
+ * Emit a hex or octal value.
+ *
* @param arg the hexadecimal or octal value.
* @param flags the formatting flags to use.
* @param width the width to use.
@@ -815,79 +815,79 @@ public final class Formatter
* @throws IOException if the output stream throws an I/O error.
*/
private void hexOrOctalConversion(Object arg, int flags, int width,
- int precision, int radix,
- char conversion)
+ int precision, int radix,
+ char conversion)
throws IOException
{
assert radix == 8 || radix == 16;
CPStringBuilder builder = basicIntegralConversion(arg, flags, width,
- precision, radix,
- conversion);
+ precision, radix,
+ conversion);
int insertPoint = 0;
// Insert the sign.
if (builder.charAt(0) == '-')
{
- // Already inserted. Note that we don't insert a sign, since
- // the only case where it is needed it BigInteger, and it has
- // already been inserted by toString.
- ++insertPoint;
+ // Already inserted. Note that we don't insert a sign, since
+ // the only case where it is needed it BigInteger, and it has
+ // already been inserted by toString.
+ ++insertPoint;
}
else if ((flags & FormattableFlags.PLUS) != 0)
{
- builder.insert(insertPoint, '+');
- ++insertPoint;
+ builder.insert(insertPoint, '+');
+ ++insertPoint;
}
else if ((flags & FormattableFlags.SPACE) != 0)
{
- builder.insert(insertPoint, ' ');
- ++insertPoint;
+ builder.insert(insertPoint, ' ');
+ ++insertPoint;
}
// Insert the radix prefix.
if ((flags & FormattableFlags.ALTERNATE) != 0)
{
- builder.insert(insertPoint, radix == 8 ? "0" : "0x");
- insertPoint += radix == 8 ? 1 : 2;
+ builder.insert(insertPoint, radix == 8 ? "0" : "0x");
+ insertPoint += radix == 8 ? 1 : 2;
}
// Now justify the result.
int resultWidth = builder.length();
if (resultWidth < width)
{
- char fill = ((flags & FormattableFlags.ZERO) != 0) ? '0' : ' ';
- if ((flags & FormattableFlags.LEFT_JUSTIFY) != 0)
- {
- // Left justify.
- if (fill == ' ')
- insertPoint = builder.length();
- }
- else
- {
- // Right justify. Insert spaces before the radix prefix
- // and sign.
- insertPoint = 0;
- }
- while (resultWidth++ < width)
- builder.insert(insertPoint, fill);
+ char fill = ((flags & FormattableFlags.ZERO) != 0) ? '0' : ' ';
+ if ((flags & FormattableFlags.LEFT_JUSTIFY) != 0)
+ {
+ // Left justify.
+ if (fill == ' ')
+ insertPoint = builder.length();
+ }
+ else
+ {
+ // Right justify. Insert spaces before the radix prefix
+ // and sign.
+ insertPoint = 0;
+ }
+ while (resultWidth++ < width)
+ builder.insert(insertPoint, fill);
}
String result = builder.toString();
if ((flags & FormattableFlags.UPPERCASE) != 0)
{
- if (fmtLocale == null)
- result = result.toUpperCase();
- else
- result = result.toUpperCase(fmtLocale);
+ if (fmtLocale == null)
+ result = result.toUpperCase();
+ else
+ result = result.toUpperCase(fmtLocale);
}
out.append(result);
}
- /**
- * Emit a decimal value.
- *
+ /**
+ * Emit a decimal value.
+ *
* @param arg the hexadecimal or octal value.
* @param flags the formatting flags to use.
* @param width the width to use.
@@ -896,26 +896,26 @@ public final class Formatter
* @throws IOException if the output stream throws an I/O error.
*/
private void decimalConversion(Object arg, int flags, int width,
- int precision, char conversion)
+ int precision, char conversion)
throws IOException
{
CPStringBuilder builder = basicIntegralConversion(arg, flags, width,
- precision, 10,
- conversion);
+ precision, 10,
+ conversion);
boolean isNegative = false;
if (builder.charAt(0) == '-')
{
- // Sign handling is done during localization.
- builder.deleteCharAt(0);
- isNegative = true;
+ // Sign handling is done during localization.
+ builder.deleteCharAt(0);
+ isNegative = true;
}
applyLocalization(builder, flags, width, isNegative);
genericFormat(builder.toString(), flags, width, precision);
}
- /**
- * Emit a single date or time conversion to a StringBuilder.
+ /**
+ * Emit a single date or time conversion to a StringBuilder.
*
* @param builder the builder to write to.
* @param cal the calendar to use in the conversion.
@@ -923,185 +923,185 @@ public final class Formatter
* @param syms the date formatting symbols.
*/
private void singleDateTimeConversion(CPStringBuilder builder, Calendar cal,
- char conversion,
- DateFormatSymbols syms)
+ char conversion,
+ DateFormatSymbols syms)
{
int oldLen = builder.length();
int digits = -1;
switch (conversion)
{
case 'H':
- builder.append(cal.get(Calendar.HOUR_OF_DAY));
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.HOUR_OF_DAY));
+ digits = 2;
+ break;
case 'I':
- builder.append(cal.get(Calendar.HOUR));
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.HOUR));
+ digits = 2;
+ break;
case 'k':
- builder.append(cal.get(Calendar.HOUR_OF_DAY));
- break;
+ builder.append(cal.get(Calendar.HOUR_OF_DAY));
+ break;
case 'l':
- builder.append(cal.get(Calendar.HOUR));
- break;
+ builder.append(cal.get(Calendar.HOUR));
+ break;
case 'M':
- builder.append(cal.get(Calendar.MINUTE));
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.MINUTE));
+ digits = 2;
+ break;
case 'S':
- builder.append(cal.get(Calendar.SECOND));
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.SECOND));
+ digits = 2;
+ break;
case 'N':
- // FIXME: nanosecond ...
- digits = 9;
- break;
+ // FIXME: nanosecond ...
+ digits = 9;
+ break;
case 'p':
- {
- int ampm = cal.get(Calendar.AM_PM);
- builder.append(syms.getAmPmStrings()[ampm]);
- }
- break;
+ {
+ int ampm = cal.get(Calendar.AM_PM);
+ builder.append(syms.getAmPmStrings()[ampm]);
+ }
+ break;
case 'z':
- {
- int zone = cal.get(Calendar.ZONE_OFFSET) / (1000 * 60);
- builder.append(zone);
- digits = 4;
- // Skip the '-' sign.
- if (zone < 0)
- ++oldLen;
- }
- break;
+ {
+ int zone = cal.get(Calendar.ZONE_OFFSET) / (1000 * 60);
+ builder.append(zone);
+ digits = 4;
+ // Skip the '-' sign.
+ if (zone < 0)
+ ++oldLen;
+ }
+ break;
case 'Z':
- {
- // FIXME: DST?
- int zone = cal.get(Calendar.ZONE_OFFSET) / (1000 * 60 * 60);
- String[][] zs = syms.getZoneStrings();
- builder.append(zs[zone + 12][1]);
- }
- break;
+ {
+ // FIXME: DST?
+ int zone = cal.get(Calendar.ZONE_OFFSET) / (1000 * 60 * 60);
+ String[][] zs = syms.getZoneStrings();
+ builder.append(zs[zone + 12][1]);
+ }
+ break;
case 's':
- {
- long val = cal.getTime().getTime();
- builder.append(val / 1000);
- }
- break;
+ {
+ long val = cal.getTime().getTime();
+ builder.append(val / 1000);
+ }
+ break;
case 'Q':
- {
- long val = cal.getTime().getTime();
- builder.append(val);
- }
- break;
+ {
+ long val = cal.getTime().getTime();
+ builder.append(val);
+ }
+ break;
case 'B':
- {
- int month = cal.get(Calendar.MONTH);
- builder.append(syms.getMonths()[month]);
- }
- break;
+ {
+ int month = cal.get(Calendar.MONTH);
+ builder.append(syms.getMonths()[month]);
+ }
+ break;
case 'b':
case 'h':
- {
- int month = cal.get(Calendar.MONTH);
- builder.append(syms.getShortMonths()[month]);
- }
- break;
+ {
+ int month = cal.get(Calendar.MONTH);
+ builder.append(syms.getShortMonths()[month]);
+ }
+ break;
case 'A':
- {
- int day = cal.get(Calendar.DAY_OF_WEEK);
- builder.append(syms.getWeekdays()[day]);
- }
- break;
+ {
+ int day = cal.get(Calendar.DAY_OF_WEEK);
+ builder.append(syms.getWeekdays()[day]);
+ }
+ break;
case 'a':
- {
- int day = cal.get(Calendar.DAY_OF_WEEK);
- builder.append(syms.getShortWeekdays()[day]);
- }
- break;
+ {
+ int day = cal.get(Calendar.DAY_OF_WEEK);
+ builder.append(syms.getShortWeekdays()[day]);
+ }
+ break;
case 'C':
- builder.append(cal.get(Calendar.YEAR) / 100);
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.YEAR) / 100);
+ digits = 2;
+ break;
case 'Y':
- builder.append(cal.get(Calendar.YEAR));
- digits = 4;
- break;
+ builder.append(cal.get(Calendar.YEAR));
+ digits = 4;
+ break;
case 'y':
- builder.append(cal.get(Calendar.YEAR) % 100);
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.YEAR) % 100);
+ digits = 2;
+ break;
case 'j':
- builder.append(cal.get(Calendar.DAY_OF_YEAR));
- digits = 3;
- break;
+ builder.append(cal.get(Calendar.DAY_OF_YEAR));
+ digits = 3;
+ break;
case 'm':
- builder.append(cal.get(Calendar.MONTH) + 1);
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.MONTH) + 1);
+ digits = 2;
+ break;
case 'd':
- builder.append(cal.get(Calendar.DAY_OF_MONTH));
- digits = 2;
- break;
+ builder.append(cal.get(Calendar.DAY_OF_MONTH));
+ digits = 2;
+ break;
case 'e':
- builder.append(cal.get(Calendar.DAY_OF_MONTH));
- break;
+ builder.append(cal.get(Calendar.DAY_OF_MONTH));
+ break;
case 'R':
- singleDateTimeConversion(builder, cal, 'H', syms);
- builder.append(':');
- singleDateTimeConversion(builder, cal, 'M', syms);
- break;
+ singleDateTimeConversion(builder, cal, 'H', syms);
+ builder.append(':');
+ singleDateTimeConversion(builder, cal, 'M', syms);
+ break;
case 'T':
- singleDateTimeConversion(builder, cal, 'H', syms);
- builder.append(':');
- singleDateTimeConversion(builder, cal, 'M', syms);
- builder.append(':');
- singleDateTimeConversion(builder, cal, 'S', syms);
- break;
+ singleDateTimeConversion(builder, cal, 'H', syms);
+ builder.append(':');
+ singleDateTimeConversion(builder, cal, 'M', syms);
+ builder.append(':');
+ singleDateTimeConversion(builder, cal, 'S', syms);
+ break;
case 'r':
- singleDateTimeConversion(builder, cal, 'I', syms);
- builder.append(':');
- singleDateTimeConversion(builder, cal, 'M', syms);
- builder.append(':');
- singleDateTimeConversion(builder, cal, 'S', syms);
- builder.append(' ');
- singleDateTimeConversion(builder, cal, 'p', syms);
- break;
+ singleDateTimeConversion(builder, cal, 'I', syms);
+ builder.append(':');
+ singleDateTimeConversion(builder, cal, 'M', syms);
+ builder.append(':');
+ singleDateTimeConversion(builder, cal, 'S', syms);
+ builder.append(' ');
+ singleDateTimeConversion(builder, cal, 'p', syms);
+ break;
case 'D':
- singleDateTimeConversion(builder, cal, 'm', syms);
- builder.append('/');
- singleDateTimeConversion(builder, cal, 'd', syms);
- builder.append('/');
- singleDateTimeConversion(builder, cal, 'y', syms);
- break;
+ singleDateTimeConversion(builder, cal, 'm', syms);
+ builder.append('/');
+ singleDateTimeConversion(builder, cal, 'd', syms);
+ builder.append('/');
+ singleDateTimeConversion(builder, cal, 'y', syms);
+ break;
case 'F':
- singleDateTimeConversion(builder, cal, 'Y', syms);
- builder.append('-');
- singleDateTimeConversion(builder, cal, 'm', syms);
- builder.append('-');
- singleDateTimeConversion(builder, cal, 'd', syms);
- break;
+ singleDateTimeConversion(builder, cal, 'Y', syms);
+ builder.append('-');
+ singleDateTimeConversion(builder, cal, 'm', syms);
+ builder.append('-');
+ singleDateTimeConversion(builder, cal, 'd', syms);
+ break;
case 'c':
- singleDateTimeConversion(builder, cal, 'a', syms);
- builder.append(' ');
- singleDateTimeConversion(builder, cal, 'b', syms);
- builder.append(' ');
- singleDateTimeConversion(builder, cal, 'd', syms);
- builder.append(' ');
- singleDateTimeConversion(builder, cal, 'T', syms);
- builder.append(' ');
- singleDateTimeConversion(builder, cal, 'Z', syms);
- builder.append(' ');
- singleDateTimeConversion(builder, cal, 'Y', syms);
- break;
+ singleDateTimeConversion(builder, cal, 'a', syms);
+ builder.append(' ');
+ singleDateTimeConversion(builder, cal, 'b', syms);
+ builder.append(' ');
+ singleDateTimeConversion(builder, cal, 'd', syms);
+ builder.append(' ');
+ singleDateTimeConversion(builder, cal, 'T', syms);
+ builder.append(' ');
+ singleDateTimeConversion(builder, cal, 'Z', syms);
+ builder.append(' ');
+ singleDateTimeConversion(builder, cal, 'Y', syms);
+ break;
default:
- throw new UnknownFormatConversionException(String.valueOf(conversion));
+ throw new UnknownFormatConversionException(String.valueOf(conversion));
}
if (digits > 0)
{
- int newLen = builder.length();
- int delta = newLen - oldLen;
- while (delta++ < digits)
- builder.insert(oldLen, '0');
+ int newLen = builder.length();
+ int delta = newLen - oldLen;
+ while (delta++ < digits)
+ builder.insert(oldLen, '0');
}
}
@@ -1117,33 +1117,33 @@ public final class Formatter
* @throws IOException if the output stream throws an I/O error.
*/
private void dateTimeConversion(Object arg, int flags, int width,
- int precision, char conversion,
- char subConversion)
+ int precision, char conversion,
+ char subConversion)
throws IOException
{
noPrecision(precision);
checkFlags(flags,
- FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
- conversion);
+ FormattableFlags.LEFT_JUSTIFY | FormattableFlags.UPPERCASE,
+ conversion);
Calendar cal;
if (arg instanceof Calendar)
cal = (Calendar) arg;
else
{
- Date date;
- if (arg instanceof Date)
- date = (Date) arg;
- else if (arg instanceof Long)
- date = new Date(((Long) arg).longValue());
- else
- throw new IllegalFormatConversionException(conversion,
- arg.getClass());
- if (fmtLocale == null)
- cal = Calendar.getInstance();
- else
- cal = Calendar.getInstance(fmtLocale);
- cal.setTime(date);
+ Date date;
+ if (arg instanceof Date)
+ date = (Date) arg;
+ else if (arg instanceof Long)
+ date = new Date(((Long) arg).longValue());
+ else
+ throw new IllegalFormatConversionException(conversion,
+ arg.getClass());
+ if (fmtLocale == null)
+ cal = Calendar.getInstance();
+ else
+ cal = Calendar.getInstance(fmtLocale);
+ cal.setTime(date);
}
// We could try to be more efficient by computing this lazily.
@@ -1170,8 +1170,8 @@ public final class Formatter
++index;
if (index >= length)
{
- // FIXME: what exception here?
- throw new IllegalArgumentException();
+ // FIXME: what exception here?
+ throw new IllegalArgumentException();
}
}
@@ -1204,20 +1204,20 @@ public final class Formatter
int start = index;
if (format.charAt(index) == '<')
{
- result = 0;
- advance();
+ result = 0;
+ advance();
}
else if (Character.isDigit(format.charAt(index)))
{
- result = parseInt();
- if (format.charAt(index) == '$')
- advance();
- else
- {
- // Reset.
- index = start;
- result = -1;
- }
+ result = parseInt();
+ if (format.charAt(index) == '$')
+ advance();
+ else
+ {
+ // Reset.
+ index = start;
+ result = -1;
+ }
}
return result;
}
@@ -1235,15 +1235,15 @@ public final class Formatter
int start = index;
while (true)
{
- int x = FLAGS.indexOf(format.charAt(index));
- if (x == -1)
- break;
- int newValue = 1 << x;
- if ((value & newValue) != 0)
- throw new DuplicateFormatFlagsException(format.substring(start,
- index + 1));
- value |= newValue;
- advance();
+ int x = FLAGS.indexOf(format.charAt(index));
+ if (x == -1)
+ break;
+ int newValue = 1 << x;
+ if ((value & newValue) != 0)
+ throw new DuplicateFormatFlagsException(format.substring(start,
+ index + 1));
+ value |= newValue;
+ advance();
}
return value;
}
@@ -1293,7 +1293,7 @@ public final class Formatter
* specification or a mismatch
* between it and the arguments.
* @throws FormatterClosedException if the formatter is closed.
- */
+ */
public Formatter format(Locale loc, String fmt, Object... args)
{
if (closed)
@@ -1305,122 +1305,122 @@ public final class Formatter
try
{
- fmtLocale = loc;
- format = fmt;
- length = format.length();
- for (index = 0; index < length; ++index)
- {
- char c = format.charAt(index);
- if (c != '%')
- {
- out.append(c);
- continue;
- }
-
- int start = index;
- advance();
-
- // We do the needed post-processing of this later, when we
- // determine whether an argument is actually needed by
- // this conversion.
- int argumentIndex = parseArgumentIndex();
-
- int flags = parseFlags();
- int width = parseWidth();
- int precision = parsePrecision();
- char origConversion = format.charAt(index);
- char conversion = origConversion;
- if (Character.isUpperCase(conversion))
- {
- flags |= FormattableFlags.UPPERCASE;
- conversion = Character.toLowerCase(conversion);
- }
-
- Object argument = null;
- if (conversion == '%' || conversion == 'n')
- {
- if (argumentIndex != -1)
- {
- // FIXME: not sure about this.
- throw new UnknownFormatConversionException("FIXME");
- }
- }
- else
- {
- if (argumentIndex == -1)
- argumentIndex = implicitArgumentIndex++;
- else if (argumentIndex == 0)
- argumentIndex = previousArgumentIndex;
- // Argument indices start at 1 but array indices at 0.
- --argumentIndex;
- if (argumentIndex < 0 || argumentIndex >= args.length)
- throw new MissingFormatArgumentException(format.substring(start, index));
- argument = args[argumentIndex];
- }
-
- switch (conversion)
- {
- case 'b':
- booleanFormat(argument, flags, width, precision,
- origConversion);
- break;
- case 'h':
- hashCodeFormat(argument, flags, width, precision,
- origConversion);
- break;
- case 's':
- stringFormat(argument, flags, width, precision,
- origConversion);
- break;
- case 'c':
- characterFormat(argument, flags, width, precision,
- origConversion);
- break;
- case 'd':
- checkFlags(flags & FormattableFlags.UPPERCASE, 0, 'd');
- decimalConversion(argument, flags, width, precision,
- origConversion);
- break;
- case 'o':
- checkFlags(flags & FormattableFlags.UPPERCASE, 0, 'o');
- hexOrOctalConversion(argument, flags, width, precision, 8,
- origConversion);
- break;
- case 'x':
- hexOrOctalConversion(argument, flags, width, precision, 16,
- origConversion);
- case 'e':
- // scientificNotationConversion();
- break;
- case 'f':
- // floatingDecimalConversion();
- break;
- case 'g':
- // smartFloatingConversion();
- break;
- case 'a':
- // hexFloatingConversion();
- break;
- case 't':
- advance();
- char subConversion = format.charAt(index);
- dateTimeConversion(argument, flags, width, precision,
- origConversion, subConversion);
- break;
- case '%':
- percentFormat(flags, width, precision);
- break;
- case 'n':
- newLineFormat(flags, width, precision);
- break;
- default:
- throw new UnknownFormatConversionException(String.valueOf(origConversion));
- }
- }
+ fmtLocale = loc;
+ format = fmt;
+ length = format.length();
+ for (index = 0; index < length; ++index)
+ {
+ char c = format.charAt(index);
+ if (c != '%')
+ {
+ out.append(c);
+ continue;
+ }
+
+ int start = index;
+ advance();
+
+ // We do the needed post-processing of this later, when we
+ // determine whether an argument is actually needed by
+ // this conversion.
+ int argumentIndex = parseArgumentIndex();
+
+ int flags = parseFlags();
+ int width = parseWidth();
+ int precision = parsePrecision();
+ char origConversion = format.charAt(index);
+ char conversion = origConversion;
+ if (Character.isUpperCase(conversion))
+ {
+ flags |= FormattableFlags.UPPERCASE;
+ conversion = Character.toLowerCase(conversion);
+ }
+
+ Object argument = null;
+ if (conversion == '%' || conversion == 'n')
+ {
+ if (argumentIndex != -1)
+ {
+ // FIXME: not sure about this.
+ throw new UnknownFormatConversionException("FIXME");
+ }
+ }
+ else
+ {
+ if (argumentIndex == -1)
+ argumentIndex = implicitArgumentIndex++;
+ else if (argumentIndex == 0)
+ argumentIndex = previousArgumentIndex;
+ // Argument indices start at 1 but array indices at 0.
+ --argumentIndex;
+ if (argumentIndex < 0 || argumentIndex >= args.length)
+ throw new MissingFormatArgumentException(format.substring(start, index));
+ argument = args[argumentIndex];
+ }
+
+ switch (conversion)
+ {
+ case 'b':
+ booleanFormat(argument, flags, width, precision,
+ origConversion);
+ break;
+ case 'h':
+ hashCodeFormat(argument, flags, width, precision,
+ origConversion);
+ break;
+ case 's':
+ stringFormat(argument, flags, width, precision,
+ origConversion);
+ break;
+ case 'c':
+ characterFormat(argument, flags, width, precision,
+ origConversion);
+ break;
+ case 'd':
+ checkFlags(flags & FormattableFlags.UPPERCASE, 0, 'd');
+ decimalConversion(argument, flags, width, precision,
+ origConversion);
+ break;
+ case 'o':
+ checkFlags(flags & FormattableFlags.UPPERCASE, 0, 'o');
+ hexOrOctalConversion(argument, flags, width, precision, 8,
+ origConversion);
+ break;
+ case 'x':
+ hexOrOctalConversion(argument, flags, width, precision, 16,
+ origConversion);
+ case 'e':
+ // scientificNotationConversion();
+ break;
+ case 'f':
+ // floatingDecimalConversion();
+ break;
+ case 'g':
+ // smartFloatingConversion();
+ break;
+ case 'a':
+ // hexFloatingConversion();
+ break;
+ case 't':
+ advance();
+ char subConversion = format.charAt(index);
+ dateTimeConversion(argument, flags, width, precision,
+ origConversion, subConversion);
+ break;
+ case '%':
+ percentFormat(flags, width, precision);
+ break;
+ case 'n':
+ newLineFormat(flags, width, precision);
+ break;
+ default:
+ throw new UnknownFormatConversionException(String.valueOf(origConversion));
+ }
+ }
}
catch (IOException exc)
{
- ioException = exc;
+ ioException = exc;
}
return this;
}
diff --git a/java/util/FormatterClosedException.java b/java/util/FormatterClosedException.java
index c3588648e..620684938 100644
--- a/java/util/FormatterClosedException.java
+++ b/java/util/FormatterClosedException.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when a method is called on a {@link Formatter} but
* it has already been closed.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class FormatterClosedException
+public class FormatterClosedException
extends IllegalStateException
{
private static final long serialVersionUID = 18111216L;
diff --git a/java/util/GregorianCalendar.java b/java/util/GregorianCalendar.java
index 6eb7ce84e..b5d9e8c47 100644
--- a/java/util/GregorianCalendar.java
+++ b/java/util/GregorianCalendar.java
@@ -367,25 +367,25 @@ public class GregorianCalendar extends Calendar
if (month > 11)
{
- year += (month / 12);
- month = month % 12;
+ year += (month / 12);
+ month = month % 12;
}
if (month < 0)
{
- year += (int) month / 12;
- month = month % 12;
- if (month < 0)
- {
- month += 12;
- year--;
- }
+ year += (int) month / 12;
+ month = month % 12;
+ if (month < 0)
+ {
+ month += 12;
+ year--;
+ }
}
int dayOfYear = dayCount[month] + 1;
if (month > 1)
if (isLeapYear(year))
- dayOfYear++;
+ dayOfYear++;
boolean greg = isGregorian(year, dayOfYear);
int day = (int) getLinearDay(year, dayOfYear, greg);
@@ -431,29 +431,29 @@ public class GregorianCalendar extends Calendar
throw new IllegalArgumentException("Illegal MONTH.");
if (isSet[WEEK_OF_YEAR])
{
- int daysInYear = 365 + leap;
- daysInYear += (getFirstDayOfMonth(year, 0) - 1); // pad first week
- int last = getFirstDayOfMonth(year, 11) + 4;
- if (last > 7)
- last -= 7;
- daysInYear += 7 - last;
- int weeks = daysInYear / 7;
- if (fields[WEEK_OF_YEAR] < 1 || fields[WEEK_OF_YEAR] > weeks)
- throw new IllegalArgumentException("Illegal WEEK_OF_YEAR.");
+ int daysInYear = 365 + leap;
+ daysInYear += (getFirstDayOfMonth(year, 0) - 1); // pad first week
+ int last = getFirstDayOfMonth(year, 11) + 4;
+ if (last > 7)
+ last -= 7;
+ daysInYear += 7 - last;
+ int weeks = daysInYear / 7;
+ if (fields[WEEK_OF_YEAR] < 1 || fields[WEEK_OF_YEAR] > weeks)
+ throw new IllegalArgumentException("Illegal WEEK_OF_YEAR.");
}
if (isSet[WEEK_OF_MONTH])
{
- int weeks = (month == 1 && leap == 0) ? 5 : 6;
- if (fields[WEEK_OF_MONTH] < 1 || fields[WEEK_OF_MONTH] > weeks)
- throw new IllegalArgumentException("Illegal WEEK_OF_MONTH.");
+ int weeks = (month == 1 && leap == 0) ? 5 : 6;
+ if (fields[WEEK_OF_MONTH] < 1 || fields[WEEK_OF_MONTH] > weeks)
+ throw new IllegalArgumentException("Illegal WEEK_OF_MONTH.");
}
if (isSet[DAY_OF_MONTH])
if (fields[DAY_OF_MONTH] < 1
|| fields[DAY_OF_MONTH] > month_days[month]
+ ((month == 1) ? leap : 0))
- throw new IllegalArgumentException("Illegal DAY_OF_MONTH.");
+ throw new IllegalArgumentException("Illegal DAY_OF_MONTH.");
if (isSet[DAY_OF_YEAR]
&& (fields[DAY_OF_YEAR] < 1 || fields[DAY_OF_YEAR] > 365 + leap))
@@ -465,10 +465,10 @@ public class GregorianCalendar extends Calendar
if (isSet[DAY_OF_WEEK_IN_MONTH])
{
- int weeks = (month == 1 && leap == 0) ? 4 : 5;
- if (fields[DAY_OF_WEEK_IN_MONTH] < -weeks
- || fields[DAY_OF_WEEK_IN_MONTH] > weeks)
- throw new IllegalArgumentException("Illegal DAY_OF_WEEK_IN_MONTH.");
+ int weeks = (month == 1 && leap == 0) ? 4 : 5;
+ if (fields[DAY_OF_WEEK_IN_MONTH] < -weeks
+ || fields[DAY_OF_WEEK_IN_MONTH] > weeks)
+ throw new IllegalArgumentException("Illegal DAY_OF_WEEK_IN_MONTH.");
}
if (isSet[AM_PM] && fields[AM_PM] != AM && fields[AM_PM] != PM)
@@ -522,78 +522,78 @@ public class GregorianCalendar extends Calendar
if (! isSet[MONTH] && (! isSet[DAY_OF_WEEK] || isSet[WEEK_OF_YEAR]))
{
- // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR
- if (isSet[WEEK_OF_YEAR])
- {
- int first = getFirstDayOfMonth(year, 0);
- int offs = 1;
- int daysInFirstWeek = getFirstDayOfWeek() - first;
- if (daysInFirstWeek <= 0)
- daysInFirstWeek += 7;
-
- if (daysInFirstWeek < getMinimalDaysInFirstWeek())
- offs += daysInFirstWeek;
- else
- offs -= 7 - daysInFirstWeek;
- month = 0;
- day = offs + 7 * (fields[WEEK_OF_YEAR] - 1);
- offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek();
-
- if (offs < 0)
- offs += 7;
- day += offs;
- }
- else
- {
- // 4: YEAR + DAY_OF_YEAR
- month = 0;
- day = fields[DAY_OF_YEAR];
- }
+ // 5: YEAR + DAY_OF_WEEK + WEEK_OF_YEAR
+ if (isSet[WEEK_OF_YEAR])
+ {
+ int first = getFirstDayOfMonth(year, 0);
+ int offs = 1;
+ int daysInFirstWeek = getFirstDayOfWeek() - first;
+ if (daysInFirstWeek <= 0)
+ daysInFirstWeek += 7;
+
+ if (daysInFirstWeek < getMinimalDaysInFirstWeek())
+ offs += daysInFirstWeek;
+ else
+ offs -= 7 - daysInFirstWeek;
+ month = 0;
+ day = offs + 7 * (fields[WEEK_OF_YEAR] - 1);
+ offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek();
+
+ if (offs < 0)
+ offs += 7;
+ day += offs;
+ }
+ else
+ {
+ // 4: YEAR + DAY_OF_YEAR
+ month = 0;
+ day = fields[DAY_OF_YEAR];
+ }
}
else
{
- if (isSet[DAY_OF_WEEK])
- {
- int first = getFirstDayOfMonth(year, month);
-
- // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
- if (isSet[DAY_OF_WEEK_IN_MONTH])
- {
- if (fields[DAY_OF_WEEK_IN_MONTH] < 0)
- {
- month++;
- first = getFirstDayOfMonth(year, month);
- day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH]);
- }
- else
- day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1);
-
- int offs = fields[DAY_OF_WEEK] - first;
- if (offs < 0)
- offs += 7;
- day += offs;
- }
- else
- { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
- int offs = 1;
- int daysInFirstWeek = getFirstDayOfWeek() - first;
- if (daysInFirstWeek <= 0)
- daysInFirstWeek += 7;
-
- if (daysInFirstWeek < getMinimalDaysInFirstWeek())
- offs += daysInFirstWeek;
- else
- offs -= 7 - daysInFirstWeek;
-
- day = offs + 7 * (fields[WEEK_OF_MONTH] - 1);
- offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek();
- if (offs < 0)
- offs += 7;
- day += offs;
- }
- }
-
- // 1: YEAR + MONTH + DAY_OF_MONTH
+ if (isSet[DAY_OF_WEEK])
+ {
+ int first = getFirstDayOfMonth(year, month);
+
+ // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
+ if (isSet[DAY_OF_WEEK_IN_MONTH])
+ {
+ if (fields[DAY_OF_WEEK_IN_MONTH] < 0)
+ {
+ month++;
+ first = getFirstDayOfMonth(year, month);
+ day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH]);
+ }
+ else
+ day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1);
+
+ int offs = fields[DAY_OF_WEEK] - first;
+ if (offs < 0)
+ offs += 7;
+ day += offs;
+ }
+ else
+ { // 2: YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
+ int offs = 1;
+ int daysInFirstWeek = getFirstDayOfWeek() - first;
+ if (daysInFirstWeek <= 0)
+ daysInFirstWeek += 7;
+
+ if (daysInFirstWeek < getMinimalDaysInFirstWeek())
+ offs += daysInFirstWeek;
+ else
+ offs -= 7 - daysInFirstWeek;
+
+ day = offs + 7 * (fields[WEEK_OF_MONTH] - 1);
+ offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek();
+ if (offs < 0)
+ offs += 7;
+ day += offs;
+ }
+ }
+
+ // 1: YEAR + MONTH + DAY_OF_MONTH
}
if (era == BC && year > 0)
year = 1 - year;
@@ -603,9 +603,9 @@ public class GregorianCalendar extends Calendar
// get the hour (but no check for validity)
if (isSet[HOUR])
{
- hour = fields[HOUR];
- if (fields[AM_PM] == PM)
- hour += 12;
+ hour = fields[HOUR];
+ if (fields[AM_PM] == PM)
+ hour += 12;
}
else
hour = fields[HOUR_OF_DAY];
@@ -619,41 +619,41 @@ public class GregorianCalendar extends Calendar
if (month < 0)
{
- year += (int) month / 12;
- month = month % 12;
- if (month < 0)
- {
- month += 12;
- year--;
- }
+ year += (int) month / 12;
+ month = month % 12;
+ if (month < 0)
+ {
+ month += 12;
+ year--;
+ }
}
if (month > 11)
{
- year += (month / 12);
- month = month % 12;
+ year += (month / 12);
+ month = month % 12;
}
month_days[1] = isLeapYear(year) ? 29 : 28;
while (day <= 0)
{
- if (month == 0)
- {
- year--;
- month_days[1] = isLeapYear(year) ? 29 : 28;
- }
- month = (month + 11) % 12;
- day += month_days[month];
+ if (month == 0)
+ {
+ year--;
+ month_days[1] = isLeapYear(year) ? 29 : 28;
+ }
+ month = (month + 11) % 12;
+ day += month_days[month];
}
while (day > month_days[month])
{
- day -= (month_days[month]);
- month = (month + 1) % 12;
- if (month == 0)
- {
- year++;
- month_days[1] = isLeapYear(year) ? 29 : 28;
- }
+ day -= (month_days[month]);
+ month = (month + 1) % 12;
+ if (month == 0)
+ {
+ year++;
+ month_days[1] = isLeapYear(year) ? 29 : 28;
+ }
}
// ok, by here we have valid day,month,year,era and millisinday
@@ -719,19 +719,19 @@ public class GregorianCalendar extends Calendar
if (gregorian)
{
- // subtract the days that are missing in gregorian calendar
- // with respect to julian calendar.
- //
- // Okay, here we rely on the fact that the gregorian
- // calendar was introduced in the AD era. This doesn't work
- // with negative years.
- //
- // The additional leap year factor accounts for the fact that
- // a leap day is not seen on Jan 1 of the leap year.
- int gregOffset = (int) Math.floor((double) (year - 1) / 400.)
- - (int) Math.floor((double) (year - 1) / 100.);
-
- return julianDay + gregOffset;
+ // subtract the days that are missing in gregorian calendar
+ // with respect to julian calendar.
+ //
+ // Okay, here we rely on the fact that the gregorian
+ // calendar was introduced in the AD era. This doesn't work
+ // with negative years.
+ //
+ // The additional leap year factor accounts for the fact that
+ // a leap day is not seen on Jan 1 of the leap year.
+ int gregOffset = (int) Math.floor((double) (year - 1) / 400.)
+ - (int) Math.floor((double) (year - 1) / 100.);
+
+ return julianDay + gregOffset;
}
else
julianDay -= 2;
@@ -754,7 +754,7 @@ public class GregorianCalendar extends Calendar
weekday += 7;
fields[DAY_OF_WEEK] = weekday;
- // get a first approximation of the year. This may be one
+ // get a first approximation of the year. This may be one
// year too big.
int year = 1970
+ (int) (gregorian
@@ -768,8 +768,8 @@ public class GregorianCalendar extends Calendar
// Now look in which year day really lies.
if (day < firstDayOfYear)
{
- year--;
- firstDayOfYear = getLinearDay(year, 1, gregorian);
+ year--;
+ firstDayOfYear = getLinearDay(year, 1, gregorian);
}
day -= firstDayOfYear - 1; // day of year, one based.
@@ -777,27 +777,27 @@ public class GregorianCalendar extends Calendar
fields[DAY_OF_YEAR] = (int) day;
if (year <= 0)
{
- fields[ERA] = BC;
- fields[YEAR] = 1 - year;
+ fields[ERA] = BC;
+ fields[YEAR] = 1 - year;
}
else
{
- fields[ERA] = AD;
- fields[YEAR] = year;
+ fields[ERA] = AD;
+ fields[YEAR] = year;
}
int leapday = isLeapYear(year) ? 1 : 0;
if (day <= 31 + 28 + leapday)
{
- fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY
- fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH];
+ fields[MONTH] = (int) day / 32; // 31->JANUARY, 32->FEBRUARY
+ fields[DAY_OF_MONTH] = (int) day - 31 * fields[MONTH];
}
else
{
- // A few more magic formulas
- int scaledDay = ((int) day - leapday) * 5 + 8;
- fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31);
- fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1;
+ // A few more magic formulas
+ int scaledDay = ((int) day - leapday) * 5 + 8;
+ fields[MONTH] = scaledDay / (31 + 30 + 31 + 30 + 31);
+ fields[DAY_OF_MONTH] = (scaledDay % (31 + 30 + 31 + 30 + 31)) / 5 + 1;
}
}
@@ -819,8 +819,8 @@ public class GregorianCalendar extends Calendar
if (millisInDay < 0)
{
- millisInDay += (24 * 60 * 60 * 1000);
- day--;
+ millisInDay += (24 * 60 * 60 * 1000);
+ day--;
}
calculateDay(fields, day, gregorian);
@@ -832,8 +832,8 @@ public class GregorianCalendar extends Calendar
millisInDay += fields[DST_OFFSET];
if (millisInDay >= 24 * 60 * 60 * 1000)
{
- millisInDay -= 24 * 60 * 60 * 1000;
- calculateDay(fields, ++day, gregorian);
+ millisInDay -= 24 * 60 * 60 * 1000;
+ calculateDay(fields, ++day, gregorian);
}
fields[DAY_OF_WEEK_IN_MONTH] = (fields[DAY_OF_MONTH] + 6) / 7;
@@ -845,7 +845,7 @@ public class GregorianCalendar extends Calendar
// nb 35 is the smallest multiple of 7 that ensures that
// the left hand side of the modulo operator is positive.
int relativeWeekdayOfFirst = (relativeWeekday - fields[DAY_OF_MONTH]
- + 1 + 35) % 7;
+ + 1 + 35) % 7;
// which week of the month is the first of this month in?
int minDays = getMinimalDaysInFirstWeek();
@@ -853,11 +853,11 @@ public class GregorianCalendar extends Calendar
// which week of the month is this day in?
fields[WEEK_OF_MONTH] = (fields[DAY_OF_MONTH]
- + relativeWeekdayOfFirst - 1) / 7 + weekOfFirst;
+ + relativeWeekdayOfFirst - 1) / 7 + weekOfFirst;
int weekOfYear = (fields[DAY_OF_YEAR] - relativeWeekday + 6) / 7;
- // Do the Correction: getMinimalDaysInFirstWeek() is always in the
+ // Do the Correction: getMinimalDaysInFirstWeek() is always in the
// first week.
int firstWeekday = (7 + getWeekDay(fields[YEAR], minDays)
- getFirstDayOfWeek()) % 7;
@@ -878,7 +878,7 @@ public class GregorianCalendar extends Calendar
areFieldsSet = isSet[ERA] = isSet[YEAR] = isSet[MONTH] = isSet[WEEK_OF_YEAR] = isSet[WEEK_OF_MONTH] = isSet[DAY_OF_MONTH] = isSet[DAY_OF_YEAR] = isSet[DAY_OF_WEEK] = isSet[DAY_OF_WEEK_IN_MONTH] = isSet[AM_PM] = isSet[HOUR] = isSet[HOUR_OF_DAY] = isSet[MINUTE] = isSet[SECOND] = isSet[MILLISECOND] = isSet[ZONE_OFFSET] = isSet[DST_OFFSET] = true;
}
-
+
/**
* Return a hash code for this object, following the general contract
* specified by {@link Object#hashCode()}.
@@ -931,76 +931,76 @@ public class GregorianCalendar extends Calendar
switch (field)
{
case YEAR:
- complete();
- fields[YEAR] += amount;
- isTimeSet = false;
- break;
+ complete();
+ fields[YEAR] += amount;
+ isTimeSet = false;
+ break;
case MONTH:
- complete();
- int months = fields[MONTH] + amount;
- fields[YEAR] += months / 12;
- fields[MONTH] = months % 12;
- if (fields[MONTH] < 0)
- {
- fields[MONTH] += 12;
- fields[YEAR]--;
- }
- int maxDay = getActualMaximum(DAY_OF_MONTH);
- if (fields[DAY_OF_MONTH] > maxDay)
- fields[DAY_OF_MONTH] = maxDay;
- set(YEAR, fields[YEAR]);
- set(MONTH, fields[MONTH]);
- break;
+ complete();
+ int months = fields[MONTH] + amount;
+ fields[YEAR] += months / 12;
+ fields[MONTH] = months % 12;
+ if (fields[MONTH] < 0)
+ {
+ fields[MONTH] += 12;
+ fields[YEAR]--;
+ }
+ int maxDay = getActualMaximum(DAY_OF_MONTH);
+ if (fields[DAY_OF_MONTH] > maxDay)
+ fields[DAY_OF_MONTH] = maxDay;
+ set(YEAR, fields[YEAR]);
+ set(MONTH, fields[MONTH]);
+ break;
case DAY_OF_MONTH:
case DAY_OF_YEAR:
case DAY_OF_WEEK:
- if (! isTimeSet)
- computeTime();
- time += amount * (24 * 60 * 60 * 1000L);
- areFieldsSet = false;
- break;
+ if (! isTimeSet)
+ computeTime();
+ time += amount * (24 * 60 * 60 * 1000L);
+ areFieldsSet = false;
+ break;
case WEEK_OF_YEAR:
case WEEK_OF_MONTH:
case DAY_OF_WEEK_IN_MONTH:
- if (! isTimeSet)
- computeTime();
- time += amount * (7 * 24 * 60 * 60 * 1000L);
- areFieldsSet = false;
- break;
+ if (! isTimeSet)
+ computeTime();
+ time += amount * (7 * 24 * 60 * 60 * 1000L);
+ areFieldsSet = false;
+ break;
case AM_PM:
- if (! isTimeSet)
- computeTime();
- time += amount * (12 * 60 * 60 * 1000L);
- areFieldsSet = false;
- break;
+ if (! isTimeSet)
+ computeTime();
+ time += amount * (12 * 60 * 60 * 1000L);
+ areFieldsSet = false;
+ break;
case HOUR:
case HOUR_OF_DAY:
- if (! isTimeSet)
- computeTime();
- time += amount * (60 * 60 * 1000L);
- areFieldsSet = false;
- break;
+ if (! isTimeSet)
+ computeTime();
+ time += amount * (60 * 60 * 1000L);
+ areFieldsSet = false;
+ break;
case MINUTE:
- if (! isTimeSet)
- computeTime();
- time += amount * (60 * 1000L);
- areFieldsSet = false;
- break;
+ if (! isTimeSet)
+ computeTime();
+ time += amount * (60 * 1000L);
+ areFieldsSet = false;
+ break;
case SECOND:
- if (! isTimeSet)
- computeTime();
- time += amount * (1000L);
- areFieldsSet = false;
- break;
+ if (! isTimeSet)
+ computeTime();
+ time += amount * (1000L);
+ areFieldsSet = false;
+ break;
case MILLISECOND:
- if (! isTimeSet)
- computeTime();
- time += amount;
- areFieldsSet = false;
- break;
+ if (! isTimeSet)
+ computeTime();
+ time += amount;
+ areFieldsSet = false;
+ break;
case ZONE_OFFSET:
case DST_OFFSET:default:
- throw new IllegalArgumentException("Invalid or unknown field");
+ throw new IllegalArgumentException("Invalid or unknown field");
}
}
@@ -1044,77 +1044,77 @@ public class GregorianCalendar extends Calendar
case ERA:
case YEAR:
case MONTH:
- // check that day of month is still in correct range
- if (fields[DAY_OF_MONTH] > getActualMaximum(DAY_OF_MONTH))
- fields[DAY_OF_MONTH] = getActualMaximum(DAY_OF_MONTH);
- isTimeSet = false;
- isSet[WEEK_OF_MONTH] = false;
- isSet[DAY_OF_WEEK] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- isSet[WEEK_OF_YEAR] = false;
- break;
+ // check that day of month is still in correct range
+ if (fields[DAY_OF_MONTH] > getActualMaximum(DAY_OF_MONTH))
+ fields[DAY_OF_MONTH] = getActualMaximum(DAY_OF_MONTH);
+ isTimeSet = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ break;
case DAY_OF_MONTH:
- isSet[WEEK_OF_MONTH] = false;
- isSet[DAY_OF_WEEK] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- isSet[WEEK_OF_YEAR] = false;
- time += delta * (24 * 60 * 60 * 1000L);
- break;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ time += delta * (24 * 60 * 60 * 1000L);
+ break;
case WEEK_OF_MONTH:
- isSet[DAY_OF_MONTH] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- isSet[WEEK_OF_YEAR] = false;
- time += delta * (7 * 24 * 60 * 60 * 1000L);
- break;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ time += delta * (7 * 24 * 60 * 60 * 1000L);
+ break;
case DAY_OF_WEEK_IN_MONTH:
- isSet[DAY_OF_MONTH] = false;
- isSet[WEEK_OF_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- isSet[WEEK_OF_YEAR] = false;
- time += delta * (7 * 24 * 60 * 60 * 1000L);
- break;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ time += delta * (7 * 24 * 60 * 60 * 1000L);
+ break;
case DAY_OF_YEAR:
- isSet[MONTH] = false;
- isSet[DAY_OF_MONTH] = false;
- isSet[WEEK_OF_MONTH] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- isSet[DAY_OF_WEEK] = false;
- isSet[WEEK_OF_YEAR] = false;
- time += delta * (24 * 60 * 60 * 1000L);
- break;
+ isSet[MONTH] = false;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_WEEK] = false;
+ isSet[WEEK_OF_YEAR] = false;
+ time += delta * (24 * 60 * 60 * 1000L);
+ break;
case WEEK_OF_YEAR:
- isSet[MONTH] = false;
- isSet[DAY_OF_MONTH] = false;
- isSet[WEEK_OF_MONTH] = false;
- isSet[DAY_OF_WEEK_IN_MONTH] = false;
- isSet[DAY_OF_YEAR] = false;
- time += delta * (7 * 24 * 60 * 60 * 1000L);
- break;
+ isSet[MONTH] = false;
+ isSet[DAY_OF_MONTH] = false;
+ isSet[WEEK_OF_MONTH] = false;
+ isSet[DAY_OF_WEEK_IN_MONTH] = false;
+ isSet[DAY_OF_YEAR] = false;
+ time += delta * (7 * 24 * 60 * 60 * 1000L);
+ break;
case AM_PM:
- isSet[HOUR_OF_DAY] = false;
- time += delta * (12 * 60 * 60 * 1000L);
- break;
+ isSet[HOUR_OF_DAY] = false;
+ time += delta * (12 * 60 * 60 * 1000L);
+ break;
case HOUR:
- isSet[HOUR_OF_DAY] = false;
- time += delta * (60 * 60 * 1000L);
- break;
+ isSet[HOUR_OF_DAY] = false;
+ time += delta * (60 * 60 * 1000L);
+ break;
case HOUR_OF_DAY:
- isSet[HOUR] = false;
- isSet[AM_PM] = false;
- time += delta * (60 * 60 * 1000L);
- break;
+ isSet[HOUR] = false;
+ isSet[AM_PM] = false;
+ time += delta * (60 * 60 * 1000L);
+ break;
case MINUTE:
- time += delta * (60 * 1000L);
- break;
+ time += delta * (60 * 1000L);
+ break;
case SECOND:
- time += delta * (1000L);
- break;
+ time += delta * (1000L);
+ break;
case MILLISECOND:
- time += delta;
- break;
+ time += delta;
+ break;
}
}
@@ -1141,12 +1141,12 @@ public class GregorianCalendar extends Calendar
switch (field)
{
case DAY_OF_WEEK:
- // day of week is special: it rolls automatically
- add(field, amount);
- return;
+ // day of week is special: it rolls automatically
+ add(field, amount);
+ return;
case ZONE_OFFSET:
case DST_OFFSET:
- throw new IllegalArgumentException("Can't roll time zone");
+ throw new IllegalArgumentException("Can't roll time zone");
}
complete();
int min = getActualMinimum(field);
@@ -1162,7 +1162,7 @@ public class GregorianCalendar extends Calendar
/**
* The minimum values for the calendar fields.
*/
- private static final int[] minimums =
+ private static final int[] minimums =
{
BC, 1, 0, 0, 1, 1, 1, SUNDAY, 1, AM,
1, 0, 0, 0, 0, -(12 * 60 * 60 * 1000),
@@ -1172,7 +1172,7 @@ public class GregorianCalendar extends Calendar
/**
* The maximum values for the calendar fields.
*/
- private static final int[] maximums =
+ private static final int[] maximums =
{
AD, 5000000, 11, 53, 6, 31, 366,
SATURDAY, 5, PM, 12, 23, 59, 59, 999,
@@ -1235,16 +1235,16 @@ public class GregorianCalendar extends Calendar
switch (field)
{
case WEEK_OF_YEAR:
- return 52;
+ return 52;
case DAY_OF_MONTH:
- return 28;
+ return 28;
case DAY_OF_YEAR:
- return 365;
+ return 365;
case DAY_OF_WEEK_IN_MONTH:
case WEEK_OF_MONTH:
- return 4;
+ return 4;
default:
- return maximums[field];
+ return maximums[field];
}
}
@@ -1263,17 +1263,17 @@ public class GregorianCalendar extends Calendar
{
if (field == WEEK_OF_YEAR)
{
- int min = getMinimalDaysInFirstWeek();
- if (min == 0)
- return 1;
- if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
- complete();
-
- int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
- int weekday = getWeekDay(year, min);
- if ((7 + weekday - getFirstDayOfWeek()) % 7 >= min - 1)
- return 1;
- return 0;
+ int min = getMinimalDaysInFirstWeek();
+ if (min == 0)
+ return 1;
+ if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
+ complete();
+
+ int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
+ int weekday = getWeekDay(year, min);
+ if ((7 + weekday - getFirstDayOfWeek()) % 7 >= min - 1)
+ return 1;
+ return 0;
}
return minimums[field];
}
@@ -1295,71 +1295,71 @@ public class GregorianCalendar extends Calendar
{
case WEEK_OF_YEAR:
{
- if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
- complete();
-
- // This is wrong for the year that contains the gregorian change.
- // I.e it gives the weeks in the julian year or in the gregorian
- // year in that case.
- int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
- int lastDay = isLeapYear(year) ? 366 : 365;
- int weekday = getWeekDay(year, lastDay);
- int week = (lastDay + 6 - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
-
- int minimalDays = getMinimalDaysInFirstWeek();
- int firstWeekday = getWeekDay(year, minimalDays);
- /*
- * Is there a set of days at the beginning of the year, before the
- * first day of the week, equal to or greater than the minimum number
- * of days required in the first week?
- */
- if (minimalDays - (7 + firstWeekday - getFirstDayOfWeek()) % 7 < 1)
- return week + 1; /* Add week 1: firstWeekday through to firstDayOfWeek */
+ if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
+ complete();
+
+ // This is wrong for the year that contains the gregorian change.
+ // I.e it gives the weeks in the julian year or in the gregorian
+ // year in that case.
+ int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
+ int lastDay = isLeapYear(year) ? 366 : 365;
+ int weekday = getWeekDay(year, lastDay);
+ int week = (lastDay + 6 - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
+
+ int minimalDays = getMinimalDaysInFirstWeek();
+ int firstWeekday = getWeekDay(year, minimalDays);
+ /*
+ * Is there a set of days at the beginning of the year, before the
+ * first day of the week, equal to or greater than the minimum number
+ * of days required in the first week?
+ */
+ if (minimalDays - (7 + firstWeekday - getFirstDayOfWeek()) % 7 < 1)
+ return week + 1; /* Add week 1: firstWeekday through to firstDayOfWeek */
}
case DAY_OF_MONTH:
{
- if (! areFieldsSet || ! isSet[MONTH])
- complete();
- int month = fields[MONTH];
-
- // If you change this, you should also change
- // SimpleTimeZone.getDaysInMonth();
- if (month == FEBRUARY)
- {
- if (! isSet[YEAR] || ! isSet[ERA])
- complete();
- int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
- return isLeapYear(year) ? 29 : 28;
- }
- else if (month < AUGUST)
- return 31 - (month & 1);
- else
- return 30 + (month & 1);
+ if (! areFieldsSet || ! isSet[MONTH])
+ complete();
+ int month = fields[MONTH];
+
+ // If you change this, you should also change
+ // SimpleTimeZone.getDaysInMonth();
+ if (month == FEBRUARY)
+ {
+ if (! isSet[YEAR] || ! isSet[ERA])
+ complete();
+ int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
+ return isLeapYear(year) ? 29 : 28;
+ }
+ else if (month < AUGUST)
+ return 31 - (month & 1);
+ else
+ return 30 + (month & 1);
}
case DAY_OF_YEAR:
{
- if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
- complete();
- int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
- return isLeapYear(year) ? 366 : 365;
+ if (! areFieldsSet || ! isSet[ERA] || ! isSet[YEAR])
+ complete();
+ int year = fields[ERA] == AD ? fields[YEAR] : 1 - fields[YEAR];
+ return isLeapYear(year) ? 366 : 365;
}
case DAY_OF_WEEK_IN_MONTH:
{
- // This is wrong for the month that contains the gregorian change.
- int daysInMonth = getActualMaximum(DAY_OF_MONTH);
+ // This is wrong for the month that contains the gregorian change.
+ int daysInMonth = getActualMaximum(DAY_OF_MONTH);
- // That's black magic, I know
- return (daysInMonth - (fields[DAY_OF_MONTH] - 1) % 7 + 6) / 7;
+ // That's black magic, I know
+ return (daysInMonth - (fields[DAY_OF_MONTH] - 1) % 7 + 6) / 7;
}
case WEEK_OF_MONTH:
{
- int daysInMonth = getActualMaximum(DAY_OF_MONTH);
- int weekday = (daysInMonth - fields[DAY_OF_MONTH]
- + fields[DAY_OF_WEEK] - SUNDAY) % 7 + SUNDAY;
- return (daysInMonth + 6 - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
+ int daysInMonth = getActualMaximum(DAY_OF_MONTH);
+ int weekday = (daysInMonth - fields[DAY_OF_MONTH]
+ + fields[DAY_OF_WEEK] - SUNDAY) % 7 + SUNDAY;
+ return (daysInMonth + 6 - (7 + weekday - getFirstDayOfWeek()) % 7) / 7;
}
default:
- return maximums[field];
+ return maximums[field];
}
}
}
diff --git a/java/util/HashMap.java b/java/util/HashMap.java
index eca3ad6aa..55d81c620 100644
--- a/java/util/HashMap.java
+++ b/java/util/HashMap.java
@@ -349,7 +349,7 @@ public class HashMap<K, V> extends AbstractMap<K, V>
if (equals(key, e.key))
{
e.access(); // Must call this for bookkeeping in LinkedHashMap.
- V r = e.value;
+ V r = e.value;
e.value = value;
return r;
}
@@ -384,12 +384,12 @@ public class HashMap<K, V> extends AbstractMap<K, V>
final Iterator<Map.Entry<K,V>> it = addMap.entrySet().iterator();
while (it.hasNext())
{
- final Map.Entry<K,V> e = it.next();
+ final Map.Entry<K,V> e = it.next();
// Optimize in case the Entry is one of our own.
if (e instanceof AbstractMap.SimpleEntry)
{
AbstractMap.SimpleEntry<? extends K, ? extends V> entry
- = (AbstractMap.SimpleEntry<? extends K, ? extends V>) e;
+ = (AbstractMap.SimpleEntry<? extends K, ? extends V>) e;
put(entry.key, entry.value);
}
else
@@ -702,8 +702,8 @@ public class HashMap<K, V> extends AbstractMap<K, V>
}
/**
- * A simplified, more efficient internal implementation of putAll(). clone()
- * should not call putAll or put, in order to be compatible with the JDK
+ * A simplified, more efficient internal implementation of putAll(). clone()
+ * should not call putAll or put, in order to be compatible with the JDK
* implementation with respect to subclasses.
*
* @param m the map to initialize this from
@@ -715,11 +715,11 @@ public class HashMap<K, V> extends AbstractMap<K, V>
size = 0;
while (it.hasNext())
{
- final Map.Entry<K,V> e = it.next();
+ final Map.Entry<K,V> e = it.next();
size++;
- K key = e.getKey();
- int idx = hash(key);
- addEntry(key, e.getValue(), idx, false);
+ K key = e.getKey();
+ int idx = hash(key);
+ addEntry(key, e.getValue(), idx, false);
}
}
diff --git a/java/util/Hashtable.java b/java/util/Hashtable.java
index 0851de824..8f08e96ab 100644
--- a/java/util/Hashtable.java
+++ b/java/util/Hashtable.java
@@ -345,7 +345,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
}
}
- return false;
+ return false;
}
/**
@@ -362,7 +362,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
*/
public boolean containsValue(Object value)
{
- // Delegate to older method to make sure code overriding it continues
+ // Delegate to older method to make sure code overriding it continues
// to work.
return contains(value);
}
@@ -511,12 +511,12 @@ public class Hashtable<K, V> extends Dictionary<K, V>
final Iterator<Map.Entry<K,V>> it = addMap.entrySet().iterator();
while (it.hasNext())
{
- final Map.Entry<K,V> e = it.next();
+ final Map.Entry<K,V> e = it.next();
// Optimize in case the Entry is one of our own.
if (e instanceof AbstractMap.SimpleEntry)
{
AbstractMap.SimpleEntry<? extends K, ? extends V> entry
- = (AbstractMap.SimpleEntry<? extends K, ? extends V>) e;
+ = (AbstractMap.SimpleEntry<? extends K, ? extends V>) e;
put(entry.key, entry.value);
}
else
@@ -850,8 +850,8 @@ public class Hashtable<K, V> extends Dictionary<K, V>
}
/**
- * A simplified, more efficient internal implementation of putAll(). clone()
- * should not call putAll or put, in order to be compatible with the JDK
+ * A simplified, more efficient internal implementation of putAll(). clone()
+ * should not call putAll or put, in order to be compatible with the JDK
* implementation with respect to subclasses.
*
* @param m the map to initialize this from
@@ -863,13 +863,13 @@ public class Hashtable<K, V> extends Dictionary<K, V>
size = 0;
while (it.hasNext())
{
- final Map.Entry<K,V> e = it.next();
+ final Map.Entry<K,V> e = it.next();
size++;
- K key = e.getKey();
- int idx = hash(key);
- HashEntry<K, V> he = new HashEntry<K, V>(key, e.getValue());
- he.next = buckets[idx];
- buckets[idx] = he;
+ K key = e.getKey();
+ int idx = hash(key);
+ HashEntry<K, V> he = new HashEntry<K, V>(key, e.getValue());
+ he.next = buckets[idx];
+ buckets[idx] = he;
}
}
@@ -991,7 +991,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
* @author Jon Zeppieri
* @author Fridjof Siebert
*/
- private class EntryIterator
+ private class EntryIterator
implements Iterator<Entry<K,V>>
{
/**
@@ -1044,10 +1044,10 @@ public class Hashtable<K, V> extends Dictionary<K, V>
HashEntry<K, V> e = next;
while (e == null)
- if (idx <= 0)
- return null;
- else
- e = buckets[--idx];
+ if (idx <= 0)
+ return null;
+ else
+ e = buckets[--idx];
next = e.next;
last = e;
@@ -1081,7 +1081,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
* @author Fridtjof Siebert
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
- private class KeyIterator
+ private class KeyIterator
implements Iterator<K>
{
@@ -1097,7 +1097,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
*/
KeyIterator()
{
- iterator = new EntryIterator();
+ iterator = new EntryIterator();
}
@@ -1109,7 +1109,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
*/
public boolean hasNext()
{
- return iterator.hasNext();
+ return iterator.hasNext();
}
/**
@@ -1137,7 +1137,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
iterator.remove();
}
} // class KeyIterator
-
+
/**
* A class which implements the Iterator interface and is used for
* iterating over values in Hashtables. This class uses an
@@ -1162,7 +1162,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
*/
ValueIterator()
{
- iterator = new EntryIterator();
+ iterator = new EntryIterator();
}
@@ -1174,7 +1174,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
*/
public boolean hasNext()
{
- return iterator.hasNext();
+ return iterator.hasNext();
}
/**
@@ -1218,7 +1218,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
* @author Jon Zeppieri
* @author Fridjof Siebert
*/
- private class EntryEnumerator
+ private class EntryEnumerator
implements Enumeration<Entry<K,V>>
{
/** The number of elements remaining to be returned by next(). */
@@ -1315,7 +1315,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
*/
public boolean hasMoreElements()
{
- return enumerator.hasMoreElements();
+ return enumerator.hasMoreElements();
}
/**
@@ -1376,7 +1376,7 @@ public class Hashtable<K, V> extends Dictionary<K, V>
*/
public boolean hasMoreElements()
{
- return enumerator.hasMoreElements();
+ return enumerator.hasMoreElements();
}
/**
diff --git a/java/util/IdentityHashMap.java b/java/util/IdentityHashMap.java
index 8dead96c1..89a75259e 100644
--- a/java/util/IdentityHashMap.java
+++ b/java/util/IdentityHashMap.java
@@ -789,10 +789,10 @@ public class IdentityHashMap<K,V> extends AbstractMap<K,V>
key = table[loc];
}
while (key == null);
-
- return (I) (type == KEYS ? unxform(key)
- : (type == VALUES ? unxform(table[loc + 1])
- : new IdentityEntry(loc)));
+
+ return (I) (type == KEYS ? unxform(key)
+ : (type == VALUES ? unxform(table[loc + 1])
+ : new IdentityEntry(loc)));
}
/**
diff --git a/java/util/IllegalFormatCodePointException.java b/java/util/IllegalFormatCodePointException.java
index 001839fe1..f6d5c2fef 100644
--- a/java/util/IllegalFormatCodePointException.java
+++ b/java/util/IllegalFormatCodePointException.java
@@ -38,16 +38,16 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when a {@link Formatter} receives a character with an
* invalid Unicode codepoint, as defined by
* {@link Character#isValidCodePoint(int)}.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class IllegalFormatCodePointException
+public class IllegalFormatCodePointException
extends IllegalFormatException
{
private static final long serialVersionUID = 19080630L;
diff --git a/java/util/IllegalFormatConversionException.java b/java/util/IllegalFormatConversionException.java
index d59c0a4b1..58aa91833 100644
--- a/java/util/IllegalFormatConversionException.java
+++ b/java/util/IllegalFormatConversionException.java
@@ -38,16 +38,16 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the type of an argument supplied to the
* {@link Formatter#format()} method of a {@link Formatter}
* does not match the conversion character specified for it.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class IllegalFormatConversionException
+public class IllegalFormatConversionException
extends IllegalFormatException
{
private static final long serialVersionUID = 17000126L;
@@ -81,7 +81,7 @@ public class IllegalFormatConversionException
public IllegalFormatConversionException(char c, Class<?> arg)
{
super("The type, " + arg + ", is invalid for the conversion character, " +
- c + ".");
+ c + ".");
if (arg == null)
throw new NullPointerException("The supplied type was null.");
this.c = c;
diff --git a/java/util/IllegalFormatException.java b/java/util/IllegalFormatException.java
index 4daafca44..b5c740a8f 100644
--- a/java/util/IllegalFormatException.java
+++ b/java/util/IllegalFormatException.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.util;
-/**
+/**
* A general exception thrown when a format string is supplied
* to a {@link Formatter} that contains either invalid syntax
* or a mismatch between the format specification and the
@@ -48,9 +48,9 @@ package java.util;
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class IllegalFormatException
+public class IllegalFormatException
extends IllegalArgumentException
{
private static final long serialVersionUID = 18830826L;
diff --git a/java/util/IllegalFormatFlagsException.java b/java/util/IllegalFormatFlagsException.java
index 2a085c141..b53bfa50a 100644
--- a/java/util/IllegalFormatFlagsException.java
+++ b/java/util/IllegalFormatFlagsException.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the flags supplied to the {@link Formatter#format()}
* method of a {@link Formatter} form an illegal combination.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class IllegalFormatFlagsException
+public class IllegalFormatFlagsException
extends IllegalFormatException
{
private static final long serialVersionUID = 790824L;
diff --git a/java/util/IllegalFormatPrecisionException.java b/java/util/IllegalFormatPrecisionException.java
index a555f5df4..a216dc185 100644
--- a/java/util/IllegalFormatPrecisionException.java
+++ b/java/util/IllegalFormatPrecisionException.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the specified precision for a {@link Formatter}
* argument is illegal. This may be because the number is
* a negative number (other than -1), the argument does not
@@ -46,9 +46,9 @@ package java.util;
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class IllegalFormatPrecisionException
+public class IllegalFormatPrecisionException
extends IllegalFormatException
{
private static final long serialVersionUID = 18711008L;
diff --git a/java/util/IllegalFormatWidthException.java b/java/util/IllegalFormatWidthException.java
index 95d3e1502..7f2a6257e 100644
--- a/java/util/IllegalFormatWidthException.java
+++ b/java/util/IllegalFormatWidthException.java
@@ -38,16 +38,16 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the specified width for a {@link Formatter}
* argument is illegal. This may be because the number is
* a negative number (other than -1) or for some other reason.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class IllegalFormatWidthException
+public class IllegalFormatWidthException
extends IllegalFormatException
{
private static final long serialVersionUID = 16660902L;
diff --git a/java/util/InputMismatchException.java b/java/util/InputMismatchException.java
index 39326c33e..ee29e4653 100644
--- a/java/util/InputMismatchException.java
+++ b/java/util/InputMismatchException.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when a {@link Scanner} instance encounters a mismatch
* between the input data and the pattern it is trying to match it
* against. This could be because the input data represents an
@@ -47,9 +47,9 @@ package java.util;
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class InputMismatchException
+public class InputMismatchException
extends NoSuchElementException
{
/**
diff --git a/java/util/LinkedHashMap.java b/java/util/LinkedHashMap.java
index 6ec06a949..7701d7763 100644
--- a/java/util/LinkedHashMap.java
+++ b/java/util/LinkedHashMap.java
@@ -76,9 +76,9 @@ package java.util;
* things like keep the map at a fixed size.
* <p>
*
- * Under ideal circumstances (no collisions), LinkedHashMap offers O(1)
+ * Under ideal circumstances (no collisions), LinkedHashMap offers O(1)
* performance on most operations (<code>containsValue()</code> is,
- * of course, O(n)). In the worst case (all keys map to the same
+ * of course, O(n)). In the worst case (all keys map to the same
* hash code -- very unlikely), most operations are O(n). Traversal is
* faster than in HashMap (proportional to the map size, and not the space
* allocated for the map), but other operations may be slower because of the
@@ -188,7 +188,7 @@ public class LinkedHashMap<K,V> extends HashMap<K,V>
succ = null;
pred = root.pred;
pred.succ = this;
- root.pred = this;
+ root.pred = this;
}
}
}
@@ -477,7 +477,7 @@ public class LinkedHashMap<K,V> extends HashMap<K,V>
current = current.succ;
return type == VALUES ? last.value : type == KEYS ? last.key : last;
}
-
+
/**
* Removes from the backing HashMap the last element which was fetched
* with the <code>next()</code> method.
diff --git a/java/util/LinkedHashSet.java b/java/util/LinkedHashSet.java
index 03b955606..2caebaf93 100644
--- a/java/util/LinkedHashSet.java
+++ b/java/util/LinkedHashSet.java
@@ -62,7 +62,7 @@ import java.io.Serializable;
* without needing the overhead of <code>TreeSet</code>.
* <p>
*
- * Under ideal circumstances (no collisions), LinkedHashSet offers O(1)
+ * Under ideal circumstances (no collisions), LinkedHashSet offers O(1)
* performance on most operations. In the worst case (all elements map
* to the same hash code -- very unlikely), most operations are O(n).
* <p>
diff --git a/java/util/LinkedList.java b/java/util/LinkedList.java
index 3f8b2ad60..813d099da 100644
--- a/java/util/LinkedList.java
+++ b/java/util/LinkedList.java
@@ -684,7 +684,7 @@ public class LinkedList<T> extends AbstractSequentialList<T>
* Returns an Array whose component type is the runtime component type of
* the passed-in Array. The returned Array is populated with all of the
* elements in this LinkedList. If the passed-in Array is not large enough
- * to store all of the elements in this List, a new Array will be created
+ * to store all of the elements in this List, a new Array will be created
* and returned; if the passed-in Array is <i>larger</i> than the size
* of this List, then size() index will be set to null.
*
@@ -1081,8 +1081,8 @@ public class LinkedList<T> extends AbstractSequentialList<T>
if (next == null)
throw new NoSuchElementException();
--position;
- lastReturned = next;
- next = lastReturned.previous;
+ lastReturned = next;
+ next = lastReturned.previous;
return lastReturned.data;
}
@@ -1101,9 +1101,9 @@ public class LinkedList<T> extends AbstractSequentialList<T>
checkMod();
if (lastReturned == null)
throw new IllegalStateException();
- removeEntry(lastReturned);
- lastReturned = null;
- ++knownMod;
+ removeEntry(lastReturned);
+ lastReturned = null;
+ ++knownMod;
}
};
}
@@ -1217,7 +1217,7 @@ public class LinkedList<T> extends AbstractSequentialList<T>
{
addFirst(value);
}
-
+
/**
* Removes the first occurrence of the specified element
* from the list, when traversing the list from head to
@@ -1247,12 +1247,12 @@ public class LinkedList<T> extends AbstractSequentialList<T>
Entry<T> e = last;
while (e != null)
{
- if (equals(o, e.data))
- {
- removeEntry(e);
- return true;
- }
- e = e.previous;
+ if (equals(o, e.data))
+ {
+ removeEntry(e);
+ return true;
+ }
+ e = e.previous;
}
return false;
}
diff --git a/java/util/List.java b/java/util/List.java
index 0a1c4098c..3a437a5a2 100644
--- a/java/util/List.java
+++ b/java/util/List.java
@@ -232,7 +232,7 @@ public interface List<E> extends Collection<E>
* Obtains a hash code for this list. In order to obey the general
* contract of the hashCode method of class Object, this value is
* calculated as follows:
- *
+ *
<p><pre>hashCode = 1;
Iterator i = list.iterator();
while (i.hasNext())
diff --git a/java/util/Locale.java b/java/util/Locale.java
index c28709f95..ef111737d 100644
--- a/java/util/Locale.java
+++ b/java/util/Locale.java
@@ -215,7 +215,7 @@ public final class Locale implements Serializable, Cloneable
* got called.
*/
private static transient HashMap localeMap;
-
+
/**
* The default locale. Except for during bootstrapping, this should never be
* null. Note the logic in the main constructor, to detect when
@@ -249,12 +249,12 @@ public final class Locale implements Serializable, Cloneable
*
* @param language the language of the locale to retrieve.
* @return the locale.
- */
+ */
private static Locale getLocale(String language)
{
return getLocale(language, "", "");
}
-
+
/**
* Retrieves the locale with the specified language and country
* from the cache.
@@ -262,12 +262,12 @@ public final class Locale implements Serializable, Cloneable
* @param language the language of the locale to retrieve.
* @param country the country of the locale to retrieve.
* @return the locale.
- */
+ */
private static Locale getLocale(String language, String country)
{
return getLocale(language, country, "");
}
-
+
/**
* Retrieves the locale with the specified language, country
* and variant from the cache.
@@ -276,7 +276,7 @@ public final class Locale implements Serializable, Cloneable
* @param country the country of the locale to retrieve.
* @param variant the variant of the locale to retrieve.
* @return the locale.
- */
+ */
private static Locale getLocale(String language, String country, String variant)
{
if (localeMap == null)
@@ -287,13 +287,13 @@ public final class Locale implements Serializable, Cloneable
if (locale == null)
{
- locale = new Locale(language, country, variant);
- localeMap.put(name, locale);
+ locale = new Locale(language, country, variant);
+ localeMap.put(name, locale);
}
return locale;
}
-
+
/**
* Convert new iso639 codes to the old ones.
*
@@ -418,17 +418,17 @@ public final class Locale implements Serializable, Cloneable
if (name.length() > 2)
country = name.substring(3);
- int index = country.indexOf("_");
- if (index > 0)
- {
- variant = country.substring(index + 1);
- country = country.substring(0, index - 1);
- }
+ int index = country.indexOf("_");
+ if (index > 0)
+ {
+ variant = country.substring(index + 1);
+ country = country.substring(0, index - 1);
+ }
availableLocales[i] = getLocale(language, country, variant);
}
}
-
+
return (Locale[]) availableLocales.clone();
}
@@ -442,7 +442,7 @@ public final class Locale implements Serializable, Cloneable
{
if (countryCache == null)
{
- countryCache = getISOStrings("territories");
+ countryCache = getISOStrings("territories");
}
return (String[]) countryCache.clone();
@@ -458,7 +458,7 @@ public final class Locale implements Serializable, Cloneable
{
if (languageCache == null)
{
- languageCache = getISOStrings("languages");
+ languageCache = getISOStrings("languages");
}
return (String[]) languageCache.clone();
}
@@ -480,27 +480,27 @@ public final class Locale implements Serializable, Cloneable
while (e.hasMoreElements())
{
- String key = (String) e.nextElement();
-
- if (key.startsWith(tableName + "."))
- {
- String str = key.substring(tableName.length() + 1);
-
- if (str.length() == 2
- && Character.isLetter(str.charAt(0))
- && Character.isLetter(str.charAt(1)))
- {
- tempList.add(str);
- ++count;
- }
- }
+ String key = (String) e.nextElement();
+
+ if (key.startsWith(tableName + "."))
+ {
+ String str = key.substring(tableName.length() + 1);
+
+ if (str.length() == 2
+ && Character.isLetter(str.charAt(0))
+ && Character.isLetter(str.charAt(1)))
+ {
+ tempList.add(str);
+ ++count;
+ }
+ }
}
String[] strings = new String[count];
-
+
for (int a = 0; a < count; ++a)
strings[a] = (String) tempList.get(a);
-
+
return strings;
}
@@ -687,7 +687,7 @@ public final class Locale implements Serializable, Cloneable
return "";
try
{
- ResourceBundle res =
+ ResourceBundle res =
ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
inLocale,
ClassLoader.getSystemClassLoader());
@@ -696,23 +696,23 @@ public final class Locale implements Serializable, Cloneable
}
catch (MissingResourceException e)
{
- /* This means runtime support for the locale
- * is not available, so we check providers. */
+ /* This means runtime support for the locale
+ * is not available, so we check providers. */
}
for (LocaleNameProvider p :
- ServiceLoader.load(LocaleNameProvider.class))
+ ServiceLoader.load(LocaleNameProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(inLocale))
- {
- String locLang = p.getDisplayLanguage(language,
- inLocale);
- if (locLang != null)
- return locLang;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(inLocale))
+ {
+ String locLang = p.getDisplayLanguage(language,
+ inLocale);
+ if (locLang != null)
+ return locLang;
+ break;
+ }
+ }
}
if (inLocale.equals(Locale.ROOT)) // Base case
return language;
@@ -770,28 +770,28 @@ public final class Locale implements Serializable, Cloneable
ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
inLocale,
ClassLoader.getSystemClassLoader());
-
+
return res.getString("territories." + country);
}
catch (MissingResourceException e)
{
- /* This means runtime support for the locale
- * is not available, so we check providers. */
+ /* This means runtime support for the locale
+ * is not available, so we check providers. */
}
for (LocaleNameProvider p :
- ServiceLoader.load(LocaleNameProvider.class))
+ ServiceLoader.load(LocaleNameProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(inLocale))
- {
- String locCountry = p.getDisplayCountry(country,
- inLocale);
- if (locCountry != null)
- return locCountry;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(inLocale))
+ {
+ String locCountry = p.getDisplayCountry(country,
+ inLocale);
+ if (locCountry != null)
+ return locCountry;
+ break;
+ }
+ }
}
if (inLocale.equals(Locale.ROOT)) // Base case
return country;
@@ -850,28 +850,28 @@ public final class Locale implements Serializable, Cloneable
ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
inLocale,
ClassLoader.getSystemClassLoader());
-
+
return res.getString("variants." + variant);
}
catch (MissingResourceException e)
{
- /* This means runtime support for the locale
- * is not available, so we check providers. */
+ /* This means runtime support for the locale
+ * is not available, so we check providers. */
}
for (LocaleNameProvider p :
- ServiceLoader.load(LocaleNameProvider.class))
+ ServiceLoader.load(LocaleNameProvider.class))
{
- for (Locale loc : p.getAvailableLocales())
- {
- if (loc.equals(inLocale))
- {
- String locVar = p.getDisplayVariant(variant,
- inLocale);
- if (locVar != null)
- return locVar;
- break;
- }
- }
+ for (Locale loc : p.getAvailableLocales())
+ {
+ if (loc.equals(inLocale))
+ {
+ String locVar = p.getDisplayVariant(variant,
+ inLocale);
+ if (locVar != null)
+ return locVar;
+ break;
+ }
+ }
}
if (inLocale.equals(Locale.ROOT)) // Base case
return country;
@@ -989,8 +989,8 @@ public final class Locale implements Serializable, Cloneable
return false;
Locale l = (Locale) obj;
- return (language == l.language
- && country == l.country
+ return (language == l.language
+ && country == l.country
&& variant == l.variant);
}
@@ -1000,8 +1000,8 @@ public final class Locale implements Serializable, Cloneable
* @param s the stream to write to
* @throws IOException if the write fails
* @serialData The first three fields are Strings representing language,
- * country, and variant. The fourth field is a placeholder for
- * the cached hashcode, but this is always written as -1, and
+ * country, and variant. The fourth field is a placeholder for
+ * the cached hashcode, but this is always written as -1, and
* recomputed when reading it back.
*/
private void writeObject(ObjectOutputStream s)
diff --git a/java/util/Map.java b/java/util/Map.java
index 67b3d8aa5..1bcb1b2f0 100644
--- a/java/util/Map.java
+++ b/java/util/Map.java
@@ -310,7 +310,7 @@ public interface Map<K, V>
* Returns the hash code of the entry. This is defined as the
* exclusive-or of the hashcodes of the key and value (using 0 for
* <code>null</code>). In other words, this must be:
- *
+ *
<p><pre>(getKey() == null ? 0 : getKey().hashCode())
^ (getValue() == null ? 0 : getValue().hashCode())</pre>
*
@@ -322,7 +322,7 @@ public interface Map<K, V>
* Compares the specified object with this entry. Returns true only if
* the object is a mapping of identical key and value. In other words,
* this must be:
- *
+ *
<p><pre>(o instanceof Map.Entry)
&& (getKey() == null ? ((Map.Entry) o).getKey() == null
: getKey().equals(((Map.Entry) o).getKey()))
diff --git a/java/util/MissingFormatArgumentException.java b/java/util/MissingFormatArgumentException.java
index 4a9385ed5..e53de0ae3 100644
--- a/java/util/MissingFormatArgumentException.java
+++ b/java/util/MissingFormatArgumentException.java
@@ -38,16 +38,16 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the a format specification for a {@link Formatter}
* refers to an argument that is non-existent, or an argument index
* references a non-existent argument.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class MissingFormatArgumentException
+public class MissingFormatArgumentException
extends IllegalFormatException
{
private static final long serialVersionUID = 19190115L;
@@ -71,8 +71,8 @@ public class MissingFormatArgumentException
*/
public MissingFormatArgumentException(String s)
{
- super("The specification, " + s +
- ", refers to a non-existent argument.");
+ super("The specification, " + s +
+ ", refers to a non-existent argument.");
if (s == null)
throw new NullPointerException("The specification is null.");
this.s = s;
diff --git a/java/util/MissingFormatWidthException.java b/java/util/MissingFormatWidthException.java
index 55de6202f..e083172a9 100644
--- a/java/util/MissingFormatWidthException.java
+++ b/java/util/MissingFormatWidthException.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when the a format specification for a {@link Formatter}
* does not include a width for a value where one is required.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class MissingFormatWidthException
+public class MissingFormatWidthException
extends IllegalFormatException
{
private static final long serialVersionUID = 15560123L;
diff --git a/java/util/PriorityQueue.java b/java/util/PriorityQueue.java
index 904e3b1b2..470041e9d 100644
--- a/java/util/PriorityQueue.java
+++ b/java/util/PriorityQueue.java
@@ -79,23 +79,23 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
// Special case where we can find the comparator to use.
if (c instanceof SortedSet)
{
- SortedSet<? extends E> ss = (SortedSet<? extends E>) c;
- this.comparator = (Comparator<? super E>) ss.comparator();
- // We can insert the elements directly, since they are sorted.
- int i = 0;
- for (E val : ss)
- {
- if (val == null)
- throw new NullPointerException();
- storage[i++] = val;
- }
+ SortedSet<? extends E> ss = (SortedSet<? extends E>) c;
+ this.comparator = (Comparator<? super E>) ss.comparator();
+ // We can insert the elements directly, since they are sorted.
+ int i = 0;
+ for (E val : ss)
+ {
+ if (val == null)
+ throw new NullPointerException();
+ storage[i++] = val;
+ }
}
else if (c instanceof PriorityQueue)
{
- PriorityQueue<? extends E> pq = (PriorityQueue<? extends E>) c;
- this.comparator = (Comparator<? super E>)pq.comparator();
- // We can just copy the contents.
- System.arraycopy(pq.storage, 0, storage, 0, pq.storage.length);
+ PriorityQueue<? extends E> pq = (PriorityQueue<? extends E>) c;
+ this.comparator = (Comparator<? super E>)pq.comparator();
+ // We can just copy the contents.
+ System.arraycopy(pq.storage, 0, storage, 0, pq.storage.length);
}
addAll(c);
@@ -116,7 +116,7 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
public PriorityQueue(PriorityQueue<? extends E> c)
{
this(Math.max(1, (int) (1.1 * c.size())),
- (Comparator<? super E>)c.comparator());
+ (Comparator<? super E>)c.comparator());
// We can just copy the contents.
System.arraycopy(c.storage, 0, storage, 0, c.storage.length);
}
@@ -124,14 +124,14 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
public PriorityQueue(SortedSet<? extends E> c)
{
this(Math.max(1, (int) (1.1 * c.size())),
- (Comparator<? super E>)c.comparator());
+ (Comparator<? super E>)c.comparator());
// We can insert the elements directly, since they are sorted.
int i = 0;
for (E val : c)
{
- if (val == null)
- throw new NullPointerException();
- storage[i++] = val;
+ if (val == null)
+ throw new NullPointerException();
+ storage[i++] = val;
}
}
@@ -155,21 +155,21 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
public boolean hasNext()
{
- return count < used;
+ return count < used;
}
public E next()
{
- while (storage[++index] == null)
- ;
-
- ++count;
- return storage[index];
+ while (storage[++index] == null)
+ ;
+
+ ++count;
+ return storage[index];
}
public void remove()
{
- PriorityQueue.this.remove(index);
+ PriorityQueue.this.remove(index);
}
};
}
@@ -206,14 +206,14 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
{
if (o != null)
{
- for (int i = 0; i < storage.length; ++i)
- {
- if (o.equals(storage[i]))
- {
- remove(i);
- return true;
- }
- }
+ for (int i = 0; i < storage.length; ++i)
+ {
+ if (o.equals(storage[i]))
+ {
+ remove(i);
+ return true;
+ }
+ }
}
return false;
}
@@ -234,12 +234,12 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
int save = used;
for (E val : c)
{
- if (val == null)
- throw new NullPointerException();
- newSlot = findSlot(newSlot);
- storage[newSlot] = val;
- ++used;
- bubbleUp(newSlot);
+ if (val == null)
+ throw new NullPointerException();
+ newSlot = findSlot(newSlot);
+ storage[newSlot] = val;
+ ++used;
+ bubbleUp(newSlot);
}
return save != used;
@@ -250,17 +250,17 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
int slot;
if (used == storage.length)
{
- resize();
- slot = used;
+ resize();
+ slot = used;
}
else
{
- for (slot = start + 1; slot < storage.length; ++slot)
- {
- if (storage[slot] == null)
- break;
- }
- // We'll always find a slot.
+ for (slot = start + 1; slot < storage.length; ++slot)
+ {
+ if (storage[slot] == null)
+ break;
+ }
+ // We'll always find a slot.
}
return slot;
}
@@ -272,28 +272,28 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
// the bottom of the tree.
while (storage[index] != null)
{
- int child = 2 * index + 1;
-
- // See if we went off the end.
- if (child >= storage.length)
- {
- storage[index] = null;
- break;
- }
-
- // Find which child we want to promote. If one is not null,
- // we pick it. If both are null, it doesn't matter, we're
- // about to leave. If neither is null, pick the lesser.
- if (child + 1 >= storage.length || storage[child + 1] == null)
- {
- // Nothing.
- }
- else if (storage[child] == null
- || (Collections.compare(storage[child], storage[child + 1],
- comparator) > 0))
- ++child;
- storage[index] = storage[child];
- index = child;
+ int child = 2 * index + 1;
+
+ // See if we went off the end.
+ if (child >= storage.length)
+ {
+ storage[index] = null;
+ break;
+ }
+
+ // Find which child we want to promote. If one is not null,
+ // we pick it. If both are null, it doesn't matter, we're
+ // about to leave. If neither is null, pick the lesser.
+ if (child + 1 >= storage.length || storage[child + 1] == null)
+ {
+ // Nothing.
+ }
+ else if (storage[child] == null
+ || (Collections.compare(storage[child], storage[child + 1],
+ comparator) > 0))
+ ++child;
+ storage[index] = storage[child];
+ index = child;
}
--used;
}
@@ -304,23 +304,23 @@ public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable
// it up the tree to its natural resting place.
while (index > 0)
{
- // This works regardless of whether we're at 2N+1 or 2N+2.
- int parent = (index - 1) / 2;
- if (Collections.compare(storage[parent], storage[index], comparator)
- <= 0)
- {
- // Parent is the same or smaller than this element, so the
- // invariant is preserved. Note that if the new element
- // is smaller than the parent, then it is necessarily
- // smaller than the parent's other child.
- break;
- }
-
- E temp = storage[index];
- storage[index] = storage[parent];
- storage[parent] = temp;
-
- index = parent;
+ // This works regardless of whether we're at 2N+1 or 2N+2.
+ int parent = (index - 1) / 2;
+ if (Collections.compare(storage[parent], storage[index], comparator)
+ <= 0)
+ {
+ // Parent is the same or smaller than this element, so the
+ // invariant is preserved. Note that if the new element
+ // is smaller than the parent, then it is necessarily
+ // smaller than the parent's other child.
+ break;
+ }
+
+ E temp = storage[index];
+ storage[index] = storage[parent];
+ storage[parent] = temp;
+
+ index = parent;
}
}
diff --git a/java/util/Properties.java b/java/util/Properties.java
index a57004b34..b0f436f42 100644
--- a/java/util/Properties.java
+++ b/java/util/Properties.java
@@ -75,7 +75,7 @@ import org.w3c.dom.ls.LSSerializer;
* and put it in the CLASSPATH. (The character
* <code>\</code><code>u00e4</code> is the german umlaut)
*
- *
+ *
<pre>s1=3
s2=MeineDisk
s3=3. M\<code></code>u00e4rz 96
@@ -179,7 +179,7 @@ public class Properties extends Hashtable<Object, Object>
* <code>\\u</code><em>xxxx</em> notation are detected, and
* converted to the corresponding single character. <br>
*
- *
+ *
<pre># This is a comment
key = value
k\:5 \ a string starting with space and ending with newline\n
@@ -204,21 +204,21 @@ label = Name:\\u0020</pre>
{
char c = 0;
int pos = 0;
- // Leading whitespaces must be deleted first.
+ // Leading whitespaces must be deleted first.
while (pos < line.length()
&& Character.isWhitespace(c = line.charAt(pos)))
pos++;
// If empty line or begins with a comment character, skip this line.
if ((line.length() - pos) == 0
- || line.charAt(pos) == '#' || line.charAt(pos) == '!')
+ || line.charAt(pos) == '#' || line.charAt(pos) == '!')
continue;
// The characters up to the next Whitespace, ':', or '='
// describe the key. But look for escape sequences.
- // Try to short-circuit when there is no escape char.
- int start = pos;
- boolean needsEscape = line.indexOf('\\', pos) != -1;
+ // Try to short-circuit when there is no escape char.
+ int start = pos;
+ boolean needsEscape = line.indexOf('\\', pos) != -1;
CPStringBuilder key = needsEscape ? new CPStringBuilder() : null;
while (pos < line.length()
&& ! Character.isWhitespace(c = line.charAt(pos++))
@@ -232,8 +232,8 @@ label = Name:\\u0020</pre>
// is no next line, just treat it as a key with an
// empty value.
line = reader.readLine();
- if (line == null)
- line = "";
+ if (line == null)
+ line = "";
pos = 0;
while (pos < line.length()
&& Character.isWhitespace(c = line.charAt(pos)))
@@ -274,13 +274,13 @@ label = Name:\\u0020</pre>
boolean isDelim = (c == ':' || c == '=');
- String keyString;
- if (needsEscape)
- keyString = key.toString();
- else if (isDelim || Character.isWhitespace(c))
- keyString = line.substring(start, pos - 1);
- else
- keyString = line.substring(start, pos);
+ String keyString;
+ if (needsEscape)
+ keyString = key.toString();
+ else if (isDelim || Character.isWhitespace(c))
+ keyString = line.substring(start, pos - 1);
+ else
+ keyString = line.substring(start, pos);
while (pos < line.length()
&& Character.isWhitespace(c = line.charAt(pos)))
@@ -294,14 +294,14 @@ label = Name:\\u0020</pre>
pos++;
}
- // Short-circuit if no escape chars found.
- if (!needsEscape)
- {
- put(keyString, line.substring(pos));
- continue;
- }
+ // Short-circuit if no escape chars found.
+ if (!needsEscape)
+ {
+ put(keyString, line.substring(pos));
+ continue;
+ }
- // Escape char found so iterate through the rest of the line.
+ // Escape char found so iterate through the rest of the line.
StringBuilder element = new StringBuilder(line.length() - pos);
while (pos < line.length())
{
@@ -313,11 +313,11 @@ label = Name:\\u0020</pre>
// The line continues on the next line.
line = reader.readLine();
- // We might have seen a backslash at the end of
- // the file. The JDK ignores the backslash in
- // this case, so we follow for compatibility.
- if (line == null)
- break;
+ // We might have seen a backslash at the end of
+ // the file. The JDK ignores the backslash in
+ // this case, so we follow for compatibility.
+ if (line == null)
+ break;
pos = 0;
while (pos < line.length()
@@ -438,7 +438,7 @@ label = Name:\\u0020</pre>
if (header != null)
writer.println("#" + header);
writer.println ("#" + Calendar.getInstance ().getTime ());
-
+
Iterator iter = entrySet ().iterator ();
int i = size ();
CPStringBuilder s = new CPStringBuilder (); // Reuse the same buffer.
@@ -528,7 +528,7 @@ label = Name:\\u0020</pre>
}
/**
- * Prints the key/value pairs to the given print stream. This is
+ * Prints the key/value pairs to the given print stream. This is
* mainly useful for debugging purposes.
*
* @param out the print stream, where the key/value pairs are written to
@@ -645,7 +645,7 @@ label = Name:\\u0020</pre>
* Invoking this method provides the same behaviour as invoking
* <code>storeToXML(os, comment, "UTF-8")</code>.
* </p>
- *
+ *
* @param os the stream to output to.
* @param comment a comment to include at the top of the XML file, or
* <code>null</code> if one is not required.
@@ -666,7 +666,7 @@ label = Name:\\u0020</pre>
* <a href="http://java.sun.com/dtd/properties.dtd">
* http://java.sun.com/dtd/properties.dtd</a>.
* </p>
- *
+ *
* @param os the stream to output to.
* @param comment a comment to include at the top of the XML file, or
* <code>null</code> if one is not required.
@@ -685,53 +685,53 @@ label = Name:\\u0020</pre>
throw new NullPointerException("Null encoding supplied.");
try
{
- DOMImplementationRegistry registry =
- DOMImplementationRegistry.newInstance();
- DOMImplementation domImpl = registry.getDOMImplementation("LS 3.0");
- DocumentType doctype =
- domImpl.createDocumentType("properties", null,
- "http://java.sun.com/dtd/properties.dtd");
- Document doc = domImpl.createDocument(null, "properties", doctype);
- Element root = doc.getDocumentElement();
- if (comment != null)
- {
- Element commentElement = doc.createElement("comment");
- commentElement.appendChild(doc.createTextNode(comment));
- root.appendChild(commentElement);
- }
- Iterator iterator = entrySet().iterator();
- while (iterator.hasNext())
- {
- Map.Entry entry = (Map.Entry) iterator.next();
- Element entryElement = doc.createElement("entry");
- entryElement.setAttribute("key", (String) entry.getKey());
- entryElement.appendChild(doc.createTextNode((String)
- entry.getValue()));
- root.appendChild(entryElement);
- }
- DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
- LSSerializer serializer = loadAndSave.createLSSerializer();
- LSOutput output = loadAndSave.createLSOutput();
- output.setByteStream(os);
- output.setEncoding(encoding);
- serializer.write(doc, output);
+ DOMImplementationRegistry registry =
+ DOMImplementationRegistry.newInstance();
+ DOMImplementation domImpl = registry.getDOMImplementation("LS 3.0");
+ DocumentType doctype =
+ domImpl.createDocumentType("properties", null,
+ "http://java.sun.com/dtd/properties.dtd");
+ Document doc = domImpl.createDocument(null, "properties", doctype);
+ Element root = doc.getDocumentElement();
+ if (comment != null)
+ {
+ Element commentElement = doc.createElement("comment");
+ commentElement.appendChild(doc.createTextNode(comment));
+ root.appendChild(commentElement);
+ }
+ Iterator iterator = entrySet().iterator();
+ while (iterator.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ Element entryElement = doc.createElement("entry");
+ entryElement.setAttribute("key", (String) entry.getKey());
+ entryElement.appendChild(doc.createTextNode((String)
+ entry.getValue()));
+ root.appendChild(entryElement);
+ }
+ DOMImplementationLS loadAndSave = (DOMImplementationLS) domImpl;
+ LSSerializer serializer = loadAndSave.createLSSerializer();
+ LSOutput output = loadAndSave.createLSOutput();
+ output.setByteStream(os);
+ output.setEncoding(encoding);
+ serializer.write(doc, output);
}
catch (ClassNotFoundException e)
{
- throw (IOException)
- new IOException("The XML classes could not be found.").initCause(e);
+ throw (IOException)
+ new IOException("The XML classes could not be found.").initCause(e);
}
catch (InstantiationException e)
{
- throw (IOException)
- new IOException("The XML classes could not be instantiated.")
- .initCause(e);
+ throw (IOException)
+ new IOException("The XML classes could not be instantiated.")
+ .initCause(e);
}
catch (IllegalAccessException e)
{
- throw (IOException)
- new IOException("The XML classes could not be accessed.")
- .initCause(e);
+ throw (IOException)
+ new IOException("The XML classes could not be accessed.")
+ .initCause(e);
}
}
@@ -813,9 +813,9 @@ label = Name:\\u0020</pre>
}
catch (XMLStreamException e)
{
- throw (InvalidPropertiesFormatException)
- new InvalidPropertiesFormatException("Error in parsing XML.").
- initCause(e);
+ throw (InvalidPropertiesFormatException)
+ new InvalidPropertiesFormatException("Error in parsing XML.").
+ initCause(e);
}
}
diff --git a/java/util/PropertyPermission.java b/java/util/PropertyPermission.java
index d1bdbd1d0..6ed4690d8 100644
--- a/java/util/PropertyPermission.java
+++ b/java/util/PropertyPermission.java
@@ -136,7 +136,7 @@ public final class PropertyPermission extends BasicPermission
{
// Initialising the class java.util.Locale ...
// tries to initialise the Locale.defaultLocale static
- // which calls System.getProperty,
+ // which calls System.getProperty,
// which calls SecurityManager.checkPropertiesAccess,
// which creates a PropertyPermission with action "read,write",
// which calls setActions("read,write").
@@ -144,9 +144,9 @@ public final class PropertyPermission extends BasicPermission
// this would call Locale.getDefault() which returns null
// because Locale.defaultLocale hasn't been set yet
// then toLowerCase will fail with a null pointer exception.
- //
+ //
// The solution is to take a punt on 'str' being lower case, and
- // test accordingly. If that fails, we convert 'str' to lower case
+ // test accordingly. If that fails, we convert 'str' to lower case
// and try the tests again.
if ("read".equals(str))
actions = READ;
@@ -156,15 +156,15 @@ public final class PropertyPermission extends BasicPermission
actions = READ | WRITE;
else
{
- String lstr = str.toLowerCase();
- if ("read".equals(lstr))
- actions = READ;
- else if ("write".equals(lstr))
- actions = WRITE;
- else if ("read,write".equals(lstr) || "write,read".equals(lstr))
- actions = READ | WRITE;
- else
- throw new IllegalArgumentException("illegal action " + str);
+ String lstr = str.toLowerCase();
+ if ("read".equals(lstr))
+ actions = READ;
+ else if ("write".equals(lstr))
+ actions = WRITE;
+ else if ("read,write".equals(lstr) || "write,read".equals(lstr))
+ actions = READ | WRITE;
+ else
+ throw new IllegalArgumentException("illegal action " + str);
}
}
diff --git a/java/util/PropertyPermissionCollection.java b/java/util/PropertyPermissionCollection.java
index c95fa4e66..768b11225 100644
--- a/java/util/PropertyPermissionCollection.java
+++ b/java/util/PropertyPermissionCollection.java
@@ -67,7 +67,7 @@ class PropertyPermissionCollection extends PermissionCollection
/**
* A flag to detect if "*" is in the collection.
*
- * @serial true if "*" is in the collection
+ * @serial true if "*" is in the collection
*/
private boolean all_allowed;
diff --git a/java/util/Random.java b/java/util/Random.java
index b016f78d4..999e89547 100644
--- a/java/util/Random.java
+++ b/java/util/Random.java
@@ -227,7 +227,7 @@ public class Random implements Serializable
* an int value whose 32 bits are independent chosen random bits
* (0 and 1 are equally likely). The implementation for
* java.util.Random is:
- *
+ *
<pre>public int nextInt()
{
return next(32);
@@ -246,7 +246,7 @@ public class Random implements Serializable
* each value has the same likelihodd (1/<code>n</code>).
* (0 and 1 are equally likely). The implementation for
* java.util.Random is:
- *
+ *
<pre>
public int nextInt(int n)
{
@@ -266,7 +266,7 @@ public int nextInt(int n)
return val;
}</pre>
- *
+ *
* <p>This algorithm would return every value with exactly the same
* probability, if the next()-method would be a perfect random number
* generator.
@@ -323,7 +323,7 @@ public int nextInt(int n)
/**
* Generates the next pseudorandom boolean. True and false have
* the same probability. The implementation is:
- *
+ *
<pre>public boolean nextBoolean()
{
return next(1) != 0;
@@ -341,7 +341,7 @@ public int nextInt(int n)
* Generates the next pseudorandom float uniformly distributed
* between 0.0f (inclusive) and 1.0f (exclusive). The
* implementation is as follows.
- *
+ *
<pre>public float nextFloat()
{
return next(24) / ((float)(1 &lt;&lt; 24));
@@ -375,7 +375,7 @@ public int nextInt(int n)
* Generates the next pseudorandom, Gaussian (normally) distributed
* double value, with mean 0.0 and standard deviation 1.0.
* The algorithm is as follows.
- *
+ *
<pre>public synchronized double nextGaussian()
{
if (haveNextNextGaussian)
diff --git a/java/util/ResourceBundle.java b/java/util/ResourceBundle.java
index 21243403c..966eb026c 100644
--- a/java/util/ResourceBundle.java
+++ b/java/util/ResourceBundle.java
@@ -95,7 +95,7 @@ public abstract class ResourceBundle
/**
* Maximum size of our cache of <code>ResourceBundle</code>s keyed by
* {@link BundleKey} instances.
- *
+ *
* @see BundleKey
*/
private static final int CACHE_SIZE = 100;
@@ -120,7 +120,7 @@ public abstract class ResourceBundle
* {@link #CACHE_SIZE} accessed <code>ResourceBundle</code>s keyed by the
* tuple: default locale, resource-bundle name, resource-bundle locale, and
* classloader.
- *
+ *
* @see BundleKey
*/
private static Map<BundleKey,Object> bundleCache =
@@ -188,8 +188,8 @@ public abstract class ResourceBundle
String className = getClass().getName();
throw new MissingResourceException("Key '" + key
- + "'not found in Bundle: "
- + className, className, key);
+ + "'not found in Bundle: "
+ + className, className, key);
}
/**
@@ -270,7 +270,7 @@ public abstract class ResourceBundle
{
set(dl, s, l, cl);
}
-
+
void set(Locale dl, String s, Locale l, ClassLoader cl)
{
defaultLocale = dl;
@@ -280,12 +280,12 @@ public abstract class ResourceBundle
hashcode = defaultLocale.hashCode() ^ baseName.hashCode()
^ locale.hashCode() ^ classLoader.hashCode();
}
-
+
public int hashCode()
{
return hashcode;
}
-
+
public boolean equals(Object o)
{
if (! (o instanceof BundleKey))
@@ -296,7 +296,7 @@ public abstract class ResourceBundle
&& baseName.equals(key.baseName)
&& locale.equals(key.locale)
&& classLoader.equals(key.classLoader);
- }
+ }
public String toString()
{
@@ -313,11 +313,11 @@ public abstract class ResourceBundle
return builder.toString();
}
}
-
+
/** A cache lookup key. This avoids having to a new one for every
* getBundle() call. */
private static final BundleKey lookupKey = new BundleKey();
-
+
/** Singleton cache entry to represent previous failed lookups. */
private static final Object nullEntry = new Object();
@@ -383,7 +383,7 @@ public abstract class ResourceBundle
* <li>Locale("es", "ES"): result MyResources_es_ES.class, parent
* MyResources.class</li>
* </ul>
- *
+ *
* <p>The file MyResources_fr_CH.properties is never used because it is hidden
* by MyResources_fr_CH.class.</p>
*
@@ -475,38 +475,38 @@ public abstract class ResourceBundle
rbClass = Class.forName(localizedName);
else
rbClass = classloader.loadClass(localizedName);
- // Note that we do the check up front instead of catching
- // ClassCastException. The reason for this is that some crazy
- // programs (Eclipse) have classes that do not extend
- // ResourceBundle but that have the same name as a property
- // bundle; in fact Eclipse relies on ResourceBundle not
- // instantiating these classes.
- if (ResourceBundle.class.isAssignableFrom(rbClass))
- bundle = (ResourceBundle) rbClass.newInstance();
+ // Note that we do the check up front instead of catching
+ // ClassCastException. The reason for this is that some crazy
+ // programs (Eclipse) have classes that do not extend
+ // ResourceBundle but that have the same name as a property
+ // bundle; in fact Eclipse relies on ResourceBundle not
+ // instantiating these classes.
+ if (ResourceBundle.class.isAssignableFrom(rbClass))
+ bundle = (ResourceBundle) rbClass.newInstance();
}
catch (Exception ex) {}
if (bundle == null)
{
- try
- {
- InputStream is;
- String resourceName
- = localizedName.replace('.', '/') + ".properties";
- if (classloader == null)
- is = ClassLoader.getSystemResourceAsStream(resourceName);
- else
- is = classloader.getResourceAsStream(resourceName);
- if (is != null)
- bundle = new PropertyResourceBundle(is);
- }
- catch (IOException ex)
- {
- MissingResourceException mre = new MissingResourceException
- ("Failed to load bundle: " + localizedName, localizedName, "");
- mre.initCause(ex);
- throw mre;
- }
+ try
+ {
+ InputStream is;
+ String resourceName
+ = localizedName.replace('.', '/') + ".properties";
+ if (classloader == null)
+ is = ClassLoader.getSystemResourceAsStream(resourceName);
+ else
+ is = classloader.getResourceAsStream(resourceName);
+ if (is != null)
+ bundle = new PropertyResourceBundle(is);
+ }
+ catch (IOException ex)
+ {
+ MissingResourceException mre = new MissingResourceException
+ ("Failed to load bundle: " + localizedName, localizedName, "");
+ mre.initCause(ex);
+ throw mre;
+ }
}
return bundle;
@@ -524,13 +524,13 @@ public abstract class ResourceBundle
* @return the resource bundle if it was loaded, otherwise the backup
*/
private static ResourceBundle tryBundle(String baseName, Locale locale,
- ClassLoader classLoader,
- boolean wantBase)
+ ClassLoader classLoader,
+ boolean wantBase)
{
String language = locale.getLanguage();
String country = locale.getCountry();
String variant = locale.getVariant();
-
+
int baseLen = baseName.length();
// Build up a CPStringBuilder containing the complete bundle name, fully
@@ -538,23 +538,23 @@ public abstract class ResourceBundle
CPStringBuilder sb = new CPStringBuilder(baseLen + variant.length() + 7);
sb.append(baseName);
-
+
if (language.length() > 0)
{
- sb.append('_');
- sb.append(language);
-
- if (country.length() > 0)
- {
- sb.append('_');
- sb.append(country);
-
- if (variant.length() > 0)
- {
- sb.append('_');
- sb.append(variant);
- }
- }
+ sb.append('_');
+ sb.append(language);
+
+ if (country.length() > 0)
+ {
+ sb.append('_');
+ sb.append(country);
+
+ if (variant.length() > 0)
+ {
+ sb.append('_');
+ sb.append(variant);
+ }
+ }
}
// Now try to load bundles, starting with the most specialized name.
@@ -562,28 +562,28 @@ public abstract class ResourceBundle
String bundleName = sb.toString();
ResourceBundle first = null; // The most specialized bundle.
ResourceBundle last = null; // The least specialized bundle.
-
+
while (true)
{
ResourceBundle foundBundle = tryBundle(bundleName, classLoader);
- if (foundBundle != null)
- {
- if (first == null)
- first = foundBundle;
- if (last != null)
- last.parent = foundBundle;
- foundBundle.locale = locale;
- last = foundBundle;
- }
- int idx = bundleName.lastIndexOf('_');
- // Try the non-localized base name only if we already have a
- // localized child bundle, or wantBase is true.
- if (idx > baseLen || (idx == baseLen && (first != null || wantBase)))
- bundleName = bundleName.substring(0, idx);
- else
- break;
+ if (foundBundle != null)
+ {
+ if (first == null)
+ first = foundBundle;
+ if (last != null)
+ last.parent = foundBundle;
+ foundBundle.locale = locale;
+ last = foundBundle;
+ }
+ int idx = bundleName.lastIndexOf('_');
+ // Try the non-localized base name only if we already have a
+ // localized child bundle, or wantBase is true.
+ if (idx > baseLen || (idx == baseLen && (first != null || wantBase)))
+ bundleName = bundleName.substring(0, idx);
+ else
+ break;
}
-
+
return first;
}
@@ -611,14 +611,14 @@ public abstract class ResourceBundle
if (loader == null)
throw new NullPointerException("The loader can not be null.");
synchronized (ResourceBundle.class)
- {
- Iterator<BundleKey> iter = bundleCache.keySet().iterator();
- while (iter.hasNext())
- {
- BundleKey key = iter.next();
- if (key.classLoader == loader)
- iter.remove();
- }
+ {
+ Iterator<BundleKey> iter = bundleCache.keySet().iterator();
+ while (iter.hasNext())
+ {
+ BundleKey key = iter.next();
+ if (key.classLoader == loader)
+ iter.remove();
+ }
}
}
diff --git a/java/util/ServiceConfigurationError.java b/java/util/ServiceConfigurationError.java
index 1d006c8de..40d744c23 100644
--- a/java/util/ServiceConfigurationError.java
+++ b/java/util/ServiceConfigurationError.java
@@ -50,14 +50,14 @@ package java.util;
* <li>A listed class does not implement the service</li>
* <li>A listed class can not be instantiated</li>
* </ul>
- *
+ *
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
* @since 1.6
*/
public class ServiceConfigurationError
extends Error
{
-
+
/**
* Compatible with JDK 1.6
*/
@@ -86,7 +86,7 @@ public class ServiceConfigurationError
* or inappropriate.
*/
public ServiceConfigurationError(String message,
- Throwable cause)
+ Throwable cause)
{
super(message,cause);
}
diff --git a/java/util/ServiceLoader.java b/java/util/ServiceLoader.java
index 993541635..bcac0704a 100644
--- a/java/util/ServiceLoader.java
+++ b/java/util/ServiceLoader.java
@@ -149,37 +149,37 @@ public final class ServiceLoader<S>
{
return new Iterator<S>()
{
- /**
- * The cache iterator.
- */
- private Iterator<S> cacheIt = cache.iterator();
+ /**
+ * The cache iterator.
+ */
+ private Iterator<S> cacheIt = cache.iterator();
- public boolean hasNext()
- {
- if (cacheIt.hasNext())
- return true;
- if (serviceIt == null)
- serviceIt =
- ServiceFactory.lookupProviders(spi, loader, true);
- return serviceIt.hasNext();
- }
+ public boolean hasNext()
+ {
+ if (cacheIt.hasNext())
+ return true;
+ if (serviceIt == null)
+ serviceIt =
+ ServiceFactory.lookupProviders(spi, loader, true);
+ return serviceIt.hasNext();
+ }
- public S next()
- {
- if (cacheIt.hasNext())
- return cacheIt.next();
- if (serviceIt == null)
- serviceIt =
- ServiceFactory.lookupProviders(spi, loader, true);
- S nextService = serviceIt.next();
- cache.add(nextService);
- return nextService;
- }
+ public S next()
+ {
+ if (cacheIt.hasNext())
+ return cacheIt.next();
+ if (serviceIt == null)
+ serviceIt =
+ ServiceFactory.lookupProviders(spi, loader, true);
+ S nextService = serviceIt.next();
+ cache.add(nextService);
+ return nextService;
+ }
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
};
}
@@ -196,7 +196,7 @@ public final class ServiceLoader<S>
public static <S> ServiceLoader<S> load(Class<S> service)
{
return load(service,
- Thread.currentThread().getContextClassLoader());
+ Thread.currentThread().getContextClassLoader());
}
/**
@@ -215,7 +215,7 @@ public final class ServiceLoader<S>
* @return a new {@link ServiceLoader} instance.
*/
public static <S> ServiceLoader<S> load(Class<S> service,
- ClassLoader loader)
+ ClassLoader loader)
{
if (loader == null)
loader = ClassLoader.getSystemClassLoader();
@@ -244,7 +244,7 @@ public final class ServiceLoader<S>
* of the system class loader, as in
* ClassLoader.getDefaultSystemClassLoader() */
return load(service,
- ClassLoader.getSystemClassLoader().getParent());
+ ClassLoader.getSystemClassLoader().getParent());
}
/**
@@ -258,8 +258,8 @@ public final class ServiceLoader<S>
/**
* Returns a textual representation of this
- * {@link ServiceLoader}.
- *
+ * {@link ServiceLoader}.
+ *
* @return a textual representation of the
* service loader.
*/
diff --git a/java/util/SimpleTimeZone.java b/java/util/SimpleTimeZone.java
index 4f1840173..6b3b55f17 100644
--- a/java/util/SimpleTimeZone.java
+++ b/java/util/SimpleTimeZone.java
@@ -211,7 +211,7 @@ public class SimpleTimeZone extends TimeZone
* @serial
*/
private byte[] monthLength = monthArr;
- private static final byte[] monthArr =
+ private static final byte[] monthArr =
{
31, 28, 31, 30, 31, 30, 31, 31, 30,
31, 30, 31
@@ -382,7 +382,7 @@ public class SimpleTimeZone extends TimeZone
int endTime, int endTimeMode, int dstSavings)
{
this(rawOffset, id, startMonth, startDayOfWeekInMonth, startDayOfWeek,
- startTime, endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
+ startTime, endMonth, endDayOfWeekInMonth, endDayOfWeek, endTime);
if (startTimeMode < WALL_TIME || startTimeMode > UTC_TIME)
throw new IllegalArgumentException("startTimeMode must be one of WALL_TIME, STANDARD_TIME, or UTC_TIME");
@@ -425,28 +425,28 @@ public class SimpleTimeZone extends TimeZone
int daysInMonth = getDaysInMonth(month, 1);
if (dayOfWeek == 0)
{
- if (day <= 0 || day > daysInMonth)
- throw new IllegalArgumentException("day out of range");
- return DOM_MODE;
+ if (day <= 0 || day > daysInMonth)
+ throw new IllegalArgumentException("day out of range");
+ return DOM_MODE;
}
else if (dayOfWeek > 0)
{
- if (Math.abs(day) > (daysInMonth + 6) / 7)
- throw new IllegalArgumentException("dayOfWeekInMonth out of range");
- if (dayOfWeek > Calendar.SATURDAY)
- throw new IllegalArgumentException("dayOfWeek out of range");
- return DOW_IN_MONTH_MODE;
+ if (Math.abs(day) > (daysInMonth + 6) / 7)
+ throw new IllegalArgumentException("dayOfWeekInMonth out of range");
+ if (dayOfWeek > Calendar.SATURDAY)
+ throw new IllegalArgumentException("dayOfWeek out of range");
+ return DOW_IN_MONTH_MODE;
}
else
{
- if (day == 0 || Math.abs(day) > daysInMonth)
- throw new IllegalArgumentException("day out of range");
- if (dayOfWeek < -Calendar.SATURDAY)
- throw new IllegalArgumentException("dayOfWeek out of range");
- if (day < 0)
- return DOW_LE_DOM_MODE;
- else
- return DOW_GE_DOM_MODE;
+ if (day == 0 || Math.abs(day) > daysInMonth)
+ throw new IllegalArgumentException("day out of range");
+ if (dayOfWeek < -Calendar.SATURDAY)
+ throw new IllegalArgumentException("dayOfWeek out of range");
+ if (day < 0)
+ return DOW_LE_DOM_MODE;
+ else
+ return DOW_GE_DOM_MODE;
}
}
@@ -641,45 +641,45 @@ public class SimpleTimeZone extends TimeZone
int daylightSavings = 0;
if (useDaylight && era == GregorianCalendar.AD && year >= startYear)
{
- int orig_year = year;
- int time = startTime + (startTimeMode == UTC_TIME ? rawOffset : 0);
- // This does only work for Gregorian calendars :-(
- // This is mainly because setStartYear doesn't take an era.
- boolean afterStart = ! isBefore(year, month, day, dayOfWeek, millis,
- startMode, startMonth, startDay,
- startDayOfWeek, time);
- millis += dstSavings;
- if (millis >= 24 * 60 * 60 * 1000)
- {
- millis -= 24 * 60 * 60 * 1000;
- dayOfWeek = (dayOfWeek % 7) + 1;
- if (++day > daysInMonth)
- {
- day = 1;
- if (month++ == Calendar.DECEMBER)
- {
- month = Calendar.JANUARY;
- year++;
- }
- }
- }
- time = endTime + (endTimeMode == UTC_TIME ? rawOffset : 0);
- if (endTimeMode != WALL_TIME)
- time += dstSavings;
- boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis,
- endMode, endMonth, endDay, endDayOfWeek,
- time);
-
- if (year != orig_year)
- afterStart = false;
- if (startMonth < endMonth)
- // use daylight savings, if the date is after the start of
- // savings, and before the end of savings.
- daylightSavings = afterStart && beforeEnd ? dstSavings : 0;
- else
- // use daylight savings, if the date is before the end of
- // savings, or after the start of savings.
- daylightSavings = beforeEnd || afterStart ? dstSavings : 0;
+ int orig_year = year;
+ int time = startTime + (startTimeMode == UTC_TIME ? rawOffset : 0);
+ // This does only work for Gregorian calendars :-(
+ // This is mainly because setStartYear doesn't take an era.
+ boolean afterStart = ! isBefore(year, month, day, dayOfWeek, millis,
+ startMode, startMonth, startDay,
+ startDayOfWeek, time);
+ millis += dstSavings;
+ if (millis >= 24 * 60 * 60 * 1000)
+ {
+ millis -= 24 * 60 * 60 * 1000;
+ dayOfWeek = (dayOfWeek % 7) + 1;
+ if (++day > daysInMonth)
+ {
+ day = 1;
+ if (month++ == Calendar.DECEMBER)
+ {
+ month = Calendar.JANUARY;
+ year++;
+ }
+ }
+ }
+ time = endTime + (endTimeMode == UTC_TIME ? rawOffset : 0);
+ if (endTimeMode != WALL_TIME)
+ time += dstSavings;
+ boolean beforeEnd = isBefore(year, month, day, dayOfWeek, millis,
+ endMode, endMonth, endDay, endDayOfWeek,
+ time);
+
+ if (year != orig_year)
+ afterStart = false;
+ if (startMonth < endMonth)
+ // use daylight savings, if the date is after the start of
+ // savings, and before the end of savings.
+ daylightSavings = afterStart && beforeEnd ? dstSavings : 0;
+ else
+ // use daylight savings, if the date is before the end of
+ // savings, or after the start of savings.
+ daylightSavings = beforeEnd || afterStart ? dstSavings : 0;
}
return rawOffset + daylightSavings;
}
@@ -748,19 +748,19 @@ public class SimpleTimeZone extends TimeZone
* @param year The year.
*/
private int getDaysInMonth(int month, int year)
- {
+ {
if (month == Calendar.FEBRUARY)
{
- if ((year & 3) != 0)
- return 28;
+ if ((year & 3) != 0)
+ return 28;
- // Assume default Gregorian cutover,
- // all years prior to this must be Julian
- if (year < 1582)
- return 29;
+ // Assume default Gregorian cutover,
+ // all years prior to this must be Julian
+ if (year < 1582)
+ return 29;
- // Gregorian rules
- return ((year % 100) != 0 || (year % 400) == 0) ? 29 : 28;
+ // Gregorian rules
+ return ((year % 100) != 0 || (year % 400) == 0) ? 29 : 28;
}
else
return monthArr[month];
@@ -800,66 +800,66 @@ public class SimpleTimeZone extends TimeZone
switch (mode)
{
case DOM_MODE:
- if (calDayOfMonth != day)
- return calDayOfMonth < day;
- break;
+ if (calDayOfMonth != day)
+ return calDayOfMonth < day;
+ break;
case DOW_IN_MONTH_MODE:
{
- // This computes the day of month of the day of type
- // "dayOfWeek" that lies in the same (sunday based) week as cal.
- calDayOfMonth += (dayOfWeek - calDayOfWeek);
-
- // Now we convert it to 7 based number (to get a one based offset
- // after dividing by 7). If we count from the end of the
- // month, we get want a -7 based number counting the days from
- // the end:
- if (day < 0)
- calDayOfMonth -= getDaysInMonth(calMonth, calYear) + 7;
- else
- calDayOfMonth += 6;
-
- // day > 0 day < 0
- // S M T W T F S S M T W T F S
- // 7 8 9 10 11 12 -36-35-34-33-32-31
- // 13 14 15 16 17 18 19 -30-29-28-27-26-25-24
- // 20 21 22 23 24 25 26 -23-22-21-20-19-18-17
- // 27 28 29 30 31 32 33 -16-15-14-13-12-11-10
- // 34 35 36 -9 -8 -7
- // Now we calculate the day of week in month:
- int week = calDayOfMonth / 7;
-
- // day > 0 day < 0
- // S M T W T F S S M T W T F S
- // 1 1 1 1 1 1 -5 -5 -4 -4 -4 -4
- // 1 2 2 2 2 2 2 -4 -4 -4 -3 -3 -3 -3
- // 2 3 3 3 3 3 3 -3 -3 -3 -2 -2 -2 -2
- // 3 4 4 4 4 4 4 -2 -2 -2 -1 -1 -1 -1
- // 4 5 5 -1 -1 -1
- if (week != day)
- return week < day;
-
- if (calDayOfWeek != dayOfWeek)
- return calDayOfWeek < dayOfWeek;
-
- // daylight savings starts/ends on the given day.
- break;
+ // This computes the day of month of the day of type
+ // "dayOfWeek" that lies in the same (sunday based) week as cal.
+ calDayOfMonth += (dayOfWeek - calDayOfWeek);
+
+ // Now we convert it to 7 based number (to get a one based offset
+ // after dividing by 7). If we count from the end of the
+ // month, we get want a -7 based number counting the days from
+ // the end:
+ if (day < 0)
+ calDayOfMonth -= getDaysInMonth(calMonth, calYear) + 7;
+ else
+ calDayOfMonth += 6;
+
+ // day > 0 day < 0
+ // S M T W T F S S M T W T F S
+ // 7 8 9 10 11 12 -36-35-34-33-32-31
+ // 13 14 15 16 17 18 19 -30-29-28-27-26-25-24
+ // 20 21 22 23 24 25 26 -23-22-21-20-19-18-17
+ // 27 28 29 30 31 32 33 -16-15-14-13-12-11-10
+ // 34 35 36 -9 -8 -7
+ // Now we calculate the day of week in month:
+ int week = calDayOfMonth / 7;
+
+ // day > 0 day < 0
+ // S M T W T F S S M T W T F S
+ // 1 1 1 1 1 1 -5 -5 -4 -4 -4 -4
+ // 1 2 2 2 2 2 2 -4 -4 -4 -3 -3 -3 -3
+ // 2 3 3 3 3 3 3 -3 -3 -3 -2 -2 -2 -2
+ // 3 4 4 4 4 4 4 -2 -2 -2 -1 -1 -1 -1
+ // 4 5 5 -1 -1 -1
+ if (week != day)
+ return week < day;
+
+ if (calDayOfWeek != dayOfWeek)
+ return calDayOfWeek < dayOfWeek;
+
+ // daylight savings starts/ends on the given day.
+ break;
}
case DOW_LE_DOM_MODE:
- // The greatest sunday before or equal December, 12
- // is the same as smallest sunday after or equal December, 6.
- day = Math.abs(day) - 6;
+ // The greatest sunday before or equal December, 12
+ // is the same as smallest sunday after or equal December, 6.
+ day = Math.abs(day) - 6;
case DOW_GE_DOM_MODE:
- // Calculate the day of month of the day of type
- // "dayOfWeek" that lies before (or on) the given date.
- calDayOfMonth -= (calDayOfWeek < dayOfWeek ? 7 : 0) + calDayOfWeek
- - dayOfWeek;
- if (calDayOfMonth < day)
- return true;
- if (calDayOfWeek != dayOfWeek || calDayOfMonth >= day + 7)
- return false;
-
- // now we have the same day
- break;
+ // Calculate the day of month of the day of type
+ // "dayOfWeek" that lies before (or on) the given date.
+ calDayOfMonth -= (calDayOfWeek < dayOfWeek ? 7 : 0) + calDayOfWeek
+ - dayOfWeek;
+ if (calDayOfMonth < day)
+ return true;
+ if (calDayOfWeek != dayOfWeek || calDayOfMonth >= day + 7)
+ return false;
+
+ // now we have the same day
+ break;
}
// the millis decides:
@@ -971,28 +971,28 @@ public class SimpleTimeZone extends TimeZone
input.defaultReadObject();
if (serialVersionOnStream == 0)
{
- // initialize the new fields to default values.
- dstSavings = 60 * 60 * 1000;
- endMode = DOW_IN_MONTH_MODE;
- startMode = DOW_IN_MONTH_MODE;
- startTimeMode = WALL_TIME;
- endTimeMode = WALL_TIME;
- serialVersionOnStream = 2;
+ // initialize the new fields to default values.
+ dstSavings = 60 * 60 * 1000;
+ endMode = DOW_IN_MONTH_MODE;
+ startMode = DOW_IN_MONTH_MODE;
+ startTimeMode = WALL_TIME;
+ endTimeMode = WALL_TIME;
+ serialVersionOnStream = 2;
}
else
{
- int length = input.readInt();
- byte[] byteArray = new byte[length];
- input.read(byteArray, 0, length);
- if (length >= 4)
- {
- // Lets hope that Sun does extensions to the serialized
- // form in a sane manner.
- startDay = byteArray[0];
- startDayOfWeek = byteArray[1];
- endDay = byteArray[2];
- endDayOfWeek = byteArray[3];
- }
+ int length = input.readInt();
+ byte[] byteArray = new byte[length];
+ input.read(byteArray, 0, length);
+ if (length >= 4)
+ {
+ // Lets hope that Sun does extensions to the serialized
+ // form in a sane manner.
+ startDay = byteArray[0];
+ startDayOfWeek = byteArray[1];
+ endDay = byteArray[2];
+ endDayOfWeek = byteArray[3];
+ }
}
}
@@ -1025,22 +1025,22 @@ public class SimpleTimeZone extends TimeZone
switch (startMode)
{
case DOM_MODE:
- startDayOfWeek = Calendar.SUNDAY; // random day of week
+ startDayOfWeek = Calendar.SUNDAY; // random day of week
// fall through
case DOW_GE_DOM_MODE:
case DOW_LE_DOM_MODE:
- startDay = (startDay + 6) / 7;
+ startDay = (startDay + 6) / 7;
}
switch (endMode)
{
case DOM_MODE:
- endDayOfWeek = Calendar.SUNDAY;
+ endDayOfWeek = Calendar.SUNDAY;
// fall through
case DOW_GE_DOM_MODE:
case DOW_LE_DOM_MODE:
- endDay = (endDay + 6) / 7;
+ endDay = (endDay + 6) / 7;
}
// the required part:
diff --git a/java/util/StringTokenizer.java b/java/util/StringTokenizer.java
index b230c73d8..d16ec9bc4 100644
--- a/java/util/StringTokenizer.java
+++ b/java/util/StringTokenizer.java
@@ -189,7 +189,7 @@ public class StringTokenizer implements Enumeration<Object>
int start = pos;
while (++pos < len && delim.indexOf(str.charAt(pos)) < 0)
;
-
+
return str.substring(start, pos);
}
throw new NoSuchElementException();
diff --git a/java/util/TimeZone.java b/java/util/TimeZone.java
index 4e857946c..ce59c20a6 100644
--- a/java/util/TimeZone.java
+++ b/java/util/TimeZone.java
@@ -50,7 +50,7 @@ import java.text.DateFormatSymbols;
/**
* This class represents a time zone offset and handles daylight savings.
- *
+ *
* You can get the default time zone with <code>getDefault</code>.
* This represents the time zone where program is running.
*
@@ -100,36 +100,36 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
private static synchronized TimeZone defaultZone()
{
/* Look up default timezone */
- if (defaultZone0 == null)
+ if (defaultZone0 == null)
{
- defaultZone0 = (TimeZone) AccessController.doPrivileged
- (new PrivilegedAction()
- {
- public Object run()
- {
- TimeZone zone = null;
-
- // Prefer System property user.timezone.
- String tzid = System.getProperty("user.timezone");
- if (tzid != null && !tzid.equals(""))
- zone = getDefaultTimeZone(tzid);
-
- // Try platfom specific way.
- if (zone == null)
- zone = VMTimeZone.getDefaultTimeZoneId();
-
- // Fall back on GMT.
- if (zone == null)
- zone = getTimeZone ("GMT");
-
- return zone;
- }
- });
+ defaultZone0 = (TimeZone) AccessController.doPrivileged
+ (new PrivilegedAction()
+ {
+ public Object run()
+ {
+ TimeZone zone = null;
+
+ // Prefer System property user.timezone.
+ String tzid = System.getProperty("user.timezone");
+ if (tzid != null && !tzid.equals(""))
+ zone = getDefaultTimeZone(tzid);
+
+ // Try platfom specific way.
+ if (zone == null)
+ zone = VMTimeZone.getDefaultTimeZoneId();
+
+ // Fall back on GMT.
+ if (zone == null)
+ zone = getTimeZone ("GMT");
+
+ return zone;
+ }
+ });
}
-
- return defaultZone0;
+
+ return defaultZone0;
}
-
+
private static final long serialVersionUID = 3581463369166924961L;
/**
@@ -149,756 +149,756 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
private static HashMap aliases0;
/**
- * HashMap for timezones by ID.
+ * HashMap for timezones by ID.
*/
private static HashMap timezones0;
/* initialize this static field lazily to overhead if
- * it is not needed:
+ * it is not needed:
*/
// Package-private to avoid a trampoline.
static HashMap timezones()
{
- if (timezones0 == null)
+ if (timezones0 == null)
{
- HashMap timezones = new HashMap();
- timezones0 = timezones;
-
- zoneinfo_dir = SystemProperties.getProperty("gnu.java.util.zoneinfo.dir");
- if (zoneinfo_dir != null && !new File(zoneinfo_dir).isDirectory())
- zoneinfo_dir = null;
-
- if (zoneinfo_dir != null)
- {
- aliases0 = new HashMap();
-
- // These deprecated aliases for JDK 1.1.x compatibility
- // should take precedence over data files read from
- // /usr/share/zoneinfo.
- aliases0.put("ACT", "Australia/Darwin");
- aliases0.put("AET", "Australia/Sydney");
- aliases0.put("AGT", "America/Argentina/Buenos_Aires");
- aliases0.put("ART", "Africa/Cairo");
- aliases0.put("AST", "America/Juneau");
- aliases0.put("BST", "Asia/Colombo");
- aliases0.put("CAT", "Africa/Gaborone");
- aliases0.put("CNT", "America/St_Johns");
- aliases0.put("CST", "CST6CDT");
- aliases0.put("CTT", "Asia/Brunei");
- aliases0.put("EAT", "Indian/Comoro");
- aliases0.put("ECT", "CET");
- aliases0.put("EST", "EST5EDT");
- aliases0.put("EST5", "EST5EDT");
- aliases0.put("IET", "EST5EDT");
- aliases0.put("IST", "Asia/Calcutta");
- aliases0.put("JST", "Asia/Seoul");
- aliases0.put("MIT", "Pacific/Niue");
- aliases0.put("MST", "MST7MDT");
- aliases0.put("MST7", "MST7MDT");
- aliases0.put("NET", "Indian/Mauritius");
- aliases0.put("NST", "Pacific/Auckland");
- aliases0.put("PLT", "Indian/Kerguelen");
- aliases0.put("PNT", "MST7MDT");
- aliases0.put("PRT", "America/Anguilla");
- aliases0.put("PST", "PST8PDT");
- aliases0.put("SST", "Pacific/Ponape");
- aliases0.put("VST", "Asia/Bangkok");
- return timezones;
- }
-
- TimeZone tz;
- // Automatically generated by scripts/timezones.pl
- // XXX - Should we read this data from a file?
- tz = new SimpleTimeZone(-11000 * 3600, "MIT");
- timezones0.put("MIT", tz);
- timezones0.put("Pacific/Apia", tz);
- timezones0.put("Pacific/Midway", tz);
- timezones0.put("Pacific/Niue", tz);
- timezones0.put("Pacific/Pago_Pago", tz);
- tz = new SimpleTimeZone
- (-10000 * 3600, "America/Adak",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Adak", tz);
- tz = new SimpleTimeZone(-10000 * 3600, "HST");
- timezones0.put("HST", tz);
- timezones0.put("Pacific/Fakaofo", tz);
- timezones0.put("Pacific/Honolulu", tz);
- timezones0.put("Pacific/Johnston", tz);
- timezones0.put("Pacific/Rarotonga", tz);
- timezones0.put("Pacific/Tahiti", tz);
- tz = new SimpleTimeZone(-9500 * 3600, "Pacific/Marquesas");
- timezones0.put("Pacific/Marquesas", tz);
- tz = new SimpleTimeZone
- (-9000 * 3600, "AST",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("AST", tz);
- timezones0.put("America/Anchorage", tz);
- timezones0.put("America/Juneau", tz);
- timezones0.put("America/Nome", tz);
- timezones0.put("America/Yakutat", tz);
- tz = new SimpleTimeZone(-9000 * 3600, "Pacific/Gambier");
- timezones0.put("Pacific/Gambier", tz);
- tz = new SimpleTimeZone
- (-8000 * 3600, "America/Tijuana",
- Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Tijuana", tz);
- tz = new SimpleTimeZone
- (-8000 * 3600, "PST",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("PST", tz);
- timezones0.put("PST8PDT", tz);
- timezones0.put("America/Dawson", tz);
- timezones0.put("America/Los_Angeles", tz);
- timezones0.put("America/Vancouver", tz);
- timezones0.put("America/Whitehorse", tz);
- timezones0.put("US/Pacific-New", tz);
- tz = new SimpleTimeZone(-8000 * 3600, "Pacific/Pitcairn");
- timezones0.put("Pacific/Pitcairn", tz);
- tz = new SimpleTimeZone
- (-7000 * 3600, "America/Chihuahua",
- Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Chihuahua", tz);
- timezones0.put("America/Mazatlan", tz);
- tz = new SimpleTimeZone(-7000 * 3600, "MST7");
- timezones0.put("MST7", tz);
- timezones0.put("PNT", tz);
- timezones0.put("America/Dawson_Creek", tz);
- timezones0.put("America/Hermosillo", tz);
- timezones0.put("America/Phoenix", tz);
- tz = new SimpleTimeZone
- (-7000 * 3600, "MST",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("MST", tz);
- timezones0.put("MST7MDT", tz);
- timezones0.put("America/Boise", tz);
- timezones0.put("America/Cambridge_Bay", tz);
- timezones0.put("America/Denver", tz);
- timezones0.put("America/Edmonton", tz);
- timezones0.put("America/Inuvik", tz);
- timezones0.put("America/Shiprock", tz);
- timezones0.put("America/Yellowknife", tz);
- tz = new SimpleTimeZone
- (-6000 * 3600, "America/Cancun",
- Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Cancun", tz);
- timezones0.put("America/Merida", tz);
- timezones0.put("America/Mexico_City", tz);
- timezones0.put("America/Monterrey", tz);
- tz = new SimpleTimeZone(-6000 * 3600, "America/Belize");
- timezones0.put("America/Belize", tz);
- timezones0.put("America/Costa_Rica", tz);
- timezones0.put("America/El_Salvador", tz);
- timezones0.put("America/Guatemala", tz);
- timezones0.put("America/Managua", tz);
- timezones0.put("America/Regina", tz);
- timezones0.put("America/Swift_Current", tz);
- timezones0.put("America/Tegucigalpa", tz);
- timezones0.put("Pacific/Galapagos", tz);
- tz = new SimpleTimeZone
- (-6000 * 3600, "CST",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("CST", tz);
- timezones0.put("CST6CDT", tz);
- timezones0.put("America/Chicago", tz);
- timezones0.put("America/Indiana/Knox", tz);
- timezones0.put("America/Indiana/Petersburg", tz);
- timezones0.put("America/Indiana/Vincennes", tz);
- timezones0.put("America/Menominee", tz);
- timezones0.put("America/North_Dakota/Center", tz);
- timezones0.put("America/North_Dakota/New_Salem", tz);
- timezones0.put("America/Rainy_River", tz);
- timezones0.put("America/Rankin_Inlet", tz);
- timezones0.put("America/Winnipeg", tz);
- tz = new SimpleTimeZone
- (-6000 * 3600, "Pacific/Easter",
- Calendar.OCTOBER, 2, Calendar.SATURDAY, 22000 * 3600,
- Calendar.MARCH, 2, Calendar.SATURDAY, 22000 * 3600);
- timezones0.put("Pacific/Easter", tz);
- tz = new SimpleTimeZone(-5000 * 3600, "EST5");
- timezones0.put("EST5", tz);
- timezones0.put("IET", tz);
- timezones0.put("America/Atikokan", tz);
- timezones0.put("America/Bogota", tz);
- timezones0.put("America/Cayman", tz);
- timezones0.put("America/Eirunepe", tz);
- timezones0.put("America/Guayaquil", tz);
- timezones0.put("America/Jamaica", tz);
- timezones0.put("America/Lima", tz);
- timezones0.put("America/Panama", tz);
- timezones0.put("America/Rio_Branco", tz);
- tz = new SimpleTimeZone
- (-5000 * 3600, "America/Havana",
- Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
- timezones0.put("America/Havana", tz);
- tz = new SimpleTimeZone
- (-5000 * 3600, "America/Grand_Turk",
- Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("America/Grand_Turk", tz);
- timezones0.put("America/Port-au-Prince", tz);
- tz = new SimpleTimeZone
- (-5000 * 3600, "EST",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("EST", tz);
- timezones0.put("EST5EDT", tz);
- timezones0.put("America/Detroit", tz);
- timezones0.put("America/Indiana/Indianapolis", tz);
- timezones0.put("America/Indiana/Marengo", tz);
- timezones0.put("America/Indiana/Vevay", tz);
- timezones0.put("America/Iqaluit", tz);
- timezones0.put("America/Kentucky/Louisville", tz);
- timezones0.put("America/Kentucky/Monticello", tz);
- timezones0.put("America/Montreal", tz);
- timezones0.put("America/Nassau", tz);
- timezones0.put("America/New_York", tz);
- timezones0.put("America/Nipigon", tz);
- timezones0.put("America/Pangnirtung", tz);
- timezones0.put("America/Thunder_Bay", tz);
- timezones0.put("America/Toronto", tz);
- tz = new SimpleTimeZone
- (-4000 * 3600, "America/Asuncion",
- Calendar.OCTOBER, 3, Calendar.SUNDAY, 0 * 3600,
- Calendar.MARCH, 2, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("America/Asuncion", tz);
- tz = new SimpleTimeZone(-4000 * 3600, "PRT");
- timezones0.put("PRT", tz);
- timezones0.put("America/Anguilla", tz);
- timezones0.put("America/Antigua", tz);
- timezones0.put("America/Aruba", tz);
- timezones0.put("America/Barbados", tz);
- timezones0.put("America/Blanc-Sablon", tz);
- timezones0.put("America/Boa_Vista", tz);
- timezones0.put("America/Caracas", tz);
- timezones0.put("America/Curacao", tz);
- timezones0.put("America/Dominica", tz);
- timezones0.put("America/Grenada", tz);
- timezones0.put("America/Guadeloupe", tz);
- timezones0.put("America/Guyana", tz);
- timezones0.put("America/La_Paz", tz);
- timezones0.put("America/Manaus", tz);
- timezones0.put("America/Martinique", tz);
- timezones0.put("America/Montserrat", tz);
- timezones0.put("America/Port_of_Spain", tz);
- timezones0.put("America/Porto_Velho", tz);
- timezones0.put("America/Puerto_Rico", tz);
- timezones0.put("America/Santo_Domingo", tz);
- timezones0.put("America/St_Kitts", tz);
- timezones0.put("America/St_Lucia", tz);
- timezones0.put("America/St_Thomas", tz);
- timezones0.put("America/St_Vincent", tz);
- timezones0.put("America/Tortola", tz);
- tz = new SimpleTimeZone
- (-4000 * 3600, "America/Campo_Grande",
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 0 * 3600,
- Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("America/Campo_Grande", tz);
- timezones0.put("America/Cuiaba", tz);
- tz = new SimpleTimeZone
- (-4000 * 3600, "America/Goose_Bay",
- Calendar.MARCH, 2, Calendar.SUNDAY, 60000,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 60000);
- timezones0.put("America/Goose_Bay", tz);
- tz = new SimpleTimeZone
- (-4000 * 3600, "America/Glace_Bay",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Glace_Bay", tz);
- timezones0.put("America/Halifax", tz);
- timezones0.put("America/Moncton", tz);
- timezones0.put("America/Thule", tz);
- timezones0.put("Atlantic/Bermuda", tz);
- tz = new SimpleTimeZone
- (-4000 * 3600, "America/Santiago",
- Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
- Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
- timezones0.put("America/Santiago", tz);
- timezones0.put("Antarctica/Palmer", tz);
- tz = new SimpleTimeZone
- (-4000 * 3600, "Atlantic/Stanley",
- Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.APRIL, 3, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("Atlantic/Stanley", tz);
- tz = new SimpleTimeZone
- (-3500 * 3600, "CNT",
- Calendar.MARCH, 2, Calendar.SUNDAY, 60000,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 60000);
- timezones0.put("CNT", tz);
- timezones0.put("America/St_Johns", tz);
- tz = new SimpleTimeZone
- (-3000 * 3600, "America/Godthab",
- Calendar.MARCH, 30, -Calendar.SATURDAY, 22000 * 3600,
- Calendar.OCTOBER, 30, -Calendar.SATURDAY, 23000 * 3600);
- timezones0.put("America/Godthab", tz);
- tz = new SimpleTimeZone
- (-3000 * 3600, "America/Miquelon",
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Miquelon", tz);
- tz = new SimpleTimeZone
- (-3000 * 3600, "America/Montevideo",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("America/Montevideo", tz);
- tz = new SimpleTimeZone
- (-3000 * 3600, "America/Sao_Paulo",
- Calendar.NOVEMBER, 1, Calendar.SUNDAY, 0 * 3600,
- Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("America/Sao_Paulo", tz);
- tz = new SimpleTimeZone(-3000 * 3600, "AGT");
- timezones0.put("AGT", tz);
- timezones0.put("America/Araguaina", tz);
- timezones0.put("America/Argentina/Buenos_Aires", tz);
- timezones0.put("America/Argentina/Catamarca", tz);
- timezones0.put("America/Argentina/Cordoba", tz);
- timezones0.put("America/Argentina/Jujuy", tz);
- timezones0.put("America/Argentina/La_Rioja", tz);
- timezones0.put("America/Argentina/Mendoza", tz);
- timezones0.put("America/Argentina/Rio_Gallegos", tz);
- timezones0.put("America/Argentina/San_Juan", tz);
- timezones0.put("America/Argentina/Tucuman", tz);
- timezones0.put("America/Argentina/Ushuaia", tz);
- timezones0.put("America/Bahia", tz);
- timezones0.put("America/Belem", tz);
- timezones0.put("America/Cayenne", tz);
- timezones0.put("America/Fortaleza", tz);
- timezones0.put("America/Maceio", tz);
- timezones0.put("America/Paramaribo", tz);
- timezones0.put("America/Recife", tz);
- timezones0.put("Antarctica/Rothera", tz);
- tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
- timezones0.put("America/Noronha", tz);
- timezones0.put("Atlantic/South_Georgia", tz);
- tz = new SimpleTimeZone
- (-1000 * 3600, "America/Scoresbysund",
- Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
- timezones0.put("America/Scoresbysund", tz);
- timezones0.put("Atlantic/Azores", tz);
- tz = new SimpleTimeZone(-1000 * 3600, "Atlantic/Cape_Verde");
- timezones0.put("Atlantic/Cape_Verde", tz);
- tz = new SimpleTimeZone(0 * 3600, "GMT");
- timezones0.put("GMT", tz);
- timezones0.put("UTC", tz);
- timezones0.put("Africa/Abidjan", tz);
- timezones0.put("Africa/Accra", tz);
- timezones0.put("Africa/Bamako", tz);
- timezones0.put("Africa/Banjul", tz);
- timezones0.put("Africa/Bissau", tz);
- timezones0.put("Africa/Casablanca", tz);
- timezones0.put("Africa/Conakry", tz);
- timezones0.put("Africa/Dakar", tz);
- timezones0.put("Africa/El_Aaiun", tz);
- timezones0.put("Africa/Freetown", tz);
- timezones0.put("Africa/Lome", tz);
- timezones0.put("Africa/Monrovia", tz);
- timezones0.put("Africa/Nouakchott", tz);
- timezones0.put("Africa/Ouagadougou", tz);
- timezones0.put("Africa/Sao_Tome", tz);
- timezones0.put("America/Danmarkshavn", tz);
- timezones0.put("Atlantic/Reykjavik", tz);
- timezones0.put("Atlantic/St_Helena", tz);
- tz = new SimpleTimeZone
- (0 * 3600, "WET",
- Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("WET", tz);
- timezones0.put("Atlantic/Canary", tz);
- timezones0.put("Atlantic/Faroe", tz);
- timezones0.put("Atlantic/Madeira", tz);
- timezones0.put("Europe/Dublin", tz);
- timezones0.put("Europe/Guernsey", tz);
- timezones0.put("Europe/Isle_of_Man", tz);
- timezones0.put("Europe/Jersey", tz);
- timezones0.put("Europe/Lisbon", tz);
- timezones0.put("Europe/London", tz);
- tz = new SimpleTimeZone(1000 * 3600, "Africa/Algiers");
- timezones0.put("Africa/Algiers", tz);
- timezones0.put("Africa/Bangui", tz);
- timezones0.put("Africa/Brazzaville", tz);
- timezones0.put("Africa/Douala", tz);
- timezones0.put("Africa/Kinshasa", tz);
- timezones0.put("Africa/Lagos", tz);
- timezones0.put("Africa/Libreville", tz);
- timezones0.put("Africa/Luanda", tz);
- timezones0.put("Africa/Malabo", tz);
- timezones0.put("Africa/Ndjamena", tz);
- timezones0.put("Africa/Niamey", tz);
- timezones0.put("Africa/Porto-Novo", tz);
- tz = new SimpleTimeZone
- (1000 * 3600, "Africa/Windhoek",
- Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600);
- timezones0.put("Africa/Windhoek", tz);
- tz = new SimpleTimeZone
- (1000 * 3600, "CET",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("CET", tz);
- timezones0.put("ECT", tz);
- timezones0.put("MET", tz);
- timezones0.put("Africa/Ceuta", tz);
- timezones0.put("Africa/Tunis", tz);
- timezones0.put("Arctic/Longyearbyen", tz);
- timezones0.put("Atlantic/Jan_Mayen", tz);
- timezones0.put("Europe/Amsterdam", tz);
- timezones0.put("Europe/Andorra", tz);
- timezones0.put("Europe/Belgrade", tz);
- timezones0.put("Europe/Berlin", tz);
- timezones0.put("Europe/Bratislava", tz);
- timezones0.put("Europe/Brussels", tz);
- timezones0.put("Europe/Budapest", tz);
- timezones0.put("Europe/Copenhagen", tz);
- timezones0.put("Europe/Gibraltar", tz);
- timezones0.put("Europe/Ljubljana", tz);
- timezones0.put("Europe/Luxembourg", tz);
- timezones0.put("Europe/Madrid", tz);
- timezones0.put("Europe/Malta", tz);
- timezones0.put("Europe/Monaco", tz);
- timezones0.put("Europe/Oslo", tz);
- timezones0.put("Europe/Paris", tz);
- timezones0.put("Europe/Podgorica", tz);
- timezones0.put("Europe/Prague", tz);
- timezones0.put("Europe/Rome", tz);
- timezones0.put("Europe/San_Marino", tz);
- timezones0.put("Europe/Sarajevo", tz);
- timezones0.put("Europe/Skopje", tz);
- timezones0.put("Europe/Stockholm", tz);
- timezones0.put("Europe/Tirane", tz);
- timezones0.put("Europe/Vaduz", tz);
- timezones0.put("Europe/Vatican", tz);
- timezones0.put("Europe/Vienna", tz);
- timezones0.put("Europe/Warsaw", tz);
- timezones0.put("Europe/Zagreb", tz);
- timezones0.put("Europe/Zurich", tz);
- tz = new SimpleTimeZone
- (2000 * 3600, "ART",
- Calendar.APRIL, -1, Calendar.FRIDAY, 0 * 3600,
- Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 24000 * 3600);
- timezones0.put("ART", tz);
- timezones0.put("Africa/Cairo", tz);
- tz = new SimpleTimeZone(2000 * 3600, "CAT");
- timezones0.put("CAT", tz);
- timezones0.put("Africa/Blantyre", tz);
- timezones0.put("Africa/Bujumbura", tz);
- timezones0.put("Africa/Gaborone", tz);
- timezones0.put("Africa/Harare", tz);
- timezones0.put("Africa/Johannesburg", tz);
- timezones0.put("Africa/Kigali", tz);
- timezones0.put("Africa/Lubumbashi", tz);
- timezones0.put("Africa/Lusaka", tz);
- timezones0.put("Africa/Maputo", tz);
- timezones0.put("Africa/Maseru", tz);
- timezones0.put("Africa/Mbabane", tz);
- timezones0.put("Africa/Tripoli", tz);
- timezones0.put("Asia/Jerusalem", tz);
- tz = new SimpleTimeZone
- (2000 * 3600, "Asia/Amman",
- Calendar.MARCH, -1, Calendar.THURSDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.FRIDAY, 1000 * 3600);
- timezones0.put("Asia/Amman", tz);
- tz = new SimpleTimeZone
- (2000 * 3600, "Asia/Beirut",
- Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
- timezones0.put("Asia/Beirut", tz);
- tz = new SimpleTimeZone
- (2000 * 3600, "Asia/Damascus",
- Calendar.APRIL, 1, 0, 0 * 3600,
- Calendar.OCTOBER, 1, 0, 0 * 3600);
- timezones0.put("Asia/Damascus", tz);
- tz = new SimpleTimeZone
- (2000 * 3600, "Asia/Gaza",
- Calendar.APRIL, 1, 0, 0 * 3600,
- Calendar.OCTOBER, 3, Calendar.FRIDAY, 0 * 3600);
- timezones0.put("Asia/Gaza", tz);
- tz = new SimpleTimeZone
- (2000 * 3600, "EET",
- Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 4000 * 3600);
- timezones0.put("EET", tz);
- timezones0.put("Asia/Istanbul", tz);
- timezones0.put("Asia/Nicosia", tz);
- timezones0.put("Europe/Athens", tz);
- timezones0.put("Europe/Bucharest", tz);
- timezones0.put("Europe/Chisinau", tz);
- timezones0.put("Europe/Helsinki", tz);
- timezones0.put("Europe/Istanbul", tz);
- timezones0.put("Europe/Kiev", tz);
- timezones0.put("Europe/Mariehamn", tz);
- timezones0.put("Europe/Nicosia", tz);
- timezones0.put("Europe/Riga", tz);
- timezones0.put("Europe/Simferopol", tz);
- timezones0.put("Europe/Sofia", tz);
- timezones0.put("Europe/Tallinn", tz);
- timezones0.put("Europe/Uzhgorod", tz);
- timezones0.put("Europe/Vilnius", tz);
- timezones0.put("Europe/Zaporozhye", tz);
- tz = new SimpleTimeZone
- (2000 * 3600, "Europe/Kaliningrad",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Europe/Kaliningrad", tz);
- timezones0.put("Europe/Minsk", tz);
- tz = new SimpleTimeZone
- (3000 * 3600, "Asia/Baghdad",
- Calendar.APRIL, 1, 0, 3000 * 3600,
- Calendar.OCTOBER, 1, 0, 4000 * 3600);
- timezones0.put("Asia/Baghdad", tz);
- tz = new SimpleTimeZone
- (3000 * 3600, "Europe/Moscow",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Europe/Moscow", tz);
- timezones0.put("Europe/Volgograd", tz);
- tz = new SimpleTimeZone(3000 * 3600, "EAT");
- timezones0.put("EAT", tz);
- timezones0.put("Africa/Addis_Ababa", tz);
- timezones0.put("Africa/Asmara", tz);
- timezones0.put("Africa/Dar_es_Salaam", tz);
- timezones0.put("Africa/Djibouti", tz);
- timezones0.put("Africa/Kampala", tz);
- timezones0.put("Africa/Khartoum", tz);
- timezones0.put("Africa/Mogadishu", tz);
- timezones0.put("Africa/Nairobi", tz);
- timezones0.put("Antarctica/Syowa", tz);
- timezones0.put("Asia/Aden", tz);
- timezones0.put("Asia/Bahrain", tz);
- timezones0.put("Asia/Kuwait", tz);
- timezones0.put("Asia/Qatar", tz);
- timezones0.put("Asia/Riyadh", tz);
- timezones0.put("Indian/Antananarivo", tz);
- timezones0.put("Indian/Comoro", tz);
- timezones0.put("Indian/Mayotte", tz);
- tz = new SimpleTimeZone(3500 * 3600, "Asia/Tehran");
- timezones0.put("Asia/Tehran", tz);
- tz = new SimpleTimeZone
- (4000 * 3600, "Asia/Baku",
- Calendar.MARCH, -1, Calendar.SUNDAY, 4000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 5000 * 3600);
- timezones0.put("Asia/Baku", tz);
- tz = new SimpleTimeZone
- (4000 * 3600, "Asia/Yerevan",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Yerevan", tz);
- timezones0.put("Europe/Samara", tz);
- tz = new SimpleTimeZone(4000 * 3600, "NET");
- timezones0.put("NET", tz);
- timezones0.put("Asia/Dubai", tz);
- timezones0.put("Asia/Muscat", tz);
- timezones0.put("Asia/Tbilisi", tz);
- timezones0.put("Indian/Mahe", tz);
- timezones0.put("Indian/Mauritius", tz);
- timezones0.put("Indian/Reunion", tz);
- tz = new SimpleTimeZone(4500 * 3600, "Asia/Kabul");
- timezones0.put("Asia/Kabul", tz);
- tz = new SimpleTimeZone
- (5000 * 3600, "Asia/Yekaterinburg",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Yekaterinburg", tz);
- tz = new SimpleTimeZone(5000 * 3600, "PLT");
- timezones0.put("PLT", tz);
- timezones0.put("Asia/Aqtau", tz);
- timezones0.put("Asia/Aqtobe", tz);
- timezones0.put("Asia/Ashgabat", tz);
- timezones0.put("Asia/Dushanbe", tz);
- timezones0.put("Asia/Karachi", tz);
- timezones0.put("Asia/Oral", tz);
- timezones0.put("Asia/Samarkand", tz);
- timezones0.put("Asia/Tashkent", tz);
- timezones0.put("Indian/Kerguelen", tz);
- timezones0.put("Indian/Maldives", tz);
- tz = new SimpleTimeZone(5500 * 3600, "BST");
- timezones0.put("BST", tz);
- timezones0.put("IST", tz);
- timezones0.put("Asia/Calcutta", tz);
- timezones0.put("Asia/Colombo", tz);
- tz = new SimpleTimeZone(5750 * 3600, "Asia/Katmandu");
- timezones0.put("Asia/Katmandu", tz);
- tz = new SimpleTimeZone(6000 * 3600, "Antarctica/Mawson");
- timezones0.put("Antarctica/Mawson", tz);
- timezones0.put("Antarctica/Vostok", tz);
- timezones0.put("Asia/Almaty", tz);
- timezones0.put("Asia/Bishkek", tz);
- timezones0.put("Asia/Dhaka", tz);
- timezones0.put("Asia/Qyzylorda", tz);
- timezones0.put("Asia/Thimphu", tz);
- timezones0.put("Indian/Chagos", tz);
- tz = new SimpleTimeZone
- (6000 * 3600, "Asia/Novosibirsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Novosibirsk", tz);
- timezones0.put("Asia/Omsk", tz);
- tz = new SimpleTimeZone(6500 * 3600, "Asia/Rangoon");
- timezones0.put("Asia/Rangoon", tz);
- timezones0.put("Indian/Cocos", tz);
- tz = new SimpleTimeZone(7000 * 3600, "VST");
- timezones0.put("VST", tz);
- timezones0.put("Antarctica/Davis", tz);
- timezones0.put("Asia/Bangkok", tz);
- timezones0.put("Asia/Jakarta", tz);
- timezones0.put("Asia/Phnom_Penh", tz);
- timezones0.put("Asia/Pontianak", tz);
- timezones0.put("Asia/Saigon", tz);
- timezones0.put("Asia/Vientiane", tz);
- timezones0.put("Indian/Christmas", tz);
- tz = new SimpleTimeZone
- (7000 * 3600, "Asia/Hovd",
- Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
- Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
- timezones0.put("Asia/Hovd", tz);
- tz = new SimpleTimeZone
- (7000 * 3600, "Asia/Krasnoyarsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Krasnoyarsk", tz);
- tz = new SimpleTimeZone(8000 * 3600, "CTT");
- timezones0.put("CTT", tz);
- timezones0.put("Antarctica/Casey", tz);
- timezones0.put("Asia/Brunei", tz);
- timezones0.put("Asia/Chongqing", tz);
- timezones0.put("Asia/Harbin", tz);
- timezones0.put("Asia/Hong_Kong", tz);
- timezones0.put("Asia/Kashgar", tz);
- timezones0.put("Asia/Kuala_Lumpur", tz);
- timezones0.put("Asia/Kuching", tz);
- timezones0.put("Asia/Macau", tz);
- timezones0.put("Asia/Makassar", tz);
- timezones0.put("Asia/Manila", tz);
- timezones0.put("Asia/Shanghai", tz);
- timezones0.put("Asia/Singapore", tz);
- timezones0.put("Asia/Taipei", tz);
- timezones0.put("Asia/Urumqi", tz);
- timezones0.put("Australia/Perth", tz);
- tz = new SimpleTimeZone
- (8000 * 3600, "Asia/Irkutsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Irkutsk", tz);
- tz = new SimpleTimeZone
- (8000 * 3600, "Asia/Ulaanbaatar",
- Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
- Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
- timezones0.put("Asia/Ulaanbaatar", tz);
- tz = new SimpleTimeZone(8750 * 3600, "Australia/Eucla");
- timezones0.put("Australia/Eucla", tz);
- tz = new SimpleTimeZone
- (9000 * 3600, "Asia/Choibalsan",
- Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
- Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
- timezones0.put("Asia/Choibalsan", tz);
- tz = new SimpleTimeZone(9000 * 3600, "JST");
- timezones0.put("JST", tz);
- timezones0.put("Asia/Dili", tz);
- timezones0.put("Asia/Jayapura", tz);
- timezones0.put("Asia/Pyongyang", tz);
- timezones0.put("Asia/Seoul", tz);
- timezones0.put("Asia/Tokyo", tz);
- timezones0.put("Pacific/Palau", tz);
- tz = new SimpleTimeZone
- (9000 * 3600, "Asia/Yakutsk",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Yakutsk", tz);
- tz = new SimpleTimeZone
- (9500 * 3600, "Australia/Adelaide",
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Australia/Adelaide", tz);
- timezones0.put("Australia/Broken_Hill", tz);
- tz = new SimpleTimeZone(9500 * 3600, "ACT");
- timezones0.put("ACT", tz);
- timezones0.put("Australia/Darwin", tz);
- tz = new SimpleTimeZone(10000 * 3600, "Antarctica/DumontDUrville");
- timezones0.put("Antarctica/DumontDUrville", tz);
- timezones0.put("Australia/Brisbane", tz);
- timezones0.put("Australia/Lindeman", tz);
- timezones0.put("Pacific/Guam", tz);
- timezones0.put("Pacific/Port_Moresby", tz);
- timezones0.put("Pacific/Saipan", tz);
- timezones0.put("Pacific/Truk", tz);
- tz = new SimpleTimeZone
- (10000 * 3600, "Asia/Sakhalin",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Sakhalin", tz);
- timezones0.put("Asia/Vladivostok", tz);
- tz = new SimpleTimeZone
- (10000 * 3600, "Australia/Currie",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Australia/Currie", tz);
- timezones0.put("Australia/Hobart", tz);
- tz = new SimpleTimeZone
- (10000 * 3600, "AET",
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("AET", tz);
- timezones0.put("Australia/Melbourne", tz);
- timezones0.put("Australia/Sydney", tz);
- tz = new SimpleTimeZone
- (10500 * 3600, "Australia/Lord_Howe",
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600, 500 * 3600);
- timezones0.put("Australia/Lord_Howe", tz);
- tz = new SimpleTimeZone
- (11000 * 3600, "Asia/Magadan",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Magadan", tz);
- tz = new SimpleTimeZone(11000 * 3600, "SST");
- timezones0.put("SST", tz);
- timezones0.put("Pacific/Efate", tz);
- timezones0.put("Pacific/Guadalcanal", tz);
- timezones0.put("Pacific/Kosrae", tz);
- timezones0.put("Pacific/Noumea", tz);
- timezones0.put("Pacific/Ponape", tz);
- tz = new SimpleTimeZone(11500 * 3600, "Pacific/Norfolk");
- timezones0.put("Pacific/Norfolk", tz);
- tz = new SimpleTimeZone
- (12000 * 3600, "NST",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.MARCH, 3, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("NST", tz);
- timezones0.put("Antarctica/McMurdo", tz);
- timezones0.put("Antarctica/South_Pole", tz);
- timezones0.put("Pacific/Auckland", tz);
- tz = new SimpleTimeZone
- (12000 * 3600, "Asia/Anadyr",
- Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
- Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
- timezones0.put("Asia/Anadyr", tz);
- timezones0.put("Asia/Kamchatka", tz);
- tz = new SimpleTimeZone(12000 * 3600, "Pacific/Fiji");
- timezones0.put("Pacific/Fiji", tz);
- timezones0.put("Pacific/Funafuti", tz);
- timezones0.put("Pacific/Kwajalein", tz);
- timezones0.put("Pacific/Majuro", tz);
- timezones0.put("Pacific/Nauru", tz);
- timezones0.put("Pacific/Tarawa", tz);
- timezones0.put("Pacific/Wake", tz);
- timezones0.put("Pacific/Wallis", tz);
- tz = new SimpleTimeZone
- (12750 * 3600, "Pacific/Chatham",
- Calendar.OCTOBER, 1, Calendar.SUNDAY, 2750 * 3600,
- Calendar.MARCH, 3, Calendar.SUNDAY, 3750 * 3600);
- timezones0.put("Pacific/Chatham", tz);
- tz = new SimpleTimeZone(13000 * 3600, "Pacific/Enderbury");
- timezones0.put("Pacific/Enderbury", tz);
- timezones0.put("Pacific/Tongatapu", tz);
- tz = new SimpleTimeZone(14000 * 3600, "Pacific/Kiritimati");
- timezones0.put("Pacific/Kiritimati", tz);
+ HashMap timezones = new HashMap();
+ timezones0 = timezones;
+
+ zoneinfo_dir = SystemProperties.getProperty("gnu.java.util.zoneinfo.dir");
+ if (zoneinfo_dir != null && !new File(zoneinfo_dir).isDirectory())
+ zoneinfo_dir = null;
+
+ if (zoneinfo_dir != null)
+ {
+ aliases0 = new HashMap();
+
+ // These deprecated aliases for JDK 1.1.x compatibility
+ // should take precedence over data files read from
+ // /usr/share/zoneinfo.
+ aliases0.put("ACT", "Australia/Darwin");
+ aliases0.put("AET", "Australia/Sydney");
+ aliases0.put("AGT", "America/Argentina/Buenos_Aires");
+ aliases0.put("ART", "Africa/Cairo");
+ aliases0.put("AST", "America/Juneau");
+ aliases0.put("BST", "Asia/Colombo");
+ aliases0.put("CAT", "Africa/Gaborone");
+ aliases0.put("CNT", "America/St_Johns");
+ aliases0.put("CST", "CST6CDT");
+ aliases0.put("CTT", "Asia/Brunei");
+ aliases0.put("EAT", "Indian/Comoro");
+ aliases0.put("ECT", "CET");
+ aliases0.put("EST", "EST5EDT");
+ aliases0.put("EST5", "EST5EDT");
+ aliases0.put("IET", "EST5EDT");
+ aliases0.put("IST", "Asia/Calcutta");
+ aliases0.put("JST", "Asia/Seoul");
+ aliases0.put("MIT", "Pacific/Niue");
+ aliases0.put("MST", "MST7MDT");
+ aliases0.put("MST7", "MST7MDT");
+ aliases0.put("NET", "Indian/Mauritius");
+ aliases0.put("NST", "Pacific/Auckland");
+ aliases0.put("PLT", "Indian/Kerguelen");
+ aliases0.put("PNT", "MST7MDT");
+ aliases0.put("PRT", "America/Anguilla");
+ aliases0.put("PST", "PST8PDT");
+ aliases0.put("SST", "Pacific/Ponape");
+ aliases0.put("VST", "Asia/Bangkok");
+ return timezones;
+ }
+
+ TimeZone tz;
+ // Automatically generated by scripts/timezones.pl
+ // XXX - Should we read this data from a file?
+ tz = new SimpleTimeZone(-11000 * 3600, "MIT");
+ timezones0.put("MIT", tz);
+ timezones0.put("Pacific/Apia", tz);
+ timezones0.put("Pacific/Midway", tz);
+ timezones0.put("Pacific/Niue", tz);
+ timezones0.put("Pacific/Pago_Pago", tz);
+ tz = new SimpleTimeZone
+ (-10000 * 3600, "America/Adak",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Adak", tz);
+ tz = new SimpleTimeZone(-10000 * 3600, "HST");
+ timezones0.put("HST", tz);
+ timezones0.put("Pacific/Fakaofo", tz);
+ timezones0.put("Pacific/Honolulu", tz);
+ timezones0.put("Pacific/Johnston", tz);
+ timezones0.put("Pacific/Rarotonga", tz);
+ timezones0.put("Pacific/Tahiti", tz);
+ tz = new SimpleTimeZone(-9500 * 3600, "Pacific/Marquesas");
+ timezones0.put("Pacific/Marquesas", tz);
+ tz = new SimpleTimeZone
+ (-9000 * 3600, "AST",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("AST", tz);
+ timezones0.put("America/Anchorage", tz);
+ timezones0.put("America/Juneau", tz);
+ timezones0.put("America/Nome", tz);
+ timezones0.put("America/Yakutat", tz);
+ tz = new SimpleTimeZone(-9000 * 3600, "Pacific/Gambier");
+ timezones0.put("Pacific/Gambier", tz);
+ tz = new SimpleTimeZone
+ (-8000 * 3600, "America/Tijuana",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Tijuana", tz);
+ tz = new SimpleTimeZone
+ (-8000 * 3600, "PST",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("PST", tz);
+ timezones0.put("PST8PDT", tz);
+ timezones0.put("America/Dawson", tz);
+ timezones0.put("America/Los_Angeles", tz);
+ timezones0.put("America/Vancouver", tz);
+ timezones0.put("America/Whitehorse", tz);
+ timezones0.put("US/Pacific-New", tz);
+ tz = new SimpleTimeZone(-8000 * 3600, "Pacific/Pitcairn");
+ timezones0.put("Pacific/Pitcairn", tz);
+ tz = new SimpleTimeZone
+ (-7000 * 3600, "America/Chihuahua",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Chihuahua", tz);
+ timezones0.put("America/Mazatlan", tz);
+ tz = new SimpleTimeZone(-7000 * 3600, "MST7");
+ timezones0.put("MST7", tz);
+ timezones0.put("PNT", tz);
+ timezones0.put("America/Dawson_Creek", tz);
+ timezones0.put("America/Hermosillo", tz);
+ timezones0.put("America/Phoenix", tz);
+ tz = new SimpleTimeZone
+ (-7000 * 3600, "MST",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("MST", tz);
+ timezones0.put("MST7MDT", tz);
+ timezones0.put("America/Boise", tz);
+ timezones0.put("America/Cambridge_Bay", tz);
+ timezones0.put("America/Denver", tz);
+ timezones0.put("America/Edmonton", tz);
+ timezones0.put("America/Inuvik", tz);
+ timezones0.put("America/Shiprock", tz);
+ timezones0.put("America/Yellowknife", tz);
+ tz = new SimpleTimeZone
+ (-6000 * 3600, "America/Cancun",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Cancun", tz);
+ timezones0.put("America/Merida", tz);
+ timezones0.put("America/Mexico_City", tz);
+ timezones0.put("America/Monterrey", tz);
+ tz = new SimpleTimeZone(-6000 * 3600, "America/Belize");
+ timezones0.put("America/Belize", tz);
+ timezones0.put("America/Costa_Rica", tz);
+ timezones0.put("America/El_Salvador", tz);
+ timezones0.put("America/Guatemala", tz);
+ timezones0.put("America/Managua", tz);
+ timezones0.put("America/Regina", tz);
+ timezones0.put("America/Swift_Current", tz);
+ timezones0.put("America/Tegucigalpa", tz);
+ timezones0.put("Pacific/Galapagos", tz);
+ tz = new SimpleTimeZone
+ (-6000 * 3600, "CST",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("CST", tz);
+ timezones0.put("CST6CDT", tz);
+ timezones0.put("America/Chicago", tz);
+ timezones0.put("America/Indiana/Knox", tz);
+ timezones0.put("America/Indiana/Petersburg", tz);
+ timezones0.put("America/Indiana/Vincennes", tz);
+ timezones0.put("America/Menominee", tz);
+ timezones0.put("America/North_Dakota/Center", tz);
+ timezones0.put("America/North_Dakota/New_Salem", tz);
+ timezones0.put("America/Rainy_River", tz);
+ timezones0.put("America/Rankin_Inlet", tz);
+ timezones0.put("America/Winnipeg", tz);
+ tz = new SimpleTimeZone
+ (-6000 * 3600, "Pacific/Easter",
+ Calendar.OCTOBER, 2, Calendar.SATURDAY, 22000 * 3600,
+ Calendar.MARCH, 2, Calendar.SATURDAY, 22000 * 3600);
+ timezones0.put("Pacific/Easter", tz);
+ tz = new SimpleTimeZone(-5000 * 3600, "EST5");
+ timezones0.put("EST5", tz);
+ timezones0.put("IET", tz);
+ timezones0.put("America/Atikokan", tz);
+ timezones0.put("America/Bogota", tz);
+ timezones0.put("America/Cayman", tz);
+ timezones0.put("America/Eirunepe", tz);
+ timezones0.put("America/Guayaquil", tz);
+ timezones0.put("America/Jamaica", tz);
+ timezones0.put("America/Lima", tz);
+ timezones0.put("America/Panama", tz);
+ timezones0.put("America/Rio_Branco", tz);
+ tz = new SimpleTimeZone
+ (-5000 * 3600, "America/Havana",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
+ timezones0.put("America/Havana", tz);
+ tz = new SimpleTimeZone
+ (-5000 * 3600, "America/Grand_Turk",
+ Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("America/Grand_Turk", tz);
+ timezones0.put("America/Port-au-Prince", tz);
+ tz = new SimpleTimeZone
+ (-5000 * 3600, "EST",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("EST", tz);
+ timezones0.put("EST5EDT", tz);
+ timezones0.put("America/Detroit", tz);
+ timezones0.put("America/Indiana/Indianapolis", tz);
+ timezones0.put("America/Indiana/Marengo", tz);
+ timezones0.put("America/Indiana/Vevay", tz);
+ timezones0.put("America/Iqaluit", tz);
+ timezones0.put("America/Kentucky/Louisville", tz);
+ timezones0.put("America/Kentucky/Monticello", tz);
+ timezones0.put("America/Montreal", tz);
+ timezones0.put("America/Nassau", tz);
+ timezones0.put("America/New_York", tz);
+ timezones0.put("America/Nipigon", tz);
+ timezones0.put("America/Pangnirtung", tz);
+ timezones0.put("America/Thunder_Bay", tz);
+ timezones0.put("America/Toronto", tz);
+ tz = new SimpleTimeZone
+ (-4000 * 3600, "America/Asuncion",
+ Calendar.OCTOBER, 3, Calendar.SUNDAY, 0 * 3600,
+ Calendar.MARCH, 2, Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("America/Asuncion", tz);
+ tz = new SimpleTimeZone(-4000 * 3600, "PRT");
+ timezones0.put("PRT", tz);
+ timezones0.put("America/Anguilla", tz);
+ timezones0.put("America/Antigua", tz);
+ timezones0.put("America/Aruba", tz);
+ timezones0.put("America/Barbados", tz);
+ timezones0.put("America/Blanc-Sablon", tz);
+ timezones0.put("America/Boa_Vista", tz);
+ timezones0.put("America/Caracas", tz);
+ timezones0.put("America/Curacao", tz);
+ timezones0.put("America/Dominica", tz);
+ timezones0.put("America/Grenada", tz);
+ timezones0.put("America/Guadeloupe", tz);
+ timezones0.put("America/Guyana", tz);
+ timezones0.put("America/La_Paz", tz);
+ timezones0.put("America/Manaus", tz);
+ timezones0.put("America/Martinique", tz);
+ timezones0.put("America/Montserrat", tz);
+ timezones0.put("America/Port_of_Spain", tz);
+ timezones0.put("America/Porto_Velho", tz);
+ timezones0.put("America/Puerto_Rico", tz);
+ timezones0.put("America/Santo_Domingo", tz);
+ timezones0.put("America/St_Kitts", tz);
+ timezones0.put("America/St_Lucia", tz);
+ timezones0.put("America/St_Thomas", tz);
+ timezones0.put("America/St_Vincent", tz);
+ timezones0.put("America/Tortola", tz);
+ tz = new SimpleTimeZone
+ (-4000 * 3600, "America/Campo_Grande",
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 0 * 3600,
+ Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("America/Campo_Grande", tz);
+ timezones0.put("America/Cuiaba", tz);
+ tz = new SimpleTimeZone
+ (-4000 * 3600, "America/Goose_Bay",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 60000,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 60000);
+ timezones0.put("America/Goose_Bay", tz);
+ tz = new SimpleTimeZone
+ (-4000 * 3600, "America/Glace_Bay",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Glace_Bay", tz);
+ timezones0.put("America/Halifax", tz);
+ timezones0.put("America/Moncton", tz);
+ timezones0.put("America/Thule", tz);
+ timezones0.put("Atlantic/Bermuda", tz);
+ tz = new SimpleTimeZone
+ (-4000 * 3600, "America/Santiago",
+ Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
+ Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("America/Santiago", tz);
+ timezones0.put("Antarctica/Palmer", tz);
+ tz = new SimpleTimeZone
+ (-4000 * 3600, "Atlantic/Stanley",
+ Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.APRIL, 3, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("Atlantic/Stanley", tz);
+ tz = new SimpleTimeZone
+ (-3500 * 3600, "CNT",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 60000,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 60000);
+ timezones0.put("CNT", tz);
+ timezones0.put("America/St_Johns", tz);
+ tz = new SimpleTimeZone
+ (-3000 * 3600, "America/Godthab",
+ Calendar.MARCH, 30, -Calendar.SATURDAY, 22000 * 3600,
+ Calendar.OCTOBER, 30, -Calendar.SATURDAY, 23000 * 3600);
+ timezones0.put("America/Godthab", tz);
+ tz = new SimpleTimeZone
+ (-3000 * 3600, "America/Miquelon",
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Miquelon", tz);
+ tz = new SimpleTimeZone
+ (-3000 * 3600, "America/Montevideo",
+ Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.MARCH, 2, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("America/Montevideo", tz);
+ tz = new SimpleTimeZone
+ (-3000 * 3600, "America/Sao_Paulo",
+ Calendar.NOVEMBER, 1, Calendar.SUNDAY, 0 * 3600,
+ Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("America/Sao_Paulo", tz);
+ tz = new SimpleTimeZone(-3000 * 3600, "AGT");
+ timezones0.put("AGT", tz);
+ timezones0.put("America/Araguaina", tz);
+ timezones0.put("America/Argentina/Buenos_Aires", tz);
+ timezones0.put("America/Argentina/Catamarca", tz);
+ timezones0.put("America/Argentina/Cordoba", tz);
+ timezones0.put("America/Argentina/Jujuy", tz);
+ timezones0.put("America/Argentina/La_Rioja", tz);
+ timezones0.put("America/Argentina/Mendoza", tz);
+ timezones0.put("America/Argentina/Rio_Gallegos", tz);
+ timezones0.put("America/Argentina/San_Juan", tz);
+ timezones0.put("America/Argentina/Tucuman", tz);
+ timezones0.put("America/Argentina/Ushuaia", tz);
+ timezones0.put("America/Bahia", tz);
+ timezones0.put("America/Belem", tz);
+ timezones0.put("America/Cayenne", tz);
+ timezones0.put("America/Fortaleza", tz);
+ timezones0.put("America/Maceio", tz);
+ timezones0.put("America/Paramaribo", tz);
+ timezones0.put("America/Recife", tz);
+ timezones0.put("Antarctica/Rothera", tz);
+ tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
+ timezones0.put("America/Noronha", tz);
+ timezones0.put("Atlantic/South_Georgia", tz);
+ tz = new SimpleTimeZone
+ (-1000 * 3600, "America/Scoresbysund",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
+ timezones0.put("America/Scoresbysund", tz);
+ timezones0.put("Atlantic/Azores", tz);
+ tz = new SimpleTimeZone(-1000 * 3600, "Atlantic/Cape_Verde");
+ timezones0.put("Atlantic/Cape_Verde", tz);
+ tz = new SimpleTimeZone(0 * 3600, "GMT");
+ timezones0.put("GMT", tz);
+ timezones0.put("UTC", tz);
+ timezones0.put("Africa/Abidjan", tz);
+ timezones0.put("Africa/Accra", tz);
+ timezones0.put("Africa/Bamako", tz);
+ timezones0.put("Africa/Banjul", tz);
+ timezones0.put("Africa/Bissau", tz);
+ timezones0.put("Africa/Casablanca", tz);
+ timezones0.put("Africa/Conakry", tz);
+ timezones0.put("Africa/Dakar", tz);
+ timezones0.put("Africa/El_Aaiun", tz);
+ timezones0.put("Africa/Freetown", tz);
+ timezones0.put("Africa/Lome", tz);
+ timezones0.put("Africa/Monrovia", tz);
+ timezones0.put("Africa/Nouakchott", tz);
+ timezones0.put("Africa/Ouagadougou", tz);
+ timezones0.put("Africa/Sao_Tome", tz);
+ timezones0.put("America/Danmarkshavn", tz);
+ timezones0.put("Atlantic/Reykjavik", tz);
+ timezones0.put("Atlantic/St_Helena", tz);
+ tz = new SimpleTimeZone
+ (0 * 3600, "WET",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("WET", tz);
+ timezones0.put("Atlantic/Canary", tz);
+ timezones0.put("Atlantic/Faroe", tz);
+ timezones0.put("Atlantic/Madeira", tz);
+ timezones0.put("Europe/Dublin", tz);
+ timezones0.put("Europe/Guernsey", tz);
+ timezones0.put("Europe/Isle_of_Man", tz);
+ timezones0.put("Europe/Jersey", tz);
+ timezones0.put("Europe/Lisbon", tz);
+ timezones0.put("Europe/London", tz);
+ tz = new SimpleTimeZone(1000 * 3600, "Africa/Algiers");
+ timezones0.put("Africa/Algiers", tz);
+ timezones0.put("Africa/Bangui", tz);
+ timezones0.put("Africa/Brazzaville", tz);
+ timezones0.put("Africa/Douala", tz);
+ timezones0.put("Africa/Kinshasa", tz);
+ timezones0.put("Africa/Lagos", tz);
+ timezones0.put("Africa/Libreville", tz);
+ timezones0.put("Africa/Luanda", tz);
+ timezones0.put("Africa/Malabo", tz);
+ timezones0.put("Africa/Ndjamena", tz);
+ timezones0.put("Africa/Niamey", tz);
+ timezones0.put("Africa/Porto-Novo", tz);
+ tz = new SimpleTimeZone
+ (1000 * 3600, "Africa/Windhoek",
+ Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600);
+ timezones0.put("Africa/Windhoek", tz);
+ tz = new SimpleTimeZone
+ (1000 * 3600, "CET",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("CET", tz);
+ timezones0.put("ECT", tz);
+ timezones0.put("MET", tz);
+ timezones0.put("Africa/Ceuta", tz);
+ timezones0.put("Africa/Tunis", tz);
+ timezones0.put("Arctic/Longyearbyen", tz);
+ timezones0.put("Atlantic/Jan_Mayen", tz);
+ timezones0.put("Europe/Amsterdam", tz);
+ timezones0.put("Europe/Andorra", tz);
+ timezones0.put("Europe/Belgrade", tz);
+ timezones0.put("Europe/Berlin", tz);
+ timezones0.put("Europe/Bratislava", tz);
+ timezones0.put("Europe/Brussels", tz);
+ timezones0.put("Europe/Budapest", tz);
+ timezones0.put("Europe/Copenhagen", tz);
+ timezones0.put("Europe/Gibraltar", tz);
+ timezones0.put("Europe/Ljubljana", tz);
+ timezones0.put("Europe/Luxembourg", tz);
+ timezones0.put("Europe/Madrid", tz);
+ timezones0.put("Europe/Malta", tz);
+ timezones0.put("Europe/Monaco", tz);
+ timezones0.put("Europe/Oslo", tz);
+ timezones0.put("Europe/Paris", tz);
+ timezones0.put("Europe/Podgorica", tz);
+ timezones0.put("Europe/Prague", tz);
+ timezones0.put("Europe/Rome", tz);
+ timezones0.put("Europe/San_Marino", tz);
+ timezones0.put("Europe/Sarajevo", tz);
+ timezones0.put("Europe/Skopje", tz);
+ timezones0.put("Europe/Stockholm", tz);
+ timezones0.put("Europe/Tirane", tz);
+ timezones0.put("Europe/Vaduz", tz);
+ timezones0.put("Europe/Vatican", tz);
+ timezones0.put("Europe/Vienna", tz);
+ timezones0.put("Europe/Warsaw", tz);
+ timezones0.put("Europe/Zagreb", tz);
+ timezones0.put("Europe/Zurich", tz);
+ tz = new SimpleTimeZone
+ (2000 * 3600, "ART",
+ Calendar.APRIL, -1, Calendar.FRIDAY, 0 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 24000 * 3600);
+ timezones0.put("ART", tz);
+ timezones0.put("Africa/Cairo", tz);
+ tz = new SimpleTimeZone(2000 * 3600, "CAT");
+ timezones0.put("CAT", tz);
+ timezones0.put("Africa/Blantyre", tz);
+ timezones0.put("Africa/Bujumbura", tz);
+ timezones0.put("Africa/Gaborone", tz);
+ timezones0.put("Africa/Harare", tz);
+ timezones0.put("Africa/Johannesburg", tz);
+ timezones0.put("Africa/Kigali", tz);
+ timezones0.put("Africa/Lubumbashi", tz);
+ timezones0.put("Africa/Lusaka", tz);
+ timezones0.put("Africa/Maputo", tz);
+ timezones0.put("Africa/Maseru", tz);
+ timezones0.put("Africa/Mbabane", tz);
+ timezones0.put("Africa/Tripoli", tz);
+ timezones0.put("Asia/Jerusalem", tz);
+ tz = new SimpleTimeZone
+ (2000 * 3600, "Asia/Amman",
+ Calendar.MARCH, -1, Calendar.THURSDAY, 0 * 3600,
+ Calendar.OCTOBER, -1, Calendar.FRIDAY, 1000 * 3600);
+ timezones0.put("Asia/Amman", tz);
+ tz = new SimpleTimeZone
+ (2000 * 3600, "Asia/Beirut",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
+ timezones0.put("Asia/Beirut", tz);
+ tz = new SimpleTimeZone
+ (2000 * 3600, "Asia/Damascus",
+ Calendar.APRIL, 1, 0, 0 * 3600,
+ Calendar.OCTOBER, 1, 0, 0 * 3600);
+ timezones0.put("Asia/Damascus", tz);
+ tz = new SimpleTimeZone
+ (2000 * 3600, "Asia/Gaza",
+ Calendar.APRIL, 1, 0, 0 * 3600,
+ Calendar.OCTOBER, 3, Calendar.FRIDAY, 0 * 3600);
+ timezones0.put("Asia/Gaza", tz);
+ tz = new SimpleTimeZone
+ (2000 * 3600, "EET",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 4000 * 3600);
+ timezones0.put("EET", tz);
+ timezones0.put("Asia/Istanbul", tz);
+ timezones0.put("Asia/Nicosia", tz);
+ timezones0.put("Europe/Athens", tz);
+ timezones0.put("Europe/Bucharest", tz);
+ timezones0.put("Europe/Chisinau", tz);
+ timezones0.put("Europe/Helsinki", tz);
+ timezones0.put("Europe/Istanbul", tz);
+ timezones0.put("Europe/Kiev", tz);
+ timezones0.put("Europe/Mariehamn", tz);
+ timezones0.put("Europe/Nicosia", tz);
+ timezones0.put("Europe/Riga", tz);
+ timezones0.put("Europe/Simferopol", tz);
+ timezones0.put("Europe/Sofia", tz);
+ timezones0.put("Europe/Tallinn", tz);
+ timezones0.put("Europe/Uzhgorod", tz);
+ timezones0.put("Europe/Vilnius", tz);
+ timezones0.put("Europe/Zaporozhye", tz);
+ tz = new SimpleTimeZone
+ (2000 * 3600, "Europe/Kaliningrad",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Europe/Kaliningrad", tz);
+ timezones0.put("Europe/Minsk", tz);
+ tz = new SimpleTimeZone
+ (3000 * 3600, "Asia/Baghdad",
+ Calendar.APRIL, 1, 0, 3000 * 3600,
+ Calendar.OCTOBER, 1, 0, 4000 * 3600);
+ timezones0.put("Asia/Baghdad", tz);
+ tz = new SimpleTimeZone
+ (3000 * 3600, "Europe/Moscow",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Europe/Moscow", tz);
+ timezones0.put("Europe/Volgograd", tz);
+ tz = new SimpleTimeZone(3000 * 3600, "EAT");
+ timezones0.put("EAT", tz);
+ timezones0.put("Africa/Addis_Ababa", tz);
+ timezones0.put("Africa/Asmara", tz);
+ timezones0.put("Africa/Dar_es_Salaam", tz);
+ timezones0.put("Africa/Djibouti", tz);
+ timezones0.put("Africa/Kampala", tz);
+ timezones0.put("Africa/Khartoum", tz);
+ timezones0.put("Africa/Mogadishu", tz);
+ timezones0.put("Africa/Nairobi", tz);
+ timezones0.put("Antarctica/Syowa", tz);
+ timezones0.put("Asia/Aden", tz);
+ timezones0.put("Asia/Bahrain", tz);
+ timezones0.put("Asia/Kuwait", tz);
+ timezones0.put("Asia/Qatar", tz);
+ timezones0.put("Asia/Riyadh", tz);
+ timezones0.put("Indian/Antananarivo", tz);
+ timezones0.put("Indian/Comoro", tz);
+ timezones0.put("Indian/Mayotte", tz);
+ tz = new SimpleTimeZone(3500 * 3600, "Asia/Tehran");
+ timezones0.put("Asia/Tehran", tz);
+ tz = new SimpleTimeZone
+ (4000 * 3600, "Asia/Baku",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 4000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 5000 * 3600);
+ timezones0.put("Asia/Baku", tz);
+ tz = new SimpleTimeZone
+ (4000 * 3600, "Asia/Yerevan",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Yerevan", tz);
+ timezones0.put("Europe/Samara", tz);
+ tz = new SimpleTimeZone(4000 * 3600, "NET");
+ timezones0.put("NET", tz);
+ timezones0.put("Asia/Dubai", tz);
+ timezones0.put("Asia/Muscat", tz);
+ timezones0.put("Asia/Tbilisi", tz);
+ timezones0.put("Indian/Mahe", tz);
+ timezones0.put("Indian/Mauritius", tz);
+ timezones0.put("Indian/Reunion", tz);
+ tz = new SimpleTimeZone(4500 * 3600, "Asia/Kabul");
+ timezones0.put("Asia/Kabul", tz);
+ tz = new SimpleTimeZone
+ (5000 * 3600, "Asia/Yekaterinburg",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Yekaterinburg", tz);
+ tz = new SimpleTimeZone(5000 * 3600, "PLT");
+ timezones0.put("PLT", tz);
+ timezones0.put("Asia/Aqtau", tz);
+ timezones0.put("Asia/Aqtobe", tz);
+ timezones0.put("Asia/Ashgabat", tz);
+ timezones0.put("Asia/Dushanbe", tz);
+ timezones0.put("Asia/Karachi", tz);
+ timezones0.put("Asia/Oral", tz);
+ timezones0.put("Asia/Samarkand", tz);
+ timezones0.put("Asia/Tashkent", tz);
+ timezones0.put("Indian/Kerguelen", tz);
+ timezones0.put("Indian/Maldives", tz);
+ tz = new SimpleTimeZone(5500 * 3600, "BST");
+ timezones0.put("BST", tz);
+ timezones0.put("IST", tz);
+ timezones0.put("Asia/Calcutta", tz);
+ timezones0.put("Asia/Colombo", tz);
+ tz = new SimpleTimeZone(5750 * 3600, "Asia/Katmandu");
+ timezones0.put("Asia/Katmandu", tz);
+ tz = new SimpleTimeZone(6000 * 3600, "Antarctica/Mawson");
+ timezones0.put("Antarctica/Mawson", tz);
+ timezones0.put("Antarctica/Vostok", tz);
+ timezones0.put("Asia/Almaty", tz);
+ timezones0.put("Asia/Bishkek", tz);
+ timezones0.put("Asia/Dhaka", tz);
+ timezones0.put("Asia/Qyzylorda", tz);
+ timezones0.put("Asia/Thimphu", tz);
+ timezones0.put("Indian/Chagos", tz);
+ tz = new SimpleTimeZone
+ (6000 * 3600, "Asia/Novosibirsk",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Novosibirsk", tz);
+ timezones0.put("Asia/Omsk", tz);
+ tz = new SimpleTimeZone(6500 * 3600, "Asia/Rangoon");
+ timezones0.put("Asia/Rangoon", tz);
+ timezones0.put("Indian/Cocos", tz);
+ tz = new SimpleTimeZone(7000 * 3600, "VST");
+ timezones0.put("VST", tz);
+ timezones0.put("Antarctica/Davis", tz);
+ timezones0.put("Asia/Bangkok", tz);
+ timezones0.put("Asia/Jakarta", tz);
+ timezones0.put("Asia/Phnom_Penh", tz);
+ timezones0.put("Asia/Pontianak", tz);
+ timezones0.put("Asia/Saigon", tz);
+ timezones0.put("Asia/Vientiane", tz);
+ timezones0.put("Indian/Christmas", tz);
+ tz = new SimpleTimeZone
+ (7000 * 3600, "Asia/Hovd",
+ Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
+ timezones0.put("Asia/Hovd", tz);
+ tz = new SimpleTimeZone
+ (7000 * 3600, "Asia/Krasnoyarsk",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Krasnoyarsk", tz);
+ tz = new SimpleTimeZone(8000 * 3600, "CTT");
+ timezones0.put("CTT", tz);
+ timezones0.put("Antarctica/Casey", tz);
+ timezones0.put("Asia/Brunei", tz);
+ timezones0.put("Asia/Chongqing", tz);
+ timezones0.put("Asia/Harbin", tz);
+ timezones0.put("Asia/Hong_Kong", tz);
+ timezones0.put("Asia/Kashgar", tz);
+ timezones0.put("Asia/Kuala_Lumpur", tz);
+ timezones0.put("Asia/Kuching", tz);
+ timezones0.put("Asia/Macau", tz);
+ timezones0.put("Asia/Makassar", tz);
+ timezones0.put("Asia/Manila", tz);
+ timezones0.put("Asia/Shanghai", tz);
+ timezones0.put("Asia/Singapore", tz);
+ timezones0.put("Asia/Taipei", tz);
+ timezones0.put("Asia/Urumqi", tz);
+ timezones0.put("Australia/Perth", tz);
+ tz = new SimpleTimeZone
+ (8000 * 3600, "Asia/Irkutsk",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Irkutsk", tz);
+ tz = new SimpleTimeZone
+ (8000 * 3600, "Asia/Ulaanbaatar",
+ Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
+ timezones0.put("Asia/Ulaanbaatar", tz);
+ tz = new SimpleTimeZone(8750 * 3600, "Australia/Eucla");
+ timezones0.put("Australia/Eucla", tz);
+ tz = new SimpleTimeZone
+ (9000 * 3600, "Asia/Choibalsan",
+ Calendar.MARCH, -1, Calendar.SATURDAY, 2000 * 3600,
+ Calendar.SEPTEMBER, -1, Calendar.SATURDAY, 2000 * 3600);
+ timezones0.put("Asia/Choibalsan", tz);
+ tz = new SimpleTimeZone(9000 * 3600, "JST");
+ timezones0.put("JST", tz);
+ timezones0.put("Asia/Dili", tz);
+ timezones0.put("Asia/Jayapura", tz);
+ timezones0.put("Asia/Pyongyang", tz);
+ timezones0.put("Asia/Seoul", tz);
+ timezones0.put("Asia/Tokyo", tz);
+ timezones0.put("Pacific/Palau", tz);
+ tz = new SimpleTimeZone
+ (9000 * 3600, "Asia/Yakutsk",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Yakutsk", tz);
+ tz = new SimpleTimeZone
+ (9500 * 3600, "Australia/Adelaide",
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Australia/Adelaide", tz);
+ timezones0.put("Australia/Broken_Hill", tz);
+ tz = new SimpleTimeZone(9500 * 3600, "ACT");
+ timezones0.put("ACT", tz);
+ timezones0.put("Australia/Darwin", tz);
+ tz = new SimpleTimeZone(10000 * 3600, "Antarctica/DumontDUrville");
+ timezones0.put("Antarctica/DumontDUrville", tz);
+ timezones0.put("Australia/Brisbane", tz);
+ timezones0.put("Australia/Lindeman", tz);
+ timezones0.put("Pacific/Guam", tz);
+ timezones0.put("Pacific/Port_Moresby", tz);
+ timezones0.put("Pacific/Saipan", tz);
+ timezones0.put("Pacific/Truk", tz);
+ tz = new SimpleTimeZone
+ (10000 * 3600, "Asia/Sakhalin",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Sakhalin", tz);
+ timezones0.put("Asia/Vladivostok", tz);
+ tz = new SimpleTimeZone
+ (10000 * 3600, "Australia/Currie",
+ Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Australia/Currie", tz);
+ timezones0.put("Australia/Hobart", tz);
+ tz = new SimpleTimeZone
+ (10000 * 3600, "AET",
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("AET", tz);
+ timezones0.put("Australia/Melbourne", tz);
+ timezones0.put("Australia/Sydney", tz);
+ tz = new SimpleTimeZone
+ (10500 * 3600, "Australia/Lord_Howe",
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600, 500 * 3600);
+ timezones0.put("Australia/Lord_Howe", tz);
+ tz = new SimpleTimeZone
+ (11000 * 3600, "Asia/Magadan",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Magadan", tz);
+ tz = new SimpleTimeZone(11000 * 3600, "SST");
+ timezones0.put("SST", tz);
+ timezones0.put("Pacific/Efate", tz);
+ timezones0.put("Pacific/Guadalcanal", tz);
+ timezones0.put("Pacific/Kosrae", tz);
+ timezones0.put("Pacific/Noumea", tz);
+ timezones0.put("Pacific/Ponape", tz);
+ tz = new SimpleTimeZone(11500 * 3600, "Pacific/Norfolk");
+ timezones0.put("Pacific/Norfolk", tz);
+ tz = new SimpleTimeZone
+ (12000 * 3600, "NST",
+ Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.MARCH, 3, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("NST", tz);
+ timezones0.put("Antarctica/McMurdo", tz);
+ timezones0.put("Antarctica/South_Pole", tz);
+ timezones0.put("Pacific/Auckland", tz);
+ tz = new SimpleTimeZone
+ (12000 * 3600, "Asia/Anadyr",
+ Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
+ Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
+ timezones0.put("Asia/Anadyr", tz);
+ timezones0.put("Asia/Kamchatka", tz);
+ tz = new SimpleTimeZone(12000 * 3600, "Pacific/Fiji");
+ timezones0.put("Pacific/Fiji", tz);
+ timezones0.put("Pacific/Funafuti", tz);
+ timezones0.put("Pacific/Kwajalein", tz);
+ timezones0.put("Pacific/Majuro", tz);
+ timezones0.put("Pacific/Nauru", tz);
+ timezones0.put("Pacific/Tarawa", tz);
+ timezones0.put("Pacific/Wake", tz);
+ timezones0.put("Pacific/Wallis", tz);
+ tz = new SimpleTimeZone
+ (12750 * 3600, "Pacific/Chatham",
+ Calendar.OCTOBER, 1, Calendar.SUNDAY, 2750 * 3600,
+ Calendar.MARCH, 3, Calendar.SUNDAY, 3750 * 3600);
+ timezones0.put("Pacific/Chatham", tz);
+ tz = new SimpleTimeZone(13000 * 3600, "Pacific/Enderbury");
+ timezones0.put("Pacific/Enderbury", tz);
+ timezones0.put("Pacific/Tongatapu", tz);
+ tz = new SimpleTimeZone(14000 * 3600, "Pacific/Kiritimati");
+ timezones0.put("Pacific/Kiritimati", tz);
}
return timezones0;
}
@@ -909,7 +909,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
* with the result of <code>System.getProperty("user.timezone")</code>
* or <code>getDefaultTimeZoneId()</code>. Note that giving one of
* the standard tz data names from ftp://elsie.nci.nih.gov/pub/ is
- * preferred.
+ * preferred.
* The time zone name can be given as follows:
* <code>(standard zone name)[(GMT offset)[(DST zone name)[DST offset]]]
* </code>
@@ -954,175 +954,175 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
int dstOffs;
try
{
- int idLength = sysTimeZoneId.length();
-
- int index = 0;
- int prevIndex;
- char c;
-
- // get std
- do
- c = sysTimeZoneId.charAt(index);
- while (c != '+' && c != '-' && c != ',' && c != ':'
- && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
-
- if (index >= idLength)
- return getTimeZoneInternal(sysTimeZoneId);
-
- stdName = sysTimeZoneId.substring(0, index);
- prevIndex = index;
-
- // get the std offset
- do
- c = sysTimeZoneId.charAt(index++);
- while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
- && index < idLength);
- if (index < idLength)
- index--;
-
- { // convert the dst string to a millis number
- String offset = sysTimeZoneId.substring(prevIndex, index);
- prevIndex = index;
-
- if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
- stdOffs = parseTime(offset.substring(1));
- else
- stdOffs = parseTime(offset);
-
- if (offset.charAt(0) == '-')
- stdOffs = -stdOffs;
-
- // TZ timezone offsets are positive when WEST of the meridian.
- stdOffs = -stdOffs;
- }
-
- // Done yet? (Format: std offset)
- if (index >= idLength)
- {
- // Do we have an existing timezone with that name and offset?
- TimeZone tz = getTimeZoneInternal(stdName);
- if (tz != null)
- if (tz.getRawOffset() == stdOffs)
- return tz;
-
- // Custom then.
- return new SimpleTimeZone(stdOffs, stdName);
- }
-
- // get dst
- do
- c = sysTimeZoneId.charAt(index);
- while (c != '+' && c != '-' && c != ',' && c != ':'
- && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
-
- // Done yet? (Format: std offset dst)
- if (index >= idLength)
- {
- // Do we have an existing timezone with that name and offset
- // which has DST?
- TimeZone tz = getTimeZoneInternal(stdName);
- if (tz != null)
- if (tz.getRawOffset() == stdOffs && tz.useDaylightTime())
- return tz;
-
- // Custom then.
- return new SimpleTimeZone(stdOffs, stdName);
- }
-
- // get the dst offset
- prevIndex = index;
- do
- c = sysTimeZoneId.charAt(index++);
- while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
- && index < idLength);
- if (index < idLength)
- index--;
-
- if (index == prevIndex && (c == ',' || c == ';'))
- {
- // Missing dst offset defaults to one hour ahead of standard
- // time.
- dstOffs = stdOffs + 60 * 60 * 1000;
- }
- else
- { // convert the dst string to a millis number
- String offset = sysTimeZoneId.substring(prevIndex, index);
- prevIndex = index;
-
- if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
- dstOffs = parseTime(offset.substring(1));
- else
- dstOffs = parseTime(offset);
-
- if (offset.charAt(0) == '-')
- dstOffs = -dstOffs;
-
- // TZ timezone offsets are positive when WEST of the meridian.
- dstOffs = -dstOffs;
- }
-
- // Done yet? (Format: std offset dst offset)
- // FIXME: We don't support DST without a rule given. Should we?
- if (index >= idLength)
- {
- // Time Zone existing with same name, dst and offsets?
- TimeZone tz = getTimeZoneInternal(stdName);
- if (tz != null)
- if (tz.getRawOffset() == stdOffs && tz.useDaylightTime()
- && tz.getDSTSavings() == (dstOffs - stdOffs))
- return tz;
-
- return new SimpleTimeZone(stdOffs, stdName);
- }
-
- // get the DST rule
- if (sysTimeZoneId.charAt(index) == ','
- || sysTimeZoneId.charAt(index) == ';')
- {
- index++;
- int offs = index;
- while (sysTimeZoneId.charAt(index) != ','
- && sysTimeZoneId.charAt(index) != ';')
- index++;
- String startTime = sysTimeZoneId.substring(offs, index);
- index++;
- String endTime = sysTimeZoneId.substring(index);
-
- index = startTime.indexOf('/');
- int startMillis;
- int endMillis;
- String startDate;
- String endDate;
- if (index != -1)
- {
- startDate = startTime.substring(0, index);
- startMillis = parseTime(startTime.substring(index + 1));
- }
- else
- {
- startDate = startTime;
- // if time isn't given, default to 2:00:00 AM.
- startMillis = 2 * 60 * 60 * 1000;
- }
- index = endTime.indexOf('/');
- if (index != -1)
- {
- endDate = endTime.substring(0, index);
- endMillis = parseTime(endTime.substring(index + 1));
- }
- else
- {
- endDate = endTime;
- // if time isn't given, default to 2:00:00 AM.
- endMillis = 2 * 60 * 60 * 1000;
- }
-
- int[] start = getDateParams(startDate);
- int[] end = getDateParams(endDate);
- return new SimpleTimeZone(stdOffs, stdName, start[0], start[1],
- start[2], startMillis, end[0], end[1],
- end[2], endMillis, (dstOffs - stdOffs));
- }
+ int idLength = sysTimeZoneId.length();
+
+ int index = 0;
+ int prevIndex;
+ char c;
+
+ // get std
+ do
+ c = sysTimeZoneId.charAt(index);
+ while (c != '+' && c != '-' && c != ',' && c != ':'
+ && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
+
+ if (index >= idLength)
+ return getTimeZoneInternal(sysTimeZoneId);
+
+ stdName = sysTimeZoneId.substring(0, index);
+ prevIndex = index;
+
+ // get the std offset
+ do
+ c = sysTimeZoneId.charAt(index++);
+ while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
+ && index < idLength);
+ if (index < idLength)
+ index--;
+
+ { // convert the dst string to a millis number
+ String offset = sysTimeZoneId.substring(prevIndex, index);
+ prevIndex = index;
+
+ if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
+ stdOffs = parseTime(offset.substring(1));
+ else
+ stdOffs = parseTime(offset);
+
+ if (offset.charAt(0) == '-')
+ stdOffs = -stdOffs;
+
+ // TZ timezone offsets are positive when WEST of the meridian.
+ stdOffs = -stdOffs;
+ }
+
+ // Done yet? (Format: std offset)
+ if (index >= idLength)
+ {
+ // Do we have an existing timezone with that name and offset?
+ TimeZone tz = getTimeZoneInternal(stdName);
+ if (tz != null)
+ if (tz.getRawOffset() == stdOffs)
+ return tz;
+
+ // Custom then.
+ return new SimpleTimeZone(stdOffs, stdName);
+ }
+
+ // get dst
+ do
+ c = sysTimeZoneId.charAt(index);
+ while (c != '+' && c != '-' && c != ',' && c != ':'
+ && ! Character.isDigit(c) && c != '\0' && ++index < idLength);
+
+ // Done yet? (Format: std offset dst)
+ if (index >= idLength)
+ {
+ // Do we have an existing timezone with that name and offset
+ // which has DST?
+ TimeZone tz = getTimeZoneInternal(stdName);
+ if (tz != null)
+ if (tz.getRawOffset() == stdOffs && tz.useDaylightTime())
+ return tz;
+
+ // Custom then.
+ return new SimpleTimeZone(stdOffs, stdName);
+ }
+
+ // get the dst offset
+ prevIndex = index;
+ do
+ c = sysTimeZoneId.charAt(index++);
+ while ((c == '-' || c == '+' || c == ':' || Character.isDigit(c))
+ && index < idLength);
+ if (index < idLength)
+ index--;
+
+ if (index == prevIndex && (c == ',' || c == ';'))
+ {
+ // Missing dst offset defaults to one hour ahead of standard
+ // time.
+ dstOffs = stdOffs + 60 * 60 * 1000;
+ }
+ else
+ { // convert the dst string to a millis number
+ String offset = sysTimeZoneId.substring(prevIndex, index);
+ prevIndex = index;
+
+ if (offset.charAt(0) == '+' || offset.charAt(0) == '-')
+ dstOffs = parseTime(offset.substring(1));
+ else
+ dstOffs = parseTime(offset);
+
+ if (offset.charAt(0) == '-')
+ dstOffs = -dstOffs;
+
+ // TZ timezone offsets are positive when WEST of the meridian.
+ dstOffs = -dstOffs;
+ }
+
+ // Done yet? (Format: std offset dst offset)
+ // FIXME: We don't support DST without a rule given. Should we?
+ if (index >= idLength)
+ {
+ // Time Zone existing with same name, dst and offsets?
+ TimeZone tz = getTimeZoneInternal(stdName);
+ if (tz != null)
+ if (tz.getRawOffset() == stdOffs && tz.useDaylightTime()
+ && tz.getDSTSavings() == (dstOffs - stdOffs))
+ return tz;
+
+ return new SimpleTimeZone(stdOffs, stdName);
+ }
+
+ // get the DST rule
+ if (sysTimeZoneId.charAt(index) == ','
+ || sysTimeZoneId.charAt(index) == ';')
+ {
+ index++;
+ int offs = index;
+ while (sysTimeZoneId.charAt(index) != ','
+ && sysTimeZoneId.charAt(index) != ';')
+ index++;
+ String startTime = sysTimeZoneId.substring(offs, index);
+ index++;
+ String endTime = sysTimeZoneId.substring(index);
+
+ index = startTime.indexOf('/');
+ int startMillis;
+ int endMillis;
+ String startDate;
+ String endDate;
+ if (index != -1)
+ {
+ startDate = startTime.substring(0, index);
+ startMillis = parseTime(startTime.substring(index + 1));
+ }
+ else
+ {
+ startDate = startTime;
+ // if time isn't given, default to 2:00:00 AM.
+ startMillis = 2 * 60 * 60 * 1000;
+ }
+ index = endTime.indexOf('/');
+ if (index != -1)
+ {
+ endDate = endTime.substring(0, index);
+ endMillis = parseTime(endTime.substring(index + 1));
+ }
+ else
+ {
+ endDate = endTime;
+ // if time isn't given, default to 2:00:00 AM.
+ endMillis = 2 * 60 * 60 * 1000;
+ }
+
+ int[] start = getDateParams(startDate);
+ int[] end = getDateParams(endDate);
+ return new SimpleTimeZone(stdOffs, stdName, start[0], start[1],
+ start[2], startMillis, end[0], end[1],
+ end[2], endMillis, (dstOffs - stdOffs));
+ }
}
// FIXME: Produce a warning here?
@@ -1148,38 +1148,38 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
if (date.charAt(0) == 'M' || date.charAt(0) == 'm')
{
- int day;
-
- // Month, week of month, day of week
- month = Integer.parseInt(date.substring(1, date.indexOf('.')));
- int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
- date.lastIndexOf('.')));
- int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
- + 1));
- if (week == 5)
- day = -1; // last day of month is -1 in java, 5 in TZ
- else
- // first day of week starting on or after.
- day = (week - 1) * 7 + 1;
-
- dayOfWeek++; // Java day of week is one-based, Sunday is first day.
- month--; // Java month is zero-based.
- return new int[] { month, day, dayOfWeek };
+ int day;
+
+ // Month, week of month, day of week
+ month = Integer.parseInt(date.substring(1, date.indexOf('.')));
+ int week = Integer.parseInt(date.substring(date.indexOf('.') + 1,
+ date.lastIndexOf('.')));
+ int dayOfWeek = Integer.parseInt(date.substring(date.lastIndexOf('.')
+ + 1));
+ if (week == 5)
+ day = -1; // last day of month is -1 in java, 5 in TZ
+ else
+ // first day of week starting on or after.
+ day = (week - 1) * 7 + 1;
+
+ dayOfWeek++; // Java day of week is one-based, Sunday is first day.
+ month--; // Java month is zero-based.
+ return new int[] { month, day, dayOfWeek };
}
// julian day, either zero-based 0<=n<=365 (incl feb 29)
// or one-based 1<=n<=365 (no feb 29)
- int julianDay; // Julian day,
+ int julianDay; // Julian day,
if (date.charAt(0) != 'J' || date.charAt(0) != 'j')
{
- julianDay = Integer.parseInt(date.substring(1));
- julianDay++; // make 1-based
- // Adjust day count to include feb 29.
- dayCount = new int[]
- {
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
- };
+ julianDay = Integer.parseInt(date.substring(1));
+ julianDay++; // make 1-based
+ // Adjust day count to include feb 29.
+ dayCount = new int[]
+ {
+ 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335
+ };
}
else
// 1-based julian day
@@ -1188,9 +1188,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
int i = 11;
while (i > 0)
if (dayCount[i] < julianDay)
- break;
+ break;
else
- i--;
+ i--;
julianDay -= dayCount[i];
month = i;
return new int[] { month, julianDay, 0 };
@@ -1207,9 +1207,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
while (i < time.length())
if (time.charAt(i) == ':')
- break;
+ break;
else
- i++;
+ i++;
millis = 60 * 60 * 1000 * Integer.parseInt(time.substring(0, i));
if (i >= time.length())
return millis;
@@ -1217,9 +1217,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
int iprev = ++i;
while (i < time.length())
if (time.charAt(i) == ':')
- break;
+ break;
else
- i++;
+ i++;
millis += 60 * 1000 * Integer.parseInt(time.substring(iprev, i));
if (i >= time.length())
return millis;
@@ -1229,7 +1229,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
}
/**
- * Gets the time zone offset, for current date, modified in case of
+ * Gets the time zone offset, for current date, modified in case of
* daylight savings. This is the offset to add to UTC to get the local
* time.
* @param era the era of the given date
@@ -1241,7 +1241,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
* @return the time zone offset in milliseconds.
*/
public abstract int getOffset(int era, int year, int month,
- int day, int dayOfWeek, int milliseconds);
+ int day, int dayOfWeek, int milliseconds);
/**
* Get the time zone offset for the specified date, modified in case of
@@ -1257,11 +1257,11 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
? getRawOffset() + getDSTSavings()
: getRawOffset());
}
-
+
/**
* Gets the time zone offset, ignoring daylight savings. This is
* the offset to add to UTC to get the local time.
- * @return the time zone offset in milliseconds.
+ * @return the time zone offset in milliseconds.
*/
public abstract int getRawOffset();
@@ -1275,7 +1275,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
/**
* Gets the identifier of this time zone. For instance, PST for
* Pacific Standard Time.
- * @returns the ID of this time zone.
+ * @returns the ID of this time zone.
*/
public String getID()
{
@@ -1292,7 +1292,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
{
if (id == null)
throw new NullPointerException();
-
+
this.ID = id;
}
@@ -1327,7 +1327,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
/**
* This method returns a string name of the time zone suitable
* for displaying to the user. The string returned will be of the
- * specified type in the current locale.
+ * specified type in the current locale.
*
* @param dst Whether or not daylight savings time is in effect.
* @param style <code>LONG</code> for a long name, <code>SHORT</code> for
@@ -1344,7 +1344,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
/**
* This method returns a string name of the time zone suitable
* for displaying to the user. The string returned will be of the
- * specified type in the specified locale.
+ * specified type in the specified locale.
*
* @param dst Whether or not daylight savings time is in effect.
* @param style <code>LONG</code> for a long name, <code>SHORT</code> for
@@ -1358,30 +1358,30 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
DateFormatSymbols dfs;
try
{
- dfs = new DateFormatSymbols(locale);
-
- // The format of the value returned is defined by us.
- String[][]zoneinfo = dfs.getZoneStrings();
- for (int i = 0; i < zoneinfo.length; i++)
- {
- if (zoneinfo[i][0].equals(getID()))
- {
- if (!dst)
- {
- if (style == SHORT)
- return (zoneinfo[i][2]);
- else
- return (zoneinfo[i][1]);
- }
- else
- {
- if (style == SHORT)
- return (zoneinfo[i][4]);
- else
- return (zoneinfo[i][3]);
- }
- }
- }
+ dfs = new DateFormatSymbols(locale);
+
+ // The format of the value returned is defined by us.
+ String[][]zoneinfo = dfs.getZoneStrings();
+ for (int i = 0; i < zoneinfo.length; i++)
+ {
+ if (zoneinfo[i][0].equals(getID()))
+ {
+ if (!dst)
+ {
+ if (style == SHORT)
+ return (zoneinfo[i][2]);
+ else
+ return (zoneinfo[i][1]);
+ }
+ else
+ {
+ if (style == SHORT)
+ return (zoneinfo[i][4]);
+ else
+ return (zoneinfo[i][3]);
+ }
+ }
+ }
}
catch (MissingResourceException e)
{
@@ -1395,10 +1395,10 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
int offset = getRawOffset();
if (dst && this instanceof SimpleTimeZone)
{
- // ugly, but this is a design failure of the API:
- // getDisplayName takes a dst parameter even though
- // TimeZone knows nothing about daylight saving offsets.
- offset += ((SimpleTimeZone) this).getDSTSavings();
+ // ugly, but this is a design failure of the API:
+ // getDisplayName takes a dst parameter even though
+ // TimeZone knows nothing about daylight saving offsets.
+ offset += ((SimpleTimeZone) this).getDSTSavings();
}
CPStringBuilder sb = new CPStringBuilder(9);
@@ -1410,18 +1410,18 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
if (minutes != 0 || hours != 0)
{
- sb.append(offset >= 0 ? '+' : '-');
- sb.append((char) ('0' + hours / 10));
- sb.append((char) ('0' + hours % 10));
- sb.append(':');
- sb.append((char) ('0' + minutes / 10));
- sb.append((char) ('0' + minutes % 10));
+ sb.append(offset >= 0 ? '+' : '-');
+ sb.append((char) ('0' + hours / 10));
+ sb.append((char) ('0' + hours % 10));
+ sb.append(':');
+ sb.append((char) ('0' + minutes / 10));
+ sb.append((char) ('0' + minutes % 10));
}
return sb.toString();
}
- /**
+ /**
* Returns true, if this time zone uses Daylight Savings Time.
*/
public abstract boolean useDaylightTime();
@@ -1462,45 +1462,45 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
TimeZone tznew = null;
for (int pass = 0; pass < 2; pass++)
{
- synchronized (TimeZone.class)
- {
- tz = (TimeZone) timezones().get(ID);
- if (tz != null)
- {
- if (!tz.getID().equals(ID))
- {
- // We always return a timezone with the requested ID.
- // This is the same behaviour as with JDK1.2.
- tz = (TimeZone) tz.clone();
- tz.setID(ID);
- // We also save the alias, so that we return the same
- // object again if getTimeZone is called with the same
- // alias.
- timezones().put(ID, tz);
- }
- return tz;
- }
- else if (tznew != null)
- {
- timezones().put(ID, tznew);
- return tznew;
- }
- }
-
- if (pass == 1 || zoneinfo_dir == null)
- return null;
-
- // aliases0 is never changing after first timezones(), so should
- // be safe without synchronization.
- String zonename = (String) aliases0.get(ID);
- if (zonename == null)
- zonename = ID;
-
- // Read the file outside of the critical section, it is expensive.
- tznew = ZoneInfo.readTZFile (ID, zoneinfo_dir
- + File.separatorChar + zonename);
- if (tznew == null)
- return null;
+ synchronized (TimeZone.class)
+ {
+ tz = (TimeZone) timezones().get(ID);
+ if (tz != null)
+ {
+ if (!tz.getID().equals(ID))
+ {
+ // We always return a timezone with the requested ID.
+ // This is the same behaviour as with JDK1.2.
+ tz = (TimeZone) tz.clone();
+ tz.setID(ID);
+ // We also save the alias, so that we return the same
+ // object again if getTimeZone is called with the same
+ // alias.
+ timezones().put(ID, tz);
+ }
+ return tz;
+ }
+ else if (tznew != null)
+ {
+ timezones().put(ID, tznew);
+ return tznew;
+ }
+ }
+
+ if (pass == 1 || zoneinfo_dir == null)
+ return null;
+
+ // aliases0 is never changing after first timezones(), so should
+ // be safe without synchronization.
+ String zonename = (String) aliases0.get(ID);
+ if (zonename == null)
+ zonename = ID;
+
+ // Read the file outside of the critical section, it is expensive.
+ tznew = ZoneInfo.readTZFile (ID, zoneinfo_dir
+ + File.separatorChar + zonename);
+ if (tznew == null)
+ return null;
}
return null;
@@ -1517,68 +1517,68 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
// Check for custom IDs first
if (ID.startsWith("GMT") && ID.length() > 3)
{
- int pos = 3;
- int offset_direction = 1;
-
- if (ID.charAt(pos) == '-')
- {
- offset_direction = -1;
- pos++;
- }
- else if (ID.charAt(pos) == '+')
- {
- pos++;
- }
-
- try
- {
- int hour, minute;
-
- String offset_str = ID.substring(pos);
- int idx = offset_str.indexOf(":");
- if (idx != -1)
- {
- hour = Integer.parseInt(offset_str.substring(0, idx));
- minute = Integer.parseInt(offset_str.substring(idx + 1));
- }
- else
- {
- int offset_length = offset_str.length();
- if (offset_length <= 2)
- {
- // Only hour
- hour = Integer.parseInt(offset_str);
- minute = 0;
- }
- else
- {
- // hour and minute, not separated by colon
- hour = Integer.parseInt
- (offset_str.substring(0, offset_length - 2));
- minute = Integer.parseInt
- (offset_str.substring(offset_length - 2));
- }
- }
-
- // Custom IDs have to be normalized
- CPStringBuilder sb = new CPStringBuilder(9);
- sb.append("GMT");
-
- sb.append(offset_direction >= 0 ? '+' : '-');
- sb.append((char) ('0' + hour / 10));
- sb.append((char) ('0' + hour % 10));
- sb.append(':');
- sb.append((char) ('0' + minute / 10));
- sb.append((char) ('0' + minute % 10));
- ID = sb.toString();
-
- return new SimpleTimeZone((hour * (60 * 60 * 1000)
- + minute * (60 * 1000))
- * offset_direction, ID);
- }
- catch (NumberFormatException e)
- {
- }
+ int pos = 3;
+ int offset_direction = 1;
+
+ if (ID.charAt(pos) == '-')
+ {
+ offset_direction = -1;
+ pos++;
+ }
+ else if (ID.charAt(pos) == '+')
+ {
+ pos++;
+ }
+
+ try
+ {
+ int hour, minute;
+
+ String offset_str = ID.substring(pos);
+ int idx = offset_str.indexOf(":");
+ if (idx != -1)
+ {
+ hour = Integer.parseInt(offset_str.substring(0, idx));
+ minute = Integer.parseInt(offset_str.substring(idx + 1));
+ }
+ else
+ {
+ int offset_length = offset_str.length();
+ if (offset_length <= 2)
+ {
+ // Only hour
+ hour = Integer.parseInt(offset_str);
+ minute = 0;
+ }
+ else
+ {
+ // hour and minute, not separated by colon
+ hour = Integer.parseInt
+ (offset_str.substring(0, offset_length - 2));
+ minute = Integer.parseInt
+ (offset_str.substring(offset_length - 2));
+ }
+ }
+
+ // Custom IDs have to be normalized
+ CPStringBuilder sb = new CPStringBuilder(9);
+ sb.append("GMT");
+
+ sb.append(offset_direction >= 0 ? '+' : '-');
+ sb.append((char) ('0' + hour / 10));
+ sb.append((char) ('0' + hour % 10));
+ sb.append(':');
+ sb.append((char) ('0' + minute / 10));
+ sb.append((char) ('0' + minute % 10));
+ ID = sb.toString();
+
+ return new SimpleTimeZone((hour * (60 * 60 * 1000)
+ + minute * (60 * 1000))
+ * offset_direction, ID);
+ }
+ catch (NumberFormatException e)
+ {
+ }
}
TimeZone tz = getTimeZoneInternal(ID);
@@ -1590,7 +1590,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
/**
* Gets the available IDs according to the given time zone
- * offset.
+ * offset.
* @param rawOffset the given time zone GMT offset.
* @return An array of IDs, where the time zone has the specified GMT
* offset. For example <code>{"Phoenix", "Denver"}</code>, since both have
@@ -1600,42 +1600,42 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
{
synchronized (TimeZone.class)
{
- HashMap h = timezones();
- int count = 0;
- if (zoneinfo_dir == null)
- {
- Iterator iter = h.entrySet().iterator();
- while (iter.hasNext())
- {
- // Don't iterate the values, since we want to count
- // doubled values (aliases)
- Map.Entry entry = (Map.Entry) iter.next();
- if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
- count++;
- }
-
- String[] ids = new String[count];
- count = 0;
- iter = h.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry) iter.next();
- if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
- ids[count++] = (String) entry.getKey();
- }
- return ids;
- }
+ HashMap h = timezones();
+ int count = 0;
+ if (zoneinfo_dir == null)
+ {
+ Iterator iter = h.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ // Don't iterate the values, since we want to count
+ // doubled values (aliases)
+ Map.Entry entry = (Map.Entry) iter.next();
+ if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
+ count++;
+ }
+
+ String[] ids = new String[count];
+ count = 0;
+ iter = h.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
+ ids[count++] = (String) entry.getKey();
+ }
+ return ids;
+ }
}
String[] s = getAvailableIDs();
int count = 0;
for (int i = 0; i < s.length; i++)
{
- TimeZone t = getTimeZoneInternal(s[i]);
- if (t == null || t.getRawOffset() != rawOffset)
- s[i] = null;
- else
- count++;
+ TimeZone t = getTimeZoneInternal(s[i]);
+ if (t == null || t.getRawOffset() != rawOffset)
+ s[i] = null;
+ else
+ count++;
}
String[] ids = new String[count];
count = 0;
@@ -1653,28 +1653,28 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
boolean top = prefix.length() == 0;
list.add (files);
for (int i = 0; i < files.length; i++)
- {
- if (top
- && (files[i].equals("posix")
- || files[i].equals("right")
- || files[i].endsWith(".tab")
- || aliases0.get(files[i]) != null))
- {
- files[i] = null;
- count--;
- continue;
- }
-
- File f = new File(d, files[i]);
- if (f.isDirectory())
- {
- count += getAvailableIDs(f, prefix + files[i]
- + File.separatorChar, list) - 1;
- files[i] = null;
- }
- else
- files[i] = prefix + files[i];
- }
+ {
+ if (top
+ && (files[i].equals("posix")
+ || files[i].equals("right")
+ || files[i].endsWith(".tab")
+ || aliases0.get(files[i]) != null))
+ {
+ files[i] = null;
+ count--;
+ continue;
+ }
+
+ File f = new File(d, files[i]);
+ if (f.isDirectory())
+ {
+ count += getAvailableIDs(f, prefix + files[i]
+ + File.separatorChar, list) - 1;
+ files[i] = null;
+ }
+ else
+ files[i] = prefix + files[i];
+ }
return count;
}
@@ -1686,45 +1686,45 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
{
synchronized (TimeZone.class)
{
- HashMap h = timezones();
- if (zoneinfo_dir == null)
- return (String[]) h.keySet().toArray(new String[h.size()]);
-
- if (availableIDs != null)
- {
- String[] ids = new String[availableIDs.length];
- for (int i = 0; i < availableIDs.length; i++)
- ids[i] = availableIDs[i];
- return ids;
- }
-
- File d = new File(zoneinfo_dir);
- ArrayList list = new ArrayList(30);
- int count = getAvailableIDs(d, "", list) + aliases0.size();
- availableIDs = new String[count];
- String[] ids = new String[count];
-
- count = 0;
- for (int i = 0; i < list.size(); i++)
- {
- String[] s = (String[]) list.get(i);
- for (int j = 0; j < s.length; j++)
- if (s[j] != null)
- {
- availableIDs[count] = s[j];
- ids[count++] = s[j];
- }
- }
-
- Iterator iter = aliases0.entrySet().iterator();
- while (iter.hasNext())
- {
- Map.Entry entry = (Map.Entry) iter.next();
- availableIDs[count] = (String) entry.getKey();
- ids[count++] = (String) entry.getKey();
- }
-
- return ids;
+ HashMap h = timezones();
+ if (zoneinfo_dir == null)
+ return (String[]) h.keySet().toArray(new String[h.size()]);
+
+ if (availableIDs != null)
+ {
+ String[] ids = new String[availableIDs.length];
+ for (int i = 0; i < availableIDs.length; i++)
+ ids[i] = availableIDs[i];
+ return ids;
+ }
+
+ File d = new File(zoneinfo_dir);
+ ArrayList list = new ArrayList(30);
+ int count = getAvailableIDs(d, "", list) + aliases0.size();
+ availableIDs = new String[count];
+ String[] ids = new String[count];
+
+ count = 0;
+ for (int i = 0; i < list.size(); i++)
+ {
+ String[] s = (String[]) list.get(i);
+ for (int j = 0; j < s.length; j++)
+ if (s[j] != null)
+ {
+ availableIDs[count] = s[j];
+ ids[count++] = s[j];
+ }
+ }
+
+ Iterator iter = aliases0.entrySet().iterator();
+ while (iter.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) iter.next();
+ availableIDs[count] = (String) entry.getKey();
+ ids[count++] = (String) entry.getKey();
+ }
+
+ return ids;
}
}
@@ -1766,11 +1766,11 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
{
try
{
- return super.clone();
+ return super.clone();
}
catch (CloneNotSupportedException ex)
{
- return null;
+ return null;
}
}
}
diff --git a/java/util/Timer.java b/java/util/Timer.java
index 9b23a8fe7..99027554c 100644
--- a/java/util/Timer.java
+++ b/java/util/Timer.java
@@ -111,11 +111,11 @@ public class Timer
{
elements++;
if (elements == heap.length)
- {
- TimerTask new_heap[] = new TimerTask[heap.length * 2];
- System.arraycopy(heap, 0, new_heap, 0, heap.length);
- heap = new_heap;
- }
+ {
+ TimerTask new_heap[] = new TimerTask[heap.length * 2];
+ System.arraycopy(heap, 0, new_heap, 0, heap.length);
+ heap = new_heap;
+ }
heap[elements] = task;
}
@@ -130,11 +130,11 @@ public class Timer
heap[elements] = null;
elements--;
if (elements + DEFAULT_SIZE / 2 <= (heap.length / 4))
- {
- TimerTask new_heap[] = new TimerTask[heap.length / 2];
- System.arraycopy(heap, 0, new_heap, 0, elements + 1);
- heap = new_heap;
- }
+ {
+ TimerTask new_heap[] = new TimerTask[heap.length / 2];
+ System.arraycopy(heap, 0, new_heap, 0, elements + 1);
+ heap = new_heap;
+ }
}
/**
@@ -145,25 +145,25 @@ public class Timer
{
// Check if it is legal to add another element
if (heap == null)
- {
- throw new IllegalStateException
- ("cannot enqueue when stop() has been called on queue");
- }
+ {
+ throw new IllegalStateException
+ ("cannot enqueue when stop() has been called on queue");
+ }
- heap[0] = task; // sentinel
- add(task); // put the new task at the end
+ heap[0] = task; // sentinel
+ add(task); // put the new task at the end
// Now push the task up in the heap until it has reached its place
int child = elements;
int parent = child / 2;
while (heap[parent].scheduled > task.scheduled)
- {
- heap[child] = heap[parent];
- child = parent;
- parent = child / 2;
- }
+ {
+ heap[child] = heap[parent];
+ child = parent;
+ parent = child / 2;
+ }
// This is the correct place for the new task
heap[child] = task;
- heap[0] = null; // clear sentinel
+ heap[0] = null; // clear sentinel
// Maybe sched() is waiting for a new element
this.notify();
}
@@ -175,13 +175,13 @@ public class Timer
private TimerTask top()
{
if (elements == 0)
- {
- return null;
- }
+ {
+ return null;
+ }
else
- {
- return heap[1];
- }
+ {
+ return heap[1];
+ }
}
/**
@@ -195,50 +195,50 @@ public class Timer
TimerTask task = null;
while (task == null)
- {
- // Get the next task
- task = top();
-
- // return null when asked to stop
- // or if asked to return null when the queue is empty
- if ((heap == null) || (task == null && nullOnEmpty))
- {
- return null;
- }
-
- // Do we have a task?
- if (task != null)
- {
- // The time to wait until the task should be served
- long time = task.scheduled - System.currentTimeMillis();
- if (time > 0)
- {
- // This task should not yet be served
- // So wait until this task is ready
- // or something else happens to the queue
- task = null; // set to null to make sure we call top()
- try
- {
- this.wait(time);
- }
- catch (InterruptedException _)
- {
- }
- }
- }
- else
- {
- // wait until a task is added
- // or something else happens to the queue
- try
- {
- this.wait();
- }
- catch (InterruptedException _)
- {
- }
- }
- }
+ {
+ // Get the next task
+ task = top();
+
+ // return null when asked to stop
+ // or if asked to return null when the queue is empty
+ if ((heap == null) || (task == null && nullOnEmpty))
+ {
+ return null;
+ }
+
+ // Do we have a task?
+ if (task != null)
+ {
+ // The time to wait until the task should be served
+ long time = task.scheduled - System.currentTimeMillis();
+ if (time > 0)
+ {
+ // This task should not yet be served
+ // So wait until this task is ready
+ // or something else happens to the queue
+ task = null; // set to null to make sure we call top()
+ try
+ {
+ this.wait(time);
+ }
+ catch (InterruptedException _)
+ {
+ }
+ }
+ }
+ else
+ {
+ // wait until a task is added
+ // or something else happens to the queue
+ try
+ {
+ this.wait();
+ }
+ catch (InterruptedException _)
+ {
+ }
+ }
+ }
// reconstruct the heap
TimerTask lastTask = heap[elements];
@@ -249,22 +249,22 @@ public class Timer
int child = 2;
heap[1] = lastTask;
while (child <= elements)
- {
- if (child < elements)
- {
- if (heap[child].scheduled > heap[child + 1].scheduled)
- {
- child++;
- }
- }
-
- if (lastTask.scheduled <= heap[child].scheduled)
- break; // found the correct place (the parent) - done
-
- heap[parent] = heap[child];
- parent = child;
- child = parent * 2;
- }
+ {
+ if (child < elements)
+ {
+ if (heap[child].scheduled > heap[child + 1].scheduled)
+ {
+ child++;
+ }
+ }
+
+ if (lastTask.scheduled <= heap[child].scheduled)
+ break; // found the correct place (the parent) - done
+
+ heap[parent] = heap[child];
+ parent = child;
+ child = parent * 2;
+ }
// this is the correct new place for the lastTask
heap[parent] = lastTask;
@@ -306,53 +306,53 @@ public class Timer
// Null out any elements that are canceled. Skip element 0 as
// it is the sentinel.
for (int i = elements; i > 0; --i)
- {
- if (heap[i].scheduled < 0)
- {
- ++removed;
-
- // Remove an element by pushing the appropriate child
- // into place, and then iterating to the bottom of the
- // tree.
- int index = i;
- while (heap[index] != null)
- {
- int child = 2 * index;
- if (child >= heap.length)
- {
- // Off end; we're done.
- heap[index] = null;
- break;
- }
-
- if (child + 1 >= heap.length || heap[child + 1] == null)
- {
- // Nothing -- we're done.
- }
- else if (heap[child] == null
- || (heap[child].scheduled
- > heap[child + 1].scheduled))
- ++child;
- heap[index] = heap[child];
- index = child;
- }
- }
- }
+ {
+ if (heap[i].scheduled < 0)
+ {
+ ++removed;
+
+ // Remove an element by pushing the appropriate child
+ // into place, and then iterating to the bottom of the
+ // tree.
+ int index = i;
+ while (heap[index] != null)
+ {
+ int child = 2 * index;
+ if (child >= heap.length)
+ {
+ // Off end; we're done.
+ heap[index] = null;
+ break;
+ }
+
+ if (child + 1 >= heap.length || heap[child + 1] == null)
+ {
+ // Nothing -- we're done.
+ }
+ else if (heap[child] == null
+ || (heap[child].scheduled
+ > heap[child + 1].scheduled))
+ ++child;
+ heap[index] = heap[child];
+ index = child;
+ }
+ }
+ }
// Make a new heap if we shrank enough.
int newLen = heap.length;
while (elements - removed + DEFAULT_SIZE / 2 <= newLen / 4)
- newLen /= 2;
+ newLen /= 2;
if (newLen != heap.length)
- {
- TimerTask[] newHeap = new TimerTask[newLen];
- System.arraycopy(heap, 0, newHeap, 0, elements + 1);
- heap = newHeap;
- }
+ {
+ TimerTask[] newHeap = new TimerTask[newLen];
+ System.arraycopy(heap, 0, newHeap, 0, elements + 1);
+ heap = newHeap;
+ }
return removed;
}
- } // TaskQueue
+ } // TaskQueue
/**
* The scheduler that executes all the tasks on a particular TaskQueue,
@@ -378,63 +378,63 @@ public class Timer
{
TimerTask task;
while ((task = queue.serve()) != null)
- {
- // If this task has not been canceled
- if (task.scheduled >= 0)
- {
-
- // Mark execution time
- task.lastExecutionTime = task.scheduled;
-
- // Repeatable task?
- if (task.period < 0)
- {
- // Last time this task is executed
- task.scheduled = -1;
- }
-
- // Run the task
- try
- {
- task.run();
- }
+ {
+ // If this task has not been canceled
+ if (task.scheduled >= 0)
+ {
+
+ // Mark execution time
+ task.lastExecutionTime = task.scheduled;
+
+ // Repeatable task?
+ if (task.period < 0)
+ {
+ // Last time this task is executed
+ task.scheduled = -1;
+ }
+
+ // Run the task
+ try
+ {
+ task.run();
+ }
catch (ThreadDeath death)
{
// If an exception escapes, the Timer becomes invalid.
queue.stop();
throw death;
}
- catch (Throwable t)
- {
- // If an exception escapes, the Timer becomes invalid.
+ catch (Throwable t)
+ {
+ // If an exception escapes, the Timer becomes invalid.
queue.stop();
- }
- }
-
- // Calculate next time and possibly re-enqueue.
- if (task.scheduled >= 0)
- {
- if (task.fixed)
- {
- task.scheduled += task.period;
- }
- else
- {
- task.scheduled = task.period + System.currentTimeMillis();
- }
-
- try
- {
- queue.enqueue(task);
- }
- catch (IllegalStateException ise)
- {
- // Ignore. Apparently the Timer queue has been stopped.
- }
- }
- }
+ }
+ }
+
+ // Calculate next time and possibly re-enqueue.
+ if (task.scheduled >= 0)
+ {
+ if (task.fixed)
+ {
+ task.scheduled += task.period;
+ }
+ else
+ {
+ task.scheduled = task.period + System.currentTimeMillis();
+ }
+
+ try
+ {
+ queue.enqueue(task);
+ }
+ catch (IllegalStateException ise)
+ {
+ // Ignore. Apparently the Timer queue has been stopped.
+ }
+ }
+ }
}
- } // Scheduler
+ } // Scheduler
// Number of Timers created.
// Used for creating nice Thread names.
@@ -474,11 +474,11 @@ public class Timer
this(daemon, Thread.NORM_PRIORITY);
}
- /**
- * Create a new Timer whose Thread has the indicated name. It will have
- * normal priority and will not be a daemon thread.
+ /**
+ * Create a new Timer whose Thread has the indicated name. It will have
+ * normal priority and will not be a daemon thread.
* @param name the name of the Thread
- * @since 1.5
+ * @since 1.5
*/
public Timer(String name)
{
@@ -486,7 +486,7 @@ public class Timer
}
/**
- * Create a new Timer whose Thread has the indicated name. It will have
+ * Create a new Timer whose Thread has the indicated name. It will have
* normal priority. The boolean argument controls whether or not it
* will be a daemon thread.
* @param name the name of the Thread
@@ -548,24 +548,24 @@ public class Timer
if (task.scheduled == 0 && task.lastExecutionTime == -1)
{
- task.scheduled = time;
- task.period = period;
- task.fixed = fixed;
+ task.scheduled = time;
+ task.period = period;
+ task.fixed = fixed;
}
else
{
- throw new IllegalStateException
- ("task was already scheduled or canceled");
+ throw new IllegalStateException
+ ("task was already scheduled or canceled");
}
if (!this.canceled && this.thread != null)
{
- queue.enqueue(task);
+ queue.enqueue(task);
}
else
{
- throw new IllegalStateException
- ("timer was canceled or scheduler thread has died");
+ throw new IllegalStateException
+ ("timer was canceled or scheduler thread has died");
}
}
@@ -573,7 +573,7 @@ public class Timer
{
if (delay < 0)
{
- throw new IllegalArgumentException("delay is negative");
+ throw new IllegalArgumentException("delay is negative");
}
}
@@ -581,7 +581,7 @@ public class Timer
{
if (period < 0)
{
- throw new IllegalArgumentException("period is negative");
+ throw new IllegalArgumentException("period is negative");
}
}
diff --git a/java/util/TreeMap.java b/java/util/TreeMap.java
index 99a42cbfb..87c532fc1 100644
--- a/java/util/TreeMap.java
+++ b/java/util/TreeMap.java
@@ -446,7 +446,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
* (or equal to, if <code>inclusive</code> is true) <code>toKey</code>.
* The returned map is backed by the original, so changes in one appear
* in the other. The submap will throw an {@link IllegalArgumentException}
- * for any attempt to access or add an element beyond the specified cutoff.
+ * for any attempt to access or add an element beyond the specified cutoff.
*
* @param toKey the cutoff point
* @param inclusive true if the cutoff point should be included.
@@ -459,8 +459,8 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
*/
public NavigableMap<K, V> headMap(K toKey, boolean inclusive)
{
- return new SubMap((K)(Object)nil, inclusive
- ? successor(getNode(toKey)).key : toKey);
+ return new SubMap((K)(Object)nil, inclusive
+ ? successor(getNode(toKey)).key : toKey);
}
/**
@@ -641,7 +641,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
* <code>toKey</code>. The returned map is backed by the original, so
* changes in one appear in the other. The submap will throw an
* {@link IllegalArgumentException} for any attempt to access or add an
- * element beyond the specified cutoffs.
+ * element beyond the specified cutoffs.
*
* @param fromKey the low cutoff point
* @param fromInclusive true if the low cutoff point should be included.
@@ -655,10 +655,10 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
* @throws IllegalArgumentException if fromKey is greater than toKey
*/
public NavigableMap<K, V> subMap(K fromKey, boolean fromInclusive,
- K toKey, boolean toInclusive)
+ K toKey, boolean toInclusive)
{
return new SubMap(fromInclusive ? fromKey : successor(getNode(fromKey)).key,
- toInclusive ? successor(getNode(toKey)).key : toKey);
+ toInclusive ? successor(getNode(toKey)).key : toKey);
}
/**
@@ -701,7 +701,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public NavigableMap<K, V> tailMap(K fromKey, boolean inclusive)
{
return new SubMap(inclusive ? fromKey : successor(getNode(fromKey)).key,
- (K)(Object)nil);
+ (K)(Object)nil);
}
/**
@@ -873,9 +873,9 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
if (count == 0)
{
- root = nil;
- size = 0;
- return;
+ root = nil;
+ size = 0;
+ return;
}
// We color every row of nodes black, except for the overflow nodes.
@@ -1601,7 +1601,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
Entry<K,V> n = TreeMap.this.ceilingEntry(key);
if (n != null && keyInRange(n.getKey()))
- return n;
+ return n;
return null;
}
@@ -1609,9 +1609,9 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
K found = TreeMap.this.ceilingKey(key);
if (keyInRange(found))
- return found;
+ return found;
else
- return null;
+ return null;
}
public NavigableSet<K> descendingKeySet()
@@ -1622,10 +1622,10 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public NavigableMap<K,V> descendingMap()
{
if (descendingMap == null)
- descendingMap = new DescendingMap(this);
+ descendingMap = new DescendingMap(this);
return descendingMap;
}
-
+
public void clear()
{
Node next = lowestGreaterThan(minKey, true);
@@ -1674,7 +1674,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
Node<K,V> node = lowestGreaterThan(minKey, true);
if (node == nil || ! keyInRange(node.key))
- return null;
+ return null;
return node;
}
@@ -1690,7 +1690,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
Entry<K,V> n = TreeMap.this.floorEntry(key);
if (n != null && keyInRange(n.getKey()))
- return n;
+ return n;
return null;
}
@@ -1698,9 +1698,9 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
K found = TreeMap.this.floorKey(key);
if (keyInRange(found))
- return found;
+ return found;
else
- return null;
+ return null;
}
public V get(Object key)
@@ -1719,8 +1719,8 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
if (!keyInRange(toKey))
throw new IllegalArgumentException("Key outside submap range");
- return new SubMap(minKey, (inclusive ?
- successor(getNode(toKey)).key : toKey));
+ return new SubMap(minKey, (inclusive ?
+ successor(getNode(toKey)).key : toKey));
}
public Set<K> keySet()
@@ -1736,7 +1736,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
Entry<K,V> n = TreeMap.this.higherEntry(key);
if (n != null && keyInRange(n.getKey()))
- return n;
+ return n;
return null;
}
@@ -1744,9 +1744,9 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
K found = TreeMap.this.higherKey(key);
if (keyInRange(found))
- return found;
+ return found;
else
- return null;
+ return null;
}
public Entry<K,V> lastEntry()
@@ -1766,7 +1766,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
Entry<K,V> n = TreeMap.this.lowerEntry(key);
if (n != null && keyInRange(n.getKey()))
- return n;
+ return n;
return null;
}
@@ -1774,9 +1774,9 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
K found = TreeMap.this.lowerKey(key);
if (keyInRange(found))
- return found;
+ return found;
else
- return null;
+ return null;
}
public NavigableSet<K> navigableKeySet()
@@ -1785,14 +1785,14 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
// Create an AbstractSet with custom implementations of those methods
// that can be overriden easily and efficiently.
this.nKeys = new SubMap.NavigableKeySet();
- return this.nKeys;
+ return this.nKeys;
}
public Entry<K,V> pollFirstEntry()
{
Entry<K,V> e = firstEntry();
if (e != null)
- removeNode((Node<K,V>) e);
+ removeNode((Node<K,V>) e);
return e;
}
@@ -1800,7 +1800,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
Entry<K,V> e = lastEntry();
if (e != null)
- removeNode((Node<K,V>) e);
+ removeNode((Node<K,V>) e);
return e;
}
@@ -1837,25 +1837,25 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
}
public NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
- K toKey, boolean toInclusive)
+ K toKey, boolean toInclusive)
{
if (! keyInRange(fromKey) || ! keyInRange(toKey))
throw new IllegalArgumentException("key outside range");
- return new SubMap(fromInclusive ? fromKey : successor(getNode(fromKey)).key,
- toInclusive ? successor(getNode(toKey)).key : toKey);
+ return new SubMap(fromInclusive ? fromKey : successor(getNode(fromKey)).key,
+ toInclusive ? successor(getNode(toKey)).key : toKey);
}
public SortedMap<K, V> tailMap(K fromKey)
{
return tailMap(fromKey, true);
}
-
+
public NavigableMap<K,V> tailMap(K fromKey, boolean inclusive)
{
if (! keyInRange(fromKey))
throw new IllegalArgumentException("key outside range");
return new SubMap(inclusive ? fromKey : successor(getNode(fromKey)).key,
- maxKey);
+ maxKey);
}
public Collection<V> values()
@@ -1884,47 +1884,47 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
};
return this.values;
}
-
+
private class KeySet
extends AbstractSet<K>
{
public int size()
{
- return SubMap.this.size();
+ return SubMap.this.size();
}
-
+
public Iterator<K> iterator()
{
- Node first = lowestGreaterThan(minKey, true);
- Node max = lowestGreaterThan(maxKey, false);
- return new TreeIterator(KEYS, first, max);
+ Node first = lowestGreaterThan(minKey, true);
+ Node max = lowestGreaterThan(maxKey, false);
+ return new TreeIterator(KEYS, first, max);
}
-
+
public void clear()
{
- SubMap.this.clear();
+ SubMap.this.clear();
}
-
+
public boolean contains(Object o)
{
- if (! keyInRange((K) o))
- return false;
- return getNode((K) o) != nil;
+ if (! keyInRange((K) o))
+ return false;
+ return getNode((K) o) != nil;
}
-
+
public boolean remove(Object o)
{
- if (! keyInRange((K) o))
- return false;
- Node n = getNode((K) o);
- if (n != nil)
- {
- removeNode(n);
- return true;
- }
- return false;
- }
-
+ if (! keyInRange((K) o))
+ return false;
+ Node n = getNode((K) o);
+ if (n != nil)
+ {
+ removeNode(n);
+ return true;
+ }
+ return false;
+ }
+
} // class SubMap.KeySet
private final class NavigableKeySet
@@ -1934,91 +1934,91 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public K ceiling(K k)
{
- return SubMap.this.ceilingKey(k);
+ return SubMap.this.ceilingKey(k);
}
-
+
public Comparator<? super K> comparator()
{
- return comparator;
+ return comparator;
}
-
+
public Iterator<K> descendingIterator()
{
- return descendingSet().iterator();
+ return descendingSet().iterator();
}
-
+
public NavigableSet<K> descendingSet()
{
- return new DescendingSet(this);
+ return new DescendingSet(this);
}
-
+
public K first()
{
- return SubMap.this.firstKey();
+ return SubMap.this.firstKey();
}
-
+
public K floor(K k)
{
- return SubMap.this.floorKey(k);
+ return SubMap.this.floorKey(k);
}
-
+
public SortedSet<K> headSet(K to)
{
- return headSet(to, false);
+ return headSet(to, false);
}
public NavigableSet<K> headSet(K to, boolean inclusive)
{
- return SubMap.this.headMap(to, inclusive).navigableKeySet();
+ return SubMap.this.headMap(to, inclusive).navigableKeySet();
}
public K higher(K k)
{
- return SubMap.this.higherKey(k);
+ return SubMap.this.higherKey(k);
}
public K last()
{
- return SubMap.this.lastKey();
+ return SubMap.this.lastKey();
}
public K lower(K k)
{
- return SubMap.this.lowerKey(k);
+ return SubMap.this.lowerKey(k);
}
public K pollFirst()
{
- return SubMap.this.pollFirstEntry().getKey();
+ return SubMap.this.pollFirstEntry().getKey();
}
public K pollLast()
{
- return SubMap.this.pollLastEntry().getKey();
+ return SubMap.this.pollLastEntry().getKey();
}
public SortedSet<K> subSet(K from, K to)
{
- return subSet(from, true, to, false);
+ return subSet(from, true, to, false);
}
-
+
public NavigableSet<K> subSet(K from, boolean fromInclusive,
- K to, boolean toInclusive)
+ K to, boolean toInclusive)
{
- return SubMap.this.subMap(from, fromInclusive,
- to, toInclusive).navigableKeySet();
+ return SubMap.this.subMap(from, fromInclusive,
+ to, toInclusive).navigableKeySet();
}
public SortedSet<K> tailSet(K from)
{
- return tailSet(from, true);
+ return tailSet(from, true);
}
-
+
public NavigableSet<K> tailSet(K from, boolean inclusive)
{
- return SubMap.this.tailMap(from, inclusive).navigableKeySet();
+ return SubMap.this.tailMap(from, inclusive).navigableKeySet();
}
-
+
} // class SubMap.NavigableKeySet
/**
@@ -2027,54 +2027,54 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
private class EntrySet
extends AbstractSet<Entry<K,V>>
{
-
+
public int size()
{
return SubMap.this.size();
}
-
+
public Iterator<Map.Entry<K,V>> iterator()
{
Node first = lowestGreaterThan(minKey, true);
Node max = lowestGreaterThan(maxKey, false);
return new TreeIterator(ENTRIES, first, max);
}
-
+
public void clear()
{
SubMap.this.clear();
}
-
+
public boolean contains(Object o)
{
if (! (o instanceof Map.Entry))
- return false;
+ return false;
Map.Entry<K,V> me = (Map.Entry<K,V>) o;
K key = me.getKey();
if (! keyInRange(key))
- return false;
+ return false;
Node<K,V> n = getNode(key);
return n != nil && AbstractSet.equals(me.getValue(), n.value);
}
-
+
public boolean remove(Object o)
{
if (! (o instanceof Map.Entry))
- return false;
+ return false;
Map.Entry<K,V> me = (Map.Entry<K,V>) o;
K key = me.getKey();
if (! keyInRange(key))
- return false;
+ return false;
Node<K,V> n = getNode(key);
if (n != nil && AbstractSet.equals(me.getValue(), n.value))
- {
- removeNode(n);
- return true;
- }
+ {
+ removeNode(n);
+ return true;
+ }
return false;
}
} // class SubMap.EntrySet
-
+
private final class NavigableEntrySet
extends EntrySet
implements NavigableSet<Entry<K,V>>
@@ -2082,103 +2082,103 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public Entry<K,V> ceiling(Entry<K,V> e)
{
- return SubMap.this.ceilingEntry(e.getKey());
+ return SubMap.this.ceilingEntry(e.getKey());
}
-
+
public Comparator<? super Entry<K,V>> comparator()
{
- return new Comparator<Entry<K,V>>()
- {
- public int compare(Entry<K,V> t1, Entry<K,V> t2)
- {
- return comparator.compare(t1.getKey(), t2.getKey());
- }
- };
+ return new Comparator<Entry<K,V>>()
+ {
+ public int compare(Entry<K,V> t1, Entry<K,V> t2)
+ {
+ return comparator.compare(t1.getKey(), t2.getKey());
+ }
+ };
}
-
+
public Iterator<Entry<K,V>> descendingIterator()
{
- return descendingSet().iterator();
+ return descendingSet().iterator();
}
-
+
public NavigableSet<Entry<K,V>> descendingSet()
{
- return new DescendingSet(this);
+ return new DescendingSet(this);
}
-
+
public Entry<K,V> first()
{
- return SubMap.this.firstEntry();
+ return SubMap.this.firstEntry();
}
-
+
public Entry<K,V> floor(Entry<K,V> e)
{
- return SubMap.this.floorEntry(e.getKey());
+ return SubMap.this.floorEntry(e.getKey());
}
-
+
public SortedSet<Entry<K,V>> headSet(Entry<K,V> to)
{
- return headSet(to, false);
+ return headSet(to, false);
}
public NavigableSet<Entry<K,V>> headSet(Entry<K,V> to, boolean inclusive)
{
- return (NavigableSet<Entry<K,V>>)
- SubMap.this.headMap(to.getKey(), inclusive).entrySet();
+ return (NavigableSet<Entry<K,V>>)
+ SubMap.this.headMap(to.getKey(), inclusive).entrySet();
}
public Entry<K,V> higher(Entry<K,V> e)
{
- return SubMap.this.higherEntry(e.getKey());
+ return SubMap.this.higherEntry(e.getKey());
}
public Entry<K,V> last()
{
- return SubMap.this.lastEntry();
+ return SubMap.this.lastEntry();
}
public Entry<K,V> lower(Entry<K,V> e)
{
- return SubMap.this.lowerEntry(e.getKey());
+ return SubMap.this.lowerEntry(e.getKey());
}
public Entry<K,V> pollFirst()
{
- return SubMap.this.pollFirstEntry();
+ return SubMap.this.pollFirstEntry();
}
public Entry<K,V> pollLast()
{
- return SubMap.this.pollLastEntry();
+ return SubMap.this.pollLastEntry();
}
public SortedSet<Entry<K,V>> subSet(Entry<K,V> from, Entry<K,V> to)
{
- return subSet(from, true, to, false);
+ return subSet(from, true, to, false);
}
-
+
public NavigableSet<Entry<K,V>> subSet(Entry<K,V> from, boolean fromInclusive,
- Entry<K,V> to, boolean toInclusive)
+ Entry<K,V> to, boolean toInclusive)
{
- return (NavigableSet<Entry<K,V>>)
- SubMap.this.subMap(from.getKey(), fromInclusive,
- to.getKey(), toInclusive).entrySet();
+ return (NavigableSet<Entry<K,V>>)
+ SubMap.this.subMap(from.getKey(), fromInclusive,
+ to.getKey(), toInclusive).entrySet();
}
public SortedSet<Entry<K,V>> tailSet(Entry<K,V> from)
{
- return tailSet(from, true);
+ return tailSet(from, true);
}
-
+
public NavigableSet<Entry<K,V>> tailSet(Entry<K,V> from, boolean inclusive)
{
- return (NavigableSet<Entry<K,V>>)
- SubMap.this.tailMap(from.getKey(), inclusive).navigableKeySet();
+ return (NavigableSet<Entry<K,V>>)
+ SubMap.this.tailMap(from.getKey(), inclusive).navigableKeySet();
}
-
+
} // class SubMap.NavigableEntrySet
-} // class SubMap
+} // class SubMap
/**
* Returns the entry associated with the least or lowest key
@@ -2326,7 +2326,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
* <code>null</code> if there is no such key.
*
* @param key the key relative to the returned entry.
- * @return the entry with the least key greater than
+ * @return the entry with the least key greater than
* the given key, or <code>null</code> if there is
* no such key.
* @throws ClassCastException if the specified key can not
@@ -2385,7 +2385,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
* <code>null</code> if there is no such key.
*
* @param key the key relative to the returned entry.
- * @return the entry with the greatest key less than
+ * @return the entry with the greatest key less than
* the given key, or <code>null</code> if there is
* no such key.
* @throws ClassCastException if the specified key can not
@@ -2473,7 +2473,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
Entry<K,V> e = lastEntry();
if (e != null)
removeNode((Node<K,V>)e);
- return e;
+ return e;
}
/**
@@ -2524,7 +2524,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
this.map = map;
}
-
+
public Map.Entry<DK,DV> ceilingEntry(DK key)
{
return map.floorEntry(key);
@@ -2549,7 +2549,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
return map.containsKey(o);
}
-
+
public boolean containsValue(Object o)
{
return map.containsValue(o);
@@ -2568,9 +2568,9 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public Set<Entry<DK,DV>> entrySet()
{
if (entries == null)
- entries =
- new DescendingSet<Entry<DK,DV>>((NavigableSet<Entry<DK,DV>>)
- map.entrySet());
+ entries =
+ new DescendingSet<Entry<DK,DV>>((NavigableSet<Entry<DK,DV>>)
+ map.entrySet());
return entries;
}
@@ -2632,7 +2632,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public Set<DK> keySet()
{
if (keys == null)
- keys = new DescendingSet<DK>(map.navigableKeySet());
+ keys = new DescendingSet<DK>(map.navigableKeySet());
return keys;
}
@@ -2664,7 +2664,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public NavigableSet<DK> navigableKeySet()
{
if (nKeys == null)
- nKeys = new DescendingSet<DK>(map.navigableKeySet());
+ nKeys = new DescendingSet<DK>(map.navigableKeySet());
return nKeys;
}
@@ -2704,10 +2704,10 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
}
public NavigableMap<DK,DV> subMap(DK fromKey, boolean fromInclusive,
- DK toKey, boolean toInclusive)
+ DK toKey, boolean toInclusive)
{
return new DescendingMap(map.subMap(fromKey, fromInclusive,
- toKey, toInclusive));
+ toKey, toInclusive));
}
public SortedMap<DK,DV> tailMap(DK fromKey)
@@ -2726,11 +2726,11 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
final Iterator<Entry<DK,DV>> it = entrySet().iterator();
while (it.hasNext())
{
- final Entry<DK,DV> e = it.next();
+ final Entry<DK,DV> e = it.next();
r.append(e.getKey());
r.append('=');
r.append(e.getValue());
- r.append(", ");
+ r.append(", ");
}
r.replace(r.length() - 2, r.length(), "}");
return r.toString();
@@ -2742,53 +2742,53 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
// Create an AbstractCollection with custom implementations of those
// methods that can be overriden easily and efficiently.
values = new AbstractCollection()
- {
- public int size()
- {
- return DescendingMap.this.size();
- }
-
- public Iterator<DV> iterator()
- {
- return new Iterator<DV>()
- {
- /** The last Entry returned by a next() call. */
- private Entry<DK,DV> last;
-
- /** The next entry that should be returned by next(). */
- private Entry<DK,DV> next = firstEntry();
-
- public boolean hasNext()
- {
- return next != null;
- }
-
- public DV next()
- {
- if (next == null)
- throw new NoSuchElementException();
- last = next;
- next = higherEntry(last.getKey());
-
- return last.getValue();
- }
-
- public void remove()
- {
- if (last == null)
- throw new IllegalStateException();
-
- DescendingMap.this.remove(last.getKey());
- last = null;
- }
- };
- }
-
- public void clear()
- {
- DescendingMap.this.clear();
- }
- };
+ {
+ public int size()
+ {
+ return DescendingMap.this.size();
+ }
+
+ public Iterator<DV> iterator()
+ {
+ return new Iterator<DV>()
+ {
+ /** The last Entry returned by a next() call. */
+ private Entry<DK,DV> last;
+
+ /** The next entry that should be returned by next(). */
+ private Entry<DK,DV> next = firstEntry();
+
+ public boolean hasNext()
+ {
+ return next != null;
+ }
+
+ public DV next()
+ {
+ if (next == null)
+ throw new NoSuchElementException();
+ last = next;
+ next = higherEntry(last.getKey());
+
+ return last.getValue();
+ }
+
+ public void remove()
+ {
+ if (last == null)
+ throw new IllegalStateException();
+
+ DescendingMap.this.remove(last.getKey());
+ last = null;
+ }
+ };
+ }
+
+ public void clear()
+ {
+ DescendingMap.this.clear();
+ }
+ };
return values;
}
@@ -2815,17 +2815,17 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
TreeMap.this.clear();
}
-
+
public boolean contains(Object o)
{
return containsKey(o);
}
-
+
public boolean remove(Object key)
{
Node<K,V> n = getNode((K) key);
if (n == nil)
- return false;
+ return false;
removeNode(n);
return true;
}
@@ -2912,10 +2912,10 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
}
public NavigableSet<K> subSet(K from, boolean fromInclusive,
- K to, boolean toInclusive)
+ K to, boolean toInclusive)
{
return subMap(from, fromInclusive,
- to, toInclusive).navigableKeySet();
+ to, toInclusive).navigableKeySet();
}
public SortedSet<K> tailSet(K from)
@@ -2959,7 +2959,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
this.set = set;
}
-
+
public boolean add(D e)
{
return set.add(e);
@@ -3048,38 +3048,38 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public Iterator<D> iterator()
{
return new Iterator<D>()
- {
-
- /** The last element returned by a next() call. */
- private D last;
-
- /** The next element that should be returned by next(). */
- private D next = first();
-
- public boolean hasNext()
- {
- return next != null;
- }
-
- public D next()
- {
- if (next == null)
- throw new NoSuchElementException();
- last = next;
- next = higher(last);
-
- return last;
- }
-
- public void remove()
- {
- if (last == null)
- throw new IllegalStateException();
-
- DescendingSet.this.remove(last);
- last = null;
- }
- };
+ {
+
+ /** The last element returned by a next() call. */
+ private D last;
+
+ /** The next element that should be returned by next(). */
+ private D next = first();
+
+ public boolean hasNext()
+ {
+ return next != null;
+ }
+
+ public D next()
+ {
+ if (next == null)
+ throw new NoSuchElementException();
+ last = next;
+ next = higher(last);
+
+ return last;
+ }
+
+ public void remove()
+ {
+ if (last == null)
+ throw new IllegalStateException();
+
+ DescendingSet.this.remove(last);
+ last = null;
+ }
+ };
}
public D last()
@@ -3128,10 +3128,10 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
}
public NavigableSet<D> subSet(D from, boolean fromInclusive,
- D to, boolean toInclusive)
+ D to, boolean toInclusive)
{
return new DescendingSet(set.subSet(from, fromInclusive,
- to, toInclusive));
+ to, toInclusive));
}
public SortedSet<D> tailSet(D from)
@@ -3164,12 +3164,12 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
final Iterator<D> it = iterator();
while (it.hasNext())
{
- final D o = it.next();
- if (o == this)
- r.append("<this>");
- else
- r.append(o);
- r.append(", ");
+ final D o = it.next();
+ if (o == this)
+ r.append("<this>");
+ else
+ r.append(o);
+ r.append(", ");
}
r.replace(r.length() - 2, r.length(), "]");
return r.toString();
@@ -3184,12 +3184,12 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
return size;
}
-
+
public Iterator<Map.Entry<K,V>> iterator()
{
return new TreeIterator(ENTRIES);
}
-
+
public void clear()
{
TreeMap.this.clear();
@@ -3198,68 +3198,68 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public boolean contains(Object o)
{
if (! (o instanceof Map.Entry))
- return false;
+ return false;
Map.Entry<K,V> me = (Map.Entry<K,V>) o;
Node<K,V> n = getNode(me.getKey());
return n != nil && AbstractSet.equals(me.getValue(), n.value);
}
-
+
public boolean remove(Object o)
{
if (! (o instanceof Map.Entry))
- return false;
+ return false;
Map.Entry<K,V> me = (Map.Entry<K,V>) o;
Node<K,V> n = getNode(me.getKey());
if (n != nil && AbstractSet.equals(me.getValue(), n.value))
- {
- removeNode(n);
- return true;
- }
+ {
+ removeNode(n);
+ return true;
+ }
return false;
}
}
-
+
private final class NavigableEntrySet
extends EntrySet
implements NavigableSet<Entry<K,V>>
{
-
+
public Entry<K,V> ceiling(Entry<K,V> e)
{
return ceilingEntry(e.getKey());
}
-
+
public Comparator<? super Entry<K,V>> comparator()
{
return new Comparator<Entry<K,V>>()
- {
- public int compare(Entry<K,V> t1, Entry<K,V> t2)
- {
- return comparator.compare(t1.getKey(), t2.getKey());
- }
- };
- }
-
+ {
+ public int compare(Entry<K,V> t1, Entry<K,V> t2)
+ {
+ return comparator.compare(t1.getKey(), t2.getKey());
+ }
+ };
+ }
+
public Iterator<Entry<K,V>> descendingIterator()
{
return descendingSet().iterator();
}
-
+
public NavigableSet<Entry<K,V>> descendingSet()
{
return new DescendingSet(this);
}
-
+
public Entry<K,V> first()
{
return firstEntry();
}
-
+
public Entry<K,V> floor(Entry<K,V> e)
{
return floorEntry(e.getKey());
}
-
+
public SortedSet<Entry<K,V>> headSet(Entry<K,V> to)
{
return headSet(to, false);
@@ -3269,7 +3269,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
return (NavigableSet<Entry<K,V>>) headMap(to.getKey(), inclusive).entrySet();
}
-
+
public Entry<K,V> higher(Entry<K,V> e)
{
return higherEntry(e.getKey());
@@ -3299,24 +3299,24 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
{
return subSet(from, true, to, false);
}
-
+
public NavigableSet<Entry<K,V>> subSet(Entry<K,V> from, boolean fromInclusive,
- Entry<K,V> to, boolean toInclusive)
+ Entry<K,V> to, boolean toInclusive)
{
return (NavigableSet<Entry<K,V>>) subMap(from.getKey(), fromInclusive,
- to.getKey(), toInclusive).entrySet();
+ to.getKey(), toInclusive).entrySet();
}
public SortedSet<Entry<K,V>> tailSet(Entry<K,V> from)
{
return tailSet(from, true);
}
-
+
public NavigableSet<Entry<K,V>> tailSet(Entry<K,V> from, boolean inclusive)
{
return (NavigableSet<Entry<K,V>>) tailMap(from.getKey(), inclusive).navigableKeySet();
}
-
+
} // class NavigableEntrySet
} // class TreeMap
diff --git a/java/util/TreeSet.java b/java/util/TreeSet.java
index 572cda642..06f4fa5b3 100644
--- a/java/util/TreeSet.java
+++ b/java/util/TreeSet.java
@@ -291,7 +291,7 @@ public class TreeSet<T> extends AbstractSet<T>
* The returned set is backed by the original, so changes
* in one appear in the other. The subset will throw an
* {@link IllegalArgumentException} for any attempt to access or add an
- * element beyond the specified cutoff.
+ * element beyond the specified cutoff.
*
* @param to the cutoff point
* @param inclusive true if <code>to</code> should be included.
@@ -406,10 +406,10 @@ public class TreeSet<T> extends AbstractSet<T>
* @throws IllegalArgumentException if from is greater than to
*/
public NavigableSet<T> subSet(T from, boolean fromInclusive,
- T to, boolean toInclusive)
+ T to, boolean toInclusive)
{
return new TreeSet<T>(map.subMap(from, fromInclusive,
- to, toInclusive));
+ to, toInclusive));
}
/**
@@ -574,7 +574,7 @@ public class TreeSet<T> extends AbstractSet<T>
* no such element.
*
* @param e the element relative to the returned element.
- * @return the least element greater than
+ * @return the least element greater than
* the given element, or <code>null</code> if there is
* no such element.
* @throws ClassCastException if the specified element can not
@@ -596,7 +596,7 @@ public class TreeSet<T> extends AbstractSet<T>
* no such element.
*
* @param e the element relative to the returned element.
- * @return the greatest element less than
+ * @return the greatest element less than
* the given element, or <code>null</code> if there is
* no such element.
* @throws ClassCastException if the specified element can not
diff --git a/java/util/UUID.java b/java/util/UUID.java
index 9a402d159..bb25e071c 100644
--- a/java/util/UUID.java
+++ b/java/util/UUID.java
@@ -44,29 +44,29 @@ import java.security.NoSuchAlgorithmException;
/**
* This class represents a 128-bit UUID value.
- *
+ *
* There are several types of UUID, and while this class can be used to store
- * them, only the Leach-Salz (variant 2) UUID specified in RFC-4122 will
+ * them, only the Leach-Salz (variant 2) UUID specified in RFC-4122 will
* give meaningful results from the method calls.
* See: http://tools.ietf.org/html/4122 for the details
*
- * The format of a Leach-Salz (variant 2) time-based (version 1) UUID
+ * The format of a Leach-Salz (variant 2) time-based (version 1) UUID
* is as follows:
* time_low - upper 32 bits of the most significant 64 bits,
* this is the least-significant part of the timestamp.
*
* time_mid - bits 16-31 of the most significant 64 bits,
- * this is the middle portion of the timestamp.
+ * this is the middle portion of the timestamp.
*
- * version - bits 8-15 of the most significant 64 bits.
+ * version - bits 8-15 of the most significant 64 bits.
*
* time_hi - bits 0-7 of the most significant 64 bits,
* the most significant portion of the timestamp.
*
* clock_and_reserved - bits 48-63 of the least significant 64 bits.
- * a variable number of bits hold the variant
+ * a variable number of bits hold the variant
* (see the spec)
- *
+ *
* node identifier - bits 0-47 of the least signficant 64 bits.
*
* These fields are valid only for version 1, in the remaining versions,
@@ -75,8 +75,8 @@ import java.security.NoSuchAlgorithmException;
* @since 1.5
* @author Sven de Marothy
*/
-public final class UUID
- extends Object
+public final class UUID
+ extends Object
implements Serializable, Comparable<UUID>
{
private static final long serialVersionUID = -4856846361193249489L;
@@ -106,7 +106,7 @@ public final class UUID
this.mostSigBits = mostSigBits;
this.leastSigBits = leastSigBits;
}
-
+
/**
* Returns the clock-sequence value of this UUID.
* This field only exists in a time-based (version 1) UUID.
@@ -147,8 +147,8 @@ public final class UUID
{
if( !(obj instanceof UUID ) )
return false;
- return ( ((UUID)obj).mostSigBits == mostSigBits &&
- ((UUID)obj).leastSigBits == leastSigBits );
+ return ( ((UUID)obj).mostSigBits == mostSigBits &&
+ ((UUID)obj).leastSigBits == leastSigBits );
}
/**
@@ -164,7 +164,7 @@ public final class UUID
StringTokenizer st = new StringTokenizer( name.trim(), "-" );
if( st.countTokens() < 5 )
throw new IllegalArgumentException( "Incorrect UUID string"+
- " representation:"+name );
+ " representation:"+name );
long msb = (Long.parseLong(st.nextToken(), 16) << 32); // time low
msb |= (Long.parseLong(st.nextToken(), 16) << 16); // time mid
@@ -195,18 +195,18 @@ public final class UUID
return // time-low first
padHex( (( mostSigBits & 0xFFFFFFFF00000000L) >> 32) & 0xFFFFFFFFL, 8)
+ "-" + // then time-mid
- padHex( (( mostSigBits & 0xFFFF0000L ) >> 16), 4 )
+ padHex( (( mostSigBits & 0xFFFF0000L ) >> 16), 4 )
+ "-" + // time-high
- padHex( ( mostSigBits & 0x0000000000000000FFFFL ), 4 )
+ padHex( ( mostSigBits & 0x0000000000000000FFFFL ), 4 )
+ "-" + // clock (note - no reason to separate high and low here)
- padHex( (((leastSigBits & 0xFFFF000000000000L) >> 48) & 0xFFFF), 4 )
+ padHex( (((leastSigBits & 0xFFFF000000000000L) >> 48) & 0xFFFF), 4 )
+ "-" + // finally the node value.
- padHex(leastSigBits & 0xFFFFFFFFFFFFL, 12);
+ padHex(leastSigBits & 0xFFFFFFFFFFFFL, 12);
}
/**
* Returns the least significant 64 bits of the UUID as a <code>long</code>.
- */
+ */
public long getLeastSignificantBits()
{
return leastSigBits;
@@ -214,7 +214,7 @@ public final class UUID
/**
* Returns the most significant 64 bits of the UUID as a <code>long</code>.
- */
+ */
public long getMostSignificantBits()
{
return mostSigBits;
@@ -238,20 +238,20 @@ public final class UUID
* from a series of bytes representing a name.
*/
public static UUID nameUUIDFromBytes(byte[] name)
- {
+ {
long msb, lsb;
byte[] hash;
try
{
- MessageDigest md5 = MessageDigest.getInstance("MD5");
- hash = md5.digest( name );
- }
- catch (NoSuchAlgorithmException e)
+ MessageDigest md5 = MessageDigest.getInstance("MD5");
+ hash = md5.digest( name );
+ }
+ catch (NoSuchAlgorithmException e)
{
- throw new UnsupportedOperationException("No MD5 algorithm available.");
+ throw new UnsupportedOperationException("No MD5 algorithm available.");
}
-
+
msb = ((hash[0] & 0xFFL) << 56) | ((hash[1] & 0xFFL) << 48) |
((hash[2] & 0xFFL) << 40) | ((hash[3] & 0xFFL) << 32) |
((hash[4] & 0xFFL) << 24) | ((hash[5] & 0xFFL) << 16) |
@@ -262,23 +262,23 @@ public final class UUID
((hash[12] & 0xFFL) << 24) | ((hash[13] & 0xFFL) << 16) |
((hash[14] & 0xFFL) << 8) | (hash[15] & 0xFFL);
- lsb &= 0x3FFFFFFFFFFFFFFFL;
+ lsb &= 0x3FFFFFFFFFFFFFFFL;
lsb |= 0x8000000000000000L; // set top two bits to variant 2
- msb &= 0xFFFFFFFFFFFF0FFFL;
- msb |= 0x3000; // Version 3;
+ msb &= 0xFFFFFFFFFFFF0FFFL;
+ msb |= 0x3000; // Version 3;
return new UUID(msb, lsb);
}
/**
- * Returns the 48-bit node value in a long.
+ * Returns the 48-bit node value in a long.
* This field only exists in a time-based (version 1) UUID.
*
* @throws UnsupportedOperationException if the UUID type is not 1.
* @returns a long with the node value in the lower 48 bits.
*/
- public long node()
+ public long node()
{
if( version() != 1 )
throw new UnsupportedOperationException("Not a type 1 UUID");
@@ -286,7 +286,7 @@ public final class UUID
}
/**
- * Returns the 60-bit timestamp value of the UUID in a long.
+ * Returns the 60-bit timestamp value of the UUID in a long.
* This field only exists in a time-based (version 1) UUID.
*
* @throws UnsupportedOperationException if the UUID type is not 1.
@@ -309,15 +309,15 @@ public final class UUID
*
*/
public static UUID randomUUID()
- {
- long lsb = r.nextLong();
+ {
+ long lsb = r.nextLong();
long msb = r.nextLong();
- lsb &= 0x3FFFFFFFFFFFFFFFL;
+ lsb &= 0x3FFFFFFFFFFFFFFFL;
lsb |= 0x8000000000000000L; // set top two bits to variant 2
- msb &= 0xFFFFFFFFFFFF0FFFL;
- msb |= 0x4000; // Version 4;
+ msb &= 0xFFFFFFFFFFFF0FFFL;
+ msb |= 0x4000; // Version 4;
return new UUID( msb, lsb );
}
@@ -350,7 +350,7 @@ public final class UUID
return 0;
if( (v & 0x02) == 0 ) // variant is 0 1 (Leach-Salz)
return 2;
- return v; // 6 or 7
+ return v; // 6 or 7
}
/**
diff --git a/java/util/UnknownFormatConversionException.java b/java/util/UnknownFormatConversionException.java
index e37d9d356..7326a8250 100644
--- a/java/util/UnknownFormatConversionException.java
+++ b/java/util/UnknownFormatConversionException.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when a {@link Formatter} is supplied with an
* unknown conversion.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class UnknownFormatConversionException
+public class UnknownFormatConversionException
extends IllegalFormatException
{
private static final long serialVersionUID = 19060418L;
diff --git a/java/util/UnknownFormatFlagsException.java b/java/util/UnknownFormatFlagsException.java
index b8f939ec4..a7f4fc6ab 100644
--- a/java/util/UnknownFormatFlagsException.java
+++ b/java/util/UnknownFormatFlagsException.java
@@ -38,15 +38,15 @@ exception statement from your version. */
package java.util;
-/**
+/**
* Thrown when a {@link Formatter} is supplied with an
* unknown flag.
*
* @author Tom Tromey (tromey@redhat.com)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
- * @since 1.5
+ * @since 1.5
*/
-public class UnknownFormatFlagsException
+public class UnknownFormatFlagsException
extends IllegalFormatException
{
private static final long serialVersionUID = 19370506L;
@@ -72,7 +72,7 @@ public class UnknownFormatFlagsException
super("Unknown flag passed in " + s);
if (s == null)
throw new
- NullPointerException("Null flags value passed to constructor.");
+ NullPointerException("Null flags value passed to constructor.");
this.flags = s;
}
diff --git a/java/util/Vector.java b/java/util/Vector.java
index 101a78dda..44370a1e4 100644
--- a/java/util/Vector.java
+++ b/java/util/Vector.java
@@ -1,5 +1,5 @@
/* Vector.java -- Class that provides growable arrays.
- Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005, 2006,
+ Copyright (C) 1998, 1999, 2000, 2001, 2004, 2005, 2006,
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -167,8 +167,8 @@ public class Vector<T> extends AbstractList<T>
/**
* Copies the contents of the Vector into the provided array. If the
- * array is too small to fit all the elements in the Vector, an
- * {@link IndexOutOfBoundsException} is thrown without modifying the array.
+ * array is too small to fit all the elements in the Vector, an
+ * {@link IndexOutOfBoundsException} is thrown without modifying the array.
* Old elements in the array are overwritten by the new elements.
*
* @param a target array for the copy
@@ -578,7 +578,7 @@ public class Vector<T> extends AbstractList<T>
{
if (a.length < elementCount)
a = (S[]) Array.newInstance(a.getClass().getComponentType(),
- elementCount);
+ elementCount);
else if (a.length > elementCount)
a[elementCount] = null;
System.arraycopy(elementData, 0, a, 0, elementCount);
@@ -800,7 +800,7 @@ public class Vector<T> extends AbstractList<T>
int end = index + csize;
if (elementCount > 0 && index != elementCount)
System.arraycopy(elementData, index,
- elementData, end, elementCount - index);
+ elementData, end, elementCount - index);
elementCount += csize;
for ( ; index < end; index++)
elementData[index] = itr.next();
@@ -941,7 +941,7 @@ public class Vector<T> extends AbstractList<T>
// do so).
throw new ArrayIndexOutOfBoundsException(index + operator + elementCount);
}
-
+
/**
* Serializes this object to the given stream.
*
diff --git a/java/util/WeakHashMap.java b/java/util/WeakHashMap.java
index 1f4602915..3e4d34796 100644
--- a/java/util/WeakHashMap.java
+++ b/java/util/WeakHashMap.java
@@ -86,7 +86,7 @@ import java.lang.ref.WeakReference;
* @since 1.2
* @status updated to 1.4 (partial 1.5)
*/
-public class WeakHashMap<K,V> extends AbstractMap<K,V>
+public class WeakHashMap<K,V> extends AbstractMap<K,V>
{
// WARNING: WeakHashMap is a CORE class in the bootstrap cycle. See the
// comments in vm/reference/java/lang/Runtime for implications of this fact.
@@ -704,12 +704,12 @@ public class WeakHashMap<K,V> extends AbstractMap<K,V>
while (next != bucket)
{
if (next == null) throw new InternalError("WeakHashMap in incosistent state");
- prev = next;
+ prev = next;
next = prev.next;
}
if (prev == null)
buckets[slot] = bucket.next;
- else
+ else
prev.next = bucket.next;
size--;
diff --git a/java/util/concurrent/CopyOnWriteArrayList.java b/java/util/concurrent/CopyOnWriteArrayList.java
index 1ac5b956d..e7d712a9a 100644
--- a/java/util/concurrent/CopyOnWriteArrayList.java
+++ b/java/util/concurrent/CopyOnWriteArrayList.java
@@ -75,12 +75,12 @@ import java.util.RandomAccess;
* This class is especially useful when used with event handling, like the
* following code demonstrates:<br />
* <code><pre>
- *
+ *
* CopyOnWriteArrayList<EventListener> listeners =
* new CopyOnWriteArrayList<EventListener>();
- *
+ *
* [...]
- *
+ *
* for (final EventListener listener : listeners)
* {
* Runnable dispatcher = new Runnable() {
@@ -89,22 +89,22 @@ import java.util.RandomAccess;
* listener.preferenceChange(event);
* }
* };
- *
+ *
* Executor executor = Executors.newSingleThreadExecutor();
* executor.execute(dispatcher);
* }
* </pre></code>
- *
+ *
* @since 1.5
*/
-public class CopyOnWriteArrayList<E>
+public class CopyOnWriteArrayList<E>
implements List<E>, RandomAccess, Cloneable, Serializable
{
/**
- *
+ *
*/
private static final long serialVersionUID = 8673264195747942595L;
-
+
/**
* Where the data is stored.
*/
@@ -121,7 +121,7 @@ public class CopyOnWriteArrayList<E>
/**
* Construct a new ArrayList, and initialize it with the elements in the
* supplied Collection. The initial capacity is 110% of the Collection's size.
- *
+ *
* @param c
* the collection whose elements will initialize this list
* @throws NullPointerException
@@ -139,7 +139,7 @@ public class CopyOnWriteArrayList<E>
/**
* Construct a new ArrayList, and initialize it with the elements in the
* supplied array.
- *
+ *
* @param array
* the array used to initialize this list
* @throws NullPointerException
@@ -152,7 +152,7 @@ public class CopyOnWriteArrayList<E>
/**
* Returns the number of elements in this list.
- *
+ *
* @return the list size
*/
public int size()
@@ -162,7 +162,7 @@ public class CopyOnWriteArrayList<E>
/**
* Checks if the list is empty.
- *
+ *
* @return true if there are no elements
*/
public boolean isEmpty()
@@ -172,7 +172,7 @@ public class CopyOnWriteArrayList<E>
/**
* Returns true if element is in this ArrayList.
- *
+ *
* @param e
* the element whose inclusion in the List is being tested
* @return true if the list contains e
@@ -207,7 +207,7 @@ public class CopyOnWriteArrayList<E>
/**
* Returns the lowest index at which element appears in this List, or -1 if it
* does not appear.
- *
+ *
* @param e
* the element whose inclusion in the List is being tested
* @return the index where e was found
@@ -243,7 +243,7 @@ public class CopyOnWriteArrayList<E>
/**
* Returns the highest index at which element appears in this List, or -1 if
* it does not appear.
- *
+ *
* @param e
* the element whose inclusion in the List is being tested
* @return the index where e was found
@@ -278,7 +278,7 @@ public class CopyOnWriteArrayList<E>
/**
* Creates a shallow copy of this ArrayList (elements are not cloned).
- *
+ *
* @return the cloned object
*/
public Object clone()
@@ -298,7 +298,7 @@ public class CopyOnWriteArrayList<E>
/**
* Returns an Object array containing all of the elements in this ArrayList.
* The array is independent of this list.
- *
+ *
* @return an array representation of this list
*/
public Object[] toArray()
@@ -316,7 +316,7 @@ public class CopyOnWriteArrayList<E>
* of the elements in this List, a new Array will be created and returned; if
* the passed-in Array is <i>larger</i> than the size of this List, then
* size() index will be set to null.
- *
+ *
* @param a
* the passed-in Array
* @return an array representation of this list
@@ -338,7 +338,7 @@ public class CopyOnWriteArrayList<E>
/**
* Retrieves the element at the user-supplied index.
- *
+ *
* @param index
* the index of the element we are fetching
* @throws IndexOutOfBoundsException
@@ -352,7 +352,7 @@ public class CopyOnWriteArrayList<E>
/**
* Sets the element at the specified index. The new element, e, can be an
* object of any type or null.
- *
+ *
* @param index
* the index at which the element is being set
* @param e
@@ -373,7 +373,7 @@ public class CopyOnWriteArrayList<E>
/**
* Appends the supplied element to the end of this list. The element, e, can
* be an object of any type or null.
- *
+ *
* @param e
* the element to be appended to this list
* @return true, the add will always succeed
@@ -392,7 +392,7 @@ public class CopyOnWriteArrayList<E>
* Adds the supplied element at the specified index, shifting all elements
* currently at that index or higher one to the right. The element, e, can be
* an object of any type or null.
- *
+ *
* @param index
* the index at which the element is being added
* @param e
@@ -412,7 +412,7 @@ public class CopyOnWriteArrayList<E>
/**
* Removes the element at the user-supplied index.
- *
+ *
* @param index
* the index of the element to be removed
* @return the removed Object
@@ -423,20 +423,20 @@ public class CopyOnWriteArrayList<E>
{
if (index < 0 || index >= this.size())
throw new IndexOutOfBoundsException("index = " + index);
-
+
E[] snapshot = this.data;
E[] newData = (E[]) new Object[snapshot.length - 1];
-
+
E result = snapshot[index];
-
+
if (index > 0)
System.arraycopy(snapshot, 0, newData, 0, index);
-
+
System.arraycopy(snapshot, index + 1, newData, index,
snapshot.length - index - 1);
-
+
this.data = newData;
-
+
return result;
}
@@ -444,7 +444,7 @@ public class CopyOnWriteArrayList<E>
* Remove the first occurrence, if any, of the given object from this list,
* returning <code>true</code> if the object was removed, <code>false</code>
* otherwise.
- *
+ *
* @param element the object to be removed.
* @return true if element was removed, false otherwise. false means also that
* the underlying storage was unchanged after this operation concluded.
@@ -458,7 +458,7 @@ public class CopyOnWriteArrayList<E>
return false;
E[] newData = (E[]) new Object[len - 1];
-
+
// search the element to remove while filling the backup array
// this way we can run this method in O(n)
int elementIndex = -1;
@@ -469,40 +469,40 @@ public class CopyOnWriteArrayList<E>
elementIndex = i;
break;
}
-
+
if (i < newData.length)
newData[i] = snapshot[i];
}
-
+
if (elementIndex < 0)
return false;
-
+
System.arraycopy(snapshot, elementIndex + 1, newData, elementIndex,
snapshot.length - elementIndex - 1);
this.data = newData;
-
+
return true;
}
-
+
/**
* Removes all the elements contained in the given collection.
* This method removes the elements that are contained in both
* this list and in the given collection.
- *
+ *
* @param c the collection containing the elements to be removed from this
* list.
* @return true if at least one element was removed, indicating that
- * the list internal storage changed as a result, false otherwise.
+ * the list internal storage changed as a result, false otherwise.
*/
public synchronized boolean removeAll(Collection<?> c)
{
if (c.size() == 0)
return false;
-
+
E [] snapshot = this.data;
- E [] storage = (E[]) new Object[this.data.length];
+ E [] storage = (E[]) new Object[this.data.length];
boolean changed = false;
-
+
int length = 0;
for (E element : snapshot)
{
@@ -514,18 +514,18 @@ public class CopyOnWriteArrayList<E>
else
storage[length++] = element;
}
-
+
if (!changed)
return false;
-
+
E[] newData = (E[]) new Object[length];
System.arraycopy(storage, 0, newData, 0, length);
-
+
this.data = newData;
-
+
return true;
}
-
+
/**
* Removes all the elements that are not in the passed collection.
* If the collection is void, this method has the same effect of
@@ -533,7 +533,7 @@ public class CopyOnWriteArrayList<E>
* Please, note that this method is extremely slow (unless the argument has
* <code>size == 0</code>) and has bad performance is both space and time
* usage.
- *
+ *
* @param c the collection containing the elements to be retained by this
* list.
* @return true the list internal storage changed as a result of this
@@ -548,31 +548,31 @@ public class CopyOnWriteArrayList<E>
this.clear();
return true;
}
-
+
E [] snapshot = this.data;
- E [] storage = (E[]) new Object[this.data.length];
-
+ E [] storage = (E[]) new Object[this.data.length];
+
int length = 0;
for (E element : snapshot)
{
if (c.contains(element))
storage[length++] = element;
}
-
+
// means we retained all the elements previously in our storage
// we are running already slow here, but at least we avoid copying
// another array and changing the internal storage
if (length == snapshot.length)
return false;
-
+
E[] newData = (E[]) new Object[length];
System.arraycopy(storage, 0, newData, 0, length);
-
+
this.data = newData;
-
+
return true;
}
-
+
/**
* Removes all elements from this List
*/
@@ -586,7 +586,7 @@ public class CopyOnWriteArrayList<E>
* what happens if you modify the list while this is taking place; for
* example, if the collection contains this list. c can contain objects of any
* type, as well as null values.
- *
+ *
* @param c
* a Collection containing elements to be added to this List
* @return true if the list was modified, in other words c is not empty
@@ -602,7 +602,7 @@ public class CopyOnWriteArrayList<E>
* Add all elements in the supplied collection, inserting them beginning at
* the specified index. c can contain objects of any type, as well as null
* values.
- *
+ *
* @param index
* the index at which the elements will be inserted
* @param c
@@ -616,37 +616,37 @@ public class CopyOnWriteArrayList<E>
{
if (index < 0 || index > this.size())
throw new IndexOutOfBoundsException("index = " + index);
-
+
int csize = c.size();
if (csize == 0)
return false;
-
+
E[] data = this.data;
Iterator<? extends E> itr = c.iterator();
-
+
E[] newData = (E[]) new Object[data.length + csize];
-
+
// avoid this call at all if we were asked to put the elements at the
// beginning of our storage
if (index != 0)
System.arraycopy(data, 0, newData, 0, index);
-
+
int itemsLeft = index;
-
+
for (E value : c)
newData[index++] = value;
-
+
// now copy the remaining elements
System.arraycopy(data, itemsLeft, newData, 0, data.length - itemsLeft);
-
+
this.data = newData;
-
+
return true;
}
-
+
/**
* Adds an element if the list does not contains it already.
- *
+ *
* @param val the element to add to the list.
* @return true if the element was added, false otherwise.
*/
@@ -661,7 +661,7 @@ public class CopyOnWriteArrayList<E>
/**
* Adds all the element from the given collection that are not already
* in this list.
- *
+ *
* @param c the Collection containing the elements to be inserted
* @return true the list internal storage changed as a result of this
* operation, false otherwise.
@@ -671,28 +671,28 @@ public class CopyOnWriteArrayList<E>
int size = c.size();
if (size == 0)
return 0;
-
+
E [] snapshot = this.data;
E [] storage = (E[]) new Object[size];
-
+
size = 0;
for (E val : c)
{
if (!this.contains(val))
storage[size++] = val;
}
-
+
if (size == 0)
return 0;
-
+
// append storage to data
E [] newData = (E[]) new Object[snapshot.length + size];
-
+
System.arraycopy(snapshot, 0, newData, 0, snapshot.length);
System.arraycopy(storage, 0, newData, snapshot.length, size);
-
+
this.data = newData;
-
+
return size;
}
@@ -705,19 +705,19 @@ public class CopyOnWriteArrayList<E>
{
if (o == null)
return false;
-
+
if (this == o)
return true;
-
+
// let's see if 'o' is a list, if so, we need to compare the elements
// as returned by the iterator
if (o instanceof List)
{
List<?> source = (List<?>) o;
-
+
if (source.size() != this.size())
return false;
-
+
Iterator<?> sourceIterator = source.iterator();
for (E element : this)
{
@@ -727,10 +727,10 @@ public class CopyOnWriteArrayList<E>
return true;
}
-
+
return false;
}
-
+
public int hashCode()
{
// see http://java.sun.com/6/docs/api/java/util/List.html#hashcode()
@@ -741,14 +741,14 @@ public class CopyOnWriteArrayList<E>
}
return hashcode;
}
-
+
/**
* Return an Iterator containing the elements of this list.
* The Iterator uses a snapshot of the state of the internal storage
* at the moment this method is called and does <strong>not</strong> support
* update operations, so no synchronization is needed to traverse the
* iterator.
- *
+ *
* @return an Iterator containing the elements of this list in sequence.
*/
public Iterator<E> iterator()
@@ -757,7 +757,7 @@ public class CopyOnWriteArrayList<E>
{
E [] iteratorData = CopyOnWriteArrayList.this.data;
int currentElement = 0;
-
+
public boolean hasNext()
{
return (currentElement < iteratorData.length);
@@ -776,14 +776,14 @@ public class CopyOnWriteArrayList<E>
}
};
}
-
+
/**
* Return a ListIterator containing the elements of this list.
* The Iterator uses a snapshot of the state of the internal storage
* at the moment this method is called and does <strong>not</strong> support
* update operations, so no synchronization is needed to traverse the
* iterator.
- *
+ *
* @return a ListIterator containing the elements of this list in sequence.
*/
public ListIterator<E> listIterator()
@@ -800,7 +800,7 @@ public class CopyOnWriteArrayList<E>
* at the moment this method is called and does <strong>not</strong> support
* update operations, so no synchronization is needed to traverse the
* iterator.
- *
+ *
* @param index the index at which to start iterating.
* @return a ListIterator containing the elements of this list in sequence.
*/
@@ -814,7 +814,7 @@ public class CopyOnWriteArrayList<E>
{
E [] iteratorData = CopyOnWriteArrayList.this.data;
int currentElement = index;
-
+
public void add(E o)
{
throw new UnsupportedOperationException("updating of elements in " +
@@ -836,7 +836,7 @@ public class CopyOnWriteArrayList<E>
{
if (hasNext() == false)
throw new java.util.NoSuchElementException();
-
+
return iteratorData[currentElement++];
}
@@ -849,7 +849,7 @@ public class CopyOnWriteArrayList<E>
{
if (hasPrevious() == false)
throw new java.util.NoSuchElementException();
-
+
return iteratorData[--currentElement];
}
@@ -871,10 +871,10 @@ public class CopyOnWriteArrayList<E>
"iterators is not supported " +
"by this class");
}
-
+
};
}
-
+
/**
* Obtain a List view of a subsection of this list, from fromIndex
* (inclusive) to toIndex (exclusive). If the two indices are equal, the
@@ -907,7 +907,7 @@ public class CopyOnWriteArrayList<E>
*
* All methods first check to see if the actual modCount of the backing
* list is equal to its expected value, and throw a
- * ConcurrentModificationException if it is not.
+ * ConcurrentModificationException if it is not.
*
* @param fromIndex the index that the returned list should start from
* (inclusive)
@@ -941,7 +941,7 @@ public class CopyOnWriteArrayList<E>
* @author Original author unknown
* @author Eric Blake (ebb9@email.byu.edu)
*/
- private static class SubList<E>
+ private static class SubList<E>
extends AbstractList<E>
{
// Package visible, for use by iterator.
@@ -968,7 +968,7 @@ public class CopyOnWriteArrayList<E>
offset = fromIndex;
size = toIndex - fromIndex;
}
-
+
/**
* This method checks the two modCount fields to ensure that there has
* not been a concurrent modification, returning if all is okay.
@@ -982,7 +982,7 @@ public class CopyOnWriteArrayList<E>
if (data != backingList.data)
throw new ConcurrentModificationException();
}
-
+
/**
* This method checks that a value is between 0 and size (inclusive). If
* it is not, an exception is thrown.
@@ -997,7 +997,7 @@ public class CopyOnWriteArrayList<E>
throw new IndexOutOfBoundsException("Index: " + index +
", Size:" + size);
}
-
+
/**
* This method checks that a value is between 0 (inclusive) and size
* (exclusive). If it is not, an exception is thrown.
@@ -1012,7 +1012,7 @@ public class CopyOnWriteArrayList<E>
throw new IndexOutOfBoundsException("Index: " + index +
", Size:" + size);
}
-
+
/**
* Specified by AbstractList.subList to return the private field size.
*
@@ -1028,7 +1028,7 @@ public class CopyOnWriteArrayList<E>
return size;
}
}
-
+
public void clear()
{
synchronized (backingList)
@@ -1037,17 +1037,17 @@ public class CopyOnWriteArrayList<E>
E[] newData = (E[]) new Object[snapshot.length - size];
int toIndex = size + offset;
-
+
System.arraycopy(snapshot, 0, newData, 0, offset);
System.arraycopy(snapshot, toIndex, newData, offset,
snapshot.length - toIndex);
-
+
backingList.data = newData;
this.data = backingList.data;
this.size = 0;
}
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -1070,14 +1070,14 @@ public class CopyOnWriteArrayList<E>
{
checkMod();
checkBoundsExclusive(index);
-
+
E el = backingList.set(index + offset, o);
this.data = backingList.data;
-
+
return el;
}
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -1093,11 +1093,11 @@ public class CopyOnWriteArrayList<E>
{
checkMod();
checkBoundsExclusive(index);
-
+
return backingList.get(index + offset);
}
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -1119,14 +1119,14 @@ public class CopyOnWriteArrayList<E>
{
checkMod();
checkBoundsInclusive(index);
-
+
backingList.add(index + offset, o);
-
+
this.data = backingList.data;
size++;
}
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -1145,14 +1145,14 @@ public class CopyOnWriteArrayList<E>
checkMod();
checkBoundsExclusive(index);
E o = backingList.remove(index + offset);
-
+
this.data = backingList.data;
size--;
-
+
return o;
}
}
-
+
/**
* Specified by AbstractList.subList to delegate to the backing list.
*
@@ -1178,14 +1178,14 @@ public class CopyOnWriteArrayList<E>
checkBoundsInclusive(index);
int csize = c.size();
boolean result = backingList.addAll(offset + index, c);
-
+
this.data = backingList.data;
size += csize;
-
+
return result;
}
}
-
+
/**
* Specified by AbstractList.subList to return addAll(size, c).
*
@@ -1208,7 +1208,7 @@ public class CopyOnWriteArrayList<E>
return addAll(size, c);
}
}
-
+
/**
* Specified by AbstractList.subList to return listIterator().
*
@@ -1218,7 +1218,7 @@ public class CopyOnWriteArrayList<E>
{
return listIterator();
}
-
+
/**
* Specified by AbstractList.subList to return a wrapper around the
* backing list's iterator.
@@ -1363,7 +1363,7 @@ public class CopyOnWriteArrayList<E>
/**
* Adds the supplied object before the element that would be returned
* by a call to <code>next()</code>, if the list supports addition.
- *
+ *
* @param o The object to add to the list.
* @throws UnsupportedOperationException if the list doesn't support
* the addition of new elements.
@@ -1378,7 +1378,7 @@ public class CopyOnWriteArrayList<E>
{
throw new UnsupportedOperationException("Modification not supported " +
"on CopyOnWriteArrayList iterators");
- }
+ }
};
}
} // class SubList
@@ -1407,7 +1407,7 @@ public class CopyOnWriteArrayList<E>
/**
* Serializes this object to the given stream.
- *
+ *
* @param s
* the stream to write to
* @throws IOException
@@ -1430,7 +1430,7 @@ public class CopyOnWriteArrayList<E>
/**
* Deserializes this object from the given stream.
- *
+ *
* @param s
* the stream to read from
* @throws ClassNotFoundException
@@ -1455,7 +1455,7 @@ public class CopyOnWriteArrayList<E>
{
return o1 == null ? o2 == null : o1.equals(o2);
}
-
+
Object[] getArray()
{
return data;
diff --git a/java/util/jar/Attributes.java b/java/util/jar/Attributes.java
index 329fe6323..88800294c 100644
--- a/java/util/jar/Attributes.java
+++ b/java/util/jar/Attributes.java
@@ -67,7 +67,7 @@ import java.util.Set;
* @see java.util.jar.Attributes.Name
* @author Mark Wielaard (mark@klomp.org)
*/
-public class Attributes
+public class Attributes
implements Cloneable, Map<Object, Object>
{
@@ -87,16 +87,16 @@ public class Attributes
* know names for the general main attributes, stand alone application
* attributes, applet attributes, extension identification attributes,
* package versioning and sealing attributes, file contents attributes,
- * bean objects attribute and signing attributes. See the
- *
+ * bean objects attribute and signing attributes. See the
+ *
* <p>The characters of a Name must obey the following restrictions:</p>
- *
+ *
* <ul>
* <li>Must contain at least one character</li>
* <li>The first character must be alphanumeric (a-z, A-Z, 0-9)</li>
* <li>All other characters must be alphanumeric, a '-' or a '_'</li>
* </ul>
- *
+ *
* <p>When comparing Names (with <code>equals</code>) all characters are
* converted to lowercase. But you can get the original case sensitive
* string with the <code>toString()</code> method.</p>
@@ -125,13 +125,13 @@ public class Attributes
* the version of this Manifest file.
*/
public static final Name MANIFEST_VERSION = new Name(JarUtils.MANIFEST_VERSION);
-
+
/**
* General main attribute -
* the version of the jar file signature.
*/
public static final Name SIGNATURE_VERSION = new Name(JarUtils.SIGNATURE_VERSION);
-
+
/**
* General main attribute -
* (relative) file paths of the libraries/classpaths that the Classes in
@@ -172,7 +172,7 @@ public class Attributes
* the name if the extension library contained in the jar.
*/
public static final Name EXTENSION_NAME = new Name("Extension-Name");
-
+
/**
* Extension identification attribute -
* synonym for <code>EXTENSTION_NAME</code>.
@@ -180,42 +180,42 @@ public class Attributes
public static final Name EXTENSION_INSTALLATION = EXTENSION_NAME;
// Package versioning and sealing attributes
-
+
/**
* Package versioning -
* name of extension library contained in this jar.
*/
public static final Name IMPLEMENTATION_TITLE
= new Name("Implementation-Title");
-
+
/**
* Package versioning -
* version of the extension library contained in this jar.
*/
public static final Name IMPLEMENTATION_VERSION
= new Name("Implementation-Version");
-
+
/**
* Package versioning -
* name of extension library creator contained in this jar.
*/
public static final Name IMPLEMENTATION_VENDOR
= new Name("Implementation-Vendor");
-
+
/**
* Package versioning -
* unique id of extension library creator.
*/
public static final Name IMPLEMENTATION_VENDOR_ID
= new Name("Implementation-Vendor-Id");
-
+
/**
* Package versioning -
* location where this implementation can be downloaded.
*/
public static final Name IMPLEMENTATION_URL
= new Name("Implementation-URL");
-
+
/**
* Package versioning -
* title of the specification contained in this jar.
@@ -263,7 +263,7 @@ public class Attributes
* Creates a new Name from the given String.
* Throws an IllegalArgumentException if the given String is empty or
* contains any illegal Name characters.
- *
+ *
* @param name the name of the new Name
* @exception IllegalArgumentException if name isn't a valid String
* representation of a Name
@@ -278,28 +278,28 @@ public class Attributes
// there must be at least one character
if (chars.length == 0)
- throw new
- IllegalArgumentException
- ("There must be at least one character in a name");
+ throw new
+ IllegalArgumentException
+ ("There must be at least one character in a name");
// first character must be alphanum
char c = chars[0];
if (!((c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')))
- throw new
- IllegalArgumentException("First character must be alphanum");
+ (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')))
+ throw new
+ IllegalArgumentException("First character must be alphanum");
// all other characters must be alphanums, '-' or '_'
for (int i = 1; i < chars.length; i++)
- {
- c = chars[i];
- if (!((c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') ||
- (c >= '0' && c <= '9') || (c == '-') || (c == '_')))
- throw new
- IllegalArgumentException
- ("Characters must be alphanums, '-' or '_'");
- }
+ {
+ c = chars[i];
+ if (!((c >= 'a' && c <= 'z') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c >= '0' && c <= '9') || (c == '-') || (c == '_')))
+ throw new
+ IllegalArgumentException
+ ("Characters must be alphanums, '-' or '_'");
+ }
// Still here? Then convert to lower case and be done.
// Store the original name for toString();
@@ -325,23 +325,23 @@ public class Attributes
{
// Quick and dirty check
if (name == o)
- return true;
+ return true;
try
- {
- // Note that the constructor already converts the strings to
- // lowercase.
- String otherName = ((Name) o).name;
- return name.equals(otherName);
- }
+ {
+ // Note that the constructor already converts the strings to
+ // lowercase.
+ String otherName = ((Name) o).name;
+ return name.equals(otherName);
+ }
catch (ClassCastException cce)
- {
- return false;
- }
+ {
+ return false;
+ }
catch (NullPointerException npe)
- {
- return false;
- }
+ {
+ return false;
+ }
}
/**
@@ -514,15 +514,15 @@ public class Attributes
try
{
- return map.equals(((Attributes) o).map);
+ return map.equals(((Attributes) o).map);
}
catch (ClassCastException cce)
{
- return false;
+ return false;
}
catch (NullPointerException npe)
{
- return false;
+ return false;
}
}
@@ -591,8 +591,8 @@ public class Attributes
{
if (!(attr instanceof Attributes))
{
- throw new
- ClassCastException("Supplied Map is not an instance of Attributes");
+ throw new
+ ClassCastException("Supplied Map is not an instance of Attributes");
}
map.putAll(attr);
}
diff --git a/java/util/jar/JarEntry.java b/java/util/jar/JarEntry.java
index 515b45fa9..52cb2c31c 100644
--- a/java/util/jar/JarEntry.java
+++ b/java/util/jar/JarEntry.java
@@ -108,7 +108,7 @@ public class JarEntry extends ZipEntry
super(entry);
try
{
- attr = entry.getAttributes();
+ attr = entry.getAttributes();
}
catch (IOException _)
{
@@ -130,11 +130,11 @@ public class JarEntry extends ZipEntry
{
if (attr != null)
{
- return (Attributes) attr.clone();
+ return (Attributes) attr.clone();
}
else
{
- return null;
+ return null;
}
}
diff --git a/java/util/jar/JarFile.java b/java/util/jar/JarFile.java
index 680773659..b67c95346 100644
--- a/java/util/jar/JarFile.java
+++ b/java/util/jar/JarFile.java
@@ -199,8 +199,8 @@ public class JarFile extends ZipFile
super(fileName);
if (verify)
{
- manifest = readManifest();
- verify();
+ manifest = readManifest();
+ verify();
}
}
@@ -236,8 +236,8 @@ public class JarFile extends ZipFile
super(file);
if (verify)
{
- manifest = readManifest();
- verify();
+ manifest = readManifest();
+ verify();
}
}
@@ -256,7 +256,7 @@ public class JarFile extends ZipFile
* @exception FileNotFoundException if the file does not exist
* @exception IOException if another IO exception occurs while reading
* @exception IllegalArgumentException when given an illegal mode
- *
+ *
* @since 1.3
*/
public JarFile(File file, boolean verify, int mode) throws
@@ -265,8 +265,8 @@ public class JarFile extends ZipFile
super(file, mode);
if (verify)
{
- manifest = readManifest();
- verify();
+ manifest = readManifest();
+ verify();
}
}
@@ -280,8 +280,8 @@ public class JarFile extends ZipFile
// only check if manifest is not null
if (manifest == null)
{
- verify = false;
- return;
+ verify = false;
+ return;
}
verify = true;
@@ -295,23 +295,23 @@ public class JarFile extends ZipFile
{
try
{
- ZipEntry manEntry = super.getEntry(MANIFEST_NAME);
- if (manEntry != null)
- {
- InputStream in = super.getInputStream(manEntry);
- manifestRead = true;
- return new Manifest(in);
- }
- else
- {
- manifestRead = true;
- return null;
- }
+ ZipEntry manEntry = super.getEntry(MANIFEST_NAME);
+ if (manEntry != null)
+ {
+ InputStream in = super.getInputStream(manEntry);
+ manifestRead = true;
+ return new Manifest(in);
+ }
+ else
+ {
+ manifestRead = true;
+ return null;
+ }
}
catch (IOException ioe)
{
- manifestRead = true;
- return null;
+ manifestRead = true;
+ return null;
}
}
@@ -353,36 +353,36 @@ public class JarFile extends ZipFile
JarEntry jar = new JarEntry(zip);
Manifest manifest;
try
- {
- manifest = jarfile.getManifest();
- }
+ {
+ manifest = jarfile.getManifest();
+ }
catch (IOException ioe)
- {
- manifest = null;
- }
+ {
+ manifest = null;
+ }
if (manifest != null)
- {
- jar.attr = manifest.getAttributes(jar.getName());
- }
+ {
+ jar.attr = manifest.getAttributes(jar.getName());
+ }
synchronized(jarfile)
- {
- if (jarfile.verify && !jarfile.signaturesRead)
- try
- {
- jarfile.readSignatures();
- }
- catch (IOException ioe)
- {
- if (JarFile.DEBUG)
- {
- JarFile.debug(ioe);
- ioe.printStackTrace();
- }
- jarfile.signaturesRead = true; // fudge it.
- }
- }
+ {
+ if (jarfile.verify && !jarfile.signaturesRead)
+ try
+ {
+ jarfile.readSignatures();
+ }
+ catch (IOException ioe)
+ {
+ if (JarFile.DEBUG)
+ {
+ JarFile.debug(ioe);
+ ioe.printStackTrace();
+ }
+ jarfile.signaturesRead = true; // fudge it.
+ }
+ }
jar.jarfile = jarfile;
return jar;
}
@@ -398,38 +398,38 @@ public class JarFile extends ZipFile
ZipEntry entry = super.getEntry(name);
if (entry != null)
{
- JarEntry jarEntry = new JarEntry(entry);
- Manifest manifest;
- try
- {
- manifest = getManifest();
- }
- catch (IOException ioe)
- {
- manifest = null;
- }
-
- if (manifest != null)
- {
- jarEntry.attr = manifest.getAttributes(name);
+ JarEntry jarEntry = new JarEntry(entry);
+ Manifest manifest;
+ try
+ {
+ manifest = getManifest();
+ }
+ catch (IOException ioe)
+ {
+ manifest = null;
}
- if (verify && !signaturesRead)
- try
- {
- readSignatures();
- }
- catch (IOException ioe)
- {
- if (DEBUG)
- {
- debug(ioe);
- ioe.printStackTrace();
- }
- signaturesRead = true;
- }
+ if (manifest != null)
+ {
+ jarEntry.attr = manifest.getAttributes(name);
+ }
+
+ if (verify && !signaturesRead)
+ try
+ {
+ readSignatures();
+ }
+ catch (IOException ioe)
+ {
+ if (DEBUG)
+ {
+ debug(ioe);
+ ioe.printStackTrace();
+ }
+ signaturesRead = true;
+ }
jarEntry.jarfile = this;
- return jarEntry;
+ return jarEntry;
}
return null;
}
@@ -734,11 +734,11 @@ public class JarFile extends ZipFile
/**
* Verifies that the digest(s) in a signature file were, in fact, made over
* the manifest entry for ENTRY.
- *
+ *
* @param entry The entry name.
* @param attr The attributes from the signature file to verify.
* @param hmManifestEntries Mappings of Jar file entry names to their manifest
- * entry text; i.e. the base-64 encoding of their
+ * entry text; i.e. the base-64 encoding of their
*/
private boolean verifyHashes(String entry, Attributes attr,
HashMap hmManifestEntries)
@@ -820,8 +820,8 @@ public class JarFile extends ZipFile
private boolean checked;
EntryInputStream(final ZipEntry entry,
- final InputStream in,
- final JarFile jar)
+ final InputStream in,
+ final JarFile jar)
throws IOException
{
super(in);
@@ -835,9 +835,9 @@ public class JarFile extends ZipFile
Attributes attr;
Manifest manifest = jarfile.getManifest();
if (manifest != null)
- attr = manifest.getAttributes(entry.getName());
+ attr = manifest.getAttributes(entry.getName());
else
- attr = null;
+ attr = null;
if (DEBUG)
debug("verifying entry " + entry + " attr=" + attr);
if (attr == null)
@@ -958,24 +958,24 @@ public class JarFile extends ZipFile
+ " comp=" + new java.math.BigInteger(hash).toString(16));
if (!Arrays.equals(hash, hashes[i]))
{
- synchronized(jarfile)
- {
- if (DEBUG)
- debug(entry + " could NOT be verified");
- jarfile.verified.put(entry.getName(), Boolean.FALSE);
- }
- return;
- // XXX ??? what do we do here?
- // throw new ZipException("message digest mismatch");
+ synchronized(jarfile)
+ {
+ if (DEBUG)
+ debug(entry + " could NOT be verified");
+ jarfile.verified.put(entry.getName(), Boolean.FALSE);
+ }
+ return;
+ // XXX ??? what do we do here?
+ // throw new ZipException("message digest mismatch");
}
}
synchronized(jarfile)
- {
- if (DEBUG)
- debug(entry + " has been VERIFIED");
- jarfile.verified.put(entry.getName(), Boolean.TRUE);
- }
+ {
+ if (DEBUG)
+ debug(entry + " has been VERIFIED");
+ jarfile.verified.put(entry.getName(), Boolean.TRUE);
+ }
}
}
}
diff --git a/java/util/jar/JarInputStream.java b/java/util/jar/JarInputStream.java
index 1788af6ad..4de6609a5 100644
--- a/java/util/jar/JarInputStream.java
+++ b/java/util/jar/JarInputStream.java
@@ -108,18 +108,18 @@ public class JarInputStream extends ZipInputStream
{
firstEntry = (JarEntry) super.getNextEntry();
while ((firstEntry != null) &&
- firstEntry.getName().startsWith("META-INF/"))
+ firstEntry.getName().startsWith("META-INF/"))
{
- if (firstEntry.getName().equals(JarFile.MANIFEST_NAME))
- {
- manifest = new Manifest(this);
- }
- firstEntry = (JarEntry) super.getNextEntry();
+ if (firstEntry.getName().equals(JarFile.MANIFEST_NAME))
+ {
+ manifest = new Manifest(this);
+ }
+ firstEntry = (JarEntry) super.getNextEntry();
}
if (verify)
{
- // XXX
+ // XXX
}
}
@@ -136,7 +136,7 @@ public class JarInputStream extends ZipInputStream
JarEntry jarEntry = new JarEntry(zipEntry);
if (manifest != null)
{
- jarEntry.attr = manifest.getAttributes(name);
+ jarEntry.attr = manifest.getAttributes(name);
}
return jarEntry;
}
@@ -163,12 +163,12 @@ public class JarInputStream extends ZipInputStream
ZipEntry entry;
if (firstEntry != null)
{
- entry = firstEntry;
- firstEntry = null;
+ entry = firstEntry;
+ firstEntry = null;
}
else
{
- entry = super.getNextEntry();
+ entry = super.getNextEntry();
}
return entry;
}
diff --git a/java/util/jar/JarOutputStream.java b/java/util/jar/JarOutputStream.java
index 46c71b38c..0ba6002cb 100644
--- a/java/util/jar/JarOutputStream.java
+++ b/java/util/jar/JarOutputStream.java
@@ -100,7 +100,7 @@ public class JarOutputStream extends ZipOutputStream
}
/**
- * Prepares the JarOutputStream for writing the next entry.
+ * Prepares the JarOutputStream for writing the next entry.
* This implementation just calls <code>super.putNextEntry()</code>.
*
* @param entry The information for the next entry
@@ -108,6 +108,6 @@ public class JarOutputStream extends ZipOutputStream
*/
public void putNextEntry(ZipEntry entry) throws IOException
{
- super.putNextEntry(entry); // XXX
+ super.putNextEntry(entry); // XXX
}
}
diff --git a/java/util/jar/Manifest.java b/java/util/jar/Manifest.java
index 980cfc60b..f266d823e 100644
--- a/java/util/jar/Manifest.java
+++ b/java/util/jar/Manifest.java
@@ -38,7 +38,7 @@ exception statement from your version. */
package java.util.jar;
import gnu.java.util.jar.JarUtils;
-
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -48,7 +48,7 @@ import java.util.Map;
/**
* Reads, writes and manipulaties jar manifest files.
* XXX
- *
+ *
* @since 1.2
* @author Mark Wielaard (mark@klomp.org)
*/
@@ -153,7 +153,7 @@ public class Manifest implements Cloneable
/**
* Read and merge a <code>Manifest</code> from the designated input stream.
- *
+ *
* @param in the input stream to read from.
* @throws IOException if an I/O related exception occurs during the process.
*/
@@ -166,7 +166,7 @@ public class Manifest implements Cloneable
* Writes the contents of this <code>Manifest</code> to the designated
* output stream. Line-endings are platform-independent and consist of the
* 2-codepoint sequence <code>0x0D</code> and <code>0x0A</code>.
- *
+ *
* @param out the output stream to write this <code>Manifest</code> to.
* @throws IOException if an I/O related exception occurs during the process.
*/
diff --git a/java/util/logging/ConsoleHandler.java b/java/util/logging/ConsoleHandler.java
index 3cf4bca33..9f6bb7240 100644
--- a/java/util/logging/ConsoleHandler.java
+++ b/java/util/logging/ConsoleHandler.java
@@ -81,7 +81,7 @@ public class ConsoleHandler
public ConsoleHandler()
{
super(System.err, "java.util.logging.ConsoleHandler", Level.INFO,
- /* formatter */ null, SimpleFormatter.class);
+ /* formatter */ null, SimpleFormatter.class);
}
diff --git a/java/util/logging/ErrorManager.java b/java/util/logging/ErrorManager.java
index 57c079fe2..291efb2f1 100644
--- a/java/util/logging/ErrorManager.java
+++ b/java/util/logging/ErrorManager.java
@@ -82,7 +82,7 @@ public class ErrorManager
*/
public static final int CLOSE_FAILURE = 3;
-
+
/**
* Indicates that there was a problem upon opening
* an output stream.
@@ -146,7 +146,7 @@ public class ErrorManager
* widespread acceptance. See Classpath bug #2944.
*/
if (everUsed)
- return;
+ return;
everUsed = true;
}
@@ -191,4 +191,3 @@ public class ErrorManager
ex.printStackTrace();
}
}
-
diff --git a/java/util/logging/FileHandler.java b/java/util/logging/FileHandler.java
index deba5c2e5..00d967f57 100644
--- a/java/util/logging/FileHandler.java
+++ b/java/util/logging/FileHandler.java
@@ -120,7 +120,7 @@ import java.util.ListIterator;
* system property <code>user.home</code>.</li>
*
* <li><code>%g</code> - replaced by a generation number for
- * distinguisthing the individual items in the rotating set
+ * distinguisthing the individual items in the rotating set
* of log files. The generation number cycles through the
* sequence 0, 1, ..., <code>count</code> - 1.</li>
*
@@ -160,7 +160,7 @@ import java.util.ListIterator;
* step is performed after any generation number has been
* appended.
*
- * <p><em>Examples for the GNU platform:</em>
+ * <p><em>Examples for the GNU platform:</em>
*
* <p><ul>
*
@@ -269,7 +269,7 @@ public class FileHandler
/**
* A linked list of files we are, or have written to. The entries
- * are file path strings, kept in the order
+ * are file path strings, kept in the order
*/
private LinkedList logFiles;
@@ -291,9 +291,9 @@ public class FileHandler
throws IOException, SecurityException
{
this(LogManager.getLogManager().getProperty(PATTERN_KEY),
- LogManager.getIntProperty(LIMIT_KEY, DEFAULT_LIMIT),
- LogManager.getIntProperty(COUNT_KEY, DEFAULT_COUNT),
- LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND));
+ LogManager.getIntProperty(LIMIT_KEY, DEFAULT_LIMIT),
+ LogManager.getIntProperty(COUNT_KEY, DEFAULT_COUNT),
+ LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND));
}
@@ -317,8 +317,8 @@ public class FileHandler
public FileHandler(String pattern, int limit, int count)
throws IOException, SecurityException
{
- this(pattern, limit, count,
- LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND));
+ this(pattern, limit, count,
+ LogManager.getBooleanProperty(APPEND_KEY, DEFAULT_APPEND));
}
@@ -368,16 +368,16 @@ public class FileHandler
* the Sun reference implementation.
*/
public FileHandler(String pattern,
- int limit,
- int count,
- boolean append)
+ int limit,
+ int count,
+ boolean append)
throws IOException, SecurityException
{
super(/* output stream, created below */ null,
- PROPERTY_PREFIX,
- /* default level */ Level.ALL,
- /* formatter */ null,
- /* default formatter */ XMLFormatter.class);
+ PROPERTY_PREFIX,
+ /* default level */ Level.ALL,
+ /* formatter */ null,
+ /* default formatter */ XMLFormatter.class);
if ((limit <0) || (count < 1))
throw new IllegalArgumentException();
@@ -426,7 +426,7 @@ public class FileHandler
try
{
- File file = new File(path);
+ File file = new File(path);
if (!file.exists () || append)
{
FileOutputStream fout = new FileOutputStream (file, append);
@@ -476,9 +476,9 @@ public class FileHandler
* <code>pattern</code>.
*/
private static String replaceFileNameEscapes(String pattern,
- int generation,
- int uniqueNumber,
- int count)
+ int generation,
+ int uniqueNumber,
+ int count)
{
CPStringBuilder buf = new CPStringBuilder(pattern);
String replaceWith;
@@ -489,49 +489,49 @@ public class FileHandler
{
// Uncomment the next line for finding bugs.
// System.out.println(buf.substring(0,pos) + '|' + buf.substring(pos));
-
+
if (buf.charAt(pos) == '/')
{
- /* The same value is also provided by java.io.File.separator. */
- replaceWith = System.getProperty("file.separator");
- buf.replace(pos, pos + 1, replaceWith);
- pos = pos + replaceWith.length() - 1;
- continue;
+ /* The same value is also provided by java.io.File.separator. */
+ replaceWith = System.getProperty("file.separator");
+ buf.replace(pos, pos + 1, replaceWith);
+ pos = pos + replaceWith.length() - 1;
+ continue;
}
if (buf.charAt(pos) == '%')
{
switch (buf.charAt(pos + 1))
- {
- case 't':
- replaceWith = System.getProperty("java.io.tmpdir");
- break;
-
- case 'h':
- replaceWith = System.getProperty("user.home");
- break;
-
- case 'g':
- replaceWith = Integer.toString(generation);
- foundGeneration = true;
- break;
-
- case 'u':
- replaceWith = Integer.toString(uniqueNumber);
- break;
-
- case '%':
- replaceWith = "%";
- break;
-
- default:
- replaceWith = "??";
- break; // FIXME: Throw exception?
- }
-
- buf.replace(pos, pos + 2, replaceWith);
- pos = pos + replaceWith.length() - 1;
- continue;
+ {
+ case 't':
+ replaceWith = System.getProperty("java.io.tmpdir");
+ break;
+
+ case 'h':
+ replaceWith = System.getProperty("user.home");
+ break;
+
+ case 'g':
+ replaceWith = Integer.toString(generation);
+ foundGeneration = true;
+ break;
+
+ case 'u':
+ replaceWith = Integer.toString(uniqueNumber);
+ break;
+
+ case '%':
+ replaceWith = "%";
+ break;
+
+ default:
+ replaceWith = "??";
+ break; // FIXME: Throw exception?
+ }
+
+ buf.replace(pos, pos + 2, replaceWith);
+ pos = pos + replaceWith.length() - 1;
+ continue;
}
}
while (++pos < buf.length() - 1);
diff --git a/java/util/logging/Formatter.java b/java/util/logging/Formatter.java
index ee747b0b9..feaf55315 100644
--- a/java/util/logging/Formatter.java
+++ b/java/util/logging/Formatter.java
@@ -150,7 +150,7 @@ public abstract class Formatter
{
try
{
- msg = bundle.getString(msg);
+ msg = bundle.getString(msg);
}
catch (java.util.MissingResourceException _)
{
@@ -160,8 +160,8 @@ public abstract class Formatter
/* Format the message if there are parameters. */
params = record.getParameters();
if ((params != null)
- && (params.length > 0)
- && (msg.indexOf("{0") >= 0))
+ && (params.length > 0)
+ && (msg.indexOf("{0") >= 0))
{
msg = MessageFormat.format(msg, params);
}
diff --git a/java/util/logging/Handler.java b/java/util/logging/Handler.java
index 616b50234..e254b4d35 100644
--- a/java/util/logging/Handler.java
+++ b/java/util/logging/Handler.java
@@ -179,7 +179,7 @@ h.setFormatter(h.getFormatter());</pre>
throws SecurityException
{
LogManager.getLogManager().checkAccess();
-
+
/* Throws a NullPointerException if formatter is null. */
formatter.getClass();
@@ -377,7 +377,7 @@ h.setFormatter(h.getFormatter());</pre>
{
if (record.getLevel().intValue() < level.intValue())
return false;
-
+
if (filter != null)
return filter.isLoggable(record);
else
diff --git a/java/util/logging/Level.java b/java/util/logging/Level.java
index 48ff318a4..ea2c83fb2 100644
--- a/java/util/logging/Level.java
+++ b/java/util/logging/Level.java
@@ -180,12 +180,12 @@ public class Level implements Serializable
* @param value the integer value of the level. Please note
* that the Java<small><sup>TM</sup></small>
* Logging API does not specify integer
- * values for standard levels (such as
- * Level.FINE). Therefore, a custom
- * level should pass an integer value that
- * is calculated at run-time, e.g.
- * <code>(Level.FINE.intValue() + Level.CONFIG.intValue())
- * / 2</code> for a level between FINE and CONFIG.
+ * values for standard levels (such as
+ * Level.FINE). Therefore, a custom
+ * level should pass an integer value that
+ * is calculated at run-time, e.g.
+ * <code>(Level.FINE.intValue() + Level.CONFIG.intValue())
+ * / 2</code> for a level between FINE and CONFIG.
*/
protected Level(String name, int value)
{
@@ -205,13 +205,13 @@ public class Level implements Serializable
*
* @param value the integer value of the level. Please note
* that the Java<small><sup>TM</sup></small>
- * Logging API does not specify integer
- * values for standard levels (such as
- * Level.FINE). Therefore, a custom
- * level should pass an integer value that
- * is calculated at run-time, e.g.
- * <code>(Level.FINE.intValue() + Level.CONFIG.intValue())
- * / 2</code> for a level between FINE and CONFIG.
+ * Logging API does not specify integer
+ * values for standard levels (such as
+ * Level.FINE). Therefore, a custom
+ * level should pass an integer value that
+ * is calculated at run-time, e.g.
+ * <code>(Level.FINE.intValue() + Level.CONFIG.intValue())
+ * / 2</code> for a level between FINE and CONFIG.
*
* @param resourceBundleName the name of a resource bundle
* for localizing the level name, or <code>null</code>
@@ -243,7 +243,7 @@ public class Level implements Serializable
{
for (int i = 0; i < knownLevels.length; i++)
if (value == knownLevels[i].intValue())
- return knownLevels[i];
+ return knownLevels[i];
return this;
}
@@ -286,7 +286,7 @@ public class Level implements Serializable
try
{
ResourceBundle b = ResourceBundle.getBundle(resourceBundleName);
- localizedName = b.getString(name);
+ localizedName = b.getString(name);
}
catch (Exception _)
{
@@ -345,15 +345,15 @@ public class Level implements Serializable
// standard logging levels will be returned by this method, and
// they are all created using string literals.
if (name == knownLevels[i].name)
- return knownLevels[i];
+ return knownLevels[i];
}
-
+
try
{
int num = Integer.parseInt(name);
for (int i = 0; i < knownLevels.length; i++)
- if (num == knownLevels[i].value)
- return knownLevels[i];
+ if (num == knownLevels[i].value)
+ return knownLevels[i];
}
catch (NumberFormatException _)
{
@@ -369,7 +369,7 @@ public class Level implements Serializable
* another object.
*
* @return <code>true</code> if <code>other</code> is an instance of
- * <code>java.util.logging.Level</code> and has the same integer
+ * <code>java.util.logging.Level</code> and has the same integer
* value, <code>false</code> otherwise.
*/
public boolean equals(Object other)
@@ -388,7 +388,7 @@ public class Level implements Serializable
public int hashCode()
{
return value;
- }
+ }
/**
@@ -409,9 +409,8 @@ public class Level implements Serializable
{
for (int i = 0; i < knownLevels.length; i++)
if (knownLevels[i] == this)
- return true;
+ return true;
return false;
}
}
-
diff --git a/java/util/logging/LogManager.java b/java/util/logging/LogManager.java
index 6daf3dbd9..dffa44d9c 100644
--- a/java/util/logging/LogManager.java
+++ b/java/util/logging/LogManager.java
@@ -150,7 +150,7 @@ public class LogManager
* this case.
*/
private final PropertyChangeSupport pcs = new PropertyChangeSupport( /* source bean */
- LogManager.class);
+ LogManager.class);
protected LogManager()
{
@@ -272,13 +272,13 @@ public class LogManager
ref = loggers.get(name);
if (ref != null)
{
- if (ref.get() != null)
- return false;
+ if (ref.get() != null)
+ return false;
- /* There has been a logger under this name in the past,
- * but it has been garbage collected.
- */
- loggers.remove(ref);
+ /* There has been a logger under this name in the past,
+ * but it has been garbage collected.
+ */
+ loggers.remove(ref);
}
/* Adding a named logger requires a security permission. */
@@ -292,10 +292,10 @@ public class LogManager
// The level of the newly added logger must be specified.
// The easiest case is if there is a level for exactly this logger
- // in the properties. If no such level exists the level needs to be
+ // in the properties. If no such level exists the level needs to be
// searched along the hirachy. So if there is a new logger 'foo.blah.blub'
// and an existing parent logger 'foo' the properties 'foo.blah.blub.level'
- // and 'foo.blah.level' need to be checked. If both do not exist in the
+ // and 'foo.blah.level' need to be checked. If both do not exist in the
// properties the level of the new logger is set to 'null' (i.e. it uses the
// level of its parent 'foo').
Level logLevel = logger.getLevel();
@@ -320,21 +320,21 @@ public class LogManager
*/
for (Iterator iter = loggers.keySet().iterator(); iter.hasNext();)
{
- Logger possChild = (Logger) ((WeakReference) loggers.get(iter.next()))
- .get();
- if ((possChild == null) || (possChild == logger)
- || (possChild.getParent() != parent))
- continue;
-
- if (! possChild.getName().startsWith(name))
- continue;
-
- if (possChild.getName().charAt(name.length()) != '.')
- continue;
-
- possChild.setParent(logger);
- }
-
+ Logger possChild = (Logger) ((WeakReference) loggers.get(iter.next()))
+ .get();
+ if ((possChild == null) || (possChild == logger)
+ || (possChild.getParent() != parent))
+ continue;
+
+ if (! possChild.getName().startsWith(name))
+ continue;
+
+ if (possChild.getName().charAt(name.length()) != '.')
+ continue;
+
+ possChild.setParent(logger);
+ }
+
return true;
}
@@ -369,20 +369,20 @@ public class LogManager
for (String candName : loggers.keySet())
{
- candNameLength = candName.length();
+ candNameLength = candName.length();
- if (candNameLength > bestNameLength
- && childNameLength > candNameLength
- && childName.startsWith(candName)
- && childName.charAt(candNameLength) == '.')
- {
- cand = loggers.get(candName).get();
- if ((cand == null) || (cand == child))
- continue;
+ if (candNameLength > bestNameLength
+ && childNameLength > candNameLength
+ && childName.startsWith(candName)
+ && childName.charAt(candNameLength) == '.')
+ {
+ cand = loggers.get(candName).get();
+ if ((cand == null) || (cand == child))
+ continue;
- bestNameLength = candName.length();
- best = cand;
- }
+ bestNameLength = candName.length();
+ best = cand;
+ }
}
return best;
@@ -447,22 +447,22 @@ public class LogManager
Iterator<WeakReference<Logger>> iter = loggers.values().iterator();
while (iter.hasNext())
{
- WeakReference<Logger> ref;
- Logger logger;
+ WeakReference<Logger> ref;
+ Logger logger;
- ref = iter.next();
- if (ref != null)
- {
- logger = ref.get();
+ ref = iter.next();
+ if (ref != null)
+ {
+ logger = ref.get();
- if (logger == null)
- iter.remove();
- else if (logger != Logger.root)
- {
- logger.resetLogger();
- logger.setLevel(null);
- }
- }
+ if (logger == null)
+ iter.remove();
+ else if (logger != Logger.root)
+ {
+ logger.resetLogger();
+ logger.setLevel(null);
+ }
+ }
}
Logger.root.setLevel(Level.INFO);
@@ -505,7 +505,7 @@ public class LogManager
try
{
inputStream = new URL(url).openStream();
- }
+ }
catch (Exception e)
{
inputStream=null;
@@ -549,46 +549,46 @@ public class LogManager
while (keys.hasMoreElements())
{
- String key = ((String) keys.nextElement()).trim();
- String value = newProperties.getProperty(key);
-
- if (value == null)
- continue;
-
- value = value.trim();
-
- if ("handlers".equals(key))
- {
- // In Java 5 and earlier this was specified to be
- // whitespace-separated, but in reality it also accepted
- // commas (tomcat relied on this), and in Java 6 the
- // documentation was updated to fit the implementation.
- StringTokenizer tokenizer = new StringTokenizer(value,
- " \t\n\r\f,");
- while (tokenizer.hasMoreTokens())
- {
- String handlerName = tokenizer.nextToken();
+ String key = ((String) keys.nextElement()).trim();
+ String value = newProperties.getProperty(key);
+
+ if (value == null)
+ continue;
+
+ value = value.trim();
+
+ if ("handlers".equals(key))
+ {
+ // In Java 5 and earlier this was specified to be
+ // whitespace-separated, but in reality it also accepted
+ // commas (tomcat relied on this), and in Java 6 the
+ // documentation was updated to fit the implementation.
+ StringTokenizer tokenizer = new StringTokenizer(value,
+ " \t\n\r\f,");
+ while (tokenizer.hasMoreTokens())
+ {
+ String handlerName = tokenizer.nextToken();
Handler handler = (Handler)
createInstance(handlerName, Handler.class, key);
- // Tomcat also relies on the implementation ignoring
- // items in 'handlers' which are not class names.
- if (handler != null)
- Logger.root.addHandler(handler);
- }
- }
-
- if (key.endsWith(".level"))
- {
- String loggerName = key.substring(0, key.length() - 6);
- Logger logger = getLogger(loggerName);
-
- if (logger == null)
- {
- logger = Logger.getLogger(loggerName);
- addLogger(logger);
- }
+ // Tomcat also relies on the implementation ignoring
+ // items in 'handlers' which are not class names.
+ if (handler != null)
+ Logger.root.addHandler(handler);
+ }
+ }
+
+ if (key.endsWith(".level"))
+ {
+ String loggerName = key.substring(0, key.length() - 6);
+ Logger logger = getLogger(loggerName);
+
+ if (logger == null)
+ {
+ logger = Logger.getLogger(loggerName);
+ addLogger(logger);
+ }
Level level = null;
- try
+ try
{
level = Level.parse(value);
}
@@ -600,8 +600,8 @@ public class LogManager
{
logger.setLevel(level);
}
- continue;
- }
+ continue;
+ }
}
/* The API specification does not talk about the
@@ -640,11 +640,11 @@ public class LogManager
{
try
{
- return Integer.parseInt(getLogManager().getProperty(name));
+ return Integer.parseInt(getLogManager().getProperty(name));
}
catch (Exception ex)
{
- return defaultValue;
+ return defaultValue;
}
}
@@ -691,11 +691,11 @@ public class LogManager
{
try
{
- return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue();
+ return (Boolean.valueOf(getLogManager().getProperty(name))).booleanValue();
}
catch (Exception ex)
{
- return defaultValue;
+ return defaultValue;
}
}
@@ -717,14 +717,14 @@ public class LogManager
try
{
String value = getLogManager().getProperty(propertyName);
- if (value != null)
- return Level.parse(getLogManager().getProperty(propertyName));
+ if (value != null)
+ return Level.parse(getLogManager().getProperty(propertyName));
else
- return defaultValue;
+ return defaultValue;
}
catch (Exception ex)
{
- return defaultValue;
+ return defaultValue;
}
}
@@ -784,15 +784,15 @@ public class LogManager
try
{
- return defaultClass.newInstance();
+ return defaultClass.newInstance();
}
catch (java.lang.InstantiationException ex)
{
- throw new RuntimeException(ex.getMessage());
+ throw new RuntimeException(ex.getMessage());
}
catch (java.lang.IllegalAccessException ex)
{
- throw new RuntimeException(ex.getMessage());
+ throw new RuntimeException(ex.getMessage());
}
}
diff --git a/java/util/logging/LogRecord.java b/java/util/logging/LogRecord.java
index af7f2058d..ee99ee69a 100644
--- a/java/util/logging/LogRecord.java
+++ b/java/util/logging/LogRecord.java
@@ -140,7 +140,7 @@ public class LogRecord
*
* @param message the message text (which will be used as key
* for looking up the localized message text
- * if a resource bundle has been associated).
+ * if a resource bundle has been associated).
*/
public LogRecord(Level level, String message)
{
@@ -182,7 +182,7 @@ public class LogRecord
{
parameters = new Object[numParams];
for (int i = 0; i < numParams; i++)
- parameters[i] = in.readObject();
+ parameters[i] = in.readObject();
}
}
@@ -220,10 +220,10 @@ public class LogRecord
out.writeInt(parameters.length);
for (int i = 0; i < parameters.length; i++)
{
- if (parameters[i] == null)
- out.writeObject(null);
- else
- out.writeObject(parameters[i].toString());
+ if (parameters[i] == null)
+ out.writeObject(null);
+ else
+ out.writeObject(parameters[i].toString());
}
}
}
@@ -331,11 +331,11 @@ public class LogRecord
{
resourceBundleName = name;
bundle = null;
-
+
try
{
if (resourceBundleName != null)
- bundle = ResourceBundle.getBundle(resourceBundleName);
+ bundle = ResourceBundle.getBundle(resourceBundleName);
}
catch (java.util.MissingResourceException _)
{
@@ -427,7 +427,7 @@ public class LogRecord
* parameter to some logging calls, and in certain cases, the
* logging framework tries to determine an approximation
* (which may or may not be accurate).
- *
+ *
* @return the name of the class that issued the logging request,
* or <code>null</code> if this information could not
* be obtained.
@@ -450,7 +450,7 @@ public class LogRecord
* to the logging framework, applications should not modify it
* anymore. Therefore, this method should only be called on
* freshly constructed LogRecords.
- *
+ *
* @param sourceClassName the name of the class that issued the
* logging request, or <code>null</code> to indicate that
* this information could not be obtained.
@@ -467,7 +467,7 @@ public class LogRecord
* parameter to some logging calls, and in certain cases, the
* logging framework tries to determine an approximation
* (which may or may not be accurate).
- *
+ *
* @return the name of the method that issued the logging request,
* or <code>null</code> if this information could not
* be obtained.
@@ -490,7 +490,7 @@ public class LogRecord
* to the logging framework, applications should not modify it
* anymore. Therefore, this method should only be called on
* freshly constructed LogRecords.
- *
+ *
* @param sourceMethodName the name of the method that issued the
* logging request, or <code>null</code> to indicate that
* this information could not be obtained.
@@ -543,7 +543,7 @@ public class LogRecord
*
* @param message the message text (which will be used as key
* for looking up the localized message text
- * if a resource bundle has been associated).
+ * if a resource bundle has been associated).
*/
public void setMessage(String message)
{
diff --git a/java/util/logging/Logger.java b/java/util/logging/Logger.java
index cddc02d1c..c55e133e5 100644
--- a/java/util/logging/Logger.java
+++ b/java/util/logging/Logger.java
@@ -65,7 +65,7 @@ import java.security.PrivilegedAction;
* to perform any modifications to the logger.
* <p>
* FIXME: Write more documentation.
- *
+ *
* @author Sascha Brawer (brawer@acm.org)
*/
public class Logger
@@ -85,7 +85,7 @@ public class Logger
* to avoid deadlocks. Yeah, no kidding, we got them :)
*/
private static final Object[] lock = new Object[0];
-
+
static
{
// Our class might be initialized from an unprivileged context
@@ -159,7 +159,7 @@ public class Logger
* (with ResourceBundle for localization) or
* {@link #getLogger(java.lang.String) getLogger} (without ResourceBundle),
* respectively.
- *
+ *
* @param name the name for the logger, for example "java.awt" or
* "com.foo.bar". The name should be based on the name of the
* package issuing log records and consist of dot-separated Java
@@ -196,7 +196,7 @@ public class Logger
/**
* Finds a registered logger for a subsystem, or creates one in case no logger
* has been registered yet.
- *
+ *
* @param name the name for the logger, for example "java.awt" or
* "com.foo.bar". The name should be based on the name of the
* package issuing log records and consist of dot-separated Java
@@ -232,7 +232,7 @@ public class Logger
* a different one than specified by <code>resourceBundleName</code>, an
* <code>IllegalArgumentException</code> is thrown.</li>
* </ul>
- *
+ *
* @param name the name for the logger, for example "java.awt" or
* "org.gnu.foo". The name should be based on the name of the
* package issuing log records and consist of dot-separated Java
@@ -351,7 +351,7 @@ public class Logger
* <p>
* The parent of the newly created logger will the the root logger, from which
* the level threshold and the handlers are inherited.
- *
+ *
* @param resourceBundleName the name of a resource bundle for localizing
* messages, or <code>null</code> to indicate that messages do
* not need to be localized.
@@ -372,7 +372,7 @@ public class Logger
/**
* Returns the name of the resource bundle that is being used for localizing
* messages.
- *
+ *
* @return the name of the resource bundle used for localizing messages, or
* <code>null</code> if the parent's resource bundle is used for
* this purpose.
@@ -387,7 +387,7 @@ public class Logger
/**
* Returns the resource bundle that is being used for localizing messages.
- *
+ *
* @return the resource bundle used for localizing messages, or
* <code>null</code> if the parent's resource bundle is used for
* this purpose.
@@ -405,7 +405,7 @@ public class Logger
* log records with a lower severity level will be discarded; a log record of
* the same or a higher level will be published unless an installed
* <code>Filter</code> decides to discard it.
- *
+ *
* @return the severity level below which all log messages will be discarded,
* or <code>null</code> if the logger inherits the threshold from
* its parent.
@@ -421,7 +421,7 @@ public class Logger
/**
* Returns whether or not a message of the specified level would be logged by
* this logger.
- *
+ *
* @throws NullPointerException if <code>level</code> is <code>null</code>.
*/
public boolean isLoggable(Level level)
@@ -443,7 +443,7 @@ public class Logger
* records with a lower severity level will be discarded immediately. A log
* record of the same or a higher level will be published unless an installed
* <code>Filter</code> decides to discard it.
- *
+ *
* @param level the severity level below which all log messages will be
* discarded, or <code>null</code> to indicate that the logger
* should inherit the threshold from its parent.
@@ -502,7 +502,7 @@ public class Logger
/**
* Returns the name of this logger.
- *
+ *
* @return the name of this logger, or <code>null</code> if the logger is
* anonymous.
*/
@@ -528,7 +528,7 @@ public class Logger
* create a new LogRecord and pass it to this method. Therefore, subclasses
* usually just need to override this single method for customizing the
* logging behavior.
- *
+ *
* @param record the log record to be inspected and possibly forwarded.
*/
public void log(LogRecord record)
@@ -825,7 +825,7 @@ public class Logger
* understandable to an inexperienced, non-technical end user. Ideally, they
* explain in simple words what actions the user can take in order to resolve
* the problem.
- *
+ *
* @see Level#SEVERE
* @param message the message text, also used as look-up key if the logger is
* localizing messages with a resource bundle. While it is possible
@@ -847,7 +847,7 @@ public class Logger
* should be understandable to an inexperienced, non-technical end user.
* Ideally, they explain in simple words what actions the user can take in
* order to resolve the problem.
- *
+ *
* @see Level#WARNING
* @param message the message text, also used as look-up key if the logger is
* localizing messages with a resource bundle. While it is possible
@@ -871,7 +871,7 @@ public class Logger
* used only for messages that are important to end users and system
* administrators. Messages at this level should be understandable to an
* inexperienced, non-technical user.
- *
+ *
* @param message the message text, also used as look-up key if the logger is
* localizing messages with a resource bundle. While it is possible
* to pass <code>null</code>, this is not recommended, since a
@@ -890,7 +890,7 @@ public class Logger
* Logs a message with severity level CONFIG. {@link Level#CONFIG} is intended
* for static configuration messages, for example about the windowing
* environment, the operating system version, etc.
- *
+ *
* @param message the message text, also used as look-up key if the logger is
* localizing messages with a resource bundle. While it is possible
* to pass <code>null</code>, this is not recommended, since a
@@ -910,7 +910,7 @@ public class Logger
* messages that are relevant for developers using the component generating
* log messages. Examples include minor, recoverable failures, or possible
* inefficiencies.
- *
+ *
* @param message the message text, also used as look-up key if the logger is
* localizing messages with a resource bundle. While it is possible
* to pass <code>null</code>, this is not recommended, since a
@@ -929,7 +929,7 @@ public class Logger
* Logs a message with severity level FINER. {@link Level#FINER} is intended
* for rather detailed tracing, for example entering a method, returning from
* a method, or throwing an exception.
- *
+ *
* @param message the message text, also used as look-up key if the logger is
* localizing messages with a resource bundle. While it is possible
* to pass <code>null</code>, this is not recommended, since a
@@ -948,7 +948,7 @@ public class Logger
* Logs a message with severity level FINEST. {@link Level#FINEST} is intended
* for highly detailed tracing, for example reaching a certain point inside
* the body of a method.
- *
+ *
* @param message the message text, also used as look-up key if the logger is
* localizing messages with a resource bundle. While it is possible
* to pass <code>null</code>, this is not recommended, since a
@@ -966,7 +966,7 @@ public class Logger
/**
* Adds a handler to the set of handlers that get notified when a log record
* is to be published.
- *
+ *
* @param handler the handler to be added.
* @throws NullPointerException if <code>handler</code> is <code>null</code>.
* @throws SecurityException if this logger is not anonymous, a security
@@ -1001,7 +1001,7 @@ public class Logger
/**
* Removes a handler from the set of handlers that get notified when a log
* record is to be published.
- *
+ *
* @param handler the handler to be removed.
* @throws SecurityException if this logger is not anonymous, a security
* manager exists, and the caller is not granted the permission to
@@ -1053,7 +1053,7 @@ public class Logger
/**
* Returns whether or not this Logger forwards log records to handlers
* registered for its parent loggers.
- *
+ *
* @return <code>false</code> if this Logger sends log records merely to
* Handlers registered with itself; <code>true</code> if this Logger
* sends log records not only to Handlers registered with itself, but
@@ -1070,7 +1070,7 @@ public class Logger
/**
* Sets whether or not this Logger forwards log records to handlers registered
* for its parent loggers.
- *
+ *
* @param useParentHandlers <code>false</code> to let this Logger send log
* records merely to Handlers registered with itself;
* <code>true</code> to let this Logger send log records not only
@@ -1101,7 +1101,7 @@ public class Logger
/**
* Returns the parent of this logger. By default, the parent is assigned by
* the LogManager by inspecting the logger's name.
- *
+ *
* @return the parent of this logger (as detemined by the LogManager by
* inspecting logger names), the root logger if no other logger has a
* name which is a prefix of this logger's name, or <code>null</code>
@@ -1121,7 +1121,7 @@ public class Logger
* loggers reflects the hierarchical logger namespace. Basically, this method
* should not be public at all, but the GNU implementation follows the API
* specification.
- *
+ *
* @throws NullPointerException if <code>parent</code> is <code>null</code>.
* @throws SecurityException if this logger is not anonymous, a security
* manager exists, and the caller is not granted the permission to
@@ -1155,7 +1155,7 @@ public class Logger
/**
* Gets the StackTraceElement of the first class that is not this class. That
* should be the initial caller of a logging method.
- *
+ *
* @return caller of the initial logging method or null if unknown.
*/
private StackTraceElement getCallerStackFrame()
diff --git a/java/util/logging/LoggingMXBean.java b/java/util/logging/LoggingMXBean.java
index 3e0a7276d..24d8834c7 100644
--- a/java/util/logging/LoggingMXBean.java
+++ b/java/util/logging/LoggingMXBean.java
@@ -44,7 +44,7 @@ import java.util.List;
* This interface represents the management interface for logging.
* There is a single logging bean per VM instance, which can be
* retrieved via {@link LogManager#getLoggingMXBean()}.
- *
+ *
* @since 1.5
*/
public interface LoggingMXBean
@@ -73,7 +73,7 @@ public interface LoggingMXBean
/**
* Sets the logging level for a particular logger.
- *
+ *
* @param logger the name of the logger
* @param level the name of the new logging level, or null
* @throws IllegalArgumentException if the level is not
diff --git a/java/util/logging/LoggingPermission.java b/java/util/logging/LoggingPermission.java
index 1139a793a..804fb9401 100644
--- a/java/util/logging/LoggingPermission.java
+++ b/java/util/logging/LoggingPermission.java
@@ -59,17 +59,17 @@ public final class LoggingPermission
public LoggingPermission(String name, String actions)
{
super("control", "");
-
+
if (!"control".equals(name))
{
throw new IllegalArgumentException(
"name of LoggingPermission must be \"control\"");
}
-
+
if ((actions != null) && (actions.length() != 0))
{
throw new IllegalArgumentException(
- "actions of LoggingPermissions must be null or empty");
- }
+ "actions of LoggingPermissions must be null or empty");
+ }
}
}
diff --git a/java/util/logging/MemoryHandler.java b/java/util/logging/MemoryHandler.java
index ffa589f16..e5c258bbf 100644
--- a/java/util/logging/MemoryHandler.java
+++ b/java/util/logging/MemoryHandler.java
@@ -122,19 +122,19 @@ public class MemoryHandler
public MemoryHandler()
{
this((Handler) LogManager.getInstanceProperty(
- "java.util.logging.MemoryHandler.target",
- Handler.class, /* default */ null),
- LogManager.getIntPropertyClamped(
- "java.util.logging.MemoryHandler.size",
- /* default */ 1000,
- /* minimum value */ 1,
- /* maximum value */ Integer.MAX_VALUE),
- LogManager.getLevelProperty(
- "java.util.logging.MemoryHandler.push",
- /* default push level */ Level.SEVERE));
+ "java.util.logging.MemoryHandler.target",
+ Handler.class, /* default */ null),
+ LogManager.getIntPropertyClamped(
+ "java.util.logging.MemoryHandler.size",
+ /* default */ 1000,
+ /* minimum value */ 1,
+ /* maximum value */ Integer.MAX_VALUE),
+ LogManager.getLevelProperty(
+ "java.util.logging.MemoryHandler.push",
+ /* default push level */ Level.SEVERE));
}
-
+
/**
* Constructs a <code>MemoryHandler</code> for keeping a circular
* buffer of LogRecords, given some parameters. The values of the
@@ -162,7 +162,7 @@ public class MemoryHandler
* in those cases.
*/
public MemoryHandler(Handler target, int size, Level pushLevel)
- {
+ {
if ((target == null) || (size <= 0) || (pushLevel == null))
throw new IllegalArgumentException();
@@ -235,9 +235,9 @@ public class MemoryHandler
else
{
for (i = position; i < buffer.length; i++)
- target.publish(buffer[i]);
+ target.publish(buffer[i]);
for (i = 0; i < position; i++)
- target.publish(buffer[i]);
+ target.publish(buffer[i]);
}
numPublished = 0;
@@ -298,7 +298,7 @@ public class MemoryHandler
target.close();
}
-
+
/**
* Returns the push level threshold for this <code>Handler</code>.
diff --git a/java/util/logging/SocketHandler.java b/java/util/logging/SocketHandler.java
index 002dfdbbe..3c17b9bbc 100644
--- a/java/util/logging/SocketHandler.java
+++ b/java/util/logging/SocketHandler.java
@@ -104,10 +104,10 @@ public class SocketHandler
throws java.io.IOException
{
this(LogManager.getLogManager().getProperty("java.util.logging.SocketHandler.host"),
- getPortNumber());
+ getPortNumber());
}
-
+
/**
* Constructs a <code>SocketHandler</code> that publishes log
* records to a TCP/IP socket. With the exception of the internet
@@ -131,10 +131,10 @@ public class SocketHandler
throws java.io.IOException
{
super(createSocket(host, port),
- "java.util.logging.SocketHandler",
- /* default level */ Level.ALL,
- /* formatter */ null,
- /* default formatter */ XMLFormatter.class);
+ "java.util.logging.SocketHandler",
+ /* default level */ Level.ALL,
+ /* formatter */ null,
+ /* default formatter */ XMLFormatter.class);
}
@@ -218,4 +218,3 @@ public class SocketHandler
flush();
}
}
-
diff --git a/java/util/logging/StreamHandler.java b/java/util/logging/StreamHandler.java
index 5c35c1e48..d74dfac0c 100644
--- a/java/util/logging/StreamHandler.java
+++ b/java/util/logging/StreamHandler.java
@@ -114,7 +114,7 @@ public class StreamHandler
public StreamHandler(OutputStream out, Formatter formatter)
{
this(out, "java.util.logging.StreamHandler", Level.INFO,
- formatter, SimpleFormatter.class);
+ formatter, SimpleFormatter.class);
}
@@ -125,7 +125,7 @@ public class StreamHandler
Formatter formatter, Class defaultFormatterClass)
{
this.level = LogManager.getLevelProperty(propertyPrefix + ".level",
- defaultLevel);
+ defaultLevel);
this.filter = (Filter) LogManager.getInstanceProperty(
propertyPrefix + ".filter",
@@ -136,14 +136,14 @@ public class StreamHandler
this.formatter = formatter;
else
this.formatter = (Formatter) LogManager.getInstanceProperty(
- propertyPrefix + ".formatter",
+ propertyPrefix + ".formatter",
/* must be instance of */ Formatter.class,
/* default: new instance of */ defaultFormatterClass);
try
{
String enc = LogManager.getLogManager().getProperty(propertyPrefix
- + ".encoding");
+ + ".encoding");
/* make sure enc actually is a valid encoding */
if ((enc != null) && (enc.length() > 0))
@@ -163,10 +163,10 @@ public class StreamHandler
}
catch (UnsupportedEncodingException uex)
{
- /* This should never happen, since the validity of the encoding
- * name has been checked above.
- */
- throw new RuntimeException(uex.getMessage());
+ /* This should never happen, since the validity of the encoding
+ * name has been checked above.
+ */
+ throw new RuntimeException(uex.getMessage());
}
}
}
@@ -263,9 +263,9 @@ public class StreamHandler
* null would throw an exception.
*/
if (encoding == null)
- writer = new OutputStreamWriter(out);
+ writer = new OutputStreamWriter(out);
else
- writer = new OutputStreamWriter(out, encoding);
+ writer = new OutputStreamWriter(out, encoding);
}
}
@@ -330,7 +330,7 @@ public class StreamHandler
* would depend on the exact behavior in this rather obscure,
* erroneous case -- especially since the API specification does not
* prescribe what is supposed to happen.
- *
+ *
* @param record the log event to be published.
*/
public void publish(LogRecord record)
@@ -348,13 +348,13 @@ public class StreamHandler
}
catch (java.io.IOException ex)
{
- reportError(null, ex, ErrorManager.WRITE_FAILURE);
- return;
+ reportError(null, ex, ErrorManager.WRITE_FAILURE);
+ return;
}
catch (Exception ex)
{
- reportError(null, ex, ErrorManager.GENERIC_FAILURE);
- return;
+ reportError(null, ex, ErrorManager.GENERIC_FAILURE);
+ return;
}
streamState = STATE_PUBLISHED;
@@ -449,7 +449,7 @@ public class StreamHandler
/**
* Closes this <code>StreamHandler</code> after having forced any
* data that may have been buffered to the underlying output
- * device.
+ * device.
*
* <p>As soon as <code>close</code> has been called,
* a <code>Handler</code> should not be used anymore. Attempts
@@ -496,20 +496,20 @@ public class StreamHandler
if (writer != null)
{
- if (formatter != null)
- {
- /* Even if the StreamHandler has never published a record,
- * it emits head and tail upon closing. An earlier version
- * of the GNU Classpath implementation did not emitted
- * anything. However, this had caused XML log files to be
- * entirely empty instead of containing no log records.
- */
- if (streamState == STATE_FRESH)
+ if (formatter != null)
+ {
+ /* Even if the StreamHandler has never published a record,
+ * it emits head and tail upon closing. An earlier version
+ * of the GNU Classpath implementation did not emitted
+ * anything. However, this had caused XML log files to be
+ * entirely empty instead of containing no log records.
+ */
+ if (streamState == STATE_FRESH)
writer.write(formatter.getHead(this));
- if (streamState != STATE_CLOSED)
- writer.write(formatter.getTail(this));
- }
- streamState = STATE_CLOSED;
+ if (streamState != STATE_CLOSED)
+ writer.write(formatter.getTail(this));
+ }
+ streamState = STATE_CLOSED;
writer.close();
}
}
diff --git a/java/util/logging/XMLFormatter.java b/java/util/logging/XMLFormatter.java
index 194fcd238..da7c6ef29 100644
--- a/java/util/logging/XMLFormatter.java
+++ b/java/util/logging/XMLFormatter.java
@@ -75,7 +75,7 @@ public class XMLFormatter
*/
private static final String lineSep = SimpleFormatter.lineSep;
-
+
/**
* A DateFormat for emitting time in the ISO 8601 format.
* Since the API specification of SimpleDateFormat does not talk
@@ -129,29 +129,29 @@ public class XMLFormatter
switch (c)
{
case '&':
- buf.append("&amp;");
- break;
+ buf.append("&amp;");
+ break;
case '<':
- buf.append("&lt;");
- break;
+ buf.append("&lt;");
+ break;
case '>':
- buf.append("&gt;");
- break;
+ buf.append("&gt;");
+ break;
default:
- if (((c >= 0x20) && (c <= 0x7e))
- || (c == /* line feed */ 10)
- || (c == /* carriage return */ 13))
- buf.append(c);
- else
- {
- buf.append("&#");
- buf.append((int) c);
- buf.append(';');
- }
- break;
+ if (((c >= 0x20) && (c <= 0x7e))
+ || (c == /* line feed */ 10)
+ || (c == /* carriage return */ 13))
+ buf.append(c);
+ else
+ {
+ buf.append("&#");
+ buf.append((int) c);
+ buf.append(';');
+ }
+ break;
} /* switch (c) */
} /* for i */
@@ -190,11 +190,11 @@ public class XMLFormatter
Object[] params = record.getParameters();
ResourceBundle bundle = record.getResourceBundle();
String message;
-
+
buf.append("<record>");
buf.append(lineSep);
-
-
+
+
appendTag(buf, 1, "date", iso8601.format(new Date(millis)));
appendTag(buf, 1, "millis", millis);
appendTag(buf, 1, "sequence", record.getSequenceNumber());
@@ -346,7 +346,7 @@ public class XMLFormatter
*/
if (encoding == null)
encoding = "UTF-8";
-
+
/* On Windows XP localized for Swiss German (this is one of
* my [Sascha Brawer's] test machines), the default encoding
* has the canonical name "windows-1252". The "historical" name
diff --git a/java/util/prefs/AbstractPreferences.java b/java/util/prefs/AbstractPreferences.java
index 9562e1bbf..14fed384a 100644
--- a/java/util/prefs/AbstractPreferences.java
+++ b/java/util/prefs/AbstractPreferences.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -118,7 +118,7 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Creates a new AbstractPreferences node with the given parent and name.
- *
+ *
* @param parent the parent of this node or null when this is the root node
* @param name the name of this node, can not be null, only 80 characters
* maximum, must be empty when parent is null and cannot
@@ -174,9 +174,9 @@ public abstract class AbstractPreferences extends Preferences {
*/
public boolean isUserNode() {
AbstractPreferences root = this;
- while (root.parent != null)
- root = root.parent;
- return root == Preferences.userRoot();
+ while (root.parent != null)
+ root = root.parent;
+ return root == Preferences.userRoot();
}
/**
@@ -238,7 +238,7 @@ public abstract class AbstractPreferences extends Preferences {
// First get all cached node names
childrenNames.addAll(childCache.keySet());
-
+
// Then add any others
String names[] = childrenNamesSpi();
for (int i = 0; i < names.length; i++) {
@@ -339,7 +339,7 @@ public abstract class AbstractPreferences extends Preferences {
if (child == null) {
if (childName.length() > MAX_NAME_LENGTH)
- throw new IllegalArgumentException(childName);
+ throw new IllegalArgumentException(childName);
// Not in childCache yet so create a new sub node
child = childSpi(childName);
@@ -457,7 +457,7 @@ public abstract class AbstractPreferences extends Preferences {
for (int i=0; i < names.length; i++)
if (name.equals(names[i]))
return childSpi(name);
-
+
// No child with that name found
return null;
}
@@ -523,8 +523,8 @@ public abstract class AbstractPreferences extends Preferences {
* This method locks this node and checks if the node has not been
* removed, if it has been removed it throws an exception, then it returns
* the result of calling <code>keysSpi()</code>.
- *
- * @exception BackingStoreException when the backing store cannot be
+ *
+ * @exception BackingStoreException when the backing store cannot be
* reached
* @exception IllegalStateException if this node has been removed
*/
@@ -597,7 +597,7 @@ public abstract class AbstractPreferences extends Preferences {
if ("false".equalsIgnoreCase(value))
return false;
-
+
return defaultVal;
}
@@ -625,7 +625,7 @@ public abstract class AbstractPreferences extends Preferences {
else
return defaultVal;
}
-
+
/**
* Helper method for decoding a Base64 string as an byte array.
* Returns null on encoding error. This method does not allow any other
@@ -807,7 +807,7 @@ public abstract class AbstractPreferences extends Preferences {
if (preferenceListeners != null)
fire(new PreferenceChangeEvent(this, key, value));
}
-
+
}
/**
@@ -948,7 +948,7 @@ public abstract class AbstractPreferences extends Preferences {
/**
* Removes the preferences entry from this preferences node.
- * <p>
+ * <p>
* The result will be immediately visible in this VM, but may not be
* immediately written to the backing store.
* <p>
@@ -1040,7 +1040,7 @@ public abstract class AbstractPreferences extends Preferences {
public void sync() throws BackingStoreException {
flushNode(true);
}
-
+
/**
* Private helper method that locks this node and calls either
@@ -1247,7 +1247,7 @@ public abstract class AbstractPreferences extends Preferences {
listener.preferenceChange(event);
}
};
-
+
Executor executor =
Executors.newSingleThreadExecutor(new DefaultDaemonThreadFactory());
executor.execute(dispatcher);
@@ -1273,7 +1273,7 @@ public abstract class AbstractPreferences extends Preferences {
listener.childRemoved(event);
}
};
-
+
Executor executor =
Executors.newSingleThreadExecutor(new DefaultDaemonThreadFactory());
executor.execute(dispatcher);
@@ -1316,11 +1316,11 @@ public abstract class AbstractPreferences extends Preferences {
* not been removed. May throw an exception when the backing store cannot
* be accessed.
*
- * @exception BackingStoreException when the backing store cannot be
+ * @exception BackingStoreException when the backing store cannot be
* reached
*/
protected abstract String[] keysSpi() throws BackingStoreException;
-
+
/**
* Returns the value associated with the key in this preferences node or
* null when the key does not exist in this preferences node.
diff --git a/java/util/prefs/NodeChangeEvent.java b/java/util/prefs/NodeChangeEvent.java
index 8c48fb29f..5bdeb3346 100644
--- a/java/util/prefs/NodeChangeEvent.java
+++ b/java/util/prefs/NodeChangeEvent.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -58,8 +58,8 @@ import java.util.EventObject;
public class NodeChangeEvent extends EventObject {
// We have this to placate the compiler.
- private static final long serialVersionUID =8068949086596572957L;
-
+ private static final long serialVersionUID =8068949086596572957L;
+
/**
* The sub node that was added or removed.
* Defined transient just like <code>EventObject.source</code> since
@@ -102,7 +102,7 @@ public class NodeChangeEvent extends EventObject {
{
throw new NotSerializableException("LineEvent is not serializable");
}
-
+
private void writeObject(ObjectOutputStream oos)
throws IOException
{
diff --git a/java/util/prefs/NodeChangeListener.java b/java/util/prefs/NodeChangeListener.java
index 19664c665..8d018ab67 100644
--- a/java/util/prefs/NodeChangeListener.java
+++ b/java/util/prefs/NodeChangeListener.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/util/prefs/PreferenceChangeEvent.java b/java/util/prefs/PreferenceChangeEvent.java
index 41c3a478c..f273361e1 100644
--- a/java/util/prefs/PreferenceChangeEvent.java
+++ b/java/util/prefs/PreferenceChangeEvent.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -62,7 +62,7 @@ public class PreferenceChangeEvent extends EventObject {
// We have this to placate the compiler.
private static final long serialVersionUID = 793724513368024975L;
-
+
/**
* The key of the changed entry.
*/
@@ -116,7 +116,7 @@ public class PreferenceChangeEvent extends EventObject {
{
throw new NotSerializableException("LineEvent is not serializable");
}
-
+
private void writeObject(ObjectOutputStream oos)
throws IOException
{
diff --git a/java/util/prefs/PreferenceChangeListener.java b/java/util/prefs/PreferenceChangeListener.java
index adff35820..e6118bc31 100644
--- a/java/util/prefs/PreferenceChangeListener.java
+++ b/java/util/prefs/PreferenceChangeListener.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/util/prefs/Preferences.java b/java/util/prefs/Preferences.java
index e8cdda8ed..3ff9c85e3 100644
--- a/java/util/prefs/Preferences.java
+++ b/java/util/prefs/Preferences.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -213,28 +213,28 @@ public abstract class Preferences {
{
Iterator iter = ServiceFactory.lookupProviders
(PreferencesFactory.class, null);
-
+
if (iter != null && iter.hasNext())
factory = (PreferencesFactory) iter.next();
}
-
+
// Still no factory? Use our default.
if (factory == null)
- {
+ {
try
- {
+ {
Class cls = Class.forName (defaultFactoryClass);
factory = (PreferencesFactory) cls.newInstance();
}
- catch (Exception e)
- {
+ catch (Exception e)
+ {
throw new RuntimeException ("Couldn't load default factory"
+ " '"+ defaultFactoryClass +"'", e);
}
}
}
-
+
return factory;
}
@@ -305,7 +305,7 @@ public abstract class Preferences {
* @throws InvalidPreferencesFormatException if the XML is not properly
* formatted
*/
- public static void importPreferences(InputStream is)
+ public static void importPreferences(InputStream is)
throws InvalidPreferencesFormatException,
IOException
{
@@ -318,7 +318,7 @@ public abstract class Preferences {
/**
* Returns the absolute path name of this preference node.
- * The absolute path name of a node is the path name of its parent node
+ * The absolute path name of a node is the path name of its parent node
* plus a '/' plus its own name. If the node is the root node and has no
* parent then its name is "" and its absolute path name is "/".
*/
@@ -400,8 +400,8 @@ public abstract class Preferences {
// abstract methods (export)
/**
- * Export this node, but not its descendants, as XML to the
- * indicated output stream. The XML will be encoded using UTF-8
+ * Export this node, but not its descendants, as XML to the
+ * indicated output stream. The XML will be encoded using UTF-8
* and will use a specified document type:<br>
* <code>&lt;!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd"&gt;</code><br>
* @param os the output stream to which the XML is sent
@@ -414,8 +414,8 @@ public abstract class Preferences {
IOException;
/**
- * Export this node and all its descendants as XML to the
- * indicated output stream. The XML will be encoded using UTF-8
+ * Export this node and all its descendants as XML to the
+ * indicated output stream. The XML will be encoded using UTF-8
* and will use a specified document type:<br>
* <code>&lt;!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd"&gt;</code><br>
* @param os the output stream to which the XML is sent
@@ -670,7 +670,7 @@ public abstract class Preferences {
* <p>
* Note that according to the specification an implementation may delay
* removal of the node from the backing store till the <code>flush()</code>
- * method is called. But the <code>flush()</code> method may throw a
+ * method is called. But the <code>flush()</code> method may throw a
* <code>IllegalStateException</code> when the node has been removed.
* So most implementations will actually remove the node and any subnodes
* from the backing store immediatly.
@@ -694,4 +694,3 @@ public abstract class Preferences {
public abstract void removePreferenceChangeListener
(PreferenceChangeListener listener);
}
-
diff --git a/java/util/prefs/PreferencesFactory.java b/java/util/prefs/PreferencesFactory.java
index f4fe7e37f..5674f806d 100644
--- a/java/util/prefs/PreferencesFactory.java
+++ b/java/util/prefs/PreferencesFactory.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/util/regex/MatchResult.java b/java/util/regex/MatchResult.java
index c82d8cc99..605873dd0 100644
--- a/java/util/regex/MatchResult.java
+++ b/java/util/regex/MatchResult.java
@@ -48,25 +48,25 @@ public interface MatchResult
{
/** Returns the index just after the last matched character. */
int end();
-
+
/**
* Returns the index just after the last matched character of the
* given sub-match group.
* @param group the sub-match group
- */
+ */
int end(int group);
/** Returns the substring of the input which was matched. */
String group();
-
- /**
+
+ /**
* Returns the substring of the input which was matched by the
* given sub-match group.
* @param group the sub-match group
*/
String group(int group);
- /** Returns the number of sub-match groups in the matching pattern. */
+ /** Returns the number of sub-match groups in the matching pattern. */
int groupCount();
/** Returns the index of the first character of the match. */
diff --git a/java/util/regex/Pattern.java b/java/util/regex/Pattern.java
index 35ec0b89e..7d1fc84b4 100644
--- a/java/util/regex/Pattern.java
+++ b/java/util/regex/Pattern.java
@@ -46,14 +46,14 @@ import java.util.ArrayList;
/**
- * Compiled regular expression ready to be applied.
+ * Compiled regular expression ready to be applied.
*
* @since 1.4
*/
public final class Pattern implements Serializable
{
private static final long serialVersionUID = 5073258162644648461L;
-
+
public static final int CANON_EQ = 128;
public static final int CASE_INSENSITIVE = 2;
public static final int COMMENTS = 4;
@@ -61,7 +61,7 @@ public final class Pattern implements Serializable
public static final int MULTILINE = 8;
public static final int UNICODE_CASE = 64;
public static final int UNIX_LINES = 1;
-
+
private final String regex;
private final int flags;
@@ -93,30 +93,30 @@ public final class Pattern implements Serializable
if ((flags & UNIX_LINES) != 0)
{
- // Use a syntax set with \n for linefeeds?
- syntax = new RESyntax(syntax);
- syntax.setLineSeparator("\n");
+ // Use a syntax set with \n for linefeeds?
+ syntax = new RESyntax(syntax);
+ syntax.setLineSeparator("\n");
}
if ((flags & COMMENTS) != 0)
{
- gnuFlags |= RE.REG_X_COMMENTS;
+ gnuFlags |= RE.REG_X_COMMENTS;
}
try
{
- this.re = new RE(regex, gnuFlags, syntax);
+ this.re = new RE(regex, gnuFlags, syntax);
}
catch (REException e)
{
- PatternSyntaxException pse;
- pse = new PatternSyntaxException(e.getMessage(),
- regex, e.getPosition());
- pse.initCause(e);
- throw pse;
+ PatternSyntaxException pse;
+ pse = new PatternSyntaxException(e.getMessage(),
+ regex, e.getPosition());
+ pse.initCause(e);
+ throw pse;
}
}
-
+
// package private accessor method
RE getRE()
{
@@ -133,7 +133,7 @@ public final class Pattern implements Serializable
{
return compile(regex, 0);
}
-
+
/**
* @param regex The regular expression
* @param flags The match flags, a bit mask
@@ -148,26 +148,26 @@ public final class Pattern implements Serializable
// FIXME: check which flags are really accepted
if ((flags & ~0xEF) != 0)
throw new IllegalArgumentException ();
-
- return new Pattern (regex, flags);
+
+ return new Pattern (regex, flags);
}
-
+
public int flags ()
{
return this.flags;
}
-
+
/**
* @param regex The regular expression
* @param input The character sequence to be matched
*
* @exception PatternSyntaxException If the expression's syntax is invalid
*/
- public static boolean matches (String regex, CharSequence input)
+ public static boolean matches (String regex, CharSequence input)
{
return compile(regex).matcher(input).matches();
}
-
+
/**
* @param input The character sequence to be matched
*/
@@ -175,7 +175,7 @@ public final class Pattern implements Serializable
{
return new Matcher(this, input);
}
-
+
/**
* @param input The character sequence to be matched
*/
@@ -183,7 +183,7 @@ public final class Pattern implements Serializable
{
return split(input, 0);
}
-
+
/**
* @param input The character sequence to be matched
* @param limit The result threshold
@@ -200,60 +200,60 @@ public final class Pattern implements Serializable
while (matched && (limit <= 0 || count < limit - 1))
{
- ++count;
- end = matcher.start();
- if (start == end)
- empties++;
- else
- {
- while (empties > 0)
- {
- list.add("");
- empties--;
- }
-
- String text = input.subSequence(start, end).toString();
- list.add(text);
- }
- start = matcher.end();
- matched = matcher.find();
+ ++count;
+ end = matcher.start();
+ if (start == end)
+ empties++;
+ else
+ {
+ while (empties > 0)
+ {
+ list.add("");
+ empties--;
+ }
+
+ String text = input.subSequence(start, end).toString();
+ list.add(text);
+ }
+ start = matcher.end();
+ matched = matcher.find();
}
// We matched nothing.
if (!matched && count == 0)
return new String[] { input.toString() };
-
+
// Is the last token empty?
boolean emptyLast = (start == input.length());
// Can/Must we add empties or an extra last token at the end?
if (list.size() < limit || limit < 0 || (limit == 0 && !emptyLast))
{
- if (limit > list.size())
- {
- int max = limit - list.size();
- empties = (empties > max) ? max : empties;
- }
- while (empties > 0)
- {
- list.add("");
- empties--;
- }
+ if (limit > list.size())
+ {
+ int max = limit - list.size();
+ empties = (empties > max) ? max : empties;
+ }
+ while (empties > 0)
+ {
+ list.add("");
+ empties--;
+ }
}
// last token at end
if (limit != 0 || (limit == 0 && !emptyLast))
{
- String t = input.subSequence(start, input.length()).toString();
- if ("".equals(t) && limit == 0)
- { /* Don't add. */ }
- else
- list.add(t);
+ String t = input.subSequence(start, input.length()).toString();
+ if ("".equals(t) && limit == 0)
+ { /* Don't add. */ }
+ else
+ list.add(t);
}
return list.toArray(new String[list.size()]);
}
-
+
public String pattern ()
{
return regex;
diff --git a/java/util/regex/PatternSyntaxException.java b/java/util/regex/PatternSyntaxException.java
index 38e27db27..db73d06e2 100644
--- a/java/util/regex/PatternSyntaxException.java
+++ b/java/util/regex/PatternSyntaxException.java
@@ -58,7 +58,7 @@ public class PatternSyntaxException extends IllegalArgumentException
* The original pattern that contained the syntax error.
*/
private final String pattern;
-
+
/**
* Index of the first character in the String that was probably invalid,
* or -1 when unknown.
@@ -74,8 +74,8 @@ public class PatternSyntaxException extends IllegalArgumentException
* probably invalid, or -1 when unknown.
*/
public PatternSyntaxException(String description,
- String pattern,
- int index)
+ String pattern,
+ int index)
{
super(description);
this.desc = description;
@@ -123,11 +123,11 @@ public class PatternSyntaxException extends IllegalArgumentException
sb.append(pattern);
if (index != -1)
{
- sb.append(lineSep);
- sb.append('\t');
- for (int i=0; i<index; i++)
- sb.append(' ');
- sb.append('^');
+ sb.append(lineSep);
+ sb.append('\t');
+ for (int i=0; i<index; i++)
+ sb.append(' ');
+ sb.append('^');
}
return sb.toString();
}
diff --git a/java/util/spi/LocaleNameProvider.java b/java/util/spi/LocaleNameProvider.java
index dfd2e4cbc..44250feb5 100644
--- a/java/util/spi/LocaleNameProvider.java
+++ b/java/util/spi/LocaleNameProvider.java
@@ -85,7 +85,7 @@ public abstract class LocaleNameProvider
* @see java.util.Locale#getDisplayCountry(java.util.Locale)
*/
public abstract String getDisplayCountry(String countryCode,
- Locale locale);
+ Locale locale);
/**
* Returns the localized name for the specified ISO 639
@@ -111,7 +111,7 @@ public abstract class LocaleNameProvider
* @see java.util.Locale#getDisplayLanguage(java.util.Locale)
*/
public abstract String getDisplayLanguage(String langCode,
- Locale locale);
+ Locale locale);
/**
* Returns the localized name for the specified variant
@@ -130,6 +130,6 @@ public abstract class LocaleNameProvider
* @see java.util.Locale#getDisplayVariant(java.util.Locale)
*/
public abstract String getDisplayVariant(String variant,
- Locale locale);
+ Locale locale);
}
diff --git a/java/util/spi/TimeZoneNameProvider.java b/java/util/spi/TimeZoneNameProvider.java
index 281567057..afd56eb1b 100644
--- a/java/util/spi/TimeZoneNameProvider.java
+++ b/java/util/spi/TimeZoneNameProvider.java
@@ -92,6 +92,6 @@ public abstract class TimeZoneNameProvider
* @see java.util.TimeZone#getDisplayName(boolean,int,java.util.Locale)
*/
public abstract String getDisplayName(String id, boolean daylight,
- int style, Locale locale);
+ int style, Locale locale);
}
diff --git a/java/util/zip/Adler32.java b/java/util/zip/Adler32.java
index 7c4113840..cc27da927 100644
--- a/java/util/zip/Adler32.java
+++ b/java/util/zip/Adler32.java
@@ -45,8 +45,8 @@ package java.util.zip;
*/
/**
- * Computes Adler32 checksum for a stream of data. An Adler32
- * checksum is not as reliable as a CRC32 checksum, but a lot faster to
+ * Computes Adler32 checksum for a stream of data. An Adler32
+ * checksum is not as reliable as a CRC32 checksum, but a lot faster to
* compute.
*<p>
* The specification for Adler32 may be found in RFC 1950.
@@ -60,7 +60,7 @@ package java.util.zip;
* (excluding any dictionary data) computed according to Adler-32
* algorithm. This algorithm is a 32-bit extension and improvement
* of the Fletcher algorithm, used in the ITU-T X.224 / ISO 8073
- * standard.
+ * standard.
*<p>
* Adler-32 is composed of two sums accumulated per byte: s1 is
* the sum of all bytes, s2 is the sum of all s1 values. Both sums
@@ -103,13 +103,13 @@ public class Adler32 implements Checksum
private int checksum; //we do all in int.
//Note that java doesn't have unsigned integers,
- //so we have to be careful with what arithmetic
- //we do. We return the checksum as a long to
+ //so we have to be careful with what arithmetic
+ //we do. We return the checksum as a long to
//avoid sign confusion.
/**
- * Creates a new instance of the <code>Adler32</code> class.
- * The checksum starts off with a value of 1.
+ * Creates a new instance of the <code>Adler32</code> class.
+ * The checksum starts off with a value of 1.
*/
public Adler32 ()
{
@@ -119,13 +119,13 @@ public class Adler32 implements Checksum
/**
* Resets the Adler32 checksum to the initial value.
*/
- public void reset ()
+ public void reset ()
{
- checksum = 1; //Initialize to 1
+ checksum = 1; //Initialize to 1
}
/**
- * Updates the checksum with the byte b.
+ * Updates the checksum with the byte b.
*
* @param bval the data value to add. The high byte of the int is ignored.
*/
@@ -135,16 +135,16 @@ public class Adler32 implements Checksum
//would rather not have that overhead
int s1 = checksum & 0xffff;
int s2 = checksum >>> 16;
-
+
s1 = (s1 + (bval & 0xFF)) % BASE;
s2 = (s1 + s2) % BASE;
-
+
checksum = (s2 << 16) + s1;
}
/**
- * Updates the checksum with the bytes taken from the array.
- *
+ * Updates the checksum with the bytes taken from the array.
+ *
* @param buffer an array of bytes
*/
public void update (byte[] buffer)
@@ -153,8 +153,8 @@ public class Adler32 implements Checksum
}
/**
- * Updates the checksum with the bytes taken from the array.
- *
+ * Updates the checksum with the bytes taken from the array.
+ *
* @param buf an array of bytes
* @param off the start of the data used for this update
* @param len the number of bytes to use for this update
@@ -167,31 +167,31 @@ public class Adler32 implements Checksum
while (len > 0)
{
- // We can defer the modulo operation:
- // s1 maximally grows from 65521 to 65521 + 255 * 3800
- // s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31
- int n = 3800;
- if (n > len)
- n = len;
- len -= n;
- while (--n >= 0)
- {
- s1 = s1 + (buf[off++] & 0xFF);
- s2 = s2 + s1;
- }
- s1 %= BASE;
- s2 %= BASE;
+ // We can defer the modulo operation:
+ // s1 maximally grows from 65521 to 65521 + 255 * 3800
+ // s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31
+ int n = 3800;
+ if (n > len)
+ n = len;
+ len -= n;
+ while (--n >= 0)
+ {
+ s1 = s1 + (buf[off++] & 0xFF);
+ s2 = s2 + s1;
+ }
+ s1 %= BASE;
+ s2 %= BASE;
}
/*Old implementation, borrowed from somewhere:
int n;
-
+
while (len-- > 0) {
- s1 = (s1 + (bs[offset++] & 0xff)) % BASE;
+ s1 = (s1 + (bs[offset++] & 0xff)) % BASE;
s2 = (s2 + s1) % BASE;
}*/
-
+
checksum = (s2 << 16) | s1;
}
diff --git a/java/util/zip/CRC32.java b/java/util/zip/CRC32.java
index 1c2b39738..de2e7083d 100644
--- a/java/util/zip/CRC32.java
+++ b/java/util/zip/CRC32.java
@@ -71,15 +71,15 @@ public class CRC32 implements Checksum
int[] crc_table = new int[256];
for (int n = 0; n < 256; n++)
{
- int c = n;
- for (int k = 8; --k >= 0; )
- {
- if ((c & 1) != 0)
- c = 0xedb88320 ^ (c >>> 1);
- else
- c = c >>> 1;
- }
- crc_table[n] = c;
+ int c = n;
+ for (int k = 8; --k >= 0; )
+ {
+ if ((c & 1) != 0)
+ c = 0xedb88320 ^ (c >>> 1);
+ else
+ c = c >>> 1;
+ }
+ crc_table[n] = c;
}
return crc_table;
}
@@ -98,7 +98,7 @@ public class CRC32 implements Checksum
public void reset () { crc = 0; }
/**
- * Updates the checksum with the int bval.
+ * Updates the checksum with the int bval.
*
* @param bval (the byte is taken as the lower 8 bits of bval)
*/
diff --git a/java/util/zip/CheckedInputStream.java b/java/util/zip/CheckedInputStream.java
index d743fbb24..163a4c4aa 100644
--- a/java/util/zip/CheckedInputStream.java
+++ b/java/util/zip/CheckedInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -118,13 +118,13 @@ public class CheckedInputStream extends FilterInputStream
long s = 0;
while (n > 0)
{
- int r = in.read(buf, 0, min);
- if (r == -1)
- break;
- n -= r;
- s += r;
- min = (int) Math.min(n, 1024);
- sum.update(buf, 0, r);
+ int r = in.read(buf, 0, min);
+ if (r == -1)
+ break;
+ n -= r;
+ s += r;
+ min = (int) Math.min(n, 1024);
+ sum.update(buf, 0, r);
}
return s;
diff --git a/java/util/zip/CheckedOutputStream.java b/java/util/zip/CheckedOutputStream.java
index a3c19292f..e0222258a 100644
--- a/java/util/zip/CheckedOutputStream.java
+++ b/java/util/zip/CheckedOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
diff --git a/java/util/zip/Deflater.java b/java/util/zip/Deflater.java
index 41d988144..dd81fe748 100644
--- a/java/util/zip/Deflater.java
+++ b/java/util/zip/Deflater.java
@@ -41,10 +41,10 @@ package java.util.zip;
* This is the Deflater class. The deflater class compresses input
* with the deflate algorithm described in RFC 1951. It has several
* compression levels and three different strategies described below.
- *
+ *
* This class is <i>not</i> thread safe. This is inherent in the API, due
* to the split of deflate and setInput.
- *
+ *
* @author Jochen Hoenicke
* @author Tom Tromey
*/
@@ -52,11 +52,11 @@ public class Deflater
{
/**
* The best and slowest compression level. This tries to find very
- * long and distant string repetitions.
+ * long and distant string repetitions.
*/
public static final int BEST_COMPRESSION = 9;
/**
- * The worst but fastest compression level.
+ * The worst but fastest compression level.
*/
public static final int BEST_SPEED = 1;
/**
@@ -78,10 +78,10 @@ public class Deflater
*/
public static final int FILTERED = 1;
- /**
+ /**
* This strategy will not look for string repetitions at all. It
* only encodes with Huffman trees (which means, that more common
- * characters get a smaller encoding.
+ * characters get a smaller encoding.
*/
public static final int HUFFMAN_ONLY = 2;
@@ -123,13 +123,13 @@ public class Deflater
* (6) FINISHED_STATE is entered, when everything has been flushed to the
* internal pending output buffer.
* (7) At any time (7)
- *
+ *
*/
private static final int IS_SETDICT = 0x01;
private static final int IS_FLUSHING = 0x04;
private static final int IS_FINISHING = 0x08;
-
+
private static final int INIT_STATE = 0x00;
private static final int SETDICT_STATE = 0x01;
private static final int INIT_FINISHING_STATE = 0x08;
@@ -151,7 +151,7 @@ public class Deflater
/** The total bytes of output written. */
private long totalOut;
-
+
/** The pending output. */
private DeflaterPending pending;
@@ -169,7 +169,7 @@ public class Deflater
/**
* Creates a new deflater with given compression level.
* @param lvl the compression level, a value between NO_COMPRESSION
- * and BEST_COMPRESSION, or DEFAULT_COMPRESSION.
+ * and BEST_COMPRESSION, or DEFAULT_COMPRESSION.
* @exception IllegalArgumentException if lvl is out of range.
*/
public Deflater(int lvl)
@@ -180,7 +180,7 @@ public class Deflater
/**
* Creates a new deflater with given compression level.
* @param lvl the compression level, a value between NO_COMPRESSION
- * and BEST_COMPRESSION.
+ * and BEST_COMPRESSION.
* @param nowrap true, iff we should suppress the deflate header at the
* beginning and the adler checksum at the end of the output. This is
* useful for the GZIP format.
@@ -201,26 +201,26 @@ public class Deflater
reset();
}
- /**
+ /**
* Resets the deflater. The deflater acts afterwards as if it was
* just created with the same compression level and strategy as it
- * had before.
+ * had before.
*/
- public void reset()
+ public void reset()
{
state = (noHeader ? BUSY_STATE : INIT_STATE);
totalOut = 0;
pending.reset();
engine.reset();
}
-
+
/**
* Frees all objects allocated by the compressor. There's no
* reason to call this, since you can just rely on garbage
* collection. Exists only for compatibility against Sun's JDK,
* where the compressor allocates native memory.
* If you call any method (even reset) afterwards the behaviour is
- * <i>undefined</i>.
+ * <i>undefined</i>.
*/
public void end()
{
@@ -229,7 +229,7 @@ public class Deflater
state = CLOSED_STATE;
}
- /**
+ /**
* Gets the current adler checksum of the data that was processed so
* far.
*/
@@ -238,7 +238,7 @@ public class Deflater
return engine.getAdler();
}
- /**
+ /**
* Gets the number of input bytes processed so far.
*/
public int getTotalIn()
@@ -246,7 +246,7 @@ public class Deflater
return (int) engine.getTotalIn();
}
- /**
+ /**
* Gets the number of input bytes processed so far.
* @since 1.5
*/
@@ -255,7 +255,7 @@ public class Deflater
return engine.getTotalIn();
}
- /**
+ /**
* Gets the number of output bytes so far.
*/
public int getTotalOut()
@@ -263,7 +263,7 @@ public class Deflater
return (int) totalOut;
}
- /**
+ /**
* Gets the number of output bytes so far.
* @since 1.5
*/
@@ -272,7 +272,7 @@ public class Deflater
return totalOut;
}
- /**
+ /**
* Finalizes this object.
*/
protected void finalize()
@@ -280,7 +280,7 @@ public class Deflater
/* Exists solely for compatibility. We don't have any native state. */
}
- /**
+ /**
* Flushes the current input block. Further calls to deflate() will
* produce enough output to inflate everything in the current input
* block. This is not part of Sun's JDK so I have made it package
@@ -291,7 +291,7 @@ public class Deflater
state |= IS_FLUSHING;
}
- /**
+ /**
* Finishes the deflater with the current input block. It is an error
* to give more input after this method was called. This method must
* be called to force all bytes to be flushed.
@@ -300,7 +300,7 @@ public class Deflater
state |= IS_FLUSHING | IS_FINISHING;
}
- /**
+ /**
* Returns true iff the stream was finished and no more output bytes
* are available.
*/
@@ -314,7 +314,7 @@ public class Deflater
* You should then call setInput(). <br>
*
* <em>NOTE</em>: This method can also return true when the stream
- * was finished.
+ * was finished.
*/
public boolean needsInput()
{
@@ -344,7 +344,7 @@ public class Deflater
* true again.
* @param input the buffer containing the input data.
* @param off the start of the data.
- * @param len the length of the data.
+ * @param len the length of the data.
* @exception IllegalStateException if the buffer was finished() or ended()
* or if previous input is still pending.
*/
@@ -355,11 +355,11 @@ public class Deflater
engine.setInput(input, off, len);
}
- /**
+ /**
* Sets the compression level. There is no guarantee of the exact
* position of the change, but if you call this when needsInput is
* true the change of compression level will occur somewhere near
- * before the end of the so far given input.
+ * before the end of the so far given input.
* @param lvl the new compression level.
*/
public void setLevel(int lvl)
@@ -372,12 +372,12 @@ public class Deflater
if (level != lvl)
{
- level = lvl;
- engine.setLevel(lvl);
+ level = lvl;
+ engine.setLevel(lvl);
}
}
- /**
+ /**
* Sets the compression strategy. Strategy is one of
* DEFAULT_STRATEGY, HUFFMAN_ONLY and FILTERED. For the exact
* position where the strategy is changed, the same as for
@@ -387,14 +387,14 @@ public class Deflater
public void setStrategy(int stgy)
{
if (stgy != DEFAULT_STRATEGY && stgy != FILTERED
- && stgy != HUFFMAN_ONLY)
+ && stgy != HUFFMAN_ONLY)
throw new IllegalArgumentException();
engine.setStrategy(stgy);
}
/**
- * Deflates the current input block to the given array. It returns
- * the number of bytes compressed, or 0 if either
+ * Deflates the current input block to the given array. It returns
+ * the number of bytes compressed, or 0 if either
* needsInput() or finished() returns true or length is zero.
* @param output the buffer where to write the compressed data.
*/
@@ -404,15 +404,15 @@ public class Deflater
}
/**
- * Deflates the current input block to the given array. It returns
- * the number of bytes compressed, or 0 if either
+ * Deflates the current input block to the given array. It returns
+ * the number of bytes compressed, or 0 if either
* needsInput() or finished() returns true or length is zero.
* @param output the buffer where to write the compressed data.
* @param offset the offset into the output array.
* @param length the maximum number of bytes that may be written.
* @exception IllegalStateException if end() was called.
* @exception IndexOutOfBoundsException if offset and/or length
- * don't match the array length.
+ * don't match the array length.
*/
public int deflate(byte[] output, int offset, int length)
{
@@ -423,78 +423,78 @@ public class Deflater
if (state < BUSY_STATE)
{
- /* output header */
- int header = (DEFLATED +
- ((DeflaterConstants.MAX_WBITS - 8) << 4)) << 8;
- int level_flags = (level - 1) >> 1;
- if (level_flags < 0 || level_flags > 3)
- level_flags = 3;
- header |= level_flags << 6;
- if ((state & IS_SETDICT) != 0)
- /* Dictionary was set */
- header |= DeflaterConstants.PRESET_DICT;
- header += 31 - (header % 31);
-
- pending.writeShortMSB(header);
- if ((state & IS_SETDICT) != 0)
- {
- int chksum = engine.getAdler();
- engine.resetAdler();
- pending.writeShortMSB(chksum >> 16);
- pending.writeShortMSB(chksum & 0xffff);
- }
-
- state = BUSY_STATE | (state & (IS_FLUSHING | IS_FINISHING));
+ /* output header */
+ int header = (DEFLATED +
+ ((DeflaterConstants.MAX_WBITS - 8) << 4)) << 8;
+ int level_flags = (level - 1) >> 1;
+ if (level_flags < 0 || level_flags > 3)
+ level_flags = 3;
+ header |= level_flags << 6;
+ if ((state & IS_SETDICT) != 0)
+ /* Dictionary was set */
+ header |= DeflaterConstants.PRESET_DICT;
+ header += 31 - (header % 31);
+
+ pending.writeShortMSB(header);
+ if ((state & IS_SETDICT) != 0)
+ {
+ int chksum = engine.getAdler();
+ engine.resetAdler();
+ pending.writeShortMSB(chksum >> 16);
+ pending.writeShortMSB(chksum & 0xffff);
+ }
+
+ state = BUSY_STATE | (state & (IS_FLUSHING | IS_FINISHING));
}
for (;;)
{
- int count = pending.flush(output, offset, length);
- offset += count;
- totalOut += count;
- length -= count;
- if (length == 0 || state == FINISHED_STATE)
- break;
-
- if (!engine.deflate((state & IS_FLUSHING) != 0,
- (state & IS_FINISHING) != 0))
- {
- if (state == BUSY_STATE)
- /* We need more input now */
- return origLength - length;
- else if (state == FLUSHING_STATE)
- {
- if (level != NO_COMPRESSION)
- {
- /* We have to supply some lookahead. 8 bit lookahead
- * are needed by the zlib inflater, and we must fill
- * the next byte, so that all bits are flushed.
- */
- int neededbits = 8 + ((-pending.getBitCount()) & 7);
- while (neededbits > 0)
- {
- /* write a static tree block consisting solely of
- * an EOF:
- */
- pending.writeBits(2, 10);
- neededbits -= 10;
- }
- }
- state = BUSY_STATE;
- }
- else if (state == FINISHING_STATE)
- {
- pending.alignToByte();
- /* We have completed the stream */
- if (!noHeader)
- {
- int adler = engine.getAdler();
- pending.writeShortMSB(adler >> 16);
- pending.writeShortMSB(adler & 0xffff);
- }
- state = FINISHED_STATE;
- }
- }
+ int count = pending.flush(output, offset, length);
+ offset += count;
+ totalOut += count;
+ length -= count;
+ if (length == 0 || state == FINISHED_STATE)
+ break;
+
+ if (!engine.deflate((state & IS_FLUSHING) != 0,
+ (state & IS_FINISHING) != 0))
+ {
+ if (state == BUSY_STATE)
+ /* We need more input now */
+ return origLength - length;
+ else if (state == FLUSHING_STATE)
+ {
+ if (level != NO_COMPRESSION)
+ {
+ /* We have to supply some lookahead. 8 bit lookahead
+ * are needed by the zlib inflater, and we must fill
+ * the next byte, so that all bits are flushed.
+ */
+ int neededbits = 8 + ((-pending.getBitCount()) & 7);
+ while (neededbits > 0)
+ {
+ /* write a static tree block consisting solely of
+ * an EOF:
+ */
+ pending.writeBits(2, 10);
+ neededbits -= 10;
+ }
+ }
+ state = BUSY_STATE;
+ }
+ else if (state == FINISHING_STATE)
+ {
+ pending.alignToByte();
+ /* We have completed the stream */
+ if (!noHeader)
+ {
+ int adler = engine.getAdler();
+ pending.writeShortMSB(adler >> 16);
+ pending.writeShortMSB(adler & 0xffff);
+ }
+ state = FINISHED_STATE;
+ }
+ }
}
return origLength - length;
@@ -503,10 +503,10 @@ public class Deflater
/**
* Sets the dictionary which should be used in the deflate process.
* This call is equivalent to <code>setDictionary(dict, 0,
- * dict.length)</code>.
- * @param dict the dictionary.
+ * dict.length)</code>.
+ * @param dict the dictionary.
* @exception IllegalStateException if setInput () or deflate ()
- * were already called or another dictionary was already set.
+ * were already called or another dictionary was already set.
*/
public void setDictionary(byte[] dict)
{
diff --git a/java/util/zip/DeflaterEngine.java b/java/util/zip/DeflaterEngine.java
index 38a82d8b7..287558e3e 100644
--- a/java/util/zip/DeflaterEngine.java
+++ b/java/util/zip/DeflaterEngine.java
@@ -45,7 +45,7 @@ class DeflaterEngine implements DeflaterConstants
/**
* Hashtable, hashing three characters to an index for window, so
- * that window[index]..window[index+2] have this hash code.
+ * that window[index]..window[index+2] have this hash code.
* Note that the array should really be unsigned short, so you need
* to and the values with 0xffff.
*/
@@ -53,7 +53,7 @@ class DeflaterEngine implements DeflaterConstants
/**
* prev[index & WMASK] points to the previous index that has the
- * same hash code as the string starting at index. This way
+ * same hash code as the string starting at index. This way
* entries with the same hash code are in a linked list.
* Note that the array should really be unsigned short, so you need
* to and the values with 0xffff.
@@ -78,7 +78,7 @@ class DeflaterEngine implements DeflaterConstants
private int lookahead;
/**
- * This array contains the part of the uncompressed stream that
+ * This array contains the part of the uncompressed stream that
* is of relevance. The current character is indexed by strstart.
*/
private byte[] window;
@@ -113,12 +113,12 @@ class DeflaterEngine implements DeflaterConstants
* second half is copied to the beginning.
*
* The head array is a hash table. Three characters build a hash value
- * and they the value points to the corresponding index in window of
+ * and they the value points to the corresponding index in window of
* the last string with this hash. The prev array implements a
* linked list of matches with the same hash: prev[index & WMASK] points
* to the previous index with the same hash.
- *
- *
+ *
+ *
*/
@@ -180,44 +180,44 @@ class DeflaterEngine implements DeflaterConstants
niceLength = DeflaterConstants.NICE_LENGTH[lvl];
max_chain = DeflaterConstants.MAX_CHAIN[lvl];
- if (DeflaterConstants.COMPR_FUNC[lvl] != comprFunc)
+ if (DeflaterConstants.COMPR_FUNC[lvl] != comprFunc)
{
- if (DeflaterConstants.DEBUGGING)
- System.err.println("Change from "+comprFunc +" to "
- + DeflaterConstants.COMPR_FUNC[lvl]);
- switch (comprFunc)
- {
- case DEFLATE_STORED:
- if (strstart > blockStart)
- {
- huffman.flushStoredBlock(window, blockStart,
- strstart - blockStart, false);
- blockStart = strstart;
- }
- updateHash();
- break;
- case DEFLATE_FAST:
- if (strstart > blockStart)
- {
- huffman.flushBlock(window, blockStart, strstart - blockStart,
- false);
- blockStart = strstart;
- }
- break;
- case DEFLATE_SLOW:
- if (prevAvailable)
- huffman.tallyLit(window[strstart-1] & 0xff);
- if (strstart > blockStart)
- {
- huffman.flushBlock(window, blockStart, strstart - blockStart,
- false);
- blockStart = strstart;
- }
- prevAvailable = false;
- matchLen = MIN_MATCH - 1;
- break;
- }
- comprFunc = COMPR_FUNC[lvl];
+ if (DeflaterConstants.DEBUGGING)
+ System.err.println("Change from "+comprFunc +" to "
+ + DeflaterConstants.COMPR_FUNC[lvl]);
+ switch (comprFunc)
+ {
+ case DEFLATE_STORED:
+ if (strstart > blockStart)
+ {
+ huffman.flushStoredBlock(window, blockStart,
+ strstart - blockStart, false);
+ blockStart = strstart;
+ }
+ updateHash();
+ break;
+ case DEFLATE_FAST:
+ if (strstart > blockStart)
+ {
+ huffman.flushBlock(window, blockStart, strstart - blockStart,
+ false);
+ blockStart = strstart;
+ }
+ break;
+ case DEFLATE_SLOW:
+ if (prevAvailable)
+ huffman.tallyLit(window[strstart-1] & 0xff);
+ if (strstart > blockStart)
+ {
+ huffman.flushBlock(window, blockStart, strstart - blockStart,
+ false);
+ blockStart = strstart;
+ }
+ prevAvailable = false;
+ matchLen = MIN_MATCH - 1;
+ break;
+ }
+ comprFunc = COMPR_FUNC[lvl];
}
}
@@ -225,7 +225,7 @@ class DeflaterEngine implements DeflaterConstants
if (DEBUGGING)
System.err.println("updateHash: "+strstart);
ins_h = (window[strstart] << HASH_SHIFT) ^ window[strstart + 1];
- }
+ }
/**
* Inserts the current string in the head hash and returns the previous
@@ -238,13 +238,13 @@ class DeflaterEngine implements DeflaterConstants
if (DEBUGGING)
{
- if (hash != (((window[strstart] << (2*HASH_SHIFT))
- ^ (window[strstart + 1] << HASH_SHIFT)
- ^ (window[strstart + 2])) & HASH_MASK))
- throw new InternalError("hash inconsistent: "+hash+"/"
- +window[strstart]+","
- +window[strstart+1]+","
- +window[strstart+2]+","+HASH_SHIFT);
+ if (hash != (((window[strstart] << (2*HASH_SHIFT))
+ ^ (window[strstart + 1] << HASH_SHIFT)
+ ^ (window[strstart + 2])) & HASH_MASK))
+ throw new InternalError("hash inconsistent: "+hash+"/"
+ +window[strstart]+","
+ +window[strstart+1]+","
+ +window[strstart+2]+","+HASH_SHIFT);
}
prev[strstart & WMASK] = match = head[hash];
@@ -259,22 +259,22 @@ class DeflaterEngine implements DeflaterConstants
matchStart -= WSIZE;
strstart -= WSIZE;
blockStart -= WSIZE;
-
+
/* Slide the hash table (could be avoided with 32 bit values
* at the expense of memory usage).
*/
- for (int i = 0; i < HASH_SIZE; i++)
+ for (int i = 0; i < HASH_SIZE; i++)
{
- int m = head[i] & 0xffff;
- head[i] = m >= WSIZE ? (short) (m - WSIZE) : 0;
+ int m = head[i] & 0xffff;
+ head[i] = m >= WSIZE ? (short) (m - WSIZE) : 0;
}
/* Slide the prev table.
*/
- for (int i = 0; i < WSIZE; i++)
+ for (int i = 0; i < WSIZE; i++)
{
- int m = prev[i] & 0xffff;
- prev[i] = m >= WSIZE ? (short) (m - WSIZE) : 0;
+ int m = prev[i] & 0xffff;
+ prev[i] = m >= WSIZE ? (short) (m - WSIZE) : 0;
}
}
@@ -298,30 +298,30 @@ class DeflaterEngine implements DeflaterConstants
*/
while (lookahead < DeflaterConstants.MIN_LOOKAHEAD && inputOff < inputEnd)
{
- int more = 2*WSIZE - lookahead - strstart;
-
- if (more > inputEnd - inputOff)
- more = inputEnd - inputOff;
-
- System.arraycopy(inputBuf, inputOff,
- window, strstart + lookahead, more);
- adler.update(inputBuf, inputOff, more);
- inputOff += more;
- totalIn += more;
- lookahead += more;
+ int more = 2*WSIZE - lookahead - strstart;
+
+ if (more > inputEnd - inputOff)
+ more = inputEnd - inputOff;
+
+ System.arraycopy(inputBuf, inputOff,
+ window, strstart + lookahead, more);
+ adler.update(inputBuf, inputOff, more);
+ inputOff += more;
+ totalIn += more;
+ lookahead += more;
}
- if (lookahead >= MIN_MATCH)
+ if (lookahead >= MIN_MATCH)
updateHash();
}
/**
- * Find the best (longest) string in the window matching the
+ * Find the best (longest) string in the window matching the
* string starting at strstart.
*
* Preconditions:
* strstart + MAX_MATCH <= window.length.
- *
+ *
*
* @param curMatch
*/
@@ -333,7 +333,7 @@ class DeflaterEngine implements DeflaterConstants
int match;
int best_end = this.strstart + matchLen;
int best_len = Math.max(matchLen, MIN_MATCH - 1);
-
+
int limit = Math.max(strstart - MAX_DIST, 0);
int strend = scan + MAX_MATCH - 1;
@@ -350,51 +350,51 @@ class DeflaterEngine implements DeflaterConstants
if (niceLength > lookahead)
niceLength = lookahead;
- if (DeflaterConstants.DEBUGGING
- && strstart > 2*WSIZE - MIN_LOOKAHEAD)
+ if (DeflaterConstants.DEBUGGING
+ && strstart > 2*WSIZE - MIN_LOOKAHEAD)
throw new InternalError("need lookahead");
-
+
do {
if (DeflaterConstants.DEBUGGING && curMatch >= strstart)
- throw new InternalError("future match");
+ throw new InternalError("future match");
if (window[curMatch + best_len] != scan_end
- || window[curMatch + best_len - 1] != scan_end1
- || window[curMatch] != window[scan]
- || window[curMatch+1] != window[scan + 1])
- continue;
+ || window[curMatch + best_len - 1] != scan_end1
+ || window[curMatch] != window[scan]
+ || window[curMatch+1] != window[scan + 1])
+ continue;
- match = curMatch + 2;
+ match = curMatch + 2;
scan += 2;
/* We check for insufficient lookahead only every 8th comparison;
* the 256th check will be made at strstart+258.
*/
while (window[++scan] == window[++match]
- && window[++scan] == window[++match]
- && window[++scan] == window[++match]
- && window[++scan] == window[++match]
- && window[++scan] == window[++match]
- && window[++scan] == window[++match]
- && window[++scan] == window[++match]
- && window[++scan] == window[++match]
- && scan < strend)
+ && window[++scan] == window[++match]
+ && window[++scan] == window[++match]
+ && window[++scan] == window[++match]
+ && window[++scan] == window[++match]
+ && window[++scan] == window[++match]
+ && window[++scan] == window[++match]
+ && window[++scan] == window[++match]
+ && scan < strend)
;
if (scan > best_end) {
-// if (DeflaterConstants.DEBUGGING && ins_h == 0)
-// System.err.println("Found match: "+curMatch+"-"+(scan-strstart));
- matchStart = curMatch;
- best_end = scan;
- best_len = scan - strstart;
- if (best_len >= niceLength)
- break;
-
- scan_end1 = window[best_end-1];
- scan_end = window[best_end];
+// if (DeflaterConstants.DEBUGGING && ins_h == 0)
+// System.err.println("Found match: "+curMatch+"-"+(scan-strstart));
+ matchStart = curMatch;
+ best_end = scan;
+ best_len = scan - strstart;
+ if (best_len >= niceLength)
+ break;
+
+ scan_end1 = window[best_end-1];
+ scan_end = window[best_end];
}
scan = strstart;
} while ((curMatch = (prev[curMatch & WMASK] & 0xffff)) > limit
- && --chainLength != 0);
+ && --chainLength != 0);
matchLen = Math.min(best_len, lookahead);
return matchLen >= MIN_MATCH;
@@ -417,13 +417,13 @@ class DeflaterEngine implements DeflaterConstants
length--;
while (--length > 0)
{
- insertString();
- strstart++;
+ insertString();
+ strstart++;
}
strstart += 2;
blockStart = strstart;
- }
-
+ }
+
private boolean deflateStored(boolean flush, boolean finish)
{
if (!flush && lookahead == 0)
@@ -434,25 +434,25 @@ class DeflaterEngine implements DeflaterConstants
int storedLen = strstart - blockStart;
- if ((storedLen >= DeflaterConstants.MAX_BLOCK_SIZE)
- /* Block is full */
- || (blockStart < WSIZE && storedLen >= MAX_DIST)
- /* Block may move out of window */
- || flush)
+ if ((storedLen >= DeflaterConstants.MAX_BLOCK_SIZE)
+ /* Block is full */
+ || (blockStart < WSIZE && storedLen >= MAX_DIST)
+ /* Block may move out of window */
+ || flush)
{
- boolean lastBlock = finish;
- if (storedLen > DeflaterConstants.MAX_BLOCK_SIZE)
- {
- storedLen = DeflaterConstants.MAX_BLOCK_SIZE;
- lastBlock = false;
- }
-
- if (DeflaterConstants.DEBUGGING)
- System.err.println("storedBlock["+storedLen+","+lastBlock+"]");
-
- huffman.flushStoredBlock(window, blockStart, storedLen, lastBlock);
- blockStart += storedLen;
- return !lastBlock;
+ boolean lastBlock = finish;
+ if (storedLen > DeflaterConstants.MAX_BLOCK_SIZE)
+ {
+ storedLen = DeflaterConstants.MAX_BLOCK_SIZE;
+ lastBlock = false;
+ }
+
+ if (DeflaterConstants.DEBUGGING)
+ System.err.println("storedBlock["+storedLen+","+lastBlock+"]");
+
+ huffman.flushStoredBlock(window, blockStart, storedLen, lastBlock);
+ blockStart += storedLen;
+ return !lastBlock;
}
return true;
}
@@ -464,78 +464,78 @@ class DeflaterEngine implements DeflaterConstants
while (lookahead >= MIN_LOOKAHEAD || flush)
{
- if (lookahead == 0)
- {
- /* We are flushing everything */
- huffman.flushBlock(window, blockStart, strstart - blockStart,
- finish);
- blockStart = strstart;
- return false;
- }
-
- if (strstart > 2 * WSIZE - MIN_LOOKAHEAD)
- {
- /* slide window, as findLongestMatch need this.
- * This should only happen when flushing and the window
- * is almost full.
- */
- slideWindow();
- }
-
- int hashHead;
- if (lookahead >= MIN_MATCH
- && (hashHead = insertString()) != 0
- && strategy != Deflater.HUFFMAN_ONLY
- && strstart - hashHead <= MAX_DIST
- && findLongestMatch(hashHead))
- {
- /* longestMatch sets matchStart and matchLen */
- if (DeflaterConstants.DEBUGGING)
- {
- for (int i = 0 ; i < matchLen; i++)
- {
- if (window[strstart+i] != window[matchStart + i])
- throw new InternalError();
- }
- }
- boolean full = huffman.tallyDist(strstart - matchStart, matchLen);
-
- lookahead -= matchLen;
- if (matchLen <= max_lazy && lookahead >= MIN_MATCH)
- {
- while (--matchLen > 0)
- {
- strstart++;
- insertString();
- }
- strstart++;
- }
- else
- {
- strstart += matchLen;
- if (lookahead >= MIN_MATCH - 1)
- updateHash();
- }
- matchLen = MIN_MATCH - 1;
- if (!full)
- continue;
- }
- else
- {
- /* No match found */
- huffman.tallyLit(window[strstart] & 0xff);
- strstart++;
- lookahead--;
- }
-
- if (huffman.isFull())
- {
- boolean lastBlock = finish && lookahead == 0;
- huffman.flushBlock(window, blockStart, strstart - blockStart,
- lastBlock);
- blockStart = strstart;
- return !lastBlock;
- }
+ if (lookahead == 0)
+ {
+ /* We are flushing everything */
+ huffman.flushBlock(window, blockStart, strstart - blockStart,
+ finish);
+ blockStart = strstart;
+ return false;
+ }
+
+ if (strstart > 2 * WSIZE - MIN_LOOKAHEAD)
+ {
+ /* slide window, as findLongestMatch need this.
+ * This should only happen when flushing and the window
+ * is almost full.
+ */
+ slideWindow();
+ }
+
+ int hashHead;
+ if (lookahead >= MIN_MATCH
+ && (hashHead = insertString()) != 0
+ && strategy != Deflater.HUFFMAN_ONLY
+ && strstart - hashHead <= MAX_DIST
+ && findLongestMatch(hashHead))
+ {
+ /* longestMatch sets matchStart and matchLen */
+ if (DeflaterConstants.DEBUGGING)
+ {
+ for (int i = 0 ; i < matchLen; i++)
+ {
+ if (window[strstart+i] != window[matchStart + i])
+ throw new InternalError();
+ }
+ }
+ boolean full = huffman.tallyDist(strstart - matchStart, matchLen);
+
+ lookahead -= matchLen;
+ if (matchLen <= max_lazy && lookahead >= MIN_MATCH)
+ {
+ while (--matchLen > 0)
+ {
+ strstart++;
+ insertString();
+ }
+ strstart++;
+ }
+ else
+ {
+ strstart += matchLen;
+ if (lookahead >= MIN_MATCH - 1)
+ updateHash();
+ }
+ matchLen = MIN_MATCH - 1;
+ if (!full)
+ continue;
+ }
+ else
+ {
+ /* No match found */
+ huffman.tallyLit(window[strstart] & 0xff);
+ strstart++;
+ lookahead--;
+ }
+
+ if (huffman.isFull())
+ {
+ boolean lastBlock = finish && lookahead == 0;
+ huffman.flushBlock(window, blockStart, strstart - blockStart,
+ lastBlock);
+ blockStart = strstart;
+ return !lastBlock;
+ }
}
return true;
}
@@ -547,127 +547,127 @@ class DeflaterEngine implements DeflaterConstants
while (lookahead >= MIN_LOOKAHEAD || flush)
{
- if (lookahead == 0)
- {
- if (prevAvailable)
- huffman.tallyLit(window[strstart-1] & 0xff);
- prevAvailable = false;
-
- /* We are flushing everything */
- if (DeflaterConstants.DEBUGGING && !flush)
- throw new InternalError("Not flushing, but no lookahead");
- huffman.flushBlock(window, blockStart, strstart - blockStart,
- finish);
- blockStart = strstart;
- return false;
- }
-
- if (strstart >= 2 * WSIZE - MIN_LOOKAHEAD)
- {
- /* slide window, as findLongestMatch need this.
- * This should only happen when flushing and the window
- * is almost full.
- */
- slideWindow();
- }
-
- int prevMatch = matchStart;
- int prevLen = matchLen;
- if (lookahead >= MIN_MATCH)
- {
- int hashHead = insertString();
- if (strategy != Deflater.HUFFMAN_ONLY
- && hashHead != 0 && strstart - hashHead <= MAX_DIST
- && findLongestMatch(hashHead))
- {
- /* longestMatch sets matchStart and matchLen */
-
- /* Discard match if too small and too far away */
- if (matchLen <= 5
- && (strategy == Deflater.FILTERED
- || (matchLen == MIN_MATCH
- && strstart - matchStart > TOO_FAR))) {
- matchLen = MIN_MATCH - 1;
- }
- }
- }
-
- /* previous match was better */
- if (prevLen >= MIN_MATCH && matchLen <= prevLen)
- {
- if (DeflaterConstants.DEBUGGING)
- {
- for (int i = 0 ; i < matchLen; i++)
- {
- if (window[strstart-1+i] != window[prevMatch + i])
- throw new InternalError();
- }
- }
- huffman.tallyDist(strstart - 1 - prevMatch, prevLen);
- prevLen -= 2;
- do
- {
- strstart++;
- lookahead--;
- if (lookahead >= MIN_MATCH)
- insertString();
- }
- while (--prevLen > 0);
- strstart ++;
- lookahead--;
- prevAvailable = false;
- matchLen = MIN_MATCH - 1;
- }
- else
- {
- if (prevAvailable)
- huffman.tallyLit(window[strstart-1] & 0xff);
- prevAvailable = true;
- strstart++;
- lookahead--;
- }
-
- if (huffman.isFull())
- {
- int len = strstart - blockStart;
- if (prevAvailable)
- len--;
- boolean lastBlock = (finish && lookahead == 0 && !prevAvailable);
- huffman.flushBlock(window, blockStart, len, lastBlock);
- blockStart += len;
- return !lastBlock;
- }
+ if (lookahead == 0)
+ {
+ if (prevAvailable)
+ huffman.tallyLit(window[strstart-1] & 0xff);
+ prevAvailable = false;
+
+ /* We are flushing everything */
+ if (DeflaterConstants.DEBUGGING && !flush)
+ throw new InternalError("Not flushing, but no lookahead");
+ huffman.flushBlock(window, blockStart, strstart - blockStart,
+ finish);
+ blockStart = strstart;
+ return false;
+ }
+
+ if (strstart >= 2 * WSIZE - MIN_LOOKAHEAD)
+ {
+ /* slide window, as findLongestMatch need this.
+ * This should only happen when flushing and the window
+ * is almost full.
+ */
+ slideWindow();
+ }
+
+ int prevMatch = matchStart;
+ int prevLen = matchLen;
+ if (lookahead >= MIN_MATCH)
+ {
+ int hashHead = insertString();
+ if (strategy != Deflater.HUFFMAN_ONLY
+ && hashHead != 0 && strstart - hashHead <= MAX_DIST
+ && findLongestMatch(hashHead))
+ {
+ /* longestMatch sets matchStart and matchLen */
+
+ /* Discard match if too small and too far away */
+ if (matchLen <= 5
+ && (strategy == Deflater.FILTERED
+ || (matchLen == MIN_MATCH
+ && strstart - matchStart > TOO_FAR))) {
+ matchLen = MIN_MATCH - 1;
+ }
+ }
+ }
+
+ /* previous match was better */
+ if (prevLen >= MIN_MATCH && matchLen <= prevLen)
+ {
+ if (DeflaterConstants.DEBUGGING)
+ {
+ for (int i = 0 ; i < matchLen; i++)
+ {
+ if (window[strstart-1+i] != window[prevMatch + i])
+ throw new InternalError();
+ }
+ }
+ huffman.tallyDist(strstart - 1 - prevMatch, prevLen);
+ prevLen -= 2;
+ do
+ {
+ strstart++;
+ lookahead--;
+ if (lookahead >= MIN_MATCH)
+ insertString();
+ }
+ while (--prevLen > 0);
+ strstart ++;
+ lookahead--;
+ prevAvailable = false;
+ matchLen = MIN_MATCH - 1;
+ }
+ else
+ {
+ if (prevAvailable)
+ huffman.tallyLit(window[strstart-1] & 0xff);
+ prevAvailable = true;
+ strstart++;
+ lookahead--;
+ }
+
+ if (huffman.isFull())
+ {
+ int len = strstart - blockStart;
+ if (prevAvailable)
+ len--;
+ boolean lastBlock = (finish && lookahead == 0 && !prevAvailable);
+ huffman.flushBlock(window, blockStart, len, lastBlock);
+ blockStart += len;
+ return !lastBlock;
+ }
}
return true;
- }
+ }
- public boolean deflate(boolean flush, boolean finish)
+ public boolean deflate(boolean flush, boolean finish)
{
boolean progress;
do
{
- fillWindow();
- boolean canFlush = flush && inputOff == inputEnd;
- if (DeflaterConstants.DEBUGGING)
- System.err.println("window: ["+blockStart+","+strstart+","
- +lookahead+"], "+comprFunc+","+canFlush);
- switch (comprFunc)
- {
- case DEFLATE_STORED:
- progress = deflateStored(canFlush, finish);
- break;
- case DEFLATE_FAST:
- progress = deflateFast(canFlush, finish);
- break;
- case DEFLATE_SLOW:
- progress = deflateSlow(canFlush, finish);
- break;
- default:
- throw new InternalError();
- }
+ fillWindow();
+ boolean canFlush = flush && inputOff == inputEnd;
+ if (DeflaterConstants.DEBUGGING)
+ System.err.println("window: ["+blockStart+","+strstart+","
+ +lookahead+"], "+comprFunc+","+canFlush);
+ switch (comprFunc)
+ {
+ case DEFLATE_STORED:
+ progress = deflateStored(canFlush, finish);
+ break;
+ case DEFLATE_FAST:
+ progress = deflateFast(canFlush, finish);
+ break;
+ case DEFLATE_SLOW:
+ progress = deflateSlow(canFlush, finish);
+ break;
+ default:
+ throw new InternalError();
+ }
}
while (pending.isFlushed() /* repeat while we have no pending output */
- && progress); /* and progress was made */
+ && progress); /* and progress was made */
return progress;
}
@@ -676,12 +676,12 @@ class DeflaterEngine implements DeflaterConstants
{
if (inputOff < inputEnd)
throw new IllegalStateException
- ("Old input was not completely processed");
+ ("Old input was not completely processed");
int end = off + len;
/* We want to throw an ArrayIndexOutOfBoundsException early. The
- * check is very tricky: it also handles integer wrap around.
+ * check is very tricky: it also handles integer wrap around.
*/
if (0 > off || off > end || end > buf.length)
throw new ArrayIndexOutOfBoundsException();
diff --git a/java/util/zip/DeflaterHuffman.java b/java/util/zip/DeflaterHuffman.java
index 32c10b6de..8da987e0f 100644
--- a/java/util/zip/DeflaterHuffman.java
+++ b/java/util/zip/DeflaterHuffman.java
@@ -44,7 +44,7 @@ package java.util.zip;
* to the split of deflate and setInput.
*
* @author Jochen Hoenicke
- * @date Jan 6, 2000
+ * @date Jan 6, 2000
*/
class DeflaterHuffman
{
@@ -79,7 +79,7 @@ class DeflaterHuffman
void reset() {
for (int i = 0; i < freqs.length; i++)
- freqs[i] = 0;
+ freqs[i] = 0;
codes = null;
length = null;
}
@@ -87,10 +87,10 @@ class DeflaterHuffman
final void writeSymbol(int code)
{
if (DeflaterConstants.DEBUGGING)
- {
- freqs[code]--;
-// System.err.print("writeSymbol("+freqs.length+","+code+"): ");
- }
+ {
+ freqs[code]--;
+// System.err.print("writeSymbol("+freqs.length+","+code+"): ");
+ }
pending.writeBits(codes[code] & 0xffff, length[code]);
}
@@ -98,13 +98,13 @@ class DeflaterHuffman
{
boolean empty = true;
for (int i = 0; i < freqs.length; i++)
- if (freqs[i] != 0)
- {
- System.err.println("freqs["+i+"] == "+freqs[i]);
- empty = false;
- }
+ if (freqs[i] != 0)
+ {
+ System.err.println("freqs["+i+"] == "+freqs[i]);
+ empty = false;
+ }
if (!empty)
- throw new InternalError();
+ throw new InternalError();
System.err.println("checkEmpty suceeded!");
}
@@ -120,31 +120,31 @@ class DeflaterHuffman
codes = new short[freqs.length];
if (DeflaterConstants.DEBUGGING)
- System.err.println("buildCodes: "+freqs.length);
- for (int bits = 0; bits < maxLength; bits++)
- {
- nextCode[bits] = code;
- code += bl_counts[bits] << (15 - bits);
- if (DeflaterConstants.DEBUGGING)
- System.err.println("bits: "+(bits+1)+" count: "+bl_counts[bits]
- +" nextCode: "+Integer.toHexString(code));
- }
+ System.err.println("buildCodes: "+freqs.length);
+ for (int bits = 0; bits < maxLength; bits++)
+ {
+ nextCode[bits] = code;
+ code += bl_counts[bits] << (15 - bits);
+ if (DeflaterConstants.DEBUGGING)
+ System.err.println("bits: "+(bits+1)+" count: "+bl_counts[bits]
+ +" nextCode: "+Integer.toHexString(code));
+ }
if (DeflaterConstants.DEBUGGING && code != 65536)
- throw new RuntimeException("Inconsistent bl_counts!");
-
+ throw new RuntimeException("Inconsistent bl_counts!");
+
for (int i=0; i < numCodes; i++)
- {
- int bits = length[i];
- if (bits > 0)
- {
- if (DeflaterConstants.DEBUGGING)
- System.err.println("codes["+i+"] = rev("
- +Integer.toHexString(nextCode[bits-1])+"),"
- +bits);
- codes[i] = bitReverse(nextCode[bits-1]);
- nextCode[bits-1] += 1 << (16 - bits);
- }
- }
+ {
+ int bits = length[i];
+ if (bits > 0)
+ {
+ if (DeflaterConstants.DEBUGGING)
+ System.err.println("codes["+i+"] = rev("
+ +Integer.toHexString(nextCode[bits-1])+"),"
+ +bits);
+ codes[i] = bitReverse(nextCode[bits-1]);
+ nextCode[bits-1] += 1 << (16 - bits);
+ }
+ }
}
private void buildLength(int childs[])
@@ -153,63 +153,63 @@ class DeflaterHuffman
int numNodes = childs.length / 2;
int numLeafs = (numNodes + 1) / 2;
int overflow = 0;
-
+
for (int i = 0; i < maxLength; i++)
- bl_counts[i] = 0;
+ bl_counts[i] = 0;
/* First calculate optimal bit lengths */
int lengths[] = new int[numNodes];
lengths[numNodes-1] = 0;
for (int i = numNodes - 1; i >= 0; i--)
- {
- if (childs[2*i+1] != -1)
- {
- int bitLength = lengths[i] + 1;
- if (bitLength > maxLength)
- {
- bitLength = maxLength;
- overflow++;
- }
- lengths[childs[2*i]] = lengths[childs[2*i+1]] = bitLength;
- }
- else
- {
- /* A leaf node */
- int bitLength = lengths[i];
- bl_counts[bitLength - 1]++;
- this.length[childs[2*i]] = (byte) lengths[i];
- }
- }
-
+ {
+ if (childs[2*i+1] != -1)
+ {
+ int bitLength = lengths[i] + 1;
+ if (bitLength > maxLength)
+ {
+ bitLength = maxLength;
+ overflow++;
+ }
+ lengths[childs[2*i]] = lengths[childs[2*i+1]] = bitLength;
+ }
+ else
+ {
+ /* A leaf node */
+ int bitLength = lengths[i];
+ bl_counts[bitLength - 1]++;
+ this.length[childs[2*i]] = (byte) lengths[i];
+ }
+ }
+
if (DeflaterConstants.DEBUGGING)
- {
- System.err.println("Tree "+freqs.length+" lengths:");
- for (int i=0; i < numLeafs; i++)
- System.err.println("Node "+childs[2*i]+" freq: "+freqs[childs[2*i]]
- + " len: "+length[childs[2*i]]);
- }
-
+ {
+ System.err.println("Tree "+freqs.length+" lengths:");
+ for (int i=0; i < numLeafs; i++)
+ System.err.println("Node "+childs[2*i]+" freq: "+freqs[childs[2*i]]
+ + " len: "+length[childs[2*i]]);
+ }
+
if (overflow == 0)
- return;
-
+ return;
+
int incrBitLen = maxLength - 1;
do
- {
- /* Find the first bit length which could increase: */
- while (bl_counts[--incrBitLen] == 0)
- ;
-
- /* Move this node one down and remove a corresponding
- * amount of overflow nodes.
- */
- do
- {
- bl_counts[incrBitLen]--;
- bl_counts[++incrBitLen]++;
- overflow -= 1 << (maxLength - 1 - incrBitLen);
- }
- while (overflow > 0 && incrBitLen < maxLength - 1);
- }
+ {
+ /* Find the first bit length which could increase: */
+ while (bl_counts[--incrBitLen] == 0)
+ ;
+
+ /* Move this node one down and remove a corresponding
+ * amount of overflow nodes.
+ */
+ do
+ {
+ bl_counts[incrBitLen]--;
+ bl_counts[++incrBitLen]++;
+ overflow -= 1 << (maxLength - 1 - incrBitLen);
+ }
+ while (overflow > 0 && incrBitLen < maxLength - 1);
+ }
while (overflow > 0);
/* We may have overshot above. Move some nodes from maxLength to
@@ -217,7 +217,7 @@ class DeflaterHuffman
*/
bl_counts[maxLength-1] += overflow;
bl_counts[maxLength-2] -= overflow;
-
+
/* Now recompute all bit lengths, scanning in increasing
* frequency. It is simpler to reconstruct all lengths instead of
* fixing only the wrong ones. This idea is taken from 'ar'
@@ -227,30 +227,30 @@ class DeflaterHuffman
* array.
*/
int nodePtr = 2 * numLeafs;
- for (int bits = maxLength; bits != 0; bits--)
- {
- int n = bl_counts[bits-1];
- while (n > 0)
- {
- int childPtr = 2*childs[nodePtr++];
- if (childs[childPtr + 1] == -1)
- {
- /* We found another leaf */
- length[childs[childPtr]] = (byte) bits;
- n--;
- }
- }
- }
+ for (int bits = maxLength; bits != 0; bits--)
+ {
+ int n = bl_counts[bits-1];
+ while (n > 0)
+ {
+ int childPtr = 2*childs[nodePtr++];
+ if (childs[childPtr + 1] == -1)
+ {
+ /* We found another leaf */
+ length[childs[childPtr]] = (byte) bits;
+ n--;
+ }
+ }
+ }
if (DeflaterConstants.DEBUGGING)
- {
- System.err.println("*** After overflow elimination. ***");
- for (int i=0; i < numLeafs; i++)
- System.err.println("Node "+childs[2*i]+" freq: "+freqs[childs[2*i]]
- + " len: "+length[childs[2*i]]);
- }
+ {
+ System.err.println("*** After overflow elimination. ***");
+ for (int i=0; i < numLeafs; i++)
+ System.err.println("Node "+childs[2*i]+" freq: "+freqs[childs[2*i]]
+ + " len: "+length[childs[2*i]]);
+ }
}
-
- void buildTree()
+
+ void buildTree()
{
int numSymbols = freqs.length;
@@ -266,123 +266,123 @@ class DeflaterHuffman
int heapLen = 0;
int maxCode = 0;
for (int n = 0; n < numSymbols; n++)
- {
- int freq = freqs[n];
- if (freq != 0)
- {
- /* Insert n into heap */
- int pos = heapLen++;
- int ppos;
- while (pos > 0 &&
- freqs[heap[ppos = (pos - 1) / 2]] > freq) {
- heap[pos] = heap[ppos];
- pos = ppos;
- }
- heap[pos] = n;
- maxCode = n;
- }
- }
-
+ {
+ int freq = freqs[n];
+ if (freq != 0)
+ {
+ /* Insert n into heap */
+ int pos = heapLen++;
+ int ppos;
+ while (pos > 0 &&
+ freqs[heap[ppos = (pos - 1) / 2]] > freq) {
+ heap[pos] = heap[ppos];
+ pos = ppos;
+ }
+ heap[pos] = n;
+ maxCode = n;
+ }
+ }
+
/* We could encode a single literal with 0 bits but then we
* don't see the literals. Therefore we force at least two
* literals to avoid this case. We don't care about order in
- * this case, both literals get a 1 bit code.
+ * this case, both literals get a 1 bit code.
*/
while (heapLen < 2)
- {
- int node = maxCode < 2 ? ++maxCode : 0;
- heap[heapLen++] = node;
- }
+ {
+ int node = maxCode < 2 ? ++maxCode : 0;
+ heap[heapLen++] = node;
+ }
numCodes = Math.max(maxCode + 1, minNumCodes);
-
+
int numLeafs = heapLen;
int[] childs = new int[4*heapLen - 2];
int[] values = new int[2*heapLen - 1];
int numNodes = numLeafs;
for (int i = 0; i < heapLen; i++)
- {
- int node = heap[i];
- childs[2*i] = node;
- childs[2*i+1] = -1;
- values[i] = freqs[node] << 8;
- heap[i] = i;
- }
-
+ {
+ int node = heap[i];
+ childs[2*i] = node;
+ childs[2*i+1] = -1;
+ values[i] = freqs[node] << 8;
+ heap[i] = i;
+ }
+
/* Construct the Huffman tree by repeatedly combining the least two
* frequent nodes.
*/
do
- {
- int first = heap[0];
- int last = heap[--heapLen];
-
- /* Propagate the hole to the leafs of the heap */
- int ppos = 0;
- int path = 1;
- while (path < heapLen)
- {
- if (path + 1 < heapLen
- && values[heap[path]] > values[heap[path+1]])
- path++;
-
- heap[ppos] = heap[path];
- ppos = path;
- path = path * 2 + 1;
- }
-
- /* Now propagate the last element down along path. Normally
- * it shouldn't go too deep.
- */
- int lastVal = values[last];
- while ((path = ppos) > 0
- && values[heap[ppos = (path - 1)/2]] > lastVal)
- heap[path] = heap[ppos];
- heap[path] = last;
-
-
- int second = heap[0];
-
- /* Create a new node father of first and second */
- last = numNodes++;
- childs[2*last] = first;
- childs[2*last+1] = second;
- int mindepth = Math.min(values[first] & 0xff, values[second] & 0xff);
- values[last] = lastVal = values[first] + values[second] - mindepth + 1;
-
- /* Again, propagate the hole to the leafs */
- ppos = 0;
- path = 1;
- while (path < heapLen)
- {
- if (path + 1 < heapLen
- && values[heap[path]] > values[heap[path+1]])
- path++;
-
- heap[ppos] = heap[path];
- ppos = path;
- path = ppos * 2 + 1;
- }
-
- /* Now propagate the new element down along path */
- while ((path = ppos) > 0
- && values[heap[ppos = (path - 1)/2]] > lastVal)
- heap[path] = heap[ppos];
- heap[path] = last;
- }
+ {
+ int first = heap[0];
+ int last = heap[--heapLen];
+
+ /* Propagate the hole to the leafs of the heap */
+ int ppos = 0;
+ int path = 1;
+ while (path < heapLen)
+ {
+ if (path + 1 < heapLen
+ && values[heap[path]] > values[heap[path+1]])
+ path++;
+
+ heap[ppos] = heap[path];
+ ppos = path;
+ path = path * 2 + 1;
+ }
+
+ /* Now propagate the last element down along path. Normally
+ * it shouldn't go too deep.
+ */
+ int lastVal = values[last];
+ while ((path = ppos) > 0
+ && values[heap[ppos = (path - 1)/2]] > lastVal)
+ heap[path] = heap[ppos];
+ heap[path] = last;
+
+
+ int second = heap[0];
+
+ /* Create a new node father of first and second */
+ last = numNodes++;
+ childs[2*last] = first;
+ childs[2*last+1] = second;
+ int mindepth = Math.min(values[first] & 0xff, values[second] & 0xff);
+ values[last] = lastVal = values[first] + values[second] - mindepth + 1;
+
+ /* Again, propagate the hole to the leafs */
+ ppos = 0;
+ path = 1;
+ while (path < heapLen)
+ {
+ if (path + 1 < heapLen
+ && values[heap[path]] > values[heap[path+1]])
+ path++;
+
+ heap[ppos] = heap[path];
+ ppos = path;
+ path = ppos * 2 + 1;
+ }
+
+ /* Now propagate the new element down along path */
+ while ((path = ppos) > 0
+ && values[heap[ppos = (path - 1)/2]] > lastVal)
+ heap[path] = heap[ppos];
+ heap[path] = last;
+ }
while (heapLen > 1);
-
+
if (heap[0] != childs.length / 2 - 1)
- throw new RuntimeException("Weird!");
-
+ throw new RuntimeException("Weird!");
+
buildLength(childs);
}
- int getEncodedLength()
+ int getEncodedLength()
{
int len = 0;
for (int i = 0; i < freqs.length; i++)
- len += freqs[i] * length[i];
+ len += freqs[i] * length[i];
return len;
}
@@ -391,46 +391,46 @@ class DeflaterHuffman
int min_count; /* min repeat count */
int count; /* repeat count of the current code */
int curlen = -1; /* length of current code */
-
+
int i = 0;
while (i < numCodes)
- {
- count = 1;
- int nextlen = length[i];
- if (nextlen == 0)
- {
- max_count = 138;
- min_count = 3;
- }
- else
- {
- max_count = 6;
- min_count = 3;
- if (curlen != nextlen)
- {
- blTree.freqs[nextlen]++;
- count = 0;
- }
- }
- curlen = nextlen;
- i++;
-
- while (i < numCodes && curlen == length[i])
- {
- i++;
- if (++count >= max_count)
- break;
- }
-
- if (count < min_count)
- blTree.freqs[curlen] += count;
- else if (curlen != 0)
- blTree.freqs[REP_3_6]++;
- else if (count <= 10)
- blTree.freqs[REP_3_10]++;
- else
- blTree.freqs[REP_11_138]++;
- }
+ {
+ count = 1;
+ int nextlen = length[i];
+ if (nextlen == 0)
+ {
+ max_count = 138;
+ min_count = 3;
+ }
+ else
+ {
+ max_count = 6;
+ min_count = 3;
+ if (curlen != nextlen)
+ {
+ blTree.freqs[nextlen]++;
+ count = 0;
+ }
+ }
+ curlen = nextlen;
+ i++;
+
+ while (i < numCodes && curlen == length[i])
+ {
+ i++;
+ if (++count >= max_count)
+ break;
+ }
+
+ if (count < min_count)
+ blTree.freqs[curlen] += count;
+ else if (curlen != 0)
+ blTree.freqs[REP_3_6]++;
+ else if (count <= 10)
+ blTree.freqs[REP_3_10]++;
+ else
+ blTree.freqs[REP_11_138]++;
+ }
}
void writeTree(Tree blTree)
@@ -439,58 +439,58 @@ class DeflaterHuffman
int min_count; /* min repeat count */
int count; /* repeat count of the current code */
int curlen = -1; /* length of current code */
-
+
int i = 0;
while (i < numCodes)
- {
- count = 1;
- int nextlen = length[i];
- if (nextlen == 0)
- {
- max_count = 138;
- min_count = 3;
- }
- else
- {
- max_count = 6;
- min_count = 3;
- if (curlen != nextlen)
- {
- blTree.writeSymbol(nextlen);
- count = 0;
- }
- }
- curlen = nextlen;
- i++;
-
- while (i < numCodes && curlen == length[i])
- {
- i++;
- if (++count >= max_count)
- break;
- }
-
- if (count < min_count)
- {
- while (count-- > 0)
- blTree.writeSymbol(curlen);
- }
- else if (curlen != 0)
- {
- blTree.writeSymbol(REP_3_6);
- pending.writeBits(count - 3, 2);
- }
- else if (count <= 10)
- {
- blTree.writeSymbol(REP_3_10);
- pending.writeBits(count - 3, 3);
- }
- else
- {
- blTree.writeSymbol(REP_11_138);
- pending.writeBits(count - 11, 7);
- }
- }
+ {
+ count = 1;
+ int nextlen = length[i];
+ if (nextlen == 0)
+ {
+ max_count = 138;
+ min_count = 3;
+ }
+ else
+ {
+ max_count = 6;
+ min_count = 3;
+ if (curlen != nextlen)
+ {
+ blTree.writeSymbol(nextlen);
+ count = 0;
+ }
+ }
+ curlen = nextlen;
+ i++;
+
+ while (i < numCodes && curlen == length[i])
+ {
+ i++;
+ if (++count >= max_count)
+ break;
+ }
+
+ if (count < min_count)
+ {
+ while (count-- > 0)
+ blTree.writeSymbol(curlen);
+ }
+ else if (curlen != 0)
+ {
+ blTree.writeSymbol(REP_3_6);
+ pending.writeBits(count - 3, 2);
+ }
+ else if (count <= 10)
+ {
+ blTree.writeSymbol(REP_3_10);
+ pending.writeBits(count - 3, 3);
+ }
+ else
+ {
+ blTree.writeSymbol(REP_11_138);
+ pending.writeBits(count - 11, 7);
+ }
+ }
}
}
@@ -514,9 +514,9 @@ class DeflaterHuffman
*/
static short bitReverse(int value) {
return (short) (bit4Reverse.charAt(value & 0xf) << 12
- | bit4Reverse.charAt((value >> 4) & 0xf) << 8
- | bit4Reverse.charAt((value >> 8) & 0xf) << 4
- | bit4Reverse.charAt(value >> 12));
+ | bit4Reverse.charAt((value >> 4) & 0xf) << 8
+ | bit4Reverse.charAt((value >> 8) & 0xf) << 4
+ | bit4Reverse.charAt(value >> 12));
}
static {
@@ -550,8 +550,8 @@ class DeflaterHuffman
staticDLength[i] = 5;
}
}
-
- public DeflaterHuffman(DeflaterPending pending)
+
+ public DeflaterHuffman(DeflaterPending pending)
{
this.pending = pending;
@@ -578,8 +578,8 @@ class DeflaterHuffman
int code = 257;
while (len >= 8)
{
- code += 4;
- len >>= 1;
+ code += 4;
+ len >>= 1;
}
return code + len;
}
@@ -588,8 +588,8 @@ class DeflaterHuffman
int code = 0;
while (distance >= 4)
{
- code += 2;
- distance >>= 1;
+ code += 2;
+ distance >>= 1;
}
return code + distance;
}
@@ -610,58 +610,58 @@ class DeflaterHuffman
}
public void compressBlock() {
- for (int i = 0; i < last_lit; i++)
+ for (int i = 0; i < last_lit; i++)
{
- int litlen = l_buf[i] & 0xff;
- int dist = d_buf[i];
- if (dist-- != 0)
- {
- if (DeflaterConstants.DEBUGGING)
- System.err.print("["+(dist+1)+","+(litlen+3)+"]: ");
-
- int lc = l_code(litlen);
- literalTree.writeSymbol(lc);
-
- int bits = (lc - 261) / 4;
- if (bits > 0 && bits <= 5)
- pending.writeBits(litlen & ((1 << bits) - 1), bits);
-
- int dc = d_code(dist);
- distTree.writeSymbol(dc);
-
- bits = dc / 2 - 1;
- if (bits > 0)
- pending.writeBits(dist & ((1 << bits) - 1), bits);
- }
- else
- {
- if (DeflaterConstants.DEBUGGING)
- {
- if (litlen > 32 && litlen < 127)
- System.err.print("("+(char)litlen+"): ");
- else
- System.err.print("{"+litlen+"}: ");
- }
- literalTree.writeSymbol(litlen);
- }
+ int litlen = l_buf[i] & 0xff;
+ int dist = d_buf[i];
+ if (dist-- != 0)
+ {
+ if (DeflaterConstants.DEBUGGING)
+ System.err.print("["+(dist+1)+","+(litlen+3)+"]: ");
+
+ int lc = l_code(litlen);
+ literalTree.writeSymbol(lc);
+
+ int bits = (lc - 261) / 4;
+ if (bits > 0 && bits <= 5)
+ pending.writeBits(litlen & ((1 << bits) - 1), bits);
+
+ int dc = d_code(dist);
+ distTree.writeSymbol(dc);
+
+ bits = dc / 2 - 1;
+ if (bits > 0)
+ pending.writeBits(dist & ((1 << bits) - 1), bits);
+ }
+ else
+ {
+ if (DeflaterConstants.DEBUGGING)
+ {
+ if (litlen > 32 && litlen < 127)
+ System.err.print("("+(char)litlen+"): ");
+ else
+ System.err.print("{"+litlen+"}: ");
+ }
+ literalTree.writeSymbol(litlen);
+ }
}
if (DeflaterConstants.DEBUGGING)
System.err.print("EOF: ");
literalTree.writeSymbol(EOF_SYMBOL);
if (DeflaterConstants.DEBUGGING)
{
- literalTree.checkEmpty();
- distTree.checkEmpty();
+ literalTree.checkEmpty();
+ distTree.checkEmpty();
}
}
- public void flushStoredBlock(byte[] stored,
- int stored_offset, int stored_len,
- boolean lastBlock) {
+ public void flushStoredBlock(byte[] stored,
+ int stored_offset, int stored_len,
+ boolean lastBlock) {
if (DeflaterConstants.DEBUGGING)
System.err.println("Flushing stored block "+ stored_len);
pending.writeBits((DeflaterConstants.STORED_BLOCK << 1)
- + (lastBlock ? 1 : 0), 3);
+ + (lastBlock ? 1 : 0), 3);
pending.alignToByte();
pending.writeShort(stored_len);
pending.writeShort(~stored_len);
@@ -670,7 +670,7 @@ class DeflaterHuffman
}
public void flushBlock(byte[] stored, int stored_offset, int stored_len,
- boolean lastBlock) {
+ boolean lastBlock) {
literalTree.freqs[EOF_SYMBOL]++;
/* Build trees */
@@ -687,8 +687,8 @@ class DeflaterHuffman
int blTreeCodes = 4;
for (int i = 18; i > blTreeCodes; i--)
{
- if (blTree.length[BL_ORDER[i]] > 0)
- blTreeCodes = i+1;
+ if (blTree.length[BL_ORDER[i]] > 0)
+ blTreeCodes = i+1;
}
int opt_len = 14 + blTreeCodes * 3 + blTree.getEncodedLength()
+ literalTree.getEncodedLength() + distTree.getEncodedLength()
@@ -701,36 +701,36 @@ class DeflaterHuffman
static_len += distTree.freqs[i] * staticDLength[i];
if (opt_len >= static_len)
{
- /* Force static trees */
- opt_len = static_len;
+ /* Force static trees */
+ opt_len = static_len;
}
if (stored_offset >= 0 && stored_len+4 < opt_len >> 3)
{
- /* Store Block */
- if (DeflaterConstants.DEBUGGING)
- System.err.println("Storing, since " + stored_len + " < " + opt_len
- + " <= " + static_len);
- flushStoredBlock(stored, stored_offset, stored_len, lastBlock);
+ /* Store Block */
+ if (DeflaterConstants.DEBUGGING)
+ System.err.println("Storing, since " + stored_len + " < " + opt_len
+ + " <= " + static_len);
+ flushStoredBlock(stored, stored_offset, stored_len, lastBlock);
}
else if (opt_len == static_len)
{
- /* Encode with static tree */
- pending.writeBits((DeflaterConstants.STATIC_TREES << 1)
- + (lastBlock ? 1 : 0), 3);
- literalTree.setStaticCodes(staticLCodes, staticLLength);
- distTree.setStaticCodes(staticDCodes, staticDLength);
- compressBlock();
- reset();
+ /* Encode with static tree */
+ pending.writeBits((DeflaterConstants.STATIC_TREES << 1)
+ + (lastBlock ? 1 : 0), 3);
+ literalTree.setStaticCodes(staticLCodes, staticLLength);
+ distTree.setStaticCodes(staticDCodes, staticDLength);
+ compressBlock();
+ reset();
}
else
{
- /* Encode with dynamic tree */
- pending.writeBits((DeflaterConstants.DYN_TREES << 1)
- + (lastBlock ? 1 : 0), 3);
- sendAllTrees(blTreeCodes);
- compressBlock();
- reset();
+ /* Encode with dynamic tree */
+ pending.writeBits((DeflaterConstants.DYN_TREES << 1)
+ + (lastBlock ? 1 : 0), 3);
+ sendAllTrees(blTreeCodes);
+ compressBlock();
+ reset();
}
}
@@ -739,14 +739,14 @@ class DeflaterHuffman
return last_lit == BUFSIZE;
}
- public final boolean tallyLit(int lit)
+ public final boolean tallyLit(int lit)
{
if (DeflaterConstants.DEBUGGING)
{
- if (lit > 32 && lit < 127)
- System.err.println("("+(char)lit+")");
- else
- System.err.println("{"+lit+"}");
+ if (lit > 32 && lit < 127)
+ System.err.println("("+(char)lit+")");
+ else
+ System.err.println("{"+lit+"}");
}
d_buf[last_lit] = 0;
l_buf[last_lit++] = (byte) lit;
@@ -754,7 +754,7 @@ class DeflaterHuffman
return last_lit == BUFSIZE;
}
- public final boolean tallyDist(int dist, int len)
+ public final boolean tallyDist(int dist, int len)
{
if (DeflaterConstants.DEBUGGING)
System.err.println("["+dist+","+len+"]");
diff --git a/java/util/zip/DeflaterOutputStream.java b/java/util/zip/DeflaterOutputStream.java
index 4321c0f2c..6fd1c5cfb 100644
--- a/java/util/zip/DeflaterOutputStream.java
+++ b/java/util/zip/DeflaterOutputStream.java
@@ -57,21 +57,21 @@ import java.io.OutputStream;
* finishing the stream.
*
* @author Tom Tromey, Jochen Hoenicke
- * @date Jan 11, 2001
+ * @date Jan 11, 2001
*/
public class DeflaterOutputStream extends FilterOutputStream
{
- /**
+ /**
* This buffer is used temporarily to retrieve the bytes from the
- * deflater and write them to the underlying output stream.
+ * deflater and write them to the underlying output stream.
*/
protected byte[] buf;
- /**
+ /**
* The deflater which is used to deflate the stream.
*/
protected Deflater def;
-
+
/**
* Deflates everything in the def's input buffers. This will call
* <code>def.deflate()</code> until all bytes from the input buffers
@@ -81,19 +81,19 @@ public class DeflaterOutputStream extends FilterOutputStream
{
while (! def.needsInput())
{
- int len = def.deflate(buf, 0, buf.length);
+ int len = def.deflate(buf, 0, buf.length);
- // System.err.println("DOS deflated " + len + " out of " + buf.length);
- if (len <= 0)
- break;
- out.write(buf, 0, len);
+ // System.err.println("DOS deflated " + len + " out of " + buf.length);
+ if (len <= 0)
+ break;
+ out.write(buf, 0, len);
}
if (! def.needsInput())
throw new InternalError("Can't deflate all input?");
}
- /**
+ /**
* Creates a new DeflaterOutputStream with a default Deflater and
* default buffer size.
* @param out the output stream where deflated output should be written.
@@ -103,7 +103,7 @@ public class DeflaterOutputStream extends FilterOutputStream
this(out, new Deflater(), 4096);
}
- /**
+ /**
* Creates a new DeflaterOutputStream with the given Deflater and
* default buffer size.
* @param out the output stream where deflated output should be written.
@@ -114,7 +114,7 @@ public class DeflaterOutputStream extends FilterOutputStream
this(out, defl, 4096);
}
- /**
+ /**
* Creates a new DeflaterOutputStream with the given Deflater and
* buffer size.
* @param out the output stream where deflated output should be written.
@@ -131,7 +131,7 @@ public class DeflaterOutputStream extends FilterOutputStream
def = defl;
}
- /**
+ /**
* Flushes the stream by calling flush() on the deflater and then
* on the underlying stream. This ensures that all bytes are
* flushed. This function doesn't work in Sun's JDK, but only in
@@ -147,17 +147,17 @@ public class DeflaterOutputStream extends FilterOutputStream
/**
* Finishes the stream by calling finish() on the deflater. This
* was the only way to ensure that all bytes are flushed in Sun's
- * JDK.
+ * JDK.
*/
public void finish() throws IOException
{
def.finish();
while (! def.finished())
{
- int len = def.deflate(buf, 0, buf.length);
- if (len <= 0)
- break;
- out.write(buf, 0, len);
+ int len = def.deflate(buf, 0, buf.length);
+ if (len <= 0)
+ break;
+ out.write(buf, 0, len);
}
if (! def.finished())
throw new InternalError("Can't deflate all input?");
@@ -165,7 +165,7 @@ public class DeflaterOutputStream extends FilterOutputStream
}
/**
- * Calls finish() and closes the stream.
+ * Calls finish() and closes the stream.
*/
public void close() throws IOException
{
diff --git a/java/util/zip/DeflaterPending.java b/java/util/zip/DeflaterPending.java
index f38212c35..fabc2264e 100644
--- a/java/util/zip/DeflaterPending.java
+++ b/java/util/zip/DeflaterPending.java
@@ -41,7 +41,7 @@ package java.util.zip;
* This class stores the pending output of the Deflater.
*
* @author Jochen Hoenicke
- * @date Jan 5, 2000
+ * @date Jan 5, 2000
*/
class DeflaterPending extends PendingBuffer
@@ -51,4 +51,3 @@ class DeflaterPending extends PendingBuffer
super(DeflaterConstants.PENDING_BUF_SIZE);
}
}
-
diff --git a/java/util/zip/GZIPInputStream.java b/java/util/zip/GZIPInputStream.java
index f244810e7..ed99ee92c 100644
--- a/java/util/zip/GZIPInputStream.java
+++ b/java/util/zip/GZIPInputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ import java.io.IOException;
import java.io.InputStream;
/**
- * This filter stream is used to decompress a "GZIP" format stream.
+ * This filter stream is used to decompress a "GZIP" format stream.
* The "GZIP" format is described in RFC 1952.
*
* @author John Leuner
@@ -86,11 +86,11 @@ public class GZIPInputStream
/**
* The CRC-32 checksum value for uncompressed data.
*/
- protected CRC32 crc;
+ protected CRC32 crc;
/**
* Indicates whether or not the end of the stream has been reached.
- */
+ */
protected boolean eos;
/**
@@ -101,7 +101,7 @@ public class GZIPInputStream
/**
* Creates a GZIPInputStream with the default buffer size.
*
- * @param in The stream to read compressed data from
+ * @param in The stream to read compressed data from
* (in GZIP format).
*
* @throws IOException if an error occurs during an I/O operation.
@@ -115,7 +115,7 @@ public class GZIPInputStream
/**
* Creates a GZIPInputStream with the specified buffer size.
*
- * @param in The stream to read compressed data from
+ * @param in The stream to read compressed data from
* (in GZIP format).
* @param size The size of the buffer to use.
*
@@ -204,7 +204,7 @@ public class GZIPInputStream
throw new IOException("Error in GZIP header, bad magic code");
headCRC.update(magic);
headCRC.update(magic2);
-
+
/* 2. Check the compression type (must be 8) */
int CM = in.read();
if (CM != Deflater.DEFLATED)
@@ -216,32 +216,32 @@ public class GZIPInputStream
if (flags < 0)
throw new EOFException("Early EOF in GZIP header");
headCRC.update(flags);
-
+
/* This flag byte is divided into individual bits as follows:
-
- bit 0 FTEXT
- bit 1 FHCRC
- bit 2 FEXTRA
- bit 3 FNAME
- bit 4 FCOMMENT
- bit 5 reserved
- bit 6 reserved
- bit 7 reserved
+
+ bit 0 FTEXT
+ bit 1 FHCRC
+ bit 2 FEXTRA
+ bit 3 FNAME
+ bit 4 FCOMMENT
+ bit 5 reserved
+ bit 6 reserved
+ bit 7 reserved
*/
-
- /* 3.1 Check the reserved bits are zero */
+
+ /* 3.1 Check the reserved bits are zero */
if ((flags & 0xd0) != 0)
throw new IOException("Reserved flag bits in GZIP header != 0");
-
+
/* 4.-6. Skip the modification time, extra flags, and OS type */
for (int i=0; i< 6; i++)
{
int readByte = in.read();
if (readByte < 0)
- throw new EOFException("Early EOF in GZIP header");
+ throw new EOFException("Early EOF in GZIP header");
headCRC.update(readByte);
}
-
+
/* 7. Read extra field */
if ((flags & FEXTRA) != 0)
{
@@ -249,39 +249,39 @@ public class GZIPInputStream
for (int i=0; i< 2; i++)
{
int readByte = in.read();
- if (readByte < 0)
- throw new EOFException("Early EOF in GZIP header");
- headCRC.update(readByte);
+ if (readByte < 0)
+ throw new EOFException("Early EOF in GZIP header");
+ headCRC.update(readByte);
}
if (in.read() < 0 || in.read() < 0)
- throw new EOFException("Early EOF in GZIP header");
-
+ throw new EOFException("Early EOF in GZIP header");
+
int len1, len2, extraLen;
len1 = in.read();
len2 = in.read();
if ((len1 < 0) || (len2 < 0))
- throw new EOFException("Early EOF in GZIP header");
+ throw new EOFException("Early EOF in GZIP header");
headCRC.update(len1);
headCRC.update(len2);
extraLen = (len1 << 8) | len2;
for (int i = 0; i < extraLen;i++)
{
- int readByte = in.read();
- if (readByte < 0)
- throw new EOFException("Early EOF in GZIP header");
- headCRC.update(readByte);
+ int readByte = in.read();
+ if (readByte < 0)
+ throw new EOFException("Early EOF in GZIP header");
+ headCRC.update(readByte);
}
}
-
+
/* 8. Read file name */
if ((flags & FNAME) != 0)
{
int readByte;
while ( (readByte = in.read()) > 0)
- headCRC.update(readByte);
+ headCRC.update(readByte);
if (readByte < 0)
- throw new EOFException("Early EOF in GZIP file name");
+ throw new EOFException("Early EOF in GZIP file name");
headCRC.update(readByte);
}
@@ -296,7 +296,7 @@ public class GZIPInputStream
throw new EOFException("Early EOF in GZIP comment");
headCRC.update(readByte);
}
-
+
/* 10. Read header CRC */
if ((flags & FHCRC) != 0)
{
@@ -304,16 +304,16 @@ public class GZIPInputStream
int crcval = in.read();
if (crcval < 0)
throw new EOFException("Early EOF in GZIP header");
-
+
tempByte = in.read();
if (tempByte < 0)
throw new EOFException("Early EOF in GZIP header");
-
+
crcval = (crcval << 8) | tempByte;
if (crcval != ((int) headCRC.getValue() & 0xffff))
throw new IOException("Header CRC value mismatch");
}
-
+
readGZIPHeader = true;
//System.err.println("Read GZIP header");
}
@@ -330,7 +330,7 @@ public class GZIPInputStream
{
int count = in.read(footer, 8-needed, needed);
if (count <= 0)
- throw new EOFException("Early EOF in GZIP footer");
+ throw new EOFException("Early EOF in GZIP footer");
needed -= count; //Jewel Jan 16
}
@@ -338,9 +338,9 @@ public class GZIPInputStream
| ((footer[2] & 0xff) << 16) | (footer[3] << 24);
if (crcval != (int) crc.getValue())
throw new IOException("GZIP crc sum mismatch, theirs \""
- + Integer.toHexString(crcval)
- + "\" and ours \""
- + Integer.toHexString( (int) crc.getValue()));
+ + Integer.toHexString(crcval)
+ + "\" and ours \""
+ + Integer.toHexString( (int) crc.getValue()));
int total = (footer[4] & 0xff) | ((footer[5] & 0xff) << 8)
| ((footer[6] & 0xff) << 16) | (footer[7] << 24);
diff --git a/java/util/zip/GZIPOutputStream.java b/java/util/zip/GZIPOutputStream.java
index 5b7b827a9..0080ab645 100644
--- a/java/util/zip/GZIPOutputStream.java
+++ b/java/util/zip/GZIPOutputStream.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -41,7 +41,7 @@ import java.io.IOException;
import java.io.OutputStream;
/**
- * This filter stream is used to compress a stream into a "GZIP" stream.
+ * This filter stream is used to compress a stream into a "GZIP" stream.
* The "GZIP" format is described in RFC 1952.
*
* @author John Leuner
@@ -64,8 +64,8 @@ public class GZIPOutputStream extends DeflaterOutputStream
/**
* Creates a GZIPOutputStream with the default buffer size
*
- * @param out The stream to read data (to be compressed) from
- *
+ * @param out The stream to read data (to be compressed) from
+ *
*/
public GZIPOutputStream(OutputStream out) throws IOException
{
@@ -75,8 +75,8 @@ public class GZIPOutputStream extends DeflaterOutputStream
/**
* Creates a GZIPOutputStream with the specified buffer size
*
- * @param out The stream to read compressed data from
- * @param size Size of the buffer to use
+ * @param out The stream to read compressed data from
+ * @param size Size of the buffer to use
*/
public GZIPOutputStream(OutputStream out, int size) throws IOException
{
@@ -85,25 +85,25 @@ public class GZIPOutputStream extends DeflaterOutputStream
int mod_time = (int) (System.currentTimeMillis() / 1000L);
byte[] gzipHeader =
{
- /* The two magic bytes */
- (byte) GZIPInputStream.GZIP_MAGIC,
- (byte) (GZIPInputStream.GZIP_MAGIC >> 8),
-
- /* The compression type */
- (byte) Deflater.DEFLATED,
-
+ /* The two magic bytes */
+ (byte) GZIPInputStream.GZIP_MAGIC,
+ (byte) (GZIPInputStream.GZIP_MAGIC >> 8),
+
+ /* The compression type */
+ (byte) Deflater.DEFLATED,
+
/* The flags (not set) */
- 0,
-
- /* The modification time */
- (byte) mod_time, (byte) (mod_time >> 8),
- (byte) (mod_time >> 16), (byte) (mod_time >> 24),
-
- /* The extra flags */
- 0,
-
- /* The OS type (unknown) */
- (byte) 255
+ 0,
+
+ /* The modification time */
+ (byte) mod_time, (byte) (mod_time >> 8),
+ (byte) (mod_time >> 16), (byte) (mod_time >> 24),
+
+ /* The extra flags */
+ 0,
+
+ /* The OS type (unknown) */
+ (byte) 255
};
out.write(gzipHeader);
@@ -134,18 +134,18 @@ public class GZIPOutputStream extends DeflaterOutputStream
int totalin = def.getTotalIn();
int crcval = (int) (crc.getValue() & 0xffffffff);
- // System.err.println("CRC val is " + Integer.toHexString( crcval ) + " and length " + Integer.toHexString(totalin));
-
- byte[] gzipFooter =
+ // System.err.println("CRC val is " + Integer.toHexString( crcval ) + " and length " + Integer.toHexString(totalin));
+
+ byte[] gzipFooter =
{
- (byte) crcval, (byte) (crcval >> 8),
- (byte) (crcval >> 16), (byte) (crcval >> 24),
+ (byte) crcval, (byte) (crcval >> 8),
+ (byte) (crcval >> 16), (byte) (crcval >> 24),
- (byte) totalin, (byte) (totalin >> 8),
- (byte) (totalin >> 16), (byte) (totalin >> 24)
+ (byte) totalin, (byte) (totalin >> 8),
+ (byte) (totalin >> 16), (byte) (totalin >> 24)
};
out.write(gzipFooter);
- // System.err.println("wrote GZIP trailer (" + gzipFooter.length + " bytes )");
+ // System.err.println("wrote GZIP trailer (" + gzipFooter.length + " bytes )");
}
}
diff --git a/java/util/zip/Inflater.java b/java/util/zip/Inflater.java
index f529dc691..0f094d667 100644
--- a/java/util/zip/Inflater.java
+++ b/java/util/zip/Inflater.java
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -43,7 +43,7 @@ package java.util.zip;
*/
/**
- * Inflater is used to decompress data that has been compressed according
+ * Inflater is used to decompress data that has been compressed according
* to the "deflate" standard described in rfc1950.
*
* The usage is as following. First you have to set some input with
@@ -51,10 +51,10 @@ package java.util.zip;
* inflate any bytes there may be three reasons:
* <ul>
* <li>needsInput() returns true because the input buffer is empty.
- * You have to provide more input with <code>setInput()</code>.
+ * You have to provide more input with <code>setInput()</code>.
* NOTE: needsInput() also returns true when, the stream is finished.
* </li>
- * <li>needsDictionary() returns true, you have to provide a preset
+ * <li>needsDictionary() returns true, you have to provide a preset
* dictionary with <code>setDictionary()</code>.</li>
* <li>finished() returns true, the inflater has finished.</li>
* </ul>
@@ -69,15 +69,15 @@ package java.util.zip;
public class Inflater
{
/* Copy lengths for literal codes 257..285 */
- private static final int CPLENS[] =
- {
+ private static final int CPLENS[] =
+ {
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258
};
-
- /* Extra bits for literal codes 257..285 */
- private static final int CPLEXT[] =
- {
+
+ /* Extra bits for literal codes 257..285 */
+ private static final int CPLEXT[] =
+ {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0
};
@@ -88,11 +88,11 @@ public class Inflater
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577
};
-
+
/* Extra bits for distance codes */
private static final int CPDEXT[] = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
+ 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
12, 12, 13, 13
};
@@ -122,10 +122,10 @@ public class Inflater
* Only valid if mode is DECODE_DICT or DECODE_CHKSUM.
*/
private int readAdler;
- /**
+ /**
* The number of bits needed to complete the current state. This
* is valid, if mode is DECODE_DICT, DECODE_CHKSUM,
- * DECODE_HUFFMAN_LENBITS or DECODE_HUFFMAN_DISTBITS.
+ * DECODE_HUFFMAN_LENBITS or DECODE_HUFFMAN_DISTBITS.
*/
private int neededBits;
private int repLength, repDist;
@@ -133,7 +133,7 @@ public class Inflater
/**
* True, if the last block flag was set in the last block of the
* inflated stream. This means that the stream ends after the
- * current block.
+ * current block.
*/
private boolean isLastBlock;
@@ -143,7 +143,7 @@ public class Inflater
private long totalOut;
/**
* The total number of bytes set with setInput(). This is not the
- * value returned by getTotalIn(), since this also includes the
+ * value returned by getTotalIn(), since this also includes the
* unprocessed input.
*/
private long totalIn;
@@ -198,7 +198,7 @@ public class Inflater
* for the Sun implementation). Exists only for compatibility
* with Sun's JDK, where the compressor allocates native memory.
* If you call any method (even reset) afterwards the behaviour is
- * <i>undefined</i>.
+ * <i>undefined</i>.
*/
public void end ()
{
@@ -214,7 +214,7 @@ public class Inflater
* Returns true, if the inflater has finished. This means, that no
* input is needed and no output can be produced.
*/
- public boolean finished()
+ public boolean finished()
{
return mode == FINISHED && outputWindow.getAvailable() == 0;
}
@@ -230,18 +230,18 @@ public class Inflater
{
return needsDictionary() ? readAdler : (int) adler.getValue();
}
-
+
/**
* Gets the number of unprocessed input. Useful, if the end of the
* stream is reached and you want to further process the bytes after
- * the deflate stream.
+ * the deflate stream.
* @return the number of bytes of the input which were not processed.
*/
public int getRemaining()
{
return input.getAvailableBytes();
}
-
+
/**
* Gets the total number of processed compressed input bytes.
* @return the total number of bytes of processed input bytes.
@@ -283,11 +283,11 @@ public class Inflater
/**
* Inflates the compressed stream to the output buffer. If this
* returns 0, you should check, whether needsDictionary(),
- * needsInput() or finished() returns true, to determine why no
+ * needsInput() or finished() returns true, to determine why no
* further output is produced.
* @param buf the output buffer.
* @return the number of bytes written to the buffer, 0 if no further
- * output can be produced.
+ * output can be produced.
* @exception DataFormatException if deflated stream is invalid.
* @exception IllegalArgumentException if buf has length 0.
*/
@@ -299,13 +299,13 @@ public class Inflater
/**
* Inflates the compressed stream to the output buffer. If this
* returns 0, you should check, whether needsDictionary(),
- * needsInput() or finished() returns true, to determine why no
+ * needsInput() or finished() returns true, to determine why no
* further output is produced.
* @param buf the output buffer.
* @param off the offset into buffer where the output should start.
* @param len the maximum length of the output.
* @return the number of bytes written to the buffer, 0 if no further
- * output can be produced.
+ * output can be produced.
* @exception DataFormatException if deflated stream is invalid.
* @exception IndexOutOfBoundsException if the off and/or len are wrong.
*/
@@ -351,7 +351,7 @@ public class Inflater
*
* <em>NOTE</em>: This method also returns true when the stream is finished.
*/
- public boolean needsInput ()
+ public boolean needsInput ()
{
return input.needsInput ();
}
@@ -381,7 +381,7 @@ public class Inflater
* @param buffer the dictionary.
* @exception IllegalStateException if no dictionary is needed.
* @exception IllegalArgumentException if the dictionary checksum is
- * wrong.
+ * wrong.
*/
public void setDictionary (byte[] buffer)
{
@@ -398,7 +398,7 @@ public class Inflater
* @param len the length of the dictionary.
* @exception IllegalStateException if no dictionary is needed.
* @exception IllegalArgumentException if the dictionary checksum is
- * wrong.
+ * wrong.
* @exception IndexOutOfBoundsException if the off and/or len are wrong.
*/
public void setDictionary (byte[] buffer, int off, int len)
@@ -420,7 +420,7 @@ public class Inflater
* @param buf the input.
* @exception IllegalStateException if no input is needed.
*/
- public void setInput (byte[] buf)
+ public void setInput (byte[] buf)
{
setInput (buf, 0, buf.length);
}
@@ -430,11 +430,11 @@ public class Inflater
* returns true.
* @param buf the input.
* @param off the offset into buffer where the input starts.
- * @param len the length of the input.
+ * @param len the length of the input.
* @exception IllegalStateException if no input is needed.
* @exception IndexOutOfBoundsException if the off and/or len are wrong.
*/
- public void setInput (byte[] buf, int off, int len)
+ public void setInput (byte[] buf, int off, int len)
{
input.setInput (buf, off, len);
totalIn += len;
@@ -442,7 +442,7 @@ public class Inflater
/**
* Decodes the deflate header.
- * @return false if more input is needed.
+ * @return false if more input is needed.
* @exception DataFormatException if header is invalid.
*/
private boolean decodeHeader () throws DataFormatException
@@ -451,48 +451,48 @@ public class Inflater
if (header < 0)
return false;
input.dropBits(16);
-
+
/* The header is written in "wrong" byte order */
header = ((header << 8) | (header >> 8)) & 0xffff;
if (header % 31 != 0)
throw new DataFormatException("Header checksum illegal");
-
+
if ((header & 0x0f00) != (Deflater.DEFLATED << 8))
throw new DataFormatException("Compression Method unknown");
- /* Maximum size of the backwards window in bits.
+ /* Maximum size of the backwards window in bits.
* We currently ignore this, but we could use it to make the
* inflater window more space efficient. On the other hand the
* full window (15 bits) is needed most times, anyway.
int max_wbits = ((header & 0x7000) >> 12) + 8;
*/
-
+
if ((header & 0x0020) == 0) // Dictionary flag?
{
- mode = DECODE_BLOCKS;
+ mode = DECODE_BLOCKS;
}
else
{
- mode = DECODE_DICT;
- neededBits = 32;
+ mode = DECODE_DICT;
+ neededBits = 32;
}
return true;
}
-
+
/**
* Decodes the dictionary checksum after the deflate header.
- * @return false if more input is needed.
+ * @return false if more input is needed.
*/
private boolean decodeDict ()
{
while (neededBits > 0)
{
- int dictByte = input.peekBits(8);
- if (dictByte < 0)
- return false;
- input.dropBits(8);
- readAdler = (readAdler << 8) | dictByte;
- neededBits -= 8;
+ int dictByte = input.peekBits(8);
+ if (dictByte < 0)
+ return false;
+ input.dropBits(8);
+ readAdler = (readAdler << 8) | dictByte;
+ neededBits -= 8;
}
return false;
}
@@ -501,226 +501,226 @@ public class Inflater
* Decodes the huffman encoded symbols in the input stream.
* @return false if more input is needed, true if output window is
* full or the current block ends.
- * @exception DataFormatException if deflated stream is invalid.
+ * @exception DataFormatException if deflated stream is invalid.
*/
private boolean decodeHuffman () throws DataFormatException
{
int free = outputWindow.getFreeSpace();
while (free >= 258)
{
- int symbol;
- switch (mode)
- {
- case DECODE_HUFFMAN:
- /* This is the inner loop so it is optimized a bit */
- while (((symbol = litlenTree.getSymbol(input)) & ~0xff) == 0)
- {
- outputWindow.write(symbol);
- if (--free < 258)
- return true;
- }
- if (symbol < 257)
- {
- if (symbol < 0)
- return false;
- else
- {
- /* symbol == 256: end of block */
- distTree = null;
- litlenTree = null;
- mode = DECODE_BLOCKS;
- return true;
- }
- }
-
- try
- {
- repLength = CPLENS[symbol - 257];
- neededBits = CPLEXT[symbol - 257];
- }
- catch (ArrayIndexOutOfBoundsException ex)
- {
- throw new DataFormatException("Illegal rep length code");
- }
- /* fall through */
- case DECODE_HUFFMAN_LENBITS:
- if (neededBits > 0)
- {
- mode = DECODE_HUFFMAN_LENBITS;
- int i = input.peekBits(neededBits);
- if (i < 0)
- return false;
- input.dropBits(neededBits);
- repLength += i;
- }
- mode = DECODE_HUFFMAN_DIST;
- /* fall through */
- case DECODE_HUFFMAN_DIST:
- symbol = distTree.getSymbol(input);
- if (symbol < 0)
- return false;
- try
- {
- repDist = CPDIST[symbol];
- neededBits = CPDEXT[symbol];
- }
- catch (ArrayIndexOutOfBoundsException ex)
- {
- throw new DataFormatException("Illegal rep dist code");
- }
- /* fall through */
- case DECODE_HUFFMAN_DISTBITS:
- if (neededBits > 0)
- {
- mode = DECODE_HUFFMAN_DISTBITS;
- int i = input.peekBits(neededBits);
- if (i < 0)
- return false;
- input.dropBits(neededBits);
- repDist += i;
- }
- outputWindow.repeat(repLength, repDist);
- free -= repLength;
- mode = DECODE_HUFFMAN;
- break;
- default:
- throw new IllegalStateException();
- }
+ int symbol;
+ switch (mode)
+ {
+ case DECODE_HUFFMAN:
+ /* This is the inner loop so it is optimized a bit */
+ while (((symbol = litlenTree.getSymbol(input)) & ~0xff) == 0)
+ {
+ outputWindow.write(symbol);
+ if (--free < 258)
+ return true;
+ }
+ if (symbol < 257)
+ {
+ if (symbol < 0)
+ return false;
+ else
+ {
+ /* symbol == 256: end of block */
+ distTree = null;
+ litlenTree = null;
+ mode = DECODE_BLOCKS;
+ return true;
+ }
+ }
+
+ try
+ {
+ repLength = CPLENS[symbol - 257];
+ neededBits = CPLEXT[symbol - 257];
+ }
+ catch (ArrayIndexOutOfBoundsException ex)
+ {
+ throw new DataFormatException("Illegal rep length code");
+ }
+ /* fall through */
+ case DECODE_HUFFMAN_LENBITS:
+ if (neededBits > 0)
+ {
+ mode = DECODE_HUFFMAN_LENBITS;
+ int i = input.peekBits(neededBits);
+ if (i < 0)
+ return false;
+ input.dropBits(neededBits);
+ repLength += i;
+ }
+ mode = DECODE_HUFFMAN_DIST;
+ /* fall through */
+ case DECODE_HUFFMAN_DIST:
+ symbol = distTree.getSymbol(input);
+ if (symbol < 0)
+ return false;
+ try
+ {
+ repDist = CPDIST[symbol];
+ neededBits = CPDEXT[symbol];
+ }
+ catch (ArrayIndexOutOfBoundsException ex)
+ {
+ throw new DataFormatException("Illegal rep dist code");
+ }
+ /* fall through */
+ case DECODE_HUFFMAN_DISTBITS:
+ if (neededBits > 0)
+ {
+ mode = DECODE_HUFFMAN_DISTBITS;
+ int i = input.peekBits(neededBits);
+ if (i < 0)
+ return false;
+ input.dropBits(neededBits);
+ repDist += i;
+ }
+ outputWindow.repeat(repLength, repDist);
+ free -= repLength;
+ mode = DECODE_HUFFMAN;
+ break;
+ default:
+ throw new IllegalStateException();
+ }
}
return true;
}
/**
* Decodes the adler checksum after the deflate stream.
- * @return false if more input is needed.
+ * @return false if more input is needed.
* @exception DataFormatException if checksum doesn't match.
*/
private boolean decodeChksum () throws DataFormatException
{
while (neededBits > 0)
{
- int chkByte = input.peekBits(8);
- if (chkByte < 0)
- return false;
- input.dropBits(8);
- readAdler = (readAdler << 8) | chkByte;
- neededBits -= 8;
+ int chkByte = input.peekBits(8);
+ if (chkByte < 0)
+ return false;
+ input.dropBits(8);
+ readAdler = (readAdler << 8) | chkByte;
+ neededBits -= 8;
}
if ((int) adler.getValue() != readAdler)
throw new DataFormatException("Adler chksum doesn't match: "
- +Integer.toHexString((int)adler.getValue())
- +" vs. "+Integer.toHexString(readAdler));
+ +Integer.toHexString((int)adler.getValue())
+ +" vs. "+Integer.toHexString(readAdler));
mode = FINISHED;
return false;
}
/**
* Decodes the deflated stream.
- * @return false if more input is needed, or if finished.
+ * @return false if more input is needed, or if finished.
* @exception DataFormatException if deflated stream is invalid.
*/
private boolean decode () throws DataFormatException
{
- switch (mode)
+ switch (mode)
{
case DECODE_HEADER:
- return decodeHeader();
+ return decodeHeader();
case DECODE_DICT:
- return decodeDict();
+ return decodeDict();
case DECODE_CHKSUM:
- return decodeChksum();
+ return decodeChksum();
case DECODE_BLOCKS:
- if (isLastBlock)
- {
- if (nowrap)
- {
- mode = FINISHED;
- return false;
- }
- else
- {
- input.skipToByteBoundary();
- neededBits = 32;
- mode = DECODE_CHKSUM;
- return true;
- }
- }
-
- int type = input.peekBits(3);
- if (type < 0)
- return false;
- input.dropBits(3);
-
- if ((type & 1) != 0)
- isLastBlock = true;
- switch (type >> 1)
- {
- case DeflaterConstants.STORED_BLOCK:
- input.skipToByteBoundary();
- mode = DECODE_STORED_LEN1;
- break;
- case DeflaterConstants.STATIC_TREES:
- litlenTree = InflaterHuffmanTree.defLitLenTree;
- distTree = InflaterHuffmanTree.defDistTree;
- mode = DECODE_HUFFMAN;
- break;
- case DeflaterConstants.DYN_TREES:
- dynHeader = new InflaterDynHeader();
- mode = DECODE_DYN_HEADER;
- break;
- default:
- throw new DataFormatException("Unknown block type "+type);
- }
- return true;
+ if (isLastBlock)
+ {
+ if (nowrap)
+ {
+ mode = FINISHED;
+ return false;
+ }
+ else
+ {
+ input.skipToByteBoundary();
+ neededBits = 32;
+ mode = DECODE_CHKSUM;
+ return true;
+ }
+ }
+
+ int type = input.peekBits(3);
+ if (type < 0)
+ return false;
+ input.dropBits(3);
+
+ if ((type & 1) != 0)
+ isLastBlock = true;
+ switch (type >> 1)
+ {
+ case DeflaterConstants.STORED_BLOCK:
+ input.skipToByteBoundary();
+ mode = DECODE_STORED_LEN1;
+ break;
+ case DeflaterConstants.STATIC_TREES:
+ litlenTree = InflaterHuffmanTree.defLitLenTree;
+ distTree = InflaterHuffmanTree.defDistTree;
+ mode = DECODE_HUFFMAN;
+ break;
+ case DeflaterConstants.DYN_TREES:
+ dynHeader = new InflaterDynHeader();
+ mode = DECODE_DYN_HEADER;
+ break;
+ default:
+ throw new DataFormatException("Unknown block type "+type);
+ }
+ return true;
case DECODE_STORED_LEN1:
- {
- if ((uncomprLen = input.peekBits(16)) < 0)
- return false;
- input.dropBits(16);
- mode = DECODE_STORED_LEN2;
- }
- /* fall through */
+ {
+ if ((uncomprLen = input.peekBits(16)) < 0)
+ return false;
+ input.dropBits(16);
+ mode = DECODE_STORED_LEN2;
+ }
+ /* fall through */
case DECODE_STORED_LEN2:
- {
- int nlen = input.peekBits(16);
- if (nlen < 0)
- return false;
- input.dropBits(16);
- if (nlen != (uncomprLen ^ 0xffff))
- throw new DataFormatException("broken uncompressed block");
- mode = DECODE_STORED;
- }
- /* fall through */
+ {
+ int nlen = input.peekBits(16);
+ if (nlen < 0)
+ return false;
+ input.dropBits(16);
+ if (nlen != (uncomprLen ^ 0xffff))
+ throw new DataFormatException("broken uncompressed block");
+ mode = DECODE_STORED;
+ }
+ /* fall through */
case DECODE_STORED:
- {
- int more = outputWindow.copyStored(input, uncomprLen);
- uncomprLen -= more;
- if (uncomprLen == 0)
- {
- mode = DECODE_BLOCKS;
- return true;
- }
- return !input.needsInput();
- }
+ {
+ int more = outputWindow.copyStored(input, uncomprLen);
+ uncomprLen -= more;
+ if (uncomprLen == 0)
+ {
+ mode = DECODE_BLOCKS;
+ return true;
+ }
+ return !input.needsInput();
+ }
case DECODE_DYN_HEADER:
- if (!dynHeader.decode(input))
- return false;
- litlenTree = dynHeader.buildLitLenTree();
- distTree = dynHeader.buildDistTree();
- mode = DECODE_HUFFMAN;
- /* fall through */
+ if (!dynHeader.decode(input))
+ return false;
+ litlenTree = dynHeader.buildLitLenTree();
+ distTree = dynHeader.buildDistTree();
+ mode = DECODE_HUFFMAN;
+ /* fall through */
case DECODE_HUFFMAN:
case DECODE_HUFFMAN_LENBITS:
case DECODE_HUFFMAN_DIST:
case DECODE_HUFFMAN_DISTBITS:
- return decodeHuffman();
+ return decodeHuffman();
case FINISHED:
- return false;
+ return false;
default:
- throw new IllegalStateException();
- }
+ throw new IllegalStateException();
+ }
}
}
diff --git a/java/util/zip/InflaterDynHeader.java b/java/util/zip/InflaterDynHeader.java
index bff84a894..64e08d6bb 100644
--- a/java/util/zip/InflaterDynHeader.java
+++ b/java/util/zip/InflaterDynHeader.java
@@ -49,12 +49,12 @@ class InflaterDynHeader
private static final int repMin[] = { 3, 3, 11 };
private static final int repBits[] = { 2, 3, 7 };
-
+
private byte[] blLens;
private byte[] litdistLens;
private InflaterHuffmanTree blTree;
-
+
private int mode;
private int lnum, dnum, blnum, num;
private int repSymbol;
@@ -63,127 +63,127 @@ class InflaterDynHeader
private static final int[] BL_ORDER =
{ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
-
+
public InflaterDynHeader()
{
}
-
+
public boolean decode(StreamManipulator input) throws DataFormatException
{
decode_loop:
for (;;)
{
- switch (mode)
- {
- case LNUM:
- lnum = input.peekBits(5);
- if (lnum < 0)
- return false;
- lnum += 257;
- input.dropBits(5);
-// System.err.println("LNUM: "+lnum);
- mode = DNUM;
- /* fall through */
- case DNUM:
- dnum = input.peekBits(5);
- if (dnum < 0)
- return false;
- dnum++;
- input.dropBits(5);
-// System.err.println("DNUM: "+dnum);
- num = lnum+dnum;
- litdistLens = new byte[num];
- mode = BLNUM;
- /* fall through */
- case BLNUM:
- blnum = input.peekBits(4);
- if (blnum < 0)
- return false;
- blnum += 4;
- input.dropBits(4);
- blLens = new byte[19];
- ptr = 0;
-// System.err.println("BLNUM: "+blnum);
- mode = BLLENS;
- /* fall through */
- case BLLENS:
- while (ptr < blnum)
- {
- int len = input.peekBits(3);
- if (len < 0)
- return false;
- input.dropBits(3);
-// System.err.println("blLens["+BL_ORDER[ptr]+"]: "+len);
- blLens[BL_ORDER[ptr]] = (byte) len;
- ptr++;
- }
- blTree = new InflaterHuffmanTree(blLens);
- blLens = null;
- ptr = 0;
- mode = LENS;
- /* fall through */
- case LENS:
- {
- int symbol;
- while (((symbol = blTree.getSymbol(input)) & ~15) == 0)
- {
- /* Normal case: symbol in [0..15] */
-
-// System.err.println("litdistLens["+ptr+"]: "+symbol);
- litdistLens[ptr++] = lastLen = (byte) symbol;
-
- if (ptr == num)
- {
- /* Finished */
- return true;
- }
- }
-
- /* need more input ? */
- if (symbol < 0)
- return false;
-
- /* otherwise repeat code */
- if (symbol >= 17)
- {
- /* repeat zero */
-// System.err.println("repeating zero");
- lastLen = 0;
- }
- else
- {
- if (ptr == 0)
- throw new DataFormatException();
- }
- repSymbol = symbol-16;
- mode = REPS;
- }
- /* fall through */
-
- case REPS:
- {
- int bits = repBits[repSymbol];
- int count = input.peekBits(bits);
- if (count < 0)
- return false;
- input.dropBits(bits);
- count += repMin[repSymbol];
-// System.err.println("litdistLens repeated: "+count);
-
- if (ptr + count > num)
- throw new DataFormatException();
- while (count-- > 0)
- litdistLens[ptr++] = lastLen;
-
- if (ptr == num)
- {
- /* Finished */
- return true;
- }
- }
- mode = LENS;
- continue decode_loop;
- }
+ switch (mode)
+ {
+ case LNUM:
+ lnum = input.peekBits(5);
+ if (lnum < 0)
+ return false;
+ lnum += 257;
+ input.dropBits(5);
+// System.err.println("LNUM: "+lnum);
+ mode = DNUM;
+ /* fall through */
+ case DNUM:
+ dnum = input.peekBits(5);
+ if (dnum < 0)
+ return false;
+ dnum++;
+ input.dropBits(5);
+// System.err.println("DNUM: "+dnum);
+ num = lnum+dnum;
+ litdistLens = new byte[num];
+ mode = BLNUM;
+ /* fall through */
+ case BLNUM:
+ blnum = input.peekBits(4);
+ if (blnum < 0)
+ return false;
+ blnum += 4;
+ input.dropBits(4);
+ blLens = new byte[19];
+ ptr = 0;
+// System.err.println("BLNUM: "+blnum);
+ mode = BLLENS;
+ /* fall through */
+ case BLLENS:
+ while (ptr < blnum)
+ {
+ int len = input.peekBits(3);
+ if (len < 0)
+ return false;
+ input.dropBits(3);
+// System.err.println("blLens["+BL_ORDER[ptr]+"]: "+len);
+ blLens[BL_ORDER[ptr]] = (byte) len;
+ ptr++;
+ }
+ blTree = new InflaterHuffmanTree(blLens);
+ blLens = null;
+ ptr = 0;
+ mode = LENS;
+ /* fall through */
+ case LENS:
+ {
+ int symbol;
+ while (((symbol = blTree.getSymbol(input)) & ~15) == 0)
+ {
+ /* Normal case: symbol in [0..15] */
+
+// System.err.println("litdistLens["+ptr+"]: "+symbol);
+ litdistLens[ptr++] = lastLen = (byte) symbol;
+
+ if (ptr == num)
+ {
+ /* Finished */
+ return true;
+ }
+ }
+
+ /* need more input ? */
+ if (symbol < 0)
+ return false;
+
+ /* otherwise repeat code */
+ if (symbol >= 17)
+ {
+ /* repeat zero */
+// System.err.println("repeating zero");
+ lastLen = 0;
+ }
+ else
+ {
+ if (ptr == 0)
+ throw new DataFormatException();
+ }
+ repSymbol = symbol-16;
+ mode = REPS;
+ }
+ /* fall through */
+
+ case REPS:
+ {
+ int bits = repBits[repSymbol];
+ int count = input.peekBits(bits);
+ if (count < 0)
+ return false;
+ input.dropBits(bits);
+ count += repMin[repSymbol];
+// System.err.println("litdistLens repeated: "+count);
+
+ if (ptr + count > num)
+ throw new DataFormatException();
+ while (count-- > 0)
+ litdistLens[ptr++] = lastLen;
+
+ if (ptr == num)
+ {
+ /* Finished */
+ return true;
+ }
+ }
+ mode = LENS;
+ continue decode_loop;
+ }
}
}
diff --git a/java/util/zip/InflaterHuffmanTree.java b/java/util/zip/InflaterHuffmanTree.java
index 6c9b2175d..c12c732e0 100644
--- a/java/util/zip/InflaterHuffmanTree.java
+++ b/java/util/zip/InflaterHuffmanTree.java
@@ -40,37 +40,37 @@ package java.util.zip;
class InflaterHuffmanTree
{
private static final int MAX_BITLEN = 15;
-
+
private short[] tree;
static InflaterHuffmanTree defLitLenTree, defDistTree;
static
{
- try
+ try
{
- byte[] codeLengths = new byte[288];
- int i = 0;
- while (i < 144)
- codeLengths[i++] = 8;
- while (i < 256)
- codeLengths[i++] = 9;
- while (i < 280)
- codeLengths[i++] = 7;
- while (i < 288)
- codeLengths[i++] = 8;
- defLitLenTree = new InflaterHuffmanTree(codeLengths);
-
- codeLengths = new byte[32];
- i = 0;
- while (i < 32)
- codeLengths[i++] = 5;
- defDistTree = new InflaterHuffmanTree(codeLengths);
- }
+ byte[] codeLengths = new byte[288];
+ int i = 0;
+ while (i < 144)
+ codeLengths[i++] = 8;
+ while (i < 256)
+ codeLengths[i++] = 9;
+ while (i < 280)
+ codeLengths[i++] = 7;
+ while (i < 288)
+ codeLengths[i++] = 8;
+ defLitLenTree = new InflaterHuffmanTree(codeLengths);
+
+ codeLengths = new byte[32];
+ i = 0;
+ while (i < 32)
+ codeLengths[i++] = 5;
+ defDistTree = new InflaterHuffmanTree(codeLengths);
+ }
catch (DataFormatException ex)
{
- throw new InternalError
- ("InflaterHuffmanTree: static tree length illegal");
+ throw new InternalError
+ ("InflaterHuffmanTree: static tree length illegal");
}
}
@@ -83,31 +83,31 @@ class InflaterHuffmanTree
{
buildTree(codeLengths);
}
-
+
private void buildTree(byte[] codeLengths) throws DataFormatException
{
int[] blCount = new int[MAX_BITLEN+1];
int[] nextCode = new int[MAX_BITLEN+1];
for (int i = 0; i < codeLengths.length; i++)
{
- int bits = codeLengths[i];
- if (bits > 0)
- blCount[bits]++;
+ int bits = codeLengths[i];
+ if (bits > 0)
+ blCount[bits]++;
}
int code = 0;
int treeSize = 512;
for (int bits = 1; bits <= MAX_BITLEN; bits++)
{
- nextCode[bits] = code;
- code += blCount[bits] << (16 - bits);
- if (bits >= 10)
- {
- /* We need an extra table for bit lengths >= 10. */
- int start = nextCode[bits] & 0x1ff80;
- int end = code & 0x1ff80;
- treeSize += (end - start) >> (16 - bits);
- }
+ nextCode[bits] = code;
+ code += blCount[bits] << (16 - bits);
+ if (bits >= 10)
+ {
+ /* We need an extra table for bit lengths >= 10. */
+ int start = nextCode[bits] & 0x1ff80;
+ int end = code & 0x1ff80;
+ treeSize += (end - start) >> (16 - bits);
+ }
}
if (code != 65536)
throw new DataFormatException("Code lengths don't add up properly.");
@@ -119,46 +119,46 @@ class InflaterHuffmanTree
int treePtr = 512;
for (int bits = MAX_BITLEN; bits >= 10; bits--)
{
- int end = code & 0x1ff80;
- code -= blCount[bits] << (16 - bits);
- int start = code & 0x1ff80;
- for (int i = start; i < end; i += 1 << 7)
- {
- tree[DeflaterHuffman.bitReverse(i)]
- = (short) ((-treePtr << 4) | bits);
- treePtr += 1 << (bits-9);
- }
+ int end = code & 0x1ff80;
+ code -= blCount[bits] << (16 - bits);
+ int start = code & 0x1ff80;
+ for (int i = start; i < end; i += 1 << 7)
+ {
+ tree[DeflaterHuffman.bitReverse(i)]
+ = (short) ((-treePtr << 4) | bits);
+ treePtr += 1 << (bits-9);
+ }
}
-
+
for (int i = 0; i < codeLengths.length; i++)
{
- int bits = codeLengths[i];
- if (bits == 0)
- continue;
- code = nextCode[bits];
- int revcode = DeflaterHuffman.bitReverse(code);
- if (bits <= 9)
- {
- do
- {
- tree[revcode] = (short) ((i << 4) | bits);
- revcode += 1 << bits;
- }
- while (revcode < 512);
- }
- else
- {
- int subTree = tree[revcode & 511];
- int treeLen = 1 << (subTree & 15);
- subTree = -(subTree >> 4);
- do
- {
- tree[subTree | (revcode >> 9)] = (short) ((i << 4) | bits);
- revcode += 1 << bits;
- }
- while (revcode < treeLen);
- }
- nextCode[bits] = code + (1 << (16 - bits));
+ int bits = codeLengths[i];
+ if (bits == 0)
+ continue;
+ code = nextCode[bits];
+ int revcode = DeflaterHuffman.bitReverse(code);
+ if (bits <= 9)
+ {
+ do
+ {
+ tree[revcode] = (short) ((i << 4) | bits);
+ revcode += 1 << bits;
+ }
+ while (revcode < 512);
+ }
+ else
+ {
+ int subTree = tree[revcode & 511];
+ int treeLen = 1 << (subTree & 15);
+ subTree = -(subTree >> 4);
+ do
+ {
+ tree[subTree | (revcode >> 9)] = (short) ((i << 4) | bits);
+ revcode += 1 << bits;
+ }
+ while (revcode < treeLen);
+ }
+ nextCode[bits] = code + (1 << (16 - bits));
}
}
@@ -173,45 +173,45 @@ class InflaterHuffmanTree
int lookahead, symbol;
if ((lookahead = input.peekBits(9)) >= 0)
{
- if ((symbol = tree[lookahead]) >= 0)
- {
- input.dropBits(symbol & 15);
- return symbol >> 4;
- }
- int subtree = -(symbol >> 4);
- int bitlen = symbol & 15;
- if ((lookahead = input.peekBits(bitlen)) >= 0)
- {
- symbol = tree[subtree | (lookahead >> 9)];
- input.dropBits(symbol & 15);
- return symbol >> 4;
- }
- else
- {
- int bits = input.getAvailableBits();
- lookahead = input.peekBits(bits);
- symbol = tree[subtree | (lookahead >> 9)];
- if ((symbol & 15) <= bits)
- {
- input.dropBits(symbol & 15);
- return symbol >> 4;
- }
- else
- return -1;
- }
+ if ((symbol = tree[lookahead]) >= 0)
+ {
+ input.dropBits(symbol & 15);
+ return symbol >> 4;
+ }
+ int subtree = -(symbol >> 4);
+ int bitlen = symbol & 15;
+ if ((lookahead = input.peekBits(bitlen)) >= 0)
+ {
+ symbol = tree[subtree | (lookahead >> 9)];
+ input.dropBits(symbol & 15);
+ return symbol >> 4;
+ }
+ else
+ {
+ int bits = input.getAvailableBits();
+ lookahead = input.peekBits(bits);
+ symbol = tree[subtree | (lookahead >> 9)];
+ if ((symbol & 15) <= bits)
+ {
+ input.dropBits(symbol & 15);
+ return symbol >> 4;
+ }
+ else
+ return -1;
+ }
}
else
{
- int bits = input.getAvailableBits();
- lookahead = input.peekBits(bits);
- symbol = tree[lookahead];
- if (symbol >= 0 && (symbol & 15) <= bits)
- {
- input.dropBits(symbol & 15);
- return symbol >> 4;
- }
- else
- return -1;
+ int bits = input.getAvailableBits();
+ lookahead = input.peekBits(bits);
+ symbol = tree[lookahead];
+ if (symbol >= 0 && (symbol & 15) <= bits)
+ {
+ input.dropBits(symbol & 15);
+ return symbol >> 4;
+ }
+ else
+ return -1;
}
}
}
diff --git a/java/util/zip/InflaterInputStream.java b/java/util/zip/InflaterInputStream.java
index 3c3745706..2af365610 100644
--- a/java/util/zip/InflaterInputStream.java
+++ b/java/util/zip/InflaterInputStream.java
@@ -8,7 +8,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -57,17 +57,17 @@ import java.io.InputStream;
public class InflaterInputStream extends FilterInputStream
{
/**
- * Decompressor for this filter
+ * Decompressor for this filter
*/
protected Inflater inf;
/**
- * Byte array used as a buffer
+ * Byte array used as a buffer
*/
protected byte[] buf;
/**
- * Size of buffer
+ * Size of buffer
*/
protected int len;
@@ -81,7 +81,7 @@ public class InflaterInputStream extends FilterInputStream
*
* @param in the InputStream to read bytes from
*/
- public InflaterInputStream(InputStream in)
+ public InflaterInputStream(InputStream in)
{
this(in, new Inflater(), 4096);
}
@@ -93,7 +93,7 @@ public class InflaterInputStream extends FilterInputStream
* @param in the InputStream to read bytes from
* @param inf the decompressor used to decompress data read from in
*/
- public InflaterInputStream(InputStream in, Inflater inf)
+ public InflaterInputStream(InputStream in, Inflater inf)
{
this(in, inf, 4096);
}
@@ -106,7 +106,7 @@ public class InflaterInputStream extends FilterInputStream
* @param inf the decompressor used to decompress data read from in
* @param size size of the buffer to use
*/
- public InflaterInputStream(InputStream in, Inflater inf, int size)
+ public InflaterInputStream(InputStream in, Inflater inf, int size)
{
super(in);
@@ -116,7 +116,7 @@ public class InflaterInputStream extends FilterInputStream
throw new NullPointerException("inf may not be null");
if (size < 0)
throw new IllegalArgumentException("size may not be negative");
-
+
this.inf = inf;
this.buf = new byte [size];
}
@@ -151,12 +151,12 @@ public class InflaterInputStream extends FilterInputStream
{
if (in == null)
throw new ZipException ("InflaterInputStream is closed");
-
+
len = in.read(buf, 0, buf.length);
if (len < 0)
throw new ZipException("Deflated stream ends early.");
-
+
inf.setInput(buf, 0, len);
}
@@ -166,7 +166,7 @@ public class InflaterInputStream extends FilterInputStream
* The byte is in the lower 8 bits of the int.
*/
public int read() throws IOException
- {
+ {
int nread = read(onebytebuffer, 0, 1);
if (nread > 0)
return onebytebuffer[0] & 0xff;
@@ -190,26 +190,26 @@ public class InflaterInputStream extends FilterInputStream
int count = 0;
for (;;)
{
-
- try
- {
- count = inf.inflate(b, off, len);
- }
- catch (DataFormatException dfe)
- {
- throw new ZipException(dfe.getMessage());
- }
-
- if (count > 0)
- return count;
-
- if (inf.needsDictionary()
- | inf.finished())
- return -1;
- else if (inf.needsInput())
- fill();
- else
- throw new InternalError("Don't know what to do");
+
+ try
+ {
+ count = inf.inflate(b, off, len);
+ }
+ catch (DataFormatException dfe)
+ {
+ throw new ZipException(dfe.getMessage());
+ }
+
+ if (count > 0)
+ return count;
+
+ if (inf.needsDictionary()
+ | inf.finished())
+ return -1;
+ else if (inf.needsInput())
+ fill();
+ else
+ throw new InternalError("Don't know what to do");
}
}
@@ -234,12 +234,12 @@ public class InflaterInputStream extends FilterInputStream
long skipped = 0L;
while (n > 0L)
{
- int numread = read(tmpbuf, 0, buflen);
- if (numread <= 0)
- break;
- n -= numread;
- skipped += numread;
- buflen = (int) Math.min(n, 2048);
+ int numread = read(tmpbuf, 0, buflen);
+ if (numread <= 0)
+ break;
+ n -= numread;
+ skipped += numread;
+ buflen = (int) Math.min(n, 2048);
}
return skipped;
diff --git a/java/util/zip/OutputWindow.java b/java/util/zip/OutputWindow.java
index 1f082a9fa..59dadb5f3 100644
--- a/java/util/zip/OutputWindow.java
+++ b/java/util/zip/OutputWindow.java
@@ -67,9 +67,9 @@ class OutputWindow
{
while (len-- > 0)
{
- window[window_end++] = window[rep_start++];
- window_end &= WINDOW_MASK;
- rep_start &= WINDOW_MASK;
+ window[window_end++] = window[rep_start++];
+ window_end &= WINDOW_MASK;
+ rep_start &= WINDOW_MASK;
}
}
@@ -82,18 +82,18 @@ class OutputWindow
int border = WINDOW_SIZE - len;
if (rep_start <= border && window_end < border)
{
- if (len <= dist)
- {
- System.arraycopy(window, rep_start, window, window_end, len);
- window_end += len;
- }
- else
- {
- /* We have to copy manually, since the repeat pattern overlaps.
- */
- while (len-- > 0)
- window[window_end++] = window[rep_start++];
- }
+ if (len <= dist)
+ {
+ System.arraycopy(window, rep_start, window, window_end, len);
+ window_end += len;
+ }
+ else
+ {
+ /* We have to copy manually, since the repeat pattern overlaps.
+ */
+ while (len-- > 0)
+ window[window_end++] = window[rep_start++];
+ }
}
else
slowRepeat(rep_start, len, dist);
@@ -101,16 +101,16 @@ class OutputWindow
public int copyStored(StreamManipulator input, int len)
{
- len = Math.min(Math.min(len, WINDOW_SIZE - window_filled),
- input.getAvailableBytes());
+ len = Math.min(Math.min(len, WINDOW_SIZE - window_filled),
+ input.getAvailableBytes());
int copied;
int tailLen = WINDOW_SIZE - window_end;
if (len > tailLen)
{
- copied = input.copyBytes(window, window_end, tailLen);
- if (copied == tailLen)
- copied += input.copyBytes(window, 0, len - tailLen);
+ copied = input.copyBytes(window, window_end, tailLen);
+ if (copied == tailLen)
+ copied += input.copyBytes(window, 0, len - tailLen);
}
else
copied = input.copyBytes(window, window_end, len);
@@ -127,8 +127,8 @@ class OutputWindow
if (len > WINDOW_SIZE)
{
- offset += len - WINDOW_SIZE;
- len = WINDOW_SIZE;
+ offset += len - WINDOW_SIZE;
+ len = WINDOW_SIZE;
}
System.arraycopy(dict, offset, window, 0, len);
window_end = len & WINDOW_MASK;
@@ -157,10 +157,10 @@ class OutputWindow
if (tailLen > 0)
{
- System.arraycopy(window, WINDOW_SIZE - tailLen,
- output, offset, tailLen);
- offset += tailLen;
- len = copy_end;
+ System.arraycopy(window, WINDOW_SIZE - tailLen,
+ output, offset, tailLen);
+ offset += tailLen;
+ len = copy_end;
}
System.arraycopy(window, copy_end - len, output, offset, len);
window_filled -= copied;
@@ -173,6 +173,3 @@ class OutputWindow
window_filled = window_end = 0;
}
}
-
-
-
diff --git a/java/util/zip/PendingBuffer.java b/java/util/zip/PendingBuffer.java
index 9079b9804..50f561f49 100644
--- a/java/util/zip/PendingBuffer.java
+++ b/java/util/zip/PendingBuffer.java
@@ -40,12 +40,12 @@ package java.util.zip;
/**
* This class is general purpose class for writing data to a buffer.
*
- * It allows you to write bits as well as bytes
+ * It allows you to write bits as well as bytes
*
* Based on DeflaterPending.java
*
* @author Jochen Hoenicke
- * @date Jan 5, 2000
+ * @date Jan 5, 2000
*/
class PendingBuffer
@@ -71,14 +71,14 @@ class PendingBuffer
start = end = bitCount = 0;
}
- public final void writeByte(int b)
+ public final void writeByte(int b)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
buf[end++] = (byte) b;
}
- public final void writeShort(int s)
+ public final void writeShort(int s)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
@@ -86,7 +86,7 @@ class PendingBuffer
buf[end++] = (byte) (s >> 8);
}
- public final void writeInt(int s)
+ public final void writeInt(int s)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
@@ -96,7 +96,7 @@ class PendingBuffer
buf[end++] = (byte) (s >> 24);
}
- public final void writeBlock(byte[] block, int offset, int len)
+ public final void writeBlock(byte[] block, int offset, int len)
{
if (DeflaterConstants.DEBUGGING && start != 0)
throw new IllegalStateException();
@@ -113,9 +113,9 @@ class PendingBuffer
throw new IllegalStateException();
if (bitCount > 0)
{
- buf[end++] = (byte) bits;
- if (bitCount > 8)
- buf[end++] = (byte) (bits >>> 8);
+ buf[end++] = (byte) bits;
+ if (bitCount > 8)
+ buf[end++] = (byte) (bits >>> 8);
}
bits = 0;
bitCount = 0;
@@ -161,28 +161,28 @@ class PendingBuffer
public final int flush(byte[] output, int offset, int length) {
if (bitCount >= 8)
{
- buf[end++] = (byte) bits;
- bits >>>= 8;
- bitCount -= 8;
+ buf[end++] = (byte) bits;
+ bits >>>= 8;
+ bitCount -= 8;
}
if (length > end - start)
{
- length = end - start;
- System.arraycopy(buf, start, output, offset, length);
- start = 0;
- end = 0;
+ length = end - start;
+ System.arraycopy(buf, start, output, offset, length);
+ start = 0;
+ end = 0;
}
else
{
- System.arraycopy(buf, start, output, offset, length);
- start += length;
+ System.arraycopy(buf, start, output, offset, length);
+ start += length;
}
return length;
}
/**
* Flushes the pending buffer and returns that data in a new array
- *
+ *
* @return the output stream
*/
@@ -197,4 +197,3 @@ class PendingBuffer
}
-
diff --git a/java/util/zip/StreamManipulator.java b/java/util/zip/StreamManipulator.java
index 57d15ae28..105d807e4 100644
--- a/java/util/zip/StreamManipulator.java
+++ b/java/util/zip/StreamManipulator.java
@@ -46,7 +46,7 @@ package java.util.zip;
* but we only need at most 15, so this is all safe.
*
* There are some optimizations in this class, for example, you must
- * never peek more then 8 bits more than needed, and you must first
+ * never peek more then 8 bits more than needed, and you must first
* peek bits before you may drop them. This is not a general purpose
* class but optimized for the behaviour of the Inflater.
*
@@ -66,17 +66,17 @@ class StreamManipulator
* Get the next n bits but don't increase input pointer. n must be
* less or equal 16 and if you if this call succeeds, you must drop
* at least n-8 bits in the next call.
- *
+ *
* @return the value of the bits, or -1 if not enough bits available. */
public final int peekBits(int n)
{
if (bits_in_buffer < n)
{
- if (window_start == window_end)
- return -1;
- buffer |= (window[window_start++] & 0xff
- | (window[window_start++] & 0xff) << 8) << bits_in_buffer;
- bits_in_buffer += 16;
+ if (window_start == window_end)
+ return -1;
+ buffer |= (window[window_start++] & 0xff
+ | (window[window_start++] & 0xff) << 8) << bits_in_buffer;
+ bits_in_buffer += 16;
}
return buffer & ((1 << n) - 1);
}
@@ -94,7 +94,7 @@ class StreamManipulator
/**
* Gets the next n bits and increases input pointer. This is equivalent
* to peekBits followed by dropBits, except for correct error handling.
- * @return the value of the bits, or -1 if not enough bits available.
+ * @return the value of the bits, or -1 if not enough bits available.
*/
public final int getBits(int n)
{
@@ -114,7 +114,7 @@ class StreamManipulator
}
/**
- * Gets the number of bytes available.
+ * Gets the number of bytes available.
* @return the number of bytes available.
*/
public final int getAvailableBytes()
@@ -141,24 +141,24 @@ class StreamManipulator
* byte aligned. If not enough bytes are available, copies fewer
* bytes.
* @param length the length to copy, 0 is allowed.
- * @return the number of bytes copied, 0 if no byte is available.
+ * @return the number of bytes copied, 0 if no byte is available.
*/
public int copyBytes(byte[] output, int offset, int length)
{
if (length < 0)
throw new IllegalArgumentException("length negative");
- if ((bits_in_buffer & 7) != 0)
+ if ((bits_in_buffer & 7) != 0)
/* bits_in_buffer may only be 0 or 8 */
throw new IllegalStateException("Bit buffer is not aligned!");
int count = 0;
while (bits_in_buffer > 0 && length > 0)
{
- output[offset++] = (byte) buffer;
- buffer >>>= 8;
- bits_in_buffer -= 8;
- length--;
- count++;
+ output[offset++] = (byte) buffer;
+ buffer >>>= 8;
+ bits_in_buffer -= 8;
+ length--;
+ count++;
}
if (length == 0)
return count;
@@ -171,9 +171,9 @@ class StreamManipulator
if (((window_start - window_end) & 1) != 0)
{
- /* We always want an even number of bytes in input, see peekBits */
- buffer = (window[window_start++] & 0xff);
- bits_in_buffer = 8;
+ /* We always want an even number of bytes in input, see peekBits */
+ buffer = (window[window_start++] & 0xff);
+ bits_in_buffer = 8;
}
return count + length;
}
@@ -191,26 +191,25 @@ class StreamManipulator
{
if (window_start < window_end)
throw new IllegalStateException
- ("Old input was not completely processed");
+ ("Old input was not completely processed");
int end = off + len;
/* We want to throw an ArrayIndexOutOfBoundsException early. The
- * check is very tricky: it also handles integer wrap around.
+ * check is very tricky: it also handles integer wrap around.
*/
if (0 > off || off > end || end > buf.length)
throw new ArrayIndexOutOfBoundsException();
-
+
if ((len & 1) != 0)
{
- /* We always want an even number of bytes in input, see peekBits */
- buffer |= (buf[off++] & 0xff) << bits_in_buffer;
- bits_in_buffer += 8;
+ /* We always want an even number of bytes in input, see peekBits */
+ buffer |= (buf[off++] & 0xff) << bits_in_buffer;
+ bits_in_buffer += 8;
}
-
+
window = buf;
window_start = off;
window_end = end;
}
}
-
diff --git a/java/util/zip/ZipConstants.java b/java/util/zip/ZipConstants.java
index bdf94506b..69f589a31 100644
--- a/java/util/zip/ZipConstants.java
+++ b/java/util/zip/ZipConstants.java
@@ -91,4 +91,3 @@ interface ZipConstants
int ENDOFF = 16;
int ENDCOM = 20;
}
-
diff --git a/java/util/zip/ZipEntry.java b/java/util/zip/ZipEntry.java
index a6d01af5f..73afc893b 100644
--- a/java/util/zip/ZipEntry.java
+++ b/java/util/zip/ZipEntry.java
@@ -46,7 +46,7 @@ import java.util.Calendar;
* about the members in an archive. On the other hand ZipOutputStream
* needs an instance of this class to create a new member.
*
- * @author Jochen Hoenicke
+ * @author Jochen Hoenicke
*/
public class ZipEntry implements ZipConstants, Cloneable
{
@@ -196,7 +196,7 @@ public class ZipEntry implements ZipConstants, Cloneable
/**
* Returns the entry name. The path components in the entry are
- * always separated by slashes ('/').
+ * always separated by slashes ('/').
*/
public String getName()
{
@@ -241,7 +241,7 @@ public class ZipEntry implements ZipConstants, Cloneable
time = cal.getTimeInMillis();
known |= KNOWN_TIME;
return time;
- }
+ }
catch (RuntimeException ex)
{
/* Ignore illegal time stamp */
@@ -260,7 +260,7 @@ public class ZipEntry implements ZipConstants, Cloneable
public void setSize(long size)
{
if ((size & 0xffffffff00000000L) != 0)
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException();
this.size = (int) size;
this.known |= KNOWN_SIZE;
}
@@ -298,7 +298,7 @@ public class ZipEntry implements ZipConstants, Cloneable
public void setCrc(long crc)
{
if ((crc & 0xffffffff00000000L) != 0)
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException();
this.crc = (int) crc;
this.known |= KNOWN_CRC;
}
@@ -317,18 +317,18 @@ public class ZipEntry implements ZipConstants, Cloneable
* supported.
* @exception IllegalArgumentException if method is not supported.
* @see ZipOutputStream#DEFLATED
- * @see ZipOutputStream#STORED
+ * @see ZipOutputStream#STORED
*/
public void setMethod(int method)
{
if (method != ZipOutputStream.STORED
- && method != ZipOutputStream.DEFLATED)
- throw new IllegalArgumentException();
+ && method != ZipOutputStream.DEFLATED)
+ throw new IllegalArgumentException();
this.method = (byte) method;
}
/**
- * Gets the compression method.
+ * Gets the compression method.
* @return the compression method or -1 if unknown.
*/
public int getMethod()
@@ -342,10 +342,10 @@ public class ZipEntry implements ZipConstants, Cloneable
*/
public void setExtra(byte[] extra)
{
- if (extra == null)
+ if (extra == null)
{
- this.extra = null;
- return;
+ this.extra = null;
+ return;
}
if (extra.length > 0xffff)
throw new IllegalArgumentException();
@@ -360,38 +360,38 @@ public class ZipEntry implements ZipConstants, Cloneable
if (extra == null)
{
- known |= KNOWN_EXTRA;
- return;
+ known |= KNOWN_EXTRA;
+ return;
}
try
{
- int pos = 0;
- while (pos < extra.length)
- {
- int sig = (extra[pos++] & 0xff)
- | (extra[pos++] & 0xff) << 8;
- int len = (extra[pos++] & 0xff)
- | (extra[pos++] & 0xff) << 8;
- if (sig == 0x5455)
- {
- /* extended time stamp */
- int flags = extra[pos];
- if ((flags & 1) != 0)
- {
- long time = ((extra[pos+1] & 0xff)
- | (extra[pos+2] & 0xff) << 8
- | (extra[pos+3] & 0xff) << 16
- | (extra[pos+4] & 0xff) << 24);
- setTime(time*1000);
- }
- }
- pos += len;
- }
+ int pos = 0;
+ while (pos < extra.length)
+ {
+ int sig = (extra[pos++] & 0xff)
+ | (extra[pos++] & 0xff) << 8;
+ int len = (extra[pos++] & 0xff)
+ | (extra[pos++] & 0xff) << 8;
+ if (sig == 0x5455)
+ {
+ /* extended time stamp */
+ int flags = extra[pos];
+ if ((flags & 1) != 0)
+ {
+ long time = ((extra[pos+1] & 0xff)
+ | (extra[pos+2] & 0xff) << 8
+ | (extra[pos+3] & 0xff) << 16
+ | (extra[pos+4] & 0xff) << 24);
+ setTime(time*1000);
+ }
+ }
+ pos += len;
+ }
}
catch (ArrayIndexOutOfBoundsException ex)
{
- /* be lenient */
+ /* be lenient */
}
known |= KNOWN_EXTRA;
@@ -429,7 +429,7 @@ public class ZipEntry implements ZipConstants, Cloneable
/**
* Gets true, if the entry is a directory. This is solely
- * determined by the name, a trailing slash '/' marks a directory.
+ * determined by the name, a trailing slash '/' marks a directory.
*/
public boolean isDirectory()
{
diff --git a/java/util/zip/ZipFile.java b/java/util/zip/ZipFile.java
index 7cf7007ed..3963bcb1e 100644
--- a/java/util/zip/ZipFile.java
+++ b/java/util/zip/ZipFile.java
@@ -106,19 +106,19 @@ public class ZipFile implements ZipConstants
*
* @return the newly open RandomAccessFile, never null
*/
- private RandomAccessFile openFile(String name,
- File file)
+ private RandomAccessFile openFile(String name,
+ File file)
throws ZipException, IOException
- {
- try
+ {
+ try
{
- return
+ return
(name != null)
? new RandomAccessFile(name, "r")
: new RandomAccessFile(file, "r");
}
catch (FileNotFoundException f)
- {
+ {
ZipException ze = new ZipException(f.getMessage());
ze.initCause(f);
throw ze;
@@ -130,7 +130,7 @@ public class ZipFile implements ZipConstants
* Opens a Zip file with the given name for reading.
* @exception IOException if a i/o error occured.
* @exception ZipException if the file doesn't contain a valid zip
- * archive.
+ * archive.
*/
public ZipFile(String name) throws ZipException, IOException
{
@@ -143,7 +143,7 @@ public class ZipFile implements ZipConstants
* Opens a Zip file reading the given File.
* @exception IOException if a i/o error occured.
* @exception ZipException if the file doesn't contain a valid zip
- * archive.
+ * archive.
*/
public ZipFile(File file) throws ZipException, IOException
{
@@ -158,7 +158,7 @@ public class ZipFile implements ZipConstants
* If the OPEN_DELETE mode is specified, the zip file will be deleted at
* some time moment after it is opened. It will be deleted before the zip
* file is closed or the Virtual Machine exits.
- *
+ *
* The contents of the zip file will be accessible until it is closed.
*
* @since JDK1.3
@@ -166,7 +166,7 @@ public class ZipFile implements ZipConstants
*
* @exception IOException if a i/o error occured.
* @exception ZipException if the file doesn't contain a valid zip
- * archive.
+ * archive.
*/
public ZipFile(File file, int mode) throws ZipException, IOException
{
@@ -183,7 +183,7 @@ public class ZipFile implements ZipConstants
{
boolean valid = false;
- try
+ try
{
byte[] buf = new byte[4];
raf.readFully(buf);
@@ -195,18 +195,18 @@ public class ZipFile implements ZipConstants
}
catch (IOException _)
{
- }
+ }
if (!valid)
{
try
{
- raf.close();
+ raf.close();
}
catch (IOException _)
{
}
- throw new ZipException("Not a valid zip file");
+ throw new ZipException("Not a valid zip file");
}
}
@@ -225,11 +225,11 @@ public class ZipFile implements ZipConstants
* while holding the lock on <code>raf</code>.
*
* @exception IOException if a i/o error occured.
- * @exception ZipException if the central directory is malformed
+ * @exception ZipException if the central directory is malformed
*/
private void readEntries() throws ZipException, IOException
{
- /* Search for the End Of Central Directory. When a zip comment is
+ /* Search for the End Of Central Directory. When a zip comment is
* present the directory may start earlier.
* Note that a comment has a maximum length of 64K, so that is the
* maximum we search backwards.
@@ -239,13 +239,13 @@ public class ZipFile implements ZipConstants
long top = Math.max(0, pos - 65536);
do
{
- if (pos < top)
- throw new ZipException
- ("central directory not found, probably not a zip file: " + name);
- inp.seek(pos--);
+ if (pos < top)
+ throw new ZipException
+ ("central directory not found, probably not a zip file: " + name);
+ inp.seek(pos--);
}
while (inp.readLeInt() != ENDSIG);
-
+
if (inp.skip(ENDTOT - ENDNRD) != ENDTOT - ENDNRD)
throw new EOFException(name);
int count = inp.readLeShort();
@@ -255,43 +255,43 @@ public class ZipFile implements ZipConstants
entries = new LinkedHashMap<String, ZipEntry> (count+count/2);
inp.seek(centralOffset);
-
+
for (int i = 0; i < count; i++)
{
- if (inp.readLeInt() != CENSIG)
- throw new ZipException("Wrong Central Directory signature: " + name);
+ if (inp.readLeInt() != CENSIG)
+ throw new ZipException("Wrong Central Directory signature: " + name);
inp.skip(6);
- int method = inp.readLeShort();
- int dostime = inp.readLeInt();
- int crc = inp.readLeInt();
- int csize = inp.readLeInt();
- int size = inp.readLeInt();
- int nameLen = inp.readLeShort();
- int extraLen = inp.readLeShort();
- int commentLen = inp.readLeShort();
+ int method = inp.readLeShort();
+ int dostime = inp.readLeInt();
+ int crc = inp.readLeInt();
+ int csize = inp.readLeInt();
+ int size = inp.readLeInt();
+ int nameLen = inp.readLeShort();
+ int extraLen = inp.readLeShort();
+ int commentLen = inp.readLeShort();
inp.skip(8);
- int offset = inp.readLeInt();
- String name = inp.readString(nameLen);
-
- ZipEntry entry = new ZipEntry(name);
- entry.setMethod(method);
- entry.setCrc(crc & 0xffffffffL);
- entry.setSize(size & 0xffffffffL);
- entry.setCompressedSize(csize & 0xffffffffL);
- entry.setDOSTime(dostime);
- if (extraLen > 0)
- {
- byte[] extra = new byte[extraLen];
- inp.readFully(extra);
- entry.setExtra(extra);
- }
- if (commentLen > 0)
- {
+ int offset = inp.readLeInt();
+ String name = inp.readString(nameLen);
+
+ ZipEntry entry = new ZipEntry(name);
+ entry.setMethod(method);
+ entry.setCrc(crc & 0xffffffffL);
+ entry.setSize(size & 0xffffffffL);
+ entry.setCompressedSize(csize & 0xffffffffL);
+ entry.setDOSTime(dostime);
+ if (extraLen > 0)
+ {
+ byte[] extra = new byte[extraLen];
+ inp.readFully(extra);
+ entry.setExtra(extra);
+ }
+ if (commentLen > 0)
+ {
entry.setComment(inp.readString(commentLen));
- }
- entry.offset = offset;
- entries.put(name, entry);
+ }
+ entry.offset = offset;
+ entries.put(name, entry);
}
}
@@ -299,7 +299,7 @@ public class ZipFile implements ZipConstants
* Closes the ZipFile. This also closes all input streams given by
* this class. After this is called, no further method should be
* called.
- *
+ *
* @exception IOException if a i/o error occured.
*/
public void close() throws IOException
@@ -310,9 +310,9 @@ public class ZipFile implements ZipConstants
synchronized (raf)
{
- closed = true;
- entries = null;
- raf.close();
+ closed = true;
+ entries = null;
+ raf.close();
}
}
@@ -333,14 +333,14 @@ public class ZipFile implements ZipConstants
public Enumeration<? extends ZipEntry> entries()
{
checkClosed();
-
+
try
{
- return new ZipEntryEnumeration(getEntries().values().iterator());
+ return new ZipEntryEnumeration(getEntries().values().iterator());
}
catch (IOException ioe)
{
- return new EmptyEnumeration<ZipEntry>();
+ return new EmptyEnumeration<ZipEntry>();
}
}
@@ -354,12 +354,12 @@ public class ZipFile implements ZipConstants
{
synchronized(raf)
{
- checkClosed();
+ checkClosed();
- if (entries == null)
- readEntries();
+ if (entries == null)
+ readEntries();
- return entries;
+ return entries;
}
}
@@ -378,16 +378,16 @@ public class ZipFile implements ZipConstants
try
{
- LinkedHashMap<String, ZipEntry> entries = getEntries();
- ZipEntry entry = entries.get(name);
+ LinkedHashMap<String, ZipEntry> entries = getEntries();
+ ZipEntry entry = entries.get(name);
// If we didn't find it, maybe it's a directory.
if (entry == null && !name.endsWith("/"))
- entry = entries.get(name + '/');
- return entry != null ? new ZipEntry(entry, name) : null;
+ entry = entries.get(name + '/');
+ return entry != null ? new ZipEntry(entry, name) : null;
}
catch (IOException ioe)
{
- return null;
+ return null;
}
}
@@ -411,7 +411,7 @@ public class ZipFile implements ZipConstants
*
* @exception IllegalStateException when the ZipFile has already been closed
* @exception IOException if a i/o error occured.
- * @exception ZipException if the Zip archive is malformed.
+ * @exception ZipException if the Zip archive is malformed.
*/
public InputStream getInputStream(ZipEntry entry) throws IOException
{
@@ -446,7 +446,7 @@ public class ZipFile implements ZipConstants
switch (method)
{
case ZipOutputStream.STORED:
- return inp;
+ return inp;
case ZipOutputStream.DEFLATED:
inp.addDummyByte();
final Inflater inf = new Inflater(true);
@@ -463,10 +463,10 @@ public class ZipFile implements ZipConstants
}
};
default:
- throw new ZipException("Unknown compression method " + method);
+ throw new ZipException("Unknown compression method " + method);
}
}
-
+
/**
* Returns the (path) name of this zip file.
*/
@@ -483,17 +483,17 @@ public class ZipFile implements ZipConstants
public int size()
{
checkClosed();
-
+
try
{
- return getEntries().size();
+ return getEntries().size();
}
catch (IOException ioe)
{
- return 0;
+ return 0;
}
}
-
+
private static class ZipEntryEnumeration implements Enumeration<ZipEntry>
{
private final Iterator<ZipEntry> elements;
@@ -511,7 +511,7 @@ public class ZipFile implements ZipConstants
public ZipEntry nextElement()
{
/* We return a clone, just to be safe that the user doesn't
- * change the entry.
+ * change the entry.
*/
return (ZipEntry) (elements.next().clone());
}
@@ -525,7 +525,7 @@ public class ZipFile implements ZipConstants
private static final Charset UTF8CHARSET = Charset.forName("UTF-8");
/**
- * The actual UTF-8 decoder. Created on demand.
+ * The actual UTF-8 decoder. Created on demand.
*/
private CharsetDecoder utf8Decoder;
@@ -572,37 +572,37 @@ public class ZipFile implements ZipConstants
}
}
}
-
+
public int available()
{
long amount = end - (bufferOffset + pos);
if (amount > Integer.MAX_VALUE)
- return Integer.MAX_VALUE;
+ return Integer.MAX_VALUE;
return (int) amount;
}
-
+
public int read() throws IOException
{
if (bufferOffset + pos >= end + dummyByteCount)
- return -1;
+ return -1;
if (pos == buffer.length)
{
bufferOffset += buffer.length;
pos = 0;
fillBuffer();
}
-
+
return buffer[pos++] & 0xFF;
}
public int read(byte[] b, int off, int len) throws IOException
{
if (len > end + dummyByteCount - (bufferOffset + pos))
- {
- len = (int) (end + dummyByteCount - (bufferOffset + pos));
- if (len == 0)
- return -1;
- }
+ {
+ len = (int) (end + dummyByteCount - (bufferOffset + pos));
+ if (len == 0)
+ return -1;
+ }
int totalBytesRead = Math.min(buffer.length - pos, len);
System.arraycopy(buffer, pos, b, off, totalBytesRead);
@@ -622,16 +622,16 @@ public class ZipFile implements ZipConstants
len -= remain;
totalBytesRead += remain;
}
-
+
return totalBytesRead;
}
public long skip(long amount) throws IOException
{
if (amount < 0)
- return 0;
+ return 0;
if (amount > end - (bufferOffset + pos))
- amount = end - (bufferOffset + pos);
+ amount = end - (bufferOffset + pos);
seek(bufferOffset + pos + amount);
return amount;
}
diff --git a/java/util/zip/ZipInputStream.java b/java/util/zip/ZipInputStream.java
index df44bb3e8..3eae026da 100644
--- a/java/util/zip/ZipInputStream.java
+++ b/java/util/zip/ZipInputStream.java
@@ -82,9 +82,9 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
{
if (avail <= 0)
{
- fillBuf();
- if (avail <= 0)
- return -1;
+ fillBuf();
+ if (avail <= 0)
+ return -1;
}
if (length > avail)
length = avail;
@@ -92,28 +92,28 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
avail -= length;
return length;
}
-
+
private void readFully(byte[] out) throws IOException
{
int off = 0;
int len = out.length;
while (len > 0)
{
- int count = readBuf(out, off, len);
- if (count == -1)
- throw new EOFException();
- off += count;
- len -= count;
+ int count = readBuf(out, off, len);
+ if (count == -1)
+ throw new EOFException();
+ off += count;
+ len -= count;
}
}
-
+
private int readLeByte() throws IOException
{
if (avail <= 0)
{
- fillBuf();
- if (avail <= 0)
- throw new ZipException("EOF in header");
+ fillBuf();
+ if (avail <= 0)
+ throw new ZipException("EOF in header");
}
return buf[len - avail--] & 0xff;
}
@@ -121,7 +121,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
/**
* Read an unsigned short in little endian byte order.
*/
- private int readLeShort() throws IOException
+ private int readLeShort() throws IOException
{
return readLeByte() | (readLeByte() << 8);
}
@@ -129,7 +129,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
/**
* Read an int in little endian byte order.
*/
- private int readLeInt() throws IOException
+ private int readLeInt() throws IOException
{
return readLeShort() | (readLeShort() << 16);
}
@@ -148,13 +148,13 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
int header = readLeInt();
if (header == CENSIG)
{
- /* Central Header reached. */
- close();
- return null;
+ /* Central Header reached. */
+ close();
+ return null;
}
if (header != LOCSIG)
throw new ZipException("Wrong Local header signature: "
- + Integer.toHexString(header));
+ + Integer.toHexString(header));
/* skip version */
readLeShort();
flags = readLeShort();
@@ -175,36 +175,36 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
String name;
try
{
- name = new String(buffer, "UTF-8");
+ name = new String(buffer, "UTF-8");
}
catch (UnsupportedEncodingException uee)
{
- throw new AssertionError(uee);
+ throw new AssertionError(uee);
}
-
+
entry = createZipEntry(name);
entryAtEOF = false;
entry.setMethod(method);
if ((flags & 8) == 0)
{
- entry.setCrc(crc & 0xffffffffL);
- entry.setSize(size & 0xffffffffL);
- entry.setCompressedSize(csize & 0xffffffffL);
+ entry.setCrc(crc & 0xffffffffL);
+ entry.setSize(size & 0xffffffffL);
+ entry.setCompressedSize(csize & 0xffffffffL);
}
entry.setDOSTime(dostime);
if (extraLen > 0)
{
- byte[] extra = new byte[extraLen];
- readFully(extra);
- entry.setExtra(extra);
+ byte[] extra = new byte[extraLen];
+ readFully(extra);
+ entry.setExtra(extra);
}
if (method == ZipOutputStream.DEFLATED && avail > 0)
{
- System.arraycopy(buf, len - avail, buf, 0, avail);
- len = avail;
- avail = 0;
- inf.setInput(buf, 0, len);
+ System.arraycopy(buf, len - avail, buf, 0, avail);
+ len = avail;
+ avail = 0;
+ inf.setInput(buf, 0, len);
}
return entry;
}
@@ -232,33 +232,33 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
if (method == ZipOutputStream.DEFLATED)
{
- if ((flags & 8) != 0)
- {
- /* We don't know how much we must skip, read until end. */
- byte[] tmp = new byte[2048];
- while (read(tmp) > 0)
- ;
-
- /* read will close this entry */
- return;
- }
- csize -= inf.getTotalIn();
- avail = inf.getRemaining();
+ if ((flags & 8) != 0)
+ {
+ /* We don't know how much we must skip, read until end. */
+ byte[] tmp = new byte[2048];
+ while (read(tmp) > 0)
+ ;
+
+ /* read will close this entry */
+ return;
+ }
+ csize -= inf.getTotalIn();
+ avail = inf.getRemaining();
}
if (avail > csize && csize >= 0)
avail -= csize;
else
{
- csize -= avail;
- avail = 0;
- while (csize != 0)
- {
- long skipped = in.skip(csize & 0xffffffffL);
- if (skipped <= 0)
- throw new ZipException("zip archive ends early.");
- csize -= skipped;
- }
+ csize -= avail;
+ avail = 0;
+ while (csize != 0)
+ {
+ long skipped = in.skip(csize & 0xffffffffL);
+ if (skipped <= 0)
+ throw new ZipException("zip archive ends early.");
+ csize -= skipped;
+ }
}
size = 0;
@@ -307,40 +307,40 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
switch (method)
{
case ZipOutputStream.DEFLATED:
- len = super.read(b, off, len);
- if (len < 0)
- {
- if (!inf.finished())
- throw new ZipException("Inflater not finished!?");
- avail = inf.getRemaining();
- if ((flags & 8) != 0)
- readDataDescr();
-
- if (inf.getTotalIn() != csize
- || inf.getTotalOut() != size)
- throw new ZipException("size mismatch: "+csize+";"+size+" <-> "+inf.getTotalIn()+";"+inf.getTotalOut());
- inf.reset();
- finished = true;
- }
- break;
-
+ len = super.read(b, off, len);
+ if (len < 0)
+ {
+ if (!inf.finished())
+ throw new ZipException("Inflater not finished!?");
+ avail = inf.getRemaining();
+ if ((flags & 8) != 0)
+ readDataDescr();
+
+ if (inf.getTotalIn() != csize
+ || inf.getTotalOut() != size)
+ throw new ZipException("size mismatch: "+csize+";"+size+" <-> "+inf.getTotalIn()+";"+inf.getTotalOut());
+ inf.reset();
+ finished = true;
+ }
+ break;
+
case ZipOutputStream.STORED:
- if (len > csize && csize >= 0)
- len = csize;
-
- len = readBuf(b, off, len);
- if (len > 0)
- {
- csize -= len;
- size -= len;
- }
-
- if (csize == 0)
- finished = true;
- else if (len < 0)
- throw new ZipException("EOF in stored block");
- break;
+ if (len > csize && csize >= 0)
+ len = csize;
+
+ len = readBuf(b, off, len);
+ if (len > 0)
+ {
+ csize -= len;
+ size -= len;
+ }
+
+ if (csize == 0)
+ finished = true;
+ else if (len < 0)
+ throw new ZipException("EOF in stored block");
+ break;
}
if (len > 0)
@@ -348,11 +348,11 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
if (finished)
{
- if ((crc.getValue() & 0xffffffffL) != entry.getCrc())
- throw new ZipException("CRC mismatch");
- crc.reset();
- entry = null;
- entryAtEOF = true;
+ if ((crc.getValue() & 0xffffffffL) != entry.getCrc())
+ throw new ZipException("CRC mismatch");
+ crc.reset();
+ entry = null;
+ entryAtEOF = true;
}
return len;
}
@@ -374,7 +374,7 @@ public class ZipInputStream extends InflaterInputStream implements ZipConstants
* to new ZipEntry(name).
* @param name the name of the zip entry.
*/
- protected ZipEntry createZipEntry(String name)
+ protected ZipEntry createZipEntry(String name)
{
return new ZipEntry(name);
}
diff --git a/java/util/zip/ZipOutputStream.java b/java/util/zip/ZipOutputStream.java
index d292f7d40..bc1c3e99c 100644
--- a/java/util/zip/ZipOutputStream.java
+++ b/java/util/zip/ZipOutputStream.java
@@ -54,7 +54,7 @@ import java.util.Vector;
*
* This class is not thread safe.
*
- * @author Jochen Hoenicke
+ * @author Jochen Hoenicke
*/
public class ZipOutputStream extends DeflaterOutputStream implements ZipConstants
{
@@ -79,7 +79,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
* Compression method. This method doesn't compress at all.
*/
public static final int STORED = 0;
-
+
/**
* Compression method. This method uses the Deflater.
*/
@@ -105,17 +105,17 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
byte[] commentBytes;
try
{
- commentBytes = comment.getBytes("UTF-8");
+ commentBytes = comment.getBytes("UTF-8");
}
catch (UnsupportedEncodingException uee)
{
- throw new AssertionError(uee);
+ throw new AssertionError(uee);
}
if (commentBytes.length > 0xffff)
throw new IllegalArgumentException("Comment too long.");
zipComment = commentBytes;
}
-
+
/**
* Sets default compression method. If the Zip entry specifies
* another method its method takes precedence.
@@ -133,7 +133,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
/**
* Sets default compression level. The new level will be activated
- * immediately.
+ * immediately.
* @exception IllegalArgumentException if level is not supported.
* @see Deflater
*/
@@ -141,11 +141,11 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
{
def.setLevel(level);
}
-
+
/**
* Write an unsigned short in little endian byte order.
*/
- private void writeLeShort(int value) throws IOException
+ private void writeLeShort(int value) throws IOException
{
out.write(value & 0xff);
out.write((value >> 8) & 0xff);
@@ -154,7 +154,7 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
/**
* Write an int in little endian byte order.
*/
- private void writeLeInt(int value) throws IOException
+ private void writeLeInt(int value) throws IOException
{
writeLeShort(value);
writeLeShort(value >> 16);
@@ -192,27 +192,27 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
if (method == STORED)
{
- if (entry.getCompressedSize() >= 0)
- {
- if (entry.getSize() < 0)
- entry.setSize(entry.getCompressedSize());
- else if (entry.getSize() != entry.getCompressedSize())
- throw new ZipException
- ("Method STORED, but compressed size != size");
- }
- else
- entry.setCompressedSize(entry.getSize());
-
- if (entry.getSize() < 0)
- throw new ZipException("Method STORED, but size not set");
- if (entry.getCrc() < 0)
- throw new ZipException("Method STORED, but crc not set");
+ if (entry.getCompressedSize() >= 0)
+ {
+ if (entry.getSize() < 0)
+ entry.setSize(entry.getCompressedSize());
+ else if (entry.getSize() != entry.getCompressedSize())
+ throw new ZipException
+ ("Method STORED, but compressed size != size");
+ }
+ else
+ entry.setCompressedSize(entry.getSize());
+
+ if (entry.getSize() < 0)
+ throw new ZipException("Method STORED, but size not set");
+ if (entry.getCrc() < 0)
+ throw new ZipException("Method STORED, but crc not set");
}
else if (method == DEFLATED)
{
- if (entry.getCompressedSize() < 0
- || entry.getSize() < 0 || entry.getCrc() < 0)
- flags |= 8;
+ if (entry.getCompressedSize() < 0
+ || entry.getSize() < 0 || entry.getCrc() < 0)
+ flags |= 8;
}
if (curEntry != null)
@@ -228,30 +228,30 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
/* Write the local file header */
writeLeInt(LOCSIG);
writeLeShort(method == STORED
- ? ZIP_STORED_VERSION : ZIP_DEFLATED_VERSION);
+ ? ZIP_STORED_VERSION : ZIP_DEFLATED_VERSION);
writeLeShort(flags);
writeLeShort(method);
writeLeInt(entry.getDOSTime());
if ((flags & 8) == 0)
{
- writeLeInt((int)entry.getCrc());
- writeLeInt((int)entry.getCompressedSize());
- writeLeInt((int)entry.getSize());
+ writeLeInt((int)entry.getCrc());
+ writeLeInt((int)entry.getCompressedSize());
+ writeLeInt((int)entry.getSize());
}
else
{
- writeLeInt(0);
- writeLeInt(0);
- writeLeInt(0);
+ writeLeInt(0);
+ writeLeInt(0);
+ writeLeInt(0);
}
byte[] name;
try
{
- name = entry.getName().getBytes("UTF-8");
+ name = entry.getName().getBytes("UTF-8");
}
catch (UnsupportedEncodingException uee)
{
- throw new AssertionError(uee);
+ throw new AssertionError(uee);
}
if (name.length > 0xffff)
throw new ZipException("Name too long.");
@@ -294,31 +294,31 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
curEntry.setSize(size);
else if (curEntry.getSize() != size)
throw new ZipException("size was "+size
- +", but I expected "+curEntry.getSize());
+ +", but I expected "+curEntry.getSize());
if (curEntry.getCompressedSize() < 0)
curEntry.setCompressedSize(csize);
else if (curEntry.getCompressedSize() != csize)
throw new ZipException("compressed size was "+csize
- +", but I expected "+curEntry.getSize());
+ +", but I expected "+curEntry.getSize());
if (curEntry.getCrc() < 0)
curEntry.setCrc(crc.getValue());
else if (curEntry.getCrc() != crc.getValue())
throw new ZipException("crc was " + Long.toHexString(crc.getValue())
- + ", but I expected "
- + Long.toHexString(curEntry.getCrc()));
+ + ", but I expected "
+ + Long.toHexString(curEntry.getCrc()));
offset += csize;
/* Now write the data descriptor entry if needed. */
if (curMethod == DEFLATED && (curEntry.flags & 8) != 0)
{
- writeLeInt(EXTSIG);
- writeLeInt((int)curEntry.getCrc());
- writeLeInt((int)curEntry.getCompressedSize());
- writeLeInt((int)curEntry.getSize());
- offset += EXTHDR;
+ writeLeInt(EXTSIG);
+ writeLeInt((int)curEntry.getCrc());
+ writeLeInt((int)curEntry.getCompressedSize());
+ writeLeInt((int)curEntry.getSize());
+ offset += EXTHDR;
}
entries.addElement(curEntry);
@@ -338,12 +338,12 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
switch (curMethod)
{
case DEFLATED:
- super.write(b, off, len);
- break;
-
+ super.write(b, off, len);
+ break;
+
case STORED:
- out.write(b, off, len);
- break;
+ out.write(b, off, len);
+ break;
}
crc.update(b, off, len);
@@ -364,65 +364,65 @@ public class ZipOutputStream extends DeflaterOutputStream implements ZipConstant
int numEntries = 0;
int sizeEntries = 0;
-
+
Enumeration e = entries.elements();
while (e.hasMoreElements())
{
- ZipEntry entry = (ZipEntry) e.nextElement();
-
- int method = entry.getMethod();
- writeLeInt(CENSIG);
- writeLeShort(method == STORED
- ? ZIP_STORED_VERSION : ZIP_DEFLATED_VERSION);
- writeLeShort(method == STORED
- ? ZIP_STORED_VERSION : ZIP_DEFLATED_VERSION);
- writeLeShort(entry.flags);
- writeLeShort(method);
- writeLeInt(entry.getDOSTime());
- writeLeInt((int)entry.getCrc());
- writeLeInt((int)entry.getCompressedSize());
- writeLeInt((int)entry.getSize());
-
- byte[] name;
- try
- {
- name = entry.getName().getBytes("UTF-8");
- }
- catch (UnsupportedEncodingException uee)
- {
- throw new AssertionError(uee);
- }
- if (name.length > 0xffff)
- throw new ZipException("Name too long.");
- byte[] extra = entry.getExtra();
- if (extra == null)
- extra = new byte[0];
- String str = entry.getComment();
- byte[] comment;
- try
- {
- comment = str != null ? str.getBytes("UTF-8") : new byte[0];
- }
- catch (UnsupportedEncodingException uee)
- {
- throw new AssertionError(uee);
- }
- if (comment.length > 0xffff)
- throw new ZipException("Comment too long.");
-
- writeLeShort(name.length);
- writeLeShort(extra.length);
- writeLeShort(comment.length);
- writeLeShort(0); /* disk number */
- writeLeShort(0); /* internal file attr */
- writeLeInt(0); /* external file attr */
- writeLeInt(entry.offset);
-
- out.write(name);
- out.write(extra);
- out.write(comment);
- numEntries++;
- sizeEntries += CENHDR + name.length + extra.length + comment.length;
+ ZipEntry entry = (ZipEntry) e.nextElement();
+
+ int method = entry.getMethod();
+ writeLeInt(CENSIG);
+ writeLeShort(method == STORED
+ ? ZIP_STORED_VERSION : ZIP_DEFLATED_VERSION);
+ writeLeShort(method == STORED
+ ? ZIP_STORED_VERSION : ZIP_DEFLATED_VERSION);
+ writeLeShort(entry.flags);
+ writeLeShort(method);
+ writeLeInt(entry.getDOSTime());
+ writeLeInt((int)entry.getCrc());
+ writeLeInt((int)entry.getCompressedSize());
+ writeLeInt((int)entry.getSize());
+
+ byte[] name;
+ try
+ {
+ name = entry.getName().getBytes("UTF-8");
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
+ if (name.length > 0xffff)
+ throw new ZipException("Name too long.");
+ byte[] extra = entry.getExtra();
+ if (extra == null)
+ extra = new byte[0];
+ String str = entry.getComment();
+ byte[] comment;
+ try
+ {
+ comment = str != null ? str.getBytes("UTF-8") : new byte[0];
+ }
+ catch (UnsupportedEncodingException uee)
+ {
+ throw new AssertionError(uee);
+ }
+ if (comment.length > 0xffff)
+ throw new ZipException("Comment too long.");
+
+ writeLeShort(name.length);
+ writeLeShort(extra.length);
+ writeLeShort(comment.length);
+ writeLeShort(0); /* disk number */
+ writeLeShort(0); /* internal file attr */
+ writeLeInt(0); /* external file attr */
+ writeLeInt(entry.offset);
+
+ out.write(name);
+ out.write(extra);
+ out.write(comment);
+ numEntries++;
+ sizeEntries += CENHDR + name.length + extra.length + comment.length;
}
writeLeInt(ENDSIG);