<< Chapter < Page
  Digital signal processing - dsp     Page 11 / 27
Chapter >> Page >

Plot the data

The statement in Listing 3 calls the overloaded plotData method to cause all of the pages belonging to the plotting object titled "A" to be stacked in alocation where the upper left corner of the stack is 401 pixels to the right of the upper left corner of the screen.

Listing 3. Plot the data.
plotObjectA.plotData(401,0);

As described earlier, page 0 containing the earliest data fed to the plotting object is on the top of the stack. Figure 1 shows the two pages belonging to this plotting object after they have been manually rearranged to make them bothvisible.

Feed and plot the object titled "B"

Listing 4 feeds 2600 random white noise values to the object titled "B" and displays the pages in the default location in the upper left corner of thescreen. Listing 4 also signals the end of the main method.

Listing 4. Feed and plot the object titled "B".
for(int cnt = 0;cnt<2600;cnt++){ plotObjectB.feedData((Math.random() - 0.5)*25); }//end for loopplotObjectB.plotData();}//end main

Listing 4 (plus one of the statements in Listing 1 ) is much more typical of the amount of code required to use this plotting class than was thecase with Listing 2 .

(Almost all of the code in Listing 2 was required to set the special data values used to test the transitions discussed earlier.)

The three steps

To recap, the three steps required to use this class for plotting nearly unlimited amounts of data are:

  1. Instantiate a plotting object of the class named PlotALot01 , as in Listing 1 .
  2. Call the feedData method once for each data value that is to be plotted, as in Listing 4 .
  3. Call the plotData method on the plotting object afterall of the data has been fed to the plotting object, as in Listing 3 or Listing 4 .

Some instance variables

Continuing with the class definition for the class named PlotALot01 , Listing 5 shows several instance variables that belong to a plotting object instantiatedfrom this class.

Listing 5. Some instance variables.
String title; int frameWidth;int frameHeight; int traceSpacing;//pixels between tracesint sampSpacing;//pixels between samples int ovalWidth;//width of sample marking ovalint ovalHeight;//height of sample marking ovalint tracesPerPage; int samplesPerPage;int pageCounter = 0; int sampleCounter = 0;ArrayList<Page>pageLinks = new ArrayList<Page>();

The purpose of each of these instance variables is indicated by the name of the variable, and in some cases by the comments following the variabledeclaration. In addition, I will have more to say about some of these variables later when I discuss the code that uses them.

(Note the use of generics in the declaration and initialization of the variable named pageLinks . The use of generics dictates that this class requires J2SE 5.0 or later.)

The first overloaded constructor

As mentioned earlier, there are two overloaded versions of the constructor for this class. The overloaded version that begins in Listing 6 accepts several incoming parameters allowing the user to control various aspects of the plottingformat.

Questions & Answers

what is biology
Hajah Reply
the study of living organisms and their interactions with one another and their environments
AI-Robot
what is biology
Victoria Reply
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
lack electricity and its more savely than electronic microscope because its naturally by using of light
Abdullahi Reply
advantage of electronic microscope is easily and clearly while disadvantage is dangerous because its electronic. advantage of light microscope is savely and naturally by sun while disadvantage is not easily,means its not sharp and not clear
Abdullahi
cell theory state that every organisms composed of one or more cell,cell is the basic unit of life
Abdullahi
is like gone fail us
DENG
cells is the basic structure and functions of all living things
Ramadan
What is classification
ISCONT Reply
is organisms that are similar into groups called tara
Yamosa
in what situation (s) would be the use of a scanning electron microscope be ideal and why?
Kenna Reply
A scanning electron microscope (SEM) is ideal for situations requiring high-resolution imaging of surfaces. It is commonly used in materials science, biology, and geology to examine the topography and composition of samples at a nanoscale level. SEM is particularly useful for studying fine details,
Hilary
cell is the building block of life.
Condoleezza Reply
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Digital signal processing - dsp. OpenStax CNX. Jan 06, 2016 Download for free at https://legacy.cnx.org/content/col11642/1.38
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?

Ask