Conversation
|
This is files of Random class implementation in txtUml |
There was a problem hiding this comment.
I think you have misunderstood the task a little. You have to write a wrapper class for the original Java class. So you need an instance of the Java object and simply call the same methods on it. For example:
public class RandomImplementation implements Random {
java.util.Random instance = new java.util.Random();
// ...
@Override
public int nextInt() {
return instance.nextInt();
}
// ...
}txtUML supports double so you can add nextDouble(), nextGaussian() and next(int bits).
You use Javadoc comments the wrong way. Java doc comments start wit /** and they are before the corresponding function. For example:
/**
* This is the Javadoc for function foo. You can see it
* when you hover the cursor on the function's name
* in several IDE's and is very informative.
*
* @param bar description of the parameter bar
* @return description of the return value
* @throws some exception may be thrown
*/
public int foo(int bar);See my other comments below.
| @@ -0,0 +1,76 @@ | |||
| package hu.elte.txtuml.stdlib.math; | |||
There was a problem hiding this comment.
Package name is wrong. The Java Random class is in the java.util package.
| * The algorithms implemented by class Random use a protected utility method that on each invocation can supply | ||
| * up to 32 pseudorandomly generated bits. | ||
| */ | ||
| public interface RandomInterface extends ExternalClass { |
There was a problem hiding this comment.
The name of the interface should be Random.
| * The general contract of nextInt is that one int value is pseudorandomly generated and returned. All 232 | ||
| * possible int values are produced with (approximately) equal probability. | ||
| */ | ||
| public int nextLong(); |
There was a problem hiding this comment.
Type long is currently not supported by txtUML. This function can be omitted.
| @@ -0,0 +1,44 @@ | |||
| package hu.elte.txtuml.stdlib.math; | |||
There was a problem hiding this comment.
Correct the package name here as well.
No description provided.