473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Need help on returning an array

Hi all.

I've encountered a problem here.



public double getValue() {
return phase1.getBoundary(Space3D.BoundaryPeriodicSquare( ,,));
}

public void setValue(double d) {

phase1.setBoundary(new Space3D.BoundaryPeriodicSquare(d,d,d));

diaTextField.setText(toString().valueOf((float)pha se1.getCollisionDiameter()));
display1.repaint();




Please refer to the words in bold. esp, return phase1.getBoundary(Space3D.BoundaryPeriodicSquare( ,,));

the program is not running becuase of this instance.
i know this is because i am trying to get length, breadth and height into the getBoundary.

Should i use double ?

any idea anyone?

thanks a lot in advance
Oct 1 '07 #1
5 1320
r035198x
13,262 8TB
Hi all.

I've encountered a problem here.



public double getValue() {
return phase1.getBoundary(Space3D.BoundaryPeriodicSquare( ,,));
}

public void setValue(double d) {

phase1.setBoundary(new Space3D.BoundaryPeriodicSquare(d,d,d));

diaTextField.setText(toString().valueOf((float)pha se1.getCollisionDiameter()));
display1.repaint();




Please refer to the words in bold. esp, return phase1.getBoundary(Space3D.BoundaryPeriodicSquare( ,,));

the program is not running becuase of this instance.
i know this is because i am trying to get length, breadth and height into the getBoundary.

Should i use double ?

any idea anyone?

thanks a lot in advance
1.) Do not use bold tags for posting code. Use code tags instead.
2.) What are the arguments to the BoundaryPeriodicSquare method in your getValue method?
Oct 1 '07 #2
public static class BoundaryPeriodicSquare extends Boundary implements Space.Boundary.Periodic {
public BoundaryPeriodicSquare() {this(Default.BOX_SIZE,Default.BOX_SIZE,Default.BO X_SIZE);}
public BoundaryPeriodicSquare(Phase p) {this(p,Default.BOX_SIZE,Default.BOX_SIZE,Default. BOX_SIZE);}
public BoundaryPeriodicSquare(Phase p, double lx, double ly, double lz) {super(p);dimensions.x=lx; dimensions.y=ly; dimensions.z=lz; updateDimensions();}
public BoundaryPeriodicSquare(double lx, double ly, double lz) {super();dimensions.x=lx; dimensions.y=ly; dimensions.z=lz; updateDimensions();}
public Space.Boundary.Type type() {return Boundary.PERIODIC_SQUARE;}
private static Space.Tensor zilch = new Tensor();
private final Vector temp = new Vector();
private final Vector dimensions = new Vector();
private final Vector dimensionsCopy = new Vector();
private final Vector dimensionsHalf = new Vector();
public final Space.Vector dimensions() {return dimensionsCopy;}
public Space.Vector randomPosition() {
temp.x = dimensions.x*Simulation.random.nextDouble();
temp.y = dimensions.y*Simulation.random.nextDouble();
temp.z = dimensions.z*Simulation.random.nextDouble();
return temp;
}


Sorry. I hope this is the one you are looking for.

Anyway, i am just confused. How am i supposed to get the parameters into my getValue.

Thanks for your help.

I am sorry if its lengthy.

Raymond
Oct 1 '07 #3
r035198x
13,262 8TB
public static class BoundaryPeriodicSquare extends Boundary implements Space.Boundary.Periodic {
public BoundaryPeriodicSquare() {this(Default.BOX_SIZE,Default.BOX_SIZE,Default.BO X_SIZE);}
public BoundaryPeriodicSquare(Phase p) {this(p,Default.BOX_SIZE,Default.BOX_SIZE,Default. BOX_SIZE);}
public BoundaryPeriodicSquare(Phase p, double lx, double ly, double lz) {super(p);dimensions.x=lx; dimensions.y=ly; dimensions.z=lz; updateDimensions();}
public BoundaryPeriodicSquare(double lx, double ly, double lz) {super();dimensions.x=lx; dimensions.y=ly; dimensions.z=lz; updateDimensions();}
public Space.Boundary.Type type() {return Boundary.PERIODIC_SQUARE;}
private static Space.Tensor zilch = new Tensor();
private final Vector temp = new Vector();
private final Vector dimensions = new Vector();
private final Vector dimensionsCopy = new Vector();
private final Vector dimensionsHalf = new Vector();
public final Space.Vector dimensions() {return dimensionsCopy;}
public Space.Vector randomPosition() {
temp.x = dimensions.x*Simulation.random.nextDouble();
temp.y = dimensions.y*Simulation.random.nextDouble();
temp.z = dimensions.z*Simulation.random.nextDouble();
return temp;
}


Sorry. I hope this is the one you are looking for.

Anyway, i am just confused. How am i supposed to get the parameters into my getValue.

Thanks for your help.

I am sorry if its lengthy.

Raymond
Why did you post all that code anyway. I didn't ask for that. And you did not use code tags again for posting code. It helps to actually read the replies you get if you want get help.
I was asking you what you wanted to achive by this line:
Expand|Select|Wrap|Line Numbers
  1.                  return phase1.getBoundary(Space3D.BoundaryPeriodicSquare(  ,,));
You did not supply any arguments to the BoundaryPeriodicSquare method. All those commas you have in there without the actual parameters is simply invalid Java code and won't compile.
Oct 1 '07 #4
Why did you post all that code anyway. I didn't ask for that. And you did not use code tags again for posting code. It helps to actually read the replies you get if you want get help.
I was asking you what you wanted to achive by this line:
Expand|Select|Wrap|Line Numbers
  1.                  return phase1.getBoundary(Space3D.BoundaryPeriodicSquare(  ,,));
You did not supply any arguments to the BoundaryPeriodicSquare method. All those commas you have in there without the actual parameters is simply invalid Java code and won't compile.

with that line,
Expand|Select|Wrap|Line Numbers
  1.                  return phase1.getBoundary(Space3D.BoundaryPeriodicSquare( ))
  2.  
  3. public void setValue(double d) { 
  4.     phase1.setBoundary(new Space3D.BoundaryPeriodicSquare(d,d,d));
  5.  
  6.      diaTextField.setText(toString().valueOf((float)phase1.getBoundary());
  7.       display1.repaint(); 
actually , my idea was this :

i wish to return value of a 3 by 1 array which i got from setValue, to getValue.
but i dont know how to get the values in . i knew the commas are invalid. and the error that i got from line 1 is : cannot convert to double.

Thanks a lot.
Oct 1 '07 #5
r035198x
13,262 8TB
with that line,
Expand|Select|Wrap|Line Numbers
  1.                  return phase1.getBoundary(Space3D.BoundaryPeriodicSquare( ))
  2.  
  3. public void setValue(double d) { 
  4.     phase1.setBoundary(new Space3D.BoundaryPeriodicSquare(d,d,d));
  5.  
  6.      diaTextField.setText(toString().valueOf((float)phase1.getBoundary());
  7.       display1.repaint(); 
actually , my idea was this :

i wish to return value of a 3 by 1 array which i got from setValue, to getValue.
but i dont know how to get the values in . i knew the commas are invalid. and the error that i got from line 1 is : cannot convert to double.

Thanks a lot.
Hold on. You are no longer making much sense.

That setValue method does not return anything. It's return type is void.
Now if you could answer these two questions:
1.) What return type is the getBoundary method?
2.) What parameters does the Space3D.BoundaryPeriodicSquare method expect?
Oct 1 '07 #6

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

Similar topics

2
by: lawrence | last post by:
I've been bad about documentation so far but I'm going to try to be better. I've mostly worked alone so I'm the only one, so far, who's suffered from my bad habits. But I'd like other programmers...
6
by: Krackers | last post by:
How do you write a function which returns a reference to an array. I can only get a function to return a copy of the array itself. I've had a look at some other threads in this group an the return...
5
by: Gent | last post by:
I have two questions which are very similar: Is it possible to return an object in C++. Below is part of my code for reference however I am more concerned about the concept. It seems like the...
3
by: Faustino Dina | last post by:
Hi, The following code is from an article published in Informit.com at http://www.informit.com/guides/content.asp?g=dotnet&seqNum=142. The problem is the author says it is not a good idea to...
8
by: Mike Nolan | last post by:
As far as I can tell, Postgres has no equivalent to greatest and least functions in Oracle. Yes, you can do the same thing with a case statement, but at the expense of writing MUCH longer SQL...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
11
by: jza | last post by:
Hello all, I am fairly new to c, coming from a Java background. I am working on a mathematical program and I have a function that needs to return a 2-d array. After some web searching, I have...
0
by: anuptosh | last post by:
Hi, I have been trying to run the below example to get a Oracle Array as an output from a Java code. This is an example I have found on the web. But, the expected result is that the code should...
5
by: ctj951 | last post by:
I have a very specific question about a language issue that I was hoping to get an answer to. If you allocate a structure that contains an array as a local variable inside a function and return...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.