Transcript.java
/**
* Copyright 2010,2021 Nikolas S Boyd.
Permission is granted to copy this work provided this copyright statement is retained in all copies.
*/
package Hoot.Streams;
import Hoot.Runtime.Functions.*;
import Hoot.Runtime.Faces.*;
import Hoot.Runtime.Values.*;
import Hoot.Runtime.Blocks.*;
import Smalltalk.Core.*;
import Smalltalk.Blocks.*;
import Smalltalk.Magnitudes.*;
import Hoot.Behaviors.*;
import Hoot.Behaviors.Nil;
import Hoot.Behaviors.Object;
import Hoot.Behaviors.True;
import Hoot.Behaviors.False;
import Hoot.Behaviors.Boolean;
import Hoot.Magnitudes.*;
import Hoot.Magnitudes.Integer;
import Hoot.Magnitudes.Character;
import Hoot.Magnitudes.Float;
import Hoot.Magnitudes.Double;
import Hoot.Collections.*;
import Hoot.Collections.String;
import Hoot.Runtime.Faces.Logging;
import Hoot.Runtime.Names.Primitive;
import Hoot.Magnitudes.Integer;
import Smalltalk.Collections.ReadableString;
public class Transcript
implements Logging
{
public static final Transcript Instance = new Transcript();
/**
* @return
*/
public static Transcript log()
{
java.lang.String exitID = "Transcript>>$log";
Frame f0 = new Frame(exitID);
return (Transcript)Instance;
}
/**
* @return
*/
public Transcript printLine()
{
java.lang.String exitID = "Transcript>>printLine";
Frame f0 = new Frame(exitID);
this.cr();
return (Transcript)this;
}
/**
* @return
*/
public Transcript printLine(final CharSequence text)
{
java.lang.String exitID = "Transcript>>printLine";
Frame f0 = new Frame(exitID);
Primitive.printLine(text.toString());
return (Transcript)this;
}
/**
* @return
*/
public Transcript printLine(final ReadableString text)
{
java.lang.String exitID = "Transcript>>printLine";
Frame f0 = new Frame(exitID);
this.printLine(((String)text));
return (Transcript)this;
}
/**
* @return
*/
public Transcript printLine(final String text)
{
java.lang.String exitID = "Transcript>>printLine";
Frame f0 = new Frame(exitID);
Primitive.printLine(text.primitiveString());
return (Transcript)this;
}
/**
* @return
*/
public Transcript print(final CharSequence text)
{
java.lang.String exitID = "Transcript>>print";
Frame f0 = new Frame(exitID);
Primitive.printLine(text.toString());
return (Transcript)this;
}
/**
* @return
*/
public Transcript print(final ReadableString text)
{
java.lang.String exitID = "Transcript>>print";
Frame f0 = new Frame(exitID);
this.print(((String)text));
return (Transcript)this;
}
/**
* @return
*/
public Transcript print(final String text)
{
java.lang.String exitID = "Transcript>>print";
Frame f0 = new Frame(exitID);
Primitive.print(text.primitiveString());
return (Transcript)this;
}
/**
* @return
*/
public Transcript cr()
{
java.lang.String exitID = "Transcript>>cr";
Frame f0 = new Frame(exitID);
this.print(this.lineSeparator());
return (Transcript)this;
}
/**
* @return
*/
public Transcript tab()
{
java.lang.String exitID = "Transcript>>tab";
Frame f0 = new Frame(exitID);
this.print(Character.type().tab().asString());
return (Transcript)this;
}
/**
* @return
*/
public Transcript space()
{
java.lang.String exitID = "Transcript>>space";
Frame f0 = new Frame(exitID);
this.print(Character.type().space().asString());
return (Transcript)this;
}
/**
* @return
*/
public Transcript quote()
{
java.lang.String exitID = "Transcript>>quote";
Frame f0 = new Frame(exitID);
this.print(Character.type().quote().asString());
return (Transcript)this;
}
/**
* @return
*/
public String lineSeparator()
{
java.lang.String exitID = "Transcript>>lineSeparator";
Frame f0 = new Frame(exitID);
return (String)WriteStream.type().lineSeparator();
}
/**
* @return
*/
public Transcript yourself()
{
java.lang.String exitID = "Transcript>>yourself";
Frame f0 = new Frame(exitID);
return (Transcript)this;
}
/**
* @return
*/
public Transcript reportSecs_fromTest(final String text, final Closure testBlock)
{
java.lang.String exitID = "Transcript>>reportSecs_fromTest";
Frame f0 = new Frame(exitID);
LongInteger duration = LongInteger.from(testBlock.millisecondsToRun());
{
Transcript prime = this;
prime.print(text);
prime.print((duration.divideWith(((Float)Float.from(1000.0f)))).printString());
prime.printLine(String.from(" secs"));
};
return (Transcript)this;
}
/**
* @return
*/
public Transcript reportMsecs_fromTest(final String text, final Closure testBlock)
{
java.lang.String exitID = "Transcript>>reportMsecs_fromTest";
Frame f0 = new Frame(exitID);
LongInteger duration = LongInteger.from(testBlock.millisecondsToRun());
{
Transcript prime = this;
prime.print(text);
prime.print(duration.printString());
prime.printLine(String.from(" msecs"));
};
return (Transcript)this;
}
/**
* @return
*/
public Transcript report_afterTest(final String text, final Closure testBlock)
{
java.lang.String exitID = "Transcript>>report_afterTest";
Frame f0 = new Frame(exitID);
this.report_after_timesRepeat(text, SmallInteger.from(1), testBlock);
return (Transcript)this;
}
/**
* @return
*/
public Transcript report_after_timesRepeat(final String text, final Integer count, final Closure testBlock)
{
java.lang.String exitID = "Transcript>>report_after_timesRepeat";
Frame f0 = new Frame(exitID);
LongInteger duration = LongInteger.from(testBlock.millisecondsToRepeat(count));
(count.moreThan(SmallInteger.from(1))).ifTrue_ifFalse(Closure.with(f2 -> {
{
Transcript prime = this;
prime.print(text);
prime.print((duration.divideWith(((Float)Float.from(1000.0f)))).printString());
prime.printLine(String.from(" secs"));
};
}, ""), Closure.with(f2 -> {
{
Transcript prime = this;
prime.print(text);
prime.print(duration.printString());
prime.printLine(String.from(" msecs"));
};
}, ""));
return (Transcript)this;
}
}