• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

delay()

 
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm looking at some code online, and there's this function:
delay(1000 * 4);
It doesn't appear to be associated with an object.
One of the objects in the code extends Thread, which doesn't have a delay() function.
At any rate, this line is outside of any class code.
I've searched for a java function index on the internet and haven't been able to
find one. Googling the function itself doesn't bring up anything.

Is this a static method? Where's the documentation on it?
 
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post the code or a link to where you saw it? There isn't enough information there to tell you what it is.
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what do you mean by outside of any class code? You can't write code outside of classes in Java.
 
Marie Day
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike. J. Thompson wrote:Can you post the code or a link to where you saw it? There isn't enough information there to tell you what it is.



Here's the link to the page. It's in the first listing.

http://www.drdobbs.com/jvm/music-components-in-java-creating-oscill/230500178?pgno=2
 
Marie Day
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike. J. Thompson wrote:And what do you mean by outside of any class code? You can't write code outside of classes in Java.



Based on that statement, I looked up Object, and didn't see a delay method there. Could you tell me what class this line of code belongs to...
 
Marie Day
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike. J. Thompson wrote:And what do you mean by outside of any class code? You can't write code outside of classes in Java.



I meant it doesn't seem to be part of the code that defines a class, or inherited from a class that's being extended.
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've read the code, and the incomplete code snippet does not make it clear where the delay method is defined. I don't know if that is meant to be pseudo code or if there really is a delay method in their library, but I don't think you'll find it in any standard Java classes.

A likely implementation (if its a real method) will be to call Thread.sleep(long).
 
Marie Day
Ranch Hand
Posts: 30
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike. J. Thompson wrote:I've read the code, and the incomplete code snippet does not make it clear where the delay method is defined. I don't know if that is meant to be pseudo code or if there really is a delay method in their library, but I don't think you'll find it in any standard Java classes.

A likely implementation (if its a real method) will be to call Thread.sleep(long).



Thank you. He does offer a jar file containing all the code for all the sound synthesis components in the article series. The answer is most likely in there.
 
He does not suffer fools gladly. But this tiny ad does:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic