How do I call a method of an instance of an interface?

I create an instance of a class that implements the Uncmin_methods interface:
Uncmin_methods optFunctions = ( Uncmin_methods ) new Optimizer( epsilon );
Then I want to do something like:
optFunctions.setDesiredProbRow( desiredProbRow );
But the stupid compiler won't let me call one of Optimizer's methods.
Is optFunctions a Uncmin_method object or an Optimizer object?
How could I update the optFunctions object with some dynamic data?

But the stupid compiler won't let me call one of
Optimizer's methods.The compiler isn't "stupid". It knows the rules of the Java language better than you or I do. If it won't compile, better figure out why. I can't tell you, because "Optimizer" and "Uncmin_method" are presumably your own home-made interfaces/classes which I wouldn't know about.
Is optFunctions a Uncmin_method object or an
Optimizer object?See last sentence above.

Similar Messages

  • How can I call a method for all instances of a certain class?

    Hi,
    I have created a snake java applet, which you can play here [http://users.telenet.be/javagames/|http://users.telenet.be/javagames/].
    But now I want to make this into a multi-player game (with two or more snakes etc..).
    In my main class you can find methods like these:
    snake.move();
    snake.drawSnake();Now if I just alter my main class and make a second instance of the class snake and change my methods to this,
    snake.move();
    snake2.move();
    snake.drawSnake();
    snake2.drawSnake();my game almost works perfectly, I'll have to make some minor changes though.
    But my question is, is there a better way of doing this. Instead of duplicating all the code, how can I make the methods immediately work for both snakes, instead of calling it twice?
    All suggestions are welcome!
    Thanks in advance.
    Lennart

    If there was something common to all snake instances then you could declare that variable static.
    Note: I don't want to confuse you here. A static variable can have a value apart from any instances at all. Instances can view static variables but a static method or inner class, for example, cannot view instance variables.
    More generally, I would think you would want to treat each snake as an automaton with its own behavior. There must be some class such as Game or Board or whatever that has, as suggested, either an array or collection of snakes. Iterate over each snake, ask it to perform some computation for the game and then draw itself.
    - Saish

  • How Can I Call a method in iView  ,which is in another iView

    I Have 2 iViews i want to call a method in Iview which is i another iView
    Thanks and Regards
    Prasad.Y

    Hi Prasad,
    first, welcom at SDN.
    Next, let us clarify some wording:
    A <i>PAR</i> is a <i>Portal ARchive</i>. It is a zip in a certain format. It contains a <i>portal application</i>.
    A <i>portal application</i> consists of <i>components</i> and/or <i>services</i>.
    An <i>iView</i> is somehow an "instance" of a <i>component</i>. It is created within the portal. There are <i>no iViews in a PAR</i> (like: "There are no objects in a JAR (but classes).").
    With this in mind, you know that the question does not work, for iViews don't have "methods".
    If you ask how you can call a method of a class belonging to a different component (but within the same portal app), it is no problem at all, each class has access to each other class within the same portal app (in fact, one has to differentiate between public and private part, but we don't want to go so far). To call use a class belonging to (the public part of) a different app, you will have to set the SharingReference within portalapp.xml.
    If that's what you're looking for - great.
    If not, ask again, but far more detailed.
    Hope it helps
    Detlev
    PS: Please consider to reward points for helpful answers. Thanks in advance.

  • How can I call a Method in a Transformation Routine

    Hello Experts,
    How can I call a Method in a Transformation Routine ??
    THNXX

    Hi,
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/6090a621-c170-2910-c1ab-d9203321ee19?quicklink=index&overridelayout=true
    It will be help full .
    Regards,

  • How can we call the method of used controller?

    Hi All,
       i created two WDA Applications.( like YWDA1,YWDA2 ) . i am using the component WDA2 in WDA 1.and displaying the one view of WDA2 as popup window in WDA1 on action of one of the input element in the view of WDA1 by using the method l_window_manager->create_window_for_cmp_usage
    I have a button on the view of WDA2 which has appear in the popup window...how can i call the method which has binded to that button....and where should i code that...and i need to assign selected value in the popup window to input elemetn of view  WDA1
    Please help me to resolve this....
    Regards,
    Ravi

    You can not directly call view's event handler from other component.
    create a method in component controller of the second component and in the button click call the component controller method. ( also make the method as interface so that you can call it from other components )
    Now, you can call the interfacecontroller's method
    DATA: l_ref_INTERFACECONTROLLER TYPE REF TO ZIWCI__VSTX_REBATE_REQ_WD .
      l_ref_INTERFACECONTROLLER =   wd_This->wd_CpIfc_<comp usage name>( ).
      l_ref_INTERFACECONTROLLER->Save_Rr(
        STATUS = '01'                       " Zvstxrrstatus
    save_rr is the method of second component controller

  • How do you call a method from  another class without extending as a parent?

    How do you call a method from another class without extending it as a parent? Is this possible?

    Why don't you just create an instance of the class?
    Car c = new Car();
    c.drive("fast");The drive method is in the car class, but as long as the method is public, you can use it anywhere.
    Is that what you were asking or am I totally misunderstanding your question?
    Jen

  • EL - How do you call a method that requires a parameter

    How do you call a method that requires a parameter
    In scriplet code here is what I am trying to do
    <%= car.getDefaultColor(car.getCarType()) %>
    How do I do this in EL
    Here is my guess (it generates the Exception described below)
    ${car.defaultColor(car.carType)}
    Here is the Exception I am getting:
    javax.servlet.ServletException: <h3>Validation error messages from tag library c</h3>tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${car.defaultColor(car.carType)}": Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"]
    Any Ideas?
    P.S. If it matters to you, I am using JSTL 1.0 and the code snippets above are actually within the value attribute of a <c:out value="" /> statement.

    How do you call a method that requires a parameter
    In scriplet code here is what I am trying to do
    <%= car.getDefaultColor(car.getCarType()) %>
    How do I do this in ELYou don't. EL is very strict in method signatures. All get methods must be public Type getProperty(void); And all set methods must be public void setProperty(Type t);
    So you will have to re-work your Bean so it does not need an argument to the get method (getDefaultColor()). Since you are calling another method out of car, you might re-write the getDefaultColor method as such:
      public Object getDefaultColor() {
        CarType ct = this.getCarType();
        //then do other stuff
      }If that isn't suitable, then provide a helper method that is used to set the current car type and then call the getDefaultColor:
      private CarType curCarType;
      public void setCurrentCarType(CarType ct) { curCarType = ct; }
      public Object getDefaultColor() {
        if (curCarType == null) throw new IllegalStateException("CarType must be set before getting color");
        //normal work using curCarType
    <c:set target="${car}" property="currentCarType" value="${car.carType}"/>
    <c:out value="${car.defaultColor}"/>It is better to do as little of the data manipulation (setting up the car type) in the JSP as possible, so the first option is better than the second. Also better then the second would be to set the current car type in a servlet or data access object (or wherever) from which your retreive the car to begin with. Manipulatig it in the JSP itself should be your last resort (to keep as much business logic out of the JSP as possible).
    Here is my guess (it generates the Exception
    described below)
    ${car.defaultColor(car.carType)}
    Here is the Exception I am getting:
    javax.servlet.ServletException: <h3>Validation error
    messages from tag library c</h3>tag = 'out' /
    attribute = 'value': An error occurred while parsing
    custom action attribute "value" with value
    "${car.defaultColor(car.carType)}": Encountered "(",
    expected one of ["}", ".", ">", "gt", "<", "lt",
    "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[",
    "+", "-", "*", "/", "div", "%", "mod", "and", "&&",
    "or", "||"]
    Any Ideas?
    P.S. If it matters to you, I am using JSTL 1.0 and
    the code snippets above are actually within the value
    attribute of a <c:out value="" /> statement.

  • How would I call a method inside a dll?

    How would I call a method inside a dll? Is it even possible in Java? Like in VB you would do something like this: XXX.dll --> XXX.Activate()... I have already loaded the dll like this:
    String xxx = "C:/WINDOWS/system32/xxx.dll";
    System.load(xxx);
    Please help?
    THX

    I've got another question.
    I've gone through the link you posted and a couple others that I found.
    I am able to create an interface using the windows kernel32.dll and go through an example I found.
    But when I try to use a dll that I have from another application, I have problems.
    Here is what I have for the interface.
    public interface IAiCamDeviceControl extends StdCallLibrary {
         public IAiCamDeviceControl INSTANCE=(IAiCamDeviceControl)Native.loadLibrary("D:\\IAiCamDeviceControl.dll",IAiCamDeviceControl.class);   
    //        public long GetVersion( String s );
    //        public long Close();
    }The interface that works looks like this:
    public interface Kernel32 extends StdCallLibrary {
         public Kernel32 INSTANCE=(Kernel32)Native.loadLibrary("Kernel32",Kernel32.class);I thought that the problem might be using the path name for the library, so I copied it into the system32 directory.
    Still get the same error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'D:\IAiCamDeviceControl.dll': The specified module could not be found.
    My main looks like
    public class Main {
        public static void main(String[] args) {
    //          Kernel32 lib=Kernel32.INSTANCE;
    //          Kernel32.SYSTEM_POWER_STATUS batteryStatus=new Kernel32.SYSTEM_POWER_STATUS();
    //          lib.GetSystemPowerStatus(batteryStatus);
    //          System.out.println(batteryStatus);
                IAiCamDeviceControl camDev = IAiCamDeviceControl.INSTANCE;
    }The commented part is from the version that worked.
    All I attempted to do here was just create an instance of the interface.
    Any idea why I can't access the dll?
    The dll is the same one that is used successfully in VB, C#, and C++ demo programs, so I suspect it is a good dll.

  • How we can call java methods in ODI?

    Hi
    i have java jars.i would like to call java methods from ODI
    how it is possible in ODI?
    plz help me regards the same
    thanks

    Hi
    i tried according to given contents in this link
    but in my systen i am getting error
    could y plz help me regards solving this error
    error is :
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 1, in ?
    java.lang.UnsupportedClassVersionError: FileWrite (Unsupported major.minor version 50.0)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at org.python.core.SyspathJavaLoader.loadClass(SyspathJavaLoader.java)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at org.python.core.Py.findClassEx(Py.java)
         at org.python.core.SysPackageManager.findClass(SysPackageManager.java)
         at org.python.core.PackageManager.findClass(PackageManager.java)
         at org.python.core.SysPackageManager.findClass(SysPackageManager.java)
         at org.python.core.PyJavaPackage.__findattr__(PyJavaPackage.java)
         at org.python.core.PackageManager.lookupName(PackageManager.java)
         at org.python.core.imp.load(imp.java)
         at org.python.core.imp.import_next(imp.java)
         at org.python.core.imp.import_name(imp.java)
         at org.python.core.imp.importName(imp.java)
         at org.python.core.ImportFunction.load(__builtin__.java)
         at org.python.core.ImportFunction.__call__(__builtin__.java)
         at org.python.core.PyObject.__call__(PyObject.java)
         at org.python.core.__builtin__.__import__(__builtin__.java)
         at org.python.core.imp.importOne(imp.java)
         at org.python.pycode._pyx0.f$0(<string>:1)
         at org.python.pycode._pyx0.call_function(<string>)
         at org.python.core.PyTableCode.call(PyTableCode.java)
         at org.python.core.PyCode.call(PyCode.java)
         at org.python.core.Py.runCode(Py.java)
         at org.python.core.Py.exec(Py.java)
         at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)
    java.lang.UnsupportedClassVersionError: java.lang.UnsupportedClassVersionError: FileWrite (Unsupported major.minor version 50.0)
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlS.treatTaskTrt(SnpSessTaskSqlS.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)

  • How do i call the method in a class using servlet

    i am doing a project which need to use servlet to call a few methods in a class and display those method on the broswer. i tried to write the servlet myself but there are still some errors .. can anyone help:
    The servlet i wrote :
    package qm.minipas;
    import java.io.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class test extends HttpServlet {
    Database database;
    /** Initializes the servlet.
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    database = FlatfileDatabase.getInstance();
    /** Destroys the servlet.
    public void destroy() {
    /** Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    response.setContentType("text/html");
    java.io.PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("this is my class wossname"+FlatfileDatabase.getInstance()); // this is calling the toString() method in the instance of myJavaClass
    out.println("this is my method"+FlatfileDatabase.getAll());
    out.println("</body>");
    out.println("</html>");
    out.close();
    /** Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    /** Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    processRequest(request, response);
    /** Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    my methods which i need to call are shown below:
    public Collection getAll() {
    return Collections.unmodifiableCollection(patientRecords);
    public Collection getInpatients() {
    Collection selection=new ArrayList();
    synchronized(patientRecords) {
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(next.isInpatient())
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByAdmissionDate(Date dateOfAdmission) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(dateOfAdmission.equals(next.getDateOfAdmission()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByAdmissionDates(Date from,Date to)
    throws IllegalArgumentException {
    if(to.before(from))
    throw new IllegalArgumentException("End date must not be before start date");
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    Date nextAD=next.getDateOfAdmission();
    if((nextAD.after(from)||nextAD.equals(from))
    &&(nextAD.before(to)||nextAD.equals(to)))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByDischargeDates(Date from,Date to)
    throws IllegalArgumentException {
    if(to.before(from))
    throw new IllegalArgumentException("End date must not be before start date");
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    Date nextAD=next.getDateOfDischarge();
    if(nextAD==null)
    continue;
    if((nextAD.after(from)||nextAD.equals(from))
    &&(nextAD.before(to)||nextAD.equals(to)))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByConsultant(String consultant) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(consultant.equalsIgnoreCase(next.getConsultant()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByDischargeDate(Date dateOfDischarge) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(dateOfDischarge.equals(next.getDateOfDischarge()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getBySurname(String surname) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(surname.equalsIgnoreCase(next.getSurname()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);
    public Collection getByWard(String ward) {
    List selection=new ArrayList();
    for(Iterator i=patientRecords.iterator(); i.hasNext();) {
    PatientRecord next=(PatientRecord) i.next();
    if(ward.equalsIgnoreCase(next.getWard()))
    selection.add(next);
    return Collections.unmodifiableCollection(selection);

    please provide a detail description of your errors.

  • How do I call these methods?

    This is an incomplete program so far but for some reason where I write the statement to call the method its an error (Quartersa(); [Quartersa(double) in addcoins.AddCoins cannot be applied ( )]). What is it that I'm doing wrong? The error is at the bottom of the code.
    Heres what ive been working on:
    package addcoins;
    import java.util.Scanner;
    * @author HP_Owner
    public class AddCoins {
        /** Creates a new instance of AddCoins */
          public static void Quartersa(double quarters){
            quarters = .25;
       int quarteramount;
       System.out.println("Qaurters:");
       Scanner input = new Scanner(System.in);
    quarteramount = input.nextInt();
    quarters = quarteramount * 025;
    System.out.print( quarters);
        public static void Dimesa(double dimes){
            dimes = .10;
       int dimeamount;
       System.out.println("Dimes:");
       Scanner input = new Scanner(System.in);
    dimeamount = input.nextInt();
    dimes= dimeamount * .10;
    System.out.print( dimes);
        public static void Nickelsa(double nickels){
            nickels = 0.5;
       int nickelamount;
       System.out.println("Nickels:");
       Scanner input = new Scanner(System.in);
    nickelamount = input.nextInt();
    nickels = nickelamount * 0.5;
    System.out.print( nickels);
        public static void Penniesa(double pennies){
            pennies = 0.1;
       int pennyamount;
       System.out.println("Pennies:");
       Scanner input = new Scanner(System.in);
    pennyamount = input.nextInt();
    pennies = pennyamount * 0.1;
    System.out.print( pennies);
        public AddCoins() {
         * @param args the command line arguments
        public static void main(String[] args) {
            // TODO code application logic here
        Scanner input = new Scanner(System.in);
        System.out.println("Enter your total coins:");
    Quartersa(); //ERROR HERE
      Edited by: tetris on Feb 2, 2008 10:03 PM

    I think this is the problem
    System.out.println("Enter your total coins:");
    Quartersa(); //ERROR HERE
    you would need to put something inside the parenthesis here Quartersa();
    something like this might work...
    System.out.println("Enter your total coins:");
    int num=input.nextInt();
    Quartersa(num);
    good luck i hope it works.

  • How Can I Call the method in WAR project's class?

    Message was edited by: JUNHA SHIN

    I have one correct Web Moudule Project.
    The EAR project(EmployeeCardJdoEar) added the WAR archive
    (EmployeeCardJdoWar) is run correctly.
    I want to add the war archive to my WD project.
    because, the war project contain business logic to be reused.
    so. i had enrolled in my WD project's properties ->
    Web Dynpro References -> Sharing References ->
    sap.com/EmployeeCardJdoEar.
    but, this method in WAR(EmployeeCardJdoWar) occurs Exception.
    Context ctx = new InitialContext();
    pmf = (PersistenceManagerFactory)
               ctx.lookup("java:comp/env/jdo/defaultPMF");
    I think lookup call is not run correctly.
    But, this lookup is run correctly in my EAR project.

  • How can I call a method of an object that is stored in an ArrayList?

    Hello,
    I am working on a simple game.
    I have my own collection class that can contain some Brick objects.
    That class looks like this:
    class MyCollection<Brick>
          ArrayList<Brick> list = new ArrayList<Brick>();
          public void add(Brick obj)
                list.add(obj);
         public int get(int i)
                return list.get(i);
         public int length()
               return list.size();
    }My Brick class is abstract and contains this method:
    public abstract int getXpos();That method is overridden by the subclass Brick_type1 (which, of course, extends Brick) and returns an int.
    In my main class I try to call the getXpos() method but I cannot call if for an unknown reason:
    MyCollection mc = new MyCollection<Brick>();
    Brick_type1 bt = new Brick_type1(10);
    mc.add(bt);
    for(int i = 0; i<mc.length(); i++)
                System.out.println(bc.get(i).getXpos());   // getXpos() does not exist, says the compilatorbc.get(i) should return a Brick that contains the getXpos() method, so why can´t I call it?

    Roxxor wrote:
    Sorry, it should be:
    public Brick get(int i)
    return list.get(i);
    }...so it actually returns a Brick, but I still cannot call the getXpos() method for some reason.Is this also just a typo?
    MyCollection mc = new MyCollection<Brick>();

  • Get_xplan_msc, How Do I call this method??? , xml, web service, wsdl,dataProvider="{myServiceXML.lastResult.DataSet}"

    Result:
    <wsdl:definitions targetNamespace="
    http://tempuri.org/" xmlns:soap="
    http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tm="
    http://microsoft.com/wsdl/mime/textMatching/"
    xmlns:soapenc="
    http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:mime="
    http://schemas.xmlsoap.org/wsdl/mime/"
    xmlns:tns="
    http://tempuri.org/" xmlns:s="
    http://www.w3.org/2001/XMLSchema"
    xmlns:soap12="
    http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:http="
    http://schemas.xmlsoap.org/wsdl/http/"
    xmlns:wsdl="
    http://schemas.xmlsoap.org/wsdl/">
    <wsdl:types>
    <s:schema elementFormDefault="qualified"
    targetNamespace="
    http://tempuri.org/">
    <s:element name="Get_xplan_tpu">
    <s:complexType/>
    </s:element>
    <s:element name="Get_xplan_tpuResponse">
    <s:complexType>
    <s:sequence>
    <s:element minOccurs="0" maxOccurs="1"
    name="Get_xplan_tpuResult">
    <s:complexType>
    <s:sequence>
    <s:element ref="s:schema"/>
    <s:any/>
    </s:sequence>
    </s:complexType>
    </s:element>
    </s:sequence>
    </s:complexType>
    </s:element>
    <s:element name="Get_xplan_msc">
    <s:complexType/>
    etc....
    <?xml version="1.0" encoding="utf-8" ?>
    - <DataSet xmlns="
    http://tempuri.org/">
    + <xs:schema id="NewDataSet" xmlns="" xmlns:xs="
    http://www.w3.org/2001/XMLSchema"
    xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    - <xs:element name="NewDataSet" msdata:IsDataSet="true"
    msdata:UseCurrentLocale="true">
    - <xs:complexType>
    - <xs:choice minOccurs="0" maxOccurs="unbounded">
    - <xs:element name="xplan_MSC_Planning">
    - <xs:complexType>
    - <xs:sequence>
    <xs:element name="MSC" type="xs:string" minOccurs="0"
    />
    <xs:element name="Date" type="xs:dateTime" minOccurs="0"
    />
    <xs:element name="Traffic" type="xs:decimal"
    minOccurs="0" />
    <xs:element name="Radios" type="xs:int" minOccurs="0"
    />
    <xs:element name="InstalledCapacity" type="xs:int"
    minOccurs="0" />
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:choice>
    </xs:complexType>
    </xs:element>
    </xs:schema>
    - <diffgr:diffgram
    xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
    xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
    - <NewDataSet xmlns="">
    - <xplan_MSC_Planning diffgr:id="xplan_MSC_Planning1"
    msdata:rowOrder="0">
    <MSC>NYGMSC01</MSC>
    <Date>2007-06-24T00:00:00-07:00</Date>
    <Traffic>12730.8400</Traffic>
    <Radios>676</Radios>
    <InstalledCapacity>12342</InstalledCapacity>
    </xplan_MSC_Planning>
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    backgroundColor="#f6f6f6"
    backgroundGradientColors="[#f6f6f6, #bbbbbb]"
    creationComplete="myServiceXML.send()">
    <!-- Script -->
    <!-- Our result handler functions get any value returned
    from the server -->
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    // you import the event classes for strong typing
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    public function handleResultXML(event:ResultEvent):void {
    // the result object is your xml root
    lastResultValue.text = "Result:\n" + event.result;
    // you get the row nodes of your result object
    http://localhost:1343/***/DataService.asmx?op=Get_xplan_msc
    // the data of the dataprovider populates the component
    http://www.flexcapacitor.com/examples/php/datagrid_xml.php
    myDataGrid.dataProvider = event.result.row;
    // this function is called when you get an error from the
    server
    http://localhost:1343/***/DataService.asmx?wsdl
    public function handleFault(event:FaultEvent):void {
    lastResultValue.text = "Fault: " + event.fault.faultDetail;
    //trace(myServiceXML.toXMLString());
    // var myService:XML = XML(event.result);
    //trace(myService.toXMLString());
    ]]>
    </mx:Script>
    <!-- Data Communications -->
    <!-- The url is the page you post to -->
    <!-- In the request object you add your name and value
    pairs -->
    <!-- The curly brackets surrounding "username.text" get
    the value of username.text -->
    <!-- Note: The curly brackets are also used for
    databinding where supported -->
    <!-- Note: We set the resultFormat to E4X to
    automatically convert your return string to an XML object with E4X
    support -->
    <mx:HTTPService id="myServiceXML" url="
    http://localhost:1343/***/DataService.asmx?wsdl"
    method="POST" result="handleResultXML(event)"
    fault="handleFault(event)"
    useProxy="false" resultFormat="e4x">
    </mx:HTTPService>
    <!-- Layout -->
    <mx:Label x="10" y="10" text="Populate DataGrid with XML"
    fontSize="20" fontWeight="bold"/>
    <mx:HRule x="10" y="49" width="80%"/>
    <mx:Button id="submit0" x="10" y="73" label="Get XML"
    click="myServiceXML.send()"/>
    <mx:Label x="10" y="228" text="Result"/>
    <mx:DataGrid id="myDataGrid" x="10" y="114" width="611"
    height="106" dataProvider="{myServiceXML.lastResult.DataSet}">
    <mx:columns>
    <mx:DataGridColumn headerText="xplan_MSC_Planning"
    dataField="Traffic"/>
    <mx:DataGridColumn headerText="MSC" dataField="MSC"/>
    </mx:columns>
    </mx:DataGrid>
    <mx:TextArea x="10" y="244" width="611" height="400"
    id="lastResultValue"/>
    </mx:Application>

    I haven't been able to see the results from my web service.
    I'm seeing this error.
    It might be an internal security issue...I'm not sure
    why...any help is greatly
    appreciated.
    David
    - <s:element name="Get_xplan_msc">
    <s:complexType />
    </s:element>
    - <s:element name="Get_xplan_mscResponse">
    - <s:complexType>
    - <s:sequence>
    - <s:element minOccurs="0" maxOccurs="1"
    name="Get_xplan_mscResult">
    - <s:complexType>
    - <s:sequence>
    <s:element ref="s:schema" />
    <s:any />
    </s:sequence>
    </s:complexType>
    </s:element>
    </s:sequence>
    </s:complexType>
    </s:element>
    [WSDLError faultString="Element
    http://tempuri.org/:Get_xplan_mscResponse
    not resolvable" faultCode="WSDL.BadElement" faultDetail="null"]
    at mx.rpc.soap::WSDLParser/
    http://www.adobe.com/2006/flex/mx/internal::parseMessage()
    at mx.rpc.soap::WSDLOperation/parseMessages()
    at mx.rpc.soap::Operation/
    http://www.adobe.com/2006/flex/mx/internal::invokePendingCall()
    at mx.rpc.soap::Operation/
    http://www.adobe.com/2006/flex/mx/internal::invokeAllPending()
    at mx.rpc.soap::WebService/::unEnqueueCalls()
    at mx.rpc.soap::WebService/
    http://www.adobe.com/2006/flex/mx/internal::wsdlHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc.soap::WSDLParser/dispatchEvent()
    at mx.rpc.soap::WSDLParser/::parseCompleted()
    at mx.rpc.soap::WSDLParser/
    http://www.adobe.com/2006/flex/mx/internal::httpResultHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()
    at mx.rpc::AbstractInvoker/
    http://www.adobe.com/2006/flex/mx/internal::resultHandler()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    at ::DirectHTTPMessageResponder/completeHandler()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    backgroundColor="#f6f6f6"
    backgroundGradientColors="[#f6f6f6, #bbbbbb]"
    creationComplete="getXplan_MSC()">
    <!-- Script -->
    <!-- Our result handler functions get any value returned
    from the server -->
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    // you import the event classes for strong typing
    import mx.rpc.events.ResultEvent;
    import mx.rpc.events.FaultEvent;
    import mx.controls.dataGridClasses.DataGridColumn;
    import mx.managers.CursorManager;
    import mx.controls.Alert;
    default xml namespace = "
    http://localhost:1343";
    //necessary to access the xml elements easily
    [Bindable]private var _xmlResult:XML; //holds the result xml
    [Bindable]private var _xlDayData:XMLList; //dataProvider for
    the day weather dataGrid
    [Bindable]private var _sPlace:String;
    /** invokes the web service operation to get the weather */
    private function getXplan_MSC():void
    CursorManager.setBusyCursor();
    WS.Get_xplan_msc.send();
    //lastResultValue.text = "Result:\n" +
    event.result.Get_xplan_msc;
    /** called by the WebService result event. Sets the
    dataProviders as necessary */
    private function onResult(oEvent:ResultEvent):void
    _xmlResult = XML(oEvent.result);
    //var xmlResultNode:XML = _xmlResult.Get_xplan_mscResult[0];
    // var xmlDetailsNode:XML = xmlResultNode.Details[0];
    //outputInfo.text = xmlDetailsNode.toXMLString();
    //outputInfo.text = _xlDayData.text();
    // outputInfo.text = _xmlResult.toXMLString();
    // outputInfo.text = xmlResultNode.MSC.text();// + ", " +
    xmlResultNode.StateCode.text();
    // _xlDayData =
    xmlDetailsNode.toXMLString();//Get_xplan_mscResult[0];
    outputInfo.text = _xmlResult.text();
    CursorManager.removeBusyCursor();
    }//onResult
    /** labelFunction for DataGrid. It seems that the namespace
    on the xml makes
    * using the DataGridColumn dataField not work. At least I
    couldn't get it to work. */
    public function handleResultXML(event:ResultEvent):void {
    // the result object is your xml root
    lastResultValue.text = "Result:\n" +
    event.result.Get_xplan_msc;
    // you get the row nodes of your result object
    http://localhost:1343/***/DataService.asmx?op=Get_xplan_msc
    // the data of the dataprovider populates the component
    http://www.flexcapacitor.com/examples/php/datagrid_xml.php
    //myDataGrid.dataProvider = event.result.row[0];
    // this function is called when you get an error from the
    server
    http://localhost:1343/***/DataService.asmx?wsdl
    public function handleFault(event:FaultEvent):void {
    lastResultValue.text = "Fault: " + event.fault.faultDetail;
    lastResultValue.text = "Fault: " + event.fault.faultDetail;
    //trace(myServiceXML.toXMLString());
    // var myService:XML = XML(event.result);
    //trace(myService.toXMLString());
    ]]>
    </mx:Script>
    <!-- Data Communications -->
    <!-- The url is the page you post to -->
    <!-- In the request object you add your name and value
    pairs -->
    <!-- The curly brackets surrounding "username.text" get
    the value of username.text -->
    <!-- Note: The curly brackets are also used for
    databinding where supported -->
    <mx:WebService id="WS" wsdl="
    http://localhost:1343/***/DataService.asmx?wsdl">
    <mx:operation name="Get_xplan_msc" resultFormat="e4x"
    />
    </mx:WebService>
    <!-- Layout -->
    <mx:Label x="10" y="10" text="Populate Chart with XML"
    fontSize="20" fontWeight="bold"/>
    <mx:HRule x="10" y="49" width="80%"/>
    <mx:Button id="submit0" x="139" y="199" label="Get XML"
    click="getXplan_MSC()"/>
    <mx:Label x="10" y="228" text="Result"/>
    <mx:TextArea x="10" y="244" width="333" height="400"
    id="lastResultValue"/>
    <mx:TextArea x="377" width="354" height="400"
    id="outputInfo" y="244"/>
    <!--
    <mx:ColumnChart x="243" y="80" id="columnchart1"
    width="293" height="115" dataProvider="">
    <mx:series>
    <mx:ColumnSeries displayName="Date" yField="Date"/>
    <mx:ColumnSeries displayName="MSC" yField="MSC"/>
    <mx:ColumnSeries displayName="Traffic"
    yField="Traffic"/>
    <mx:ColumnSeries displayName="Radios"
    yField="Radios"/>
    </mx:series>
    </mx:ColumnChart>
    <mx:Legend dataProvider="{columnchart1}" x="108"
    y="100"/>
    -->
    </mx:Application>

  • How do I call a method when the user clicks on the delete button?

    Hello , I need to implement the following :
    If date from is less than sysdate , when the user clicks the "delete" button , he is shown an error message .
    Can you please help how this can be done ? Thanks.

    Thanks. What are the steps for adding a custom delete button ?
    Are these ok ?
    1 ) Add an adf button
    2) Add the following in the actions listener : #{bindings.Delete.execute}
    3) Right Click button --> create method binding for action
    4) Compare date ?
    Thanks.

Maybe you are looking for

  • Image Quality Issue

    Hi, I have a website that has a master swf that loads in a nav swf which loads in a gallery swf. I noticed that the images in my gallery swf look aliased/pixelly when they are nested within the main swfs but they look fine within the gallery swf. Is

  • Burning slide show on dvd to give to friends

    how do i share a slide show or photo album with a group of friends we traveled with? i have no idea if they have apple computors or are techno friendly. i wanted to burn DVD's of my slide how to give away but i can't seem to accomplish that. what is

  • Quick keywording question

    I'm new to Mac's and Aperture, so this question probably looks stupid and it's easy to answer. I'm yet not quite familiar with the wording even though i read the key wording part in the manual and have tried to learn it. My main problem is as follows

  • Creating XMP data from HTML page

    I have a very large number of images that are linked from websites in the form: <a href="images/filename.jpg">Image caption.</a> I would like to be able to use a script to batch process my files that will collect the text between the <a ....> and </a

  • Photoshop and premiere elements 12 Student and teacher edition:

    Hi there, i bought the student edition, entered everything recommended as name, etc, product code, sent a jpg file with school report and now i am waiting since three weeks for the serial number. What can i do?, photoshop and premiere elements 12 Stu