|
JNISpice version 2.0.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectspice.basic.DAS
spice.basic.DLA
public class DLA
Class DLA supports forward and backward list traversal of DLA files.
The numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation.
At the prompt, enter the name of the DSK file phobos_3_3.bds.
Example code begins here.
import java.io.*; import spice.basic.*; public class DLAEx1 { // // Load the JNISpice shared library. // static{ System.loadLibrary( "JNISpice" ); } public static void main( String[] args ) { // // Local variables // DLA dla; DLADescriptor dladsc; String dlaname; boolean found; int segno; try { // // Get the name of the DLA file to read; open the file // for read access. // dlaname = IOUtils.prompt( "Name of DLA file > " ); dla = DLA.openForRead( dlaname ); // // Begin a forward search. An exception will be thrown // if the file doesn't contain at least one segment. // segno = 0; dladsc = dla.beginForwardSearch(); found = true; while ( found ) { ++segno; System.out.format ( "%n" + "Segment number = %d%n" + "%n" + " Backward segment pointer = %d%n" + " Forward segment pointer = %d%n" + " Integer component base address = %d%n" + " Integer component size = %d%n" + " D.p. component base address = %d%n" + " D.p. component size = %d%n" + " Character component base address = %d%n" + " Character component size = %d%n" + "%n", segno, dladsc.getBackwardPointer(), dladsc.getForwardPointer(), dladsc.getIntBase(), dladsc.getIntSize(), dladsc.getDoubleBase(), dladsc.getDoubleSize(), dladsc.getCharBase(), dladsc.getCharSize() ); // // Find the next segment, if there is one. // found = dla.hasNext( dladsc ); if ( found ) { dladsc = dla.getNext( dladsc ); } } } catch ( java.io.IOException exc ) { // // Handle exception raised by IOUtils.prompt call. // exc.printStackTrace(); } catch ( SpiceException exc ) { exc.printStackTrace(); } } }
When this program was executed on a PC/Linux/gcc/64-bit/java 1.5 platform, the output was:
Name of DLA file > phobos_3_3.bds Segment number = 1 Backward segment pointer = -1 Forward segment pointer = -1 Integer component base address = 11 Integer component size = 3311271 D.p. component base address = 0 D.p. component size = 494554 Character component base address = 0 Character component size = 0
At the prompt, enter the name of the DSK file phobos_3_3.bds.
Example code begins here.
import java.io.*; import spice.basic.*; public class DLAEx2 { // // Load the JNISpice shared library. // static{ System.loadLibrary( "JNISpice" ); } public static void main( String[] args ) { // // Local variables // DLA dla; DLADescriptor dladsc; String dlaname; boolean found; int segno; try { // // Get the name of the DLA file to read; open the file // for read access. // System.out.format( "%n" ); dlaname = IOUtils.prompt( "Name of DLA file > " ); dla = DLA.openForRead( dlaname ); // // Begin a backward search. An exception will be thrown // if the file doesn't contain at least one segment. // segno = 0; dladsc = dla.beginBackwardSearch(); found = true; while ( found ) { ++segno; System.out.format ( "%n" + "Segment number (offset from end of file) " + "= %d%n" + "%n" + " Backward segment pointer = %d%n" + " Forward segment pointer = %d%n" + " Integer component base address = %d%n" + " Integer component size = %d%n" + " D.p. component base address = %d%n" + " D.p. component size = %d%n" + " Character component base address = %d%n" + " Character component size = %d%n" + "%n", segno - 1, dladsc.getBackwardPointer(), dladsc.getForwardPointer(), dladsc.getIntBase(), dladsc.getIntSize(), dladsc.getDoubleBase(), dladsc.getDoubleSize(), dladsc.getCharBase(), dladsc.getCharSize() ); // // Find the previous segment, if there is one. // found = dla.hasPrevious( dladsc ); if ( found ) { dladsc = dla.getPrevious( dladsc ); } } } catch ( java.io.IOException exc ) { // // Handle exception raised by IOUtils.prompt call. // exc.printStackTrace(); } catch ( SpiceException exc ) { exc.printStackTrace(); } } }
When this program was executed on a PC/Linux/gcc/64-bit/java 1.5 platform, the output was:
Name of DLA file > phobos_3_3.bds Segment number (offset from end of file) = 0 Backward segment pointer = -1 Forward segment pointer = -1 Integer component base address = 11 Integer component size = 3311271 D.p. component base address = 0 D.p. component size = 494554 Character component base address = 0 Character component size = 0
Field Summary |
---|
Fields inherited from class spice.basic.DAS |
---|
fileName, handle, readable, writable |
Constructor Summary | |
---|---|
|
DLA()
No-args constructor. |
protected |
DLA(DAS das)
Construct a DLA instance from a DAS instance. |
protected |
DLA(java.lang.String filename)
|
Method Summary | |
---|---|
DLADescriptor |
beginBackwardSearch()
Start a backward search on a DLA file. |
DLADescriptor |
beginForwardSearch()
Start a forward search on a DLA file. |
DLADescriptor |
getNext(DLADescriptor DLADescr)
Get the DLA descriptor of the successor of a given DLA segment. |
DLADescriptor |
getPrevious(DLADescriptor DLADescr)
Get the DLA descriptor of the predecessor of a given DLA segment. |
int |
getSegmentCount()
Count the segments in a DLA file. |
boolean |
hasNext(DLADescriptor DLADescr)
Indicate whether a DLA segment has a successor. |
boolean |
hasPrevious(DLADescriptor DLADescr)
Indicate whether a DLA segment has a predecessor. |
static DLA |
openForRead(java.lang.String filename)
Open a DLA file for read access. |
Methods inherited from class spice.basic.DAS |
---|
addComments, close, deleteComments, getCommentCharacterCount, getCommentRecordCount, getFileName, getHandle, getInternalFileName, isReadable, isWritable, openForWrite, readComments |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected DLA(java.lang.String filename) throws SpiceErrorException
SpiceErrorException
public DLA()
protected DLA(DAS das) throws SpiceException
The DAL file must have type DLA or DSK.
User applications will not need to call this
constructor directly. See the methods openForRead(java.lang.String)
and DAS.openForWrite(java.lang.String)
.
SpiceException
Method Detail |
---|
public static DLA openForRead(java.lang.String filename) throws SpiceException
SpiceException
public DLADescriptor beginForwardSearch() throws SpiceException
An exception is thrown if the file contains no segments.
SpiceException
public DLADescriptor beginBackwardSearch() throws SpiceException
An exception is thrown if the file contains no segments.
SpiceException
public boolean hasNext(DLADescriptor DLADescr) throws SpiceException
SpiceException
public boolean hasPrevious(DLADescriptor DLADescr) throws SpiceException
SpiceException
public DLADescriptor getNext(DLADescriptor DLADescr) throws SpiceException
SpiceException
public DLADescriptor getPrevious(DLADescriptor DLADescr) throws SpiceException
SpiceException
public int getSegmentCount() throws SpiceException
SpiceException
|
JNISpice version 2.0.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |