Contains Area and Shape method

Hi,
I've some problems with the "contains" method of the
Area class in java.awt.geom...the problem is that the boolean value from this method is always false for me..
This is the code for a shape object, but the same is for
an area object. Thank you if you can.
boolean pippo;
Ellipse2D.Float circle2;
circle2 = new Ellipse2D.Float(50,50,50,50);
pippo= circle2.contains(50,50);
System.out.println(pippo);

Did you read the API?
contains:
Tests if the interior of this Ellipse2D entirely
contains the specified rectangular area.
Maybe it has to do with this - as you are specifying a
point that is not interior but on the outside edge??
Therefore it returns false.I'don't think this is the problem...
the istruction:
     circle2 = new Ellipse2D.Float(50,50,50,50);
create a circle in position x=50 y=50 with radius=50
and so the coordinate's point (50,50) should be in any case inside the circle!

Similar Messages

  • Why addcomponent and removecomponent method are not in component class,

    Hi,
    why addcomponent and removecomponent method are not in component oand component class,
    Thank you

    java.awt.Container has the appropriate add and remove methods:
    http://java.sun.com/javase/6/docs/api/java/awt/Container.html
    If that seems odd to you, you need to think about the Composite Pattern:
    http://en.wikipedia.org/wiki/Composite_pattern
    [url #" style="display: block; background-image: url('http://upload.wikimedia.org/wikipedia/en/1/13/Compositepattern.png'); width: 406px; height: 271px] 

  • EjbActivate() and ejbPassivate() methods are called million times!!! :(

    Hello All,
    Am I missing some thing here?
    We have a project with many Entity Beans, and all of them have relations with one another. The simple example I can give is Entity A has one to many relation with Entity B.
    i.e There could be one Entity A and for this there could be many Entities B these two entities are managed by CMR fields.
    Entity A has a PK, this would act as a FK in Entity B.
    In the EJB Post create method of Entity B I am trying to find a suitable entity A and trying to execute setEntityA(suitableEntityA), while this method is getting executed here is the things that happen
    the container tries to find all Entity B (if there are 10,000 records in B table then ejbActivate() of B is executed 10,000 times) then it sets the relation with Entity A, then at the end of the Transaction the container will call ejbPassivate() method on Entity B 10,000 times!!! oh god what is happening here...!!!?????
    can some one tell me if I am missing some settings?
    The same thing happends for all the other EJBs which have one to many CMR fields, i.e ejbActivate() and ejbPassivate() of each of these Entity Beans will be called for those many number of times for as many records found in the Datbase of the corresponding Entity.
    I have the follwing setting in my orion-ejb-jar.xml file
    <entity-deployment name="EntityA"
    max-tx-retries="0"
    max-instances="-1"
    location="EntityA"
    table="A"
    data-source="jdbc/oracleDS"
    exclusive-write-access="false"
    locking-mode="optimistic"
    update-changed-fields-only="true"
    delay-updates-until-commit="true">
    similar xml construct for Entity B also!!!
    If some one knows more about this please let me know.
    Thank you
    -Mallik

    Found one more thing for this CMP-CMR relationship and ejbActivate() and ejbPassivate() process of CMP Entity's.
    In this above example if say
    Entity A (Dept) ------ Entity B (Employee) (1:M) has one to many relationship
    Employee holds a FK value which is PK in Dept (dept_id).
    Suppose asssume that there are 10,000 employees working for a dept_id = 5.
    (i.e there are 10,000 records in Employee that references Dept table with dept_id =5)
    Now I want to add one more employee to this dept_id = 5, then I create an Employee entity and in the ejbPostCreate() method of Employee entity I lookup Dept Entity with Dept_PK=5, until this every thing is fine. Now I call setter method with in Employee Entity to set the dept such as setDept_dept_id(detpEntity5), at the execution of this method EJB container calls starts calling Employee Entity's the ejbActivate() method for 10,000 times this equals the number of references Employee table has to Dept table with Dept_ID=5, then at the end of the transaction the container calls ejbPassivate() method 10,000 times to passivate all those ejbs that it activated.
    Did some one experience the same thing with CMP EJBs? please let me know what I have to do to avoid such things?
    Thank you
    Mallik

  • VMI and  reduce Stock in Transit - what are the right methods?

    Hi Gurus,
    We are using APO system to implement VMI functionality to replenish stock at customer location.  We need to build stock in transit at customer location after PGI happens in ECC.  
    Now, stock in transit is show up in 'Stock in transit' key figure, but the question is how to reduce stock in transit once it is received at customer location.
    SAP recommends following four methods to reduce:
    http://help.sap.com/saphelp_scm2007/helpdata/en/f1/f69a3dcbcfac53e10000000a114084/frameset.htm
    1.  Goods receipt information is not sent from the customer to the vendor
    2. The open purchase order quantity is sent from the customer to the vendor
    3. A proof of delivery is sent from the customer
    4.  The stock in transit quantity is sent from the customer to the vendor
    Out of these 1 and 2 methods are feasible in our scenario.
    Please share your experience if you have used any of these methods, I want to hear from someone who implemented any of these methods before deciding on a method.
    Thanks in advance,
    Niranjan

    Dear Niranjan,
    I have implemented SCM-APO VMI using Past Releases of SCM  (version 4.1) for upto 300 Customer Sites & 500-1000 Products.
    In my experience ... this is a Big Custom Development using EDI - IDOCs / ALE wherein you Receive from Customer the Data either as "Open Orders" or  "Goods Receipt" of VMI Order at Customer Store or "In-transits" as they view it.  There is a Facility to receive them in the PROACT IDOC but you have to write IDOC FUnction Modules to post the Data to the
    VMI Planning Area as well as at Product-Location you have to Daily Delete the In-transit Order (Category EI or AH for ASN) and Upload Intransit Quantity directly into Live-Cache as a Order.  The Development is also complex as you need to Map the VMI Customer Product to the Vendor/Manufacturer's Product COdes in SCM-APO.
    I have experience implementing VMI like this several years ago ... and I am not sure if SAP SCM-APO built anything Standard for the Interface over the years.    If you are not sure get a ALE/IDOC & ABAP Consultant or  XI Consultant to work with you on the Project. 
    You can Delete In-transit Quantities by using RLCDEL  Transaction for Category EI or AH (if ASNs are used).  You need a IDOC/ALE Development to Calculate and Upload In-Transits and Update into the VMI Planning Area as well as Download to a FILE which you can use via another ABAP Development to Upload In-transits at the Product-Location (Customer) in SCM-APO.
    Hope this helps.
    Regards,
    Ambrish Mathur

  • Re: No G/L accounts are defined for bank ICICI and payment method C

    < MODERATOR:  Message locked.  Please read [this|Before you post: Rules of Engagement; before posting next time. use an appropriate subject...  something other than what was copied from an email would be appreciated. >
    Hi Friends,
    When i am doing T.Code F-58 i am getting an error of
    (No G/L accounts are defined for bank ICICI and payment method C) so could anybody please help me how to solve this problem awaiting for your reply friends.
    Points will be assigned.
    Thanks in advance.
    KUMAR.

    Hi Kumar,
    You will have to configure the House Bank with T Code FI12 and further mention the payment method in FBZP. You will have to select one of the  follwing as payment method, check/transfer/postal giro transfer/bill of exchange. Though check (C) is widely used.
    Assign points, if useful.
    Regards,
    Saurabh Agarwal

  • No G/L accounts are defined for bank 24001 and payment method C

    Hi SAP Gurus,
    Iam getting error while cheque payment to vendor - No G/L accounts are defined for bank 24001 and payment method C, Message No.: F5459.
    I have created the Bank A/c,Detail is House Bank No.24001, Account ID : 24001, Bank A/c No. 2111111111, GL A/c No. 40000000.
    Kindly help for the above matter.
    Regards,
    Amitabh

    Hi Amitabh,
    As per the error you have not yet assigned your GL account for the particular Bank Account.
    For example while giving payment by Cheque. Method is Cheque, GL account is Outgoing account right.
    The entry would be
    Cheque Issued Out Ac Dr.
    To Main Bank Ac Cr.
    You hv to assign both GL Account.
    Please check Assign accounts to account symbols area.
    Warm Regards,
    Sivakumar Sathiyamoorthy

  • Planning method/Basic and Planning method/forecast field values are grey

    Hi Experts
    The Planning method/Basic and Planning method/forecast field values are grey in my project profile.
    What customization would influence for this setting. I wish to change from 2 to 4. Please advise the solution/
    warm regards
    ramSiva

    You can change the above field values only from WBS scheduling profile. If you want to change them, choose 'free scheduling' method.
    Regards,
    Mahendra

  • Does iPhone 5 sim card size and shape are changed?

    About the sim card size and shape, there are some web sites talk about new micro - nano.....what ever sim cards for the new iPhone 5, I searched the details in the official Appel site there was no any topics about this issue, now I want the truth form any one knows it, is the sim card changed? or it is the same as for iPhone 4 and 4s?

    Yes sim card size is changed, iPhone 5, 5c and 5s supports a nano sim which is slightly shorter than micro sim which is used in iPhone 4 and 4s so you have to trim your sim or you can get a new one

  • There are two CDC methods - Source based CDC and Target based CDC which one

    There are two CDC methods - Source based CDC and Target based CDC, which one is better performancewise. in data services.
    If there is any document available which compares both and provides any info on performance etc, will be helpful.
    thank you for the helpful info.

    LIke Suneer mentioned CDC is for better performance.
    Following link would be helpful.
    http://wiki.sdn.sap.com/wiki/display/BOBJ/Extractors-Source-Based+CDC
    http://wiki.sdn.sap.com/wiki/display/BOBJ/Extractors-Target-Based+CDC
    Thanks,
    Arun

  • Ai, 3D effect - after using to either extrude or revolve the settings are retained in my drawing tools - pen, pencil and shapes. Example I draw a 50 pt extruded object in wireframe, isometric view and my pen and all drawing tools will only draw using thos

    Ai, 3D effect - after using to either extrude or revolve the settings are retained in my drawing tools - pen, pencil and shapes. Example I draw a 50 pt extruded object in wireframe, isometric view and my pen and all drawing tools will only draw using those settings. I can not exit, help please!

    Appearance panel menu > New art has basic appearance.

  • Issue with container divs, and absolute/fixed positioning

    Hello everyone, I have an issue getting my divs to function properly. I have a container div and I want the table div to float inside (and move with page resize). Right now it doesnt move with the page (see photo).
    However, when I change the position to relative of that div, it moves under the container div and locks itself there.(Second photo)
    Any help would be great! Thanks!
    Picture one:
    Picture two
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <!-- TemplateBeginEditable name="doctitle" -->
    <title>davide marchetti architetto</title>
    <!-- TemplateEndEditable -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
    <link href="ttp://mottie.github.com/tablesorter/css/theme.blue.css" rel="stylesheet">
    <script type="text/javascript" src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.js"></script>
    <script type="text/javascript" src="http://mottie.github.com/tablesorter/js/jquery.tablesorter.widgets.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
            $("#myTable").tablesorter();
    </script>
    <style type="text/css">
    body {
    font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
    background-color: #FFFFFF;
    margin: 0;
    padding: 0;
    color: #000;
    background-image: url();
    background-repeat: no-repeat;
    /* ~~ Element/tag selectors ~~ */
    ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
    padding: 0;
    margin: 0;
    h1, h2, h3, h4, h5, h6, p {
    margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
    padding-right: 15px;
    padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
    border: none;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
    color:#414958;
    text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
    color: #4E5869;
    text-decoration: underline;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
    text-decoration: none;
    /* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */
    .container {
    width: 80%;
    max-width: 1260px;/* a max-width may be desirable to keep this layout from getting too wide on a large monitor. This keeps line length more readable. IE6 does not respect this declaration. */
    min-width: 780px;
    margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */
    /* ~~ This is the layout information. ~~
    1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.
    .content {
    padding: 10px 0;
    font-size: x-small;
    /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    .content ul, .content ol {
    padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    /* ~~ miscellaneous float/clear classes ~~ */
    .fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
    float: right;
    margin-left: 8px;
    .fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
    float: left;
    margin-right: 8px;
    .clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the overflow:hidden on the .container is removed */
    clear:both;
    height:0;
    font-size: 1px;
    line-height: 0px;
    body,td,th {
              font-family: "Courier New", Courier, monospace;
              font-size: 12px;
    #apDiv1 {
    position: relative;
    width: 618px;
    height: 268px;
    z-index: 1;
    left: 186px;
    top: 147px;
    overflow: hidden;
    #apDiv2 {
              position: relative;
              width: 698px;
              height: 299px;
              z-index: 1;
              left: 266px;
              top: 117px;
              overflow: scroll;
    table.tableizer-table {
    border: 1px solid #CCC; font-family: Courier New, Courier, monospace;
    font-size: 12px;
    .tableizer-table td {
    padding: 4px;
    margin: 3px;
    border: 1px solid #ccc;
    .tableizer-table th {
    background-color: #000000;
    color: #FFF;
    font-weight: bold;
    #apDiv4 {
    position: relative;
    width: 697px;
    height: 299px;
    z-index: 1;
    left: -141px;
    top: -636px;
    overflow: scroll;
    #apDiv3 {
    position: relative;
    width: 700px;
    height: 300px;
    z-index: 2;
    h1,h2,h3,h4,h5,h6 {
    font-family: "Courier New", Courier, monospace;
    </style>
    <!-- TemplateBeginEditable name="head" -->
    <!-- TemplateEndEditable -->
    </head>
    <div class="container">
      <div class="container"><img src="../images/Davide.png" width="800" height="600" usemap="#Map" border="0" />
        <div id="apDiv2">
          <map name="Map" id="Map">
            <area shape="rect" coords="48,416,125,435" href="../news.html" />
            <area shape="rect" coords="262,416,304,436" href="../studio.html" />
            <area shape="rect" coords="490,416,545,435" href="../projects.html" />
            <area shape="rect" coords="702,415,751,436" href="../contact.html" />
          </map>
          <table id="myTable" class="tableizer-table">
            <thead>
              <tr class="tableizer-firstrow">
                <th>YEAR </th>
                <th>PROJECT</th>
                <th>LOCATION</th>
                <th>CATEGORY</th>
                <th>STATUS</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>2013</td>
                <td>EXPO 2015 - Italian Pavilion</td>
                <td>Milan - Italy</td>
                <td>Culture</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td>2012</td>
                <td>Requalification of "Almerici", "Bufalini" and "Fabbri" Squares</td>
                <td>Cesena - Italy</td>
                <td>Urban planning</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Re-thinking Shanghai: sustainable intervention along the Suzhou Creek</td>
                <td>Shanghai - China</td>
                <td>Mixed use</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>VCC Flat</td>
                <td>Rome - Italy</td>
                <td>Interior design</td>
                <td>Commission / Built</td>
              </tr>
              <tr>
                <td>2011</td>
                <td>London 2012 Olympic Games Information Pavilion</td>
                <td>London - UK</td>
                <td>Culture</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Enhancement project for the sacred area of the sanctuary of Hercules Victor</td>
                <td>Tivoli - Italy</td>
                <td>Culture</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td>2010</td>
                <td>VTL Flat </td>
                <td>Rome - Italy</td>
                <td>Interior design</td>
                <td>Commission / Built</td>
              </tr>
              <tr>
                <td> </td>
                <td>BNC Flat</td>
                <td>Rome - Italy</td>
                <td>Interior design</td>
                <td>Commission / Built</td>
              </tr>
              <tr>
                <td> </td>
                <td>Expansion of the "Farnesina" High School</td>
                <td>Rome - Italy</td>
                <td>Education</td>
                <td>Competition / Selected Project</td>
              </tr>
              <tr>
                <td> </td>
                <td>Neanderthal Art Center</td>
                <td>Pilo�a - Spain</td>
                <td>Culture</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>New pedestrian & cycling footpath in the site of the "San Leopoldo II" old bridge</td>
                <td>Poggio a Caiano - Italy</td>
                <td>Infrastructure</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Proposition 2065 - St. Leonards site</td>
                <td>Sidney - Australia</td>
                <td>Mixed use</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>MEIS - National Museum of Italian Judaism and Shoah </td>
                <td>Ferrara - Italy</td>
                <td>Culture</td>
                <td>Competition / 3rd Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>36 The Calls Design Competition</td>
                <td>Leeds - UK</td>
                <td>Offices</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Europan 10: masterplan for an harbour area</td>
                <td>Rudk�bing - Denmark</td>
                <td>Urban planning</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td>2009</td>
                <td>"Scuola in Piazza a Levante" - Kindergarten and public areas</td>
                <td>Bisceglie - Italy</td>
                <td>Education</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>CIBAF - City of Kids </td>
                <td>Frattamaggiore - Italy</td>
                <td>Education</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Designing in Teheran</td>
                <td>Teheran - Iran</td>
                <td>Mixed use</td>
                <td>Competition / Selected Project</td>
              </tr>
              <tr>
                <td>2008</td>
                <td>DawnTown 2008: Waterworks</td>
                <td>Miami - USA</td>
                <td>Mixed use</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Venice Biennale New Australian Pavillion</td>
                <td>Venice - Italy</td>
                <td>Culture</td>
                <td>Competition / 1st Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>New pedestrian and cycling bridge</td>
                <td>Civita di Bagnoregio - Italy</td>
                <td>Infrastructure</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Renovation of "San Ciro" Square</td>
                <td>Portici - Italy</td>
                <td>Urban planning</td>
                <td>Competition / 2nd phase selected / 3rd Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>Renovation of "Umberto I�" Square</td>
                <td>San Ferdinando di Puglia - Italy</td>
                <td>Urban planning</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Historic Renovation of the "Corsie Sistine" Hospital Wards </td>
                <td>Rome - Italy</td>
                <td>Culture</td>
                <td>Tender Competition (design/bid/build)</td>
              </tr>
              <tr>
                <td> </td>
                <td>Cupboard</td>
                <td>Rome - Italy</td>
                <td>Furniture design</td>
                <td>Commission / Built</td>
              </tr>
              <tr>
                <td> </td>
                <td>Office table and lighting system</td>
                <td>Rome - Italy</td>
                <td>Furniture design</td>
                <td>Commission / Built</td>
              </tr>
              <tr>
                <td> </td>
                <td>New City Library</td>
                <td>Legnano - Italy</td>
                <td>Library</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Office table</td>
                <td>Rome - Italy</td>
                <td>Furniture design</td>
                <td>Concept Design</td>
              </tr>
              <tr>
                <td> </td>
                <td>Volleyball Arena, Hotel and Commercial Spaces</td>
                <td>Rome - Italy</td>
                <td>Mixed use</td>
                <td>Concept Design</td>
              </tr>
              <tr>
                <td>2007</td>
                <td>New Provincial Archaeological Museum in the Santa Scolastica Monastery</td>
                <td>Bari - Italy</td>
                <td>Culture</td>
                <td>Competition / 5th Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>The City of Water and Health</td>
                <td>Rome - Italy</td>
                <td>Mixed use</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Parkway Iconic Bridge</td>
                <td>Sheffield - UK</td>
                <td>Infrastructure</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Renovation of "Loveno 84" Sport Center</td>
                <td>Menaggio - Italy</td>
                <td>Sport</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>"Guardia di Finanza" Corp Main Headquarters</td>
                <td>Catanzaro - Italy</td>
                <td>Mixed use</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>"Lega Lombarda" Real Estate Complex Urban Development</td>
                <td>Rome - Italy</td>
                <td>Mixed use</td>
                <td>Tender Competition (design/bid/build) </td>
              </tr>
              <tr>
                <td> </td>
                <td>Necklace</td>
                <td>Rome - Italy</td>
                <td>Jewellery design</td>
                <td>Prototype </td>
              </tr>
              <tr>
                <td> </td>
                <td>Moon putter</td>
                <td>Rome - Italy</td>
                <td>Product design</td>
                <td>Prototype</td>
              </tr>
              <tr>
                <td> </td>
                <td>Aleale Coffee Table</td>
                <td>Rome - Italy</td>
                <td>Furniture design</td>
                <td>Concept Design</td>
              </tr>
              <tr>
                <td>2006</td>
                <td>"1st October" Public Square</td>
                <td>Santa Maria Capua Vetere - Italy</td>
                <td>Urban planning</td>
                <td>Competition / 1st Prize / Built</td>
              </tr>
              <tr>
                <td> </td>
                <td>"Attilio Pecile" New Square and Sustainable Mixed Use Building</td>
                <td>Rome - Italy</td>
                <td>Mixed use</td>
                <td>Competition / 1st Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>Renewal of the "Porta Nuova" Old Tower</td>
                <td>Venice - Italy</td>
                <td>Culture</td>
                <td>Competition / 2nd Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>"Meno e pi� 4": Civic Center and Pre-school Building</td>
                <td>Rome - Italy</td>
                <td>Mixed use</td>
                <td>Competition / Mention</td>
              </tr>
              <tr>
                <td> </td>
                <td>Urban Renewal of Historic Building and Public Squares</td>
                <td>Conversano - Italy</td>
                <td>Urban planning</td>
                <td>Competition / 2nd Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>New Seafront and Beach Accesses</td>
                <td>Fregene - Italy</td>
                <td>Urban planning</td>
                <td>Competition / Mention</td>
              </tr>
              <tr>
                <td> </td>
                <td>Requalification of Main Streets and Squares of the Old City Centre</td>
                <td>Bari - Italy</td>
                <td>Urban planning</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Gyeonggi-do Jeongok Prehistory Museum</td>
                <td>Jeongok-ri - South Korea</td>
                <td>Culture</td>
                <td>Competition / Honourable Mention</td>
              </tr>
              <tr>
                <td> </td>
                <td>Low-income housing development</td>
                <td>Guadalajara/Ceuta - Spain</td>
                <td>Residential</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Shop extension</td>
                <td>Rome - Italy</td>
                <td>Retail</td>
                <td>Commission / Concept Design</td>
              </tr>
              <tr>
                <td> </td>
                <td>Temporary Concert Hall</td>
                <td>Rome - Italy</td>
                <td>Culture</td>
                <td>Concept Design</td>
              </tr>
              <tr>
                <td> </td>
                <td>Office Space Interior Design - New Seat of the Lombardy Regional Government </td>
                <td>Milan - Italy</td>
                <td>Office</td>
                <td>Tender Competition (design/bid/build)</td>
              </tr>
              <tr>
                <td>2005</td>
                <td>Europan 8 - Urban Requalification</td>
                <td>Istanbul - Turkey</td>
                <td>Urban planning</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Natural Park Visitor Center, Kindergarten and Primary School</td>
                <td>Funes - Italy</td>
                <td>Education</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Coastal Area Development</td>
                <td>Latina - Italy</td>
                <td>Urban planning</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Requalification of Three Squares</td>
                <td>Benevento - Italy</td>
                <td>Urban planning</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Office and Data Center New Building in the Ministry of Defense headquarters</td>
                <td>Rome - Italy</td>
                <td>Office</td>
                <td>Concept Design</td>
              </tr>
              <tr>
                <td>2004</td>
                <td>JCD Floating Pearl Store</td>
                <td>Tokio - Japan</td>
                <td>Retail</td>
                <td>Competition / 2nd phase selected </td>
              </tr>
              <tr>
                <td> </td>
                <td>Requalifications of Rome�s Beachfront and Coastal Areas</td>
                <td>Ostia - Italy</td>
                <td>Urban planning</td>
                <td>Competition / 1st Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>40 Apartments Building and Sport Center</td>
                <td>Rome - Italy</td>
                <td>Mixed use</td>
                <td>Competition / 2nd Prize</td>
              </tr>
              <tr>
                <td> </td>
                <td>nMBA New Beaux-Art Museum</td>
                <td>Lausanne - Switzerland</td>
                <td>Culture</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>The Dubai Residence and Hotel Towers</td>
                <td>Dubai - UAE</td>
                <td>Mixed use</td>
                <td>Concept Design</td>
              </tr>
              <tr>
                <td> </td>
                <td>Shoes and Accessories Shop</td>
                <td>Rome - Italy</td>
                <td>Retail</td>
                <td>Commission / Concept Design</td>
              </tr>
              <tr>
                <td>2003</td>
                <td>Pedestrian and cycling Bridge </td>
                <td>Rome - Italy</td>
                <td>Infrastructure</td>
                <td>Competition</td>
              </tr>
              <tr>
                <td> </td>
                <td>Temporary Pavillion for a Car Show</td>
                <td>Rome - Italy</td>
                <td>Retail</td>
                <td>Commission / Concept Design</td>
              </tr>
              <tr>
                <td> </td>
                <td>Belvedere Tower</td>
                <td>Castellammare di Stabia - Italy</td>
                <td>Infrastructure</td>
                <td>Concept Design</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    <!-- end .container --></div>
    </body>
    </html>

    #apDiv2 {
        position: absolute;
        width: 698px;
        height: 299px;
        z-index: 1;
        left:50px;
        top: 117px;
        overflow: scroll;
    Don't forget to fix your code errors.  You're still missing a <body> tag in your markup. 
    Nancy O.

  • Overlay Images and Shapes on the same canvas

    The example copde below was taken from: http://math.hws.edu/eck/cs124/javanotes3/source/
    Is it possible to update the code so that images (jpg,gif) can be added as well as shapes?
    Any help with this is much appreciated.
        The ShapeDraw applet lets the user add small colored shapes to
        a drawing area and then drag them around.  The shapes are rectangles,
        ovals, and roundrects.  The user adds a shape to the canvas by
        clicking on a button.  The shape is added at the upper left corner
        of the canvas.  The color of the shape is given by the current
        setting of a pop-up menu.  The user can drag the shapes with the
        mouse.  Ordinarily, the shapes maintain a given back-to-front order.
        However, if the user shift-clicks on a shape, that shape will be
        brought to the front.
        A menu can be popped up on a shape (by right-clicking or performing
        some othe platform-dependent action).  This menu allows the user
        to change the size and color of a shape.  It is also possible to
        delete the shape and to bring it to the front.
        This file defines the applet class plus several other classes used
        by the applet, namely:  ShapeCanvas, Shape, RectShape, OvalShape,
        and RoundRectShape.
        David Eck
        July 28,  1998
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    import java.util.Vector;
    public class ShapeDrawWithMenu extends Applet {
       public void init() { 
            // Set up the applet's GUI.  It consists of a canvas, or drawing area,
            // plus a row of controls below the canvas.  The controls include three
            // buttons which are used to add shapes to the canvas and a Choice menu
            // that is used to select the color used for a shape when it is created.
            // The canvas is set as the "listener" for these controls so that it can
            // respond to the user's actions.  (The pop-up menu is created by the canvas.)
          setBackground(Color.lightGray);
          ShapeCanvas canvas = new ShapeCanvas();  // create the canvas
          Choice colorChoice = new Choice();  // color choice menu
          colorChoice.add("Red");
          colorChoice.add("Green");
          colorChoice.add("Blue");
          colorChoice.add("Cyan");
          colorChoice.add("Magenta");
          colorChoice.add("Yellow");
          colorChoice.add("Black");
          colorChoice.add("White");
          colorChoice.addItemListener(canvas);
          Button rectButton = new Button("Rect");    // buttons for adding shapes
          rectButton.addActionListener(canvas);
          Button ovalButton = new Button("Oval");
          ovalButton.addActionListener(canvas);
          Button roundRectButton = new Button("RoundRect");
          roundRectButton.addActionListener(canvas);
          Panel bottom = new Panel();   // a Panel to hold the control buttons
          bottom.setLayout(new GridLayout(1,4,3,3));
          bottom.add(rectButton);
          bottom.add(ovalButton);
          bottom.add(roundRectButton);
          bottom.add(colorChoice);
          setLayout(new BorderLayout(3,3));
          add("Center",canvas);              // add canvas and controls to the applet
          add("South",bottom);
       public Insets getInsets() {
            // Says how much space to leave between the edges of the applet and the
            // components in the applet.
          return new Insets(3,3,3,3);
    }  // end class ShapeDraw
    class ShapeCanvas extends Canvas implements ActionListener, ItemListener,
                                                MouseListener, MouseMotionListener {
          // This class represents a canvas that can display colored shapes and
          // let the user drag them around.  It uses an off-screen images to
          // make the dragging look as smooth as possible.  A pop-up menu is
          // added to the canvas that can be used to performa certain actions
          // on the shapes;
       Image offScreenCanvas = null;   // off-screen image used for double buffering
       Graphics offScreenGraphics;     // graphics context for drawing to offScreenCanvas
       Vector shapes = new Vector();   // holds a list of the shapes that are displayed on the canvas
       Color currentColor = Color.red; // current color; when a shape is created, this is its color
       ShapeCanvas() {
            // Constructor: set background color to white, set up listeners to respond to mouse actions,
            //              and set up the pop-up menu
          setBackground(Color.white);
          addMouseListener(this);
          addMouseMotionListener(this);
          popup = new PopupMenu();
          popup.add("Red");
          popup.add("Green");
          popup.add("Blue");
          popup.add("Cyan");
          popup.add("Magenta");
          popup.add("Yellow");
          popup.add("Black");
          popup.add("White");
          popup.addSeparator();
          popup.add("Big");
          popup.add("Medium");
          popup.add("Small");
          popup.addSeparator();
          popup.add("Delete");
          popup.add("Bring To Front");
          add(popup);
          popup.addActionListener(this);
       } // end construtor
       synchronized public void paint(Graphics g) {
            // In the paint method, everything is drawn to an off-screen canvas, and then
            // that canvas is copied onto the screen.
          makeOffScreenCanvas();
          g.drawImage(offScreenCanvas,0,0,this);
       public void update(Graphics g) {
            // Update method is called when canvas is to be redrawn.
            // Just call the paint method.
          paint(g);
       void makeOffScreenCanvas() {
             // Erase the off-screen canvas and redraw all the shapes in the list.
             // (First, if canvas has not yet been created, then create it.)
          if (offScreenCanvas == null) {
             offScreenCanvas = createImage(getSize().width,getSize().height);
             offScreenGraphics = offScreenCanvas.getGraphics();
          offScreenGraphics.setColor(getBackground());
          offScreenGraphics.fillRect(0,0,getSize().width,getSize().height);
          int top = shapes.size();
          for (int i = 0; i < top; i++) {
             Shape s = (Shape)shapes.elementAt(i);
             s.draw(offScreenGraphics);
       public void itemStateChanged(ItemEvent evt) {
              // This is called to respond to item events.  Such events
              // can only be sent by the color choice menu,
              // so respond by setting the current color according to
              // the selected item in that menu.
          Choice colorChoice = (Choice)evt.getItemSelectable();
          switch (colorChoice.getSelectedIndex()) {
             case 0: currentColor = Color.red;     break;
             case 1: currentColor = Color.green;   break;
             case 2: currentColor = Color.blue;    break;
             case 3: currentColor = Color.cyan;    break;
             case 4: currentColor = Color.magenta; break;
             case 5: currentColor = Color.yellow;  break;
             case 6: currentColor = Color.black;   break;
             case 7: currentColor = Color.white;   break;
       public void actionPerformed(ActionEvent evt) {
              // Called to respond to action events.  The three shape-adding
              // buttons have been set up to send action events to this canvas.
              // Respond by adding the appropriate shape to the canvas.  This
              // also be a command from a pop-up menu.
          String command = evt.getActionCommand();
          if (command.equals("Rect"))
             addShape(new RectShape());
          else if (command.equals("Oval"))
             addShape(new OvalShape());
          else if (command.equals("RoundRect"))
             addShape(new RoundRectShape());
          else
             doPopupMenuCommand(command);
       synchronized void addShape(Shape shape) {
              // Add the shape to the canvas, and set its size/position and color.
              // The shape is added at the top-left corner, with size 50-by-30.
              // Then redraw the canvas to show the newly added shape.
          shape.setColor(currentColor);
          shape.reshape(3,3,50,30);
          shapes.addElement(shape);
          repaint();
       // ------------ This rest of the class implements dragging and the pop-up menu ---------------------
       PopupMenu popup;
       Shape selectedShape = null;     // This is null unless a menu has been popped up on this shape.
       Shape draggedShape = null;      // This is null unless a shape has been selected for dragging.
       int prevDragX;  // During dragging, these record the x and y coordinates of the
       int prevDragY;  //    previous position of the mouse.
       Shape clickedShape(int x, int y) {
             // Find the frontmost shape at coordinates (x,y); return null if there is none.
          for ( int i = shapes.size() - 1; i >= 0; i-- ) {  // check shapes from front to back
             Shape s = (Shape)shapes.elementAt(i);
             if (s.containsPoint(x,y))
                return s;
          return null;
       void doPopupMenuCommand(String command) {
             // Handle a command from the pop-up menu.
          if (selectedShape == null)  // should be impossible
             return;
          if (command.equals("Red"))
             selectedShape.setColor(Color.red);
          else if (command.equals("Green"))
             selectedShape.setColor(Color.green);
          else if (command.equals("Blue"))
             selectedShape.setColor(Color.blue);
          else if (command.equals("Cyan"))
             selectedShape.setColor(Color.cyan);
          else if (command.equals("Magenta"))
             selectedShape.setColor(Color.magenta);
          else if (command.equals("Yellow"))
             selectedShape.setColor(Color.yellow);
          else if (command.equals("Black"))
             selectedShape.setColor(Color.black);
          else if (command.equals("White"))
             selectedShape.setColor(Color.white);
          else if (command.equals("Big"))
             selectedShape.resize(75,45);
          else if (command.equals("Medium"))
             selectedShape.resize(50,30);
          else if (command.equals("Small"))
             selectedShape.resize(25,15);
          else if (command.equals("Delete"))
             shapes.removeElement(selectedShape);
          else if (command.equals("Bring To Front")) {
             shapes.removeElement(selectedShape);
             shapes.addElement(selectedShape);
          repaint();
       synchronized public void mousePressed(MouseEvent evt) {
             // User has pressed the mouse.  Find the shape that the user has clicked on, if
             // any.  If there is a shape at the position when the mouse was clicked, then
             // start dragging it.  If the user was holding down the shift key, then bring
             // the dragged shape to the front, in front of all the other shapes.
          int x = evt.getX();  // x-coordinate of point where mouse was clicked
          int y = evt.getY();  // y-coordinate of point
          if (evt.isPopupTrigger()) {            // If this is a pop-up menu event that
             selectedShape = clickedShape(x,y);  // occurred over a shape, record which shape
             if (selectedShape != null)          // it is and show the menu.
                popup.show(this,x,y);
          else {
             draggedShape = clickedShape(x,y);
             if (draggedShape != null) {
                prevDragX = x;
                prevDragY = y;
                if (evt.isShiftDown()) {                 // Bring the shape to the front by moving it to
                   shapes.removeElement(draggedShape);  //       the end of the list of shapes.
                   shapes.addElement(draggedShape);
                   repaint();  // repaint canvas to show shape in front of other shapes
       synchronized public void mouseDragged(MouseEvent evt) {
              // User has moved the mouse.  Move the dragged shape by the same amount.
          if (draggedShape != null) {
             int x = evt.getX();
             int y = evt.getY();
             draggedShape.moveBy(x - prevDragX, y - prevDragY);
             prevDragX = x;
             prevDragY = y;
             repaint();      // redraw canvas to show shape in new position
       synchronized public void mouseReleased(MouseEvent evt) {
              // User has released the mouse.  Move the dragged shape, then set
              // shapeBeingDragged to null to indicate that dragging is over.
              // If the shape lies completely outside the canvas, remove it
              // from the list of shapes (since there is no way to ever move
              // it back onscreen).
          int x = evt.getX();
          int y = evt.getY();
          if (draggedShape != null) {
             draggedShape.moveBy(x - prevDragX, y - prevDragY);
             if ( draggedShape.left >= getSize().width || draggedShape.top >= getSize().height ||
                     draggedShape.left + draggedShape.width < 0 ||
                     draggedShape.top + draggedShape.height < 0 ) {  // shape is off-screen
                shapes.removeElement(draggedShape);  // remove shape from list of shapes
             draggedShape = null;
             repaint();
          else if (evt.isPopupTrigger()) {        // If this is a pop-up menu event that
             selectedShape = clickedShape(x,y);   // occurred over a shape, record the
             if (selectedShape != null)           // shape and show the menu.
                popup.show(this,x,y);
       public void mouseEntered(MouseEvent evt) { }   // Other methods required for MouseListener and
       public void mouseExited(MouseEvent evt) { }    //              MouseMotionListener interfaces.
       public void mouseMoved(MouseEvent evt) { }
       public void mouseClicked(MouseEvent evt) { }
    }  // end class ShapeCanvas
    abstract class Shape {
          // A class representing shapes that can be displayed on a ShapeCanvas.
          // The subclasses of this class represent particular types of shapes.
          // When a shape is first constucted, it has height and width zero
          // and a default color of white.
       int left, top;      // Position of top left corner of rectangle that bounds this shape.
       int width, height;  // Size of the bounding rectangle.
       Color color = Color.white;  // Color of this shape.
       void reshape(int left, int top, int width, int height) {
             // Set the position and size of this shape.
          this.left = left;
          this.top = top;
          this.width = width;
          this.height = height;
       void resize(int width,int height) {
             // Set the size without changing the position
          this.width = width;
          this.height = height;
       void moveTo(int x, int y) {
              // Move upper left corner to the point (x,y)
          this.left = x;
          this.top = y;
       void moveBy(int dx, int dy) {
              // Move the shape by dx pixels horizontally and dy pixels veritcally
              // (by changing the position of the top-left corner of the shape).
          left += dx;
          top += dy;
       void setColor(Color color) {
              // Set the color of this shape
          this.color = color;
       boolean containsPoint(int x, int y) {
             // Check whether the shape contains the point (x,y).
             // By default, this just checks whether (x,y) is inside the
             // rectangle that bounds the shape.  This method should be
             // overridden by a subclass if the default behaviour is not
             // appropriate for the subclass.
          if (x >= left && x < left+width && y >= top && y < top+height)
             return true;
          else
             return false;
       abstract void draw(Graphics g); 
             // Draw the shape in the graphics context g.
             // This must be overriden in any concrete subclass.
    }  // end of class Shape
    class RectShape extends Shape {
          // This class represents rectangle shapes.
       void draw(Graphics g) {
          g.setColor(color);
          g.fillRect(left,top,width,height);
          g.setColor(Color.black);
          g.drawRect(left,top,width,height);
    class OvalShape extends Shape {
           // This class represents oval shapes.
       void draw(Graphics g) {
          g.setColor(color);
          g.fillOval(left,top,width,height);
          g.setColor(Color.black);
          g.drawOval(left,top,width,height);
       boolean containsPoint(int x, int y) {
             // Check whether (x,y) is inside this oval, using the
             // mathematical equation of an ellipse.
          double rx = width/2.0;   // horizontal radius of ellipse
          double ry = height/2.0;  // vertical radius of ellipse
          double cx = left + rx;   // x-coord of center of ellipse
          double cy = top + ry;    // y-coord of center of ellipse
          if ( (ry*(x-cx))*(ry*(x-cx)) + (rx*(y-cy))*(rx*(y-cy)) <= rx*rx*ry*ry )
             return true;
          else
            return false;
    class RoundRectShape extends Shape {
           // This class represents rectangle shapes with rounded corners.
           // (Note that it uses the inherited version of the
           // containsPoint(x,y) method, even though that is not perfectly
           // accurate when (x,y) is near one of the corners.)
       void draw(Graphics g) {
          g.setColor(color);
          g.fillRoundRect(left,top,width,height,width/3,height/3);
          g.setColor(Color.black);
          g.drawRoundRect(left,top,width,height,width/3,height/3);
    }

    Manveer-Singh
    Please don't post in old threads that are long dead. When you have a question, please start a topic of your own. Feel free to provide a link to an old thread if relevant.
    I'm locking this 3 year old thread now.
    db
    edit You have earlier been advised not to post in old dead threads.
    [http://forums.sun.com/thread.jspa?threadID=354443]
    Continuing to ignore this advice will render your account liable to be blocked.
    Edited by: Darryl.Burke

  • Does not contain a static 'Main' method suitable for an entry point_

    Hello
    I want to to do a project with Entiity Framework . I add a project to my solution for my domain class and it's name is 'LinkModel.DomainClasses'.  when I prees F5 there is an error like bellow.
    Could You help me to solve this? thanks alot
    ..\Documents\Training\LinkCodeFirstLast\LinkCodeFirst\LinkCodeFirst\LinkModel.DomainClasses\obj\Debug\LinkModel.DomainClasses.exe'
    does not contain a static 'Main' method suitable for an entry point

    Hi bkshn,
    This error is caused by the missing "Main" method in your project. it is the entry point of your project.
    If you want to create a EF project, you could follow the way in the aricle below.
    https://msdn.microsoft.com/en-us/data/ee712907#codefirst
    The Main method is like below.
    class Program
    static void Main(string[] args)
    using (var db = new BloggingContext())
    // Create and save a new Blog
    Console.Write("Enter a name for a new Blog: ");
    var name = Console.ReadLine();
    var blog = new Blog { Name = name };
    db.Blogs.Add(blog);
    db.SaveChanges();
    // Display all Blogs from the database
    var query = from b in db.Blogs
    orderby b.Name
    select b;
    Console.WriteLine("All blogs in the database:");
    foreach (var item in query)
    Console.WriteLine(item.Name);
    Console.WriteLine("Press any key to exit...");
    Console.ReadKey();
    And you could start to learn the EF from the following MSDN blogs.
    https://msdn.microsoft.com/en-us/data/ee712907
    If you have any other concern regarding this issue, please feel free to let me know.
    Best regards,
    Youjun Tang
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Multiple dispatch and Symmetric methods - Where Does That Code Live?

    Hi all.
    I am stuck with the above problem, which looks to be a very common and fundamental one. Supposing I have some sort of relation or operation to be performed on various different pairs (or n-tuples) of classes of object. Where does this code belong, given that it is not sole property of any one of the classes, but a kind of property of the collection of classes?
    An bad example for me to bring up, but one that neatly illustrates the point, is the equals method. In order to retain the symmetric and transitive properties of the equals method, and object can only make judgement calls about it being equal to another object of it's own type. This prevents the concept of equivalency from crossing between types.
    In order to compare a with b (if a and b are of different types), b must supply some sort of representation of itself as an a, then the comparison statement a.equals(b.asA()); must be called.
    This of course means b must supply an 'asXXX()' method for each class XXX it wishes to equate itself to. Furthermore, by an extension of the equals contract for symmetricality, the method AsB() in class A (if it exists) must be such that, if a.AsB() .equals (b), then b.AsA.equals( a ).
    This sort of design is unfeasible for obvious reasons, the main reason being that it is impossible to anticipate evey case where an instance of class A could reasonably be compared to an instance of some other class X.
    The other annoyance is all that hard work of providing methods to equate A with something else, would go unused for 99% of the time.
    With this in mind, I was thinking. Suppose in some program environment, we have only 3 classes, A, B, and C, such that:
    {A,B} can be meaningfully compared
    {B, C} and {A, C} cannot.
    It would be OK to supply code (somewhere) for comparing A's with B's. We also know that under no circumstances will an A or a B, and a C, ever need to be compared for equality.
    Supposing an extension of this environment were created, introducing class D.
    {D, A} and {D, B} can be meaningfully compared.
    Now, neither A nor C knows what a D is, or how to compare themselves to it. But D was developed with A, B and C in mind, and contains logic for the various comparisons (with A and with B). An obvious idea for this is to let D bring it's new code into play, by registering these new comparison functions in the environment somehow.
    Supposing instead that equality comparison was delegated to some third party, instead. This third party contains a table of pairs of classes, which act as keys to look up a comparison object.
    So, when class A is loaded, something of the sort happens:
    public class A {
        static {
            Equals.comparer.addEntry(A.class, B.class, new EqualsMethod() {
               // details of the EqualsMethod interface implementation go here
    public class B {
        static {
            // since equals is symmetric, this method clashes with the above in A
            // This could happen...
            Equals.comparer.addEntry(B.class, A.class, new EqualsMethod() {
               // ... different approach to the above
    public class D {
        static {
            Equals.comparer.addEntry(D.class, A.class, new EqualsMethod() {
            Equals.comparer.addEntry(D.class, B.class, new EqualsMethod() {
        } // Ds can now be compared with Bs and As. They can now be compared with Ds
    }There is a problem with the above. As can clearly be seen, there are 3 unique situations that might occur between two classes (call them X and Y).
    o One of X or Y contains code to compare them both.
    o Neither X nor Y contain code to compare the two. X equals Y is always false
    o Both X and Y contain code to compare the two.
    The third causes the problem. What if X and Y disagree on how to compare themselves? Which method gets chosen? The only solution would be to let whosever static initialiser gets called first be the one to supply the code.
    I said before that equals was a bad example to bring up. this is because the usage of equals and the concept of equality in java is already well defined, and works just fine. However, in my own pet project at the moment, I have run into the same problems as outlined above.
    I am currently assembling a generic pattern API for use in various other applications I am writing (I was finding that I was writing code for matching objects to patterns, in different guises, quite frequently, so I made the decision to refactor it into its own package). An important part of the API is the section that handles the logic for combining patterns, ie with AND, OR and NOT operations.
    The Pattern interface is this:
    interface Pattern<E> {
         public boolean match(E toMatch);
         public Pattern<E> not();
         public Pattern<E> or(Pattern<E> other);
         public Pattern<E> and(Pattern<E> other);
    }There are a few basic Patterns:
    TruePattern<E> - a pattern that always returns true no matter what E is passed for it toMatch
    FalsePattern<E> - self-explanatory.
    ExactValuePattern<E> - true if and only if the E that it is passed toMatch is .equal to the E that this pattern was constructed with.
    NotPattern<E> - a pattern that contains another pattern, and returns true for any E that returns does not match it's contained pattern. Used for when the contained pattern cannot be logically reduced to one pattern under the NOT method in the Pattern interface
    AndPattern<E> - a pattern that contains 2 other patterns, and returns true for some E iff both contained patterns return true for that E. Used for when the 2 patterns cannot be logically reduced into one pattern via the AND method in the Pattern interface
    OrPattern<E> - self explanatory
    RangePattern<E extends Comparable <E>> - a pattern for comparing if some Comparable lies between two other comparables.
    Every pattern has the opportunity to provide a reduction, when combined with another pattern through And or Or. For example, any pattern AND a FalsePattern can be reduced just the FalsePattern. any pattern OR a TruePattern can be reduced to just the TruePattern.
    The methods AND and OR from the Pattern interface present the same problems as the .equals() example I was using before.
    o AND and OR are symmetric operations
    o There exist situations where two patterns of unrelated class could be meaningfully combined (and reduced) under these two operations.
    Example: The pattern on Integers '0 < X < 3' and 'X is 5' can be reduce to the FalsePattern
    Example: The pattern on Doubles '0 < X <= 10' or 'X is 5.5' or 'X is 7.2' can be reduced to '0 < X <= 10'.
    Example: The pattern on Integers ('0 <= X <= 5' and 'X is not 0') or ('X is 6') or ('x is 7') can be reduced to '1<=X<=7'.
    So the question is, where does the code belong? a.and(b) should return the same as b.and(a), but both b and a may well disagree as to what happens when they are combined under and. At present, both a and b need to supply their own separate implementations. Clearly though, the code for combining patterns A and B belongs to neither A alone, not B alone, but to A and B as a whole.
    Thanks in advance, and sorry for this overlong post.

    So the equivalent thing in my scenario would be an
    AndAnator, and an OrAnator? :)
    The thing is, it would be nice for comparison between
    A and B to take place automatically, without the poor
    coder having to maintain a reference to a Comparator
    and invoke the comparison method each time. Likewise
    in my situation, it'd be nice to say A.or(B) instead
    of andAnator.and(A,B), yet have all the goodness of a
    third party doing the comparison (or in this case,
    the anding).
    I am going to go and test this all out, but do you
    have any suggestions on a good structure? I think it
    would involve pulling the and/or/not methods from the
    interface (this appeals, as many implementors may not
    wish to supply logic for running these methods
    anyhow), and then putting them... somewhere else.I didn't consider your speicifc problem very deeply because after such a long detailed explanation I figured you'd be up for kicking around the idea for a while.
    In your case, I see that you would want to be able to call the and and or methods on the Objects themselves. Luckily, in this case, I think you can have your cake and eat it too.
    You can make your and and or methods fa�ades to the third party 'referee'. This way you can enfore symmetry. It's difficult (if not impossible) to enoforce transitivity with this design but I think you don't even need that in this case. That is if a == b and b == c then a == c should be true but if a and b and b and c then a and c is not necessarily true. In your case, it may not even make sense.

  • Plain Explain  and s methods (tools) for  to improve Performance

    Hi
    How can I do to use Plain Explain and others methods for to impove performance ?
    Where can I to find tutorial about it ?
    thank you in advance

    Hi
    How can I do to use Plain Explain and others
    methods for to impove performance ?
    Internally there are potentially several hundred 'procedures' that can be assembled in different ways to access data. For example, when getting one row from a table, you could use an index or a full table scan.
    Explain Plan shows the [proposed] access path, or complete list of the procedures, in the order called, to do what the SQL statement is requesting.
    The objective with Explain Plan is to review the proposed access path and determine whether alternates, through the use of hints or statistics or indexes or materialized views, might be 'better'.
    You often use Wait analysis, through StatsPack, AWR/ADDM, TKProf, Trace, etc. to determine which SQL statement is likely causing a performance issue.
    >
    Where can I to find tutorial about it ?Ah ... the $64K question. If we only knew ...
    There are so many variables involved, that most tutorials are nearly useless. The common approach therefore is to read - a lot. And build up your own 'interpretation' of the reading.
    Personal suggestion is to read (in order)
    1) Oracle's Database Concepts manual (described some of 'how' this is happening)
    2) Oracle's Performance Tuning manual (describes more of 'how' as related to performance and also describes some of the approaches)
    3) Tom Kyte's latest book (has a lot of demos and 'proofs' about how specific things work)
    4) Don Burleson's Statspack book (shows how to set up and do some basic interpretation)
    5) Jonathan's book (how the optimizer works - tough reading, though)
    6_ any book by the Oak Table (http://oaktable.net)
    Beyond that is any book that contains the words 'Oracle' and 'Performance' in the title or description. BUT ... when reading, use truck-loads, not just grains, of salt.
    Verify everything. I have seen an incredible amount of mistakes ... make 'em mysellf all the time, so I tend to recognize them when I see them. Believe nothing unless you have proven it for yourself.. Even then, realize there are exceptions and boundary conditions and ibgs and patches and statistics and CPU and memory and disk speed issues that will change ehat you have proven.
    It's not hopeless. But it is a lot of work and effort. And well rewarded, if you decide to get serious.

Maybe you are looking for