Java Simulation Library

Mar 12, 2014

I am trying to work on a project that involves Java Simulation Library, the imported library jslCode.jar cant be found ...

package jslx.forecasting.demandgeneration;
import jsl.utilities.random.distributions.Binomial;
import jsl.utilities.random.distributions.Constant;
import jsl.utilities.random.distributions.Exponential;
import jsl.utilities.random.GetValueIfc;

[Code] ....

View Replies


ADVERTISEMENT

SSO Kerberos Simulation In Java

Apr 20, 2014

I'd like to learn more in Java security, namly Kerberos and SSO. The question is weather I have too weak laptop. I have 8 GB ram. How many virtualbox instances od I have to run in order to JAAS, SSO kerberos demo to simulate. For instance VM with Windows 2008 Server -> 3 GB RAM, Centos VM -> 1GB. Is 8 GB RAM in my laptop not too little?

BTW

I do not have yet experience in SSO/Kreberos but I want to know what to do in order to simulate and exercise.

View Replies View Related

Stardict Java Library

Jun 16, 2014

I have stardict files and i want to use it in java. what is the library to use in java?

View Replies View Related

Implementing A Java Class Library?

Apr 18, 2014

i have been given a homework assignment where I have to get rid of a stack object I wrote for a program and replace it with the Stack<E> library java offers ie:

public class Stack<E> extends Vector<E> {
public Stack(); // constructor
public Boolean empty();
public E peek();
public E pop();
public E push(E item);
}

my question is do i have to actually write all these methods? Or can i just construct a stack and use the methods?

View Replies View Related

Packaging Custom Library In Java Program

Jan 29, 2014

I have a custom library I made to make things easier for myself. I used it in a small program in NetBeans and it works fine. When I try to clean and build, it says it can't find the methods from my Library class. How do I get the library packaged into the jar?

View Replies View Related

JCreator - Error In Java Library System

Oct 8, 2014

I search this source code in google about library system then i run this in my JCreator then that error appear . I think that problem is all about "main". where can i put that main ?

View Replies View Related

Cannot Run Java Program That Is Using External Library From Command Line

Mar 30, 2015

I am reading the excellent book Algorithms. The author of this book is using his own libraries.

I have downloaded the libraries (it is a file called stdlib.jar) and I've store it in a directory called ~/Downloads(I am using a macbook pro).

Then I have created a project with IntelliJ Idea 14.1 using the default package (as it is the only way for a program to 'see' these libraries).

The program is running inside the ide, but because of the nature of this book, all the included code must be run from the command line.

The problem is that I cannot run for example the Average class from the command line because the system asks for the external library.

Specifically the error is :

I enter : java -cp . Average

and the Error I get is :

Exception in thread "main" java.lang.NoClassDefFoundError: StdIn
at Average.main(Average.java:11)
Caused by: java.lang.ClassNotFoundException: StdIn
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)

[Code] ....

The Average class is the following :

public class Average {
public static void main(String[] args) {
//Average the numbers on StdIn
double sum = 0.0;
int cnt = 0;

[Code] .....

View Replies View Related

JSP :: Sending Variable Set In Java Tag Library Definition To File

Jun 29, 2014

I am working on some enhancement on application. I have a requirement. The flow is as below

In a jsp file one selection dropdown exists and a body. Selection dropdown is written as custom tag library and is included in jsp file eg tag.tld whose code exists in tag.java code for other parts of jsp are written in that *.jsp file itself. eg test.jsp

i.e test.jsp calls tag.tld to include selection dropdown

I now want a hashmap created in tag.java to be available in jsp file and I want to use it in one of the javascript function available in same jsp file for validation

How can I achieve this....

View Replies View Related

Java Library Function That Searches Stream Of Tcp Packets

Apr 28, 2014

i need a java library function that searches the stream of tcp packets coming to my computer from a particular ip address, so i can perform regular expressions on the contents of those packets.

View Replies View Related

JTabbedPane Tab Click Simulation

Mar 31, 2015

Is it possible to programmatically simulate a click event on a tab (JTabbedPane) to trigger its changeListener once a button is clicked ?

View Replies View Related

Simulation - Two Cars Are Going To Race Against Each Other

Oct 22, 2014

I was thinking to make a game where two cars are going to race against each other. I already have two gif pictures which are the cars. I do now have a background and a racer track. So we can start from here.

I have made a object with construction which I called Racers. Inside that, i wrote a PaintWindow (Where the window and much more is inside), -car1, -car2. All these is private. So I made something like this now:

package p2;
public class Race {
private Object window;
private Car car1;
private Car car2;
public Race(PaintWindow window, Car c1, Car c2) {

[Code] .....

But the problem is now that im kinda lost and I dont really know what to write anymore. How can I get a for example a green background on the whole PaintWindow with two Racers tracks and inside the racers tracks (Each car have each track) does it have to be cars. So I need to somehow import the cars inside it too. But thats the problem I need. that I dont really know what more to do. To make it easier, I have a Main-method in another class.

public static void main(String[] args) {
PaintWindow window = new PaintWindow();
Car c1 = new Car(new ImageIcon("C:/Users/Sarah/Desktop/CarBlue.GIF"));
Car c2 = new Car(new ImageIcon("C:Users/Sarah/Desktop/CarRed.GIF"));
Race race = new Race(window,c1,c2);
race.action();
if(args.length>0) {
Paintwindow.pause(2000);
window.dispose();

View Replies View Related

Print Queue Using Priority Q Simulation?

Nov 28, 2014

I have a class "ExecuteJob" which has Print Q in the form of Priority Q.

You can keep adding job to the Q by calling one of the method in the class. However, and object cant do things simultaneity can it? While im adding a new job to the print queue, can it be executing and existing job in the print Q.

To achieve that, I would need to implement process and threads? I believe am I right? So that adding a job is independent to being removed?

View Replies View Related

Front End For Air Traffic Control Simulation?

Apr 1, 2014

I'm a student designing and developing an Air Traffic Control (ATC) system for incoming aircraft, mainly implementing the part which handles the queuing system for approaching aircraft.

View Replies View Related

CallNumber Method For Bingo Simulation

May 26, 2014

As you may have known, I'm creating a Bingo simulator from scratch.

Precondition: an n amount of randomly generated cards are created.

Postcondition: After a number is called, cards that has that number will have its value be true.

For example:

Precondition

Java Code:

Card 1 //Name of card

1 24 32 48 63
2 22 41 51 64
3 16 37 52 61
4 19 33 57 72
5 20 34 54 71 //Card with numbers

false false false false false
false false false false false
false false false false false
false false false false false
false false false false false //Card with boolean values to indicate marked values

[Code] .....

So what I want to do is have a method that allows me to use the callRandomNumber method so that the matrix location with that random value is marked true for all of the boards.

View Replies View Related

Traffic Light Simulation Using Multithreading

Feb 2, 2015

I am writing a simple program to simulate a traffic light. What I want is to make them glow after each 1 second, one by one. For example: Firstly Red, then after 10 seconds, red will be put to off and yellow will start glowing and then accordingly green. This process shall continue incessantly (Just for experimental purpose). I have some arrangement done but could not figure out how to put them together in run() method of Runnable interface. I know how interthread communication works. But could not find any logic in this case when three threads will run together.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class TrafficLight extends JFrame implements Runnable
{
JButton red, green, yellow ;
TrafficLight()

[Code] .....

View Replies View Related

Simple 2D Optics Simulation Program

Sep 13, 2014

I'm very new to Java (I literally started learning it yesterday) and I've been working on a simple program that's meant to simulate interactions between optics objects and light rays.

Everything has been going really well, except that my mirrors only reflect the first ray that comes in contact with them.

Here's a screenshot : 2014-09-13 at 7.39.23 PM.jpg

I wrote 7 classes:

Main class to create the optics objectOptics class. the most important class that uses a recursive function to detect the nearest intersection point of a ray with the nearest optics object. It then calculates a reflected ray and inputs it back into the function until no intersections are found or the max recursion depth is met.Ray. creates a rays (in parametric form O + tD where O is the origin, D is the direction and t is a non-negative scalar)Object. empty abstract class used for polymorphism (so when i add more optics objects like prisms and lenses they'll share the object type)Mirror. Basically a line segment created with the Line classLine. Creates a line segmentDraw. JComponent with paintComponent function that loops through an array of shapes and draws them to the screen.

What I know so far is that the problem boils down to the checkRay() function in the Optics class. When a mirror has already reflected a ray, the line:

Intersection sec = new Intersection(ray,(Mirror)obj);

creates an intersection with a null point.

I debugged it line by line and found the problem was that my variable 't' (that is the parameter for the parametric line which represents the mirror) in the Intersection class got big values when it's meant to be between 0 and 1 (since it's a line segment), which resulted in the function returning null (as it should when 't' is not between 0 and 1).

I've confirmed with tests that this has nothing to do with the specific mirror or angle of incidence. It only occurs when a mirror has already been intersected with by a ray.

I've found out that my function:

public PVector getNormal(PVector D){
D.normalize();
return new PVector(D.y,-D.x);
}

Changes the value of the 'D' PVector of the mirror inside my 'objects' ArrayList. How can it access the private PVector 'D' from outside the Mirror class? This normalization to the direction vector is what causes the Intersection class to return null the second time around!

The problem was that in the getNormal function, the input vector argument was a reference to the 'D' vector for the mirror in my 'objects' ArrayList so the .normalize() function acted upon the original vector, changing it's value and screwing things up. The two classes I talked about:

Optics: (note line 64. this line returns a null intersection when it shouldn't)

package ofer.davidson;
 import java.util.ArrayList;
 public class Optics {
 //Arrays to store all the optics objects and rays that are created
ArrayList<Object> objects;
ArrayList<Ray> rays;
 
[Code] .....

Also why doesn't my background turn white??

View Replies View Related

Elevator Simulation In Event Time Not Clock

Apr 10, 2014

I am making a elevator simulator for my class. It needs to be "event time". I am having trouble understanding how I can make an "event time" simulator. Initially I was using a while loop to run a clock time simulation of x seconds for each event, until I ran into a concrete wall and had to call another method which took X seconds, while still needing to execute code.

An example of what I did is:

Spawn person -> person.goToElevator (Takes x seconds) - > person.waitForElevator (Until elevator arrives, x seconds). While this is happening, I needed to create another person and do the same thing, this will add another to the queue if the first person is still waiting. Etc etc, you get the point.

We have not learnt about multi threading, that is the next assignment.

Here is a quote from my lecturer:

"That's right, it requires multi-threading which we're not doing in this paper. Here's a solution that can work:

The person waiting for the lift and then doing lots of other things should do all that in a fraction of a second. So, you don't let the person really wait. Instead, you will set a timestamp in the future in the person object that "he's busy till that time". In all other steps in your simulation you will first check if a person is "busy" (i.e. has a timestamp in the future). If so, you can't use this object, otherwise, you can.

How does it create a bigger queue? Outputs I would have in my final simulation would be, averageQueueLength, numOfPeopleInBuilding etc.

View Replies View Related

Create 2D Game That Has Realistic Space Simulation

Jul 31, 2014

I am attempting to create a 2d game that has a realistic space simulation. The map is supposed to be set so that you are looking from the top down. The problem I am having exists in my interaction between the sun and a planet. Simply put, the planet will only move in a single diagonal direction without ever changing direction. The formulas I am using are F=(G*M1*M2)/D^2 and A=F/M. The code below is simplified.

(inside planet Class)
double x;
double y;
double mass;
double xForce;
double yForce;
double xAccel;
double yAccel;

[Code] ....

Things I have already tried:
1. Setting G to negative
2. changing the order of the subtraction in determining D
3. some weird pythagorean theorem thing someone suggested

View Replies View Related

FIFO Queue - Waiting Line Simulation

Jan 22, 2015

how to setup a program that simulates the progression of a line over time.The scenario involves a bank and 5 tellers. There is one line of customers that starts off with an initial length of 20. Every minute, 10 more customers are added to the line. As this is meant to be a FIFO queue the first 11 customers in the line will be distrusted among the 5 bank tellers as follows: Teller #1 will process 1 customer per minute, Teller #2 and #3 can each process 2 customers per minute, and Teller #4 and #5 can each process 3 customers per minute. Therefore, the first 11 customers in line will be processed within the first minute of the programs execution.

Unfortunately, I am not sure how to attack this thing. I am thinking that I need to setup a queue for the initial 20 customers and an array for the 10 customers that will be joining the line every minute. However, I am not sure how I can set this up to work automatically.

View Replies View Related

Bank Account Simulation - ResultsModel Cannot Resolve To A Type

Mar 12, 2015

I have serious errors. I am trying to design a Bank Account Simulation. My various codes are as below.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.io.*;
public class Display2 extends JFrame //implements ActionListener

[Code] ....

ERROR: ResultsModel cannot be resolved to a type

View Replies View Related

Swing/AWT/SWT :: Traffic Simulation - Applet Not Initialized Error

Mar 25, 2006

I have a traffic simulation code that is producing a start:applet not initialized error each time i run it. This is the code

import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.awt.*;
import java.applet.Applet;
import java.lang.Thread;
class Node {

[Code] ....

View Replies View Related

Simulation On Assembly Code Level By Writing A Mini-compiler

Sep 28, 2014

I need to do a simulation on the assembly code level by writing a mini-compiler for each ISA, i.e., 4, 3, 2-Address Architecture, Accumulator Architecture, Stack Architecture, and Load-Store Architecture.The input to the simulator is a segment of C program:The basic sample segments of C code are:

1. A = (B + C) * D - E;

2. F = (G + H) - (I + J);

3. G = H + A[I];

4. If (I == J) F = G + H;

Else F = G - H;

5. Loop: G = G + A[I];

I = I + J;

If (I != H) Goto Loop;

6. If (G < H) Goto Less;

7. While (save[I] == K)

I = I + J;

View Replies View Related

ANTLR Class Library In Java Class

Sep 13, 2014

I am working on a calculator for Android.To make sure the application I am developing works with multiple operations (in the correct order) I decided to use ANTLR as part of my Java coding of the calculator. So in a separate file (.g4 file), I must declare the format of the expression.

E.G.

grammar Expr;
prog:(expr NEWLINE)* ;
expr:expr ('*'|'/') expr
|expr ('+'|'-') expr
|INT
|'(' expr ')'
;
NEWLINE : [
]+ ;
INT : [0-9]+ ;

After which I need to include the ANTLR class library in my Java Class. Then I believe I need to call a set of functions such as createLexerInterpreter and createParserInterpreter, but I am not sure. I will be having an algorithm string that will need to be parsed, such as " 3+4*5+8*9+(5/6) ".

View Replies View Related

N-body Simulation - Forces For Body Not Calculating In Some Instances?

Mar 13, 2015

I am making a n-body simulation. For some reason, when I have two bodies orbiting each other and I add a third body, the two initial bodies stop orbiting each other.

EXAMPLE:

[URL]- earth is orbiting the sun, when I add mars,[URL] earth AND mars does not orbit the sun and both travel in a straight line. Almost as the forces are not being computed at all on the body. How can this be?

Here is the relevant code:
 
public void update(float deltaTime){
for(int i=0; i<bodies.size();i++){
resetForces(); 
bodies.get(i).update((float)(deltaTime / Math.pow(10,9))*timeScale);
lastTime = System.nanoTime();
//sets the forces for all bodies
for(int n=0; n<bodies.size();n++){

[code]....

View Replies View Related

Import All Library Within Directory

Sep 1, 2014

I see you can import in 2 ways:

import java.util.*;

or

import java.util.Scanner/Random/etc;

if I used the first one it imports all the librarys within that (directory?). If so would that add to a bigger file size?

View Replies View Related

How To Access Webcam Without A Library

Feb 13, 2015

how to access the webcam without a library

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved