Monolog Hamleta w Javie

poszwa.blogspot.com 1 godzina temu

Sam nie bardzo lubię tekstów AI, chyba iż w języku programowania :)


<a alt="hamlet.java - explore this and millions of other domains on NetAtlas" href="https://netatlas.net/domain/hamlet.java">Hamlet.java</a>
Hamlet.java · dk.elsinore
package dk.elsinore;
public final class
Hamlet
implements
Runnable
{
static class
SlingsAndArrows
extends
RuntimeException
{}
static class
Conscience
extends
RuntimeException
{}
private static final boolean TO_BE =
true;
/** Kwestia, której kompilator nie potrafi rozstrzygnąć,
     *  choć potrafi ją zoptymalizować. */
static boolean question()
{
return TO_BE ||
!TO_BE;
}
@Override
public void run()
{
try
{
while
(question())
{
                suffer(Fortune.outrageous());
// czy szlachetniej jest znosić
}
}
catch
(SlingsAndArrows e)
{
            takeArms(SeaOfTroubles.INSTANCE);
// czy stawić opór — i skończyć
}
try
{
            die();
// umrzeć — zasnąć
}
catch
(InterruptedException dream)
{
// zasnąć — może śnić?
throw new
SlingsAndArrows();
// ay, there's the rub
}
}
/** Kto by dźwigał brzemię, gdyby mógł sam sobie wystawić kwit? */
private void die()
throws
InterruptedException
{
Thread.sleep(Long.MAX_VALUE);
}
/** Nieodkryty kraj, z którego nie wraca żaden podróżny.
     *  Sygnatura obiecuje wartość, której nigdy nie dostaniesz. */
private static
Void theUndiscoveredCountry()
{
for
(;;)
{ }
}
public static void main(String[] args)
{
Runnable enterpriseOfGreatPithAndMoment =
new
Hamlet();
try
{
            resolve(enterpriseOfGreatPithAndMoment);
}
catch
(Conscience c)
{
// sumienie czyni nas tchórzami — wyjątek połknięty
}
// Thread#start() nigdy nie zostaje wywołane:
// przedsięwzięcie traci miano czynu.
}
static void resolve(Runnable r)
{
throw new
Conscience();
}
static void suffer(Fortune f)
{
throw new
SlingsAndArrows();
}
static void takeArms(SeaOfTroubles s)
{ theUndiscoveredCountry();
}
enum
SeaOfTroubles
{ INSTANCE }
static class
Fortune
{
static
Fortune outrageous()
{
return new
Fortune();
}
}
}
Idź do oryginalnego materiału