Algorithm-VSM

 view release on metacpan or  search on metacpan

examples/corpus/Animator.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.8  Java Threads For Applets
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/EventThreadDemo.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.9  The Event Dispatch Thread In AWT/Swing
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/EventThreadDemo.java  view on Meta::CPAN

        public void removeUpdate(DocumentEvent e) { }
        public void changedUpdate(DocumentEvent e) { }
    }

    public static void keepBusy( int howLong, String source  ) {  
        if (SwingUtilities.isEventDispatchThread() == true )      //(C)
            System.out.println(                                   //(D)
             " using Event Dispatch Thread for keepBusy in " + source); 
        else 
            System.out.println(                                   //(E)
              "   using the main thread for keepBusy in " + source );
        long curr = System.currentTimeMillis();
        while ( System.currentTimeMillis() < curr + howLong )
            ;
    }
}

examples/corpus/EventThreadDemo2.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.9  The Event Dispatch Thread In AWT/Swing
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/EventThreadDemo2.java  view on Meta::CPAN

        MyTools.printThreadInfo("Just after calling setVisible:");//(K)     
    }
}

///////////////////////////  class MyTools  ///////////////////////////
class MyTools {                                                   //(L)
    public static void printThreadInfo( String s ) {              //(M)
        System.out.println( s );
//        Thread.currentThread().getThreadGroup().list();
//        System.out.println( 
//          "Number of threads in the current thread group: "
//          + Thread.currentThread().getThreadGroup().activeCount() );
        System.out.println( "The current thread is: " 
                          + Thread.currentThread() );
    }

    public static void keepBusy( int howLong ) {                  //(N)
        long curr = System.currentTimeMillis();
        while ( System.currentTimeMillis() < curr + howLong )
            ;
    }
}

examples/corpus/InterThreadIO.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.7  Data I/O Between Threads In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/MultiCustomerAccount.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.6  Java's wait-notify Mechanism For Dealing With Deadlock
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/SynchedFileIO.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.5  Thread Synchronization In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/SynchedFileIO.java  view on Meta::CPAN

            FileIO.writeOneString( str  , "hello.dat" );
        } catch( FileIOException e ) {}
    }
}


////////////////////////  class ThreadedFileIO  ///////////////////////
class ThreadedFileIO extends Thread  {
    DataFile df;

    ThreadedFileIO( String threadName, DataFile d ) {
        df = d;
        setName( threadName );
        start();
    }
    public void run( ) {
        int i = 0;
        while ( i++ < 4 ) {
            try {
                df.fileIO();
                String str = FileIO.readOneString( "hello.dat" );        
                System.out.println( getName() + ":     "  
                           +  "hello.dat contains: " + str ); 

examples/corpus/SynchedSwaps.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.5  Thread Synchronization In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/ThreadsBasic.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.1  creating And Executing Simple Threads In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/ThreadsBasicWithJoin.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.1  Creating And Executing Simple Threads In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/ThreadsBasicWithRunnable.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.2  The Runnable Interface In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/UnsynchedFileIO.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.4  Thread Interference In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus/UnsynchedFileIO.java  view on Meta::CPAN

            FileIO.writeOneString( str  , "hello.dat" );         //(C3)
        } catch( FileIOException e ) {}
    }
}


///////////////////////  class ThreadedFileIO  ////////////////////////
class ThreadedFileIO extends Thread  {                            //(D)
    DataFile df;                                                  //(E)

    ThreadedFileIO( String threadName, DataFile d ) {             //(F)
        df = d;
        setName( threadName );
        start();
    }
    public void run( ) {                                          //(G)
        int i = 0;
        while ( i++ < 4 ) {
            try {
                df.fileIO();
                String str = FileIO.readOneString( "hello.dat" );        
                System.out.println( getName() + ":     "  
                           +  "hello.dat contains: " + str ); 

examples/corpus/UnsynchedSwaps.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.4  Thread Interference In Java 
//

//UnsynchedSwaps.java

/////////////////////////  class DataObject  //////////////////////////
class DataObject {                                         
    int dataItem1;
    int dataItem2;

examples/corpus_with_java_and_cpp/Animator.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.8  Java Threads For Applets
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/EventThreadDemo.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.9  The Event Dispatch Thread In AWT/Swing
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/EventThreadDemo.java  view on Meta::CPAN

        public void removeUpdate(DocumentEvent e) { }
        public void changedUpdate(DocumentEvent e) { }
    }

    public static void keepBusy( int howLong, String source  ) {  
        if (SwingUtilities.isEventDispatchThread() == true )      //(C)
            System.out.println(                                   //(D)
             " using Event Dispatch Thread for keepBusy in " + source); 
        else 
            System.out.println(                                   //(E)
              "   using the main thread for keepBusy in " + source );
        long curr = System.currentTimeMillis();
        while ( System.currentTimeMillis() < curr + howLong )
            ;
    }
}

examples/corpus_with_java_and_cpp/EventThreadDemo2.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.9  The Event Dispatch Thread In AWT/Swing
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/EventThreadDemo2.java  view on Meta::CPAN

        MyTools.printThreadInfo("Just after calling setVisible:");//(K)     
    }
}

///////////////////////////  class MyTools  ///////////////////////////
class MyTools {                                                   //(L)
    public static void printThreadInfo( String s ) {              //(M)
        System.out.println( s );
//        Thread.currentThread().getThreadGroup().list();
//        System.out.println( 
//          "Number of threads in the current thread group: "
//          + Thread.currentThread().getThreadGroup().activeCount() );
        System.out.println( "The current thread is: " 
                          + Thread.currentThread() );
    }

    public static void keepBusy( int howLong ) {                  //(N)
        long curr = System.currentTimeMillis();
        while ( System.currentTimeMillis() < curr + howLong )
            ;
    }
}

examples/corpus_with_java_and_cpp/HelloThreadWithJoin.cc  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.11  Object-Oriented Multithreading In C++
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com
//



//HelloThreadWithJoin.cc

#include <qthread.h>
#include <string>
#include <iostream>
using namespace std;


class HelloThread : public QThread {
    string message;
public:
    HelloThread( string message ) { this->message = message; }
    void run() { cout << message; }

examples/corpus_with_java_and_cpp/InterThreadIO.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.7  Data I/O Between Threads In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/MultiCustomerAccount.cc  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.11  Object-Oriented Multithreading In C++
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com
//



//MultiCustomerAccount.cc

#include <qthread.h>
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;

void keepBusy( double howLongInMillisec );

QMutex mutex;
QWaitCondition cond;

examples/corpus_with_java_and_cpp/MultiCustomerAccount.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.6  Java's wait-notify Mechanism For Dealing With Deadlock
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/SynchedFileIO.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.5  Thread Synchronization In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/SynchedFileIO.java  view on Meta::CPAN

            FileIO.writeOneString( str  , "hello.dat" );
        } catch( FileIOException e ) {}
    }
}


////////////////////////  class ThreadedFileIO  ///////////////////////
class ThreadedFileIO extends Thread  {
    DataFile df;

    ThreadedFileIO( String threadName, DataFile d ) {
        df = d;
        setName( threadName );
        start();
    }
    public void run( ) {
        int i = 0;
        while ( i++ < 4 ) {
            try {
                df.fileIO();
                String str = FileIO.readOneString( "hello.dat" );        
                System.out.println( getName() + ":     "  
                           +  "hello.dat contains: " + str ); 

examples/corpus_with_java_and_cpp/SynchedSwaps.cc  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.11  Object-Oriented Multithreading In C++
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com
//



//SynchedSwaps.cc

#include <qthread.h>
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;

void keepBusy( double howLongInMillisec );

class DataObject : public QThread {
    QMutex mutex;
    int dataItem1;

examples/corpus_with_java_and_cpp/SynchedSwaps.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.5  Thread Synchronization In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/ThreadsBasic.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.1  creating And Executing Simple Threads In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/ThreadsBasicWithJoin.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.1  Creating And Executing Simple Threads In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/ThreadsBasicWithRunnable.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.2  The Runnable Interface In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/UnsynchedFileIO.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.4  Thread Interference In Java
//
// The links to the rest of the code in this book are at
//     
//      http://programming-with-objects.com/pwocode.html
//
// For further information regarding the book, please visit
//
//      http://programming-with-objects.com

examples/corpus_with_java_and_cpp/UnsynchedFileIO.java  view on Meta::CPAN

            FileIO.writeOneString( str  , "hello.dat" );         //(C3)
        } catch( FileIOException e ) {}
    }
}


///////////////////////  class ThreadedFileIO  ////////////////////////
class ThreadedFileIO extends Thread  {                            //(D)
    DataFile df;                                                  //(E)

    ThreadedFileIO( String threadName, DataFile d ) {             //(F)
        df = d;
        setName( threadName );
        start();
    }
    public void run( ) {                                          //(G)
        int i = 0;
        while ( i++ < 4 ) {
            try {
                df.fileIO();
                String str = FileIO.readOneString( "hello.dat" );        
                System.out.println( getName() + ":     "  
                           +  "hello.dat contains: " + str ); 

examples/corpus_with_java_and_cpp/UnsynchedSwaps.java  view on Meta::CPAN

// This code example is from the following source:
//
// Book Title:  Programming with Objects, A Comparative Presentation
//              of Object-Oriented Programming with C++ and Java
//
// Chapter:     Chapter 18  Multithreaded Object-Oriented Programming
//
// Section:     Section 18.4  Thread Interference In Java 
//

//UnsynchedSwaps.java

/////////////////////////  class DataObject  //////////////////////////
class DataObject {                                         
    int dataItem1;
    int dataItem2;

examples/test_queries.txt  view on Meta::CPAN

q3:  string getAllChars throw IOException distinct TreeMap histogram map

q4:  Cloneable CloneNotSupportedException xobj_clone array random printstring

q5:  getName user maryjo jojo StudentUser user derived base invoke

q6:  swing actionPerformed closeButton startButton windowClosing greetingButton

q7:  pane MyTextPanel jpanel insertUpdate

q8:  threading ThreadFileIO extends datafile readOneString InterruptedException

q9:  synchronized withdraw balance Withdrawer random Math Account Depositor

q10: ChatServer ServerSocket exception clientHandler clientList ArrayList

q11: ListIterator InputStreamReader getOutputStream exception flush 

q12: newInstance driver executeQuery insert executeQuery resultSetMetaData 

q13: autocommit drop table friends sportsclub primary sport getString



( run in 0.873 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )