Java code to VBA conversion

EML

New member
Local time
Tomorrow, 00:23
Joined
Mar 17, 2012
Messages
3
Hello,
I got a pretty long code written in java and I need to use that algorithms in Excel. I was trying to do that on my own, but I recieved a lot of compile errors. I don't know how to represent few statements :/

Code:
package jobshop;

import java.util.ArrayList;
import java.util.List;

public class JobShop {
    final int N=3, M=3;
    final int MAXINT=100000;
    int[ ][ ] ProcessingTimes;
    int[ ][ ] Order;
    int[ ][ ] Solution;
    int[] MachineReady = new int[M];
    int[] JobReady = new int[N];
   
     private class Phase {
        int job;
        int machine;
        int order;
        public Phase(int job, int machine, int order){
            this.job = job; this.machine = machine; this.order= order;
        }
    }
   
    private int readNfromExcel(){
        return N;
    }
    private int readMfromExcel(){
        return M;
    }
   
    private int[][] loadPhaseOrderFromExcel(){ 
        int [][] A= new int[N][M]; //Job - Machine
        A[0][0]=0; A[0][1]=1; A[0][2]=2;
        A[1][0]=2; A[1][1]=0; A[1][2]=1;
        A[2][0]=0; A[2][1]=1; A[2][2]=2;
        return A;
    }

It's just part of the code, but I think I can handle the rest of it.
What do you think guys? Can you help me, please? I'm not lazy, I'm just a noob in programming.
 
What exactly are you looking for?
 
Here's what I got so far.
Code:
Dim N As Integer: N = 3
Dim M As Integer: M = 3
Dim MAXINT As Integer: MAXINT = 100000
Dim ProcessingTimes()
Dim order()
Dim Solution()
Dim MachineReady(M) As Integer
Dim JobReady(N) As Integer

Private Sub Phase()
Dim job As Integer
Dim machine As Integer
Dim order As Integer
Public Sub Phase(job, machine, order)
    Me.job = job
    Me.machine = machine
    Me.order = order
End Sub

Private Function readNfromExcel() As Integer
    Return N 
End Function
I'm getting compile error in that "return N" line. I don't know if the rest is ok.
 
What exactly are you looking for?
You are programing in java - how do you intend to interact with Excel?
Have you tried looking for an api that let's java talk to Excel?
Have you found any examples of java interacting with Excel?

This is an Access modules forum -- not exactly java or excel.

I did a quick search and found this that may be useful to you.
http://www.ezjcom.com/excel.html
 
This is an Access modules forum -- not exactly java or excel.
I'm sorry. I didn't realize that "access" in access-programming stands for MS Access :o
I just found similar problem in here: showthread.php?t=208661

And I don't need to run java in VBA. I need a full conversion. Thanks anyway for your effort.
 

Users who are viewing this thread

Back
Top Bottom