comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]
Today's topics:
* simple IF question if (newplayer == goalkeeper) {throw error} - 11 messages,
5 authors
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f48598d0a1b3fad3
* Append one array to another array - 3 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20154155911aad9d
* clone - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/499165c53fb19987
* Homework - Was Re: java programe help - 2 messages, 2 authors
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8fddd0a49ac12937
* How can i block java web start from downloading jre .. but still launch app - 1
messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/650db0305c405eb3
* rules engines: faster implementation than methods invocations? - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fe7838a641d72733
* Enums in inner classes - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7ecb6f0754c4b0df
* Eclipse Help trouble - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a1e9234ad1090cc0
* Forwarding search criteria from the view - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/24b71b08bba2f834
* Beginner) About the Timer using in separate class - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/466241af75596bd5
* Programmer Needed - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/daa0281ff37484c3
* Building an Opensource project...newb question. - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d160d6e57d983826
* Challenge: Triangles puzzle - 1 messages, 1 author
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e013ca5d7daa5f0
==========================================================================
TOPIC: simple IF question if (newplayer == goalkeeper) {throw error}
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f48598d0a1b3fad3
==========================================================================
== 1 of 11 ==
Date: Thurs, Oct 28 2004 3:11 am
From: "Steve Bosman" <[EMAIL PROTECTED]>
google instanceof
or just go straight to http://mindprod.com/jgloss/instanceof.html
Steve
== 2 of 11 ==
Date: Thurs, Oct 28 2004 3:13 am
From: Joona I Palaste <[EMAIL PROTECTED]>
zcraven <[EMAIL PROTECTED]> scribbled the following
on comp.lang.java.programmer:
> if (p2,p3,p4==Goalkeeper)
> {
> throw new IllegalArgumentException("You cannot put a goalkeeper
> in an outfield position");
> }
> I want to check that the variables p2 to p11 are of class OutfieldPlayer and
> not Goalkeeper (Both OutfieldPlayer and Goalkeeper are subtypes of abstract
> class Player). How do I write an if to check that the variables are of a
> certain class?
Because you have ten individual variables p2 to p11, the best you can do
is either a series of if statements:
if (p2 instanceof Goalkeeper) {
throw new IllegalArgumentException("No way!");
}
if (p3 instanceof Goalkeeper) {
throw new IllegalArgumentException("No way!");
}
/* and so on */
or one if statement with a large chained condition:
if (p2 instanceof Goalkeeper || p3 instanceof Goalkeeper /* and so on
*/) {
throw new IllegalArgumentException("No way!");
}
Your code, however, simply *screams* out for an array. You could have:
Player[] p = new Player[11];
/* assign values to p[0] to p[10] */
if (p[0] instanceof OutfieldPlayer) {
throw new IllegalArgumentException("Goalkeepers can't play " +
"outfield");
}
for (int i=1; i<11; i++) {
if (p[i] instanceof Goalkeeper) {
throw new IllegalArgumentException("Outfield players can't " +
"keep goals");
}
}
This way you could accommodate teams of several hundred or thousand
players without having to retype the same code over and over again.
--
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"Shh! The maestro is decomposing!"
- Gary Larson
== 3 of 11 ==
Date: Thurs, Oct 28 2004 3:14 am
From: Joachim Bowman <[EMAIL PROTECTED]>
zcraven wrote:
> How do I write an if to check that the variables are of a
> certain class?
if (variable instanceof CertainClass) { doSomething(); }
== 4 of 11 ==
Date: Thurs, Oct 28 2004 3:15 am
From: Thomas Schodt <[EMAIL PROTECTED]>
zcraven wrote:
> if (p2,p3,p4==Goalkeeper)
> {
> throw new IllegalArgumentException("You cannot put a goalkeeper
> in an outfield position");
> }
>
>
> I want to check that the variables p2 to p11 are of class OutfieldPlayer and
> not Goalkeeper (Both OutfieldPlayer and Goalkeeper are subtypes of abstract
> class Player). How do I write an if to check that the variables are of a
> certain class?
You should probably have a moveTo() method in Player
and override it as appropriate so
newplayer.moveTo(OUTFIELD)
would throw an exception if newplayer is an instance of Goalkeeper.
== 5 of 11 ==
Date: Thurs, Oct 28 2004 3:20 am
From: "zcraven" <[EMAIL PROTECTED]>
"Joona I Palaste" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> zcraven <[EMAIL PROTECTED]> scribbled the following
> on comp.lang.java.programmer:
> > if (p2,p3,p4==Goalkeeper)
> > {
> > throw new IllegalArgumentException("You cannot put a
goalkeeper
> > in an outfield position");
> > }
>
> > I want to check that the variables p2 to p11 are of class OutfieldPlayer
and
> > not Goalkeeper (Both OutfieldPlayer and Goalkeeper are subtypes of
abstract
> > class Player). How do I write an if to check that the variables are of
a
> > certain class?
>
> Because you have ten individual variables p2 to p11, the best you can do
> is either a series of if statements:
>
> if (p2 instanceof Goalkeeper) {
> throw new IllegalArgumentException("No way!");
> }
> if (p3 instanceof Goalkeeper) {
> throw new IllegalArgumentException("No way!");
> }
> /* and so on */
>
> or one if statement with a large chained condition:
>
> if (p2 instanceof Goalkeeper || p3 instanceof Goalkeeper /* and so on
> */) {
> throw new IllegalArgumentException("No way!");
> }
>
> Your code, however, simply *screams* out for an array. You could have:
>
> Player[] p = new Player[11];
> /* assign values to p[0] to p[10] */
> if (p[0] instanceof OutfieldPlayer) {
> throw new IllegalArgumentException("Goalkeepers can't play " +
> "outfield");
> }
> for (int i=1; i<11; i++) {
> if (p[i] instanceof Goalkeeper) {
> throw new IllegalArgumentException("Outfield players can't " +
> "keep goals");
> }
> }
>
> This way you could accommodate teams of several hundred or thousand
> players without having to retype the same code over and over again.
>
> --
> /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
> \-------------------------------------------------------- rules! --------/
> "Shh! The maestro is decomposing!"
> - Gary Larson
Thank you kind sir.
The clubFirst11 will always be of size 11 (hence the name), so I think I
will use the 2nd thing you suggested.
Is it possible to create an array of a fixed size (11) that behaves the same
as an arraylist (so I dont have to change my code too much)? Should I do
this?
== 6 of 11 ==
Date: Thurs, Oct 28 2004 3:24 am
From: "zcraven" <[EMAIL PROTECTED]>
"Joona I Palaste" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> zcraven <[EMAIL PROTECTED]> scribbled the following
> on comp.lang.java.programmer:
> > if (p2,p3,p4==Goalkeeper)
> > {
> > throw new IllegalArgumentException("You cannot put a
goalkeeper
> > in an outfield position");
> > }
>
> > I want to check that the variables p2 to p11 are of class OutfieldPlayer
and
> > not Goalkeeper (Both OutfieldPlayer and Goalkeeper are subtypes of
abstract
> > class Player). How do I write an if to check that the variables are of
a
> > certain class?
>
> Because you have ten individual variables p2 to p11, the best you can do
> is either a series of if statements:
>
> if (p2 instanceof Goalkeeper) {
> throw new IllegalArgumentException("No way!");
> }
> if (p3 instanceof Goalkeeper) {
> throw new IllegalArgumentException("No way!");
> }
> /* and so on */
>
> or one if statement with a large chained condition:
>
> if (p2 instanceof Goalkeeper || p3 instanceof Goalkeeper /* and so on
> */) {
> throw new IllegalArgumentException("No way!");
> }
>
> Your code, however, simply *screams* out for an array. You could have:
>
> Player[] p = new Player[11];
> /* assign values to p[0] to p[10] */
> if (p[0] instanceof OutfieldPlayer) {
> throw new IllegalArgumentException("Goalkeepers can't play " +
> "outfield");
> }
> for (int i=1; i<11; i++) {
> if (p[i] instanceof Goalkeeper) {
> throw new IllegalArgumentException("Outfield players can't " +
> "keep goals");
> }
> }
>
> This way you could accommodate teams of several hundred or thousand
> players without having to retype the same code over and over again.
>
> --
> /-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
> \-------------------------------------------------------- rules! --------/
> "Shh! The maestro is decomposing!"
> - Gary Larson
it doesnt compile ('inconvertible types')
== 7 of 11 ==
Date: Thurs, Oct 28 2004 3:25 am
From: "zcraven" <[EMAIL PROTECTED]>
public void setFirst11(Goalkeeper g1, OutfieldPlayer p2, OutfieldPlayer
p3,
OutfieldPlayer p4, OutfieldPlayer p5, OutfieldPlayer p6,
OutfieldPlayer p7,
OutfieldPlayer p8, OutfieldPlayer p9, OutfieldPlayer p10,
OutfieldPlayer p11)
{
if (g1 instanceof OutfieldPlayer){
throw new IllegalArgumentException("You cannot put an outfield
player in goal");
}
if (p2 instanceof Goalkeeper || p3 instanceof Goalkeeper || p4
instanceof Goalkeeper || p5 instanceof Goalkeeper ||
p6 instanceof Goalkeeper || p7 instanceof Goalkeeper || p8
instanceof Goalkeeper || p9 instanceof Goalkeeper ||
p10 instanceof Goalkeeper){
throw new IllegalArgumentException("You cannot put a goalkeeper
in an outfield position");
}
}
== 8 of 11 ==
Date: Thurs, Oct 28 2004 3:27 am
From: Joona I Palaste <[EMAIL PROTECTED]>
zcraven <[EMAIL PROTECTED]> scribbled the following
on comp.lang.java.programmer:
> "Joona I Palaste" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> zcraven <[EMAIL PROTECTED]> scribbled the following
>> on comp.lang.java.programmer:
>> > if (p2,p3,p4==Goalkeeper)
>> > {
>> > throw new IllegalArgumentException("You cannot put a
> goalkeeper
>> > in an outfield position");
>> > }
>>
>> > I want to check that the variables p2 to p11 are of class OutfieldPlayer
> and
>> > not Goalkeeper (Both OutfieldPlayer and Goalkeeper are subtypes of
> abstract
>> > class Player). How do I write an if to check that the variables are of
> a
>> > certain class?
>>
>> Because you have ten individual variables p2 to p11, the best you can do
>> is either a series of if statements:
>>
>> if (p2 instanceof Goalkeeper) {
>> throw new IllegalArgumentException("No way!");
>> }
>> if (p3 instanceof Goalkeeper) {
>> throw new IllegalArgumentException("No way!");
>> }
>> /* and so on */
>>
>> or one if statement with a large chained condition:
>>
>> if (p2 instanceof Goalkeeper || p3 instanceof Goalkeeper /* and so on
>> */) {
>> throw new IllegalArgumentException("No way!");
>> }
>>
>> Your code, however, simply *screams* out for an array. You could have:
>>
>> Player[] p = new Player[11];
>> /* assign values to p[0] to p[10] */
>> if (p[0] instanceof OutfieldPlayer) {
>> throw new IllegalArgumentException("Goalkeepers can't play " +
>> "outfield");
>> }
>> for (int i=1; i<11; i++) {
>> if (p[i] instanceof Goalkeeper) {
>> throw new IllegalArgumentException("Outfield players can't " +
>> "keep goals");
>> }
>> }
>>
>> This way you could accommodate teams of several hundred or thousand
>> players without having to retype the same code over and over again.
> Thank you kind sir.
> The clubFirst11 will always be of size 11 (hence the name), so I think I
> will use the 2nd thing you suggested.
> Is it possible to create an array of a fixed size (11) that behaves the same
> as an arraylist (so I dont have to change my code too much)? Should I do
> this?
Not really directly possible, but arrays and ArrayLists can be easily
converted back and forth.
To convert from an array to a List:
Player[] p = /* get players from somewhere */
List pl = Arrays.asList(p);
To convert a List to an array:
List pl = /* get players from somewhere */
Player[] p = (Player[])pl.toArray(new Player[0]);
Note the use of List instead of ArrayList. This is because
Arrays.asList() is not guaranteed to return an ArrayList, only some
kind of List, and anyway you very rarely need the specific behaviour
of an ArrayList that a List doesn't have. You still have to construct
your lists with new ArrayList() though. new List() won't work as List
is only an interface.
--
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"C++. C++ run. Run, ++, run."
- JIPsoft
== 9 of 11 ==
Date: Thurs, Oct 28 2004 3:29 am
From: Joona I Palaste <[EMAIL PROTECTED]>
zcraven <[EMAIL PROTECTED]> scribbled the following
on comp.lang.java.programmer:
> "Joona I Palaste" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> zcraven <[EMAIL PROTECTED]> scribbled the following
>> on comp.lang.java.programmer:
>> > if (p2,p3,p4==Goalkeeper)
>> > {
>> > throw new IllegalArgumentException("You cannot put a
> goalkeeper
>> > in an outfield position");
>> > }
>>
>> > I want to check that the variables p2 to p11 are of class OutfieldPlayer
> and
>> > not Goalkeeper (Both OutfieldPlayer and Goalkeeper are subtypes of
> abstract
>> > class Player). How do I write an if to check that the variables are of
> a
>> > certain class?
>>
>> Because you have ten individual variables p2 to p11, the best you can do
>> is either a series of if statements:
>>
>> if (p2 instanceof Goalkeeper) {
>> throw new IllegalArgumentException("No way!");
>> }
>> if (p3 instanceof Goalkeeper) {
>> throw new IllegalArgumentException("No way!");
>> }
>> /* and so on */
>>
>> or one if statement with a large chained condition:
>>
>> if (p2 instanceof Goalkeeper || p3 instanceof Goalkeeper /* and so on
>> */) {
>> throw new IllegalArgumentException("No way!");
>> }
>>
>> Your code, however, simply *screams* out for an array. You could have:
>>
>> Player[] p = new Player[11];
>> /* assign values to p[0] to p[10] */
>> if (p[0] instanceof OutfieldPlayer) {
>> throw new IllegalArgumentException("Goalkeepers can't play " +
>> "outfield");
>> }
>> for (int i=1; i<11; i++) {
>> if (p[i] instanceof Goalkeeper) {
>> throw new IllegalArgumentException("Outfield players can't " +
>> "keep goals");
>> }
>> }
>>
>> This way you could accommodate teams of several hundred or thousand
>> players without having to retype the same code over and over again.
> it doesnt compile ('inconvertible types')
You said yourself that OutfieldPlayer and Goalkeeper are subtypes of
Player, so I think the above should compile. I haven't seen your real
code so I only have your word for this, and can't test it myself.
Please post the exact message given by the compiler, along with the
line it's complaining about.
--
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"A bicycle cannot stand up by itself because it's two-tyred."
- Sky Text
== 10 of 11 ==
Date: Thurs, Oct 28 2004 3:58 am
From: "zcraven" <[EMAIL PROTECTED]>
> You said yourself that OutfieldPlayer and Goalkeeper are subtypes of
> Player, so I think the above should compile. I haven't seen your real
> code so I only have your word for this, and can't test it myself.
> Please post the exact message given by the compiler, along with the
> line it's complaining about.
this is the code:
-----------------------------------------------------------
public void setFirst11(Goalkeeper g1, OutfieldPlayer p2, OutfieldPlayer
p3, OutfieldPlayer p4, OutfieldPlayer p5, OutfieldPlayer p6, OutfieldPlayer
p7, OutfieldPlayer p8, OutfieldPlayer p9, OutfieldPlayer p10,
OutfieldPlayer p11)
{
if (g1 instanceof OutfieldPlayer){
throw new IllegalArgumentException("You cannot put an outfield
player in goal");
}
if (p2 instanceof Goalkeeper || p3 instanceof Goalkeeper || p4
instanceof Goalkeeper || p5 instanceof Goalkeeper ||
p6 instanceof Goalkeeper || p7 instanceof Goalkeeper || p8
instanceof Goalkeeper || p9 instanceof Goalkeeper ||
p10 instanceof Goalkeeper){
throw new IllegalArgumentException("You cannot put a goalkeeper
in an outfield position");
}
}
-----------------------------------------------------
It complains with 'inconvertible types' at this line:
public void setFirst11(Goalkeeper g1, OutfieldPlayer p2, OutfieldPlayer
p3, OutfieldPlayer p4, OutfieldPlayer p5, OutfieldPlayer p6, OutfieldPlayer
p7, OutfieldPlayer p8, OutfieldPlayer p9, OutfieldPlayer p10,
OutfieldPlayer p11)
== 11 of 11 ==
Date: Thurs, Oct 28 2004 4:17 am
From: "Steve Bosman" <[EMAIL PROTECTED]>
Without seeing your code, I would guess that you have a class hierarchy
where
Goalkeeper extends Player (and doesn't extend OutfieldPlayer)
and OutfieldPlayer extends Player (and doesn't extend Goalkeeper)
since your method doesn't use the generic Player for the arguments, but
explicitly states Goalkeeper or OutfieldPlayer, the java compiler is
clever enough to know that, to take one example, "p9 instanceof
Goalkeeper" is a nonsense statement since p9 cannot be cast to
Goalkeeper (it is inconvertible).
Steve
==========================================================================
TOPIC: Append one array to another array
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/20154155911aad9d
==========================================================================
== 1 of 3 ==
Date: Thurs, Oct 28 2004 3:18 am
From: [EMAIL PROTECTED] (June Moore)
Hi,
I would like to append the content of an array (Student[]) to another
array (Student[]).
Student[] oldStudent
Student[] newStudent
Can I do this?
newStudent = newStudent.add(oldStudent);
Thanks,
June.....
== 2 of 3 ==
Date: Thurs, Oct 28 2004 3:35 am
From: "VisionSet" <[EMAIL PROTECTED]>
"June Moore" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
> I would like to append the content of an array (Student[]) to another
> array (Student[]).
>
> Student[] oldStudent
> Student[] newStudent
>
> Can I do this?
> newStudent = newStudent.add(oldStudent);
No, because an array is immutable.
You will have to create a new array and copy the contents of both into it.
You may find System.arrayCopy() useful.
--
Mike W
== 3 of 3 ==
Date: Thurs, Oct 28 2004 5:44 am
From: "VisionSet" <[EMAIL PROTECTED]>
"VisionSet" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "June Moore" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Hi,
> > I would like to append the content of an array (Student[]) to another
> > array (Student[]).
> >
> > Student[] oldStudent
> > Student[] newStudent
> >
> > Can I do this?
> > newStudent = newStudent.add(oldStudent);
>
> No, because an array is immutable.
> You will have to create a new array and copy the contents of both into it.
> You may find System.arrayCopy() useful.
When I say immutable I refer to the size, this being your problem.
It is a poor word choice since an array is mutable as far as changing the
value of the element references.
ie you can do this
String[] myString = {"Original"};
myStringArray[0] = "Mutated";
Also note you can not call methods on Arrays, although they are Objects
there is no API for them.
java.util.Arrays being a utility class for services on Arrays and
java.lang.reflect.Array being a introspection class for accessing an Array
object. Neither can produce objects.
--
Mike W
==========================================================================
TOPIC: clone
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/499165c53fb19987
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 3:30 am
From: "Paul H. van Rossem" <[EMAIL PROTECTED]>
On 28-10-2004 11:24, <- Chameleon -> wrote:
>>> I want to take the clone() of Cloneable objects which are upcasting
>>> to Object
>>>
>>> I give below a similar code:
>>>
>>>
>>>
>>> class A {
>>> public Object clone() {....}
>>> ....
>>> }
>>>
>>> class B {
>>> public static int main(String[] argv) {
>>> A a = new A();
>>> Object aClone = getCloneForAnyObject(a);
>>> }
>>> public Object getCloneForAnyObject(Object a) { // Upcasting to Object
>>> // if "a" is "Cloneable" I want to return "a.clone()"
>>> // else I want to return "a".
>>> // Can you implement this method?
>>> }
>>> }
>>
>>
>>
>> Is this what you mean? I only wonder why you would want to do
>> something like this; looks like a strange design contract. You might
>> need to reconsider your requirements vs. design...(?)
>
>
> for instance, if you store lots of objects in a "Vector", when you want
> to clone an object from "Vector" you have only the "Object". Your
> instance of a class is upcasted to "Object"
>
> Now, you want to clone this object but you dont know the class type of
> this object to downcast. What you can do?
>
>> if (a instanceof Cloneable)
>> return a.clone();
>> else return a;
>
>
> this is wrong.
> in Object clone() is protected
Indeed, that's why this is a wrong approach! If you have a vector of
Objects (say of ClassX1 and ClassX2), and those all derive from ClassX,
then you should provide a public clone() method for ClassX (possibly
abstract) and any of these subclasses (ClassX1.clone(), etc), thereby
overriding the ClassX and ultimately the Object's invisible clone(). So
you are able to clone() any object from your vector of ClassX, without
having to know (or test!) which type it is. This is called dynamic binding.
So you need an intermediate class. Not sure that this answers your question?
Paul.
==========================================================================
TOPIC: Homework - Was Re: java programe help
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8fddd0a49ac12937
==========================================================================
== 1 of 2 ==
Date: Thurs, Oct 28 2004 3:48 am
From: Andrew Thompson <[EMAIL PROTECTED]>
On Thu, 28 Oct 2004 10:45:13 +0100, Alex Hunsley wrote:
> Chris Uppal wrote:
(Thomas Weidenfeller)
>>>>>- [...] And
>>>>> you don't hide behind alleged or real anonymous services or
>>>>> nick names. Telling us the name of your university if not
>>>>> apparent from your e-mail address is a bonus.
>>
>> I disagree with this. /Very strongly/.
On reflection, I agree, though I think it might be worthwhile
explaining you are more *likely* to get help if you post with a
'real sounding' and ..especially 'not idiotic' name.
Obviously it is a matter of taste to the observer as to
what constitutes idiotic, but anything that says, or implies
rude words is definitely on my list.
In times when I am busy and need to start making arbitrary
choices as to which posts I will and won't read, the ones
from 'silly names' are the first to be dropped.
And ultimately..
> ..If we start shouting at people with anonymous
> looking nicks, then posters may just come back with real looking names
> that are fictional.
I think that sums up the pointlessness of demanding any
such thing, if 'Dennis Bradshaw' made a post, is this a
new poster who's name is Dennis Bradshaw, or is *her*
name actually Denise Smith, ..or Anna Cheung, or...
Even though I will give more time to those who are prepared
to post under a 'real sounding' name that they post under
consistently, I do not think we should attempt to rob people
of their anonimity at the outset. To post under an obviously
fale name is saying (politely) 'I am what I write, nothing more,
nothing less, accept my words for what they are, not who you
presume I am' (wow - very zen..)
Though if posters begin to drag in their college, or it becomes
overly apparent they are attempting to pass off other people's
work as their own (as has happened recently) all bets are off.
--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
== 2 of 2 ==
Date: Thurs, Oct 28 2004 3:53 am
From: Joona I Palaste <[EMAIL PROTECTED]>
Try searching for "Homework" on Google Groups. There are apparently
people and organisations who make a living from doing people's
homework for them. And this is advertised publically! Doesn't anyone
have any ethics any more?
--
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"A friend of mine is into Voodoo Acupuncture. You don't have to go into her
office. You'll just be walking down the street and... ohh, that's much better!"
- Stephen Wright
==========================================================================
TOPIC: How can i block java web start from downloading jre .. but still launch app
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/650db0305c405eb3
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 4:06 am
From: [EMAIL PROTECTED] (Glenn M)
How i can i configure a the web start client so that it ignore's any
request to download a JRE.
I have web start 1.4.2 and am trying to connect to an application
through web start that requests the download of jre 1.3
i am adament that this application will work with jre 1.4.2 and want
to block this download of jre 1.3 but still run the java application
how can accomplish this...
thanks
glenn
==========================================================================
TOPIC: rules engines: faster implementation than methods invocations?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fe7838a641d72733
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 4:13 am
From: [EMAIL PROTECTED] (Jesper Nordenberg)
NOBODY <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Hi,
>
> About rules engines (and jsr-94):
> We looked at 'drools', but it uses method invocations.
> ---> Is there other implementations around, not based on method
> invocation?
>
> Given that invocation is 50 to 300 times slower than compiled call,
> method invocation sucks big time at high throughputs. My only alternative
> is code generation at this point.
You're benchmark is not very accurate. I've modified it so it actually
does some work and removed the object <-> primitive conversions. The
results using JDK 1.5 -server are:
direct dolong: total=3205 ms, avg=0.080125 us, 440000000
invoke dolong: total=4536 ms (1.4152886115444618x), avg=0.1134 us,
440000000
So, the difference in speed is not as big as you suggest.
/Jesper Nordenberg
public class TestInvokeSpeed {
static Method m_dolong;
static {
try {
m_dolong = TestInvokeSpeed.class.getMethod("dolong", new
Class[]{Long.class,
Long.class,
String.class,
String.class});
}
catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
int N = 40 * 1000 * 1000;
testlong(false, N);
System.out.println();
testlong(true, N);
System.out.println();
}
static void testlong(boolean echo, int N) throws Exception {
long t1, d1, d2;
t1 = System.currentTimeMillis();
long l = 0;
Long l1 = new Long(1);
Long l2 = new Long(2);
for (int i = 0; i < N; i++) {
l += dolong(l1, l2, "toto", "tata").longValue();
}
d1 = System.currentTimeMillis() - t1;
System.out.println(!echo ? "." : "direct dolong: total=" + d1 + "
ms, avg=" + (1000.0 * d1 / N) + " us, " + l);
Object[] args = new Object[]{new Long(1), new Long(2), "toto",
"tata"};
t1 = System.currentTimeMillis();
l = 0;
for (int i = 0; i < N; i++) {
l += ((Long) m_dolong.invoke(null, args)).longValue();
}
d2 = System.currentTimeMillis() - t1;
System.out.println(!echo ? "." : "invoke dolong: total=" + d2
+ " ms (" + (1.0 * d2 / d1) +
"x), avg=" + (1000.0 * d2 / N) + " us, " + l);
}
public static Long dolong(Long l1, Long l2, String s1, String s2) {
return new Long(l1.longValue() + l2.longValue() + s1.length() +
s2.length());
}
}
==========================================================================
TOPIC: Enums in inner classes
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7ecb6f0754c4b0df
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 4:33 am
From: G Winstanley <[EMAIL PROTECTED]>
On Wed, 27 Oct 2004 21:05:34 GMT, the cup of "xarax" <[EMAIL PROTECTED]>
overfloweth with the following:
> "Boudewijn Dijkstra" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > "G Winstanley" <[EMAIL PROTECTED]> schreef in bericht
> > news:[EMAIL PROTECTED]
> > >> I think the modifier it's complaining about is "static"--enums are
> > >> implicitly static, and you can't declare a static class inside a
> > >> non-static inner class.
> > >
> > > Ah ha! Of course, I should have realized that. Thanks for pointing out
> > > the obvious. Of course it now compiles.
> >
> > Huh? In your reply to my last post in this thread, you said you already tried
> > static...
>
> He tried "static" on the enum declaration, not
> on the enclosing inner class.
>
Precisely. Annoying really, as it's exactly the sort of thing that gives you
one of those Homer Simpson "Doh" moments when you see the solution.
Thanks for the help all. Classes now enumerated in full.
Stan
==========================================================================
TOPIC: Eclipse Help trouble
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a1e9234ad1090cc0
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 5:05 am
From: [EMAIL PROTECTED] (Jonck van der Kogel)
> Had the same problem with eclipse on linux. I changed the custom browser
> command in Preferences->Help and that did it.
> Hope that helps
Regretfully this changed nothing for me. Has anyone gotten Help to
work under OS X? If so, any pointers?
Thanks very much, Jonck
==========================================================================
TOPIC: Forwarding search criteria from the view
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/24b71b08bba2f834
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 5:23 am
From: "VisionSet" <[EMAIL PROTECTED]>
I have a bunch of related view classes, each displaying a database table.
Each has a generic controller (interface type) with a generic search method.
Each view class has a search function that takes text field contents and
forwards them to their respective controller's search method.
Since the nature of the search criteria changes between these classes I'm
thinking of having the controllers search method like so:
public void search(Object[] criteria);
Now the controllers are the most throwaway part of the code and are written
to serve view and model, so I can make assumptions about the exact types of
criteria...
I should have constants for the criteria array indices; is their logical
home the view classes? Certainly not the controller interface.
Is there a better way?
One option I realise is to access all the swing models from the controller
and never have to pass the actual data explicitly via the view code. I do
this for substantial models like TableModels, but for trivial textfields
this always seems to end up real clunky.
TIA
--
Mike W
==========================================================================
TOPIC: Beginner) About the Timer using in separate class
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/466241af75596bd5
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 5:29 am
From: [EMAIL PROTECTED] (Hade Prince)
here is my question, and I have 3 more hours by the deadline...
since I use Timer build-in function in the Java, and the
actionperformed, all kinds of stuff like this, and another class is
Applet; in this situation, I wonder to know how I can get my applet
run with every second (it means my applet connect to another class
with some object like a ball, and I need to make a animation but not
using frame method... since in the timer, the delay time is 1000 of
course for the millisecond, this is off my topic, my question is, how
can I use it, is it possible someone can type a source code for me for
reference to know how I can use it? thanks a lot.
==========================================================================
TOPIC: Programmer Needed
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/daa0281ff37484c3
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 5:31 am
From: [EMAIL PROTECTED] (Jennie Knutson)
My name is Jennie Knutson. I work for an Information Technology
Service Provider, named Unitary, based in Milano, Italy. Our company
works with offshore, outsourcing companies to do our projects. We
have potential projects, however, we are in need of programmers. If
you are interested in a position, and would like more information,
please send your resume to [EMAIL PROTECTED] Thank you for your
time.
Jennie Knutson
==========================================================================
TOPIC: Building an Opensource project...newb question.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d160d6e57d983826
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 5:39 am
From: [EMAIL PROTECTED] (JavaNewb)
Many thanks for your help Paul, I'll give that a try and let you know how I get on.
Thanks again.
==========================================================================
TOPIC: Challenge: Triangles puzzle
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5e013ca5d7daa5f0
==========================================================================
== 1 of 1 ==
Date: Thurs, Oct 28 2004 5:56 am
From: Jens Axel Søgaard <[EMAIL PROTECTED]>
Dirk Thierbach wrote:
> Gareth McCaughan <[EMAIL PROTECTED]> wrote:
>>Yes. In particular, the *very* short solutions all (1) used
>>assignments within the program as input (though they didn't
>>count those assignments as part of the code),
>>(2) used numbers to represent points, which enables various minor
>>algorithmic simplifications.
>
>
> Nope. Anything that's comparable will do for the simple solution,
> and with two additional lines, you can use anything that only admits equality.
> If you just want the number of solutions, and not the solutions themselves
> without "duplicates" by permutation, then you can do even without that
> (just divide the length of the list of solutions by 6).
>
> BTW, one more important difference is that some algorithms just counted,
> while some actually computed all solutions. Some algorithms restricted
> themselves to two "fans" of lines, while some allowed an arbitrary
> geometry. And so on, and so on.
It is also interesting to look at the various time complexities for
the algorithms used. The programs that generate all tree-tuples of points
and then filter for triangles and remove duplicates will be slower than
programs that generate the triangles in way that doesn't generate non-triangles
nor duplicates, when we run the programs for large n and m.
--
Jens Axel Søgaard
=======================================================================
You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".
comp.lang.java.programmer
[EMAIL PROTECTED]
Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe
Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]
Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe
=======================================================================
Google Groups: http://groups-beta.google.com