Java "for loop" in KM

Hi All,
I have a Table(I$_Customer) where i have data like this:
CN;CA; CAD; Row_type; Rank; File_number
CN;CA;CAD;1; 0; 1
A; 25; A; 2; 1; 1
B; 60; B; 2; 2; 1
C; 15; C; 2; 3; 2
D; 23; D; 2; 4; 2
E; 21; E; 2; 5; 2
F; 21; F; 2; 6; 3
G; 25; G; 2; 7; 3
H; 25; H; 2; 8; 3
I; 25; I; 2; 9; 3
J; 26; J; 2; 10; 3
This is my data i have to load rows to different files using 1 interface based on the file_number column
so first 3 rows will need to load to file :customer_1
next 3 rows need to load to file :customer_2
and rest of the rows to file: Customer_3
In the IKM i have a command Sqlunload which is executing on Sunopsis API Technology:
import.java.sql.*;
int var_counter;
For(var_counter=1;var_counter<=5;var_counter++)
Sqlunload with where clause file_number=var_counter
I have not used java + Sunopsis API
so if any body can help is very great
Thanks
Edited by: Gourav Atalkar(ELT) on Feb 28, 2013 3:46 AM

Oh, I see.
Can you tell me the name of your IKM ? It would be easier to help you.
I don't know Java and Jython, so I can't really help you with this technology.
But I've got an idea. You could use the "command on destination" / "command on source" tabs to generate your loop.
0) You have created your I$ table with the 3 news columns. Right ?
1)Then, you could create an extra step that will create and load N "I$_X" tables.
in "command on source tab", you write an SQL statement like this :
"select distinct FILE_NUMBER from I$"in "command on destination tab", you write an SQL Statement like this :
create table I$_#FILE_NUMBER(you can duplicate the "create flow table" and just add the #FILE_NUMBER)
With that, the IKM will execute the "create table" statement for each result of the "select distinct file_number" statement.
So it will create 3 I$ tables : I$_1 ; I$_2 ; I$_3.
2) Then, you will have to add a news step that will load these I$ table.
in "command on source tab", you write an SQL statement like this :
"select distinct FILE_NUMBER from I$"in "command on destination tab", you write an SQL Statement like this :
insert into table I$_#FILE_NUMBER
select .. from I$ where FILE_NUMBER = #FILE_NUMBER3) Then you will have to use the same technique to create many files

Similar Messages

  • How convert java FOR loop into  taglib directive

    hi all,
    I have following code in my Jsp. It is working but, we dont want to use java FOR loop anymore. Instead use corresponding taglib directive.
    How can i convert this Java FOR loop into taglib implementation of FOR loop ?
                   <%
                   for(int i=0;i< arrMemberBenefit.length;i++)     {
                        pageContext.setAttribute("arrMemberBenefiti", arrMemberBenefit);
    System.out.println("PCPNAME: " + arrMemberBenefit[0].getPcpName());
    %>
                        <tr class="rowOdd">
                             <td headers="t1h1" class="first"><c:out value="${arrMemberBenefiti.member.firstName}${space}${arrMemberBenefiti.member.lastName}" /></td>
                             <td headers="t1h2" class="last"><c:out value="${arrMemberBenefiti.pcpName}" /></td>
                        </tr>
    <%}
    %>
    pl any help highly apprecialted
    pp

    Using the JSTL forEach tag:
    I have used your variable name for arrMemberBenefiti
    myself I would probably call it something like memberBenefit
    You may need to put the array into an attribute to begin with
    // just in case
    <% pageContext.setAttribute("arrMemberBenefit", arrMemberBenefit); %>
    // and the actual JSTL loop
    <c:forEach var="arrMemberBenefiti" items="${arrMemberBenefit}">
      <tr class="rowOdd">
        <td headers="t1h1" class="first"><c:out value="${arrMemberBenefiti.member.firstName}${space}${arrMemberBenefiti.member. lastName}" /></td>
        <td headers="t1h2" class="last"><c:out value="${arrMemberBenefiti.pcpName}" /></td>
      </tr>
    </c:forEach>Cheers,
    evnafets

  • Please help me.. how to rewrite the following java- for loop code in ada

    int i, j, n = 100;
    for (i = 0, j = 17; i < n; i++, j-- )
    sum += i * j + 3;

    how to rewrite the following java- for loop code in ada
    You should have a programming manual for Ada first. If you mean it the other way round, I think you subject line confused me.

  • Java for loop

    I have to design and create a program that reads in a sequence of student grades and computes the average grade, the number of students who pass (a grade of at least 60) and the number who fail. The program prints the total number of student, average grade, number of students who pass and number of students who fail.
    I have written the pseudocode as follows, which i believe is flawed, hence the following code is not working either. Any help would be appreciated.
    Read the number of students
    Start loop
    Read a number for the first student
    Student total grades = Student total grades + student grade
    Calculate the total of all the students marks
    End loop
    Calculate average grade for the students
    If the student grade is greater than 60
    calculate how many students got grade 60 and above ??
    Else
    calculate how many students got grade 59 and below??
    Print to the screen total amount of students
    Print to the screen the average grade
    Print to the screen the amount of student that have passed
    print to the screen the amount of students that have failed
    import java.io.*;
    public class grades
    public static void main (String args [])throws IOException
         int averagegrade, grade, numberofstudents, totalgrades,storage,sumpassed,sumfailed;
         String information ;
         BufferedReader stgin = new BufferedReader ( new InputStreamReader ( System.in ) );
         sumpassed = 0;
         sumfailed  = 0;
         numberofstudents = 0;
         totalgrades = 0;
         grade = 0;
         averagegrade = 0;
         System.out.println ("Enter the number of students");
         information = stgin.readLine();
         numberofstudents = Integer.parseInt (information) ;
         for (  storage = 0 ;   storage < numberofstudents ; storage ++ )
         System.out.println ("Enter grade of a student");
         information = stgin.readLine();
         grade = Integer.parseInt( information );
            totalgrades = totalgrades + grade;
           averagegrade = totalgrades / numberofstudents;
             if (grade >= 60 )
             sumpassed = sumpassed + numberofstudents  ;
         else
         sumfailed = sumfailed + numberofstudents ;
         System.out.println ( " Total amount of students entered " + numberofstudents );
         System.out.println ( " The average student grade is " + averagegrade);
         System.out.println ( " Total amount of students that passed is " + sumpassed);
         System.out.println ( " Total amount of students that failed is " + sumfailed );
    }

    I have a very similiar project I need to do. I need to find averages of grades. They need to be between 0 - 100 or a message is given. Once grades are all entered they need to be averaged and that needs to be displayed. I am new new new to this and an so lost! Here is what I have so far, if ANYONE can help it would be great. I have to have this finished by this evening. UGH!
    import javax.swing.*;
    public class Grades2
         public static void main(String[] args)
              int count = 0; // Initialize these to zero.
              int total = 0; // Initialize these to zero
              int avg = 0; // Initialize these to zero.
              int input; // Don't need to initialize, but it won't hurt
    // Display a message requesting a grade between 0 and 100
         System.out.println("Enter numerical grades");
              input = value; // Store the input to variable input
              while(input != 999) {     // If they entered 999, the while loop will not run.
    if ((input >= 0) && (input <= 100)) // Check if value is in the range of 0 to 100
    count ++; // Increment the number of values input
    total += input; // Add the input to the running total
    else
    {           // the value was not between 0 and 100, the while loop will check to see if it is 999
         JOptionPane.showMessageDialog(null, "Enter a valid grade",
                   "Grades Program", JOptionPane.INFORMATION_MESSAGE);
    // Do not increment count
    // Do not increment the total.
    input = JOptionPane.showInputDialog("Enter a Final Grade: ");
    // Input = new value;
                                       } // This loop will continue to run until the user enters 999 as the input
                   if (count == 0) {           // I'm doing this check because you don't want to do a divide by zero
         JOptionPane.showMessageDialog(null, "No grade has been issued",
                   "Grades Program", JOptionPane.INFORMATION_MESSAGE); ;
                   else {
         System.out.println("The average is: " + total / count);
         }

  • How can I make a Java program pyramid using for loops??

    Hi guys, so I'm stuck with my program here... I don't know how to make it work, and i've been trying really hard.. So now i give up and need some guidance.. Please help me here.
    Your job in this assignment is to write programs to solve each of these six problems.
    1. Write a GraphicsProgram subclass that draws a pyramid consisting of bricks
    arranged in horizontal rows, so that the number of bricks in each row decreases by
    one as you move up the pyramid, as shown in the following sample run:
    The pyramid should be centered at the bottom of the window and should use
    constants for the following parameters:
    BRICK_WIDTH The width of each brick (30 pixels)
    BRICK_HEIGHT The height of each brick (12 pixels)
    BRICKS_IN_BASE The number of bricks in the base (14)
    The numbers in parentheses show the values for this diagram, but you must be able
    to change those values in your program.
    * File: Pyramid.java
    * Name:
    * Section Leader:
    * This file is the starter file for the Pyramid problem.
    * It includes definitions of the constants that match the
    * sample run in the assignment, but you should make sure
    * that changing these values causes the generated display
    * to change accordingly.
    import acm.graphics.*;
    import acm.program.*;
    import java.awt.*;
    public class Pyramid extends GraphicsProgram {
    /** Width of each brick in pixels */
         private static final int BRICK_WIDTH = 30;
    /** Width of each brick in pixels */
         private static final int BRICK_HEIGHT = 12;
    /** Number of bricks in the base of the pyramid */
         private static final int BRICKS_IN_BASE = 14;
         public void run() {     
    }That's my problem.

    yo, so i figure out my for loop. my code is very very very very ugly, so dont laugh i know its ugly! just wanna ask for some tips
    public void run() {
              int initBrick = 30;
              int initPlacement = (getWidth() - BRICK_WIDTH) / 2;
              for (int i = 0; i < initBrick; i += 30)
                   int initX = i;
                   int x = initX + initPlacement;
                   GRect brick = new GRect(x, 0, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 60; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 15;
                   int y = 12;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 90; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 30;
                   int y = 24;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 120; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 45;
                   int y = 36;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 150; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 60;
                   int y = 48;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 180; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 75;
                   int y = 60;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 210; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 90;
                   int y = 72;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 240; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 105;
                   int y = 84;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 270; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 120;
                   int y = 96;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 300; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 135;
                   int y = 108;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 330; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 150;
                   int y = 120;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 360; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 165;
                   int y = 132;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 390; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 180;
                   int y = 144;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
              for (int i = 0; i < 420; i += 30)
                   int initX = i;
                   int x = (initX + initPlacement) - 195;
                   int y = 156;
                   GRect brick = new GRect(x, y, BRICK_WIDTH, BRICK_HEIGHT);
                   add(brick);
         }So yeah, it's very ugly. not general. BUT now; I know the logic of the program..
    I need to change 3 variables here.
    the Y var, the X variable, and the size of the loop test..
    so I need to make a one compact for loop that will change those 3 for every time the loop finish, or for every row the variable will change...
    Ill try to think again, ill head to the balcony, and squeeze my brain. YEAH it took me this long to figure this out, anyway im a noob YET. But i was working a while ago.
    ANYWAY, leave some tips please.. I NEED TIPS NOT SOLUTION

  • Java For-each loop to JavaFX for loop

    Hi
    I have a the following Java for-each loop :
    private int w = 250;
    private int h = 100;
    private int targetPixel[];
    private final static int a = 0xff000000;
    for (int i=w*h-1;i>=0;i--)
         targetPixel=a;
    My problem is since in JavaFX their is no for each loop how do you convert this java for-each loop to a JavaFX loop? Could you please provide me a solution with a sample code.
    Thank you.

    How to resolve this code to java fx?
    int particles = 10;
    int textures = 32;
    Random rnd =new Random();
    IDX particle=new IDX [particles];
    for(int i=0;i<particles;i++)
         particle=new IDX (textures*i/particles,rnd);
    Here new IDX is a class like the following class IDX
         double x;
         double y;
         double z;
         int xx;
         int yy;
         int index; //Texture index
         public IDX (int textureID,Random rnd)
              x=rnd.nextDouble()*2-1;
              y=rnd.nextDouble()*2-1;
              z=rnd.nextDouble()*2-1;
              index=textureID;
    my problem is how do you pass values to a java fx class constructor if javafx class has constructors. please help?
    Edited by: R34GTR on May 14, 2009 8:29 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Hello...Java is supporting mutiple datatypes declarations in for loop

    hello,
    is it possible to declare more than one data types in a for loop...i think java is supporting multiple declarations in for loop..am i right
    class check
         public static void main(String[] args)
              for(int i=10,float k=10;i<5;i++)
                   System.out.println("Hello World!"+i);
    regards,
    j.mouli

    Hi,
    no, that doesn't work because java unlike c++ does not
    have the comma operator ",". So you need to declare
    the 2nd variable in the body of the loopNot strictly correct - its true that it won't work in this case, but false that Java doesn't recognise the comma.
    If your two variables were of the same type you could use something like
    for (int i = 0, k = 10; i < k; i++)
    However, the initialisation must take place in a single statement, so you can't use multiple types

  • Java - sleep in a for loop doesn't work (as desired)

    Hey all,
    I'm trying to get a draw animation when the mouse is released (after dragging an object to a set area on the screen) - hence I'm trying to do this via a for loop with a small sleep() delay. However it isn't working. The delay is there, but nothing changes until the end of the for loop and then you only see the final repaint() [i.e. instead of each iteration in the for loop]:
    // This program is concerned with this and the mouseDragged methods
         public void mouseReleased(MouseEvent e)
              for( int c = 0; c < xButton.length; c++)
                   if( xButton[c] >= xRandWeight && xButton[c] <= (xRandWeight+50) && yButton[c] >= yRandWeight && yButton[c] <= (yRandWeight+50) )
                        // Have an animation for the scales re-adjusting
                        if( c == 0 )
                             currWeight = (int)(scales.getWeight2());
                             desiredWeight = Integer.parseInt(b1.getLabel());
                             if( desiredWeight >= currWeight )
                                  // More efficient than putting this subtraction straight into for loop
                                  difference = desiredWeight - currWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight+count);
                                       repaint();
                                       try
                                            Thread.currentThread().sleep(100);
                                       catch (InterruptedException in)
                                            in.printStackTrace();
                             else
                                  difference = currWeight - desiredWeight;
                                  for( int count = 1 ; count <= difference ; count++ )
                                       scales.setWeight2(currWeight-count);
                                       repaint();
         }Any ideas on how to fix this/meet the goal would be greatly appreciated :)
    Thanks,
    Tristan Perry
    Edited by: TristanPerry on Nov 16, 2008 12:36 PM

    My program isn't being written in SWINGFirst, it's Swing, not SWING. It's not an acronym.
    Perhaps you would like to tell us which windowing toolkit you are using, so that you can get better responses. Or is that a closely guarded secret? <sarcasm/>
    I'm very new to JavaSo ditch the GUI stuff and get a foundation first.
    db

  • How can I repeat a for loop, once it's terms has been fulfilled???

    Well.. I've posted 2 different exceptions about this game today, but I managed to fix them all by myself, but now I'm facing another problem, which is NOT an error, but just a regular question.. HOW CAN I REPEAT A FOR LOOP ONCE IT HAS FULFILLED IT'S TERMS OF RUNNING?!
    I've been trying many different things, AND, the 'continue' statement too, and I honestly think that what it takes IS a continue statement, BUT I don't know how to use it so that it does what I want it too.. -.-'
    Anyway.. Enought chit-chat. I have a nice functional game running that maximum allows 3 apples in the air in the same time.. But now my question is: How can I make it create 3 more appels once the 3 first onces has either been catched or fallen out the screen..?
    Here's my COMPLETE sourcecode, so if you know just a little bit of Java you should be able to figure it out, and hopefully you'll be able to tell me what to do now, to make it repeat my for loop:
    Main.java:
    import java.applet.*;
    import java.awt.*;
    @SuppressWarnings("serial")
    public class Main extends Applet implements Runnable
         private Image buffering_image;
         private Graphics buffering_graphics;
         private int max_apples = 3;
         private int score = 0;
         private GameObject player;
         private GameObject[] apple = new GameObject[max_apples];
         private boolean move_left = false;
         private boolean move_right = false;
        public void init()
            load_content();
            setBackground(Color.BLACK);
         public void run()
              while(true)
                   if(move_left)
                        player.player_x -= player.movement_speed;
                   else if(move_right)
                        player.player_x += player.movement_speed;
                   for(int i = 0; i < max_apples; i++)
                       apple.apple_y += apple[i].falling_speed;
                   repaint();
                   prevent();
                   collision();
              try
              Thread.sleep(20);
              catch(InterruptedException ie)
              System.out.println(ie);
         private void prevent()
              if(player.player_x <= 0)
              player.player_x = 0;     
              else if(player.player_x >= 925)
              player.player_x = 925;     
         private void load_content()
         MediaTracker media = new MediaTracker(this);
         player = new GameObject(getImage(getCodeBase(), "Sprites/player.gif"));
         media.addImage(player.sprite, 0);
         for(int i = 0; i < max_apples; i++)
         apple[i] = new GameObject(getImage(getCodeBase(), "Sprites/apple.jpg"));
         try
         media.waitForAll();     
         catch(Exception e)
              System.out.println(e);
         public boolean collision()
              for(int i = 0; i < max_apples; i++)
              Rectangle apple_rect = new Rectangle(apple[i].apple_x, apple[i].apple_y,
    apple[i].sprite.getWidth(this),
    apple[i].sprite.getHeight(this));
              Rectangle player_rect = new Rectangle(player.player_x, player.player_y,
    player.sprite.getWidth(this),
    player.sprite.getHeight(this));
              if(apple_rect.intersects(player_rect))
                   if(apple[i].alive)
                   score++;
                   apple[i].alive = false;
                   if(!apple[i].alive)
                   apple[i].alive = false;     
         return true;
    public void update(Graphics g)
    if(buffering_image == null)
    buffering_image = createImage(getSize().width, getSize().height);
    buffering_graphics = buffering_image.getGraphics();
    buffering_graphics.setColor(getBackground());
    buffering_graphics.fillRect(0, 0, getSize().width, getSize().height);
    buffering_graphics.setColor(getForeground());
    paint(buffering_graphics);
    g.drawImage(buffering_image, 0, 0, this);
    public boolean keyDown(Event e, int i)
         i = e.key;
    if(i == 1006)
    move_left = true;
    else if(i == 1007)
         move_right = true;
              return true;     
    public boolean keyUp(Event e, int i)
         i = e.key;
    if(i == 1006)
    move_left = false;
    else if(i == 1007)
         move_right = false;
    return true;
    public void paint(Graphics g)
    g.drawImage(player.sprite, player.player_x, player.player_y, this);
    for(int i = 0; i < max_apples; i++)
         if(apple[i].alive)
              g.drawImage(apple[i].sprite, apple[i].apple_x, apple[i].apple_y, this);
    g.setColor(Color.RED);
    g.drawString("Score: " + score, 425, 100);
    public void start()
    Thread thread = new Thread(this);
    thread.start();
    @SuppressWarnings("deprecation")
         public void stop()
         Thread thread = new Thread(this);
    thread.stop();
    GameObject.java:import java.awt.*;
    import java.util.*;
    public class GameObject
    public Image sprite;
    public Random random = new Random();
    public int player_x;
    public int player_y;
    public int movement_speed = 15;
    public int falling_speed;
    public int apple_x;
    public int apple_y;
    public boolean alive;
    public GameObject(Image loaded_image)
         player_x = 425;
         player_y = 725;
         sprite = loaded_image;
         falling_speed = random.nextInt(10) + 1;
         apple_x = random.nextInt(920) + 1;
         apple_y = random.nextInt(100) + 1;
         alive = true;
    And now all I need is you to answer my question! =)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    package forums;
    import java.util.Random;
    import javax.swing.Timer;
    import javax.imageio.ImageIO;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    public class VimsiesRetardedAppleGamePanel extends JPanel implements KeyListener
      private static final long serialVersionUID = 1L;
      private static final int WIDTH = 800;
      private static final int HEIGHT = 600;
      private static final int MAX_APPLES = 3;
      private static final Random RANDOM = new Random();
      private int score = 0;
      private Player player;
      private Apple[] apples = new Apple[MAX_APPLES];
      private boolean moveLeft = false;
      private boolean moveRight = false;
      abstract class Sprite
        public final Image image;
        public int x;
        public int y;
        public boolean isAlive = true;
        public Sprite(String imageFilename, int x, int y) {
          try {
            this.image = ImageIO.read(new File(imageFilename));
          } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException("Bailing out: Can't load images!");
          this.x = x;
          this.y = y;
          this.isAlive = true;
        public Rectangle getRectangle() {
          return new Rectangle(x, y, image.getWidth(null), image.getHeight(null));
      class Player extends Sprite
        public static final int SPEED = 15;
        public Player() {
          super("C:/Java/home/src/images/player.jpg", WIDTH/2, 0);
          y = HEIGHT-image.getHeight(null)-30;
      class Apple extends Sprite
        public int fallingSpeed;
        public Apple() {
          super("C:/Java/home/src/images/apple.jpg", 0, 0);
          reset();
        public void reset() {
          this.x = RANDOM.nextInt(WIDTH-image.getWidth(null));
          this.y = RANDOM.nextInt(300);
          this.fallingSpeed = RANDOM.nextInt(8) + 3;
          this.isAlive = true;
      private final Timer timer = new Timer(200,
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            repaint();
      public VimsiesRetardedAppleGamePanel() {
        this.player = new Player();
        for(int i=0; i<MAX_APPLES; i++) {
          apples[i] = new Apple();
        setBackground(Color.BLACK);
        setFocusable(true); // required to generate key listener events.
        addKeyListener(this);
        timer.setInitialDelay(1000);
        timer.start();
      public void keyPressed(KeyEvent e)  {
        if (e.getKeyCode() == e.VK_LEFT) {
          moveLeft = true;
          moveRight = false;
        } else if (e.getKeyCode() == e.VK_RIGHT) {
          moveRight = true;
          moveLeft = false;
      public void keyReleased(KeyEvent e) {
        moveRight = false;
        moveLeft = false;
      public void keyTyped(KeyEvent e) {
        // do nothing
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        //System.err.println("DEBUG: moveLeft="+moveLeft+", moveRight="+moveRight);
        if ( moveLeft ) {
          player.x -= player.SPEED;
          if (player.x < 0) {
            player.x = 0;
        } else if ( moveRight ) {
          player.x += player.SPEED;
          if (player.x > getWidth()) {
            player.x = getWidth();
        //System.err.println("DEBUG: player.x="+player.x);
        Rectangle playerRect = player.getRectangle();
        for ( Apple apple : apples ) {
          apple.y += apple.fallingSpeed;
          Rectangle appleRect = apple.getRectangle();
          if ( appleRect.intersects(playerRect) ) {
            if ( apple.isAlive ) {
              score++;
              apple.isAlive = false;
        g.drawImage(player.image, player.x, player.y, this);
        for( Apple apple : apples ) {
          if ( apple.isAlive ) {
            g.drawImage(apple.image, apple.x, apple.y, this);
        g.setColor(Color.RED);
        g.drawString("Score: " + score, WIDTH/2-30, 10);
      private static void createAndShowGUI() {
        JFrame frame = new JFrame("Vimsies Retarded Apple Game");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(new VimsiesRetardedAppleGamePanel());
        frame.pack();
        frame.setSize(WIDTH, HEIGHT);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args) {
        SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              createAndShowGUI();
    }Hey Vimsie, try resetting a dead apple and see what happens.

  • Getting the label of a JButton in a for loop

    hi,
    I doing a project for my course at the minute and im in need of a bit of help. I have set up 1-d array of buttons and i have layed them out using a for loop. I have also added an annoymous action listener to each button in the loop. It looks something lke this:
    b = new JButton[43];
    for (int i=1; i<43; i++)
    b[i] = new JButton(" ");
    b.addActionListener(
    new ActionListener()
    public void actionPerformed(ActionEvent e)
              System.out.println("..........");
    }); // addActionListener
    } // for
    I want the "System.out.println( ..." line, to print out the "i" number of the button that was pressed but i cannot figure out how to do it. I cannot put "System.out.println(" "+i);" as it wont recognise i as it is not inside the for loop. Does anyone have any suggestions?
    Thanks!!

    class ButtonExample extends JFrame implements ActionListener{The OP wanted to have anonymous listeners, not a subclassed JFrame
    listening to the buttons. I don't know if the following is the best design,
    since the poster has revealed so little, but here is how to pass the
    loop index to an anonymous class.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ButtonExample {
        private JButton[] buttons = new JButton[24];
        public JPanel createGUI() {
            JPanel gui = new JPanel(new GridLayout(6,  4));
            for(int i=0; i<buttons.length; i++) {
                final int ii = i; //!! !
                buttons[i] = new JButton("button #" + i);
                buttons.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent evt) {
    System.out.println("number " + ii);
    gui.add(buttons[i]);
    return gui;
    public static void main(String[] args) {
    ButtonExample app = new ButtonExample();
    JPanel gui = app.createGUI();
    JFrame f = new JFrame("ButtonExample");
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.getContentPane().add(gui);
    f.pack();
    f.setLocationRelativeTo(null);
    f.setVisible(true);

  • Why use cursor and for loop?

    Hi All
    So in general why would we use a cursor and a for loop to do update in a stored procedure?
    Why wouldnt we just use a single update statement ?
    is there compelling reason for using a cursor and a for loop: I am reading some code from a co-worker that the business logic for the select (set need to be updated) is complex but the update logic is simple (just set a flag to (0 or 1 or 2 or 3 or 4).
    But eventually the select come down to a key (row_id) so I re-write it using just a single sql statement.
    The size of the main table is about 2.6 to 3million rows
    Any thoughts on that??
    The code below I just do a google for cursor for update example in case for something to play with
    -Thanks for all your input
    create table f (a number, b varchar2(10));
    insert into f values (5,'five');
    insert into f values (6,'six');
    insert into f values (7,'seven');
    insert into f values (8,'eight');
    insert into f values (9,'nine');
    commit;
    create or replace procedure wco as
      cursor c_f is
        select a,b from f where length(b) = 5 for update;
        v_a f.a%type;
        v_b f.b%type;
    begin
      open c_f;
      loop
        fetch c_f into v_a, v_b;
        exit when c_f%notfound;
        update f set a=v_a*v_a where current of c_f;
      end loop;
      close c_f;
    end;
    exec wco;
    select * from f;
    drop table f;
    drop procedure wco;
    Joining multiple tables
    create table numbers_en (
      id_num  number        primary key,
      txt_num varchar2(10)
    insert into numbers_en values (1, 'one'  );
    insert into numbers_en values (2, 'two'  );
    insert into numbers_en values (3, 'three');
    insert into numbers_en values (4, 'four' );
    insert into numbers_en values (5, 'five' );
    insert into numbers_en values (6, 'six'  );
    create table lang (
       id_lang   char(2) primary key,
       txt_lang  varchar2(10)
    insert into lang values ('de', 'german');
    insert into lang values ('fr', 'french');
    insert into lang values ('it', 'italian');
    create table translations (
      id_num    references numbers_en,
      id_lang   references lang,
      txt_trans varchar2(10) not null
    insert into translations values (1, 'de', 'eins'   );
    insert into translations values (1, 'fr', 'un'     );
    insert into translations values (2, 'it', 'duo'    );
    insert into translations values (3, 'de', 'drei'   );
    insert into translations values (3, 'it', 'tre'    );
    insert into translations values (4, 'it', 'quattro');
    insert into translations values (6, 'de', 'sechs'  );
    insert into translations values (6, 'fr', 'six'    );
    declare
      cursor cur is
          select id_num,
                 txt_num,
                 id_lang,
                 txt_lang,
                 txt_trans
            from numbers_en join translations using(id_num)
                       left join lang         using(id_lang)
        for update of translations.txt_trans;
      rec cur%rowtype;
    begin
      for rec in cur loop
        dbms_output.put (
          to_char (rec.id_num         , '999') || ' - ' ||
          rpad    (rec.txt_num        ,   10 ) || ' - ' ||
          rpad(nvl(rec.txt_trans, ' '),   10 ) || ' - ' ||
                   rec.id_lang                 || ' - ' ||
          rpad    (rec.txt_lang       ,   10 )
        if mod(rec.id_num,2) = 0 then
          update translations set txt_trans = upper(txt_trans)
           where current of cur;
           dbms_output.put_line(' updated');
        else
          dbms_output.new_line;
        end if;
      end loop;
    end;
    /Edited by: xwo0owx on Apr 25, 2011 11:23 AM

    Adding my sixpence...
    PL/SQL is not that different from a SQL perspective than any other SQL client language like Java or C# or C/C++. PL/SQL simply integrates the 2 languages a heck of a lot better and far more transparent than the others. But make no mistake in that PL/SQL is also a "client" language from a SQL perspective. The (internal) calls PL/SQL make to the SQL engine, are the same (driver) calls made to the SQL engine when using Java and C and the others.
    So why a cursor and loops in PL/SQL? For the same reason you have cursors and loops in all these other SQL client languages. There are the occasion that you need to pull data from the SQL engine into the local language to perform some very funky and complex processing that is not possible using the SQL language.
    The danger is using client cursor loop processing as the norm - always pulling rows into the client language and crunching it there. This is not very performant. And pretty much impossible to scale. Developers in this case views the SQL language as a mere I/O interface for reading and writing rows. As they would use the standard file I/O read() and write() interface calls.
    Nothing could be further from the truth. SQL is a very advance and sophisticated data processing language. And it will always be faster than having to pull rows to a client language and process them there. However, SQL is not Turing complete. It is not the procedural type language that most other languages we use, are. For that reason there are things that we cannot do in SQL. And that should be the only reason for using the client language, like PL/SQL or the others, to perform row crunching using a client cursor loop.

  • For Loop and Void Method Questions

    Question 1: How would I write a for loop that repeats the according to the number entered, to prompt the user to enter a number (double) between 1 and 100. If the number is outside this range it is not accepted.
    Question: 2 Also how would I write a for loop to do sum and find the average of the array numbers in a seperate void method( does not return anything to the main method)?
    Question: 3 (first code snippet) With my for loop that is used to process each number in the array and square it and cube it and display the results to 2 decimal places. How do I make it so say I want the array to allow me to enter 2 numbers (so I enter 2 numbers) then it asks me to enter a number between 1 -100 (which will prompt 2 times) that it shows me the results for the entered numbers between 1-100 after one another instead of number then result number then result like I how it now.
    for (int index = 0; index < howNum; index++) // process each number in the array
              enterYourNumbers = JOptionPane.showInputDialog   
                            ("Enter a number between 1 and 100");                       
              numArray = new double[howNum]; 
            try
                numArray[index] = Double.parseDouble(enterYourNumbers);
            catch (NumberFormatException e)
                    enterYourNumbers = JOptionPane.showInputDialog
                              ("Enter a number between 1 and 100");                          
                DecimalFormat fmt = new DecimalFormat ("###,###.00");
                JOptionPane.showMessageDialog(null, enterYourNumbers + " "  + "squared is "  + fmt.format(calcSquare(numArray[index]))
                                              + "\n" + enterYourNumbers + " " +  "cubed is " + fmt.format(calcCube(numArray[index])));                                                                           
                wantToContinue = JOptionPane.showInputDialog ("Do you want to continue(y/n)? ");
      while (wantToContinue.equalsIgnoreCase("y"));
    import javax.swing.*;
    import java.text.DecimalFormat;
    public class Array
        public static void main(String[] args)
            int howNum = 0;
            int whichNum = 0;     
            double[] numArray;
            boolean invalidInput = true;
            String howManyNumbers, enterYourNumbers, wantToContinue;
      do // repeat program while "y"
          do // repeat if invalid input
            howManyNumbers = JOptionPane.showInputDialog
                        ("How many numbers do you want to enter");                     
            try
                 howNum = Integer.parseInt(howManyNumbers);
                 invalidInput =  false;
            catch (NumberFormatException e )
                howManyNumbers = JOptionPane.showInputDialog
                            ("How many numbers do you want to enter");
          while (invalidInput);
          for (int index = 0; index < howNum; index++) // process each number in the array
              enterYourNumbers = JOptionPane.showInputDialog   
                            ("Enter a number between 1 and 100");                       
              numArray = new double[howNum]; 
            try
                numArray[index] = Double.parseDouble(enterYourNumbers);
            catch (NumberFormatException e)
                    enterYourNumbers = JOptionPane.showInputDialog
                              ("Enter a number between 1 and 100");                          
                DecimalFormat fmt = new DecimalFormat ("###,###.00");
                JOptionPane.showMessageDialog(null, enterYourNumbers + " "  + "squared is "  + fmt.format(calcSquare(numArray[index]))
                                              + "\n" + enterYourNumbers + " " +  "cubed is " + fmt.format(calcCube(numArray[index])));                                                                           
                wantToContinue = JOptionPane.showInputDialog ("Do you want to continue(y/n)? ");
      while (wantToContinue.equalsIgnoreCase("y"));
        public static double calcSquare(double yourNumberSquared)
            return yourNumberSquared * yourNumberSquared;       
        public static double calcCube(double yourNumberCubed)
           return yourNumberCubed * yourNumberCubed * yourNumberCubed;              
        public static void calcAverage(double yourNumberAverage)
    }

    DeafBox wrote:
    Question 1: How would I write a for loop that repeats the according to the number entered, to prompt the user to enter a number (double) between 1 and 100. If the number is outside this range it is not accepted. Use a while loop instead.
    Question: 2 Also how would I write a for loop to do sum and find the average of the array numbers in a seperate void method( does not return anything to the main method)? Why would you want to use 2 methods. Use the loop to sum the numbers. Then after the loop a single line of code calculates the average.
    Question: 3 (first code snippet) With my for loop that is used to process each number in the array and square it and cube it and display the results to 2 decimal places. How do I make it so say I want the array to allow me to enter 2 numbers (so I enter 2 numbers) then it asks me to enter a number between 1 -100 (which will prompt 2 times) that it shows me the results for the entered numbers between 1-100 after one another instead of number then result number then result like I how it now. If I understand you correctly, use 2 loops. One gathers user inputs and stores them in an array/List. The second loop iterates over the array/List and does calculations.

  • How do I use an enhanced for loop / for each on my ViewObjectImpl ?

    Guys and Gals,
    With all of my newly acquired Java knowledge in tow, I spent this weekend cleaning up all of my code, dealing mainly with for loops. I converted them from a huge mess to a for each type loop using language such as ...
        RowSet priceUpdateRows = (RowSet)((PriceUpdatesViewRowImpl) priceUpdate).getPriceUpdateRowsView();
        for (Row priceUpdateRow: priceUpdateRows)
        { // do operations on row... which makes perfect sense to me. For each Row in the RowSet, do something. It doesn't, however, makes sense to the compiler. It pouts and gives me a "foreach not applicable to expression type" error. So I read up on iterators and such, messed with code examples, and still can't get the RowSet to iterate with the above code. Could I make RowSet implement Iterable? How would I do that? I tried to create a class called RowSetExt which extended RowSet and implemented Iterable, but then I got a class cast exception.
    I know I could implement something like the following or a while(hasNext()) but they're really not what I'm looking for.
    ViewObject vo = … < Get ViewObject > …
    RowSetIterator rsi = vo.createRowSetIterator("rowsRSI");
    while (rsi.hasNext())
         Row row = rsi.next();
         row.setAttribute("YourAttribute",your_value);
         rsi.closeRowSetIterator();How do I make the for(Row row : <RowSet>) example work? Or could someone point me in a direction?
    Will

    One thing I tried was to make a framework extension class for my ViewObjectImpls
    public class PcsViewObjectImpl
      extends ViewObjectImpl
      implements Iterable<Row>
      Set<Row> set = new HashSet<Row>();
      public Iterator<Row> getRows()
        return set.iterator();
      public Iterator<Row> iterator()
        return getRows();
    }AppModuleImpl
        PriceUpdateRowsViewRowImpl priceUpdateRows = (PriceUpdateRowsViewRowImpl)((PriceUpdatesViewRowImpl) priceUpdate).getPriceUpdateRowsView();
        for (Row priceUpdateRow: priceUpdateRows)
        {However, this gives me a class cast exception at runtime. But I would think some kind of extension class would be the way to go ... ?

  • Using while loops instead of for loops in arrays?

    I am new to java and doing a java tutorial on using arrays and for loops. What im trying to find out is how it is possible to use a while loop instead.
    I would be very grateful if anyone can suggest a way of changing my code to use a while loop.
    The code I have written is:
    public class DetermineGrade
    public static void main(String[]args)
    final char[] mark = {'A','B' ,'C' ,'D' ,'F' };
    char [] grade = new char[5];
    int [] Score ={95,35,65,75};
    for (int i=0; i<4; i++)
    if (Score >= 90)
    grade= mark[0] ;
    else if (Score >=80)
    grade = mark[1] ;
    else if (Score >=70)
    grade = mark[2] ;
    else if (Score >=60)
    grade = mark[3];
    else grade = mark[4];
    for (int i=0; i<4; i++)
    System.out.println("grade = " + Score + ", " + grade);
    Thankyou LB

    Im trying to underdstand the differences in the
    different loops. I can grasp the for loop but I dont
    see how a while loop works, or how it id different
    from the other?
    for (j = INIT; j < MAX; j++) {
        // do stuff
    }is the same as
    j = INIT;
    while (j < MAX) {
        // do stuff
        j++;
    }Lee

  • Problem with continue in a for loop

    Hi all
    I have a variable of type Node[] which contains nodes like Text,ImageView and SVGPath etc...
    now i want to filter that group which means i want to separate the Text nodes for that i used a for loop as
    var abc:Node[];
    var abcsize=sizeof abc;
    var textarray:Text[]=for(i in abc){
    if(i.toString()=="Text"){
       i as Text;  //casting Node to Text
                     }//if
               else{
                      continue;     //if the node is not of type Text then i am skipping that one
                     }//else
          }//forwhen i am trying to compile this i am getting the compilation error as
    Note: An internal error has occurred in the OpenJFX compiler. Please file a bug at the
    Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues)
    after checking for duplicates.  Include in your report:
    - the following diagnostics
    - file 1.2.3_b36
    - and if possible, the source file which triggered this problem.
    Thank you.
        else{
    An exception has occurred in the OpenJavafx compiler. Please file a bug at the Openjfx-compiler issues home (https://openjfx-compiler.dev.java.net/Issues) after checking for duplicates. Include the following diagnostic in your report and, if possible, the source code which triggered this problem.  Thank you.
    java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCContinue cannot be cast to com.sun.tools.javac.tree.JCTree$JCExpression
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:568)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2320)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava.visitIfExpression(JavafxToJava.java:3595)
            at com.sun.tools.javafx.tree.JFXIfExpression.accept(JFXIfExpression.java:48)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2320)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava$5.addElement(JavafxToJava.java:3007)
            at com.sun.tools.javafx.comp.JavafxToJava.visitForExpression(JavafxToJava.java:3212)
            at com.sun.tools.javafx.tree.JFXForExpression.accept(JFXForExpression.java:50)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToExpression(JavafxToJava.java:565)
            at com.sun.tools.javafx.comp.JavafxToJava.translateAsValue(JavafxToJava.java:575)
            at com.sun.tools.javafx.comp.JavafxToJava.translateNonBoundInit(JavafxToJava.java:1861)
            at com.sun.tools.javafx.comp.JavafxToJava.translateDefinitionalAssignmentToValueArg(JavafxToJava.java:1876)
            at com.sun.tools.javafx.comp.JavafxToJava.translateDefinitionalAssignmentToSetExpression(JavafxToJava.java:1917)
            at com.sun.tools.javafx.comp.JavafxToJava.visitVarScriptInit(JavafxToJava.java:1976)
            at com.sun.tools.javafx.tree.JFXVarScriptInit.accept(JFXVarScriptInit.java:67)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:598)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:628)
            at com.sun.tools.javafx.comp.JavafxToJava.visitBlockExpression(JavafxToJava.java:2306)
            at com.sun.tools.javafx.tree.JFXBlock.accept(JFXBlock.java:83)
            at com.sun.tools.javafx.comp.JavafxToJava.translateToStatement(JavafxToJava.java:598)
            at com.sun.tools.javafx.comp.JavafxToJava.access$700(JavafxToJava.java:89)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.makeRunMethodBody(JavafxToJava.java:2164)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.methodBody(JavafxToJava.java:2224)
            at com.sun.tools.javafx.comp.JavafxToJava$FunctionTranslator.doit(JavafxToJava.java:2279)
            at com.sun.tools.javafx.comp.JavafxToJava.visitFunctionDefinition(JavafxToJava.java:2292)
            at com.sun.tools.javafx.tree.JFXFunctionDefinition.accept(JFXFunctionDefinition.java:93)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:509)
            at com.sun.tools.javafx.comp.JavafxToJava.visitClassDeclaration(JavafxToJava.java:1261)
            at com.sun.tools.javafx.tree.JFXClassDeclaration.accept(JFXClassDeclaration.java:141)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:521)
            at com.sun.tools.javafx.comp.JavafxToJava.visitScript(JavafxToJava.java:1147)
            at com.sun.tools.javafx.tree.JFXScript.accept(JFXScript.java:89)
            at com.sun.tools.javafx.comp.JavafxToJava.translateGeneric(JavafxToJava.java:500)
            at com.sun.tools.javafx.comp.JavafxToJava.translate(JavafxToJava.java:517)
            at com.sun.tools.javafx.comp.JavafxToJava.toJava(JavafxToJava.java:691)
            at com.sun.tools.javafx.main.JavafxCompiler.jfxToJava(JavafxCompiler.java:728)
            at com.sun.tools.javafx.main.JavafxCompiler.jfxToJava(JavafxCompiler.java:699)
            at com.sun.tools.javafx.main.JavafxCompiler.compile2(JavafxCompiler.java:785)
            at com.sun.tools.javafx.main.JavafxCompiler.compile(JavafxCompiler.java:685)
            at com.sun.tools.javafx.main.Main.compile(Main.java:624)
            at com.sun.tools.javafx.main.Main.compile(Main.java:312)
            at com.sun.tools.javafx.Main.compile(Main.java:84)
            at com.sun.tools.javafx.Main.main(Main.java:69)
    ERROR: javafxc execution failed, exit code: 4
    D:\work\javaFX\javaFX_workspace\Book_fix\nbproject\build-impl.xml:143: exec returned: -1Any one please help

    - This is a real bug in the compiler, obviously. I wonder if I haven't meet it already, or something similar. Maybe you should report it.
    - The problem is that your code is incorrect anyway: the branch with continue doesn't return a value, so cannot be used in the list building. Well, at least that's what I suppose which confuses the compiler. You can try and return null (which will be discarded) instead of using continue.
    - But your code can be much more efficient, compact and perhaps even more readable, using the powerful JavaFX sequence comprehension:
    var seqMixed = [ 1, "one", Text { content: "Ichi" }, Circle {}, 2, "two", Text { content: "Ni" } ];
    println(seqMixed);
    var seqFiltered = seqMixed[ obj | obj instanceof Text ];
    println(seqFiltered);
    seqFiltered = seqMixed[ obj | not (obj instanceof Text) ];
    println(seqFiltered);

Maybe you are looking for

  • New installation woes - SQLDeveloper on Oracle Linux x64 and Oracle 11g XE

    Note that as an experienced Oracle developer in enterprise environments running MS Windows OS, I am familiar with SQLDeveloper for Windows. I don't have a lot of experience with Linux however. I don't find it intimidating, I just don't have a lot of

  • Integrating third party applications using Identity Management

    Hi, I have a 3rd party application(Peoplesoft) which my customers have been using for a long time. And I have 2 ADF applications(say Apps1 and Apps2) running on a single domain in my weblogic 10.3-11gR1 application server. I have configured security

  • Searching for content in text insets

    In a FrameMaker book, is there a way to search all the text insets in a book without opening each individual inset? I'm working on a project that has more than 30 text insets. I'd like to search for certain terms without having to open each inset. I'

  • New DB in OEM grid

    Hi, I installed Oracle with a 10gR2 database created by downloading and installing 10201_database_win32.zip. Then in OEM I could see my created database. Then I installed another Database using DBCA. but I can not see this one in OEM grid. Why ? What

  • How can I get a food deal of site license of Oracle EE

    I am working for a software company which paid too much for Oracle license, is there anyway to negotiate with Oracle to get a partnership program, which might be a lot cheaper, because we really re-sell our software and Oracle together to the custome