How to interpret result of outcode method of Rectangle2D.Double class

I am trying to use Rectangle2D to determine position of a point with respect to a given rectangle.
Here is my code
Rectangle2D.Double rect = new Rectangle2D.Double(10,10,50,50);
          System.out.println(rect.outcode(10,10));
          System.out.println(rect.outcode(10,9));
          System.out.println(rect.outcode(9,10));
          System.out.println(rect.outcode(50,50));
          System.out.println(rect.outcode(60,60));
          System.out.println(rect.outcode(61,10));
          System.out.println(rect.outcode(61,61));
          System.out.println(rect.outcode(61,45));
Here are the results
0
2
1
0
0
4
12
4
I can understand when result is 0 then the point is either inside or on the Rectangle2D.Double object
I can assume if output is 1,2 3 or 4 it can be mean out_left, out_top, out_right, out_bottom but sometimes i get values like 5,9, 12 etc which I cannot figure out. What I can assume for these values
Any pointer to this will be helpful
Thanks Shantanu

Any time you see constants defined in powers of two you can suspect
that they may be added to form unique sums.
So these, found in the Constant Field Values of Rectangle2D
public static final int OUT_BOTTOM = 8
public static final int OUT_LEFT   = 1
public static final int OUT_RIGHT  = 4
public static final int OUT_TOP    = 2may indicate that something like this is possible/useful:
OUT_TOP                =  2    // N
OUT_TOP + OUT_LEFT     =  3    // NW
OUT_LEFT               =  1    // W
OUT_LEFT + OUT_BOTTOM  =  9    // SW
OUT_BOTTOM             =  8    // S
OUT_BOTTOM + OUT_RIGHT = 12    // SE
OUT_RIGHT              =  4    // E
OUT_RIGHT + OUT_TOP    =  6    // Ne
CENTER                 =  0    // inside

Similar Messages

  • How to use results of ejbfind methods when it is a collection ?

    How to use ejbFind methods result , when it is a collection ?
    Hi thank you for reading my post.
    EJB find methods return a collection , i want to know how i can use that collection ?
    should i use Collection.toArray() and then use that array by casting it?
    what is DTOs and ho i can use them in this case?
    How i can use the returned collection is a swing application as it is a colection of ejbs ?
    Should i Cast it back to ejb class which it comes from or some other way ?
    for example converting it to an array of DTO (in session bean) and return it to swing application ?
    or there are some other ways ?
    Thank you

    Hi
    pleas , some one answer
    Collection collection = <home-interface>.<finderMethod>;
    Iterator iter = collection.iterator();
    while (iter.hasNext()) {
    <remote-interface> entityEJB = (<remote-interface>) iter.next();
    } what if i do the above job in session bean and convert the result to a DTO and pass the dto back ?
    thank you

  • How to add results from a method

    Hi-
    I have written the following code that takes an input integer, and figures out every odd integer contained inside such as inputting 7 would give you 5,3,1. How can I modify this code to take those answers in my example and get it to add them to equal 9 in this case? I have tried making my method return an int, but I am doing something wrong, and have banged on this for hours, resulting in a giggling compiler. Even if I get some help on the return, I am baffled by how to get another method(?) or whatever to "remember" the parsed out odd integers
    and then add them.
    Thanks
    Brad
    public class OddSum
    public static void main (String [] args)
    System.out.println ("Please Enter An Integer.");
    int varOne;
    EasyIn easy = new EasyIn();
    varOne = easy.readInt();
    System.out.println("You Entered: " + varOne);
    figureOdds(varOne);
    public static void figureOdds (int varOne)
    int num;
    for (num = varOne-1; num >0; --num)
    int monkees;
    monkees = num;
    if(monkees%2 != 0)
    System.out.println("The Odds Contained in your Input Integer are: " + monkees);
    }

    Hmmm-
    neither of those solutioins are working correctly. Say for example I entered a 5. First (and what I had working)
    I wanted to find all the odd ints contained in 5 not including 5: 3 and 1. THEN I wanted to add them for a result of 4. It was helpful to see that I could declare a var named sum and set it to 0 as in this:
    int sumOfOdds = 0;
    for (num = varOne-1; num >0; --num)
    //int monkees;
    //monkees = num;
    if(num%2 != 0)
    sumOfOdds += num;
    System.out.println("The Odds Contained in your Input Integer are: " + num);
    but when you compile and enter "11" as the int it comes up with 55 instead of 25 as it should.
    In the second reply with code:
    public static int figureOdds(int varOne) {
    int num, sum = 0;
    for (num = varOne-1; num > 0; --num) {
    if(num%2 != 0){
    sum += num;
    System.out.println("The Odds Contained in your Input Integer are: " + num);
    return sum;
    it gives me the same result as I was getting. Am I missing something that was unsaid, but supposed to be understood?
    Thanks
    Brad

  • Extenal authentication plug-in debugging - how to interpret results?

    Hi all
    I've managed to get OID to synchronize with MS AD (partly thanks to this forum)
    Also, I've installed the External Authentication Plug-In
    But I still can't log in to SSO as an AD user...
    So I've run the plug-in debugger and it gives results such as:
    Begin post-search plug-in
    filter string = (&(objectclass=person)(uid=howard_d))
    = appears in position 15
    length of my_filter string = 35
    SAMAccountName = person)(uid=howard_d)
    not a valid SAMAccountName
    I get a similar result if I try logging in with the full account name of '[email protected]'
    (I can bind against AD with these credentials, but not against OID)
    Do I need to change my mappings?
    Or what other tests can I do to check the external-authentication plug-in?
    Thanks again
    Howard

    If (&(objectclass=person)(uid=howard_d)) is the filter used in AD,
    I guess the filter to be used in OID should be "(&(objectclass=person)(SAMAccountName=howard_d))"
    or "(SAMAccountName=howard_d)"
    I think its the syntax error you are getting.

  • How to write hasCode() & equals(0) methods in Compound Key Class

    Hi Java Helpdesk,
    I am wondering how to write the hashCode() and equals() methods that is mandatory when creating composite
    @IdClass. Below is the combination of primary @Id keys that I would like to make up in a compound key class:
    public final class PatientKey implements java.io.Serializable
        private String firstnameId;
        private String SurnameId;
        private String DateOfBirthID;
        private String Sex;
        public int hashCode()
        public boolean equals(Object otherOb)
    }The Order application in Java EE 5 Tutorial (page 841) is made up of only 2 primary keys.
    Thanks,
    Jack

    Hi,
    Thanks for your very brief response and I had a look at both EqualsBuilder and HashCodeBuilder from the URL links you have provided. These methods may improve the comparison accuracy but I was more interested on how to implement the equals() and hashCode methods when comparing 3 or more primary keys in order to make up a primary key class. Below is my first attempt to compose the PatientPK primary key class:
    1. public class PatientPK implements java.io.Serializable {
    2.
    3.     private String firstName;
    4.     private String lastName;
    5.     private String dateOfBirth;
    6.     private Char sex;
    7.
    8.     public PatientPK() {}
    9.
    10.   public PatientPK(String firstName, String lastName, Date dateOfBirth, Char sex)
    11.   {
    12.       this.firstName = firstName;
    13.       this.lastName = lastName;
    14.       this.dateOfBirth = dateOfBirth;
    15.       this.sex = sex;
    16.   }
    17.
    18.   public String getFirstName() { return this.firstName; }
    19.   public void setFirstName(String firstname) { this.firstName = firstName; }
    20.
    21.   public String getlastName() { return this.lastName; }
    22.   public void setLastname(String lastName) { this.lastName = lastName; }
    23.
    24.   public String getDateOfBirth() { return this.dateOfBirth; }
    25.   public void setDateOfBirth(String dateOfBirth) { this.dateOfBirth = dateOfBirth; }
    26.
    27.   public Char getSex() { return this.sex; }
    28.   public void setSex(String sex) { this.sex = sex; }
    29.
    30.   public boolean equals(Object obj)
    31.   {
    32.       if (obj == this) return true;
    33.       if (!(obj instanceof PatientPK)) return false;
    34.       PatientPK pk = (PatientPK) obj;
    35.       if (!firstName.equals(pk.firstName)) return false;
    36.       if (!lastName.equals(pk.lastName)) return false;
    37.       if (!dateOfBirth.equals(pk.dateOfBirth)) return false;
    38.       if (!sex.equals(pk.sex)) return false;
    39.       return true;
    40.   }
    41.
    42.   public hashCode()
    43.   {
    44.       return firstName.hashCode() + lastName.hashCode() + dateOfBirth.hashCode() + sex.hashCode();
    45.   }
    46.}Please advice whether both these equals() and hashCode() implementations are correct.
    Thanks in advance,
    Jack

  • How can i call a main method  from a different class???

    Plzz help...
    i have 2 classes.., T1 and T2.. Tt2 is a class with a main method....i want to call the main method in T2......fromT1..is it possibl..plz help

    T2.main(args);

  • How to refer to enclosing instance from within the member class?

    Hi
    How to refer to the enclosing instance from within the member class?
    I have the following code :
    import java.awt.*;
    import java.awt.event.*;
    public class MyDialog extends Dialog
         public MyDialog(Frame fr,boolean modal)
              super(fr,modal);
              addWindowListener(new MyWindowAdapter());
         public void paint(Graphics g)
              g.drawString("Modal Dialogs are sometimes needed...",10,10);
         class MyWindowAdapter extends WindowAdapter
              public void windowClosing(WindowEvent evt)
                   //MyDialog.close(); // is this right?
    In the above code, how can I call the "close()" method of the "Dialog" class (which is the enclosing class) from the inner class?
    Thanks in advance.
    Senthil.

    Hi Senthil,
    You can directly call the outer class method. Otherwise use the following way MyDialog.this.close(); (But there is no close() method in Dialog!!)
    If this is not you expected, give me more details about problem.
    (Siva E.)

  • Calling a method from a different class?

    Ok..
    I been trying for hours... but im stumped.
    How can I get this to work?
    (Note: I cut this code down from over 600+ lines of code.. I left in a REALLY raw framework that shows where the basic problem is.)
    public class Client extends JPanel implements Runnable {
    // variable declarations...
        Socket connection;
        BufferedReader fromServer;
        PrintWriter toServer;
        public Client(){
    // GUI creation...
    // Create the login JFrame
        Login login = new Login()
        public void connect(){
        try {
                //Attempt to connect to the server
                connection = new Socket(ip,port);
                fromServer = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                toServer = new PrintWriter(connection.getOutputStream());
                //Launch a thread here to read incoming messages from the server
                //so I dont block on reading
                new Thread (this).start();
        } catch (Exception e) {
            e.printStackTrace();
        public void run(){
            // This keeps reading lines from the server
            String s;
            try {
                //Read messages sent from the server - add them to chat window
                while ((s=fromServer.readLine()) != null) {
                txtChat.append(s);
            } catch (Exception e) {}
        public static void main(String args[]){
            // some init frame stuff
            frame = new JFrame();
            frame.getContentPane().add(new Client(),BorderLayout.CENTER);
         frame.setVisible(true);
    class Login extends JFrame {
        JPanel pane;
        public Login() {
         super("Login");
         pane = new JPanel();
         JButton cmdConnect = new JButton("Connect");
            pane.add(cmdConnect);
         setContentPane(pane);
         setSize(300,300);
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         cmdConnect.addActionListener(new ActionListener(){
             public void actionPerformed(ActionEvent ae){
              // I want to connect to the server when this button is pressed.
              // How can I call the connect method in the Client class?
    }

    Your posted code shows Login as an inner class. So one way to solve your problem is.
    1. Make an instance variable to hold the instance. For example, after "PrintWriter toServer;" add "private Client client;"
    2. In the Client constructor, add a line "client = this;"
    3. In the Login actionPerformed(), use "client.connect();"
    Another way is to have Login keep a reference to the Client that created it.
    1. Add an instance variable to Login "private Client client;"
    2. Change the Login constructor "public Login(Client c) {"
    3. Add a line in the constructor "client = c;"
    4. In the actionPerformed() "client.connect();"

  • How to get the result of a method on a page

    I use JDeveloper 11g
    I want the result of a method (String) in the ApplicationModule on a page (jspx)
    What I have done is:
    1. make a method (getValue) in the ApplicationModule Algemeen (also in Client interface)
    2. make a pagedef-file with executables and bindings, see
    <executables>
    <invokeAction id="doGetValue" Binds="getValue"
    Refresh="renderModel"/>
    <variableIterator id="variables" Refresh="renderModel">
    <variable Type="java.lang.String" Name="getValueReturn"
    IsQueriable="false" IsUpdateable="0"
    DefaultValue="${bindings.getValue.result}"/>
    </variableIterator>
    </executables>
    <bindings>
    <methodAction id="getValue" RequiresUpdateModel="true"
    Action="invokeMethod" MethodName="getValue"
    IsViewObjectMethod="false" DataControl="AlgemeenDataControl"
    InstanceName="AlgemeenDataControl.dataProvider"
    ReturnName="AlgemeenDataControl.methodResults.getValue_AlgemeenDataControl_dataProvider_getValue_result"/>
    <attributeValues IterBinding="variables" id="ValueReturn">
    <AttrNames>
    <Item Value="getValueReturn"/>
    </AttrNames>
    </attributeValues>
    </bindings>
    3. on the page (jspx) I have an outputText-component:
    <h:outputText value="#{bindings.ValueReturn.inputValue}"/>
    But, it does not work, I don't get the result of the method on the screen.
    Who can help me with this?

    Hi,
    Simple example below:
    Suppose you have this method in AppmoduleImpl:
    public void testHello( ) {
    return "Hello";
    1.After you expose this to clientInterface,drop this method on the jspx page as ADF Parameter
    form
    2.Drop the return String as outputText
    3.Run the page,click on the commandButton & the outputText returns 'Hello'
    Regards,
    Shantala

  • Calling results of a method from another class

    Very very new to Java, so apologies for the lack of basic knowledge. I am making a programme with 3 classes. One class gathers details about a module. Another about the results of this module (which requires some of the information inputted for the first class). For some reason I cannot find how to use results created in the first class in this second class. How do you call the results of a method from one class in another class?
    Thanks.

    Thank you.
    I am given the following information:
    '_ModuleRecord_
    This class is used to record information about a module taken by a single student. It has a constructor that takes three parameters:
    a Module,
    an int representing the examination mark achieved by a student, and
    an int representing the coursework mark achieved by a student.
    The class has another constructor that takes a single Module parameter.'
    and the code looks like this:
    public class ModuleRecord
      public ModuleRecord(Module m, int eMark, int cMark)
      public ModuleRecord(Module m)
      } I am a bit confused by the whole thing to be honest. I assume that the Module is referring to the other class, but how do I forge the link between them here?

  • Result Analysis Valuation Method 3

    Hi PS Experts,
    The building block document on Profit Realization 'I58_BB_ConfigGuide_EN_DE' says that as per IAS 11 and 18, we need to configure Result Analysis Valuation Method 3 only which is cost based. Is it right and whether you are all having this valuation method in your SAP system where IFRS standards are applicable.
    Then, in addition to this cost based Revenue Recognition through this valuation method 3, we would like to input realistic POC(Engineer's certificate) into the system. Whether it is possible and if so, how and what other valuation method we need to use with or with changes to a particular valuation method. Appreciate your valuable inputs on this.
    Regards!

    Hello,
    Cost based POC i.e Method 3 is compliant with IFRS requirements. Other methods also are so.
    The choice of RA method depends on value/risk/duration/revenue plan of the project. We use this method for high value projects running for a long time where there is a need to recognise revenue before actual billing.
    Completed contract method is also used and very much in accordance with accouning principles.
    For POC calculated through progress determination- say Engineer's certificate- you can use method 7.
    Thanks,

  • How can i use Catalog in Method Type?

    Dear Experts,
    How can i use Catalog in Method Type?
    I want to use Multiple method type mean require selection option(help from catalog)and also need to entere the result against certain parameters. So how can i do this possible ?
    Except use of additional infrmation field
    Regards,
    Abhishek

    Hi,
    Can i provide selection option F4 help at Method while enteing the result?
    Because for 1 MIC as per buyer method testing different so it will come alternately.
    i.e i have 3 methods which comes altarnative for one MIC
    TST_ISO
    TST_AATC
    TST_ASTM
    So how it is possible???

  • How to get result arts of Expand() and DoUniteEffect()?

    In Illustrator SDK, some operations on arts will return the result. For example, DuplicateArt() will set the result to "newArt" its parameter. However, some operations will not, such as Expand() and DoUniteEffect(). Is there any way to get the result arts of these functions? Thank you.

    for Expanding Art, you could do as follow:
    AIArtHandle newArt =0;
    result = AIArtHandleModifier::ExpandArt(SourceArt, newArt, kExpandStroke);
    aisdk::check_ai_error(result);
    Just check method documentation to know how to pass and  retrieve data!
    Regards,
    Thomas

  • Please help on how to use variables inside a method call

    Hello guys,
    How's it goin?
    Pardon me if you find my question silly, but I am relatively
    new in ActionScript 2.0 programming.
    I have here a simple problem. It seems I can't use a variable
    inside a method call of an object. Here's the code. Please note of
    the authParams string variable below.
    import AkamaiConnection;
    import mx.services.WebService;
    var GeneratedToken:String;
    var authParams:String;
    // Create a Web Service object
    var TokGenService:WebService = new WebService("
    http://webservice.asmx?wsdl");
    // Call the web service method
    var myToken:Object = TokGenService.GenerateToken();
    // Create an AkamaiConnection object
    var connection:AkamaiConnection = new AkamaiConnection();
    connection.addEventListener("onConnect", this);
    connection.addEventListener("onError", this);
    // If you get a result from the web service, save the result
    in a variable
    myToken.onResult = function(result)
    // If you get a result from the web service, save the result
    in a variable
    myToken.onResult = function(result)
    GeneratedToken = result;
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    //Call the Connect method of the AkamaiConnection class
    connection.connect("cp37414.edgefcs.net/ondemand",true,true,5,true,false,"443","rtmpt",
    authParams);
    But then, if I use a hard-coded string value in lieu of the
    variable, the method call works!
    connection.connect("cp37414.edgefcs.net/ondemand",true,true,5,true,false,"443","rtmpt",
    "testStringvalue");
    I don't know what I'm missing or what I'm doing wrong... Can
    somebody help me please? I am using a 30-day trial version of Adobe
    Flash CS3. Also, when I Trace output the variables, the values are
    there. It just that they can't be read or recognize inside the
    method call. Is this a ActionScript limitation?
    Thanks so much in advance!

    The result param is a returned, “Decoded ActionScript
    object version of the XML”. I am not exactly sure what that
    means but I have had issues of returned XML values and their
    datatype. When I did have these issues I had to cast or convert
    into the desired datatype. Try one of the following, assuming the
    problem is related to the code that you have bolded.
    GeneratedToken = result.toString();
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    Or
    GeneratedToken = String(result);
    authParams = GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/";
    Or
    GeneratedToken = result.toString();
    authParams = String(GeneratedToken +
    "&aifp=v001&slist=37414/test/Streaming/");

  • TptbmOCI Interpret Results

    I have been running tptbmOCI against an Oracle database and a TimesTen database. I had a question about how to interpret what I am seeing.
    So when I do an insert you can see below that I am inserting 1,000,000 records (bold below) however, when it comes to the results it show 10,000 transactions. When do a select count(*) from appuser.vpn_users it shows the 1 million records. I was under the impression that the transactions would say 1,000,000 but instead shows 10,000.
    Why does it show 1,000,000 on one section but then appears to only benchmark on 10,000 records on the results? Is that because tptbmOCI is bench marking against 10,000 of the 1 million records??
    D:\TimesTen\tt1121_64\quickstart\sample_code\oci>tptbmOCI -service dbscan -user appuser -insert 100 -key 1000
    Enter password for appuser :
    Connected using appuser@dbscan
    Using Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
    Data Mining and Real Application Testing options
    and Oracle Client 11.1.0.7.0
    Load the appuser.vpn_users table with *1000000* rows of data
    Run 10000 txns with 1 process: 0% read, 0% update, 100% insert, 0% delete
    Transactions: *10000* <1> SQL operations per txn
    Elapsed time: 14.7 seconds
    Transaction rate: 680.1 transactions/second
    Transaction rate: 40808.0 transactions/minute

    Hi Victir,
    By default, TPTBM first drops, creates and populates the VPN_USERS table with data. The number of rows used to populate the table is determined by the value specified for 'key' squared. So for -key 1000 the table is populated with 1,000,000 rows. Then the number of transactions specified by -xact (default is 10,000) are executed and timed to give the transactional throughput. It is possible to simply populate the table without running any transactions (-build) option or to run transactions without repeating the population step (-nobuild option).
    Try running tptbmoci --help to get details on all options.
    Chris

Maybe you are looking for

  • Safari stops responding when I try to bookmark (and other slow problems!)

    Two weeks ago my logicboard died, so I sent my ibook out to Apple for it to be fixed. Ever since I got it back this past Tuesday, my Safari has been extremely slow, but nothing else is wrong with my computer. Here are the problems: - The biggest issu

  • Can't open new windows in safari

    I have been using safari for years. I upgraded to the safari 3.0 Beta some weeks ago and had no problems everything ran fine. I have done nothing irregular and today I fired up my computer - opened safari and found that no window would automatically

  • HR-ABAP for infotype 581

    hi , here we r suffering with the problem that when we want to enter data for NON-METRO  FOR City Category it always shows fill all required fileds. in V_T7INR9 view is there any need to maintain value for NON-METRO  . i will be very greateful plz he

  • How to use MAF libraries

    Dear, I'm going to replace controls by MAF in my android application. I import libraries: - mafuicomponents-1.2.1.jar - maftreeview-1.2.1.jar - mafsettingscreen-1.2.1.jar - maflocaleawarecontrols-1.2.1.jar - mafcalendar-1.2.1.jar I created an simple

  • Access iOS 6 Maps on the web?

    Is there a way to access iOS Maps on the web?  I ask this because there are so many errors in everything I've searched for thus far (including the 14+ buildings of my employer), that it will take forever to tap in problem reports for each one.  Googl