Interfaces and methods with complex object

In all the examples I have, the methods of an interface use only basic java datatypes (int, Character, ..)
I want to pass a Vector that represents a list of objects from one of my own classes to an interface method.
class Myclass ...
private String p1;
private int p2;
myInterfaceMethod(..., Vector list, ...)
// list is a vector of Myclass objects
How do I know about Myclass when implementing the interface and how do I access p1 and p2 ?

You can use any kind of "complex" object in your interface methods, all of them are objects at last.
The other question seems to be a misunderstanding of interface implementation. When u "implement" an interface in a class, all that JVM does is to check that you actualy have one method (with code inside its body) for each method you defined previously in the interface.
Think of an interface as a contract signed by a class. It's forced to implement each method definied in you interface. So, as the method is defined inside the class, you can access any data member of the class without doing anything "special". Do u catch it?

Similar Messages

  • Call a method with complex data type from a DLL file

    Hi,
    I have a win32 API with a dll file, and I am trying to call some methods from it in the labview. To do this, I used the import library wizard, and everything is working as expected. The only problem which I have is with a method with complex data type as return type (a vector). According to this link, import library wizard can not import methods with complex data type.
    The name of this method is this:   const std::vector< BlackfinInterfaces::Count > Counts ()
    where Count is a structure defined as below:
    struct Count
       Count() : countTime(0) {}
       std::vector<unsigned long> countLines;
       time_t countTime;
    It seems that I should manually use the Call Library Function Node. How can I configure parameters for the above method?

    You cannot configure Call Library Function Node to call this function.  LabVIEW has no way to pass a C++ class such as vector to a DLL.

  • Deprecated interfaces and methods

    We have a weblogic time service that utilize a lot of
    deprecated interfaces and methods such as
    ScheduledTriggerDef, TimeServicesDef etc. Although the time
    service runs in the WLS 7, it is a big concern to me
    that it uses so many deprecated interfaces or methods.
    I am just wondering how I can replace them with non-deprecated ones

    Mark,
    I have a question about the API.
    From the documentation and the API docs it is not clear how to schedule
    a callback to be called just once ASAP.
    We use the deprecated Timer service to execute long running operations
    on the Weblogic thread pool and want the operation to execute only once
    and start as soon as there is a thread available.
    It is not clear what will happen in case a task is scheduled to be
    executed only once and the time for that execution has passed ( 5 ms ago).
    I'd appreciate the clarification.
    Thanks,
    Dejan
    Mark Griffith wrote:
    It will run because it is only deprecated. You should at some point
    "rewrite", but the rewrite is not that big of a deal. There maybe some
    slight differences in timers, since we moved to jmx interfacs, but the
    scemantics should be very very close.
    Attached is an example that will run in the 8.1 sample environment.
    cd to $WLS_HOME
    (On my box it is /bea/wls81/weblogic81/)
    cd samples/domains/examples/
    setExamplesEnv.sh
    cd ../../server/examples/src/examples
    ../examples/src/examples 201$ pwd
    C:/bea/wls81/weblogic81/samples/server/examples/src/examples
    cp jmxTimerEar.zip .
    jar xvf jmxTimerEar.zip
    cd jmxTimerEar
    ant
    And it should build for you.
    Cheers
    mbg
    "Eric Sundberg" <[email protected]> wrote in message
    news:[email protected]..
    We have a weblogic time service that utilize a lot of
    deprecated interfaces and methods such as
    ScheduledTriggerDef, TimeServicesDef etc. Although the time
    service runs in the WLS 7, it is a big concern to me
    that it uses so many deprecated interfaces or methods.
    I am just wondering how I can replace them with non-deprecated ones

  • Track public classes, interfaces and methods by ID

    Hi All,
    I'm wondering whether there is a tool to assign a unique ID to classes, interfaces and methods (eg. within Javadoc) and track these IDs.
    The reason I'd need such a feature is that I'd like to do requirements tracking in an easy but complete way. I have a document containing functional specifications (with IDs) and on the other side there is the source code; where the javadoc of the public methods and classes is my software specification. What I now want to do is make a link between the IDs in the functional spec to the IDs in the sofware spec (ie. the source code).
    Does anybody know of such a tool (commercial or not)?
    Thanks,
    Daniel

    I'm a bit confused as to whether or not I understand you correctly. Please tell me if the following pseudocode is somewhat like the solution you are looking for:
    class MethodFunctionality {
       private Class methodClass;
       private String methodSignature;
       private List methodFunctions;
        *   Returns true if the method is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if methodFunctions.contains(requirementId)
             return true;
          else
             return false;
       public String getMethodSignature() {
          return this.methodSingature;
       public Class getMethodClass() {
          return this.methodClass;
        *   Returns an array with IDs of each functional
        *   requirement covered by the method.
       public int[] getCoverage() {
          return this.methodFunctions;
    class ClassFunctionality {
       private Map methodDetails;
       private List classFunctions;
       public MethodFunctionality getMethodDetails(String methodSignature) {
          return (MethodFunctionality) this.methodDetails.get(methodSignature);
        *   Returns true if the class is used for the specified
        *   requirement, false otherwise.
       public boolean fulfills(int requirementId) {
          if classFunctions.contains(requirementId)
             return true;
          else
             return false;
        *   Returns an array with IDs of each functional
        *   requirement covered by the class.
       public int[] getCoverage() {
          return this.classFunctions;
    }Mapping classes and methods to functionality like this would both allow you to query each class and method for all the functional requirements they claim to cover and would allow you to collect all classes and methods involved for a particular functional requirement.

  • I need interfaces and reports with wxample

    Hi all,
    I need interface sample date.If any one having please provide
    Best Regards
    Gopal

    What do you mean exactly ?
    Nicolas.
    Well, I assume more info in your duplicate thread :
    i need interfaces and reports with wxample
    Message was edited by:
    N. Gasparotto

  • Interfaces and methods of Object class

    JSL 2.0 states the following
    If an interface has no direct superinterfaces, then the interface implicitly
    declares a public abstract member method m with signature s, return type r,
    and throws clause t corresponding to each public instance method m with
    signature s, return type r, and throws clause t declared in Object, unless a
    method with the same signature, same return type, and a compatible throws
    clause is explicitly declared by the interface.
    But the following codes produces empty output
    package test;
    import java.lang.reflect.Method;
    public class TestIterface {
        public static void main(String [] args){
            Method [] methods=Y.class.getMethods();
            for(int i=0, n=methods.length;i<n;i++)
                System.out.println(methods);
    interface Y{
    What are the reasons of such behaviour?

    then the interface implicitly declares a public abstract member method
    "Implicit" means that it's implied that the interface declares those methods; unlike java.lang.Object, there is no interface from which all other interfaces descend. All interfaces at the "top" of the inheritance hierarchy are implied to expose at least the same methods as Object.
    Hope this helps...

  • Web Services with Complex Objects (Urgent !!)

    Hi,
    My last post was on a problem using IBM-RAD (Service) and AXIS2 (Client) in "New to Java" Forum. That is one of the trial scenarios I'm working on nowadays. Hope, I'll get some useful reply soon.
    Now, I need a suggestion about the application I'm working upon. It is as follows:
    (i) The application (i.e. Service Class) takes some primitive,String and/or some bean object as input
    (ii) It returns a bean object [or an array (can use collection class also if possible) of bean objects].
    (iii) The bean properties are primitive,String , other bean objects, and/or some collection object(Vector / ArrayList etc.) i.e. it should handle complex objects.
    (iv) The Service should run on Websphere and Client on Tomcat.
    A pictorial representation is given below:
    [primitive/String/bean object (Input arg)]
    [(Contains  primitive/String/other bean objects/collection class)] Bean <---------> Service <----------------------- Client
    [Calls bean] |===============> Client
    [Returns bean (or array of beans / collection object)]
    I'm now trying (by building test applications) a combination of IBM-RAD (Service) and AXIS2 (Client), but facing problems in handling array of beans and/or collection classes either on Service or on the Client side.
    So, I need some suggestions on whether I'm going the right way, or need to change my approach (or technology). Any suggestion would be appreciated.
    Please reply ASAP, it is urgent.
    Thanks in advance,
    Suman

    no problem for me, so it's not urgent.
    Request for help denied.

  • Abstract classes and methods with dollar.decimal not displaying correctly

    Hi, I'm working on a homework assignment and need a little help. I have two classes, 1 abstract class, 1 extends class and 1 program file. When I run the program file, it executes properly, but the stored values are not displaying correctly. I'm trying to get them to display in the dollar format, but it's leaving off the last 0. Can someone please offer some assistance. Here's what I did.
    File 1
    public abstract class Customer//Using the abstract class for the customer info
    private String name;//customer name
    private String acctNo;//customer account number
    private int branchNumber;//The bank branch number
    //The constructor accepts as arguments the name, acctNo, and branchNumber
    public Customer(String n, String acct, int b)
        name = n;
        acctNo = acct;
        branchNumber = b;
    //toString method
    public String toString()
    String str;
        str = "Name: " + name + "\nAccount Number: " + acctNo + "\nBranch Number: " + branchNumber;
        return str;
    //Using the abstract method for the getCurrentBalance class
    public abstract double getCurrentBalance();
    }file 2
    public class AccountTrans extends Customer //
        private final double
        MONTHLY_DEPOSITS = 100,
        COMPANY_MATCH = 10,
        MONTHLY_INTEREST = 1;
        private double monthlyDeposit,
        coMatch,
        monthlyInt;
        //The constructor accepts as arguments the name, acctNo, and branchNumber
        public AccountTrans(String n, String acct, int b)
            super(n, acct, b);
        //The setMonthlyDeposit accepts the value for the monthly deposit amount
        public void setMonthlyDeposit(double deposit)
            monthlyDeposit = deposit;
        //The setCompanyMatch accepts the value for the monthly company match amount
        public void setCompanyMatch(double match)
            coMatch = match;
        //The setMonthlyInterest accepts the value for the monthly interest amount
        public void setMonthlyInterest(double interest)
            monthlyInt = interest;
        //toString method
        public String toString()
            String str;
            str = super.toString() +
            "\nAccount Type: Hybrid Retirement" +
            "\nDeposits: $" + monthlyDeposit +
            "\nCompany Match: $" + coMatch +
            "\nInterest: $" + monthlyInt;
            return str;
        //Using the getter method for the customer.java fields
        public double getCurrentBalance()
            double currentBalance;
            currentBalance = (monthlyDeposit + coMatch + monthlyInt) * (2);
            return currentBalance;
    }File 3
        public static void main(String[] args)
    //Creates the AccountTrans object       
            AccountTrans acctTrans = new AccountTrans("Jane Smith", "A123ZW", 435);
            //Created to store the values for the MonthlyDeposit,
            //CompanyMatch, MonthlyInterest
            acctTrans.setMonthlyDeposit(100);
            acctTrans.setCompanyMatch(10);
            acctTrans.setMonthlyInterest(5);
            DecimalFormat dollar = new DecimalFormat("#,##0.00");
            //This will display the customer's data
            System.out.println(acctTrans);
            //This will display the current balance times 2 since the current
            //month is February.
            System.out.println("Your current balance is $"
                    + dollar.format(acctTrans.getCurrentBalance()));
        }

    Get a hair cut!
    h1. The Ubiquitous Newbie Tips
    * DON'T SHOUT!!!
    * Homework dumps will be flamed mercilessly. [Feelin' lucky, punk? Well, do ya'?|http://www.youtube.com/watch?v=1-0BVT4cqGY]
    * Have a quick scan through the [Forum FAQ's|http://wikis.sun.com/display/SunForums/Forums.sun.com+FAQ].
    h5. Ask a good question
    * Don't forget to actually ask a question. No, The subject line doesn't count.
    * Don't even talk to me until you've:
        (a) [googled it|http://www.google.com.au/] and
        (b) had a squizzy at the [Java Cheat Sheet|http://mindprod.com/jgloss/jcheat.html] and
        (c) looked it up in [Sun's Java Tutorials|http://java.sun.com/docs/books/tutorial/] and
        (d) read the relevant section of the [API Docs|http://java.sun.com/javase/6/docs/api/index-files/index-1.html] and maybe even
        (e) referred to the JLS for "advanced" questions.
    * [Good questions|http://www.catb.org/~esr/faqs/smart-questions.html#intro] get better Answers. It's a fact. Trust me on this one.
        - Lots of regulars on these forums simply don't read badly written questions. It's just too frustrating.
          - FFS spare us the SMS and L33t speak! Pull your pants up, and get a hair cut!
        - Often you discover your own mistake whilst forming a "Good question".
        - Often you discover that you where trying to answer "[the wrong question|http://blog.aisleten.com/2008/11/20/youre-asking-the-wrong-question/]".
        - Many of the regulars on these forums will bend over backwards to help with a "Good question",
          especially to a nuggetty problem, because they're interested in the answer.
    * Improve your chances of getting laid tonight by writing an SSCCE
        - For you normal people, That's a: Short Self-Contained Compilable (Correct) Example.
        - Short is sweet: No-one wants to wade through 5000 lines to find your syntax errors!
        - Often you discover your own mistake whilst writing an SSCCE.
        - Often you solve your own problem whilst preparing the SSCCE.
        - Solving your own problem yields a sense of accomplishment, which makes you smarter ;-)
    h5. Formatting Matters
    * Post your code between a pair of &#123;code} tags
        - That is: &#123;code} ... your code goes here ... &#123;code}
        - This makes your code easier to read by preserving whitespace and highlighting java syntax.
        - Copy&paste your source code directly from your editor. The forum editor basically sucks.
        - The forums tabwidth is 8, as per [the java coding conventions|http://java.sun.com/docs/codeconv/].
          - Indents will go jagged if your tabwidth!=8 and you've mixed tabs and spaces.
          - Indentation is essential to following program code.
          - Long lines (say > 132 chars) should be wrapped.
    * Post your error messages between a pair of &#123;code} tags:
        - That is: &#123;code} ... errors here ... &#123;code}
        - OR: &#91;pre]&#123;noformat} ... errors here ... &#123;noformat}&#91;/pre]
        - To make it easier for us to find, Mark the erroneous line(s) in your source-code. For example:
            System.out.println("Your momma!); // <<<< ERROR 1
        - Note that error messages are rendered basically useless if the code has been
          modified AT ALL since the error message was produced.
        - Here's [How to read a stacktrace|http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/].
    * The forum editor has a "Preview" pane. Use it.
        - If you're new around here you'll probably find the "Rich Text" view is easier to use.
        - WARNING: Swapping from "Plain Text" view to "Rich Text" scrambles the markup!
        - To see how a posted "special effect" is done, click reply then click the quote button.
    If you (the newbie) have covered these bases *you deserve, and can therefore expect, GOOD answers!*
    h1. The pledge!
    We the New To Java regulars do hereby pledge to refrain from flaming anybody, no matter how gumbyish the question, if the OP has demonstrably tried to cover these bases. The rest are fair game.

  • Trouble with Complex Object example

    From the 3.5 Tutorial.
    I have all of the .xml files in d:\oracle\home\labs, the .cmd file to start the cache using the POF is in the same directory.
    When I run the .cmd file, I get an
    Illegal State Exception: Missing POF configuration
    The POF configuration file is right there in the same directory with everything else.
    Where is it looking for this?
    Heres the .cmd file:
    @echo off
    setlocal
    if (%COHERENCE_HOME%)==() (
    set COHERENCE_HOME=d:\coherence
    if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
    set COH_OPTS=%COH_OPTS% -server -cp %COHERENCE_HOME%\lib\coherence.jar;D:\home\oracle\labs\Golddigger\CacheTest\classes
    set COH_OPTS=%COH_OPTS% -Dtangosol.coherence.cacheconfig=d:\home\oracle\labs\golddigger-cache-config.xml
    "%java_exec%" %COH_OPTS% -Xms1g -Xmx1g com.tangosol.net.DefaultCacheServer %2 %3
    %4 %5 %6 %7
    :exit
    Here's the cache configuration file:
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
    <caching-scheme-mapping>
    <cache-mapping>
    <cache-name>*</cache-name>
    <scheme-name>ExamplesPartitionedPofScheme</scheme-name>
    </cache-mapping>
    </caching-scheme-mapping>
    <caching-schemes>
    <distributed-scheme>
    <scheme-name>ExamplesPartitionedPofScheme</scheme-name>
    <service-name>PartitionedPofCache</service-name>
    <serializer>
    <class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
    <init-params>
    <init-param>
    <param-type>String</param-type>
    *<param-value>payloadPOFConfig.xml</param-value>*
    </init-param>
    </init-params>
    </serializer>
    <backing-map-scheme>
    <local-scheme>
    <!-- each node will be limited to 250MB -->
    <high-units>250M</high-units>
    <unit-calculator>binary</unit-calculator>
    </local-scheme>
    </backing-map-scheme>
    <autostart>true</autostart>
    </distributed-scheme>
    </caching-schemes>
    </cache-config>
    And here is payloadPOFConfig.xml:
    <?xml version="1.0"?>
    <!DOCTYPE pof-config SYSTEM "pof-config.dtd">
    <pof-config>
    <user-type-list>
    <!-- coherence POF user types -->
    <include>coherence-pof-config.xml</include>
    <!-- com.tangosol.examples package -->
    <user-type>
    <type-id>1002</type-id>
    <class-name>com.oracle.coherence.handson.Payload</class-name>
    </user-type>
    </user-type-list>
    <allow-interfaces>true</allow-interfaces>
    <allow-subclasses>true</allow-subclasses>
    </pof-config>

    Yeah, I fixed that. The class was compiled with the JDeveloper internal JRE, the cache was started with an older version of Java that was lingering under java_home.
    Now, I get a new error trying to write my Payload class to the cache...
    (Wrapped) java.io.NotSerializableException: com.oracle.coherence.handson.Payload
         at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:210)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ConverterValueToBinary.convert(DistributedCache.CDB:3)
         at com.tangosol.util.ConverterCollections$ConverterMap.put(ConverterCollections.java:1541)
         at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.DistributedCache$ViewMap.put(DistributedCache.CDB:1)
         at com.tangosol.coherence.component.util.SafeNamedCache.put(SafeNamedCache.CDB:1)
         at com.oracle.coherence.handson.WriteTest.main(WriteTest.java:31)
    Caused by: java.io.NotSerializableException: com.oracle.coherence.handson.Payload
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
         at com.tangosol.util.ExternalizableHelper.writeSerializable(ExternalizableHelper.java:2181)
         at com.tangosol.util.ExternalizableHelper.writeObjectInternal(ExternalizableHelper.java:2629)
         at com.tangosol.util.ExternalizableHelper.serializeInternal(ExternalizableHelper.java:2529)
         at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:206)
         ... 5 more
    The Payload class is as follows:
    package com.oracle.coherence.handson;
    import com.tangosol.io.pof.PofReader;
    import com.tangosol.io.pof.PortableObject;
    import com.tangosol.io.pof.PofWriter;
    import java.io.*;
    public class Payload
    implements PortableObject
    private File fileInfo;
    private byte[] contents;
    private long size;
    private String status = "Pending";
    public Payload()
    // Empty default constructor
    public Payload(File fileInfo, byte[] contents, int size)
    super();
    this.fileInfo = fileInfo;
    this.contents = contents;
    this.size = size;
    public void readExternal(PofReader pofReader)
    throws IOException
    this.setFileInfo((File) pofReader.readObject(0));
    this.setContents((byte[]) pofReader.readByteArray(1));
    this.setSize(pofReader.readInt(2));
    this.setStatus(pofReader.readString(3));
    public void writeExternal(PofWriter pofWriter) throws IOException
    pofWriter.writeObject(0, this.getFileInfo());
    pofWriter.writeByteArray(1, this.getContents());
    pofWriter.writeLong(2, this.getSize());
    pofWriter.writeString(3, this.getStatus());
    Then a bunch of accessors and mutators for the variables.
    I've been able to write both a File object and a byte[] to the cache as values, but it won't take this class.
    What is not serializable in here?

  • ArrayDeque as a stack doesn't work as expected with complex objects

    Trying to use ArrayDeque as a strorage for complex values <PSList<PSol>> (i.e. Arraylists of structured Values PSol), this doesn't work as expected. The code below should produce different values of pSLWk, being stored on bkStack, which are then to be retrieved by pop() to the variables pSL1, pSL2, pSL3.
    However, retrieval only ends up with three identical data sets (variables) pS1,pS2, pS3.
            public PSList<PSol> pSL;
            private ArrayDeque<PSList<PSol>> bkStack=new ArrayDeque<PSList<PSol>>();
            pSLWk=new PSList<PSol>();       // Constructor copies some Array (static field) to the PSLists
            pSL=new PSList<PSol>();
            pSLAux=new PSList<PSol>(pSLWk);   // Constructor copies from existing PSList
            pSLWk.checkResult("pSLWk prior to setDefaults - modifies pSLWk !");
            setDefaults();                                                            // Modifies pSLWk only
            pSLWk.checkResult(" pSLWk after setDefaults");              // .. got changes (o.k.)
            pSL.checkResult(" pSL after setDefaults");                  // .. unchanged  (o.k.)
            pSL.checkResult(" pSLAux after setDefaults");               // .. unchanged  (o.k.)
            bkStack.push(new PSList<PSol>(pSLWk));                      // store changes in bkStack
            pSLWk.getEl(77).setVal(new StringBuffer("4"));              // change pSLWk again (value 4 @ 77)
            pSLWk.checkResult("pSLWk, after PUSH, THEN modify 4@77");   // .. got change (o.k.)
            pSL.checkResult("pSL after setVal 77");
            bkStack.push(pSLWk);                      // store changes in bkStack
            pSLWk.getEl(80).setVal(new StringBuffer("8"));              // change pSLWk again (value 8 @ 80)
            pSLWk.checkResult("pSLWk after setVal 8@80");               // .. got change (o.k.)
            pSL.checkResult("pSL after setVal 80");
            bkStack.push(new PSList<PSol>(pSLWk));                      // store changes in bkStack
            pSL1=new PSList<PSol>(bkStack.pop());
            pSL1.checkResult("pSL1 after 1st pop");
    //      pSL1=bkStack.pop()                                          // Straightforward way doesn't work either...
            pSL2=new PSList<PSol>(bkStack.pop());
            pSL2.checkResult("pSL2 after 2nd pop");
            pSL3=new PSList<PSol>(bkStack.pop());
            pSL3.checkResult("pSL3 after 3rd pSLWk=..pop()");Here the result from the code above:
    debug:
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.>pSLWk prior to setDefaults - modifies pSLWk !
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2   63 <C.R.> pSLWk after setDefaults
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.> pSL after setDefaults
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.> pSLAux after setDefaults
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  463 <C.R.>pSLWk, after PUSH, THEN modify 4@77
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.>pSL after setVal 77
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSLWk after setVal 8@80
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.>pSL after setVal 80
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSL1 after 1st pop
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSL2 after 2nd pop
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSL3 after 3rd pSLWk=..pop()
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.>pSLWk prior to setDefaults - modifies pSLWk !
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2   63 <C.R.> pSLWk after setDefaults
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.> pSL after setDefaults
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.> pSLAux after setDefaults
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  463 <C.R.>pSLWk, after PUSH, THEN modify 4@77
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.>pSL after setVal 77
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSLWk after setVal 8@80
    1 8 9   4  5 42 9 7  5  2 6 4 923     1  7   3         86   7 5  3 69     2   63 <C.R.>pSL after setVal 80
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSL1 after 1st pop
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSL2 after 2nd pop
    128 96  4635 42 9 7945  2 6 47923     1  7   3 9       86   7 5  3 69     2  4638<C.R.>pSL3 after 3rd pSLWk=..pop()What's the problem with this ?
    Rem: I tried the simple approach as well:
    bkstack.push(pSLWk);
    ...

    Thank you for your comments, although I see we still don't have a common understanding of the problem.
    Firstly, I add the code for the PSList and the PSol classes, so you might find some problem with that:
         public class PSol     {
              private StringBuffer val;
              private int zI;
              private int sI;
              private int bI;
                        // == Konstruktor
              public PSol( StringBuffer v, int z, int s, int b )     {
                   this.val=v;
                   this.zI=z;
                   this.sI=s;
                   this.bI=b;
                        // == Getter,Setter
              public StringBuffer getVal()     {return val;}
              public int getZ()     {return zI;}
              public int getS()     {return sI;}
              public int getB()     {return bI;}
              public int getVSize()     {return val.length();}
              public void setVal(StringBuffer v)     {val=v;}
              public boolean hasVChar( StringBuffer ch, boolean delCh )     {
                   boolean bT=false;
                   StringBuffer fSt=getVal();
                   if (!(fSt.indexOf( ch.toString() )     == -1))     {
                        bT=true;
                        if (delCh)     {
                             setVal(fSt.deleteCharAt(fSt.indexOf( ch.toString() )));
                   return bT;
         }     // PSol
         public class PSList<E> extends ArrayList<PSol>     {
                   /**     Construktor 1: PSList(v,z,s,b) - makes list from single arrays
              private static final long serialVersionUID =  4711L;                         // ### JAVAC Warning! ###
            public PSList (String[] vS, int[] z, int[] s, int[] b) {
                   StringBuffer[] v=new StringBuffer[valDim];
                for (int i=0;i<valDim;i++)  {
                    v=new StringBuffer(vS[i]);
    //ArrayList<PSol> pSL=new ArrayList<PSol>;
                   for (int i=0; i<valDim; i++) {
                        this.add( new PSol( v[i], z[i], s[i], b[i] ) );
    /** Konstruktor2 : makes list from matrix array
    public PSList () {
    for (int j=0; j<nDim; j++) {
    for (int i=0; i<nDim; i++) {
    this.add( new PSol( new StringBuffer(sGuiArr[i][j]), i, j , i/locDim + (j/locDim)*locDim) );
                        /**     ------- Construktor 3 : PSList(PSList pS) - makes list as a copy of an existing one
    public PSList ( PSList<PSol> pX )     {
                   super (pX); // ArrayList-Constructor (Collection)
    // get Element <PSol>
    public PSol getEl ( int i )     {return get(i);}
         public int getCount()     {return size();}
         public int getTValLg()     {
                   int lg=0;
                   for (int i=0; i<getCount(); i++)     {
                        lg=lg + getEl(i).getVal().length();
                   return lg;
                        /**     ------- checkResult()     -     Check if alll elements are single char +dump
         public boolean checkResult(String messg)     {
                   boolean allOne=true;
                   for (int i=0; i<size(); i++)     {
                        if ( getEl(i).getVal().length() > 1 )     {
                             allOne=false;
                             System.out.print(" ");
                   else     {
                        System.out.print(getEl(i).getVal());
                   System.out.println("<C.R.>"+messg);
                   return allOne;
         }     // Class PSList
    Secondly, I don't really see what you mean by pointing out to 'only one "pSLWk" instance of PSList'. The variable pSLWk is the variable to be worked upon; after some change of the contents, I want to save this state of contents to the stack. When I pop that variable from the stack, I wouldn't want to restore it to pSLWK, but to some other variable, e.g. by public PSList<PSol> pSL1;
    pSL1=new PSList<PSol>(bkStack.pop());Again - to my understanding (which comes from old days of microprocessor coding... - there shouldn't be a need to know how the data came there, or what was the name of the variable who stored it there. And  : the implementation of ArrayDeque returns 'elements' of class E, not references !
    Thirdly, you're right, that the method of using a copy constructor for retrieval looks 'weird'. However - I had some other versions that didn't work either, e.g. the straightforward one, as I pointed out.
    And fourthly: yes, I'm almost sure that I'm messing up something somewhere. I went to this forum hoping to clarify that ... :)
    If you don't mind, could you please sketch a few lines of code, how to 'push' a complex variable to a ArrayDeque stack, and retrieve it - by 'pop()' - to some to other variable of the same class later ?
    Might make our discussion much easier, to see how things REALLY work.
    Thank you !                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Can BitmapData.CopyPixels method with many objects be faster?

    I'm trying to know if you can copy the pixels of many objects in one BitmapData without a huge slowdown.
    The slow down is made by calling the method multiple times, thus making a lot of variable declaration and disposal for the garbage collector.
    If someone know how to either immitate the copyPixel method or have any other way of solving this problem, i would gladly appreciate it
    thanks,
    Dominik

    I also calculated something bugging me with the garbage collector
    here are my results for declaring a class variable and not natives like ints,Number...
    1.looping 600 time while declaring one simple local variable: 0ms
    2.looping 1200 time while declaring one simple local variable: 1ms
    3.looping 2400 time while declaring one simple local variable: 1-2ms
    4.looping 4800 time while declaring one simple local variable: 3-4ms
    5.looping 9600 time while declaring one simple local variable: 6-7ms
    6. 3x 5.looping 9600 time=looping 28800 time while declaring one  simple local variable 20-21 ms
    vs printing one pixel with CopyPixel
    1200 time :2
    2400 time :4
    4800 time :7
    9600 time :14-15
    28800 time :41ms
    vs printing one pixel with SetPixel
    1200 time ; 0
    2400 time : 0
    4800 time : 1
    9600 time : 2
    28800 time :7ms
    Something seems to take a huge time to execute for CopyPixel and i suspect some declaration and class variable.
    I think using SetPixel for particles is the best but SetPixel is not doing a job that the CopyPixel is doing:
              Its deciding what pixels are overwritten and those that are not buts its also doing whats setPixel does.
    So if we substract the time spent for setting a pixel for all the CopyPixel results it shows that :
    9600 time :(14-15) - 2 = (12-13) ms
    28800 time :41ms -7 = 34 ms
    copyPixel still takes a good proportion at executing the rest of the code and it cant possibly be that long for setting only that many pixels

  • How to create web services with complex objects as parameters

    Hi,
    Not sure if this is the right place, but...
    I'm using Netbeans 5.5 and trying to learn web services.
    Creating a simple web service with simple parameters like strings and integers is nice and easy. I'm now trying to take the next step, and create a web service with a more complex schema as a parameter.
    I've tried two approaches, and hit dead ends on both:
    (1) Define my complex schema as an xsd file, and then create a WSDL file. Creating the schema and saving it in my EFB project works fine; when I try to create a new WSDL file, the IDE gives me a button to import external schemas - which is where the problem is: the Browse simply won't find my newly created schema file.
    (2) Define a Java class (in this case, it's a fairly simple example containing a single ArrayList), and then use the IDE to generate a web service from Java. The IDE does this fine, but I now have no idea how to consume or test the web service - I don't know where to look for the WSDL that has presumably been generated, and I'm also a bit iffy over what answers to give the WSDL creator about port names etc.
    Ideally, I'd prefer to get approach 1 to work - can someone point me in the direction of a sensible tutorial for these things?
    (Happy to carry on using Netbeans 5.5 or to revert to Sun Studio Enterprise, which I was playing with before.)
    All help appreciated, Thanks

    - For NetBeans related questions, nbusers mailing list is more suited. It is often visited by NetBeans experts.
    http://www.netbeans.org/community/lists/top.html
    ...[email protected]
    The NetBeans users mailing list. General discussion of NetBeans use, this is the place to ask for help and to help others.... (There is a 'Subscribe' button next to the above that you can use to subscribe to the list).
    Can you try posting this question on nbusers list?
    - SJSE 8.1 is based on an older version of NB (NB5.0).
    You should definitely continue with NetBeans, since all development is now being done in NetBeans; all the major JSE modules have been moved to opensource at netbeans.org and are all being developed there. There are as yet no future plans to work on further releases for JSE.
    Please check out http://www.netbeans.org for more details.

  • In range and coerce with complex numbers?

    I have an array of complex numbers with these numbers I need to set to 0 all numbers whose real parts are negative. With "in range and coerce" I can split the array into real and imaginary then set all negative numbers to 0 then recombine the complex part but that still leaves me with 0+ai numbers that should be 0. How can I also set the complex part to zero for the negative numbers?

    Hello,
    You can use the following fonction in a for loop with your array.
    Michel

  • Content based routing and XML with multiple objects

    I have some structure:
    <contracts>
      <contract>
         <department>1</department>
      </contract>
      <contract>
         <department>1</department>
       </contract>
      <contract>
         <department>2</department>
       </contract>
    </contracts>
    I need to route contract to 2 system based on <department> value:
    contracts/department = 1 --> System1
    contracts/department = 2 --> System2
    Will XI split my XML (based on Content Routing rules in ID) into 2 structures (with departmet=1 and department=2 accordingly) ?
    Or I have to perform 1ToN mapping? I don't like it bacause it will be diffucult to monitor hundred of messages.

    Alternatively if you donot like 1:n mapping and BPM.
    Create two message mappings in the IR
    1.Source :<contracts>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>2</department>
    </contract>
    </contracts>
    Target:
    <contracts>
    <contract>
    <department>1</department>
    </contract>
    <contract>
    <department>1</department>
    </contract>
    Basically mapping generates a target structure which has only department 1.
    2.Same like step1 but the mapping should generate the XML with department = 2.
    Once requires steps are done in the ID , do the content based routing in the reciever determination and give the appropraite message mapping in the interface determination.
    That should your problem and also you will like doing it as it does not involve any split level mapping..:)

  • Flex and CFC with Remote Object

    I wrote a simple cold fusion componenet on my webserver at:
    http://www.paramountmediainc.com/webservices/eadexchange/agent_sys.cfc
    Now I want to play with that in Flex with a Remote Object.
    I'm writing the flex on my local machine. I tried this approach but
    was uncessfull:
    <mx:RemoteObject id="acctRO" showBusyCursor="true"
    source="webservices.eadexchange.agent_sys"
    endpoint="
    http://www.paramountmediainc.com/flashservices/gateway">
    I get the following error ...
    TypeError: Error #1034: Type Coercion failed: cannot convert
    Object@3b15da1 to mx.messaging.messages.ErrorMessage.
    Any ideas what I'm doing wrong here?

    You cant really replace Struts with Flex, maybe a view part
    , thats about is, you still need backend processioning
    logic,all that you are asking is difficult to answer is one reply,
    IMHO, best thing you can do is to dive into following URLs :
    http://www.adobe.com/devnet/flex/
    http://livedocs.adobe.com/flex/3/html/help.html?content=Part2_DevApps_1.html
    http://livedocs.adobe.com/blazeds/1/blazeds_devguide/
    http://livedocs.adobe.com/flex/3/html/help.html?content=Part6_ProgAS_1.html
    and of course your best friend :
    http://livedocs.adobe.com/flex/3/langref/index.html

Maybe you are looking for