📄 textcommandparserhelper.java
字号:
}
case TextCommandParserTokenTypes.CMD_GET_MAX_NUMBER_SUPPORTED: {
tsCommand.setGetMaxNumberSupported(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_TAG_FIELD: {
tsCommand.setGetTagField(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_VALUE: {
tsCommand.setGetValue(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_MASK: {
tsCommand.setGetMask(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_INCLUSIVE_FLAG: {
tsCommand.setGetInclusiveFlag(cmdFactory.createNoParamType());
break;
}
default: {
throw new CommandNotSupportedException("Method not supported by object TagSelector.");
}
}
return tsCommand;
}
/**
* Creates the IR for a NotificationChannel commmand.
* @return The NotificationChannelCommand IR
* @throws TextCommandParserException
*/
private NotificationChannelCommand getNotificationChannelCommand() throws TextCommandParserException {
NotificationChannelCommand ncCommand = cmdFactory.createNotificationChannelCommand();
switch (commandType) {
case TextCommandParserTokenTypes.CMD_CREATE: {
NotificationChannelCommand.Create c = cmdFactory.createNotificationChannelCommandCreate();
c.setName(readValueParameter().getStringValue());
c.setAddress(readValueParameter().getStringValue());
ncCommand.setCreate(c);
break;
}
case TextCommandParserTokenTypes.CMD_GETNAME: {
ncCommand.setGetName(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_ADDRESS: {
ncCommand.setGetAddress(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_EFFECTIVE_ADDRESS: {
ncCommand.setGetEffectiveAddress(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_SET_ADDRESS: {
NotificationChannelCommand.SetAddress a = cmdFactory.createNotificationChannelCommandSetAddress();
a.setAddress(readValueParameter().getStringValue());
ncCommand.setSetAddress(a);
break;
}
case TextCommandParserTokenTypes.CMD_GET_DATA_SELECTOR: {
ncCommand.setGetDataSelector(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_SET_DATA_SELECTOR: {
NotificationChannelCommand.SetDataSelector ds = cmdFactory.createNotificationChannelCommandSetDataSelector();
ds.setDataSelector(readValueParameter().getStringValue());
ncCommand.setSetDataSelector(ds);
break;
}
case TextCommandParserTokenTypes.CMD_ADD_SOURCES: {
NotificationChannelCommand.AddSources srcs = cmdFactory.createNotificationChannelCommandAddSources();
SourceListParamType.List list = cmdFactory.createSourceListParamTypeList();
SourceListParamType listType = cmdFactory.createSourceListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
srcs.setSources(listType);
ncCommand.setAddSources(srcs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_SOURCES: {
NotificationChannelCommand.RemoveSources srcs = cmdFactory.createNotificationChannelCommandRemoveSources();
SourceListParamType.List list = cmdFactory.createSourceListParamTypeList();
SourceListParamType listType = cmdFactory.createSourceListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
srcs.setSources(listType);
ncCommand.setRemoveSources(srcs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_ALL_SOURCES: {
ncCommand.setRemoveAllSources(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_SOURCE: {
NotificationChannelCommand.GetSource src = cmdFactory.createNotificationChannelCommandGetSource();
src.setName(readValueParameter().getStringValue());
ncCommand.setGetSource(src);
break;
}
case TextCommandParserTokenTypes.CMD_GET_ALL_SOURCES: {
ncCommand.setGetAllSources(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_ADD_NOTIFICATION_TRIGGERS: {
NotificationChannelCommand.AddNotificationTriggers trgs = cmdFactory.createNotificationChannelCommandAddNotificationTriggers();
TriggerListParamType.List list = cmdFactory.createTriggerListParamTypeList();
TriggerListParamType listType = cmdFactory.createTriggerListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
trgs.setTriggers(listType);
ncCommand.setAddNotificationTriggers(trgs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_NOTIFICATION_TRIGGERS: {
NotificationChannelCommand.RemoveNotificationTriggers trgs = cmdFactory.createNotificationChannelCommandRemoveNotificationTriggers();
TriggerListParamType.List list = cmdFactory.createTriggerListParamTypeList();
TriggerListParamType listType = cmdFactory.createTriggerListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
trgs.setTriggers(listType);
ncCommand.setRemoveNotificationTriggers(trgs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_ALL_NOTIFICATION_TRIGGERS: {
ncCommand.setRemoveAllNotificationTriggers(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_NOTIFICATION_TRIGGER: {
NotificationChannelCommand.GetNotificationTrigger trg = cmdFactory.createNotificationChannelCommandGetNotificationTrigger();
trg.setName(readValueParameter().getStringValue());
ncCommand.setGetNotificationTrigger(trg);
break;
}
case TextCommandParserTokenTypes.CMD_GET_ALL_NOTIFICATION_TRIGGERS: {
ncCommand.setGetAllNotificationTriggers(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_READ_QUEUED_DATA: {
NotificationChannelCommand.ReadQueuedData rq = cmdFactory.createNotificationChannelCommandReadQueuedData();
//Set the ClearBuffer flag if the optional parameter is available
if (hasParameters()) {
rq.setClearBuffer(readValueParameter().getBooleanValue());
}
ncCommand.setReadQueuedData(rq);
break;
}
default: {
throw new CommandNotSupportedException("Method not supported by object NotificationChannel.");
}
}
return ncCommand;
}
/**
* Creates the IR for a DataSelector commmand.
* @return The DataSelectorCommand IR
* @throws TextCommandParserException
*/
private DataSelectorCommand getDataSelectorCommand() throws TextCommandParserException {
DataSelectorCommand dsCommand = cmdFactory.createDataSelectorCommand();
switch (commandType) {
case TextCommandParserTokenTypes.CMD_CREATE: {
DataSelectorCommand.Create c = cmdFactory.createDataSelectorCommandCreate();
c.setName(readValueParameter().getStringValue());
dsCommand.setCreate(c);
break;
}
case TextCommandParserTokenTypes.CMD_GETNAME: {
dsCommand.setGetName(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_ADD_FIELD_NAMES: {
DataSelectorCommand.AddFieldNames fns = cmdFactory.createDataSelectorCommandAddFieldNames();
FieldNameListParamType.List list = cmdFactory.createFieldNameListParamTypeList();
FieldNameListParamType listType = cmdFactory.createFieldNameListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
fns.setFieldNames(listType);
dsCommand.setAddFieldNames(fns);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_FIELD_NAMES: {
DataSelectorCommand.RemoveFieldNames fns = cmdFactory.createDataSelectorCommandRemoveFieldNames();
FieldNameListParamType.List list = cmdFactory.createFieldNameListParamTypeList();
FieldNameListParamType listType = cmdFactory.createFieldNameListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
fns.setFieldNames(listType);
dsCommand.setRemoveFieldNames(fns);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_ALL_FIELD_NAMES: {
dsCommand.setRemoveAllFieldNames(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_ALL_FIELD_NAMES: {
dsCommand.setGetAllFieldNames(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_ADD_EVENT_FILTERS: {
DataSelectorCommand.AddEventFilters efs = cmdFactory.createDataSelectorCommandAddEventFilters();
EventTypeListParamType.List list = cmdFactory.createEventTypeListParamTypeList();
EventTypeListParamType listType = cmdFactory.createEventTypeListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
efs.setEventType(listType);
dsCommand.setAddEventFilters(efs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_EVENT_FILTERS: {
DataSelectorCommand.RemoveEventFilters efs = cmdFactory.createDataSelectorCommandRemoveEventFilters();
EventTypeListParamType.List list = cmdFactory.createEventTypeListParamTypeList();
EventTypeListParamType listType = cmdFactory.createEventTypeListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
efs.setEventType(listType);
dsCommand.setRemoveEventFilters(efs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_ALL_EVENT_FILTERS: {
dsCommand.setRemoveAllEventFilters(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_ALL_EVENT_FILTERS: {
dsCommand.setGetAllEventFilters(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_ADD_TAG_FIELD_NAMES: {
DataSelectorCommand.AddTagFieldNames tfs = cmdFactory.createDataSelectorCommandAddTagFieldNames();
StringListParamType.List list = cmdFactory.createStringListParamTypeList();
StringListParamType listType = cmdFactory.createStringListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
tfs.setFieldNames(listType);
dsCommand.setAddTagFieldNames(tfs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_TAG_FIELD_NAMES: {
DataSelectorCommand.RemoveTagFieldNames tfs = cmdFactory.createDataSelectorCommandRemoveTagFieldNames();
StringListParamType.List list = cmdFactory.createStringListParamTypeList();
StringListParamType listType = cmdFactory.createStringListParamType();
list.getValue().addAll(readListParameter().toStringList());
listType.setList(list);
tfs.setFieldNames(listType);
dsCommand.setRemoveTagFieldNames(tfs);
break;
}
case TextCommandParserTokenTypes.CMD_REMOVE_ALL_TAG_FIELD_NAMES: {
dsCommand.setRemoveAllTagFieldNames(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_ALL_TAG_FIELD_NAMES: {
dsCommand.setGetAllTagFieldNames(cmdFactory.createNoParamType());
break;
}
default: {
throw new CommandNotSupportedException("Method not supported by object DataSelector.");
}
}
return dsCommand;
}
/**
* Creates the IR for a EventType commmand.
* @return The EventTypeCommand IR
*/
private EventTypeCommand getEventTypeCommand() throws TextCommandParserException {
EventTypeCommand evCommand = cmdFactory.createEventTypeCommand();
switch (commandType) {
case TextCommandParserTokenTypes.CMD_GET_SUPPORTED_TYPES: {
evCommand.setGetSupportedTypes(cmdFactory.createNoParamType());
break;
}
default: {
throw new CommandNotSupportedException("Method not supported by object EventType.");
}
}
return evCommand;
}
/**
* Creates the IR for a TriggerType commmand.
* @return The TriggerTypeCommand IR
*/
private TriggerTypeCommand getTriggerTypeCommand() throws TextCommandParserException {
TriggerTypeCommand ttCommand = cmdFactory.createTriggerTypeCommand();
switch (commandType) {
case TextCommandParserTokenTypes.CMD_GET_SUPPORTED_TYPES: {
ttCommand.setGetSupportedTypes(cmdFactory.createNoParamType());
break;
}
default: {
throw new CommandNotSupportedException("Method not supported by object TriggerType.");
}
}
return ttCommand;
}
/**
* Creates the IR for a FieldName commmand.
* @return The FieldNameCommand IR
*/
private FieldNameCommand getFieldNameCommand() throws TextCommandParserException {
FieldNameCommand fnCommand = cmdFactory.createFieldNameCommand();
switch (commandType) {
case TextCommandParserTokenTypes.CMD_GET_SUPPORTED_NAMES: {
fnCommand.setGetSupportedNames(cmdFactory.createNoParamType());
break;
}
default: {
throw new CommandNotSupportedException("Method not supported by object FieldName.");
}
}
return fnCommand;
}
/**
* Creates the IR for a TagField commmand.
* @return The TagFieldCommand IR
* @throws TextCommandParserException
*/
private TagFieldCommand getTagFieldCommand() throws TextCommandParserException {
TagFieldCommand tfCommand = cmdFactory.createTagFieldCommand();
switch (commandType) {
case TextCommandParserTokenTypes.CMD_CREATE: {
TagFieldCommand.Create c = cmdFactory.createTagFieldCommandCreate();
c.setName(readValueParameter().getStringValue());
tfCommand.setCreate(c);
break;
}
case TextCommandParserTokenTypes.CMD_GETNAME: {
tfCommand.setGetName(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_GET_TAG_FIELD_NAME: {
tfCommand.setGetTagFieldName(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_SET_TAG_FIELD_NAME: {
TagFieldCommand.SetTagFieldName tagFieldName = cmdFactory.createTagFieldCommandSetTagFieldName();
tagFieldName.setTagFieldName(readValueParameter().getStringValue());
tfCommand.setSetTagFieldName(tagFieldName);
break;
}
case TextCommandParserTokenTypes.CMD_GET_MEMORY_BANK: {
tfCommand.setGetMemoryBank(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_SET_MEMORY_BANK: {
TagFieldCommand.SetMemoryBank memoryBank = cmdFactory.createTagFieldCommandSetMemoryBank();
memoryBank.setMemoryBank(BigInteger.valueOf(readValueParameter().getIntValue()));
tfCommand.setSetMemoryBank(memoryBank);
break;
}
case TextCommandParserTokenTypes.CMD_GET_OFFSET: {
tfCommand.setGetOffset(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_SET_OFFSET: {
TagFieldCommand.SetOffset offset = cmdFactory.createTagFieldCommandSetOffset();
offset.setOffset(readValueParameter().getIntValue());
tfCommand.setSetOffset(offset);
break;
}
case TextCommandParserTokenTypes.CMD_GET_LENGTH: {
tfCommand.setGetLength(cmdFactory.createNoParamType());
break;
}
case TextCommandParserTokenTypes.CMD_SET_LENGTH: {
TagFieldCommand.SetLength length = cmdFactory.createTagFieldCommandSetLength();
length.setLength(readValueParameter().getIntValue());
tfCommand.setSetLength(length);
break;
}
default: {
throw new CommandNotSupportedException("Method not supported by object TagField.");
}
}
return tfCommand;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -