Multiple instances of an Object-Oriented Scrollbar?

Hi everyone, Ive gone through the Object-Oriented Scrollbar tutorial on gotoandlearn.com. Its working great and I have multiple buttons inside of the moveclip it lives within. The problem occurs when I create another one on the same page. I have put one on frame 1 and the other on frame 5 so that I can select a 'category' and the scrollbar movieclip changes to the relevant buttons.
Ive duplicated the movie clips and changed the instances accordingly. I keep getting these errors in the Output panel when playing my swf;
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at as3_movieplayer_fla::MainTimeline/frame1()
and when I click the like to the second category it comes up with this error;
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at as3_movieplayer_fla::scrollbox_1/thumbUp()
Not really sure what im doing wrong - or even what these mean!
Here is the code from my main actions layer;
stop();
//buttons
btn_advertising.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
    gotoAndStop(1);
btn_corporate.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void {
    gotoAndStop(5);
//video player script
function videoOne(event:MouseEvent):void{
   vidPlayer.source = "flvs/ib_enginuity.flv";
function videoTwo(event:MouseEvent):void{
   vidPlayer.source = "flvs/ib_blists_hill.flv";
function videoOneCorp(event:MouseEvent):void{
   vidPlayer.source = "flvs/ib_explore_enjoy.flv";
function videoTwoCorp(event:MouseEvent):void{
   vidPlayer.source = "flvs/ib_great_year_visit.flv";
//text script
function button1text(event:MouseEvent):void{
   textBox.text = "Ironbridge - Enginuity";
function button2text(event:MouseEvent):void{
   textBox.text = "Ironbridge - Blists Hill";
function button1CORPtext(event:MouseEvent):void{
   textBox.text = "Ironbridge - A Place to Explore and Enjoy";
function button2CORPtext(event:MouseEvent):void{
   textBox.text = "Ironbridge - A Great Year to Visit";
//event listeners
scrollbox.content.button1.addEventListener(MouseEvent.CLICK,videoOne);
scrollbox.content.button1.addEventListener(MouseEvent.CLICK,button1text);
scrollbox.content.button2.addEventListener(MouseEvent.CLICK,videoTwo);
scrollbox.content.button2.addEventListener(MouseEvent.CLICK,button2text);
scrollboxCorp.content.button1Corp.addEventListener(MouseEvent.CLICK,videoOneCorp);
scrollboxCorp.content.button1Corp.addEventListener(MouseEvent.CLICK,button1CORPtext);
scrollboxCorp.content.button2Corp.addEventListener(MouseEvent.CLICK,videoTwoCorp);
scrollboxCorp.content.button2Corp.addEventListener(MouseEvent.CLICK,button2CORPtext);
and also the code from my actions layer inside my movieclip which is on frame 5;
import caurina.transitions.*;
var yOffset:Number;
var yMin:Number = 0;
var yMax:Number = sb.track.height - sb.thumb.height;
sb.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDown);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbUp);
function thumbDown(e:MouseEvent):void
   stage.addEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
   yOffset = mouseY - sb.thumb.y;
function thumbUp(e:MouseEvent):void
   stage.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMove);
function thumbMove(e:MouseEvent):void
   sb.thumb.y = mouseY - yOffset;
   if(sb.thumb.y <= yMin)
      sb.thumb.y = yMin;
   if(sb.thumb.y >= yMax)
      sb.thumb.y = yMax;
   var sp:Number = sb.thumb.y / yMax;
   Tweener.addTween(contentCorp, {y:(-sp*(contentCorp.height-masker.height)),
                        time:1});
   e.updateAfterEvent();
Please help me iron out these problems!!! Many thanks
Dan Williams

hum thats interesting. Could it be my flash player?
Ive 'published' it as an .exe and it works fine.
If i publish to html, the flash player box comes up with that error in it.
If you dismiss all errors then it works fine!?
The error appears in the output part. Its referencing scrollbox_1::frame1:18, but I dont have anything called scrollbox_1?! not sure what is going on.
ignore all that. I just tried exporting it as flash 9 rather than flash 10 and the error has gone!
I suppose thats the answer then!
Thanks for all your help anyway ned, was much appreciated.
Kind Regards
Dan

Similar Messages

  • How to reference multiple instances of the same Java object from PL/SQL?

    Dear all,
    I'm experimenting with calling Java from PL/SQL.
    My simple attempts work, which is calling public static [java] methods through PL/SQL wrappers from SQL (and PL/SQL). (See my example code below).
    However it is the limitation of the public static methods that puzzels me.
    I would like to do the following:
    - from PL/SQL (in essence it needs to become a forms app) create one or more objects in the java realm
    - from PL/SQL alter properties of a java object
    - from PL/SQL call methods on a java object
    However I fail to see how I can create multiple instances of an object and reference one particular object in the java realm through public static methods.
    My current solution is the singleton pattern: of said java object I have only 1 copy, so I do not need to know a reference to it.
    I can just assume that there will only ever be 1 of said object.
    But I should be able to make more then 1 instance of an object.
    To make it more specific:
    - suppose I have the object car in the java realm
    - from PL/SQL I want to create a car in the java realm
    - from PL/SQL I need to give it license plates
    - I need to start the engine of a scpecific car
    However if I want more then 1 car then I need to be able to refrence them. How is this done?
    Somehow I need to be able to execute the following in PL/SQL:
    DECLARE
    vMyCar_Porsche CAR;
    vMyCar_Fiat CAR;
    BEGIN
    vMyCar_Porsche = new CAR();
    vMyCar_Fiat = new CAR();
    vMyCar_Porsche.setLicensePlates('FAST');
    vMyCar_Porsche.startEngine();
    vMyCar_Fiat.killEngine();
    END;
    Thanks in advance.
    Best Regards,
    Ruben
    My current example code is the following:
    JAVA:
    ===
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED CODAROUL."RMG/BO/RMG_OBJECT" as package RMG.BO;
    public class RMG_OBJECT {
    private static RMG_OBJECT instance = new RMGOBJECT();
    private String rmgObjectNaam;
    private RMG_OBJECT(){
    this.rmgObjectNaam = "NonDetermined";
    public static String GET_RMGOBJECT_NAAM () {
    String toestand = null;
    if (_instance == null) {toestand = "DOES NOT EXIST";} else { toestand = "EXISTS";};
    System.out.println("instance : " + toestand);
    System.out.println("object name is : " + _instance.rmgObjectNaam);
    return _instance.rmgObjectNaam;
    public static Integer SET_RMGOBJECT_NAAM (String IN)
    try
    _instance.rmgObjectNaam = IN;
    return 1;
    catch (Exception e)//catch
    System.out.println("Other Exception: " + e.toString());
    e.printStackTrace();
    return 5;
    } //catch
    PL/SQL Wrapper:
    ==========
    CREATE OR REPLACE FUNCTION CODAROUL.SET_RMGOBJECT_NAAM(NAAM IN VARCHAR2) return NUMBER AS
    LANGUAGE JAVA NAME 'RMG.BO.RMG_OBJECT.SET_RMGOBJECT_NAAM (java.lang.String) return java.lang.Integer';
    Calling from SQL:
    ==========
    CALL dbms_java.set_output(2000);
    select CODAROUL.GET_RMGOBJECT_NAAM() from dual;
    Edited by: RubenS_BE on Apr 6, 2012 5:35 AM
    Edited by: 925945 on Apr 6, 2012 5:41 AM

    You can do this by manually creating a new iterator binding in your binding tab.
    So instead of dragging the VO directly to the page, go to the binding tab, add a new executable iterator binding, and point to that one from your ELs in the page itself.

  • Shared Objects: How to store and read multiple instances

    Hi,
    Can we store multiple instances of Shared Objects in memory and read the desired instance.
    e.g
    If i execute the below program twice then also it will create only a single instance in the memory.
    Can we create a memory object with a key and then read the instance with the object with key
    data: handle type ref to ZCL_SHM_AREA_XX,
          root   type ref to ZCL_SHM_AREA_ROOT_XX.
    handle = ZCL_SHM_AREA_XX=>attach_for_write( ).
    create object root AREA HANDLE handle.
    root->FORM = 'Termination'.
    handle->set_root( root ).
    handle->detach_commit( ).

    Hi Sameer,
    check my reply to Recursive methods..
    Cheers
    Graham Robbo

  • New instances of an object with a button - please help

    Hi
    Hope anyone can help with a simple sample/solution.
    Think i seach the entire world !!!
    Want to make fx. 40 instances of an object ( chosen by user ) - in the "old Flash" there was eval();
    - as i remember I could create multiple instances of an object like this:
    int numberOfBikes = 40;
    for (i = 0;i < numberOfBikes;i++){
    newInstanceName = eval("bike"+i) ; // this is my only problem in the world - for now :o(
    Bike newInstanceName = new Bike() ; // newInstanceName translated to example "bike12"
    newInstanceName.moveTheBike(some arguments) ;
    // YEAH - then I had 40 different bikes
    Please - if anyone have a simple solution for that single line of code - 500 lines of complex array coding does not help a newborn !!!

    You are at once on my Buddy list :o)
    Now i have 40 bikes running all over town - looks pretty cool
    This worked in my run method:
              int i;
              int numberOfBikes = 40;
              test bikes[] = new test[numberOfBikes];
              for (i = 0;i < numberOfBikes;i++)
                bikes[i] = new test();
              }This code in my while loop to call the Class method:
              for (i = 0;i < numberOfBikes;i++)
                         bikes.goAhead(gcon, H, V);
    Cool - was a MEGA help !!!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Multiple instances of a service from a bean

    Hi all,
    I have a class that provides a service, however there can multiple instances of this object and I need to retrieve all instances of the service. A simplified version of my function is:
    public MyService getMyService() throws Exception
    if (_myService == null)
    myService = (MyService)getBeanContextServices().getService(bccs, this, myService.class, null, new MyServiceRevokedListener());
    return _myService;
    I guess that I need to return a Collection of MyService objects from this function. When I call getService(...) there is only on instance returned (not surprising really). I have been searching through the documentation for a function that will return all instances of a service. This sounds like functionality that I would have expected to be provided by the API so before I write application specific code, I was wondering if anyone out there could offer some advice.
    Any thoughts and suggestions would be appreciated.
    Regards,
    Chris

    You mean likepublic MyService[] getMyServices()...? If you're looking for an API that returns a set of resources, try java.awt.GraphicsEnvironment.

  • Local connection multiple instance

    Hi,
    I have used local connection between an action script 3 and action script 2 file which is working correctly.
    But when we open application in multiple tabs of browser it shows error that the "file is already connected". Is there any way to open the multiple instance of the object.
    Thanks,
    Amit

    No, you cannot have multiple connection with the same name. If each tab represents unrelated sets of SWFs - you will need to figure out a way to create random dynamic connection names and make all swfs aware of this name. Depending on your architecture this dynamic name may be delivered via JavaScript or, is SWFs are served on the same page and you have controls over page serving - supply it as page url variable which is read by SWFs. In both cases you will need ExternalInterface capacities.

  • Creating multiple instances of a class in LabVIEW object-oriented programming

    How do you create multiple instances of a class in a loop?  Or am I thinking about this all wrong?
    For instance, I read in a file containing this information:
    Person Name #1
    Person Age #1
    Hobby #1
    Hobby #2
    Hobby #3
    Person Name #2
    Person Age #2
    Hobby #1
    Hobby #2
    Hobby #3
    Person Name #3
    Person Age #3
    Hobby #1
    Hobby #2
    Hobby #3
    If I define a Person class with name, age, and an array of strings (for the hobbies), how can I create several new Person instances in a loop while reading through the text file?
    FYI, new to LabVIEW OOP but familiar with Java OOP.  Thank you!

    First of all, let's get your terminology correct.  You are not creating multiple instances of a class.  You are creating Objects of the class.
    Use autoindexing to create an array of your class type.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Object Oriented XML Instances - existing standard?

    Hi All
    I am in search for a standard/package that can remove
    redundancy and reduce inconsistencies in XML. It ought
    to be done by using object oriented XML instances. I do
    not mean XML schema languages like SOX. The
    concept I refer to is used earlier on in the config-file. I
    have implemented a simple version but as soon as I
    realized its potential I also realized that there has to be
    an existing standard out there. I have searched the web
    without any luck, but since I am new to XML there is a big
    chance that I have missed it. I would be grateful if anyone
    could point me in the right direction.
    To clarify I have an example. Its a small part from the
    config-file used by my database bridge and this part is
    used to define fields and tables. Following two attributes
    are reserved
    1. did - the identity of this instance. The name space for
    this definition is restricted to the tag name, but can be
    seen from anywhere in the project.
    2. eid - the identity of the instance that this instance extends.
    <database did="my database">
      <field_definitions>
        <field did="super" key="no" unique="no" visible="yes" allow_null="no"/>
        <field did="boolean" eid="super" class="ops.dbb.FieldBoolean"
               default="false"/>
        <field did="integer" eid="super" class="ops.dbb.FieldInteger"
               default="0" display_size="10"/>
        <field did="auto_inc" eid="integer" class="ops.dbb.FieldAutoInc"
            key="yes" unique="yes" name="id" visible="no"/>
        <field did="string" eid="super" class="ops.dbb.FieldString"/>
        <field did="string_10" eid="string" size="10"/>
        <field did="note" eid="string" size="50" name="note" allow_null="yes"/>
      </field_definitions>
      <tables>
        <table did="users">
          <field eid="auto_inc"/>
          <field did="username" eid="string_10"/>
          <field did="password" eid="string_10" visible="no"/>
          <field eid="note"/>
        </table>
        <table did="admin_users" eid="users">
          <field did="security_level" eid="integer"/>
        </table>
      </tables>
    </database>If there are only a few tables this might not be
    justified, but used in a project with hundreds of
    tables, this will help considerable.
    As fun as it is to reinvent the wheel, I am trying
    not to.

    Either there are functions in JAXB that I am missing
    or you are misunderstanding me jmwollny. I understand
    that given a valid XSD schema JAXB will generate
    interfaces and classes that I can work with instead of
    working with XML files directly. This is really cool,
    but it is not the concept I am looking for. When I
    write 'Object Oriented XML Instances' I do not
    referring to Java, I mean that the XML elements in the
    config-file are capable of inheritance, creating
    interfaces, creating abstract elements and more. Here
    is a smaller example.
      <field did="super" key="no" unique="no"/>
      <field did="integer" eid="super" unique="yes"/>If we take a look at the second field where
    did="integer", it is inheriting the attribute key="no"
    from the field where did="super" since the attribute
    eid="super" exists. We can also see that since
    polymorphism is supported, unique="yes" in the second
    field is replacing unique="no" in the first field.
    The reason why I think this is helpful is because it
    will reduce redundancy and inconsistencies in the
    config-file.

  • Multiple instances of a Singleton-Object by updaterule ?

    Hi folks,
    I'm trying to load > 1 Mio. records from an ODS into another InfoProvider. Every record gets some keyfigures out of a very very expensive table-join.
    I tried creating this join in an ABAP-Singleton-Object to reduce uploading-time.
    This object holds a private-static attribute 'instance' as a reference to a instance of the object and a public-static 'getInstance()'-method, which returns the 'instance'-value. This method is standard-Singleton-like designed.
    Then I created a process-chain with:
    - an ABAP-process, which calls the 'getInstance()'-method
      of this Singleton.
      At the first pass this method calls the constructor and
      after that a private method, which creates the join and
      holds the result in an internal table.
      So the constructor is empty.
    - after that the data should be transfered (by an Info-
      Package) from the ODS to the other InfoProvider. In some
      fields of the update-rule and in the startroutine of
      the rule the 'getInstance()'-method of the Singleton is
      been called and by this reference to the only (so I
      thought) instance some other methods should return a
      calculated value out of the join.
    So theory .... the startroutine is been called for multiple datapackages (no problem) --- but for every package in the startroutine the 'getInstance()'-method calls the constructor, so I get multiple instances of a Singleton.
    The time-gap between the package-calls is > 10 secs., so the static-attribute should been set immediately in the first pass of the 'getInstance()', since the constructor is empty.
        Any ideas ???
        Bye Ralf

    -/-

  • Multiple instances of the same VI running in parallel

    Hi,
    I have a timestamping subVI that looks at a counter channel and applies timestamps. I want to create multiple instances of this subVI (8 to be exact) and have them all run in parallel (looking at 8 different channels). Someone gave me the following advice:
    >>
    Also, in case you want to call multiple instances of the same SubVI, and you want these multiple instances to execute in parallel, you will have to set the SubVI to execute in reentrant mode. Do this by opening the SubVI and going to "Edit >> VI Properties >> Execution" and enable "Reentrant execution".
    <<
    I've tried this but only my second instance (I started simple with only 2 instances) seems to monitor its channel and pass data along to the queue. I've included my code below, I have two signal simulators which simulate singles coming in on channels 2 and 3. I'm using a PCQI 6602 counter/timer card.
    Any help would be greatly appreciated, thanks in advance,
    Chris
    Attachments:
    LabView App (June 28, 2005).zip ‏158 KB

    good news! Your reentrant VI is working and all three instances are running (as execution highlighting clearly shows). The problem is going to be an error that is occuring but you don't see because you are ignoring the error clusters internally in the timer. It looks like at one point it was set to quit if an error occurred. That still needs to be there.
    Always hookup error clusters...
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Object oriented programming aspects in Oracle

    Dear All,
    Can you one explain me the aspects of Object Oriented Programming in Oracle. How to use oops concepts in Oracle Procedures, functions, packages, etc.
    Thanks,
    Moorthy.GS

    Oracle 9i introduces support for inheritance, method overriding and dynamic method dispatch (or "dynamic binding", or "virtual").
    A method call is dispatched to the nearest implementation, working back up the inheritance hierarchy from the current or specified type.
    See, for example, how we can implement the Template Design Pattern in PL/SQL, using inheritance, method overriding and dynamic method dispatch:
    http://www.quest-pipelines.com/pipelines/plsql/tips06.htm#OCTOBER
    Oracle 11g introduces support for "super" object-oriented keyword. One attempt to do this in PLSQL 9i/10g:
    Calling the Parent Object's Version of an Overridden Method
    http://www.quest-pipelines.com/pipelines/plsql/tips03.htm#JUNE
    I expect some OO improvements in the future (in Oracle 12oo ...):
    1. References between transient objects (instances of objects types) and (then) garbage collector
    2. Generic classes (templates, generics) like in Eiffel, C++, Java 5 (PL/SQL was modeled after ADA 83, and ADA 83 has generic packages)
    3. Multiple inheritance like in Eiffel (inner classes like in Java - no, please)
    4. Design By Contract like in Eiffel (C++ / Java 1.4 assert is not enough)
    Design by contract (DBC) is a method whose author is Bertrand Mayer, also maker of OOPL language Eiffel
    (Eiffel was designed in 1985, commercialy released in 1986, ISO-standardized in 2006).
    Simplified, DBC is based on principle that in each routine (procedure or function) with standard code,
    two additional parts – PRECONDITION and POSTCONDITION - need to be asserted.
    An additional assertion in class is called INVARIANT.
    Contract is based on routine's putting up an obligation to caller (to some other routine)
    to satisfy conditions of precondition and conditions of invariant, and hers (called routine's) obligation
    to satisfy conditions of postcondition and conditions of invariant.
    The object oriented Eiffel programming language was created to implement DBC.
    For now, other OO (object-oriented) languages don’t support directly the ideas behind DBC.
    However, precondition and postcondition are applicable to many programming languages, both OO and not OO.
    Invariants are applicable only in OOPL.
    This is my attempt to use DBC methodology (including invariants) in Oracle PL/SQL.
    Eiffel class interface (not like Java interface, but more like PL/SQL package specification)
    from Bertrand Meyer's book "Object oriented software construction", second edition (OOSC2), 1997, page 390-391:
    class interface STACK [G]
    creation make
    feature -- Initialization
      make (n: INTEGER) is -- Alocate stack for a maximum of n elements
        require
          non_negative_capacity: n >= 0
        ensure
          capacity_set: capacity = n
        end
    feature -- Access
      capacity: INTEGER -- Maximum number of stack elements
      count: INTEGER -- Number of stack elements
      item: G is -– Top element
        require
          not_empty: not empty
        end
    feature -- Status report
      empty: BOOLEAN is –- Is stack empty?
        ensure
          empty_definition: Result = (count = 0)
        end
      full: BOOLEAN is –- Is stack full?
        ensure
          full_definition: Result = (count = capacity)
        end
    feature -- Element change
      put (x: G) is –- Add x on top
        require
          not_full: not full
        ensure
          not_empty: not empty
          added_to_top: item = x
          one_more_item: count = old count + 1
        end
      remove is -– Remove top element
        require
          not_empty: not empty
        ensure
          not_full: not full
          one_fewer: count = old count - 1
        end
    invariant
      count_non_negative: 0 <= count
      count_bounded: count <= capacity
      empty_if_no_elements: empty = (count = 0)
    end -– class interface STACK
    -- PL/SQL "equivalent":
    -- Stack implementation - TABLE of INTEGER.
    -- Eiffel has generic classes (like C++ templates and better than Java generics).
    -- PL/SQL (now) has not generic classes or generic packages.
    CREATE OR REPLACE TYPE array_t AS TABLE OF INTEGER
    -- utility package:
    CREATE OR REPLACE PACKAGE dbc AS
      -- 0 = no check
      -- 1 = check preconditions
      -- 2 = check preconditions + postconditions
      -- 3 = check preconditions + postconditions + invariants
      c_no_check                  CONSTANT INTEGER := 0;
      c_check_preconditions       CONSTANT INTEGER := 1;
      c_check_pre_postconditions  CONSTANT INTEGER := 2;
      c_check_pre_post_invariants CONSTANT INTEGER := 3;
      FUNCTION check_preconditions       RETURN BOOLEAN;
      FUNCTION check_pre_postconditions  RETURN BOOLEAN;
      FUNCTION check_pre_post_invariants RETURN BOOLEAN;
      PROCEDURE set_level (p_level INTEGER);
      PROCEDURE display_error (p_error VARCHAR2);
    END;
    CREATE OR REPLACE PACKAGE BODY dbc AS
      m_level INTEGER := c_no_check;
      FUNCTION check_preconditions RETURN BOOLEAN IS
      BEGIN
        IF m_level >= c_check_preconditions THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;  
      END;
      FUNCTION check_pre_postconditions RETURN BOOLEAN IS
      BEGIN
        IF m_level >= c_check_pre_postconditions THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;  
      END;
      FUNCTION check_pre_post_invariants RETURN BOOLEAN IS
      BEGIN
        IF m_level >= c_check_pre_post_invariants THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;  
      END;
      PROCEDURE set_level (p_level INTEGER) IS
      BEGIN
        IF p_level NOT IN
          (c_no_check, c_check_preconditions, c_check_pre_postconditions, c_check_pre_post_invariants)
        THEN
          RAISE_APPLICATION_ERROR (-20000, 'Wrong checking level');
        END IF;
        m_level := p_level;
      END;
      PROCEDURE display_error (p_error VARCHAR2) IS
      BEGIN
        RAISE_APPLICATION_ERROR (-20000, 'ERROR in method ' || p_error);
      END;
    END;
    CREATE OR REPLACE TYPE stack AS OBJECT (
      -- Maximum number of stack elements
      capacity INTEGER,
      -- Number of stack elements
      el_count INTEGER,
      -- Stack implementation
      stack_implementation array_t,
      -- Alocate stack for a maximum of n elements
      CONSTRUCTOR FUNCTION stack (n INTEGER) RETURN SELF AS RESULT,
      -- Top element
      MEMBER FUNCTION item (SELF IN OUT stack) RETURN INTEGER,
      -- Is stack empty?
      MEMBER FUNCTION empty RETURN BOOLEAN,
      -- Is stack full?
      MEMBER FUNCTION full RETURN BOOLEAN,
      -- Add x on top
      MEMBER PROCEDURE put (x INTEGER),
      -- Remove top element
      MEMBER PROCEDURE remove,
      -- INVARIANTS
      -- Note:
      -- If subprogram is declared in an object type body (in PL/SQL 8i/9i/10g)
      -- it must be defined in the object type specification too.
      MEMBER FUNCTION count_non_negative RETURN BOOLEAN,
      MEMBER FUNCTION count_bounded RETURN BOOLEAN,
      MEMBER FUNCTION empty_if_no_elements RETURN BOOLEAN,
      MEMBER PROCEDURE check_invariants
    ) NOT FINAL;
    CREATE OR REPLACE TYPE BODY stack AS
      CONSTRUCTOR FUNCTION stack (n INTEGER) RETURN SELF AS RESULT IS
      BEGIN
        IF dbc.check_preconditions AND n < 0 THEN
          dbc.display_error ('stack - PRE');
        END IF;
        check_invariants;
        capacity := n;
        stack_implementation := array_t();
        stack_implementation.EXTEND (n);
        IF dbc.check_pre_postconditions AND capacity <> n THEN
          dbc.display_error ('stack - POST');
        END IF;
        check_invariants;
      END;
      MEMBER FUNCTION item (SELF IN OUT stack) RETURN INTEGER IS
      BEGIN
        IF dbc.check_preconditions AND empty THEN
          dbc.display_error ('item - PRE');
        END IF;
        check_invariants;
        RETURN stack_implementation(el_count);
      END;
      MEMBER FUNCTION empty RETURN BOOLEAN IS
      BEGIN
        IF el_count = 0 THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;
      END;
      MEMBER FUNCTION full RETURN BOOLEAN IS
      BEGIN
        IF el_count = capacity THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;
      END;
      MEMBER PROCEDURE put (x INTEGER) IS
      BEGIN
        IF dbc.check_preconditions AND full THEN
          dbc.display_error ('put - PRE');
        END IF;
        check_invariants;
        el_count := el_count + 1;
        stack_implementation(el_count) := x;
        -- PL/SQL has not Eiffel's OLD
        -- one_more_item: count = old count + 1
        IF dbc.check_pre_postconditions AND (empty OR item <> x) THEN
          dbc.display_error ('put - POST');
        END IF;
        check_invariants;
      END;
      MEMBER PROCEDURE remove IS BEGIN
        IF dbc.check_preconditions AND empty THEN
          dbc.display_error ('remove - PRE');
        END IF;
        check_invariants;
        el_count := el_count - 1;
        -- PL/SQL has not Eiffel's OLD
        -- one_fewer: count = old count - 1
        IF dbc.check_pre_postconditions AND full THEN
          dbc.display_error ('remove - POST');
        END IF;
        check_invariants;
      END;
      -- INVARIANTS
      MEMBER FUNCTION count_non_negative RETURN BOOLEAN IS
      BEGIN
        IF el_count >= 0 THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;
      END;
      MEMBER FUNCTION count_bounded RETURN BOOLEAN IS
      BEGIN
        IF el_count <= capacity THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;
      END;
      MEMBER FUNCTION empty_if_no_elements RETURN BOOLEAN IS
      BEGIN
        IF empty AND (el_count = 0)
           OR
           NOT empty AND (el_count <> 0)
        THEN
          RETURN TRUE;
        ELSE
          RETURN FALSE;
        END IF;
      END;
      MEMBER PROCEDURE check_invariants IS
      BEGIN
        IF NOT dbc.check_pre_post_invariants THEN
          RETURN; -- without checking invariants
        END IF;
        IF NOT count_non_negative THEN
          dbc.display_error ('INVARIANT count_non_negative');
        END IF;
        IF NOT count_bounded THEN
          dbc.display_error ('INVARIANT count_bounded');
        END IF;
        IF NOT empty_if_no_elements THEN
          dbc.display_error ('INVARIANT empty_if_no_elements');
        END IF;
      END;
    END; -- class body STACK
    /Regards,
    Zlatko Sirotic

  • How do YOU name classes? (object oriented programming)

    I am in the process of learning advanced object oriented design, and I am trying to use it in my personal programming project. I'm having a hard time implementing all of the classes I want for it because I can't think of what to call them.
    So, my question is, in object oriented design, how do you name the implementations and abstractions that you make?
    In other words, "implementations" can be thought of as "classes", and "abstractions" as "interfaces" in Java or "pure abstract classes" in C++. How do you name the classes and interfaces you make?
    For example, do you use prefixes or suffixes on your names, such as "I" for "interface" or "Impl" for "implementation"? Do you add "-able" to the end of the name of an abstraction, such as "Decoratable"? Can you always think of simple logical names for all of your classes, and it just has never been a problem for you?
    As an example of how the number of classes quickly grows, the Decorator Pattern will use at least five classes. I have no idea what I would name those in a programming project.

    drcouzelis wrote:
    Trent wrote:Theoretically speaking, you'll have multiple implementations of the Window interface, which will have their own unique names suggested by their respective purposes.  If not, then Window and its implementation should probably be merged into a single class.
    Thank you for bringing that up.
    How about this: The name of the implementation class will be HOW its implemented followed by the name of the interface.
    A "Window" interface would have implementations such as "AllegroWindow", "GTKWindow", or "HaikuWindow".
    In a video game, a "Character" interface would have implementations such as "GeneralCharacter", "ControllableCharacter", "PlayableCharacter", or "EnemyCharacter".
    Does that sound like a good idea?
    Indeed, classes are more specific than interfaces, subclasses are more specific as their superclasses... This should be reflected in their names, the name of a class that implements an interface should somehow make clear exactly what it is (e.g. what kind window). If you have a kind of window (for instance) that is really _just_ a window, nothing else, than the interface should become this class and the implementing classes should become subclasses.

  • Why java is called pure object oriented.

    i know that java is called as pure object oriented language.
    why it is called so even though it has primitive datatypes and also it doesnot support multiple inheritance completely. it only supports in the case of interfaces but not in the case of classes. then why it is called pure object oriented.

    Its because you cannot write an executable java program without creating an object. Well, you can:
    public class a
      public static void main( String a[] )
    }In contrary to C++, there can be no variables or functions in the wild (outside a class).
    You can not create an executable java program without creating a class (but not forcibly its instance, an object.)
    The "pure object oriented" wording in this sense has not really much importance, it is rather a marketing ploy.

  • Why generate object-oriented database schema

    Let me begin with an example:
    public class Base
    protected int id = 0;
    protected String name = null;
    public class Derived extends Base
    protected int type = 0;
    Derived class and Base class form an object-oriented inheritence. After
    using SchemaToolTask, the following table definition is generated :
    create table base
    id INT NOT NULL,
    name VARCHAR(255),
    PRIMARY KEY (id)
    create table derived
    id INT NOT NULL,
    type INT,
    PRIMARY KEY (id)
    Actually, RDBMS is ER-oriented. Every meaningful entity corresponds to a
    database table. But in this example, maybe "Base" has no any meaning, just
    for abstraction. So why we must generate this table ? Why cannot be
    configurated to just generate
    create table derived
    id INT NOT NULL,
    name VARCHAR(255),
    type INT,
    PRIMARY KEY (id)
    This will not only avoid join operation in SELECT, but also reduce the table
    size according to Base class.
    Thanks
    Liang Zhilong
    EMail : [email protected]
    Tel : (021)54235858-6650
    Fax : (021)54235800
    PhotonicBridges Co., Ltd.
    12F, 900 Yi Shan Rd., Shanghai 200233

    As I said, this is quite high on our project plans.
    On Wed, 25 Jun 2003 14:41:29 +0800, Liang Zhilong wrote:
    I believe your concern is reasonable. However, in our application, the
    operation you assumed( to find all base instances owned by class C) is
    rare, so it'll be useful if my suggested mapping is taken as an option.
    Moreover, we should not get better performance at the cost of worse
    database schema. Kodo should have enough capacity to optimize database
    operations. For example, to find all base instances owned by class C, kodo
    should issue a "SELECT col1, col2 FROM a UNION SELECT col1, col2 FROM b".
    "Stephen kim" <[email protected]>
    ??????:[email protected]...
    This sort of mapping is on our project plan but know that there a number
    of severe performance penalties that can happen with the mapping you
    describe. If you desire to lack the join, a flat-class mapping is the
    most efficient table structure.
    Take for example the multiple classes problem:
    base
    |_ A
    |_ B
    which would result in table a and table b. Now try to do an ordering
    query. You would issue 2 selects and then have to merge in memory. To
    do any relation join, again you multiply the number of SQL statements by
    the number of subclasses (e.g. to find all base instances owned by class
    C, you would have to query against a and b).
    On Wed, 25 Jun 2003 12:39:39 +0800, Liang Zhilong wrote:
    Let me begin with an example:
    public class Base
    protected int id = 0;
    protected String name = null;
    public class Derived extends Base
    protected int type = 0;
    Derived class and Base class form an object-oriented inheritence.
    After using SchemaToolTask, the following table definition is
    generated :
    create
    table base
    id INT NOT NULL,
    name VARCHAR(255),
    PRIMARY KEY (id)
    create table derived
    id INT NOT NULL,
    type INT,
    PRIMARY KEY (id)
    Actually, RDBMS is ER-oriented. Every meaningful entity corresponds to
    a database table. But in this example, maybe "Base" has no any
    meaning,just
    for abstraction. So why we must generate this table ? Why cannot be
    configurated to just generate
    create table derived
    id INT NOT NULL,
    name VARCHAR(255),
    type INT,
    PRIMARY KEY (id)
    This will not only avoid join operation in SELECT, but also reduce the
    table size according to Base class.
    Thanks
    Liang Zhilong
    EMail : [email protected]
    Tel : (021)54235858-6650
    Fax : (021)54235800
    PhotonicBridges Co., Ltd.
    12F, 900 Yi Shan Rd., Shanghai 200233--
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • How is re-entrancy managed in LVOOP Object Oriented

    Hello my fellow LabVillians,
    I have yet another question from the land of object oriented programming.
    My application uses multiple serial ports and architecualy it made sense to have a common serial driver object and re-use it around my code.
    To my surprise, different object instances share (Lock) methods.
    My surprise being that this is kind of a fundamental princliple of OOP: Data and Methods Encapsulated within each object.
    I guess I understand that that some conditions would need Functional Global Variables,  I had assumed that they weren't possible/Practical in OOP.
    After I finished having My tantrum and changed the Class .vi to be re-entrant (Share clones is compusory) I found the Following:
    1. During Deployment I got a "Lost connection with Target"
    2. A broken Arrow
    3. Soon after a Labview Crash.
    This is pretty repeatable and incredibly annoying.
    Anyone else seen similar behavior?
    Any one else have an opinion about Object Methods and re-entrancy?
    LV11sp1
    Kind Regards,
    Tim L.
    iTm - Senior Systems Engineer
    uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT

    I suspect you have some other issue in your code. We extensively use both LVOOP and reentrant methods without any issues. In fact, one of our classes is a communications class which supports serial, parallel, USB, Blue Tooth and TCP interfaces. All of our methods that will not effectively execute immediately such as a methods to set or get an attribute are reentrant.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

Maybe you are looking for

  • How to export a hierarchy or a measure from an aw to another aw ?

    hello , we have 2 environnements test and production . We create a hierarchy on a dimension and we want to export it to the production . In awm , we can only export dimension definition as xml definition but not a hierarchy. We have the same problem

  • When uploading large file from network, all other requests are not being sent to server

    In our application we are facing a weird scenario in which when we try to upload a huge file(600+ MB) from network, all other requests(AJAX) are getting blocked. But when the same file is being uploaded from local location(E drive) then everything wo

  • Need to split tax in payment

    Dear All, When we create AR AP invoice, the journal entry will split by total and tax. However, our client would like to know how much tax the client paid. Is there any report they can know what tax amount the client paid or not paid. They don't want

  • How to set the URL??

    Hello Friends, I am using the Oralce BPEL process manager 10.1.2 . In my BPEL program (in BPEL jdeveloper->BPEL process manager )I have deployed the wsdl of SALESFORCE.COM I had accessed the Login api of salesforce.com and login is sucessful. After t

  • No accpetance SES is appearing PO history

    Hi friends, No accpetance SES is appearing in the PO and also invoice has also been done for the same. What are the reasons for this issue? Tks sujith