Creating objects and efficiency

I am implementing bounding circles for my game and I have a question. I have heard that creating a new object takes up a lot of time (i.e doing it every update). Should I give each of my objects a BoundingSphere instance variable (I created my own simple BoundingSphere class), update it's position every update along with the sprite, or should I remove the instance variable and just return a new BoundingSphere when it is requested?
Just to clarify:
Implementation 1:
private BoundingSphere s;
public BoundingSphere getBoundingSphere() {
   return s;
//update s each time sprite is updatedImplementation 2:
//no private instance variable
public BoundingSphere getBoundingSphere() {
   return new BoundingSphere(radius, x, y);

If you know a maximum bound on how many of the created objects you'll need at any given time, you can prevent lots of object creation by implementing an object pool. The pool keeps a list of pre-constructed objects, and to use it, a method may request an object, use a method to initialize its values (not a constructor), then release it back to the pool when it is done using it. This is usually done with Threads to limit the number of them running, but it can be done with any object.
I hope this helps
-JBoeing

Similar Messages

  • Create Objects and Attachments

    Hi All,
    I want to know how to create Objects and Attachments  in Workflow as in case of Customized WF . As for Purchase Order Release I can see the Click on the Link and Display the Document. How it get done?
    Help Me
    Thanks

    Hello Munish,
    First goto SWO1 to create objects.(custom).
    Second you can copy std. WF and enhance it for your requiremet.
    in custom BO you can write method and in that you can call your form59.
    from swel you can find which std. B.O. is used for PO Release.
    Hope magic works,
    Regards,
    Purvesh.

  • Create object and link to database in acrobat

    i am using visual studio and creating a C# application in .net. i am looking to allow users to open a pdf document and then use a custome symbols library to trace out objects on the pdf. the object i would like to attach to a database to extract the data from. is this possible

    Sorry, I don't understand what you want to do. Especially "trace out objects on the pdf" - what sort of objects and what do you mean by "trace out"?
    Also note that Acrobat is absolutely not for use on a server.

  • Create Object and Subject for Application Log

    Hello Experts,
    Could anyone tell me how to create the Z Object and subobject for the Application Log.
    ie) <b>BALOBJ_D & BALSUBOBJ</b>
    Could you please tell me the Tcode for that.
    Since I have to save the application in the new object so that it can be displayed using this Key.
    Thanks & Regards,
    Vasanth

    Hello Vasanth
    The transaction is SLG0 (Object Maintenance).
    Regards
       Uwe

  • Programmatically create objects and formulas in Crystal Reports XI Developer edition?

    <p>Is it possible to programatically/dynamically create a text, line, formula field object, etc. in Crystal XI Developer edition?  I have been programming with the Crystal .Net reports component that came with VS 2005 for the past 6 months and know for a fact you can&#39;t programmatically create those objects although you can programmatically control their properties.  My intention is to create a dynamic report that can be reused extensively.  My current work-around for this was to create a generic report with about 40 formula field objects which draws data from 40 corresponding formula fields that I can programmatically set it&#39;s formula thus imitating a report field.  I want to update to the developer edition because I heard with this edition we can programmatically create and manipulate these objects but I found no reference or examples anywhere that proves we can do this?  Does anyone know for a fact or point me to the right place to look for documentation?  TIA</p>

    Hi,
    How can I programmatically refresh list of values status on CR server XI R2?
    Currently, after I modified the data source in the data connection, some of the LOVs in the report prompt window became empty when I tried to generate the report. I have to use Business View Manager to log onto the Crystal reports server XI R2, find and double click the list of values object to bring up the Edit LOV window, and then click on "Refresh Status" button to make the LOV available in the report prompt window.
    What SDK should I use to create a simple application (preferable a desktop application) to find all LOV objects on CR server XI R2 and to refresh their status? That is an application similar to the "Refresh Status" function in Business View Manager.
    I found Report Engine SDK has the Lov.Refresh function to refresh LOV. On the other hand, Report Engine SDK seems to be for BusinessObjects Enterprise, not for Crystal Reports Server. Can this or other function achieve what I want, i.e. to refresh list of values status on CR server XI R2? If yes, can I use it to develop a self-contained desktop application instead of a web application? I only need to run this application after I modify the data source in the data connection, so I prefer not need to deploy it as a web service.
    Thanks for your help.
    C.T.

  • Creating objects and setlabel

    I,m creating an application and in one of the classes i,m creating another object by a buttonlike so,
              //b1 is in another class
           b1.setLabel("Atm"+index);
           index++;     
           Atm Atm1 = new Atm(blah);
              //class atm
    [code\]
    is it possible to label the new object at the same time
    i.e Atm 1 as it is created
    appreciate any help
    Thank you                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    OK i fixed the typos in my post....corrected version below.....
    why name the Atm object? just have a field for the name....
    if (something is true) {
    new Atm(name);
    //more stuff
    //and you have a class....
    class Atm {
    String name;
    //other fields
    //constructor
    Atm(String str) {
    this.name = str;
    //more code
    //of course you'd probably make name a private field
    and write a setName() method

  • Database Development and Creating Objects in the Enterprise

    Hello Everyone,
    I have found myself filling the role of DB Developer for a DataMart project in a large enterprise. We are looking at replicating and consolidating multiple schemas in near real-time into an ODS for Reporting and Data Integration purposes. I did a POC locally in DEV to create Materialized Views for this purpose. It seems to work fine, I've got them on Fast Refresh, added a unique identifier etc.
    The DBA stated I was granted the Priv to create the MVIEWS bc our vendor requires more PRIVS than is normally allowed for other apps in the Enterprise and it was only done on our server. Now I requested to try the same thing, however on the remote ODS DB over DBLinks. He stated creating objects on the ODS is a 'bad idea' and not allowed without engaging the broader DB group, even for DEv purposes. He also stated that MOST enterprises don't allow creating objects, and only allow DML. Problem is, once we engage that group it could add significant time and money to the project. Which seems silly as I just want to see if it's a feasible option.
    Any thoughts on this? Can anyone share experiences regarding what is and is not allowed at the DB level strictly for DEV purposes and not on PROD?
    Thanks,
    PRAJNA

    Thanks for the input jgarry. It does seem they are treating DEV like PROD in this case. Which has the potential to hamper innovation and new ways of doing things, especially in an aging IT environment where we might be stuck in our ways of doing things. It also sounds a bit general and not necessarily the case that 'most companies also don't allow this sort of thing'. I haven't worked in enough shops to say one way or the other however.
    Yes, creating a local DBLink would be an option, but I wanted to test this method running across two physical servers ideally. Worth a try though.

  • Data objects and code objects in oracle application

    Hi,
    can any one please help me out with following question?
    1. what are data objects and code objects in oracle apps and why is that difference?
    2. How does the objects gets created in Oracle Applications, like during the installation which part is responsible for creating objects and after the installtion later point of time, how the new objects gets created in oracle applications?
    3. what are the ways to find out if my 11i application is OATM enabled ?
    Thanks in advance

    Hello,
    I managed to find answer for question 1, yet to find answer for 2 and 3.
    Answer for question 1 --
    Data objects : store and access business data (tables, indexes, sequences, index-organized tables, etc);
    Code objects : process data objects but them don't contains business data (functions, procedures, packages, views, synonyms);
    Now, here i have a question - under which objects queues are considered ?

  • I dont understand creating classes they seem a waste of time and efficiency

    I dont understand why we would want to create classes with constructors and get and set statements... I know that VB and Java did not create these just to have us writing extra code so I am missing something in my thinking.
    I read about data hiding and that I understand I guess...but everytime my professors want me to create a class then create an object from that class to access it I dont really get it. I know how to do the basics of it but I can do all of it in my main or the primary class whats the benefit of creating a whole entire class such as the following?
    Everytime I get an assignment and they are like create a class and I try to rack my head for a good idea but the nearest analogy I can come up with is this... creating your own class seems like one of those old straws you drink out of with all the loops, yes you can make it go around in a big loop but why waste time? you want to get to point A to point B so create the most efficient way to get there if possible.
    I am sure the problem is I am not seeing something and there is some logic missing but I just am getting irritated as I am not seeing it and I am finding it, its like I add an extra obstacle course to my code for no other reason than to run through a bunch of extra tasks that I could perform in my main class or main.
    input is welcome to help me arrive at some type of enlightenment thanks
    Class may not be the correct wording for this as I know we have to have a class but what I mean is a non application class. The class I have below goes with another class that actually does a lot of stuff but I am forced to push data through this class that basically does nothing but run water through some different pipes if you will. To me thats a waste when I can do everything in my original class which was called menu that I am messing with and that creates an array for a user who wants to keep a list of his items and prices of those items in inventory.
    public class Item
    private String itemName;
    private double itemPrice;
              public Item()
    public Item (String item, double price)
    setName(item);
    setPrice(price);
    public String getName()
         return itemName;
    public void setName(String item)
         itemName = item;
    public double getPrice()
         return itemPrice;
    public void setPrice(double price)
         itemPrice= price;
    Edited by: Bricatw on Oct 30, 2009 10:33 PM

    What I was plugging into it and please forgive the code as its not finished... (I am still messing with it) its just for learning and I am required to have certain parts in the Item Class and Certain parts in the Menu class..... But you it pushes through the input to the java bean.... in a case like this I just dont see the need for doing it not that I can think of anyway.
    import java.util.Scanner;//my imports for scanner so can read from the screen
    import java.util.*;//imports for my array I used astrix to just import it all as the book said it does not have any negative affects.
    public class Menu //My application class Menu that contains my main
         public static void main(String[] args)//Main method
              final int NUMBER_Of_Elements = 30; //created a symbolic constant so that I only have to change the constant
              //to edit the size of the array if I should want to change it.
              Item[]inventory = new Item[NUMBER_Of_Elements];//I create a new array object with the constant as the number of elements.
              Scanner sc = new Scanner (System.in);//created object from the scanner class used to get input from the console screen.
              System.out.println("Please enter Item on first line and price on second line.");//outputted text to prompt user and give instructions.
              System.out.println("Enter STOP to exit");//instructions on how to exit the program. I would have rather used a different
              //word than stop here. If my choice I would have used "exit" as its more widely used and to promote uniformity.
              int count;//count variable used to count my loops very important as we use it to control our arrays and loops here.
              double price;//our variable that we plug in values from the user via the console.
              String item;//same as previously mentioned for the "price"
                        System.out.println("Wings Coffee Shop Menu");
              System.out.println("");
              System.out.println("Menu Item Price");
              for (count=0; count<inventory.length; ++count)//This is our for loop it uses the length method to control how many times
              //it runs. In this case inventory.length = 30 elements so would run 30 times unless it stopped early.
                   item = sc.nextLine();//reads the input from console into the item variable.
                   if(item.equalsIgnoreCase("STOP"))//if statement that states if = stop (ignores case sensitivity) then it will break out of the loop.
                   break;//the break command which is executed if the if statement is true.
                   price = Double.parseDouble(sc.nextLine());//
                   inventory[count]= new Item(item, price);
                   Item Call = new Item(item, price);
                   System.out.printf("%-13s %.2f\n", Call.getName(), Call.getPrice());
              System.out.println("Wings Coffee Shop Menu");
              System.out.println("");
              System.out.println("Menu Item Price");
    //           for(int x = 0; x < count; ++x)
    //           System.out.printf("%15s\n",inventory[x].toString());
    //                System.out.printf("%-13s %.2f\n", Call.getName(), Call.getPrice());
    //           String[] namesOfItems = {"Coffee", "Milk", "Soda", "Bagel", "Croissant", "Donut"};
    //           double[] prices = {3.99, 2.99, 2.49, 2.99, 2.49, 1.99};
    //           for(int x = 0; x < prices.length; ++x)
    //           System.out.printf("%-13s %.2f\n", namesOfItems[x], prices[x]);
    //           Item arrayPrice = new Item(); HOW COME I CANNOT CREATE THIS OBJECT?
    //           Item call = new Item ();
    //           Item Call = new Item("item", 4.9);
    Edited by: Bricatw on Oct 30, 2009 11:22 PM

  • How to create dynamic View Object and Dynamic Table

    Dear ll
    I want to create a dynamic view object and display the output in a dynamic table on the page.
    I am using Jdeveloper 12c "Studio Edition Version 12.1.2.0.0"
    This what I did:
    1- I created a read only view object with this query "Select sysdate from dual"
    2- I added this View object to the application module
    3- I created a new method that change the query of this View object at runtime
        public void changeVoQuery(String dbViewName) {
            String sqlstm = "Select * From " + dbViewName;
            ViewObject dynamicVo = this.findViewObject("DynamicVo");
            if (dynamicVo != null) {
                dynamicVo.remove();
            dynamicVo = this.createViewObjectFromQueryStmt("DynamicVo", sqlstm);
            dynamicVo.executeQuery();
    4- I run the application module for testing the method and I passed "Scott.Emp" as a parameter and the result was Success
    5- Now I want to show the result of the view on the page, so I draged and dropped the method from the data control as a parameter form
    6- I dragged and dropped the view Object "DynamicVo" as a table and I choose "generate Column Dynamically at runtime". This is the page source
    <af:panelHeader text="#{viewcontrollerBundle.SELECT_DOCUMTN_TYPE}" id="ph1">
            <af:panelFormLayout id="pfl1">
                <af:inputText value="#{bindings.dbViewName.inputValue}" label="#{bindings.dbViewName.hints.label}"
                              required="#{bindings.dbViewName.hints.mandatory}"
                              columns="#{bindings.dbViewName.hints.displayWidth}"
                              maximumLength="#{bindings.dbViewName.hints.precision}"
                              shortDesc="#{bindings.dbViewName.hints.tooltip}" id="it1">
                    <f:validator binding="#{bindings.dbViewName.validator}"/>
                </af:inputText>
                <af:button actionListener="#{bindings.changeVoQuery.execute}" text="changeVoQuery"
                           disabled="#{!bindings.changeVoQuery.enabled}" id="b1"/>
            </af:panelFormLayout>
        </af:panelHeader>
        <af:table value="#{bindings.DynamicVo.collectionModel}" var="row" rows="#{bindings.DynamicVo.rangeSize}"
                  emptyText="#{bindings.DynamicVo.viewable ? 'No data to display.' : 'Access Denied.'}"
                  rowBandingInterval="0" selectedRowKeys="#{bindings.DynamicVo.collectionModel.selectedRow}"
                  selectionListener="#{bindings.DynamicVo.collectionModel.makeCurrent}" rowSelection="single"
                  fetchSize="#{bindings.DynamicVo.rangeSize}" filterModel="#{bindings.DynamicVoQuery.queryDescriptor}"
                  queryListener="#{bindings.DynamicVoQuery.processQuery}" filterVisible="true" varStatus="vs" id="t1"
                  partialTriggers="::b1">
            <af:iterator id="i1" value="#{bindings.DynamicVo.attributesModel.attributes}" var="column">
                <af:column headerText="#{column.label}" sortProperty="#{column.name}" sortable="true" filterable="true"
                           id="c1">
                    <af:dynamicComponent id="d1" attributeModel="#{column}"
                                         value="#{row.bindings[column.name].inputValue}"/>
                </af:column>
            </af:iterator>
        </af:table>
    when I run the page this error is occured
    <Nov 13, 2013 2:51:58 PM AST> <Error> <oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter> <BEA-000000> <ADF_FACES-60096:Server Exception during PPR, #1
    javax.el.ELException: java.lang.NullPointerException
    Caused By: java.lang.NullPointerException
    Can any body help me please
    thanks

    Have you seen Shay's video https://blogs.oracle.com/shay/entry/adf_faces_dynamic_tags_-_for_a
    All you have to do is to use the dynamic table to get your result.
    Timo

  • Creating remote objects and passing the retrieved data to modules

    I found at this Adobe tutorial a nice "RemoteService" class that  creates a RemoteObject and contains the functions for handling the  result and fault events. If I wanted to use this approach, how could I  pass the data from the result handler to interfaces that modules from  the main application could use?
    I could put the RemoteService/RemoteObject in the modules, but (in my  opinion- and I could be wrong) the best design seems to be using the  remote calls in the main app and passing the data along to the modules.
    Ultimately, I would like to know what the "best practices" are for creating remote objects and passing the retrieved data to modules
    Thanks!

    public void mouseClicked(MouseEvent e) {
      X x = new X(e.getX(), e.getY());
    }I don't see the difficulty.

  • How can I create Object Tag which supports Sun and MS JVM both.

    Hi,
    I have created object tag as shown below
    <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    name = "TestApplet" height="0" width="0" >
    <param name="code" value="com.apps.TestApplet.class" />
    <param name="codebase" value="codes" />
    <param name="archive" value="TestApplet.jar" />
    </object>
    The above tag is working fine with the below JVM combinations in Windows XP.
    1) Only Sun JVM
    2) Only MS JVM
    3) Sun JVM & MS JVM
    But these conditions are not working with Windows 2000.
    How we can create object tag which will support for these two opertating systems?

    I am not able to understand the problem. From my understanding, you have an applet which you are trying to display in a browser using <object> tag. If that is the correct then all it matters is the browser and the JRE�
    For example the below code when put in a JSP or a HTML, will use JRE 1.6.0_01 that is available on the client machine. If that is not available on the client machine then it will try and download automatically in IE.
    This below code is for IE� if you are using Mozilla Firefox then you need to change the �classid� attribute to �java: com.foo.bar.ui.MyClass�
    <OBJECT ID="Gantt" classid = "clsid:CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA"
                  codebase = "http://java.sun.com/update/1.6.0/jinstall-6u1-windows-i586.cab"
                  WIDTH = "980" HEIGHT = "495" ALIGN = "baseline">
                   <PARAM NAME="cache_option" VALUE="Plugin">
                  <PARAM NAME ="CODE" VALUE = "com.foo.bar.ui.MyClass" >
                  <PARAM NAME="MAYSCRIPT" VALUE="true">
                  <PARAM NAME ="cache_archive" VALUE = "Myjar.jar /" >
                  <PARAM NAME = "type" VALUE = "application/x-java-applet;jpi-version=1.6.0">
                  <PARAM NAME = "scriptable" VALUE = "false">
                  <strong>
                     This browser does not have a Java 1.6.0_01 Plug-in.
                     <br />
                     <a href="http://java.sun.com/update/1.6.0/jinstall-6u1-windows-i586.cab">
                       Get the latest Java Plug-in here.
                     </a>
              </strong>
            </OBJECT>

  • How to create authority check object and assign to  ztcode which is of modu

    Dear ,
             how to create authority check object and assign to  ztcode which is of custom module pool program.its urgent kindly help points rewarded.

    Manoj,
    You can check with your Basis team to create authorisation object and assigining tcodes to the user profiles.
    K.Kiran.

  • SAP Cloud Application Studio Create Custom Web Service From Custom Business Object and Consume in External System

    Hi Experts,
    I have requirement to create custom business object and create Web Service for that and use in external system (SAP ECC / SAP CRM / Third Party).
    1) Is it possible to create custom object web service and used in external system ?
    2) When we create the Web service from custom business object what the necessary steps(action : Create , Read , Update) require?
    3) Sample Scenario :
    My Custom Business Object
    businessobject Custom_Integration {
      element EP_VAL1 : LANGUAGEINDEPENDENT_MEDIUM_Text;
      element EP_VAL2 : LANGUAGEINDEPENDENT_MEDIUM_Text;
      element IP_RES : LANGUAGEINDEPENDENT_MEDIUM_Text;
    I have created the Web Service using this custom business object.
    3) How i can use this web service in external system? what are the prerequisite steps in external system to consume this service in it?
    Please anyone have idea about this how to do this and how to achieve this using SDK and custom business object.
    Many Thanks
    Mithun

    Hello Mithun,
    Does this section in the documentation help you:
    SAP Cloud Applications Studio Help -> Developers Desktop -> Web Services
    The entry "Task -> Create a Web Service" describes how to create a Web Service on your own BO
    The entry "Task -> Test a Web Service" helps you how you can use it in a foreign tool / application.
    HTH,
       Horst

  • What is authorization object and how to create it for a table

    Hi All,
    What is authorization object and how to create it for a table?
    Thanks

    Hi
    Authorization
    For authorization checks, there are many ways of linking authorization objects with user actions in an SAP system. The following discusses three possibilities in the context of ABAP programming.
    Authorization Check for Transactions
    You can directly link authorization objects with transaction codes. You can enter values for the fields of an authorization object in the transaction maintenance. Before the transaction is executed, the system compares these values with the values in the user master record and only starts the transaction if the appropriate authorization exists.
    Authorization Check for ABAP Programs
    For ABAP programs, the two objects S_DEVELOP (program development and program execution) and S_PROGRAM (program maintenance) exist. They contains a field P_GROUP that is connected with the program attribute authorization group. Thus, you can assign users program-specific authorizations for individual ABAP programs.
    Authorization Check in ABAP Programs
    A more sophisticated, user-programmed authorization check is possible using the Authority-Check statement. It allows you to check the entries in the user master record for specific authorization objects against any other values. Therefore, if a transaction or program is not sufficiently protected or not every user that is authorized to use the program can also execute all the actions, this statement must be used.
    AUTHORITY-CHECK OBJECT object
                            ID name1 FIELD f1
                            ID name2 FIELD f2
                            ID namen FIELD fn.
    object is the name of an authorization object. With name1, name2 ... , and so on, you must list all fields of the authorization object object. With  f1, f2 ... , and so on, you must specify the values that the system is to check against the entries in the relevant authorization of the user master record. The AUTHORITY-CHECK statement searches for the specified object in the user profile and checks the useru2019s authorizations for all values of f1, f2 ... . You can avoid checking a field name1, name2 ... by replacing FIELD f1  FIELD f2 with DUMMY.
    After the FIELD addition, you can only specify an elementary field, not a selection table. However, there are function modules available that execute the AUTHORITY-CHECK statement for all values of selection tables. The AUTHORITY-CHECK statement is supported by a statement pattern.
    Only if the user has all authorizations, is the return value sy-subrc of the AUTHORITY-CHECK statement set to 0. The most important return values are:
    ·        0: The user has an authorization for all specified values.
    ·        4: The user does not have the authorization.
    ·        8: The number of specified fields is incorrect.
    ·        12: The specified authorization object does not exist.
    A list of all possible return values is available in the ABAP keyword documentation. The content of sy-subrc has to be closely examined to ascertain the result of the authorization check and react accordingly.
    REPORT demo_authorithy_check.
    PARAMETERS pa_carr LIKE sflight-carrid.
    DATA wa_flights LIKE demo_focc.
    AT SELECTION-SCREEN.
      AUTHORITY-CHECK OBJECT 'S_CARRID'
                      ID 'CARRID' FIELD pa_carr
                      ID 'ACTVT' FIELD '03'.
      IF sy-subrc = 4.
        MESSAGE e045(sabapdocu) WITH pa_carr.
      ELSEIF sy-subrc <> 0.
        MESSAGE e184(sabapdocu) WITH text-010.
      ENDIF.
    START-OF-SELECTION.
      SELECT  carrid connid fldate seatsmax seatsocc
        FROM  sflight
        INTO  CORRESPONDING FIELDS OF wa_flights
        WHERE carrid = pa_carr.
        WRITE: / wa_flights-carrid,
                 wa_flights-connid,
                 wa_flights-fldate,
                 wa_flights-seatsmax,
                 wa_flights-seatsocc.
      ENDSELECT.
    Regards
    Hitesh

Maybe you are looking for

  • Two External Displays for iMac

    Is it possible to run two external displays off of an iMac? I have a small display running and just was giving an old second display so I was wondering if I could run both at the same time?

  • Change/Create purchase order with customer BSART via CIF

    Hi, we create Purchase Orders in SCM SNP.  Those POs are passed via CIF to R/3, but the Purchase orders should be created with a customer BSART. In SCM the POs currently use the standard ATPCategories. I found an exit in CIF_PO_INBOUND where you can

  • Table.convertToText() issue

    Hi all, I am not sure if this was reported before (can not match any searches) For me looks like a bug or something weird, at least. Start point is to convert a table to text (even by 1-liner script) and to make undo after this. A table is back and r

  • I can't find where to go to login to hide my purchases? HELP!

    I am trying to hide purchases (books, etc) from my account. I can't find where to do this at. Please help! Thanks!!

  • BATCH-INPUT On transaction VT02 does not work.

    Greetings, colleagues!!! I have written BATCH-INPUT on transaction VT02. I try to remove delivery from transportation. But for me does not work BATCH-INPUT because function of "Positioning" does not work in BATCH-INPUT. Prompt please. How I can remov