public class ContextArgumentStack extends Object implements ArgumentStack
CommandContext into a stack of arguments
that can be consumed.a user of this class| Constructor and Description |
|---|
ContextArgumentStack(CommandContext context)
Create a new instance using the given context.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getConsumed()
Return the arguments that were consumed between this point and that marked point.
|
CommandContext |
getContext()
Get the underlying context.
|
String |
getUnconsumed()
Get the unconsumed arguments left over, without touching the stack.
|
void |
mark()
Mark the current position of the stack.
|
void |
markConsumed()
Set as completely consumed.
|
String |
next()
Get the next string, which may come from the stack or a value flag.
|
Boolean |
nextBoolean()
Get the next boolean, which may come from the stack or a value flag.
|
Double |
nextDouble()
Get the next double, which may come from the stack or a value flag.
|
Integer |
nextInt()
Get the next integer, which may come from the stack or a value flag.
|
int |
position()
Return the current position.
|
String |
remaining()
Get all remaining string values, which will consume the rest of the stack.
|
String |
reset()
Reset to the previously
mark()ed position of the stack, and return
the arguments that were consumed between this point and that previous point. |
boolean |
wasConsumed()
Return whether any arguments were consumed between the marked position
and the current position.
|
public ContextArgumentStack(CommandContext context)
context - the contextpublic String next() throws ParameterException
ArgumentStacknext in interface ArgumentStackParameterException - on a parameter errorpublic Integer nextInt() throws ParameterException
ArgumentStacknextInt in interface ArgumentStackParameterException - on a parameter errorpublic Double nextDouble() throws ParameterException
ArgumentStacknextDouble in interface ArgumentStackParameterException - on a parameter errorpublic Boolean nextBoolean() throws ParameterException
ArgumentStacknextBoolean in interface ArgumentStackParameterException - on a parameter errorpublic String remaining() throws ParameterException
ArgumentStackremaining in interface ArgumentStackParameterException - on a parameter errorpublic String getUnconsumed()
public void markConsumed()
ArgumentStackmarkConsumed in interface ArgumentStackpublic int position()
public void mark()
The marked position initially starts at 0.
public String reset()
mark()ed position of the stack, and return
the arguments that were consumed between this point and that previous point.
The marked position initially starts at 0.
public boolean wasConsumed()
The marked position initially starts at 0.
public String getConsumed()
The marked position initially starts at 0.
public CommandContext getContext()
getContext in interface ArgumentStackCopyright © 2015. All Rights Reserved.