473,804 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what package to import when there is board?

50 New Member
hi all,
i'm trying out some examples on java..and i found this code where there is board and i cant find out what package to import to make this work, im getting error where there is "board"..
i have tried out the following but none worked:
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.applet.App let;

plz help


Expand|Select|Wrap|Line Numbers
  1. import java.util.concurrent.CyclicBarrier;
  2.  
  3. public class CellularAutomata {
  4. private final Board mainBoard;
  5. private final CyclicBarrier barrier;
  6. private final Worker[] workers;
  7.  
  8. public CellularAutomata(Board board) {
  9.     this.mainBoard = board;
  10.  
  11.     int count = Runtime.getRuntime().availableProcessors();
  12.  
  13.     this.barrier = new CyclicBarrier(count, new Runnable() 
  14.     { // barrier action
  15.         public void run(){mainBoard.commitNewValues();
  16.         }
  17.         }
  18.     );
  19.     this.workers = new Worker[count];
  20.  
  21.     for (int i = 0; i < count; i++)
  22.         workers[i] = new Worker(mainBoard.getSubBoard(count, i));
  23.     } // constructor
  24.  
  25.     public void start() {
  26.         for (int i = 0; i < workers.length; i++)     
  27.             new Thread(workers[i]).start();
  28.         mainBoard.waitForConvergence();
  29. } // start()
  30. } // CellularAutomata
  31.  
  32.  
  33. class Worker implements Runnable {
  34.  
  35.     private final Board board;
  36.  
  37.     public Worker(Board board) { 
  38.         this.board = board; 
  39.         }
  40.  
  41.     public void run() {
  42.         while (!board.hasConverged()) {
  43.             for (int x = 0; x < board.getMaxX(); x++)
  44.                 for (int y = 0; y < board.getMaxY(); y++)
  45.                     board.setNewValue(x, y, computeValue(x, y));
  46.             try { barrier.await(); 
  47.             }
  48.             catch (InterruptedException ex) { return; }
  49.             catch (BrokenBarrierException ex) { return; }
  50.         } // while
  51.     } // run()
  52.  
  53.     private int computeValue(int x, int y) {
  54. // Compute the new value that goes in (x,y)
  55.  
  56. }
  57. } // Worker
  58.  
Jan 20 '09 #1
1 2056
JosAH
11,448 Recognized Expert MVP
Board is certainly not a class that comes with your JSE distribution. I suggest you'd read that example again, maybe it's one of their classes and they have shown the source of that class.

kind regards,

Jos
Jan 20 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

54
6587
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO FRICKIN' COOL!!! ***MAN*** that would save me a buttload of work and make my life sooooo much easier!" As opposed to minor differences of this feature here, that feature there. Variations on style are of no interest to me. I'm coming at this from a...
2
1697
by: Skip Montanaro | last post by:
At work we have a package structure for our homegrown code. Developers each have their own sandboxes where they work on the stuff they are responsible for (mixtures of C++ libraries, SWIG wrappers and pure Python packages). We're running into a problem where we have two versions of the main package, one in the developer's sandbox that contains just the developer's bits and one in the central location which contains all the installed stuff....
0
1024
by: C. Barnes | last post by:
OK, here's the setup: package/ __init__.py X.py python/lib/ X.py Now inside package, we want to import the copy
4
1561
by: flupke | last post by:
Hi, I developed a package with a structure like this src/ tesfile.py dir1/ __init__.py file1.py dir2/ __init__.py
2
8106
by: kkrizl | last post by:
I have an Access database that has a few huge tables. It was taking about 20 minutes per table to import them from another application. I used the upsize wizard to put them in a SQL server database. I created a DTS package to import the files and it runs in less than 5 minutes. I'd like to change my macro that used transfer text to import my files to run my DTS package. I've seen several posts regarding this, but I don't understand...
4
3640
by: Kunle Odutola | last post by:
I'm trying to understand where the information in the META.INF directory including MANIFEST.MF etc is to be found for .NET assemblies. Also some projects such as Eclipse's OSGi kernel stores additional info in the MANIFEST.MF file. What would be the .NET equivalent where such info can be stored? Kunle --
11
3869
by: fortepianissimo | last post by:
Say I have the following package organization in a system I'm developing: A |----B |----C |----D I have a module, say 'foo', that both package D and B require. What is the best practice in terms of creating a 'common' package that hosts
4
1837
by: Martin Blais | last post by:
Hi I'm a tad confused over a problem involving cycles between packages. Assume the following sets of files:: driver.py a/__init__.py a/alice.py
0
1073
by: Roger Ineichen | last post by:
Hi Tim For a usecase like this, I personaly recommend to defina all interfaces in one module which probably is a namespace if you need alot of interfaces to define. e.g. openehr.interfaces.foobar.IFooBar
0
9714
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10350
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10351
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6866
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.