home *** CD-ROM | disk | FTP | other *** search
- Save Format v2.3(19971110)
- @begin ClassFile "CounterThread"
-
- @begin Object "Powersoft Java AWT 1.02::powersoft.painter.Class"
- DesignName CounterThread;
- @begin ClassProperties
- Exported 1;
- @begin-code BaseClassList
-
- extends Thread
-
- @end-code;
- @begin CPMethod "CounterThread"
- @begin CPPrototype "Prototype for CounterThreadMethod"
- @begin-code SourceCode "Prototype for CounterThreadMethod"
-
- // Not used for Java classes
-
- @end-code;
- @end;
- @begin CPDefinition "CounterThreadMethod"
- @begin-code SourceCode "CounterThreadMethod"
-
- //
- // CounterThreadMethod
- //
-
- public CounterThread(Form_Threads parent, int threadNumber)
- {
- // constructor for CounterThread class
- _parent = parent;
- _threadNumber = threadNumber;
- }
-
- @end-code;
- @end;
- @end;
- @begin CPMethod "run"
- @begin CPPrototype "Prototype for runMethod"
- @begin-code SourceCode "Prototype for runMethod"
-
- // Not used for Java classes
-
- @end-code;
- @end;
- @begin CPDefinition "runMethod"
- @begin-code SourceCode "runMethod"
-
- //
- // runMethod
- //
-
- public void run()
- {
- // run method for thread
- while (true)
- {
- _counter = _counter + 1;
- if (_counter > 1000)
- _counter = 0;
- synchronized (this)
- {
- _parent.updateCounter(_threadNumber, _counter);
- }
- }
-
- }
-
- @end-code;
- @end;
- @end;
- @end;
- @begin CodeBlocks
- @begin CodeBlock "HppPrefix"
- FunctionScope 1;
- @begin-code SourceCode "Imports()"
-
- // add your custom import statements here
-
-
- // This class constructs the counting threads.
- // Each thread counts to 1000 and then resets to 0.
-
- @end-code;
- @end;
- @begin CodeBlock "ClassContents"
- FunctionScope 1;
- @begin-code SourceCode "Data Members()"
-
- // add your data members here
- private Form_Threads _parent;
- private int _threadNumber;
- private int _counter = 0;
-
- @end-code;
- @end;
- @begin CodeBlock "GeneratedClassContents"
- FunctionScope 1;
- @begin-code SourceCode "GeneratedClassContents()"
-
-
- @end-code;
- @end;
- @begin CodeBlock "CppPrefix"
- FunctionScope 1;
- @begin-code SourceCode "()"
-
-
- @end-code;
- @end;
- @end;
- @end;
- @end;
-