Package jason.stdlib
Class printf
java.lang.Object
jason.asSemantics.DefaultInternalAction
jason.stdlib.println
jason.stdlib.printf
- All Implemented Interfaces:
InternalAction
,java.io.Serializable
@Manual(literal=".printf(format,arg0[,arg1,...])", hint="used for printing messages to the console inspired by Java printf/format", argsHint={"the format of the output (not use \"%d\", Jason numbers are Java Double)","the terms to be printed out","the term to be concatenated with prior one and printed out [optional]"}, argsType={"string","term","term"}, examples={".printf(\"Value %08.0f%n\",N): prints Value 00461012, when N is 461012",".printf(\"Value \"%10.3f\"\",N): prints Value 3.142, when N is 3.14159"}, seeAlso={"jason.stdlib.print","jason.stdlib.println"}) public class printf extends println
Internal action: .printf(format, args...)
.
Description: used for printing messages to the console inspired by Java printf/format. NB.: do not use "%d" since all numbers used by this internal action are translated from Jason to a Java double.
Examples:
-
.printf("Value %08.0f%n",N)
: printsValue 00461012
, when N is 461012. -
.printf("Value %10.3f",N)
: printsValue 3.142
, when N is 3.14159.
- See Also:
print
, Serialized Form
-
Field Summary
Fields Modifier and Type Field Description private static InternalAction
singleton
-
Constructor Summary
Constructors Constructor Description printf()
-
Method Summary
Modifier and Type Method Description protected void
checkArguments(Term[] args)
static InternalAction
create()
java.lang.Object
execute(TransitionSystem ts, Unifier un, Term[] args)
Executes the internal action.Methods inherited from class jason.stdlib.println
argsToString, getNewLine
Methods inherited from class jason.asSemantics.DefaultInternalAction
canBeUsedInContext, destroy, getMaxArgs, getMinArgs, prepareArguments, suspendIntention
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
singleton
-
-
Constructor Details
-
printf
public printf()
-
-
Method Details
-
create
-
checkArguments
- Overrides:
checkArguments
in classDefaultInternalAction
- Throws:
JasonException
-
execute
public java.lang.Object execute(TransitionSystem ts, Unifier un, Term[] args) throws java.lang.ExceptionDescription copied from interface:InternalAction
Executes the internal action. It should return a Boolean or an Iterator. A true boolean return means that the IA was successfully executed. An Iterator result means that there is more than one answer for this IA (e.g. see member internal action). - Specified by:
execute
in interfaceInternalAction
- Overrides:
execute
in classprintln
- Throws:
java.lang.Exception
-