Two class needs to be extends, So I need some  WorkAround ...

I have a Simple Question
for accessing SAP PI MAPPING API in ECLIPSE .
I need to extend one class AbstractTransformation ....
similary for getting SAX Parser functionalty in ECLIPSE , I need to extend class DefaultHandler..
So How to Handle this Case : Two class needs to be extends and I know only one class can be extend .
So JAVA GURUS , I need some workaround .
Regards
PS

Hi,
First of all Java does not allow multiple inheritance ie u can extend from only one base class.
work around :
write two seperate java class say
1. myJavaMapping.java which extends AbstractTransformation.
2. mySaxParser.java which extends DefaultHandler
And now create an object of mySaxParser in ur myJavaMapping class(see below code).
                mySaxParser parser = new mySaxParser(out);                             //Out is the outputstream
          SAXParserFactory factory = SAXParserFactory.newInstance(); //standard class
          try
               SAXParser saxParser = factory.newSAXParser();              //standard class
               this.out = out;
               saxParser.parse(in, parser);                                                 //begin parsing                                                                               
// in is inputstream object & has input XML
          catch(Exception e)
               e.printStackTrace();
Hope it is clear,
Anand

Similar Messages

  • Small network, two VLANs, need some guidance

    Hello. Big-time newbie here. I have a Cisco 2801 router and a few Cisco SG200-26 switches. I need to configure two VLANs: vlan10 for public wifi access and vlan20 for private staff use. I have fa0/0 configured with IP 192.168.1.2/24. This interface will be connected to an AT&T DSL gateway for Internet service. I have fa0/1 configured with IP 172.16.1.1/16. The goal is to provide Internet access to both VLANs, but no routing between VLANs. I am also enabling a DHCP pool of 172.16.10.0/22 intended for use on vlan10 (public wifi access) and another DHCP pool of 172.16.20.0/24 for vlan20 (private staff). I assume fa0/1 has to be configured for dot1q trunking and connected to a switch port also configured for trunking, yes? I also have WAPs that will need to serve up both VLANs. The WAPs I have are 121 and 2600 series. I assume I will be creating two SSIDs - one for each VLAN, yes?
    I am looking to keep this as simple as possible.
    What else do I need to consider? thank you in advance for your guidance.

    thanks for ur valuable reply.
    u r right that whenever we create a new db, oracle always assigns a new dbid. which will be different from the id of backupset db.
    kindly explain me steps to perform, whether it is duplicate db case or standby.
    how rman will recoganize the backupset.

  • General purpose class (Need some Help)

    I have a situation where Id like to have getText() and setText() methods in various components, some of which dont define the method, ie JComboBox, JRadioButton ect.....
    Now I know I could subclass the components Id like to add this functionality to but Im trying to make my code as easy to use as possible an really would hat to do this in this case...
    Id much rather have a single class which could handle each component through constructors; This too though has some issues which Im not sure I want to deal with. (if youd like more info on my issues with this technique just request) ..
    The problem stems from the various ways with wich text would be extracted from the component, JComboBox, getSelected()
    JRadioButton

    You could define an interface that has these methods. Then you create subclasses that implement this interface for the components JLabel, JRadioButton etc. This way you can refer to every component in the same way; eg. you can have an array of them and call getText() on each of them independent of what components they realy are. Instantiating can be made easier with reflection: you canhave a new class that has a static method that takes the class name and the constructor's parameter list as parametetrs and returns a new obect. A bit like JComponent comp = (JComponent) Class.forName("javax.swing.JLabel").newInstance();
    Another possibility is writing a new class that extends JComponent and has a JComponent as a member. In the constructor you define the underlaying component's actual class and then act accordingly in the get/set methods. Like having a general wrapper for any JComponent.

  • Is it possible to extend two classes?

    I want to do something like :
    public class C extends A, B {
    public class E extends A, D {
    }The two classes have things in A in common, but have to extend other different classes (B, D) as there are other differences.

    Make A an interface. I mean it. Make A an interface.Thanks for the suggestion but I have identical code to duplicate and wanted an abstract class
    class A{
       private String commonValue;
       public String getCommonValue() { return commonValue; }
       public void processSomething() {
           // Will be identical code for every class needing A
    }I guess I need to make another abstract class and have that extend and than the parent class extend this..
    Just seems annoying to duplicate the same code 5 times
    Message was edited by:
    smiles78

  • How do you have two classes drawing to the same JPanel? Graphics g problem

    Hi all,
    This is probably a five second answer but im really stuck on it!
    How do i have two classes both writing to the same JPanel?
    I have one class that extends JPanel and using Graphics g, draws to the panel ie g.drawString(..);
    But i would like another class to draw to the same panel, so that the two different classes can both draw what they like to the JPanel.
    How do i do this?
    I have tried sending the Graphics g object from the one class to the other but only the original class draws still. I was thinking perhaps if it carn't be done could i have a JPanel on top of the other one that is transparent so there would be a tracing paper effect?
    Many thanks

    I have tried sending the Graphics g object from the
    one class to the other but only the original class
    draws still. I was thinking perhaps if it carn't beThis is the right idea. One problem you may be running into is that JPanel fills in its background with the background color by default. If you switch and use JComponent instead of JPanel you may get better results. Another idea is to use a "painter": a class that has a paint(Graphics g) but is not a component and just paints on a component. I've done this before in implementing Tetris where the dropping piece is a class which can paint itself but is not a component.

  • Things Visible in Two Classes

    I'm developing a program using two classes: "Analysis.class" and "AnalysisCalc.class", each in separate files. I don't desire to import either class via package design. I'm trying to call a method from "AnalysisCalc.class" using variables visible to both classes. The intent of the program is to decrement a variable using a while loop. The intent of using "AnalysisCalc.class" is to manage my code better rather than consolidate all the code in "Analysis.class". How do I modify the following source code for these classes?
    (NOTE: Don't worry about other aspects of program such as I/O since I know how to handle that )
    // Analysis Program: Analysis.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Analysis extends JApplet implements ActionListener {
         double variableX;
         boolean variableA, variableB;
         public void init()
              variableX = 0;          
              variableA = true;
              variableB = true;
         } // end method init     
         public void strt()
              while(variableB){                    
                   rundata();
                   if( variableX < 10 )
                        variableB = false;
         }  // end method strt
         strt();
    } //end class Analysis
    // AnalysisCalc.java
    public class AnalysisCalc {  
         // AnalysisCalc constructor
         public AnalysisCalc()
              rundata( );
         public void rundata( )
              if( variableA == true)
                   variableX = 100;
                   variableA = false;
              variableX--;
    } // end class AnalysisCalc

    OK, forget the code I posted previously.
    The following code in files Trajectory.java and Calculate.java have a similar problem. I'm trying to get my method set up simple with a decrement logic because later the logic for the method will become more complex. I want to keep all this complex code out of the Trajectory.java file and manage it from the Calculate.java file. I would set up package and import design, but my ISP will not accept package design in building website since fully qualified names must be used to avoid naming conflicts.
    key code segments in file trajectory.java, being analogous to Analysis.java, include--->
    Calculate Z = new Calculate();
    while(sentinel){
    Z.rundata();
    if( altitude < 10 )
    sentinel = false;
    The file analogous to AnalysisCalc.java is Calculate.java
    // Trajectory Analysis Program: Trajectory.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Trajectory extends JApplet implements ActionListener {
         final double MAX = 90.0;
         final double MIN = -90.0;
         final double MAX_ALTITUDE = 2000000.0;
         final double MIN_ALTITUDE = 0.0;
         private JTextArea introductionArea, resultsArea;
         private JLabel spanLabel, chordLabel,
              thicknessLabel, massLabel, altitudeLabel, velocityLabel,
              trajectory_angleLabel, time_incrementLabel, rotation_factorLabel,
              calculationLabel, resultsLabel;
         private JTextField spanField, chordField, thicknessField,
              massField, altitudeField, velocityField, trajectory_angleField,
              time_incrementField, rotation_factorField;
         private JButton startButton, resetButton, contButton, abortButton;
         String introduction_string, span_string, chord_string, thickness_string, mass_string,
              altitude_string, velocity_string, trajectory_angle_string,
              time_increment_string, rotation_factor_string, results_string;
         public double span, chord, thickness, mass, altitude, velocity, trajectory_angle, time_increment,
              rotation_factor, distance, velocity_fps, elapsed_time;
         boolean value, sentinel;
         // create objects
         public void init()
              Calculate Z = new Calculate();
              span = 0;
              chord = 0;
              thickness = 0;
              mass = 0;
              altitude = 0;
              velocity = 0;
              trajectory_angle = 0;
              time_increment = 0;
              rotation_factor = 0;
              distance = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              value = true;
              sentinel = true;
              introduction_string =
                   "DEBRIS TRAJECTORY PROGRAM\n" 
                   + "designed by Weldon K. Chafin, Jr.\n\n"
                   + "Inspired by the brave heroes of the Columbia Accident "
                   + "of February 1, 2003.\n\n"
                   + "This program determines trajectory for an object modeled "
                   + "as a rectangular prism having given mass falling through "
                   + "the atmosphere. The object is assumed to oscillate with same "
                   + "frequency about all six possible permutations for axis "
                   + "angular velocity vectors as the means to simulate "
                   + "equally likely random events.\n\n"
                   + "NOTE: This program is still under construction. "
                   + "I predict this program will be fully functional by October 4, 2003. "
                   + "Then it should have calculation capability comparable to the C++ program version I created "
                   + "for the Columbia Accident Investigation Board (CAIB) to predict locations of Columbia debris. "
                   + "In fact, the CAIB forwarded my program as an analytical tool to NASA "
                   + "JSE Early Sightings Assessment Team tasked with finding high interest "
                   + "Columbia debris items via radar imaging.";
              span_string = "";
              chord_string = "";
              thickness_string = "";
              mass_string = "";
              altitude_string = "";
              velocity_string = "";
              trajectory_angle_string = "";           
              time_increment_string = "";
              rotation_factor_string = "";
              results_string = "";
              // create container & panel
              Container container = getContentPane();     
              Panel panel = new Panel( new FlowLayout( FlowLayout.LEFT));
              container.add( panel );
              // set up vertical boxlayout
              Box box = Box.createVerticalBox();
              Box inputbox1 = Box.createHorizontalBox();
              Box inputbox2 = Box.createHorizontalBox();
              Box inputbox2a = Box.createHorizontalBox();
              Box inputbox2b = Box.createHorizontalBox();
              Box inputbox2c = Box.createHorizontalBox();
              Box inputbox2d = Box.createHorizontalBox();
              Box inputbox3 = Box.createHorizontalBox();
              Box buttonbox = Box.createHorizontalBox();
              // set up introduction
              introductionArea = new JTextArea( introduction_string, 10, 50 );
              introductionArea.setEditable( false );
              box.add( new JScrollPane( introductionArea ) );
              box.add( Box.createVerticalStrut (10) );
              box.add( inputbox1);
              box.add(inputbox2a);
              Dimension minSize = new Dimension(5, 15);
              Dimension prefSize = new Dimension(5, 15);
              Dimension maxSize = new Dimension(Short.MAX_VALUE, 15);
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up span
              spanLabel = new JLabel( "span (feet)" );
              spanField = new JTextField(5 );
              inputbox2a.add( spanLabel );
              inputbox2a.add( spanField );
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));          
              // set up chord
              chordLabel = new JLabel( "chord (feet)" );
              chordField = new JTextField(5 );
              inputbox2a.add( chordLabel );
              inputbox2a.add( chordField );
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));     
              // set up thickness
              thicknessLabel = new JLabel( "thickness (feet)" );
              thicknessField = new JTextField(5 );
              inputbox2a.add( thicknessLabel );
              inputbox2a.add( thicknessField );
              inputbox2a.add(new Box.Filler(minSize, prefSize, maxSize));
              box.add( Box.createVerticalStrut (10) );
              box.add(inputbox2b);
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up mass
              massLabel = new JLabel( "mass (slugs)" );
              massField = new JTextField(5);
              inputbox2b.add( massLabel );
              inputbox2b.add( massField );
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));     
              // set up altitude
              altitudeLabel = new JLabel( "altitude (feet)");
              altitudeField = new JTextField(5 );
              inputbox2b.add( altitudeLabel );
              inputbox2b.add( altitudeField );
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
              // set up velocity
              velocityLabel = new JLabel( "velocity (Mach Number)");
              velocityField = new JTextField(5);
              inputbox2b.add( velocityLabel );
              inputbox2b.add( velocityField );
              inputbox2b.add(new Box.Filler(minSize, prefSize, maxSize));
              box.add( Box.createVerticalStrut (10) );
              Dimension minSize2c = new Dimension(160, 15);
              Dimension prefSize2c = new Dimension(160, 15);
              Dimension maxSize2c = new Dimension(Short.MAX_VALUE, 15);
              box.add(inputbox2c);
              inputbox2c.add(new Box.Filler(minSize2c, prefSize2c, maxSize2c));
              // set up trajectory_angle
              trajectory_angleLabel = new JLabel( "trajectory angle (degrees)");
              trajectory_angleField = new JTextField(5);
              inputbox2c.add( trajectory_angleLabel );
              inputbox2c.add( trajectory_angleField );
              inputbox2c.add(new Box.Filler(minSize2c, prefSize2c, maxSize2c));
              box.add( Box.createVerticalStrut (10) );
              Dimension minSize2d = new Dimension(50, 15);
              Dimension prefSize2d = new Dimension(50, 15);
              Dimension maxSize2d = new Dimension(Short.MAX_VALUE, 15);
              box.add(inputbox2d);
              inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
              // set up time_increment
              time_incrementLabel = new JLabel( "time increment (seconds)" );
              time_incrementField = new JTextField(5);
              inputbox2d.add( time_incrementLabel );
              inputbox2d.add( time_incrementField );
              inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
              // set up rotation_factor
              rotation_factorLabel = new JLabel( "rotation factor (number)" );
              rotation_factorField = new JTextField(5);
              inputbox2d.add( rotation_factorLabel );
              inputbox2d.add( rotation_factorField );
              inputbox2d.add(new Box.Filler(minSize2d, prefSize2d, maxSize2d));
              box.add( Box.createVerticalStrut (10) );
              box.add( buttonbox);
              Dimension minSizeB = new Dimension(10, 30);
              Dimension prefSizeB = new Dimension(10, 30);
              Dimension maxSizeB = new Dimension(Short.MAX_VALUE, 30);
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up start
              startButton = new JButton( "START" );
              buttonbox.add( startButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up reset
              resetButton = new JButton( "RESET" );
              buttonbox.add( resetButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up cont
              contButton = new JButton( "CONTINUE" );
              buttonbox.add( contButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              // set up abort
              abortButton = new JButton( "ABORT" );
              buttonbox.add( abortButton );
              buttonbox.add(new Box.Filler(minSizeB, prefSizeB, maxSizeB));
              box.add( Box.createVerticalStrut (10) );          
              // set up results
              resultsArea = new JTextArea( results_string, 6, 50 );
              resultsArea.setEditable( false );
              box.add( new JScrollPane( resultsArea ) );
              // add box to panel
              panel.add( box );
              // register event handlers
              spanField.addActionListener( this );
              chordField.addActionListener( this );          
              thicknessField.addActionListener( this );
              massField.addActionListener( this );
              altitudeField.addActionListener( this );
              velocityField.addActionListener( this );          
              trajectory_angleField.addActionListener( this );
              time_incrementField.addActionListener( this );
              rotation_factorField.addActionListener( this );
              startButton.addActionListener( this );
              resetButton.addActionListener( this );
              contButton.addActionListener( this );
              abortButton.addActionListener( this );
              reset();
         } // end method init     
         public void t_r_a_test (double trajectory_angle) throws Tare {   
              if (trajectory_angle > MAX || trajectory_angle < MIN)
                          throw new Tare("\ntrajectory_angle "
                   + trajectory_angle + " is outside of allowable range\n\n" 
                   + "Try another value for the trajectory angle\n"
                   + "( " + MIN + " <= trajectory angle <= " + MAX + " )" );
         }  // end method t_r_a_test
         public void a_r_e_test (double altitude) throws Are {   
              if ( altitude > MAX_ALTITUDE )
                          throw new Are("\naltitude "
                   + altitude + " is outside of allowable range\n\n" 
                   + "Try value for altitude\n"
                   + "( " + MIN_ALTITUDE + " <= altitude <= "
                   + MAX_ALTITUDE + " )" );
         }  // end method a_r_e_test
         public void n_v_test (boolean value) throws Nve {   
              if ( value == false ){
                   if( span < 0 ){
                         span = 0;
                               throw new Nve("\nValue for "
                        + " span must not be negative\n\n" 
                        + "Try another value ");
                   if( chord < 0 ){
                         chord = 0;
                               throw new Nve("\nValue for "
                        + " chord must not be negative\n\n" 
                        + "Try another value ");
                   if( thickness < 0 ){
                         thickness = 0;
                               throw new Nve("\nValue for "
                        + " thickness must not be negative\n\n" 
                        + "Try another value ");
                   if( mass < 0 ){
                         mass = 0;
                               throw new Nve("\nValue for "
                        + " mass must not be negative\n\n" 
                        + "Try another value ");
                   if( altitude < 0 ){
                        altitude = 0;
                               throw new Nve("\nValue for "
                        + " altitude must not be negative\n\n" 
                        + "Try another value ");
                   if( velocity < 0 ){
                        velocity = 0;
                               throw new Nve("\nValue for "
                        + " velocity must not be negative\n\n" 
                        + "Try another value ");
                   if( time_increment < 0 ){
                        time_increment = 0;
                               throw new Nve("\nValue for "
                        + " time increment must not be negative\n\n" 
                        + "Try another value ");
                   if( rotation_factor < 0 ){
                        rotation_factor = 0;
                               throw new Nve("\nValue for "
                        + " rotation factor must not be negative\n\n" 
                        + "Try another value ");
              } //end if( value == false )
         }  // end method n_v_test
         // process events
         public void actionPerformed( ActionEvent event )
              // process spanField
              if( event.getSource() == spanField ) {
                   span_string = spanField.getText();
                   span = Double.parseDouble( span_string);
              // process chordField
              if( event.getSource() == chordField ) {
                   chord_string = chordField.getText();
                   chord = Double.parseDouble( chord_string);
              // process thicknessField
              if( event.getSource() == thicknessField ) {
                   thickness_string = thicknessField.getText();
                   thickness = Double.parseDouble( thickness_string);
              // process massField
              if( event.getSource() == massField ) {
                   mass_string = massField.getText();
                   mass = Double.parseDouble( mass_string);
              // process altitudeField
              if( event.getSource() == altitudeField ){
                   altitude_string = altitudeField.getText();
                   altitude = Double.parseDouble( altitude_string);
              // process velocityField
              if( event.getSource() == velocityField ){
                   velocity_string = velocityField.getText();
                   velocity = Double.parseDouble( velocity_string);
              // process trajectory_angleField
              if( event.getSource() == trajectory_angleField ){
                   trajectory_angle_string = trajectory_angleField.getText();
                   trajectory_angle = Double.parseDouble( trajectory_angle_string);
              // process time_incrementField
              if( event.getSource() == time_incrementField ){
                   time_increment_string = time_incrementField.getText();
                   time_increment = Double.parseDouble( time_increment_string);
              // process rotation_factorField
              if( event.getSource() == rotation_factorField ){
                   rotation_factor_string = rotation_factorField.getText();
                   rotation_factor = Double.parseDouble( rotation_factor_string);
              // process startButton event
              if ( event.getSource() == startButton )                
                   strtb();               
              // process resetButton event
              if ( event.getSource() == resetButton )
                   reset();
              // process contButton event
              if ( event.getSource() == contButton )
                   cont();
              // process abortButton event
              if ( event.getSource() == abortButton )
                   abort();
         } // end method actionPerformed
         public void strtb()
              try{          
                   span = Double.parseDouble( spanField.getText() );
                   chord = Double.parseDouble( chordField.getText() );
                   thickness = Double.parseDouble( thicknessField.getText() );
                   mass = Double.parseDouble( massField.getText() );
                   altitude = Double.parseDouble( altitudeField.getText());
                   velocity = Double.parseDouble( velocityField.getText());
                   trajectory_angle = Double.parseDouble( trajectory_angleField.getText());
                   time_increment = Double.parseDouble( time_incrementField.getText() );     
                   rotation_factor = Double.parseDouble( rotation_factorField.getText() );          
                   if( span < 0 || chord < 0 || thickness < 0 || mass < 0
                        || altitude < 0 || velocity < 0
                        || time_increment < 0 || rotation_factor < 0 )
                   value = false;
                   t_r_a_test( trajectory_angle );
                   n_v_test( value );
                   a_r_e_test( altitude );
                   while(sentinel){
                        Z.rundata();
                        if( altitude < 10 )
                             sentinel = false;
                   results();
                   resultsArea.setText( results() );
              }//end try
              // process improperly formatted input
              catch ( NumberFormatException numberFormatException ) {
                   JOptionPane.showMessageDialog( this,
                   "You must enter numbers in decimal format or integers"     ,
                   "Invalid Number Format" ,
                   JOptionPane.ERROR_MESSAGE );
              } // end catch NumberFormatException
              catch ( ArithmeticException arithmeticException ) {
                   JOptionPane.showMessageDialog( this,
                   arithmeticException.toString(), "Arithmetic Exception" ,
                   JOptionPane.ERROR_MESSAGE );
              } // end catch ArithmeticException
              catch ( Tare tare ) {
                        JOptionPane.showMessageDialog( this,
                        tare.toString(), "-90 <= range <= 90 " ,
                        JOptionPane.ERROR_MESSAGE );
              } // end catch Tare
              catch ( Nve nve ) {
                        JOptionPane.showMessageDialog( this,
                        nve.toString(), " value less than zero" ,
                        JOptionPane.ERROR_MESSAGE );
              } // end catch Nve
              catch ( Are are ) {
                        JOptionPane.showMessageDialog( this,
                        are.toString(), " value greater than maximum" ,
                        JOptionPane.ERROR_MESSAGE );
              } // end catch Are
         }  // end method strtb
         public void reset()
              span_string = "";
              chord_string = "";
              thickness_string = "";
              mass_string = "";
              altitude_string = "";
              velocity_string = "";
              trajectory_angle_string = "";
              time_increment_string = "";
              rotation_factor_string = "";
              results_string = "";
              spanField.setText( span_string );
              chordField.setText( chord_string );
              thicknessField.setText( thickness_string );
              massField.setText( mass_string );
              altitudeField.setText( altitude_string );
              velocityField.setText( velocity_string );
              trajectory_angleField.setText( trajectory_angle_string );
              time_incrementField.setText( time_increment_string );
              rotation_factorField.setText( rotation_factor_string );
              resultsArea.setEditable( true );
              resultsArea.setText( results_string );
              resultsArea.setEditable( false );
              span = 0;
              chord = 0;
              thickness = 0;
              mass = 0;
              altitude = 0;
              velocity = 0;
              trajectory_angle = 0;
              time_increment = 0;
              rotation_factor = 0;
              distance = 0;
              velocity_fps = 0;
              elapsed_time = 0;
              value = true;
         }   // end method reset
         public void cont()
         //later
         public void abort()
         //later
         public String results()
         results_string =
         "Distance =\t\t" + distance + " miles\n"
         + "Altitude =\t\t" + altitude + " feet\n"
         + "Trajectory Angle =\t" + trajectory_angle + " degrees\n"
         + "Velocity =\t\t" + velocity_fps + " feet per second\n"
         + "Elapsed Time =\t\t" + elapsed_time + " seconds\n";
         return results_string;
    } //end class Trajectory// Trajectory Analysis Program: Calculate.java
    public class Calculate {  
         Trajectory T = new Trajectory();
         // Calculate constructor
         public Calculate()
              rundata( );
         public void rundata( )
         T.altitude--;
    } // end class Calculate

  • Re: How to create More two class with one object

    haii,
             i have small information How to create More two class with one object,
    bye
    bye
    babu

    Hello
    I assume you want to create multiple instance of your class.
    Assuming that you class is NOT a singleton then simply repeat the CREATE OBJECT statement as many times as you need.
    TYPES: begin of ty_s_class.
    TYPES: instance   TYPE REF TO zcl_myclass.
    TYPES: end of ty_s_class.
    DATA:
      lt_itab      TYPE STANDARD TABLE OF ty_s_class
                     WITH DEFAULT KEY,
      ls_record  TYPE ty_s_class.
      DO 10 TIMES.
        CLEAR: ls_record-instance.
        CREATE OBJECT ls_record-instance.
        APPEND ls_record TO lt_itab.
      ENDDO.
    Regards
      Uwe

  • Two class files with $ on compile

    Hello friends, I have a simple java program, that consists of two classes, coded in the the same java file.
    One of hte classes extends Thread.
    When I compile the source file, I get one class file for the base class, and two for the other one - ClassName.class and ClassName$1.class.
    Why is the second one created?

    The ClassName$1.class is a class file for an anonymous inner class. You create them with code likebutton.addActionListener(new ActionListener() {
         actionPerformed(ActionEvent ae) {
              System.out.println("button was pressed");
    });This particular example is from the GUI world where event listeners are commonly created using anonymous inner classes. There's a separate file for it just because there's always exactly one class file for each class.

  • Is there any way to identify the two classes are compiled by same vm

    Is there any way to identify the two classes are compiled by same vm?
    Thank's a lot.

    I think this is the better forum than java compiler. The answer to the question you asked is no.
    But that question is not the best way to address your problem.
    If this were me, I'd use a tool like ASM (http://asm.objectweb.org/) to read in that file, and replace the getToday() method, with one like this
    long getToday() {
        return 20080101;
    }and replace the class file with this new one. (keep the old one, they might be using a class loader that verifies class signatures or something)
    (They said the code you are looking at could have been changed by you - so take the hint and change it back).
    If they've ripped you off, this will restore justice much more cheaply and effectively than involving the lawyers. If they then sue you for breaching the license agreement, that would probably force them to disclose their underhand tactics.
    OTOH, if you're lying to us about the purchase, and needing to pay for upgrades to fix the performance issue, and instead are trying to crack some trial software, then I hope they are using a custom class loader that checks the integrity of the classes.
    If you are being ripped off, why are you not telling us the name of the company? I am not sure who is being ripped off here.
    Bruce

  • Getting the JAXB exception like "Two classes have the same XML type name-"

    Getting the JAXB exception like "Two classes have the same XML type name...",
    Here is the exception details:
    Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
    I took the example like:
    package com.model; ---->this package contains 'Address' class and 'City' class
    public class Address {
    private String areaName; private City currentCity; private com.common.City previousCity;
    package com.model;
    public class City {
    private String cityName;
    Another city class in "com.common" package.
    package com.common;
    public class City {
    private String pinCode;
    We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
    I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
    It would be great if i can get the solution from any one....May thanks in advance.
    Thanks,
    Satya.

    Getting the JAXB exception like "Two classes have the same XML type name...",
    Here is the exception details:
    Exception in thread "main" com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions Two classes have the same XML type name "city". Use @XmlType.name and @XmlType.namespace to assign different names to them. this problem is related to the following location: at com.model.City at public com.model.City com.model.Address.getCurrentCity() at com.model.Address this problem is related to the following location: at com.common.City at public com.common.City com.model.Address.getPreviousCity() at com.model.Address
    at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at javax.xml.bind.ContextFinder.newInstance(Unknown Source) at javax.xml.bind.ContextFinder.find(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at javax.xml.bind.JAXBContext.newInstance(Unknown Source) at com.PojoToXSD.main(PojoToXSD.java:17)
    I took the example like:
    package com.model; ---->this package contains 'Address' class and 'City' class
    public class Address {
    private String areaName; private City currentCity; private com.common.City previousCity;
    package com.model;
    public class City {
    private String cityName;
    Another city class in "com.common" package.
    package com.common;
    public class City {
    private String pinCode;
    We need to create XSDs and needs to do the Marshalling and unmarshalling with the existing code in our project(like as above example code), code does not have any annotations like "@XmlRootElement/@XmlType" and we can not able to change the source code.
    I would like to know is there any solution to fix the above issue or any other ways to create XSDs and marshaling/unmarshalling(like MOXy..etc)?
    It would be great if i can get the solution from any one....May thanks in advance.
    Thanks,
    Satya.

  • How to communicate class a and class b , these two classes doesnot have rel

    class A
    private int a;
    class B
    private int b;
    these two classes doest not have any relation like extends(inhiertance,static method,creating object for class A in class B

    Not sure if this is what you are asking, but...
    You have jars that reference each other (sounds pretty tightly coupled to me, maybe they shouldn't be in separate jars, but I digress) and each has a manifest file in META-INF, right?
    To reference another jar's contents, simply add it to the Class-Path variable in your manifest. Then you can reference the classes as if they were all unjarred and slapped in the same directories.
    More Info:
    http://java.sun.com/docs/books/tutorial/jar/basics/manifest.html#special-purpose
    Tarabyte :)

  • Class casting problem when using two class loaders

    Hi, I have a problem with class casting using two different ClassLoader...
    I created an instance of Test class, which is a subclass of AbstractTest and stored it for later use to ArrayList<AsbtractTest>. The instance was created with a custom class loader which extends URLClassLoader. Later when I got the stored instance from the ArrayList<AbstractTest> in default ClassLoader context and cast it to Test, it failed saying "java.lang.ClassCastException: com.test.Test cannot be cast to com.test.Test".
    Does anybody have an idea why this happens?

    Yes - a class is identified by it's package, it's name and it's class loader so the same class code loaded with two different class loaders are two different classes.
    An approach to dealing with your problem is to have the class implement an interface that is loaded by the parent class (assuming, of course, that the two class loaders have the same parent) then you can cast to the interface.

  • Is Two Classes that call methods from each other possible?

    I have a class lets call it
    gui and it has a method called addMessage that appends a string onto a text field
    i also have a method called JNIinterface that has a method called
    sendAlong Takes a string and sends it along which does alot of stuff
    K the gui also has a text field and when a button is pushed it needs to call sendAlong
    the JNIinterface randomly recieves messages and when it does it has to call AddMessage so they can be displayed
    any way to do this??

    Is Two Classes that call methods from each other possible?Do you mean like this?
       class A
         static void doB() { B.fromA(); }
         static void fromB() {}
       class B
         static void doA() { A.fromB(); }
         static void fromA() {}
    .I doubt there is anyway to do exactly that. You can use an interface however.
       Interface IB
         void fromA();
       class A
         IB b;
         A(IB instance) {b = instance;}
         void doB() { b.fromA(); }
         void fromB() {}
       class B implements IB
         static void doA() { A.fromB(); }
         void fromA() {}
    .Note that you might want to re-examine your design if you have circular references. There is probably something wrong with it.

  • I need some info about the Document Class.

    Hi,
    I need some information about the Document Class, can anybody
    tell me where I can find it.
    thanks

    Emad Zedan,
    > I need some information about the Document Class, can
    > anybody tell me where I can find it.
    The concept of the document class was introduced in Flash
    CS3. What it
    does is allow you to optionally associate a custom AS3 class
    with your FLA
    in the Flash authoring tool. Your document class effectively
    *becomes* the
    main timeline. This is your chance to influence the
    underlying behavior of
    the MovieClip or Sprite instance that serves as the
    foundation for your SWF.
    If you don't associate a custom document class with your
    FLA, the FLA is
    associated automatically with a default document class called
    MainTimeline,
    which extends MovieClip.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Error Message: A main Java class needs to be specified to run the program.

    Hi,
    I am adding a program object to cms using java program, and trying to run it. I am getting an error message like
    Error Message: A main Java class needs to be specified to run the program.
    Could you please help me on this., please find the pasted program object pasted below
    public class MoveReports   {
    public void run(IEnterpriseSession enterpriseSession, IInfoStore infoStore,
                   String[] args) throws SDKException {
        int objectSize = ;
        String cms = "";
         String username = "";
         String password = "";
         String auth = "";
        try {
              ISessionMgr sm = CrystalEnterprise.getSessionMgr();
             enterpriseSession = sm.logon(username, password, cms, auth);
             IInfoStore oInfoStore=(IInfoStore)enterpriseSession.getService("", "InfoStore");
                 IInfoObjects iObjects = null;
                   iObjects = oInfoStore.query("Select * from CI_INFOOBJECTS where SI_PARENTID = 44104 AND SI_PROGID LIKE '%CrystalEnterprise.Excel%'");
                   // Getting total number of reports
                   objectSize = iObjects.size();
                   if(objectSize > 0)
                        for (int count = 0; count < objectSize; count++)
                             IInfoObject obj = (IInfoObject) iObjects.get(count);
                             // Specify the Destination parent Id to move the reports
                             obj.setParentID(44102);
                        oInfoStore.commit(iObjects);
                        System.out.println("Reports Moved Successfully");
                   else
                        System.out.println("Reports Not Available");
             catch (SDKException e) {
                 e.printStackTrace();
                 System.out.println("Error : " + e.getMessage());
    Thanks&Regards
    Damodar
    Edited by: Damodaram B on Nov 2, 2009 1:29 PM

    There's couple of things at issue here - you've not specified the proper interface (IProgramBase or IProgramBaseEx), and the program job server can't find the class in question (a deployment issue).
    You may want to open a support ticket with SAP.
    Sincerely,
    Ted Ueda

Maybe you are looking for