net.sf.jcgm.core
Class Command

java.lang.Object
  extended by net.sf.jcgm.core.Command
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
AlternateCharacterSetIndex, ApplicationData, BackgroundColour, BeginApplicationStructureBody, BeginMetafile, BeginPicture, BeginPictureBody, BeginTileArray, BitonalTile, CapCommand, CellArray, CharacterCodingAnnouncer, CharacterExpansionFactor, CharacterHeight, CharacterOrientation, CharacterSetIndex, CharacterSetList, CharacterSpacing, CircleElement, CircularArc3Point, CircularArcCentre, ClipIndicator, ClipRectangle, ColourCommand, ColourIndexPrecision, ColourModel, ColourPrecision, ColourSelectionMode, ColourTable, ColourValueExtent, DashTypeCommand, DeviceViewportSpecificationMode, DisjointPolyline, EdgeVisibility, EdgeWidth, EdgeWidthSpecificationMode, EllipseElement, EndApplicationStructure, EndMetafile, EndPicture, EndTileArray, Escape, FontList, HatchIndex, IndexPrecision, IntegerPrecision, InteriorStyle, InteriorStyleSpecificationMode, JoinCommand, LineAndEdgeTypeDefinition, LineWidth, LineWidthSpecificationMode, MarkerSize, MarkerSizeSpecificationMode, MarkerType, MaximumColourIndex, MaximumVDCExtent, MessageCommand, MetafileDefaultsReplacement, MetafileDescription, MetafileElementList, MetafileVersion, NamePrecision, NoOp, PolyBezier, PolygonElement, PolygonSet, Polyline, PolyMarker, RealPrecision, RectangleElement, RestrictedTextType, ScalingMode, TextAlignment, TextCommand, TextFontIndex, TextPath, TextPrecision, Tile, VDCExtent, VDCIntegerPrecision, VDCRealPrecision, VDCType

public class Command
extends java.lang.Object
implements java.lang.Cloneable

Base class for all the CGM commands.

Notes from the Java Language Reference: The integral types are byte, short, int, and long, whose values are 8-bit, 16-bit, 32-bit and 64-bit signed two's-complement integers, respectively, and char, whose values are 16-bit unsigned integers representing Unicode characters.

Version:
$Id: Command.java 47 2011-12-14 08:52:12Z phica $
Author:
xphc (Philippe Cadé), BBNT Solutions

Field Summary
protected  int[] args
          All the command parameters
protected  int currentArg
          The current command parameter we're reading
 
Constructor Summary
Command(int ec, int eid, int l, java.io.DataInput in)
          The base class for all commands.
 
Method Summary
protected  void alignOnWord()
          Align on a word boundary
 java.lang.Object clone()
           
 int getElementClass()
          Returns the element class for this command
 int getElementCode()
          Returns the element ID for this command
protected  void info(java.lang.String message)
           
protected  byte makeByte()
           
protected  char makeChar()
           
protected  int makeColorIndex()
           
protected  int makeColorIndex(int precision)
           
protected  java.awt.Color makeDirectColor()
           
protected  int makeEnum()
           
protected  double makeFixedPoint()
           
protected  java.lang.String makeFixedString()
           
protected  double makeFloat32(int i)
           
protected  double makeFloatingPoint()
           
protected  double makeFloatingPoint32()
           
protected  int makeIndex()
           
protected  int makeInt()
           
protected  int makeName()
           
protected  java.awt.geom.Point2D.Double makePoint()
           
protected  double makeReal()
           
protected  StructuredDataRecord makeSDR()
           
protected  int makeSignedInt16()
           
protected  int makeSignedInt24()
           
protected  int makeSignedInt32()
           
protected  int makeSignedInt8()
           
protected  double makeSizeSpecification(SpecificationMode specificationMode)
           
protected  java.lang.String makeString()
           
protected  int makeUInt(int precision)
           
protected  double makeVc()
           
protected  double makeVdc()
           
 void paint(CGMDisplay d)
           
protected  java.lang.String printShape(java.awt.Shape s)
          Returns a descriptive string of the given shape
static Command read(java.io.DataInput in)
          Reads one command from the given input stream.
protected static Command readCommand(java.io.DataInput in, int ec, int eid, int l)
           
protected  int sizeOfDirectColor()
           
protected  int sizeOfEnum()
           
protected  int sizeOfInt()
           
protected  int sizeOfPoint()
           
protected  int sizeOfVdc()
           
 java.lang.String toString()
           
protected  void unimplemented(java.lang.String message)
           
protected  void unsupported(java.lang.String message)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

args

protected int[] args
All the command parameters


currentArg

protected int currentArg
The current command parameter we're reading

Constructor Detail

Command

public Command(int ec,
               int eid,
               int l,
               java.io.DataInput in)
        throws java.io.IOException
The base class for all commands.

Parameters:
ec - The element class
eid - The element ID
l - The number of arguments for the command
in - The input stream used to read the command
Throws:
java.io.IOException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

makeFixedString

protected final java.lang.String makeFixedString()

makeString

protected final java.lang.String makeString()

makeByte

protected final byte makeByte()

makeChar

protected final char makeChar()

makeSignedInt8

protected final int makeSignedInt8()

makeSignedInt16

protected final int makeSignedInt16()

makeSignedInt24

protected final int makeSignedInt24()

makeSignedInt32

protected final int makeSignedInt32()

makeInt

protected final int makeInt()

sizeOfInt

protected final int sizeOfInt()

makeIndex

protected final int makeIndex()

makeName

protected final int makeName()

makeUInt

protected final int makeUInt(int precision)

makeVdc

protected final double makeVdc()

sizeOfVdc

protected final int sizeOfVdc()

makeVc

protected final double makeVc()

makeReal

protected final double makeReal()

makeFixedPoint

protected final double makeFixedPoint()

makeFloatingPoint

protected final double makeFloatingPoint()

makeFloatingPoint32

protected final double makeFloatingPoint32()

makeEnum

protected final int makeEnum()

sizeOfEnum

protected final int sizeOfEnum()

makePoint

protected final java.awt.geom.Point2D.Double makePoint()

sizeOfPoint

protected final int sizeOfPoint()

makeColorIndex

protected final int makeColorIndex()

makeColorIndex

protected final int makeColorIndex(int precision)

makeDirectColor

protected final java.awt.Color makeDirectColor()

sizeOfDirectColor

protected final int sizeOfDirectColor()

makeFloat32

protected final double makeFloat32(int i)

makeSizeSpecification

protected final double makeSizeSpecification(SpecificationMode specificationMode)

makeSDR

protected final StructuredDataRecord makeSDR()

alignOnWord

protected final void alignOnWord()
Align on a word boundary


paint

public void paint(CGMDisplay d)

read

public static Command read(java.io.DataInput in)
                    throws java.io.IOException
Reads one command from the given input stream.

Parameters:
in - Where to read the command from
Returns:
The command or null if the end of stream was found
Throws:
java.io.IOException - On I/O error

readCommand

protected static Command readCommand(java.io.DataInput in,
                                     int ec,
                                     int eid,
                                     int l)
                              throws java.io.IOException
Throws:
java.io.IOException

info

protected final void info(java.lang.String message)

unsupported

protected final void unsupported(java.lang.String message)

unimplemented

protected final void unimplemented(java.lang.String message)

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

getElementClass

public int getElementClass()
Returns the element class for this command

Returns:
An integer representing the class

getElementCode

public int getElementCode()
Returns the element ID for this command

Returns:
An integer representing the identifier

printShape

protected java.lang.String printShape(java.awt.Shape s)
Returns a descriptive string of the given shape

Parameters:
s - The shape to describe
Returns:
A string containing the coordinates to make the shape


Part of the jcgm library http://jcgm.sourceforge.net/