-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default slot support for templated intents (#11)
* Updated ver num. * Added default value slot support to templated intents. * Added customslot with default value. * More work on making templated intents default value aware.
- Loading branch information
1 parent
18a5baf
commit 42fb90f
Showing
6 changed files
with
193 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
mutters-slots/src/main/java/com/rabidgremlin/mutters/slots/CustomSlotWithDefaultValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.rabidgremlin.mutters.slots; | ||
|
||
import java.util.HashMap; | ||
|
||
import com.rabidgremlin.mutters.core.Context; | ||
import com.rabidgremlin.mutters.core.Slot; | ||
import com.rabidgremlin.mutters.core.SlotMatch; | ||
|
||
/** | ||
* A CustomSlot that supports default values. | ||
* | ||
* @author rabidgremlin | ||
* | ||
*/ | ||
public class CustomSlotWithDefaultValue | ||
extends CustomSlot | ||
implements DefaultValueSlot | ||
{ | ||
/** The default value to return */ | ||
private Object defaultValue; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param name The name of the slot. | ||
* @param optionValueMap A map of possible input values mapped to output values. | ||
* @param defaultValue The default value. | ||
*/ | ||
public CustomSlotWithDefaultValue(String name, HashMap<String, String> optionValueMap, Object defaultValue) | ||
{ | ||
super(name, optionValueMap); | ||
this.defaultValue = defaultValue; | ||
} | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param name The name of the slot. | ||
* @param options The list of expected options. | ||
* @param defaultValue The default value. | ||
*/ | ||
public CustomSlotWithDefaultValue(String name, String[] options, Object defaultValue) | ||
{ | ||
super(name, options); | ||
this.defaultValue = defaultValue; | ||
} | ||
|
||
@Override | ||
public Object getDefaultValue() | ||
{ | ||
return defaultValue; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters