Package org.jacop.jasat.utils
Class OptParse<E>
- java.lang.Object
-
- org.jacop.jasat.utils.OptParse<E>
-
public class OptParse<E> extends java.lang.Object
util to parse command-line arguments- Version:
- 4.7
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OptParse.OptHandler<E>
a class to handle one option
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,OptParse.OptHandler<E>>
handlers
private java.lang.String
mainHelp
java.lang.String[]
realArgs
-
Constructor Summary
Constructors Constructor Description OptParse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHandler(OptParse.OptHandler<E> handler)
add a handler for some optionvoid
exitParsing()
a handler can call this to interrupt the parsingE
parse(java.lang.String[] args, E e)
void
printHelp()
print help of all optionsvoid
setHelp(java.lang.String helpString)
change the main help string, which will be printed if asked, or if a wrong option is given
-
-
-
Field Detail
-
realArgs
public java.lang.String[] realArgs
-
handlers
private java.util.Map<java.lang.String,OptParse.OptHandler<E>> handlers
-
mainHelp
private java.lang.String mainHelp
-
-
Method Detail
-
addHandler
public void addHandler(OptParse.OptHandler<E> handler)
add a handler for some option- Parameters:
handler
- the handler
-
setHelp
public void setHelp(java.lang.String helpString)
change the main help string, which will be printed if asked, or if a wrong option is given- Parameters:
helpString
- the help string
-
printHelp
public void printHelp()
print help of all options
-
exitParsing
public void exitParsing()
a handler can call this to interrupt the parsing
-
-