Do{}while stopping condition

Hi,
I am having trouble with my stopping statement! I want all the items to evaluate to true before it stops:
do{...}while(px!=x && py!=y && entryDir!=S)
I am tracing around the outline of a character, the trouble is as soon as it get to the top of the letter and the entryDir changes it stops...
So it should stop when px = x, py = y and the entry direction into the starting pixel (x,y) was S (south).
Thanks, Ron
Message was edited by:
cake

Here is the rest of the code, just to make sure...
public void getMooreBlob(int x, int y){
     char N='N', E='E', S='S', W='W';
     int px=x, py=y, nextMove=1;
     downSampleLeft = downSampleRight = x;
     downSampleTop = downSampleBottom = y;
     System.out.println("left="+x+"right="+x+"top="+y+"bottom="+y);
     //I am always going to be entering from the south to start, scanning down
     char entryDir = S;
     do{
     //pixel positions relative to p
          switch (nextMove)
               //move1
               case 1:
                    if(loadImg.getRGB((px+1),(py-1))!=-1){
                         entryDir='E';
                         px=px+1; py=py-1;
                         setP(px, py);
                         nextMove=7;
                         break;
               //move2
               case 2:
                    if(loadImg.getRGB((px+1),py)!=-1){
                         entryDir='S';
                         px=px+1; py=py;
                         setP(px, py);
                         nextMove=1;
                         break;
               //move3
               case 3:
                    if(loadImg.getRGB((px+1),(py+1))!=-1){
                         entryDir='S';
                         px=px+1;py=py+1;
                         setP(px, py);
                         nextMove=1;
                         break;
               //move4
               case 4:
                    if(loadImg.getRGB(px,(py+1))!=-1){
                         entryDir='W';
                         px=px;py=py+1;
                         setP(px, py);
                         nextMove=3;
                         break;
               //move5
               case 5:
                    if(loadImg.getRGB((px-1),(py+1))!=-1){
                         entryDir='W';
                         px=px-1;py=py+1;
                         setP(px, py);
                         nextMove=3;
                         break;
               //move6
               case 6:
                    if(loadImg.getRGB((px-1),py)!=-1){
                         entryDir='N';
                         px=px-1;py=py;
                         setP(px, py);
                         nextMove=5;
                         break;
               //move7
               case 7:
                    if(loadImg.getRGB((px-1),(py-1))!=-1){
                         entryDir='N';
                         px=px-1;py=py-1;
                         setP(px, py);
                         nextMove=5;
                         break;
               //move8
               case 8:
                    if(loadImg.getRGB(px,(py-1))!=-1){
                         entryDir='E';
                         px=px;py=py-1;
                         setP(px, py);
                         nextMove=7;
                         break;
               default:
                    nextMove++;
                    if(nextMove==9)nextMove=1;
                    break;
     }while(px!=x && py!=y && entryDir!=S);
}

Similar Messages

  • Help with a while loop condition

    I'm trying to write to a File. I ask the user for input, then I enter a while loop and test the condition. The loop works, but it won't stop. I've tried everything. Here is my code please help!!
    thanks
    inputline = keyboard.readLine();//read the keyboard
    try{
    while( inputline != null ){
    DiskOut.println( inputline );
    DiskOut.flush();
    inputline = keyboard.readLine();//read the keyboard again
    }//end while
    }//end try
    catch (IOException e) { 
    e.printStackTrace();
    }//end catch
    also i've tried these while loop conditions:
    while(inputline != "\n" || inputline != "\r") and the sort

    while(inputline != "\n" || inputline != "\r")The condition
    X!=Y OR X!=Z (given Y != Z)
    is always true. X will always not be equal to at least one of the values. So you'll want to use:
    while(!inputline.equals("\n") && !inputline.equals("\r"))In other words, "while inputline is not equal to either of them". Note the use of && instead of ||.
    If "keyboard" is simply a BufferedReader on top of System.in (and not your own class), the trailing line feeds and carriage returns won't even be in the string returned by readLine(). Your best bet is this:
    while(null != inputline && 0 != inputline.length())Make sure you type the two parts of that AND condition in the order above. If for whatever reason there are trailing \r and \n on the strings, you'll want to accomodate for platforms that may include both characters.
    // trim the trailing newline characters
    while(inputline.endsWith("\r") ||
          inputline.endsWith("\n")) {
       inputline = inputline.substring(0,inputline.length()-1);
    // or maybe this will work if you don't mind losing
    //  the whitespace at the beginning of the string:
    inputline = inputline.trim();Hope that helps somewhat.

  • Getting error while creating condition type in SPRO

    Hi ,
    can somebdy tell me why i am getting the following error while creating condition type in SPRO
    No valid change license available for message /sapcnd/
    and also while rule determination using condition type we are getting the following error.
    system error:system cannot read the structure for table
    reg
    venkat

    Hi Venkat,
    Do you have the error number code!?
    Regards,
    Michel  Bohn

  • Error while creating condition record

    Hi
    Am using 4.7 and creating condition record while saving condition record am getting error NO UPDATE SERVER FOUND FOR CONTEXT E, So am stuck up and do not know whom to contact is it error for BASIS? or related with SD kindly help.
    Thanx

    Hi Mukesh
    As you are getting error NO UPDATE SERVER FOUND FOR CONTEXT E,  while saving the condition record, kindly consult your BASIS consultants and ask them to check wheather the pricing related  tables and structures  have been copied and uploaded properly or not.
    Regards
    Srinath

  • Post stop condition duration

    Hi
    I one to collect 5 seconds of data prior to the start of a test, and then 30 seconds after the end.  So I have been using start and stop condition with pre and post logging options.  For the start condition, with 5 seconds pre condition every thing is fine, however the post stop condition of 30 sec does not occur and logging stops as soon as the stop condition occurs.  Screenshot of the start/stop condition page are attached with a copy of the project.
    Has any one any experience of this, what am I doing wrong?  Have I misunderstood the way this should work?
    thanks
    Mark
    Attachments:
    Start stop conditions.doc ‏320 KB
    F139 1lc3p3t4t v2.seproj ‏296 KB

    Hi James
    Thanks for looking at this, sorry for the delay in replying.  
    I have reattached the project file and a data set.  I've been messing around with the settings, but still no joy.  In the current project I am asking for 30s of data after the stop condition occurs but it still is not happening.  In Data View for 'P Red' the stop condiditon occurs as specified when the pressure goes below 1 bar, and then logging ceases a couple of seconds after that.  In the meta data for the logs it specifies the start and stop conditions, and it also specifies that I want 5 s pre start, however there is no mention of my post stop requirements 
    Does the 30s I specified really mean 30 seconds after the stop event, it wouldn't be something like stop after 30s or at the stop condition, which ever is longer?  Is it possible for you to look at the code or the logic in the programming of this feature?
    thanks
    Mark
    Attachments:
    F139 1lc3p3t4t v2.seproj ‏288 KB
    23092011_113247.zip ‏161 KB

  • While copying condition records in pricing from one customer to another

    While copying condition records from one customer to another for one material, need to give select rule, when I click that it supposed to come with values like "rule 1" but it does not have values. So I cannot copy data.
    Any experts solution?
    Fully rewarded.
    Thanks,
    Manohar

    Hi,
    for the condition copy, you must maintain the copy control for condition. the path:Sales and Distribution>Basic Functions>Pricing-->Copy Control For Conditions.
    this is the reqirement.
    I hope this useful for you.

  • Services are in stop condition

    Hi,
    We installed Dev & Quality systems for PI/XI-7.0 on same host,
    We are taking central SLD on Dev for Quality system,
    We are following note-940309,regarding this note we have to change the client for the following services 1) AI_DIRECTORY_<sid> 2) AI_RUNTIME_<SID> 3) LCRSAPRFC_<SID> 4) SAPSLDAPI_<SID>, after changing the client-100,these services are in stop condition,
    which Gateway number we have to give either DEV & Quality System,
    what else we have to change
    when we are execute tcode SXMB_IFR on Quality system it is pointing to DEV system,
    regards,
    haribabu

    Hi,
    We installed Dev & Quality systems for PI/XI-7.0 on same host,
    We are taking central SLD on Dev for Quality system,
    We are following note-940309,regarding this note we have to change the client for the following services 1) AI_DIRECTORY_<sid> 2) AI_RUNTIME_<SID> 3) LCRSAPRFC_<SID> 4) SAPSLDAPI_<SID>, after changing the client-100,these services are in stop condition,
    which Gateway number we have to give either DEV & Quality System,
    what else we have to change
    when we are execute tcode SXMB_IFR on Quality system it is pointing to DEV system,
    regards,
    haribabu

  • Error , while stopping Weblogic server 5.1

    Hello,
    Encountered the following error while stopping the bea Weblogic server 5.1 on
    AIX 4.3. Seeking for Valuable solution / Suggestion.
    Submitting shutdown command to Weblogic Server on Port 80.
    Failed to connect to t3://10.72.111.15:80 due to :
    [Weblogic.rmi. Unexpected Exception: Marshalling
    -with nested exception:
    [Weblogic.rjvm.PeerGoneException:
    -with nested exception:
    [Weblogic.utils.AssertionError: **** ASSERTION FAILED ***** [Exception creating
    response stream] - with nested exception:
    [java.io.InvalidClassException:
    weblogic.security.acl.internal.AuthenticatedUser;Local Class not compatible: Stream
    Classdesc serialVersionUID=6699361079932480379
    local class serialVersionUID=2825328378974757378]]]]

    Narayan,
    Can you provide more information on the configuration, JDK, Service Pack
    level and also manner in which you shutdown the server.
    Can you try using the following command to shutdown the server
    java weblogic.Admin URL SHUTDOWN system password
    http://www.weblogic.com/docs51/admindocs/weblogicserver.html#shutdown
    Also make sure you set the classpath before running this command
    If you are testing with any service pack prior to sp8, I would suggest you
    test with the latest service pack for WebLogic Server 5.1 which is sp10.
    If you need just the service pack for WLS 5.1 , you will need to have a
    websupport login and password. Please refer to this url for more
    information on this.
    http://contact.bea.com/bea/www/BEACustRegLogin.jsp
    http://websupport.bea.com/custsupp/
    Hope this helps
    Raj Alagumalai
    "Narayan" <[email protected]> wrote in
    news:3ba61ba3$[email protected]:
    >
    Hello,
    Encountered the following error while stopping the bea Weblogic server
    5.1 on AIX 4.3. Seeking for Valuable solution / Suggestion.
    Submitting shutdown command to Weblogic Server on Port 80.
    Failed to connect to t3://10.72.111.15:80 due to :
    [Weblogic.rmi. Unexpected Exception: Marshalling
    -with nested exception:
    [Weblogic.rjvm.PeerGoneException:
    -with nested exception:
    [Weblogic.utils.AssertionError: **** ASSERTION FAILED ***** [Exception
    creating response stream] - with nested exception:
    [java.io.InvalidClassException:
    weblogic.security.acl.internal.AuthenticatedUser;Local Class not
    compatible: Stream Classdesc serialVersionUID=6699361079932480379
    local class serialVersionUID=2825328378974757378]]]]

  • Error while stopping Weblogic server

    I have created a new domain and installed my application here, after deplotyment when i stop teh server it throws the following exception:
    Cannot shutdown a server when using a BootIdentify file AND running in Production mode
    I have created boot.properties file also.still it is throwing this error,.I am not getting any clue on this error, there is no clear details availablei n the archives also , so please advise.
    Thanks
    Vishy

    Narayan,
    Can you provide more information on the configuration, JDK, Service Pack
    level and also manner in which you shutdown the server.
    Can you try using the following command to shutdown the server
    java weblogic.Admin URL SHUTDOWN system password
    http://www.weblogic.com/docs51/admindocs/weblogicserver.html#shutdown
    Also make sure you set the classpath before running this command
    If you are testing with any service pack prior to sp8, I would suggest you
    test with the latest service pack for WebLogic Server 5.1 which is sp10.
    If you need just the service pack for WLS 5.1 , you will need to have a
    websupport login and password. Please refer to this url for more
    information on this.
    http://contact.bea.com/bea/www/BEACustRegLogin.jsp
    http://websupport.bea.com/custsupp/
    Hope this helps
    Raj Alagumalai
    "Narayan" <[email protected]> wrote in
    news:3ba61ba3$[email protected]:
    >
    Hello,
    Encountered the following error while stopping the bea Weblogic server
    5.1 on AIX 4.3. Seeking for Valuable solution / Suggestion.
    Submitting shutdown command to Weblogic Server on Port 80.
    Failed to connect to t3://10.72.111.15:80 due to :
    [Weblogic.rmi. Unexpected Exception: Marshalling
    -with nested exception:
    [Weblogic.rjvm.PeerGoneException:
    -with nested exception:
    [Weblogic.utils.AssertionError: **** ASSERTION FAILED ***** [Exception
    creating response stream] - with nested exception:
    [java.io.InvalidClassException:
    weblogic.security.acl.internal.AuthenticatedUser;Local Class not
    compatible: Stream Classdesc serialVersionUID=6699361079932480379
    local class serialVersionUID=2825328378974757378]]]]

  • Error while stopping starting servers

    Hi All..
    Whenever I am issuing the command:-
    ccm.sh -start all .
    or
    ccm.sh -stop all
    or
    stopservers
    I am getting following error while stopping or starting the server :
    .../BOXI3O/bobje/setup/jscripts/ccmunix.js:266: TypeError: sampleLog has no properties.
    Can somebody please help me out.
    Regards,
    Akash Jain
    Edited by: Mannu Sanghi on Oct 28, 2009 6:20 AM

    Hello Mannu,
    To enable tracing :
    At page 200 of this guide, you have one method :
    http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_bip_admin_en.pdf
    Other one is to enter the CMC, and add the "-trace" parameter on eache server you want to trace. But since you are not able to start it...
    Also, in the CMS you can do it also, but I do not know how this can be done for a unix install...
    When tracing is enabled, you can check at <BO install dir>/logging for trace log files, to see if there is any info in it.
    Samuel.

  • While stopping Addon There is message like failed instead

    While stopping Addon There is message like failed instead of disconnected
    please answe

    Hi Rakeshbos,
    Does the error occur when you are trying to run the AddOn from within Visual Studio? Or after you create the setup, and are trying to install the AddOn? Or the AddOn is already compiled and installed, and the error occurs when you're working?
    Please provide the most detailed information possible.
    Best Regards,
    Vítor Vieira

  • If statement on a while loop condition

    Hello,
    I was just wondering whether it was possible to have an if statement on a while loop. Basically, I have a while loop that has the following terminating condition
    do{
    //...loop code here
    while (netError > acceptableError && learningCycle < 100000 && alive);I'm looking to introduce a boolean "ignoreMaxCycles" that basically stops the loop from taking notice of the learningCycle clause of the condition.
    do{
    //...loop code here
    while (netError > acceptableError && alive);I know it can be done repeating the two loops with an if statement governing which one is executed, but I was wondering whether there was a shorter/cleaner way of doing this?
    Thanks,
    Nick

    nickd_101 wrote:
    Hello,
    I was just wondering whether it was possible to have an if statement on a while loop. Basically, I have a while loop that has the following terminating condition
    do{
    //...loop code here
    while (netError > acceptableError && learningCycle < 100000 && alive);I'm looking to introduce a boolean "ignoreMaxCycles" that basically stops the loop from taking notice of the learningCycle clause of the condition.
    do{
    //...loop code here
    while (netError > acceptableError && alive);I know it can be done repeating the two loops with an if statement governing which one is executed, but I was wondering whether there was a shorter/cleaner way of doing this?
    Thanks,
    Nick
    do {
    while(netError > acceptableError && (ignoreMaxCycles || learningCycle < 100000) && alive)wtf ? i took 2 minutes for that ?
    Edited by: darth_code_r on Aug 29, 2008 9:21 AM

  • Error while stopping Apache Services.

    Hi partners,
    I am having a problem while I want to stop Apache Service using "standard" script "adapcctl.sh".
    I am getting next error message, when I execute "adapcctl.sh stop apps/<apps_password>
    /d03/applmgr/prodcomn/admin/scripts/PROD_gamhap22/adapcctl.sh stop
    Timeout specified in context file: 100 second(s)
    script returned:
    adapcctl.sh version 115.53
    Apache Restricted Web Server Listener :httpd ( pid 7244 ) is running.
    Service can not be stopped using this script
    Apache Restricted Web Server Listener (PLSQL) :httpd ( pid 7522 ) is running.
    Service can not be stopped using this script
    adapcctl.sh: exiting with status 1
    .end std out.
    .end err out.
    GSM Enabled profile is setted to "Y", but I have similar "TEST" environments where GSM is enabled and Apache Server is shutted down without any problem.
    Any advice or help will be really appreciated.
    Thanks in advance.
    Kind regards,
    Francisco Mtz.

    Hi list,
    I have the solution to this problem.
    I have taken a llok inside of the <b>adapcctl.sh</b> script and I have found next lines:
    elif [ "$control_code" = "stop" ]; then
    if [ "$RUNNING" = "0" ]; then
    exit_code=2;
    elif [ "$RUNNING" = "1" -a "$RESTRICT_RUNNING" = "1" ]; then
    STATUSMSG="Service can not be stopped using this script\n"
    printf "$STATUSMSG"
    printf "$STATUSMSG" >> $OUTFILE
    exit_code=1;
    else
    RUNNING is equal to 1 and RESTRICT_RUNNING is equal to 1 when next condition is meet:
    if [ -f $RESTRICT_PIDFILE ] ; then
    restrict_pid=`cat $RESTRICT_PIDFILE | grep -i "TRUE"`
    if [ "x$restrict_pid" != "x" -a "$RUNNING" = "1" ] ; then
    RESTRICT_RUNNING=1
    RESTRICT_FILE is pointing to file "$IAS_HOME/Apache/Apache/logs/apache_runmode.properties" which was created in this environment (I don't know who created it).
    Kind regards,
    Francisco Mtz.

  • Short Dump while maintaining conditions in Product master

    Hi Experts,
    We are getting short dump while we want to maintain conditions in the product master.
    The dump message is as follows -
    CREATE DATA: The specified type "/1CN/WS_ID_300PRODUCTBBP_SKU_T" is no valid 
    An exception occurred that is explained in detail below.                         
    The exception, which is assigned to class 'CX_SY_CREATE_DATA_ERROR', was not     
    caught in                                                                       
    procedure "/SAPCND/MNT_INIT_OW" "(FUNCTION)", nor was it propagated by a         
    RAISING clause.                                                                 
    Since the caller of the procedure could not have anticipated that the            
    exception would occur, the current program is terminated.                        
    The reason for the exception is:                                                 
    The dynamically specified type "/1CN/WS_ID_300PRODUCTBBP_SKU_T" at CREATE DATA   
    is no valid data type.                                                                               
    The type is either unknown or an object type.                                    
    I checked for OSS note but could not get success and also i could not explore in SDN. Can anybody help me in this.
    Thanks a lot in advance!!
    Thank You
    Abhinandan

    Hi
    <b>Please go through the following SAP OSS Notes, which will definitely help -></b>
    <u>Note 930816 - Cond. Maint. group not generated after remote client copy</u>
    <u>Note 1051896 - Cond. group WS deleted in source aft. remote client copy</u>
    Note 971825 - Short dump caused by dynamic working set
    Note 969475 Short dump after applying notes 966127&966197
    Note 661287 - Name of the condition maintenance group
    Note 1009001 - ShortDump when Creating Mkt-Obj by Copying
    Do let me know.
    Regards
    - Atul

  • RECN (Process Contract) Error while adding condition type

    Hi All
    I am processing the contract (RECN). While adding a new condition type, it gives me thr error
    Parameter KWH (area unit) for calculation formula Y3 has errors
    Moreover when i defined this calculation formula (Y3), units KWH are not coming in area unit field (F4-possible entries).
    Pls help me with that.
    Thnx in advance
    Deepak

    Hi,
    i am assuming you have added customised formula to condition type while creation of conditon. for the formula there is no link to Badi.
    if the above is right, you need not to add any formula and parameter while creation of conditon,first remove the formula form the conditon and assign standard one.
    then select the formula after inserting the condition. error about the formula may be  no value is being supplied from the formula.
    thanks
    Jilani

Maybe you are looking for

  • Photoshop cs2 disc will not install

    I had Photoshop CS2 installed on my old iMac, which recently crashed, so I purchased a new MacBook Pro. I used Time Machine to transfer all my data from my 2006 iMac to my new MacBook Pro. Transfer of data was successful, except for Photoshop CS2, wh

  • [SOLVED] Chromium won't start

    I'm not sure why but chromium does no longer want to start for me. When I type it in the terminal I get this error message [1856:1856:142255483:ERROR:process_singleton_linux.cc(940)] Failed to create socket directory. [1856:1856:142255592:ERROR:chrom

  • 5.1 Sorround Sound for Macbook Pro

    Hi , It would be appreciated if somebody could help me, i was trying to get 5.1 sorround sound through my Macbook Pro but couldnot succeed. I have connected my laptop through a optical cable to dts decoder which is connected to the 5.1 speakers, i fo

  • How to make the Time Line in Vertical ?

    Hi All I have created a Schedule Board using the Schedule Viewer but including the Flexlib in my project . Now the thing is that the Timeline which us to come on the top of the ScheduleViewer I need to get that Time line Vertically in left side of th

  • APP-PAY-06153: System Error : Procedure pay_us_emp_dt_tax_rules.insert_fed

    Dear Friends, I'm finding the below mentioned error while I'm attaching the salary basis & saving the same, APP-PAY-06153: System Error : Procedure pay_us_emp_dt_tax_rules.insert_fed_tax_row - ORA-20001: &1 element does not exist or has not linked to