![JAR search and dependency download from the Maven repository](/logo.png)
jason.stdlib.upper_case Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jason Show documentation
Show all versions of jason Show documentation
Jason is a fully-fledged interpreter for an extended version of AgentSpeak, a BDI agent-oriented logic programming language.
The newest version!
package jason.stdlib;
import jason.asSemantics.DefaultInternalAction;
import jason.asSemantics.InternalAction;
import jason.asSemantics.TransitionSystem;
import jason.asSemantics.Unifier;
import jason.asSyntax.StringTerm;
import jason.asSyntax.StringTermImpl;
import jason.asSyntax.Term;
/**
Internal action: .upper_case(S1,S2)
.
Description: converts the string S1 into upper case S2.
Parameters:
- + S1 (a term). The term representation as a string will be used.
- -/+ S2 (a string).
Examples:
-
.upper_case("CArtAgO",X)
: unifies X with "CARTAGO".
@see jason.stdlib.concat
@see jason.stdlib.delete
@see jason.stdlib.length
@see jason.stdlib.reverse
*/
public class upper_case extends DefaultInternalAction {
private static InternalAction singleton = null;
public static InternalAction create() {
if (singleton == null)
singleton = new upper_case();
return singleton;
}
@Override public int getMinArgs() {
return 2;
}
@Override public int getMaxArgs() {
return 2;
}
@Override
public Object execute(TransitionSystem ts, final Unifier un, final Term[] args) throws Exception {
checkArguments(args);
String arg = null;
if (args[0].isString())
arg = ((StringTerm)args[0]).getString();
else
arg = args[0].toString();
arg = arg.toUpperCase();
return un.unifies(new StringTermImpl(arg), args[1]);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy