<<

Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

Index

Classes are listed by name, followed by the package in which they belong in parentheses, e.g. HashMap (java.util). Methods are indicated by name followed by parentheses with no argument list, e.g. println().

+, see strings, see operators annotation, 25, 340 default values, 79 @, see annotation @Override, 98–9 formatted string, 25, 347–8 \u, escape sequence, 313 Ant tool, 521 identifier, 31 . (dot operator), 67 AOT (Ahead of Time) compilers, 658 length,80 .class file, 15 applets, 4, 15 multi-dimensional, 121–2 .java file, 14, 133 client example, 459–64 of objects, 120–1 NaN, infinity, see floating-point directories, 148–9 rectangular, 11 special values implementing Runnable, 257, 277 vectors and matrices, 123–4 <>, 339 init(), 50, 259 ArrayList (java.util), 26, 118, (),45 see JAR 123, 336, 337, 338, 339 reading a file, 419–23 performance, 405–8, 409 abstract “Hello World” example, 19–20 Arrays (java.util), 328, 345–9 class, 105–9 hypertext tags, 19–20, 75 binarySearch(), 346–7 methods, 105–9 menu bar, 247 equals(), 345 abstract modifer, 107–9 parameters, 75 fill(), 345 access rules, 61, 140 security, 427 sort(), 346–7 default (package private), 140 see Swing classes – JApplet deepEquals(), 348–9 see packages start(), 259, 277 deepToString(), 348–9 private, 140 starter programs, 20–3 toString(), 347–8 protected, 140 stop(), 259, 284 ASCII, 312 public, 140 appletviewer, 15, 16 atomic components, 161, 164 Accessibility Framework, 163, 394 vs. browsers, 22–3 audio, 402–4 ActionListener, see event listeners application programs, 4, 14, 31–2 autoboxing and unboxing, 24, 76–9, 343 adapter classes, 240–2 see frames, with generics, 339 see event listeners “Hello World” example, 18 and overloading, 78–9 AffineTransformOp see JAR see wrappers for primitives (java.awt.image), 381, 383 starter programs, 20–3 AWT (Abstract Windowing Toolkit), 25, see image filtering arbitrary precision numbers, 356–9 161–2 see Java 2D – transformations BigDecimal (java.math), 357, 359 aliased, anti-aliasing, 185 BigInteger (java.math), 357–8 bands in image data buffer, 366 animations, 276–81 ARGB, see color BasicStroke (java.awt), 184 of images array, 42, 79–80, 120–4, 328 see Java 2D with BufferedImage, 380 see Arrays base class, 93 with MemoryImageSource, 376–8 as object, 79, 122–3 big endian, 316, 648, 649, 667 see threads copy with System.arraycopy(), bit handling, 360–2 see timers 121 operations, 360–1, 689 anonymous inner class, 239–40 declaration, 79 BitSet (java.util), 328, 361

697

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

698 Index

boolean, 30, 34 structures, 57 client/server, 428–30, 471 see primitives vs.Java,3,9,10 applications in science, 471–3 Boolean (java.lang), see wrappers Calendar (java.util), 327, 353–6 callback, 490 for primitives GregorianCalendar conceptual model in UML, 475–7 Box (javax.swing), 226–8 (java.util), 353 see CORBA see layout managers callbacks, 192, 256, 490, 649 see embedded Java break, 43, 44 see Interfaces see microservers browsers, 15 cast polling, 489 see applets automatic conversions, 45, 116 see RMI see plug-in JVM container Object elements, 328 with sockets, 428–9, 431–45, 448–69 vs. appletviewer, 22–3 legal vs. illegal casts, 45 see Web services BufferedImage (java.awt.image), object references, 115–17 cloning, 115, 118 190, 365–7, 386 operator (parentheses), 45, 691 code block, 39 animations, 380 primitives, 44–7 coding conventions, 150–3 create, 372–3 cast rules collaboration diagrams, 475, 496 see Image integer to floating-point, 46 asynchronous operations (half see images narrowing, 46 arrowheads), 487 loading, 370 object references, 117 iteration notation, 480 pixel handling, 378–80 widening, 45 messages, 477 save, 373 CGI (Common Gateway Interface), 446 nested sequences, 477 BufferedImageOp ChangeListener, 221 return messages (dashed arrows), 485 (java.awt.imge), 381 see event listeners sequence numbers, 477 see image filtering char, 30, 33–4, 296 server example, 477–81, 483–7 byte,34 as unsigned short, 34 synchronous operations (solid see integers see primitives arrowheads), 478 see primitives Character (java.lang), see see UML Byte (java.lang), see wrappers for wrappers for primitives Collections Framework, 6, 329, 331, primitives character encoding, 34, 290, 312–13 335–8 bytecode, 3, 10, 15 ASCII, 312 lists, maps, and sets, 336–7 verifier, 9 see Unicode object containers, 335 UTF-8, 312 color /C++ class, 57 ARGB (alpha-red-green-blue), 176, „ arrays, 11, 120, 123 “. dot operator, 67 366, 374–5, 378 2D arrays, 124 accessing methods and fields, 67 background, foreground colors, 177 and compute engines, 486 see access rules CIEXYZ, 176 CORBA, 503 see constructors color space, 176 CYGWIN, 595 data type analogy, 57–8 ColorModel (java.awt.image), enumerated types, 343 definition, 58–65 366 include vs. import, 140 definition files, 132–3 see graphics I/O, 289 fields, 58, 59–60 see gray scale Java GUI front-end, 10 see inheritance see images JNI, 585–624 instantiation, 65–6 indexed color model, 367 main(),32 loader, 9, 191 pen color, 177, 183 multiple inheritance, 93 see methods RGB, 176, 366 operator precedence, 38 vs. structures, 57 sRGB, 176 operator overloading, 11 see variables Color (java.awt), 176–8, 365 performance, 9, 12 class variables and methods, see static packed bits, 176, 360, 375–6 pointers vs. Java references, 66, Class class, 119 packing/unpacking ARGB values, 112 CLASSPATH, 134, 147–8, 511, 512, 513, 360–1, 374–5 printf() function, 25, 52, 594 515, 524–5, 596 constants, 177

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

Index 699

ColorConvertOP constants, 534 desktop client, 24 (java.awt.image), 381, 386 CosNaming service, 479, 542, 543–4 device drivers, 656 see image filtering exceptions, 534 see real-time comments, 32–3 IDL (Interface Definition Language), dialogs see Javadoc API 530, 531, 535 Dialog (java.awt), 161 Comparable (java.lang), 346, 358 idlj and IDL compilation, 535–7, JDialog (javax.swing), Comparator (java.util), 346 546 163 complex numbers, 11 mutator (setter), 534 Dimension (java.awt), 175 class examples, 58, 85–6, 125–6 Object Management Group, 530 direct memory access, 656 Component (java.awt), 161 Object Request Broker (ORB), 540–2, see real-time compute engine, 482 544 directory separators, 135, 300–1, concurrency, 26 operations (methods), 533 516 concurrency utilities, 285, 341–3 orbd, 545 distributed computing, 471–3, 501–3 Callable Portable Object Adapter (POA), 540, client, 492–500 (java.util.concurrent), 542 see design patterns 342–3 run example on two machines, 547–8 see RMI Client/Server example Executor servant, 538–40, 542–4 scientific applications, 471–3 (java.util.concurrent), server implementation, 537–44 simple server example, 481–90 341–2 structures, 533 simulation compute engine, 483–7 see threads vs. RMI, 503, 530–2, 535 see Web services console, 50 Web services, 573–4 domain name servers (DNS), 415 see I/O with console cursor icons, 392–4 double,34 constants, 140–1 see floating-point see final data fields, see class see primitives and interfaces, 114–15 data race, see synchronization Double (java.lang) see static import data types, 30, 33–4 see wrappers for primitives constructors, 58, 63–5, 100–5 see cast double buffering, 372 see class see mixing drag and drop, 163 construction sequence, 102–5 see primitives dynamic binding, 9, 146 default, 64, 103 see references super(), 101–2 DataBuffer (java.awt.image), 366 Ease of Development (EoD), 23, 24–6 this(), 100–1 see BufferedImage embedded Java, 651–80 containers for graphics components, see Raster AOT (Ahead of Time) compilers, 164–6 datagrams, 414–15 658 Container (java.awt), 161 DatagramSocket (java.net), 426 EmbeddedJava API, 7, 652 see Swing classes – JPanel Date (java.util), 327, 353–6 embedded server example, 671–9 panes, 165–6, 179 date and time formatting see Java Card API getContentPane(), 166 clock examples, 282–3, 284–5 see Java 2 Micro Edition (J2ME) containers of objects, 335 DateFormat (java.text), 353–6 see microservers see Collections Framework SimpleDateFormat (java.text), PersonalJava API, 7, 652 ConvolveOP (java.awt.image), 353–6 science and engineering applications, 381, 383 default package, see packages 652 see image filtering deprecation, 258 enhanced for loop, 24, 42 CORBA (Common Object Request design patterns, 471, 476 enumerated type, 26, 343–5 Broker Architecture), 136, 137, factory pattern, 341, 477, 496, 551–2 Enumeration (java.util), 327, 329, 471, 479, 530–48 ServerFactory, 477–81 337, 409 accessor (getter), 534 see RMI Client/Server example environment variables, 628–9 attributes, 534 see Model-View-Controller (MVC) see CLASSPATH C/C++, 503 pattern path, 147 client implementation, 544–5 singleton, 479 equals(), see Object class

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

700 Index

events, 201–10 FileFilter, see JFileChooser menu bar, 244 button, 204–6 final modifer, 69, 140–1, 405 Frame (java.awt), 161 change, 221–3 finalize(), 119 JFrame (javax.swing), 163 item, 215 see Object key, 399–402 float,34 garbage collection, 9, 71, 357, 408, 502 mouse, 208–10 see floating-point and Javelin Stamp, 665 mouse buttons, 394–6 see primitives real-time systems, 655–6 event listeners, 202–3 Float (java.lang) System.gc(), 655 adapter classes, 240–2 see wrappers for primitives generics, 26, 78, 338–40 inner classes, 238–40 floating-point, 12, 34, 47–50, 693–6 autoboxing and unboxing, 339 ActionListener bit layout, 48 compilation warnings, 340 (java.awt.event), 202–3, double, 30, 33–4 getContentPane(), 166 204–6, 216–18, 284 example, 52–3 getter methods, 153, 224 ChangeListener extended exponents, 695 glue, 227 (java.awt.event), 221 float, 30, 33–4, 57 graphics ItemListener see mixing primitives color, 176–8 (java.awt.event), 215 normalized and denormalized, 49, coordinate system, 175–6 KeyListener (java.awt.event), 693–4 drawing, 174–6, 178–90 399 specifications, 695 drawing example, 178–9 ListSelectionListener strictfp, 12, 50, 695 see fonts for graphics (javax.swing.event), floating-point special values, 694–5 graphics context, 174–5 218–21 NaN (Not-a-Number), 49, 53 see Java 2D API MouseListener infinity, 49, 53 rendering, 176 (java.awt.event), 202, flush buffer, see streams text, 171–4, 180–3 209–10, 399 focus, 400 Graphics (java.awt), 174–5, MouseMotionListener fonts for graphics 178–83, 372 (java.awt.event), 202, 209 Font (java.awt), 181 drawing an image, 191, 371 WindowListener FontMetrics (java.awt), for printing, 390 (java.awt.event), 202 181–2 Graphics2D (java.awt), 174–5, EventObject (java.util), 203 for loop, 41 371–2 exceptions, 9, 80–4 formatted I/O, 25, 52, 153–7 see Java 2D API finally,84 arrays, 25, 347–8 gray scale color model, 367, 379–80, general (checked) exceptions, 82–3 DecimalFormat (java.text), 386 run-time, 82, 83–4 153–5 GregorianCalendar (java.util), throw statement, 82 Format (java.text), 153–5 see Calendar throws statement, 82 Formatter (java.util), 156, GUI – Graphical User Interface, 10, 160, try-catch syntax, 81 293–5, 304–5 201, 234, 242, 251 expressions, 31, 35–6 NumberFormat (java.text), simple example, 206–8 associativity, 38–9 153–5 GUI builders, 15, 234 evaluation, 37–9 printf() in PrintStream, 25, precedence, 38–9 156–7, 289, 293–5 HashMap (java.util), 327, 331, 336, extends,91 see Scanner 409 see inheritance Fortran, 10, 11, 12, 85, 486, 487 server pool example, 553 JNI, 587 HashSet (java.util), 336 fields, see class FPGA (Field Programmable Gate Array), Hashtable (java.util), 327, File (java.io), 294, 298, 299–301 657 329–31, 335, 336, 409 for a directory, 300 see Java hardware processors heavyweight, see lightweight components see I/O with files frames, histograms obtaining URL, 419 centering, 629 class examples, 86–9, 128–30, 194–9 path names, 300–1 closing, 243 graphics, 192–9, 247–51

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

Index 701

I/O, 320–5 in JAR, 191 I/O in Java destination, 321–3 loading, 190–2, 367–70, 417 binary, 309–12 filtering, 323–5 pixel handling, 374–80 bytes, 315–17 serialization, 320–1 processing, 373–4 see I/O with console RMI example, 569–70 saving, 373 see I/O with files Web client example, 459 scaling, 371–2 see I/O with objects hostname, 415 tiling, 371 see I/O with text HotJava, 4 immutable objects, 357 java.io, 287, 289–90 Hotspot JVM, 6 implements, see interfaces java.nio, 287, 326 HTTP (Hypertext Transmission import, 132, 137–40 packages, 287–9 Protocol), 431, 432, 435–8 see static import see streams InetAddress (java.net), 423–6 I/O with console, 18, 50–2, 291–9 indexed color model, 367 see IP address see formatted outputI/O IDE (Integrated Development inheritance, 91–3 see stream classes – PrintStream Environment), 15 base class, 93 print(), println(), 32, 50–1, identifiers, 30 extends,91 62–3, 289 see literals see interfaces System.err, 291 see variables multiple inheritance, 93 System.in, 289, 291, 295–6 if statements, 40–1 see overriding System.out, 62, 289, 291, 295 see statements subclass, 91, 93 I/O with files, 301–12 Image (java.awt.image), 190, superclass, 92, 93 binary, 309–12 365–7 inner class, 238–40 see File see BufferedImage anonymous, 239–40 text input, 305–9 see images instanceof, 115, 203 see Scanner image filtering, 380–8 instances, see objects text output, 302–5 color conversion, 381, 386 instantiation, see class I/O with objects, 313–15, 417 convolution, 381–3 int,34 histogram example, 320–1 kernel operator, 381 see integers ObjectOutputStream, custom, 386–8 see primitives ObjectInputStream, see in-place, 381 Integer (java.lang), see wrappers stream classes lookup tables, 381, 384–5 for primitives Serializable (java.io), 314, rescaling, 381, 385 Integers, 33–4 320 transforms, 381, 383–4 byte,30 transient, 314 ImageIcon (javax.swing), 367, 370 int,30 I/O with text ImageObserver (java.awt.image), long,30 see formatted I/O 192, 367–8 short,30 see I/O with console ImageProducer (java.awt.image), see mixing primitives input, 295–9 377 see primitives see Scanner images, 190–2 unsigned short, see char output, 291–5 see animations see wrappers for primitives to file, 302–5 see BufferedImage interface, 109–15 see stream classes – PrintStream creating, 372–3 for callbacks, 112–13 see stream classes – Reader display, 191, 371–2 data fields, 114 see stream classes – Writer double buffering, 372 implements, 109 IOException (java.io), 296 encoding formats, 190, 370, 373 interfacing classes, 111 IP (Internet Protocol), 413, 414–15, graphics context, 372–3 marker, 115 423–6 see image filtering multiple inheritance, 109–10, 113 IP address, 414 ImageIO (javax.imageio), 287, to hold constants, 114–15 applet access, 427 367, 373 internationalization, 363 InetAddress, 423–6 javax.imageio packages, 373 Internet basics, 413–14 loopback, 414, 438

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

702 Index

ItemListener, see event listener chips, 658–9 configurations, 652, 653–4 Iterator (java.util), 42, 329, co-processor, 657 CDC, 653–4 337–8, 409 cores, 657, 659–60 CLDC, 653–4, 659, 663, 671, 672 DCT cores, 660 see Java hardware JAR (Java ARchive), 25, 132, 143–6, 524 FPGA (Field Programmable Gate KVM, 653–4 applet, 145, 149 Array), 657 prelinked, 653 application, 145–6 Imsys Cjip processor, 659 preverification, 672 java.util.jar, 363 see SNAP from Imsys Technologies profiles, 653, 654 manifest, 144 instruction sets, 657–8 MIDP, 654, 659 jar tool, 143–5 Nazomi JA108, 659 MIDlets, 654 see pack200 tool see Javelin Stamp from Parallax see SNAP from Imsys Technologies Java performance, 663, 680 Java 2 Standard Edition (J2SE), 5–6, 162 code compatibility, 16–17, 340 picoJava, 657 see Java core language, 16 real-time, 659 Java 2D API, 163, 183–90, 390 optional packages and APIs, 16, 631 standalone, 657 clipping, 185 standard extensions (javax Synopsys JVXtreme, 660 compositing, 185 packages), 162–3 see TINI drawing example, 187–90 definition of, 3–4 Virtual Peripheral (VP), 659, 665, see Graphics2D documentation, 16 667 see images editions, 5 Vulcan Machines Moon 2, 660 Line2D (java.awt), 186 features and benefits, 8–12 Xilinx lavaCORE, 660 paint, 183–4 history, 4–5 Java IDL, 530 Rectangle2D (java.awt), 186, 188 (JCP), 8 see CORBA rendering hints, 184–5, 186 see Java programming Java networking, 416–17 Shape (java.awt), 186 Java 2 Standard Edition (J2SE), 5–6 java.net, 417, 431 stroke, 184 keywords, 29, 30, 683 see Client/Server transformations, 185, 190 legacy code and Java, 10 see CORBA Java 5.0 (J2SE5.0), 6, 8, 23–6, 327 naming conventions, 7–8 see embedded Java javac tool, 3, 15, 147, 523, 671 networking, 9, 10, 416–17 see RMI bootclasspath option, 672 see operators see sockets target option, 672 see performance see Web services Javadoc API, 33, 149–50 portability, 9, 10, 160, 417 Java programming API, 150 see real-time basics, 14–23 Taglest API, 150 real world applications, 12–14 first applet, 19–20 javax packages, 162–3 shortcomings, 10–12 first application, 18 see Java symbols, 30, 684 getting started, 17–23, 50–3 javax.comm, see port communications technical programming, 10–12 JDK (Java Development Kit), 5, 7 javax.swing, see Swing versions, 5–8 SDK (Software Development Kit), 3, java.io, 289–90 Java Card API, 5, 7, 651, 652, 653 6, 7, 15, 17–18 see I/O Java Foundation Classes (JFC), 6, 160, starter programs, 20–3 see streams 163 tools, 15–16 java.lang, 137 see Java 2D Java Runtime Environment (JRE), 3, Javelin Stamp from Parallax, 659, 664–5 see Swing 147 programming, 665–70 Java hardware, 657–80 java tool, 15, 147 example program, 640, 643, 667–70 aJile board, 663–4 -D option, 628–9 see Java hardware aJile processors, 658–9, 660 , see JVM JFileChooser (javax.swing), ARM , 660 Java 2 Enterprise Edition (J2EE), 7, 9, 318–20 Aurora, 660 162, 431 FileFilter benefits, 658 Java 2 Micro Edition (J2ME), 7, 163, (javax.swing.filechooser), boards, 661–5 652–4, 659 318

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

Index 703

JNI (Java Native Interface), 585–624 Just-In-Time (JIT) compilers, JNI, 586, 588, 591 arrays 11 ports, 416, 432 get and set region functions, KVM, see Java 2 Micro Edition storing preferences, 335 605–6 real-time, 654–7 SDK, 17 of primitives, 604–7 threads, 253, 259–62 opening comm ports, 635 of object, 606–7 see threads List (java.util), 336 C tools, 595–6 and generics, 339–40 calling conventions, 600 KeyAdapter (java.awt.event), ListSelectionListener, see event calling Java methods from native code, 400 listeners 615–18 adapter classes, 240–2 literals, 31 client/server applications, 562 KeyEvent (java.awt.event), 244, floating-point types, 696 exceptions, 618–22 400 integers, 97 field ID, 608–11 see events string, 35 Fortran, 587 KeyListener, see event listener little-endian, 316 getting Java field values from native keystroke handling, 399–402 localhost, 510, 527 code, 613–15 keywords, see Java see IP Address – loopback Hello World example, 587–97 KVM, see Java 2 Micro Edition logging (java.util), 363 interface pointer, 598–600 long,34 introduction, 585–7 laying out components, 167–71 see integers „ “j data types, 593 set layout manager, 224 see primitives javah and header file, 588, 591–3 see containers Long (java.lang), see wrappers for jclass, 593, 597, 611–12 see layout managers primitives jobject, 593, 597, 608, 612 layout managers, 167, 223–37 Look and Feel, 163 jobjectArray, 606–7 BorderLayout (java.awt), 173, Swing Synth, 24 local and global references, 622 228–9 LookupOP (java.awt.image), 381, method ID, 615–18 BoxLayout (javax.swing), 225–8 384 method signature, 616 in Box, 226–8 see image filtering name mangling, 593 CardLayout (java.awt), 229–30 LookupTable (java.awt.image), native implementation, 594–6 vs. JTabbedPane, 230–1 384–5 native keyword, 589, 590 FlowLayout (java.awt), 168, 173, threshold filter, 385 native method, 586 224–5 loopback address, see IP Address objects on C side, 607–15 GridBagLayout (java.awt), object methods, 612 234–7 Mac computers, 6, 50 passing parameters, 597–8 GridBagConstraints main(), 32, 50, 253 shared library, 596 (java.awt), 234–7 JNI, 589 string objects, 600–4 GridLayout (java.awt), 168–71, Map (java.util), 336 System.loadLibrary(), 590–1, 224 math 597 set layout manager, 224 Math (java.lang), 53–5, 69 threads, 623–4 SpringLayout (javax.swing), Math functions, 54–5 type signatures, 610 231–4 StrictMath (java.lang), 55 JSP (Java Server Pages), 446–7 lightweight components, 162, 174 vectors and matrices, 123–4 JTabbedPane (javax.swing), see see AWT MediaTracker (java.awt), 367, Swing components heavyweight, 162 368–9, 370 JTextField (javax.swing), see peer component, 162 see images Swing components see Swing MemoryImageSource JVM (Java Virtual Machine), 3, 8, 11, 15, LinkedList (java.util), 336 (java.awt.image), 376–8, 625, 658 Linux/Unix and Java, 6 380 Hotspot JVM, 6 continuation characters, 524 see animations instruction set, 657–8 directory listing, 630 member variables, 59 J2ME, 653–4 directory separators, 516 menus, 244

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

704 Index

metadata, see annotation network architectures, 413–14 overloading, methods, 58, 60–2 application layer, 413, 415 see methods see class network layer, 413 overloading operators, 11, 35 name, 61 transport layer, 413, 415 overriding, 93, 94–100 overloading, 62–3, 95, 96–8 networking, see Java networking @Override annotation, 98–9 see overriding new operator, 35, 66 data fields, 99 parameters, 61, 62, 71–3 notify(), notifyAll(), see threads shadowing variables, 100 polymorphism, 96 null modem, 640 vs. overloading, 96–8 return type, 61 null reference, 40, 331 Microsoft Windows, 6 NumberFormat (java.text), see pack200 tool, 25, 146, 149 directory separators, 523 formatting packages, 132, 133–6 JNI, 586, 588, 591 see access rules JVM 1.1, 6, 8 Oak project, 4 unnamed (default) package, 136, 140 screen resolution, 629 Object (java.lang), 73, 115, 118–19, packet communications, 413–14 storing preferences, 335 328, 337–8 paintComponent() in JComponent, SDK, 17 clone(), 115, 118 179, 183, 193, 390 microservers, 431, 432–5, 448–69 equals(), 73, 118, 330 see graphics see client/servers finalize(), 119 see Swing classes – JComponent see embedded Java hashcode(), 330 Panel (java.awt), 161 middleware, 431 methods, 118–19 panes, see containers for graphics see Java 2 Enterprise Edition (J2EE) notify(), notifyAll(), and components MIDlets, 654 wait(), see synchronization parallel port I/O, see port see Java 2 Micro Edition toString(), 119–20 communications mixing primitives, 46–7 Object-Oriented Analysis and Design path, 147 see cast (OOAD), 473, 474, 558 see CLASSPATH see cast rules Object-Oriented Programming (OOP), 9, see directory separators numeric promotion, 46 10, 58, 84–5, 89–90, 130 see File Model-View-Controller Pattern (MVC), objects (or instances), 58 peer component, 162 482–3, 493–6 immutable, 357 see lightweight components compute engine, 482 instance data, 67 performance, 9, 23, 404–9 controller, 482 see references inlining, 405 model, 482 see I/O with objects see Java hardware – performance Observable (java.util), operators, 30, 36–9 permissions, see SecurityManager 493–5 arithmetic, 53–4, 686 PersonalJava API, see embedded java Observer (java.util), 493–5 assignment, 36, 37, 685 PixelGrabber (java.awt.image), view, 482 associativity, 38–9, 692 375–6 mouse buttons, 394–6 bitwise, 360–1, 689 see color see events Boolean, 688 plug-in JVM for browsers, 22, 149, 164 MouseAdapter (java.awt.event), cast, 691 policy file, see SecurityManager 399 class and object, 690 policytool, 442, 514 adapter classes, 240–2 comparison, 688 see SecurityManager MouseListener, see event listener conditional, 691 polymorphism, 96 MouseMotionListener, see event decrement and increment, 37, popup menu, 396–9 listener 687 port communications, 631–49 multiprocessing, 259–62 precedence, 38–9, 51, 691 javax.comm, 631–40 returned value, 36–7 CommPort, 632, 639 namespaces, 136–7 Observable and Observer, see CommportIndentifier, 632–5 naming service, 479 Model-View-Controller Pattern ParallelPort, 632 see CORBA Outputable interface, 171–2, 270, SerialPort, 632, 637–40 see RMI 649 communication procedure, 637

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

Index 705

finding ports, 632–4 protected, see access rules binding, 507–9 opening ports, 635–7 public, see access rules client, 509–11 port status and ownership, 634–5, 637 client JAR file, 524 serial port I/O, 637–40 Queue (java.util), 336 client/server example, 515–26 RS232, 637–40 codebase, 512–13, 524 DB9 connector pins, 638 random numbers, 126–8 see distributed computing null modem, 640 Gaussian, 88, 127 exceptions, 503–4, 506, 509, 510, example program, 640–9 Random (java.util), 127 518 USB, 631 RandomAccessFile (java.io), exporting, 506 ports, 415–16 302 marshalling, 504 see sockets Raster (java.awt.image), name lookup, 508–11, 543 Preferences API, 327, 331–5 366 policy file, 513–15, 525, 526 examples, 333–4 see BufferedImage registry, 507–9, 524–5, 552, 554–5 exporting and importing, 334 Reader and its subclasses, see streams rmiregistry, 479 listeners, 335 real-time, 654–7 Remote (java.rmi), 506 platform independence, 332 asynchronous event handlers, 656 remote implementation class, system, 334–5 garbage collection, 655–6 506–7 prefs (java.util), 332 happenings, 656 remote interface, 505–6 primitives, 29, 30, 33–4 hard vs. soft, 655 remote objects, 503–5 cast, 44–7 immortal memory, 656 rmic, 504, 523 converting, 46 Java processors, 659 run example on two machines, 527 see data types memory direct access, 656 security manager, 511–12 see floating-point Real-Time Specification for Java security, 511–15 method parameters, 69–70 (RTSJ), 656–7 skeletons, 504 string conversions, 74–6 scoped memory, 656 stub, 504 to/from byte array, 315–17, 649 timing, 656 vs. CORBA, 503, 530–2, 535 see variables threads, 656 vs. socket programming, 469, 502 see wrappers refactoring, 285 Web services, 573–4 PrintStream, see stream classes reference, 31, 66–7 and XML, 574–6 print(), println(), 32, 50–1, 62–3, accessing methods and fields, 67 RMI Client/Server example, 549–72 289 see cast client implementation, 568–9 see stream classes – PrintStream conversions, 116 with histogram, 569–70 see I/O with console in method parameters, 71–3 factory interface, 551–2, 553–6 printf(), 25, 156–7, 289, 293–5 modifying, 70–1 JNI and RMI, 562 see formatted I/O super, 99–100, 183 security, 551 see stream classes – PrintStream this, 99–100, 256, 612 server implementation, 556–67 printing graphics, 390–2 variables, 69–70 server interface, 552–3 JobAttributes (java.awt), 392 vs. C/C++ pointers, 66, 112 server pool, 553 PageAttributes (java.awt), regular expressions, 352 spring simulation, 549–50, 560–7 392 java.util.regex, 363 RPC (Remote Procedure Calls), PrintGraphics (java.awt), 390 rendering hints, 184–5, 186 502 PrintJob (java.awt), 392 see Java 2D run external programs, 629–31 priority inversion, see threads RescaleOP (java.awt.image), 381, Process, 629–31 private, see access rules 385 Runtime, 629–31 Process (java.lang), 629–31 see image filtering Runnable (java.lang), 109–10, 254, Properties (java.util), 327, RGB, see color 256–8 330–1, 335, 336, 392 rigid area, 227 concurrency utilities, 341, 342 see Hashtable RMI (Remote Method Invocation) API, see applets see Preferences API 26, 417, 429–30, 471, 479, see threads system properties, 625–9 501–29 Runtime (java.lang), 629–31

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

706 Index

SampleModel (java.awt.image), sockets, 426–8, 434–5, 448 DataInputStream, 310, 316, 649 366 benefits and shortcomings, 469 DataOutputStream, 309, 316, see BufferedImage Client/Server, 428–9 453 see Raster see DatagramSocket FileInputStream, 301–12, 316 sample, 366 ports, 415–16 web server example, 436 sandbox, 625 see ServerSocket FileOutputStream, 301–12, Scanner (java.util), 289, 295, Web server, 431 316 298–9, 307–9 SortedMap (java.util), 336 FileReader,FileWriter, 301–9 see I/O with text SortedSet (java.util), 336 FilterInputStream, scope, 238 sRGB, see colors FilterOutputStream, 313, screen properties, 629 Stack (java.util), 336, 362 317–18, 323–5 scrollbars, 171, 221 standard extensions, see Java InputStream, 289, 295 SDK, see Java programming starter programs, 20–3 from URL, 419 security, 9, 417, 439–43, 551 statements, 31, 39–44 InputStreamReader, 290, 419 with RMI, 511–15 compound, 39 for socket stream, 426, 434–5 SecurityManager (java.lang), 9, conditional, 40–1 ObjectOutputStream, 424, 439–40, 511–12 declarations, 40 ObjectInputStream, 313 and applets, 419, 626 enhanced for loop, OutputStream, 289, 294, 295, 321, policy file, 440–1, 513–15 flow control, 41–4 323 permissions, 440, 442–3, 513–15 loops, 41–3 OutputStreamWriter, 291, 313 policytool, 442, 514 switch, 43–4 PrintStream, 289, 293, 295, 674 with RMI, 511–12 static keyword, 67 deprecated constructors, 291 serial port I/O, see port communications static (or class) members, 67–9 see formatted I/O – printf() serialization, see I/O with objects static import, 25, 115, 141–3 see I/O with console servers, see client/server see constants print(), println(), 32, 50–1, server pool, 553 see import 62–3, 289 ServerSocket, 428–9, 432–3, 434, streams, 287, 289–90 printf(), 25, 156–7, 289, 293–5 448, 449, 450 buffered, 290–1, 296–8, 317–18 PrintWriter, 291, 293 see sockets choosing, 315 for socket stream, 426, 434–5, 436, servlets, 446–7 destination, 317–18 453 see Web services histogram example, 321–3 Reader, 289, 291 Set (java.util), 336 file, 301–12 Writer, 289, 291–5 setter methods, 153 filters, 317–18 strictfp, 12, 50, 695 shadowing variables, see overriding histogram example, 323–5 see floating-point short,34 flushing buffers, 290, 293, 456 StrictMath (java.lang), 55 see integers see I/O see math see primitives input examples, 315 String (java.lang), 12, 35, 50, Short (java.lang), see wrappers for networking, 416–17 76 primitives output examples, 315 `+’ append operator, 35, 76 SIMM (Singe Inline Memory Module), piped, 326 array example, 120 661 wrappers, 287, 290–1 from objects, 119–20 simulations with Java, 10 8-bit, 291–9 methods, 349–50 see animations 16-bit, 291 split(), 352–3, 435, 674 see RMI Client/Server example stream classes from java.io valueOf(),76 SNAP from Imsys Technologies, 663 BufferedReader, 290–1, 419 StringBuffer (java.lang), 351 see Java hardware for socket stream, 426, 434–5, 453 StringBuilder (java.lang), 26, programming SNAP, 671–9 ByteArrayInputStream, 316, 295, 351 Web server example, 671–9 649 StringTokenizer (java.util), Socket (java.net), 426, 432–3, ByteArrayOutputStream, 316, 327, 352 443 321 strut, 227

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

Index 707

subclass, see inheritance notify(), notifyAll(), wait(), thread context switching, 260–1 super, see reference 119, 269–70, 272–3 non-preemptive (cooperative), 260 super(), 101–2 see Object preemptive (time-slicing), 260 see constructors synchronized, 268, 269 time superclass, see inheritance System.arrayCopy(), 121 see date and time formatting Swing, 25, 160, 162–4 System.err, see I/O with console System.currentTimeMillis(), class hierarchy, 163–4 System.getProperties(), 356, 405 double buffering, 372 330 timers, 281–5 see graphics System.in, see I/O with console clock examples, 282–3, 284–5 javax.swing, 163 System.out, see I/O with console Timer (java.swing), 282, see Swing components system properties, 625–9 284–5 J2SE5.0 improvements, 24 see properties Timer (java.util), 282–3 see laying out components TimerTask (java.util), 282–3 see layout managers Taglets API, see Javadoc timing, 260, 356, 404–9 text display, 171–4 TCP (Transmission Control Protocol), and profilers, 404 Swing components 413, 415 TINI (Tiny InterNet Interface), 661–3 Box, 226–8 text display, see Swing SLUSH command shell, 661 JApplet, 164–6, 188, 247 text drawing, see Graphics SNAP card from Imsys Technologies, JButton, 166–7 this, see reference 663 JCheckBox, 212, 214–16 this(), 100–1 see Java hardware JComponent, 163 see constructors transient, 314 JDialog, 163, 164–6 threads, 9, 10, 253–8 see I/O with objects JFileChooser, 318–20 see animations TreeMap (java.util), 336 JFrame, 163, 164–6 communicating, 262, 272–6 TreeSet (java.util), 336 JLabel, 167 data race, see synchronization Toolkit (java.awt), 191, 392, 394, JList, 212, 218–21 see concurrency features 629 JMenu, 244 exclusive, 262, 267–72 JMenuBar, 244 non-interacting, 262, 263–4 UDP (User Datagram Protocol), 415 JMenuItem, 244 priority, 261–2, 264 see datagrams JPanel, 166–7, 174, 183, 224 priority inversion, 656 UML (Unified Modeling Language), 130, JPopupMenu, 396–9 producer/consumer, 272–6 471, 494–6 JRadioButton, 212, 216–18 real-time, 656 association, 494 JScrollPane, 171, 221 resources per thread, 260 class diagrams, 474, 487–90, 494, JSlider, 212, 221–3 run(), 253, 254–5, 256–8 498–500 JTabbedPane, 230–1 servers, 433–4, 449 client/server, 475–7, 481–90 JTextArea, 170, 171–3 stopping, 258–9 see collaboration diagrams JTextField, 167, 168, 171, 251, see synchronization collaborator, 478 449 task splitting, 262, 265–6 conceptual model, 474, 476 JPasswordField, 449 Thread subclass vs. Runnable, see design patterns JWindow, 166 257–8 generalization (inheritance), 488, switch statement, 43–4 see thread context switching 494 break,44 using Runnable, 256–8 interaction diagrams, 474–5 case,44 see Runnable interface, 488 default,44 using Thread subclass, 254–5 introduction, 473–5 type of switch variable, 44 Thread (java.lang), 254 iteration notation, 480 symbols, 684 sleep(), 254, 260, 262, 277, operations and attributes, 474, 487 see Java 281 polling, 489 synchronization, 119, 267, 272–6 subclass, 254–5, 257–8 realization, 489, 494 data race, 253, 267, 271 yield(), 260, 262 sequence diagrams, 475 lock, 267, 269–70, 272 start(), 254, 256 sequence numbers, 477

© Cambridge University Press www.cambridge.org Cambridge University Press 0521821134 - JavaTech: An Introduction to Scientific and Technical Computing with Java Clark S. Lindsey, Johnny S. Tolliver and Thomas Lindblad Index More information

708 Index

Unicode, 34, 79, 290, 312–13 Vector (java.util) 123, 327, 328–9, WindowListener, see event listener see char 335, 337 wrappers for primitives, 73–9, 329 see character encoding in example program, 452 see autoboxing and unboxing unsigned short, performance, 405–8, 409 Double,74 see char Virtual Peripheral (VP), see Java parseDouble(),75 see integers hardware Float,76 see primitives Integer, 74, 77, 78 URL web client application, 443–5 parseInt(), 75, 80–3 from File, 419 web server, 431–45, 448–69 string conversions, 74–6 loading image, 190, 417 applications of, 445–6 see primitives MalformedURLException client application example, 443–5 table, 74 (java.net), 419 see client/server wrappers for streams, 287, 290–1 reading file, 419–23 design, 432–5 see streams URL (java.net), 417–23, embedded example, 671–9 WritableRaster 512–13 see microservers (java.awt.image), 379, 380 URL components, 417 security, 439–43 see BufferedImage utilities, servlets and JSP, 432–3, 579–80 see Raster see bit handling threads, 433–4 Writer and its subclasses, see streams see Collections Framework socket based, 431 concurrency utilities, 285, 341–3 web services, 12 XML, 12, 574–6 see generics and distributed computing, 573–4 DOM, 578 java.util, 327–8 introduction, 573–81 DTD, 577, 578 see Preferences API Java, 578–80 Namespaces, 577 JWSDP (Java Web Services Developer parsers, 578 varargs (variable argument list), Pack), 13, 579, 581 preferences export/import, 334 25 servlets, 579–80 SAX, 578 variables SOAP, 580 Schema, 577, 578 default values, 60 technical applications, 580 Swing Synth, 24 local, 61, 62 UDDI, 580 tag defintions, 577 member, 62 XML, 574–6 primitives, 69–70 while, do-while loops, 42–3 zip compression passed by value, 69–70 whois service, 426–8 see JAR see references Window (java.awt), 161 java.util.zip, 287, 363

© Cambridge University Press www.cambridge.org