Syntax problem with array

can you hold public void name(){
in a array, if so can you give me the syntax
thanks

You can't store methods in an array, if that's what you're asking. What you can do is store objects which implement an interface telling you they have a method of a given name.
If you're wondering about returning arrays, the syntax is e.g. public int[] myMethod(){ ... }.

Similar Messages

  • A basic question/problem with array element as undefined

    Hello everybody,
    thank you for looking at my problem. I'm very new to scripting and javaScript and I've encountered a strange problem. I'm always trying to solve all my problem myself, with documentation (it help to learn) or in the last instance with help of google. But in this case I am stuck. I'm sure its something very simple and elementary.
    Here I have a code which simply loads a text file (txt), loads the content of the file in to a "var content". This text file contents a font family name, each name on a separate line, like:
    Albertus
    Antenna
    Antique
    Arial
    Arimo
    Avant
    Barber1
    Barber2
    Barber3
    Barber4
    Birch
    Blackoak ...etc
    Now, I loop trough the content variable, extract each letter and add it to the "fontList[i]" array. If the character is a line break the fontList[i] array adds another element (i = i + 1); That's how I separate every single name into its own array element;
    The problem which I am having is, when I loop trough the fontList array and $.writeln(fontList[i]) the result in the console is:
    undefinedAlbertus
    undefinedAntenna
    undefinedAntique
    undefinedArial ...etc.
    I seriously don't get it, where the undefined is coming from? As far as I have tested each digit being added into the array element, I can't see anything out of ordinary.
    Here is my code:
    #target illustrator
    var doc = app.documents.add();
    //open file
    var myFile = new File ("c:/ScriptFiles/installedFonts-Families.txt");
    var openFile = myFile.open("r");
    //check if open
    if(openFile == true){
        $.writeln("The file has loaded")}
    else {$.writeln("The file did not load, check the name or the path");}
    //load the file content into a variable
    var content = myFile.read();
    myFile.close();
    var ch;
    var x = 0;
    var fontList = [];
    for (var i = 0; i < content.length; i++) {
        ch = content.charAt (i);
            if((ch) !== (String.fromCharCode(10))) {
                fontList[x] += ch;
            else {
                x ++;
    for ( i = 0; i < fontList.length; i++) {
       $.writeln(fontList[i]);
    doc.close (SaveOptions.DONOTSAVECHANGES);
    Thank you for any help or explanation. If you have any advice on how to improve my practices or any hint, please feel free to say. Thank you

    CarlosCantos wrote an amazing script a while back (2013) that may help you in your endeavor. Below is his code, I had nothing to do with this other then give him praise and I hope it doesn't offend him since it was pasted on the forums here.
    This has helped me do something similar to what your doing.
    Thanks again CarlosCanto
    // script.name = fontList.jsx;
    // script.description = creates a document and makes a list of all fonts seen by Illustrator;
    // script.requirements = none; // runs on CS4 and newer;
    // script.parent = CarlosCanto // 02/17/2013;
    // script.elegant = false;
    #target illustrator
    var edgeSpacing = 10;
    var columnSpacing = 195;
    var docPreset = new DocumentPreset;
    docPreset.width = 800;
    docPreset.height = 600;
    var idoc = documents.addDocument(DocumentColorSpace.CMYK, docPreset);
    var x = edgeSpacing;
    var yyy = (idoc.height - edgeSpacing);
    var fontCount = textFonts.length;
    var col = 1;
    var ABcount = 1;
    for(var i=0; i<fontCount; i++) {
        sFontName = textFonts[i].name;
        var itext = idoc.textFrames.add();
        itext.textRange.characterAttributes.size = 12;
        itext.contents = sFontName;
        //$.writeln(yyy);
        itext.top = yyy;
        itext.left = x;
        itext.textRange.characterAttributes.textFont = textFonts.getByName(textFonts[i].name);
        // check wether the text frame will go off the bottom edge of the document
        if( (yyy-=(itext.height)) <= 20 ) {
            yyy = (idoc.height - edgeSpacing);
            x += columnSpacing;
            col++;
            if (col>4) {
                var ab = idoc.artboards[ABcount-1].artboardRect;
                var abtop = ab[1];
                var ableft = ab[0];
                var abright = ab[2];
                var abbottom = ab[3];
                var ntop = abtop;
                var nleft = abright+edgeSpacing;
                var nbottom = abbottom;
                var nright = abright-ableft+nleft;
                var abRect = [nleft, ntop, nright, nbottom];
                var newAb = idoc.artboards.add(abRect);
                x = nleft+edgeSpacing;
                ABcount++;
                col=1;
        //else yyy-=(itext.height);

  • Problem with arrays and comparing

    Hi,
    I am having problem accessing the array indexes.
    The program supposed to ask the user to enter the car model.
    If the car exists then it will display the message The modelname is available.
    If it doesnt exist The modelname does not exist.
    Thanks
    Car.java.........
    public class Car {
         private String regno;
         private String make;
         private String model;
         private int deposit;
         private int rate;
         public void setCar(String m, String mo, String reg, int dep, int r) {
              make = m;
              model = mo;
              regno = reg;
              deposit = dep;
              rate = r;
         public String getRegNo() {
              return regno;
         public String getmake() {
              return make;
         public String getModel() {
              return model;
         public int getdeposit() {
              return deposit;
         public int getrate() {
              return rate;
    Database.java.........
    public class Database {
    public void showDetails(){
    Car carList[] = new Car[9];
    carList[0] = new Car();
    carList[0].setCar("Toyota","Altis", "SJC2456 X", 100, 60);
    carList[1].setCar("Toyota","Vios", "SJG 9523 B", 100, 50);
    carList[2].setCar("Nissan","Latio", "SJB 7412 B", 100, 50);
    carList[3].setCar("Nissan","Murano", "SJC 8761 B", 300, 150);
    carList[4].setCar("Honda","Jazz", "SJB 4875 N", 100, 60);
    carList[5].setCar("Honda","Civic", "SJD 73269 C", 120, 70);
    carList[6].setCar("Honda","Stream", "SJL 5169 J", 120, 70);
    carList[7].setCar("Honda","Odyssey", "SJB 3468 E", 200, 150);
    carList[8].setCar("Subaru","WRX", "SJB 8234 L", 300, 200);
    carList[9].setCar("Subaru","Impressa", "SJE 8234 K", 150, 80);
    public Car findCarByModel(String findModel){
    Car car = new Car();
    for(int i = 0; i <=9; i++){
    if(car.getModel().equalsIgnoreCase(findModel)== true)
    return car; }
    } return null;
    IssueCarUi.java
    public class IssueCarUI {
    public static void main(String args[]){}
    private String requestModel;
    private Customer myCustomer;
    // Payment myPayment = new Payment();
    Rental myRental = new Rental();
    Database myDatabase = new Database();
    private int noOfDays;
    public IssueCarUI() {
    myCustomer = new Customer("", "");
    }//end Constructor
    public void createCustomer(String n, String i) {
    myCustomer.setName(n);
    myCustomer.setIC(i);
    System.out.println("Name: " + myCustomer.getName());
    System.out.println("Name: " + myCustomer.getIC());
    }// end Create customer method
    public void calculateCost(int d){
    myRental.setdays(d);
    System.out.println("Duration: 5 days");
    }// End Calculate cost
    public void showCarDetails(String requestModel) {
    requestModel=null;
    if(myDatabase.findCarByModel().equalsIgnoreCase(requestModel)==true){
    System.out.println("Model " requestModel " is available");
    }else{  System.out.println("Model " +requestModel + " not is available");}
    }// End Class
    mainmethod.java
    import java.util.Scanner;
    public class mainmethod {
    public static void main(String args[]) {
    IssueCarUI myIssue = new IssueCarUI();
    Scanner input = new Scanner(System.in);
    String name, ic,requestModel;
    System.out.print("Please enter the model to rent");
    requestModel = input.nextLine();
    myIssue.showCarDetails(requestModel);
    // System.out.print("Please Enter your name: ");
    // name = input.nextLine();
    // System.out.print("Please Enter your IC: ");
    // ic = input.nextLine();
    // myIssue.createCustomer(name, ic);
    }

    Assumption:
    * Removed setCar method and implemented the same method as a constructor for Car.
    public class Car {
      private String regno;
      private String make;
      private String model;
      private int deposit;
      private int rate;
      public Car(String m, String mo, String reg, int dep, int r) {
        make = m;
        model = mo;
        regno = reg;
        deposit = dep;
        rate = r;
      public String getRegNo() {
        return regno;
      public String getmake() {
        return make;
      public String getModel() {
        return model;
      public int getdeposit() {
        return deposit;
      public int getrate() {
        return rate;
    * When the values in the Car array are assigned in the new init() default method, they are created using the Car constructor.
    public class Database {
      //Car array is now an instance variable, rather then a local variable.
      private Car carList[]];
      //Default constructor initializes Car array and populates.
      public Database() {
        init();
      //Assign Car array with a custom Car array.
      public Database(Car carList[]) {
        this.carList = carList;
       * I highly suggest passing in as a parameter to the constructor, the car list rather then depending on this restrictive internal initialization.
       * I simply altered it in an init() method to keep it relative to your original code.
      private void init(){
        carList[] = new Car[9];
        carList[0] = new Car();
        carList[0] = new Car("Toyota","Altis", "SJC2456 X", 100, 60);
        carList[1] = new Carr("Toyota","Vios", "SJG 9523 B", 100, 50);
        carList[2] = new Car("Nissan","Latio", "SJB 7412 B", 100, 50);
        carList[3] = new Car("Nissan","Murano", "SJC 8761 B", 300, 150);
        carList[4] = new Car("Honda","Jazz", "SJB 4875 N", 100, 60);
        carList[5] = new Car("Honda","Civic", "SJD 73269 C", 120, 70);
        carList[6] = new Car("Honda","Stream", "SJL 5169 J", 120, 70);
        carList[7] = new Car("Honda","Odyssey", "SJB 3468 E", 200, 150);
        carList[8] = new Car("Subaru","WRX", "SJB 8234 L", 300, 200);
        carList[9] = new Car("Subaru","Impressa", "SJE 8234 K", 150, 80);
      public Car findCarByModel(String findModel){
        for(Car car : carList) {
          if(car.getModel().equalsIngoreCase(findModel)) {
            return car;
        return null;
    }Mel

  • Problems with Array-Parameters when using Document-Binding

    Hi,
    I use the following environment:
    JDeveloper 11.1.1.3.0
    WLS 10.3.3.0
    I created a small EJB (2.1), containing a simple method, which is using arrays as parameters:
    public String doTestArray(String[] aStringArray, int[] aIntArray)
    throws RemoteException;
    I exposed this EJB as a Webservice using JDev's Webservice wizard. I choosed Document/Wrapped-Binding. WSDL and mapping file are being generated. Made an EAR-Deployment-Profile and deployed the application to Integrated-WLS.
    I tried to test the Webservice with the WLS integrated test client, which is generating the following request:
    <doTestArrayElement xmlns="http://model/types/">
    <!--Zero or more repetitions:-->
    <arrayOfString_1>string</arrayOfString_1>
    <!--Zero or more repetitions:-->
    <arrayOfint_2>3</arrayOfint_2>
    </doTestArrayElement>
    Unfortunately, the invokation fails. WLS returns
    weblogic.wsee.codec.CodecException: Failed to decode message
    at weblogic.wsee.codec.soap11.SoapCodec.decode(SoapCodec.java:188)
    at weblogic.wsee.ws.dispatch.server.CodecHandler.decode(CodecHandler.java:139)
    That only happens in methods, which use array-parameters. Simple parameters are no problem.
    However, when I use RPC/Encoded as Webservice-Binding, everything seems to be fine.
    Does WLS have problems in general using array-parameters and Document-Binding?
    Any help would be appreciated.
    Thanks,
    Stefan

    Hi Josko,
    Where do you have this problem 3.5 or 7.0 BexAnalyzer.
    When ever heirarchy icons are created in BEx, respective hyperlink is assigned to each of them, Make sure that you dont manipulate with them,,
    If you still have problem then create OSS message.
    Regards,
    Vinay

  • Syntax problem with BDC perform

    Dear Friends,
    small problem in BDC Perform syntax but I am not getting how to do this..
    I have writen the code like this in my BDC byt its throughing the error...Here I want to do the validation on each and every field. I mean If that field values are empty i don't want to change the SAP field value.
    my code is like this.
        PERFORM dynpro USING:
        'X' 'SAPLMGMM' '0080'.
        IF NOT p_int_matl-werks IS INITIAL.
        ' ' 'RMMG1-WERKS' p_int_matl-werks.
        ENDIF.
        IF NOT p_int_matl-werks IS INITIAL.
        ' ' 'RMMG1-LGORT' p_int_matl-lgort.
          ENDIF.
        ' ' 'BDC_OKCODE' '/00'.
    pls give me exact code how to do this...
    Thanks
    Sridhar

    Hi sridher,
    1. this kind of syntax ie. IF will give error.
    2. If ur requirement is : blank value should not be put in bdc,
    3. then one way is to change / write the logic
        inside the form itself.
    4. ie. inside the routine/form DYNPRO.
    5. So, it will be then general for all performs.
    regards,
    amit m.

  • Problem with array type in SOAP response for sync interface

    Hi,
    We have a Synchronous Interface from SAP -->PI-->Unifier .The WSDL response has array type and when WSDL is imported it is showing red (I was able to activate  and use it in mapping) .We are able to send the request successfully and when retrieving the response we are getting mapping error .Please find the attachment for reference and response message from unifier .I feel that the error is because of array type .Could someone throw some light how we can solve this soon as it was a bit urgent .
    http://scn.sap.com/thread/326591
    I tried to create the Data Type and use the same instead of using the WSDL from External Definition but did not helped.Request your help in this.I have attached the WSDL for reference .
    The response is received as shown below which is giving mapping error :
    <ns1:getUDRDataResponse xmlns:ns1='http://diran:12020/ws/services/mainservice' soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><getUDRDataReturn href='#id0'/></ns1:getUDRDataResponse>
    The complete response looks like below where PI is not able to receive (this is retrieved from SOAP UI)
    <?xml version="1.0" encoding="utf-8" ?>
    - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    - <soapenv:Body> 
    - <ns1:getUDRDataResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://general.service.webservices.skire.com"> 
    <getUDRDataReturn href="#id0" /> 
    </ns1:getUDRDataResponse>
    - <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:XMLObject" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="mainservice"> 
    <errorStatus soapenc:arrayType="xsd:string[0]" xsi:type="soapenc:Array" /> 
    <statusCode xsi:type="xsd:int">200</statusCode> 
    <xmlcontents xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <report> <report_header> <c1>Name</c1> <c2>Number</c2> <c3>Status</c3> <c4>Location</c4> <c5>Phase</c5> </report_header> <report_row> <c1>Test - Sprint 1 - v10</c1> <c2>GB424</c2> <c3>Active</c3> <c4>/North Sea</c4> <c5></c5> </report_row> <report_row> <c1>Test Training 3</c1> <c2>GB424-TRN3</c2> <c3>Active</c3> <c4>/North Sea</c4> <c5></c5> </report_row> </report></xmlcontents> 
    </multiRef>
    </soapenv:Body>
    </soapenv:Envelope>

    Hi Praveen and Mark,
    Thanks for the help.I tried to use XSLT mapping for request and try to read Response as a single string but i was getting an error in SXMB_MONI with Cannot display document format,Do you want too save it to harddisk and i could not get rid of this even after pressing Yes in popup .
    Can some one help to extract only the xmlcontents  from the above response and map it to target where the target structure looks like
    <report>
    <report_header>
    <report_row>
    Please help .

  • HP Proliant ML350G4 server - problem with array

    Hi, I have HP Proliant ML350 G4 server. The problem is that I can not configure the array for SCSI hard drives. When I run the Array Configuration Utility from the SmartStart CD, I get the message: "ACU did not detect any supported controllers in your system." How do I solve this problem?

    Hi:
    You may also want to post your question on the HP Business Support Forum -- ML Servers section.
    http://h30499.www3.hp.com/t5/ProLiant-Servers-ML-DL-SL/bd-p/itrc-264#.U48mculOW9I

  • XML to model, problem with arrays

    I've imported XML data from the server using the HTTPService
    and using the service to convert the XML to a model. So below is my
    XML:
    <details>
    <field label="" value=""/>
    <field label="" value=""/>
    </details>
    I have to deal with the situation where if there is only one
    field, details.field is not Array otherwise it is but the following
    condition doesn't seem to work:
    if (details.field is Array)
    but I can still iterate through the elements as if it was an
    array. So if details.field is not an Array, what is it? Or more
    generally how do I find out the class of a variable?

    The default resultFormat of HTTPService is object. This
    causes your xml to be converted to a nested object structure. This
    is rarely desirable. And it causes the issue you are seeing,
    because the convertor can't differentiate between an array with a
    single element and an object..
    Instead, set resultFormat="e4x". then, in the result handler,
    do:
    var xmlResult:XML = XML(event.result);
    trace(xmlResult.toXMLString);
    The expression, xmlResult.field, will return an XMLList. You
    can iterate over that using a normal for loop with bracketed index
    style references.
    There are also solutions to your issue if you want to stay
    with resultFormat="object". They involve, as you expect, examining
    the the result object for its contained datatype. You can probably
    find an example in the archives.
    But switch to XML, and drop Model. Look up e4x xml if you
    want more erasons.
    Tracy

  • Problem with arrays

    Hi guys am having difficulty to access an array from another method in the came class
    import java.io.*;
    class arr
         int i,j,k;
         int r;
         int arr1[][] = new int [30][30];          
         void input() throws IOException
         InputStreamReader ir= new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(ir);
         String s= br.readLine();
         int r = Integer.parseInt(s);
         System.out.println("Value of r is:"+r);
              for(i=0;i<r;i++)
                   for(j=0;j<5;j++)
                   arr1[i][j]=k;
                   k++;
         void display()
         System.out.println("r is"+r); // When executed r = o
              for(i=0;i<r;i++)
                   for(j=0;j<5;j++)
                   System.out.println(arr1[i][j]);
    class testing
         public static void main(String args[]) throws IOException
         arr a = new arr();
         a.input();
         a.display();
    }How come that r =0 when i input another value?
    Please guys how can i overcome this problem??
    thanks

    Ok TIM ill see for the variables i and j
    For the array of size 30x30 ,i have already done what u said but had problems to access it in the display() so ive done it that way ..Guys i' having problems in the do....while loop (main ())
    normally when i input "Y" i should be promped to the menu but the programs ends....
    import java.io.*;
    class volley
         int i,j;
         int r;
         String arr1[][] = new String [30][30];
         String criteria;          
         void input() throws IOException
         InputStreamReader ir= new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(ir);
         System.out.print("Enter number of volleyball teams:");
         String s= br.readLine();
         r = Integer.parseInt(s);
              for(i=0;i<r;i++)
                   System.out.println();
                   System.out.print("Enter Information for Volleball  team "+(i+1));
                   System.out.println();
                   for(j=0;j<5;j++)
                   if (j==0)
                   criteria = "1.Team Name";
                   else if(j==1)
                   criteria = "2.City";
                   else if(j==2)
                   criteria = "3.Number of Wins";
                   else if(j==3)
                   criteria = "4.Number of losses";
                   else
                   criteria = "5.Number of Hits";
                   System.out.print(criteria+" is :" );
                   String k = br.readLine();
                   arr1[i][j]=k;
         void display()
              for(i=0;i<r;i++)
                   System.out.println();
                   System.out.println("Displaying volleball team:"+(i+1));
                   System.out.println();
                   for(j=0;j<5;j++)
                   if (j==0)
                   criteria = "1.Team Name";
                   else if(j==1)
                   criteria = "2.City";
                   else if(j==2)
                   criteria = "3.Number of Wins";
                   else if(j==3)
                   criteria = "4.Number of losses";
                   else
                   criteria = "5.Number of Hits";
                   System.out.println(criteria+ "is:" +arr1[i][j]);
    class tennis
    {     String arrtennis[][]=new String[30][30];
         int r;     
         String criteria;
         void inputtennisinfo() throws IOException
         InputStreamReader ir= new InputStreamReader(System.in);
         BufferedReader br = new BufferedReader(ir);
         System.out.print("Enter number of tennis teams:");
         String s= br.readLine();
         r = Integer.parseInt(s);
         for (int i=0;i<r;i++)
              System.out.println();
              System.out.println("Enter information for tennis team: "+(i+1));
              System.out.println();
              for(int j =0;j<5;j++)
              if (j==0)
              criteria = "1.Team Name";
              else if(j==1)
              criteria = "2.City";
              else if(j==2)
              criteria = "3.Number of Wins";
              else if(j==3)
              criteria = "4.Number of losses";
              else if (j==4)
              criteria="5.Number of hits";
              else
              criteria = "5.Number of errors";
              System.out.print(criteria+ " is: ");
              String k=br.readLine();
              arrtennis[i][j]=k;     
         void display()
         for(int i=0;i<r;i++)
              System.out.println();
              System.out.println("Displaying volleball team:"+(i+1));
              System.out.println();
              for(int j=0;j<5;j++)
              if (j==0)
              criteria = "1.Team Name";
              else if(j==1)
              criteria = "2.City";
              else if(j==2)
              criteria = "3.Number of Wins";
              else if(j==3)
              criteria = "4.Number of losses";
              else if (j==4)
              criteria="5.Number of hits";
              else
              criteria = "5.Number of errors";
              System.out.println(criteria +" is"+arrtennis[i][j]);     
    class testing
         public static void main(String args[]) throws IOException
         String yn;
         InputStreamReader irr= new InputStreamReader(System.in);
         BufferedReader brr = new BufferedReader(irr);
         volley a = new volley();
         tennis t = new tennis();
         do                                               //  loop is here
         System.out.println("*********WELCOME TO TEAM PROGRAM***********");
         System.out.println("1.INPUT VOLLEBALL INFORMATION");
         System.out.println("2.INPUT TENNIS INFORMATION");
         System.out.println("3.DISPLAY VOLLEBALL INFORMATION");
         System.out.println("4.DISPLAY TENNIS INFORMATION");
         System.out.print("Your choice is: ");
         String str=brr.readLine();
         int choice=Integer.parseInt(str);
         switch(choice)
              case 1:
                   a.input();
                   break;
              case 2 :
                   t.inputtennisinfo();
                   break;
              case 3:
                   a.display();
                   break;
              case 4:
                   t.display();
                   break;
              default:
                   System.out.println("Wrong Input");
         System.out.print("Do you want to continue(Y/N):");
         yn=brr.readLine();
         if(yn=="N")
         System.out.println("Good Bye");     
         while(yn=="Y");
    }Thanks guys

  • Having major problems with arrays, please help

    Hi,
    I'm writing a program to simulate a juke box using an array of strings to hold each track that is input. when the program starts, the user is asked the maximum number of songs to store, and this is passed to the constructor of the PlayList method, which sets up on array of Strings called queue with the total given.]
    I have four options, one to add a song, one to play the first song in the queue and then remove it from the queue. One to display all the songs in playlist, and one to quit. NB it doesn't "play" the song it just displays a message saying "now playing - song name".
    It all works UNTIL i choose option 2 (play first song and then remove it from the queue). This seems to work, but then when I choose to display all the songs, its not removed the right one, and now there's two of the same. I've been trying for hours with this, and it's really annoying me. Here's the PlayList class
    public class PlayList
        //declare attributes
        private String [] queue;
        private int total;
        //declare constructor
        public PlayList(int numsongs)
            queue = new String [numsongs];
            total = 0;
        public boolean addToQueue(String track)
            if (!isFull())
                queue[total] = track;
                total++;
                return true;
            else
                return false;
        public boolean removeFromQueue()
            if (isEmpty())
                return false;
            else
                int i;
                //remove first item off queue -- queue[0]
                for (i=1; i <= total-1; i++)
                    //rename the others
                    queue[i] = queue[i-1];
                total--;
                return true;
        public boolean isEmpty()
            if (total == 0) return true;
            else return false;      
        public boolean isFull()
            if (total == queue.length)
                return true;
            else
                return false;
        public String getItem(int item)
            return queue[item-1];
        public int getTotal()
            return (total);
        And here's the code from the main class which is executed.
    public class JukeBox
        public static void main(String[] args)
            //delcare variables
            int choice;
            PlayList playlist;
            int maxnum;
            String song;
            System.out.println("*** Jukebox simulator ***" + "\n");
            System.out.print("Maximum number of songs in playlist: ");
            maxnum = EasyIn.getInt();
            playlist = new PlayList(maxnum);
            do
                System.out.println("\n" + "[1] Add song to playlist");
                System.out.println("[2] Play first song in playlist");
                System.out.println("[3] Display list of songs in playlist");
                System.out.println("[4] Quit" + "\n");
                System.out.print("Enter choice  [1-4]: ");
                choice = EasyIn.getInt();
            //if statements for each case
            if (choice == 1)
                if (playlist.isFull())
                    System.out.println("*** Cannot add song, playlist is full ***");               
                else
                System.out.print("Enter artist and song name - ");
                song = new String(EasyIn.getString());
                playlist.addToQueue(song);
                System.out.println("\n" + "*** Song added to playlist ***");
                System.out.println(song + "\n");
            if (choice == 2) //display first song in queue, and then remove it from the queue
                if (playlist.isEmpty())
                    System.out.println("*** No songs in playlist ***");
                else
                    System.out.println("*** Now playing: ***");
                    System.out.println(playlist.getItem(1));
                    playlist.removeFromQueue();
            if (choice ==3)
                if (playlist.isEmpty())
                    System.out.println("*** No songs in playlist ***" + "\n");
                    return;
                    System.out.println("*** Songs currently in playlist ***");
                    for (int i = 1; i <= playlist.getTotal(); i++)
                        System.out.println(playlist.getItem(i));
            if (choice == 4)
                System.out.println("*** Thank you for using the juke box simulator ***");
            while (choice != 4);
    }Any ideas?

    Hi,
    I just realised that before u posyed (honest, I did hehe), and now my code its like this
    public boolean removeFromQueue()
            int i;
            if (isEmpty())
                return false;
            else
                for (i=1; i <= total; i++)
                    queue[i-1] = queue[i-];
                total--;
                return true;
        }But now I get IndexOutOfBoundsException :s

  • Problem with array of SimpleAccountBean as parameter

    Hello,
    I have deployed the simplebean sample under s1as7. It is working fine.
    In addition, I have create a method called test1 which has the following Signature test1(SimpleAccountBean[], String in).
    I have modified the wsdl for it and got a clean build from ant. However, when I run the client, I got the following exception.
    Once I change back to a single SimpleAccountBean object, then everything is fine.
    FINEST: got request for endpoint: HelloWorld
    FINEST: invoking implementor: com.sun.xml.rpc.server.http.Implementor@8f03a5
    WARNING: CORE3283: stderr: deserialization error: unexpected XML reader state. e
    xpected: END but found: START: ArrayOfSimpleAccountBean_1
    WARNING: CORE3283: stderr: at com.sun.xml.rpc.encoding.ObjectSerializerBase
    .deserialize(ObjectSerializerBase.java:202)
    WARNING: CORE3283: stderr: at com.sun.xml.rpc.encoding.ReferenceableSeriali
    zerImpl.deserialize(ReferenceableSerializerImpl.java:115)
    WARNING: CORE3283: stderr: at samples.webservices.jaxrpc.simplebean.HelloIF
    Tie.deserializetest2(HelloIF_Tie.java:278)
    WARNING: CORE3283: stderr: at samples.webservices.jaxrpc.simplebean.HelloIF
    Tie.readFirstBodyElement(HelloIFTie.java:212)
    WARNING: CORE3283: stderr: at com.sun.xml.rpc.server.StreamingHandler.handl
    e(StreamingHandler.java:164)
    WARNING: CORE3283: stderr: at com.sun.xml.rpc.server.http.JAXRPCServletDele
    gate.doPost(JAXRPCServletDelegate.java:280)
    WARNING: CORE3283: stderr: at com.sun.xml.rpc.server.http.JAXRPCServlet.doP
    ost(JAXRPCServlet.java:69)
    WARNING: CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpSe......
    My HelloWorld.wsdl file bits:
    ----------------------wsdl Type definition -----------------------------
    <complexType name="SimpleAccountBean">
    <sequence>
    <element name="balance" type="decimal"/>
    <element name="customerName" type="string"/></sequence></complexType>
    <complexType name="ArrayOfSimpleAccountBean">
    <complexContent>
    <restriction base="soap-enc:Array">
    <sequence>
    <element minOccurs="0" maxOccurs="unbounded" name="notaa" type="ns2:SimpleAccountBean"/>
    </sequence>
    <attribute ref="soap-enc:arrayType" wsdl:arrayType="ns2:SimpleAccountBean[]"/>
    </restriction></complexContent></complexType>
    ---------------------- end of wsdl Type definition-------------------
    ----------------------wsdl message definition-----------------------
    <message name="HelloIF_test2">
    <part name="ArrayOfSimpleAccountBean_1" type="ns2:ArrayOfSimpleAccountBean"/><part name="String_3" type="xsd:string"/></message>
    <message name="HelloIF_test2Response">
    <part name="result" type="xsd:decimal"/></message>
    ----------------------end of wsdl message definition---------------
    ----------------------wsdl operation definition-------------------------
    <operation name="test2" parameterOrder="ArrayOfSimpleAccountBean_1 String_3">
    <input message="tns:HelloIF_test2"/>
    <output message="tns:HelloIF_test2Response"/></operation>
    ----------------------end of wsdl operation definition---------------
    can somebody see anything wrong with the wsdl file?
    thanks...
    victor

    Hi Victor,
    I would encourage you to use the tools, like XRPCC or wscompile/deploy, that come with the Appserver to create the WSDL file for you. It is actually very difficult to figure fauts out from the WSDL.
    If you want to change any method signatures, do not forget to recreate the ties, WSDL and then stubs. Just changing in one file may not work. Infact this is the easiest and effective approach.
    Please get back for further information.
    Thanks,
    Rakesh.

  • Problem with array

    I want my code to put the values in the Passenger class into an array, but I keep getting these three errors, "cannot find symbol" in reference to the symbol "contructor Passenger(int)" at the line of code            Passenger thePass = new Passenger(1400);  and a "cannot find symbol error" in reference to the symbol contructor Passenger(double, java.lang, int) at the line of code                Passenger Pass = new Passenger(age, name, survived); and an "array required, but Passenger found" error in reference                 thePass[count] = Pass; Can anyobody help? It's driving me crazy.
    public class MYPA6
         public MYPA6() throws IOException
              String filename = JOptionPane.showInputDialog (null,"Give name of the input file:");
                 File inputFile = new File(filename);    //calls the file
                 Scanner scan = new Scanner( inputFile ); //scans the data of file
               scan.useDelimiter("[|\n\r]+");
               Passenger thePass = new Passenger(1400);
              int count = 0;
               while(scan.hasNext() )
                   int position = scan.nextInt();
                   String Class = scan.next();
                   int survived = scan.nextInt();
                   String name = scan.next();
                   double age = scan.nextDouble();
                   Passenger Pass = new Passenger(age, name, survived);
                   thePass[count] = Pass;
                   count++;
         public static void main (String [] args) throws IOException
              new MYPA6();
    class Passenger
      int posit;
      String Cls;
      int surv;
      String nam;
      double ag;
          public Passenger(int position, String Class, int survived, String name, double age)
               posit = position;
              Cls = Class;
              surv = survived;
              nam = name;
              ag = age;
    /**************************************************************************/

    thePass should be declared likePassenger[] thePass = new Passenger[1400];I'm guessing you intend it to be an array not a Passenger.
    And when the Passenger is constructed you need to pass
    all the argumentsPassenger Pass = new Passenger(position, Class, survived, name, age);Lower case variable names are good (pass and cls, not Pass and Class).
    Cheers,
    Peter

  • Problem with array param when calling a webservice from a BPM Process

    Hi. I have a web service and uses an array as parameter.
    The array (named "atributos") as part of a business object is defined here:
    <xs:schema targetNamespace="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/TrackPCPDOTrans" ...>
    <xs:complexType name="TrackPCPDOTransType">
    <xs:sequence>
    <xs:element name=... />
    <xs:element name="atributos" nillable="true" type="ns2:AtributosType" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="TrackPCPDOTrans" type="TrackPCPDOTransType"/>
    </xs:schema>
    <xs:schema targetNamespace=... >
    <xs:complexType name="AtributosType">
    <xs:sequence>
    <xs:element name="key" nillable="true" type="xs:string"/>
    <xs:element name="value" nillable="true" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="Atributos" type="AtributosType"/>
    </xs:schema>
    In the service task activity, I pass the params to the web service:
    "descripcion" --> TrackPCPDOTrans.atributos[1].key
    DataObject.descripcion --> TrackPCPDOTrans.atributos[1].value
    "estado" --> TrackPCPDOTrans.atributos[2].key
    DataObject.estado --> TrackPCPDOTrans.atributos[2].value
    "justificacion" --> TrackPCPDOTrans.atributos[3].key
    DataObject.justificacion --> TrackPCPDOTrans.atributos[3].value
    But when I test the process, an error ocurrs:
    <auditQueryPayload auditId="8712004" ciKey="380019">
    <dataState>
    <dataObject name="FaultMessage" isBusinessIndicator="false">
    <value> oracle.bpm.bpmn.engine.model.runtime.microinstructions.TrappableException: faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage} cause: {faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure} messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage} parts: {{ summary=<summary>empty expression result. The expression bpmn:getDataInput('trackPCPDOTrans')/ns:atributos[2]/ns1:key is empty. An attempt to read or copy data referenced or computed by the XPath expression either had invalid data, according to the XML schema, or did not contain certain optional data. Ensure that the variable or expression result named in the error message is not empty. Enable XML schema validation of related data elements to ensure the run-time data is valid. </summary>} } </value>
    </dataObject>
    </dataState>
    </auditQueryPayload>
    What is wrong?
    Thanks for your help.

    I did the assignment in XPATH:
    oraext:parseXML(concat('<AtributosTracking xmlns="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/AtributosTracking">
    <arrayAtributosTracking>
    <key xmlns="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos">','descripcion','</key>
    <value xmlns="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos">',bpmn:getDataObject('DataObjectDDSAO')/ns:descripcion,'</value>
    </arrayAtributosTracking>
    <arrayAtributosTracking>
    <key xmlns="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos">','estado','</key>
    <value xmlns="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos">',bpmn:getDataObject('DataObjectDDSAO')/ns:estado,'</value>
    </arrayAtributosTracking>
    </AtributosTracking>'))
    AtributosTracking.xsd:
    <?xml version="1.0" encoding="UTF-8"?>
    <?bpmo version="11.1.1.6.0.15.53" build="15.53" fullName="DataTypes.AtributosTracking" modifiers="268435456"?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/AtributosTracking" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/AtributosTracking" xmlns:ns1="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos" xmlns:bpmo="http://xmlns.oracle.com/bpm/bpmobject/" >
    <xs:import namespace="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos" schemaLocation="Atributos.xsd"/>
    <xs:complexType name="AtributosTrackingType">
    <xs:sequence>
    <xs:element name="arrayAtributosTracking" nillable="true" type="ns1:AtributosType" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="AtributosTracking" type="AtributosTrackingType"/>
    Atributos.xsd:
    <?xml version="1.0" encoding="UTF-8"?>
    <?bpmo version="11.1.1.6.0.15.53" build="15.53" fullName="DataTypes.Atributos" modifiers="0"?>
    <xs:schema targetNamespace="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://xmlns.oracle.com/bpm/bpmobject/DataTypes/Atributos" xmlns:bpmo="http://xmlns.oracle.com/bpm/bpmobject/" >
    <xs:complexType name="AtributosType">
    <xs:sequence>
    <xs:element name="key" nillable="true" type="xs:string"/>
    <xs:element name="value" nillable="true" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
    <xs:element name="Atributos" type="AtributosType"/>
    </xs:schema>
    But a new error occurrs when I run the BPM process:
    <auditQueryPayload auditId="8724004" ciKey="380025">
    <dataState>
    <dataObject name="FaultMessage" isBusinessIndicator="false">
    <value> oracle.bpm.bpmn.engine.model.runtime.microinstructions.TrappableException:
    faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure}
    messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
    cause: {faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure}
    messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
    parts: {{ summary=<summary>XPath query string returns multiple nodes.
    The assign activity part and query bpmn:getDataObject('AtributosTracking')/ns:atributosTracking are returning multiple nodes.
    The assign activity part and query named in the error message returned multiple nodes. It should return single node.
    According to BPEL4WS specification 1.1 section 14.3, the assign activity part and query named in the error message should
    not return multiple nodes. Verify the part and xpath query named in the error message at line number -1 in the BPEL source. </summary>} } </value>
    </dataObject>
    </dataState>
    </auditQueryPayload>
    Any idea?
    Thanks
    Edited by: César on 10/01/2013 11:02 AM

  • Problem with array size...PLEASE HELP

    hi...
    I want to keep putting the Strings that user inputs, in an array. I don't know how many of them there are, and I don't want to define a big array like :
    String myArray[]= String [1000];
    what am I suppose to do?
    PLEASE HELP...!
    Thanks

    Use a Vector or an ArrayList instead of a straight array.

  • Big Problem with Array. FLash 9 Problem?

    Hello there
    there must be a lag or ssomething here. i have this code:
    // A new dimensional Array, the array is korrekt. The Length
    and when i ask only one Array ellement is everythin ok
    var okeytaslari:Array=new Array();
    var d:Number;
    var e:Number;
    var farbenarray:Array =
    ["000000","0099FF","FF00FF","FF0000"];
    var farbenarray1:Array = ["s","b","g","r"];
    var r:Number=0;
    for (var farbenn=0;farbenn<4;farbenn++)
    for(d=0;d<2;d++)
    for(e=1;e<14;e++)
    okeytaslari.push({klasse:farbenarray1[farbenn]+"_"+e,farbe:farbenarray[farbenn],zahl:e,in stanzname:"s"+r});
    r++
    okeytaslari.push({klasse:"j_j",farbe:"FF00FF",zahl:"j",instanzname:"s104"});
    okeytaslari.push({klasse:"j_j",farbe:"FF00FF",zahl:"j",instanzname:"s105"});
    // here in this array are maximum 15 Numbers in which the
    highest Number is 105 because of Array okeytaslari.length
    var beispieltaslari:Array = [...]
    for (q=0; q<beispieltaslari.length; q++)
    trace(q +","+beispieltaslari
    quote:
    +","+okeytaslari[beispieltaslari
    quote:
    ].instanzname);
    //This is the Trace action first Line are the NUmbers in
    beispieltasri array
    // then after 2nd line the outpu is q and beispieltaslari
    quote:
    and okeytaslari[beispieltaslari
    quote:
    ].instanzname
    // if you can see the numbers SHOULD be the same but it isnt
    all the time. After 60 or something the Number changes
    14,7,90,63,68,102,44,91,25,42,89,53,92,52,99
    0,14,s14
    1,7,s7
    2,90,s91
    3,63,s63
    4,68,s68
    5,102,s103
    6,44,s44
    7,91,s92
    8,25,s25
    9,42,s42
    10,89,s90
    11,53,s53
    12,92,s93
    The numbers i get from my Server dynamikly. But you can see
    that they come correct and the first array is also correct :S
    Help please :(

    ups sorry i send it twice :D

Maybe you are looking for

  • Can I run two Dell 24" monitors with iMac 27" (5750) in portrait mode

    Hi there, want to putchase the 5750-based iMac 27", but I have a pair of Dell 24" monitors I want to run with it, preferably both in portrait mode. Is this possible? Or if not, is it possible with some sort of adaptor/external graphics card? Thanks k

  • How to develop web services in OSB using Eclipse OEPE

    Hello, We have some live web services developed in SOA ESB using JDeveloper. We are now forced to migrate to OSB because of the reason that sometime next year ESB will be de-supported by Oracle. I am looking for some good documentation which explains

  • Can any help on JMS topic timeout issue

    Hi ,           I am getting following error while reading the messages from JMS queue, can any one help me what time out setting i need to increase at console.           Thanks in advance           2005-11-03 05:02:36,839 ERROR ExecuteThread: '2' for

  • Need to open PDF doc from OAF pages

    Hi Everyone, We have a requirement where Once the Detail Report of Products are displayed the PDF output should be retreived from page. Detail Report of Products is a custom developed page where Product details are present. Now I am creating a button

  • Convert Varchar to Hour

    Hi, I have a field DATE. This item contain a Date. But I have other variable varchar that contain hour (hh:mi:ss). I have to convert this varchar to a hour ant concat with the Date Field. How can I do this? Thankss