repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/PluginFileDependency.java
PluginFileDependency.fileInTcMenu
public static PluginFileDependency fileInTcMenu(String file) { return new PluginFileDependency(file, PackagingType.WITHIN_TCMENU, Map.of()); }
java
public static PluginFileDependency fileInTcMenu(String file) { return new PluginFileDependency(file, PackagingType.WITHIN_TCMENU, Map.of()); }
[ "public", "static", "PluginFileDependency", "fileInTcMenu", "(", "String", "file", ")", "{", "return", "new", "PluginFileDependency", "(", "file", ",", "PackagingType", ".", "WITHIN_TCMENU", ",", "Map", ".", "of", "(", ")", ")", ";", "}" ]
Creates an instance of the class that indicates the file is within tcMenu itself. Don't use for new plugins, prefer to package arduino code in the plugin or a new library. @param file the file name @return a new instance
[ "Creates", "an", "instance", "of", "the", "class", "that", "indicates", "the", "file", "is", "within", "tcMenu", "itself", ".", "Don", "t", "use", "for", "new", "plugins", "prefer", "to", "package", "arduino", "code", "in", "the", "plugin", "or", "a", "n...
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/PluginFileDependency.java#L89-L91
train
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java
AbstractCodeCreator.initialise
@Override public void initialise(String root) { functionCalls.clear(); variables.clear(); initCreator(root); }
java
@Override public void initialise(String root) { functionCalls.clear(); variables.clear(); initCreator(root); }
[ "@", "Override", "public", "void", "initialise", "(", "String", "root", ")", "{", "functionCalls", ".", "clear", "(", ")", ";", "variables", ".", "clear", "(", ")", ";", "initCreator", "(", "root", ")", ";", "}" ]
Do not override this, use initCreator @param root the first menu item in the tree
[ "Do", "not", "override", "this", "use", "initCreator" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java#L50-L55
train
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java
AbstractCodeCreator.addExportVariableIfPresent
protected void addExportVariableIfPresent(String variable, String typeName) { String expVar = findPropertyValue(variable).getLatestValue(); if(expVar != null && !expVar.isEmpty()) { addVariable(new CodeVariableBuilder().exportOnly().variableType(typeName).variableName(expVar)); } ...
java
protected void addExportVariableIfPresent(String variable, String typeName) { String expVar = findPropertyValue(variable).getLatestValue(); if(expVar != null && !expVar.isEmpty()) { addVariable(new CodeVariableBuilder().exportOnly().variableType(typeName).variableName(expVar)); } ...
[ "protected", "void", "addExportVariableIfPresent", "(", "String", "variable", ",", "String", "typeName", ")", "{", "String", "expVar", "=", "findPropertyValue", "(", "variable", ")", ".", "getLatestValue", "(", ")", ";", "if", "(", "expVar", "!=", "null", "&&"...
Adds a variable for export only when a property is present @param variable the variable name (and also the expected property value) @param typeName the type name
[ "Adds", "a", "variable", "for", "export", "only", "when", "a", "property", "is", "present" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java#L92-L97
train
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java
AbstractCodeCreator.addLibraryFiles
protected void addLibraryFiles(String... files) { libraryFiles.addAll(Arrays.stream(files) .map(PluginFileDependency::fileInTcMenu) .collect(Collectors.toList()) ); }
java
protected void addLibraryFiles(String... files) { libraryFiles.addAll(Arrays.stream(files) .map(PluginFileDependency::fileInTcMenu) .collect(Collectors.toList()) ); }
[ "protected", "void", "addLibraryFiles", "(", "String", "...", "files", ")", "{", "libraryFiles", ".", "addAll", "(", "Arrays", ".", "stream", "(", "files", ")", ".", "map", "(", "PluginFileDependency", "::", "fileInTcMenu", ")", ".", "collect", "(", "Collect...
adds requirements on one or more files that must be copied into the project, this is only for files that already exist in tcMenu library, prefer to use the other version that takes `PluiginFileDependency` @see PluginFileDependency @param files the list of library files.
[ "adds", "requirements", "on", "one", "or", "more", "files", "that", "must", "be", "copied", "into", "the", "project", "this", "is", "only", "for", "files", "that", "already", "exist", "in", "tcMenu", "library", "prefer", "to", "use", "the", "other", "versi...
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java#L114-L119
train
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java
AbstractCodeCreator.findPropertyValue
public CreatorProperty findPropertyValue(String name) { return properties().stream().filter(p->name.equals(p.getName())).findFirst().orElse(EMPTY); }
java
public CreatorProperty findPropertyValue(String name) { return properties().stream().filter(p->name.equals(p.getName())).findFirst().orElse(EMPTY); }
[ "public", "CreatorProperty", "findPropertyValue", "(", "String", "name", ")", "{", "return", "properties", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "p", "->", "name", ".", "equals", "(", "p", ".", "getName", "(", ")", ")", ")", ".", "fi...
Gets a property by it's name @param name the name of the property to find @return the property or EMPTY
[ "Gets", "a", "property", "by", "it", "s", "name" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java#L167-L169
train
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java
AbstractCodeCreator.findPropertyValueAsIntWithDefault
public int findPropertyValueAsIntWithDefault(String name, int defVal) { return properties().stream() .filter(p->name.equals(p.getName())) .map(CreatorProperty::getLatestValueAsInt) .findFirst().orElse(defVal); }
java
public int findPropertyValueAsIntWithDefault(String name, int defVal) { return properties().stream() .filter(p->name.equals(p.getName())) .map(CreatorProperty::getLatestValueAsInt) .findFirst().orElse(defVal); }
[ "public", "int", "findPropertyValueAsIntWithDefault", "(", "String", "name", ",", "int", "defVal", ")", "{", "return", "properties", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "p", "->", "name", ".", "equals", "(", "p", ".", "getName", "(", ...
Find the integer value of a property or a default if it is not set @param name the property name @param defVal the default value @return the properties integer value or the default
[ "Find", "the", "integer", "value", "of", "a", "property", "or", "a", "default", "if", "it", "is", "not", "set" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/AbstractCodeCreator.java#L177-L182
train
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java
ArduinoLibraryInstaller.getArduinoPathWithDialog
private Optional<String> getArduinoPathWithDialog() { String savedPath = Preferences.userNodeForPackage(ArduinoLibraryInstaller.class) .get(ARDUINO_CUSTOM_PATH, homeDirectory); Path libsPath = Paths.get(savedPath, "libraries"); if (Files.exists(libsPath)) return Optional.of(save...
java
private Optional<String> getArduinoPathWithDialog() { String savedPath = Preferences.userNodeForPackage(ArduinoLibraryInstaller.class) .get(ARDUINO_CUSTOM_PATH, homeDirectory); Path libsPath = Paths.get(savedPath, "libraries"); if (Files.exists(libsPath)) return Optional.of(save...
[ "private", "Optional", "<", "String", ">", "getArduinoPathWithDialog", "(", ")", "{", "String", "savedPath", "=", "Preferences", ".", "userNodeForPackage", "(", "ArduinoLibraryInstaller", ".", "class", ")", ".", "get", "(", "ARDUINO_CUSTOM_PATH", ",", "homeDirectory...
This method will be called internally by the above method when a non standard layout is detected. @return the arduino path wrapped in an optional, or nothing if cancel is pressed.
[ "This", "method", "will", "be", "called", "internally", "by", "the", "above", "method", "when", "a", "non", "standard", "layout", "is", "detected", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java#L132-L146
train
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java
ArduinoLibraryInstaller.findLibraryInstall
public Optional<Path> findLibraryInstall(String libraryName) { return getArduinoDirectory().map(path -> { Path libsDir = path.resolve("libraries"); Path tcMenuDir = libsDir.resolve(libraryName); if (Files.exists(tcMenuDir)) { return tcMenuDir; } ...
java
public Optional<Path> findLibraryInstall(String libraryName) { return getArduinoDirectory().map(path -> { Path libsDir = path.resolve("libraries"); Path tcMenuDir = libsDir.resolve(libraryName); if (Files.exists(tcMenuDir)) { return tcMenuDir; } ...
[ "public", "Optional", "<", "Path", ">", "findLibraryInstall", "(", "String", "libraryName", ")", "{", "return", "getArduinoDirectory", "(", ")", ".", "map", "(", "path", "->", "{", "Path", "libsDir", "=", "path", ".", "resolve", "(", "\"libraries\"", ")", ...
Find the library installation of a specific named library using standard conventions @param libraryName the name of the library @return an optional wrapped path to the library, may be empty if not found.
[ "Find", "the", "library", "installation", "of", "a", "specific", "named", "library", "using", "standard", "conventions" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java#L154-L163
train
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java
ArduinoLibraryInstaller.getVersionOfLibrary
public VersionInfo getVersionOfLibrary(String name, boolean inEmbeddedDir) throws IOException { Path startPath; if(inEmbeddedDir) { startPath = Paths.get(embeddedDirectory, name); } else { Path ardDir = getArduinoDirectory().orElseThrow(IOException::new); ...
java
public VersionInfo getVersionOfLibrary(String name, boolean inEmbeddedDir) throws IOException { Path startPath; if(inEmbeddedDir) { startPath = Paths.get(embeddedDirectory, name); } else { Path ardDir = getArduinoDirectory().orElseThrow(IOException::new); ...
[ "public", "VersionInfo", "getVersionOfLibrary", "(", "String", "name", ",", "boolean", "inEmbeddedDir", ")", "throws", "IOException", "{", "Path", "startPath", ";", "if", "(", "inEmbeddedDir", ")", "{", "startPath", "=", "Paths", ".", "get", "(", "embeddedDirect...
Get the version of a library, either from the packaged version or currently installed depending how it's called. @param name the library name @param inEmbeddedDir true for the packaged version, false for the installed version @return the version of the library or 0.0.0 if it cannot be found. @throws IOException in the ...
[ "Get", "the", "version", "of", "a", "library", "either", "from", "the", "packaged", "version", "or", "currently", "installed", "depending", "how", "it", "s", "called", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java#L187-L208
train
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java
ArduinoLibraryInstaller.isLibraryUpToDate
public boolean isLibraryUpToDate(String name) { Optional<Path> libInst = findLibraryInstall(name); if (!libInst.isPresent()) return false; // can we even find it on the system. try { VersionInfo srcVer = getVersionOfLibrary(name, true); VersionInfo dstVer = getVersionOfL...
java
public boolean isLibraryUpToDate(String name) { Optional<Path> libInst = findLibraryInstall(name); if (!libInst.isPresent()) return false; // can we even find it on the system. try { VersionInfo srcVer = getVersionOfLibrary(name, true); VersionInfo dstVer = getVersionOfL...
[ "public", "boolean", "isLibraryUpToDate", "(", "String", "name", ")", "{", "Optional", "<", "Path", ">", "libInst", "=", "findLibraryInstall", "(", "name", ")", ";", "if", "(", "!", "libInst", ".", "isPresent", "(", ")", ")", "return", "false", ";", "// ...
Check if the named library is the same version or new than the packaged version @param name the library name @return true if newer or the same, false otherwise
[ "Check", "if", "the", "named", "library", "is", "the", "same", "version", "or", "new", "than", "the", "packaged", "version" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java#L215-L226
train
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java
ArduinoLibraryInstaller.copyLibraryFromPackage
public void copyLibraryFromPackage(String libraryName) throws IOException { Path ardDir = getArduinoDirectory().orElseThrow(IOException::new); Path source = Paths.get(embeddedDirectory).resolve(libraryName); Path dest = ardDir.resolve("libraries/" + libraryName); if(!Files.exists(dest))...
java
public void copyLibraryFromPackage(String libraryName) throws IOException { Path ardDir = getArduinoDirectory().orElseThrow(IOException::new); Path source = Paths.get(embeddedDirectory).resolve(libraryName); Path dest = ardDir.resolve("libraries/" + libraryName); if(!Files.exists(dest))...
[ "public", "void", "copyLibraryFromPackage", "(", "String", "libraryName", ")", "throws", "IOException", "{", "Path", "ardDir", "=", "getArduinoDirectory", "(", ")", ".", "orElseThrow", "(", "IOException", "::", "new", ")", ";", "Path", "source", "=", "Paths", ...
Copies the library from the packaged version into the installation directory. @param libraryName the library to copy @throws IOException if the copy could not complete.
[ "Copies", "the", "library", "from", "the", "packaged", "version", "into", "the", "installation", "directory", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java#L233-L248
train
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java
ArduinoLibraryInstaller.copyLibraryRecursive
private void copyLibraryRecursive(Path input, Path output) throws IOException { for (Path dirItem : Files.list(input).collect(Collectors.toList())) { Path outputName = output.resolve(dirItem.getFileName()); if (Files.isDirectory(dirItem)) { if(!Files.exists(outputName)) F...
java
private void copyLibraryRecursive(Path input, Path output) throws IOException { for (Path dirItem : Files.list(input).collect(Collectors.toList())) { Path outputName = output.resolve(dirItem.getFileName()); if (Files.isDirectory(dirItem)) { if(!Files.exists(outputName)) F...
[ "private", "void", "copyLibraryRecursive", "(", "Path", "input", ",", "Path", "output", ")", "throws", "IOException", "{", "for", "(", "Path", "dirItem", ":", "Files", ".", "list", "(", "input", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ...
Recursive copier for the above copy method. It calls recursively for subdirectories to ensure a full copy @param input the directory to copy from @param output the directory to copy to @throws IOException if the copy could not complete.
[ "Recursive", "copier", "for", "the", "above", "copy", "method", ".", "It", "calls", "recursively", "for", "subdirectories", "to", "ensure", "a", "full", "copy" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java#L256-L266
train
davetcc/tcMenu
tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java
MainWindowController.initialise
public void initialise(MenuTree menuTree, RemoteMenuController remoteControl) { this.menuTree = menuTree; this.remoteControl = remoteControl; // we spin up a monitor that counts down changed fields resetting the background colour after a few seconds. executor.scheduleAtFixedRate(this::u...
java
public void initialise(MenuTree menuTree, RemoteMenuController remoteControl) { this.menuTree = menuTree; this.remoteControl = remoteControl; // we spin up a monitor that counts down changed fields resetting the background colour after a few seconds. executor.scheduleAtFixedRate(this::u...
[ "public", "void", "initialise", "(", "MenuTree", "menuTree", ",", "RemoteMenuController", "remoteControl", ")", "{", "this", ".", "menuTree", "=", "menuTree", ";", "this", ".", "remoteControl", "=", "remoteControl", ";", "// we spin up a monitor that counts down changed...
initialise is called by the App to start the application up. In here we register a listener for communication events and start the comms. @param menuTree the tree of menu items @param remoteControl the control that's attached to a remote menu
[ "initialise", "is", "called", "by", "the", "App", "to", "start", "the", "application", "up", ".", "In", "here", "we", "register", "a", "listener", "for", "communication", "events", "and", "start", "the", "comms", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java#L92-L148
train
davetcc/tcMenu
tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java
MainWindowController.buildGrid
private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) { // inset is the amount of offset to apply to the left, to make the tree look realistic // gridPosition is the row in the grid we populating. // while there are more menuitems in the current level for (MenuItem it...
java
private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) { // inset is the amount of offset to apply to the left, to make the tree look realistic // gridPosition is the row in the grid we populating. // while there are more menuitems in the current level for (MenuItem it...
[ "private", "int", "buildGrid", "(", "SubMenuItem", "subMenu", ",", "int", "inset", ",", "int", "gridPosition", ")", "{", "// inset is the amount of offset to apply to the left, to make the tree look realistic", "// gridPosition is the row in the grid we populating.", "// while there ...
Here we go through all the menu items and populate a GridPane with controls to display and edit each item. We start at ROOT and through every item in all submenus. This is a recursive function that is repeatedly called on sub menu's until we've finished all items.
[ "Here", "we", "go", "through", "all", "the", "menu", "items", "and", "populate", "a", "GridPane", "with", "controls", "to", "display", "and", "edit", "each", "item", ".", "We", "start", "at", "ROOT", "and", "through", "every", "item", "in", "all", "subme...
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java#L188-L219
train
davetcc/tcMenu
tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java
MainWindowController.renderItemValue
private void renderItemValue(MenuItem item) { // only proceed if there's a label to be updated.. Label lblForVal = itemIdToLabel.get(item.getId()); if (lblForVal == null) return; // // First we use the visitor again to call the right method in the visitor based on it's type. ...
java
private void renderItemValue(MenuItem item) { // only proceed if there's a label to be updated.. Label lblForVal = itemIdToLabel.get(item.getId()); if (lblForVal == null) return; // // First we use the visitor again to call the right method in the visitor based on it's type. ...
[ "private", "void", "renderItemValue", "(", "MenuItem", "item", ")", "{", "// only proceed if there's a label to be updated..", "Label", "lblForVal", "=", "itemIdToLabel", ".", "get", "(", "item", ".", "getId", "(", ")", ")", ";", "if", "(", "lblForVal", "==", "n...
When there's a change in value for an item, this code takes care of rendering it. @param item the item to render
[ "When", "there", "s", "a", "change", "in", "value", "for", "an", "item", "this", "code", "takes", "care", "of", "rendering", "it", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java#L387-L501
train
davetcc/tcMenu
tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java
MainWindowController.updateConnectionDetails
private void updateConnectionDetails() { Stage stage = (Stage)platformLabel.getScene().getWindow(); connectedLabel.setText(connected ? "YES" : "NO"); remoteInfo.ifPresent(remote -> { remoteNameLabel.setText(remote.getName()); versionLabel.setText(remote.getMajorVersion()...
java
private void updateConnectionDetails() { Stage stage = (Stage)platformLabel.getScene().getWindow(); connectedLabel.setText(connected ? "YES" : "NO"); remoteInfo.ifPresent(remote -> { remoteNameLabel.setText(remote.getName()); versionLabel.setText(remote.getMajorVersion()...
[ "private", "void", "updateConnectionDetails", "(", ")", "{", "Stage", "stage", "=", "(", "Stage", ")", "platformLabel", ".", "getScene", "(", ")", ".", "getWindow", "(", ")", ";", "connectedLabel", ".", "setText", "(", "connected", "?", "\"YES\"", ":", "\"...
When the connectivity changes, we update the fields on the FX thread, we must not update any UI fields on the connection thread.
[ "When", "the", "connectivity", "changes", "we", "update", "the", "fields", "on", "the", "FX", "thread", "we", "must", "not", "update", "any", "UI", "fields", "on", "the", "connection", "thread", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java#L507-L524
train
davetcc/tcMenu
tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoSketchFileAdjuster.java
ArduinoSketchFileAdjuster.makeAdjustments
public void makeAdjustments(Consumer<String> logger, String inoFile, String projectName, List<String> callbacks) throws IOException { this.logger = logger; changed = false; Path source = Paths.get(inoFile); if (!Files.exists(source)) { logger.accept("No existing infoFile, g...
java
public void makeAdjustments(Consumer<String> logger, String inoFile, String projectName, List<String> callbacks) throws IOException { this.logger = logger; changed = false; Path source = Paths.get(inoFile); if (!Files.exists(source)) { logger.accept("No existing infoFile, g...
[ "public", "void", "makeAdjustments", "(", "Consumer", "<", "String", ">", "logger", ",", "String", "inoFile", ",", "String", "projectName", ",", "List", "<", "String", ">", "callbacks", ")", "throws", "IOException", "{", "this", ".", "logger", "=", "logger",...
Is able to update and round trip an ino file for the items that tcMenu needs. Not thread safe, should be created for each run. @param logger a consumer that handles UI logging @param inoFile the file to be modified @param projectName the project name @param callbacks the list of callbacks. @throws IOException in the e...
[ "Is", "able", "to", "update", "and", "round", "trip", "an", "ino", "file", "for", "the", "items", "that", "tcMenu", "needs", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoSketchFileAdjuster.java#L51-L108
train
davetcc/tcMenu
tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/model/FunctionCallBuilder.java
FunctionCallBuilder.requiresHeader
public FunctionCallBuilder requiresHeader(String headerName, boolean useQuotes) { headers.add(new HeaderDefinition(headerName, useQuotes, HeaderDefinition.PRIORITY_NORMAL)); return this; }
java
public FunctionCallBuilder requiresHeader(String headerName, boolean useQuotes) { headers.add(new HeaderDefinition(headerName, useQuotes, HeaderDefinition.PRIORITY_NORMAL)); return this; }
[ "public", "FunctionCallBuilder", "requiresHeader", "(", "String", "headerName", ",", "boolean", "useQuotes", ")", "{", "headers", ".", "add", "(", "new", "HeaderDefinition", "(", "headerName", ",", "useQuotes", ",", "HeaderDefinition", ".", "PRIORITY_NORMAL", ")", ...
Add a requirement that a header file needs to be included for this to work @param headerName the name of the header including .h @param useQuotes true for quotes, false for triangle brackets. @return this for chaining
[ "Add", "a", "requirement", "that", "a", "header", "file", "needs", "to", "be", "included", "for", "this", "to", "work" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuCodePluginApi/src/main/java/com/thecoderscorner/menu/pluginapi/model/FunctionCallBuilder.java#L65-L68
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.addMenuItem
public void addMenuItem(SubMenuItem parent, MenuItem item) { SubMenuItem subMenu = (parent != null) ? parent : ROOT; synchronized (subMenuItems) { ArrayList<MenuItem> subMenuChildren = subMenuItems.computeIfAbsent(subMenu, sm -> new ArrayList<>()); subMenuChildren.add(item); ...
java
public void addMenuItem(SubMenuItem parent, MenuItem item) { SubMenuItem subMenu = (parent != null) ? parent : ROOT; synchronized (subMenuItems) { ArrayList<MenuItem> subMenuChildren = subMenuItems.computeIfAbsent(subMenu, sm -> new ArrayList<>()); subMenuChildren.add(item); ...
[ "public", "void", "addMenuItem", "(", "SubMenuItem", "parent", ",", "MenuItem", "item", ")", "{", "SubMenuItem", "subMenu", "=", "(", "parent", "!=", "null", ")", "?", "parent", ":", "ROOT", ";", "synchronized", "(", "subMenuItems", ")", "{", "ArrayList", ...
add a new menu item to a sub menu, for the top level menu use ROOT. @param parent the submenu where this should appear @param item the item to be added
[ "add", "a", "new", "menu", "item", "to", "a", "sub", "menu", "for", "the", "top", "level", "menu", "use", "ROOT", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L62-L73
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.addOrUpdateItem
public void addOrUpdateItem(int parentId, MenuItem item) { synchronized (subMenuItems) { getSubMenuById(parentId).ifPresent(subMenu-> { if(getMenuItems(subMenu).stream().anyMatch(it-> it.getId() == item.getId())) { replaceMenuById(asSubMenu(subMenu), item); ...
java
public void addOrUpdateItem(int parentId, MenuItem item) { synchronized (subMenuItems) { getSubMenuById(parentId).ifPresent(subMenu-> { if(getMenuItems(subMenu).stream().anyMatch(it-> it.getId() == item.getId())) { replaceMenuById(asSubMenu(subMenu), item); ...
[ "public", "void", "addOrUpdateItem", "(", "int", "parentId", ",", "MenuItem", "item", ")", "{", "synchronized", "(", "subMenuItems", ")", "{", "getSubMenuById", "(", "parentId", ")", ".", "ifPresent", "(", "subMenu", "->", "{", "if", "(", "getMenuItems", "("...
This will either add or update an existing item, depending if the ID is already present. @param parentId the parent where it should be placed / already exists @param item the item to either add or update.
[ "This", "will", "either", "add", "or", "update", "an", "existing", "item", "depending", "if", "the", "ID", "is", "already", "present", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L80-L91
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.getSubMenuById
public Optional<SubMenuItem> getSubMenuById(int parentId) { return getAllSubMenus().stream().filter(subMenu->subMenu.getId() == parentId).map(m->(SubMenuItem)m).findFirst(); }
java
public Optional<SubMenuItem> getSubMenuById(int parentId) { return getAllSubMenus().stream().filter(subMenu->subMenu.getId() == parentId).map(m->(SubMenuItem)m).findFirst(); }
[ "public", "Optional", "<", "SubMenuItem", ">", "getSubMenuById", "(", "int", "parentId", ")", "{", "return", "getAllSubMenus", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "subMenu", "->", "subMenu", ".", "getId", "(", ")", "==", "parentId", ")...
gets a submenu by it's ID. Returns an optional that will be empty when not present @param parentId the parent to obtain @return an optional that will be populated when present with the sub menu.
[ "gets", "a", "submenu", "by", "it", "s", "ID", ".", "Returns", "an", "optional", "that", "will", "be", "empty", "when", "not", "present" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L98-L100
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.getMenuById
public Optional<MenuItem> getMenuById(SubMenuItem root, int id) { return getMenuItems(root).stream().filter(item -> item.getId() == id).findFirst(); }
java
public Optional<MenuItem> getMenuById(SubMenuItem root, int id) { return getMenuItems(root).stream().filter(item -> item.getId() == id).findFirst(); }
[ "public", "Optional", "<", "MenuItem", ">", "getMenuById", "(", "SubMenuItem", "root", ",", "int", "id", ")", "{", "return", "getMenuItems", "(", "root", ")", ".", "stream", "(", ")", ".", "filter", "(", "item", "->", "item", ".", "getId", "(", ")", ...
Gets the menu item with the specified ID, in a given submenu. If you don't know the sub menu call the findMenuItem to obtain the parent. @param root the sub menu @param id the id of the object to find. @return
[ "Gets", "the", "menu", "item", "with", "the", "specified", "ID", "in", "a", "given", "submenu", ".", "If", "you", "don", "t", "know", "the", "sub", "menu", "call", "the", "findMenuItem", "to", "obtain", "the", "parent", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L109-L111
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.replaceMenuById
public void replaceMenuById(SubMenuItem subMenu, MenuItem toReplace) { synchronized (subMenuItems) { ArrayList<MenuItem> list = subMenuItems.get(subMenu); int idx = -1; for (int i = 0; i < list.size(); ++i) { if (list.get(i).getId() == toReplace.getId()) { ...
java
public void replaceMenuById(SubMenuItem subMenu, MenuItem toReplace) { synchronized (subMenuItems) { ArrayList<MenuItem> list = subMenuItems.get(subMenu); int idx = -1; for (int i = 0; i < list.size(); ++i) { if (list.get(i).getId() == toReplace.getId()) { ...
[ "public", "void", "replaceMenuById", "(", "SubMenuItem", "subMenu", ",", "MenuItem", "toReplace", ")", "{", "synchronized", "(", "subMenuItems", ")", "{", "ArrayList", "<", "MenuItem", ">", "list", "=", "subMenuItems", ".", "get", "(", "subMenu", ")", ";", "...
Replace the menu item that has a given parent with the one provided @param subMenu the parent @param toReplace the menu item to replace by ID
[ "Replace", "the", "menu", "item", "that", "has", "a", "given", "parent", "with", "the", "one", "provided" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L129-L148
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.moveItem
public void moveItem(SubMenuItem parent, MenuItem newItem, MoveType moveType) { synchronized (subMenuItems) { ArrayList<MenuItem> items = subMenuItems.get(parent); int idx = items.indexOf(newItem); if(idx < 0) return; items.remove(idx); idx = (moveTy...
java
public void moveItem(SubMenuItem parent, MenuItem newItem, MoveType moveType) { synchronized (subMenuItems) { ArrayList<MenuItem> items = subMenuItems.get(parent); int idx = items.indexOf(newItem); if(idx < 0) return; items.remove(idx); idx = (moveTy...
[ "public", "void", "moveItem", "(", "SubMenuItem", "parent", ",", "MenuItem", "newItem", ",", "MoveType", "moveType", ")", "{", "synchronized", "(", "subMenuItems", ")", "{", "ArrayList", "<", "MenuItem", ">", "items", "=", "subMenuItems", ".", "get", "(", "p...
Moves the item either up or down in the list for that submenu @param parent the parent id @param newItem the item to move @param moveType the direction of the move.
[ "Moves", "the", "item", "either", "up", "or", "down", "in", "the", "list", "for", "that", "submenu" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L156-L174
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.findParent
public SubMenuItem findParent(MenuItem toFind) { synchronized (subMenuItems) { SubMenuItem parent = MenuTree.ROOT; for (Map.Entry<MenuItem, ArrayList<MenuItem>> entry : subMenuItems.entrySet()) { for (MenuItem item : entry.getValue()) { if (item.getId(...
java
public SubMenuItem findParent(MenuItem toFind) { synchronized (subMenuItems) { SubMenuItem parent = MenuTree.ROOT; for (Map.Entry<MenuItem, ArrayList<MenuItem>> entry : subMenuItems.entrySet()) { for (MenuItem item : entry.getValue()) { if (item.getId(...
[ "public", "SubMenuItem", "findParent", "(", "MenuItem", "toFind", ")", "{", "synchronized", "(", "subMenuItems", ")", "{", "SubMenuItem", "parent", "=", "MenuTree", ".", "ROOT", ";", "for", "(", "Map", ".", "Entry", "<", "MenuItem", ",", "ArrayList", "<", ...
Finds the submenu that the provided object belongs to. @param toFind the object to find sub menu for. @return the submenu
[ "Finds", "the", "submenu", "that", "the", "provided", "object", "belongs", "to", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L191-L203
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.removeMenuItem
public void removeMenuItem(SubMenuItem parent, MenuItem item) { SubMenuItem subMenu = (parent != null) ? parent : ROOT; synchronized (subMenuItems) { ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu); if (subMenuChildren == null) { throw new Unsuppo...
java
public void removeMenuItem(SubMenuItem parent, MenuItem item) { SubMenuItem subMenu = (parent != null) ? parent : ROOT; synchronized (subMenuItems) { ArrayList<MenuItem> subMenuChildren = subMenuItems.get(subMenu); if (subMenuChildren == null) { throw new Unsuppo...
[ "public", "void", "removeMenuItem", "(", "SubMenuItem", "parent", ",", "MenuItem", "item", ")", "{", "SubMenuItem", "subMenu", "=", "(", "parent", "!=", "null", ")", "?", "parent", ":", "ROOT", ";", "synchronized", "(", "subMenuItems", ")", "{", "ArrayList",...
Remove the menu item for the provided menu item in the provided sub menu. @param parent the submenu to search @param item the item to remove (Search By ID)
[ "Remove", "the", "menu", "item", "for", "the", "provided", "menu", "item", "in", "the", "provided", "sub", "menu", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L210-L225
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.getMenuItems
public List<MenuItem> getMenuItems(MenuItem item) { synchronized (subMenuItems) { ArrayList<MenuItem> menuItems = subMenuItems.get(item); return menuItems == null ? null : Collections.unmodifiableList(menuItems); } }
java
public List<MenuItem> getMenuItems(MenuItem item) { synchronized (subMenuItems) { ArrayList<MenuItem> menuItems = subMenuItems.get(item); return menuItems == null ? null : Collections.unmodifiableList(menuItems); } }
[ "public", "List", "<", "MenuItem", ">", "getMenuItems", "(", "MenuItem", "item", ")", "{", "synchronized", "(", "subMenuItems", ")", "{", "ArrayList", "<", "MenuItem", ">", "menuItems", "=", "subMenuItems", ".", "get", "(", "item", ")", ";", "return", "men...
Get a list of all menu items for a given submenu @param item the submenu to use @return a list of submenu items that's immutable
[ "Get", "a", "list", "of", "all", "menu", "items", "for", "a", "given", "submenu" ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L242-L247
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.changeItem
public <T> void changeItem(MenuItem<T> item, MenuState<T> menuState) { menuStates.put(item.getId(), menuState); }
java
public <T> void changeItem(MenuItem<T> item, MenuState<T> menuState) { menuStates.put(item.getId(), menuState); }
[ "public", "<", "T", ">", "void", "changeItem", "(", "MenuItem", "<", "T", ">", "item", ",", "MenuState", "<", "T", ">", "menuState", ")", "{", "menuStates", ".", "put", "(", "item", ".", "getId", "(", ")", ",", "menuState", ")", ";", "}" ]
Change the value that's associated with a menu item. if you are changing a value, just send a command to the device, it will automatically update the tree. @param item the item to change @param menuState the new state @param <T> the type of the state, picked up automatically
[ "Change", "the", "value", "that", "s", "associated", "with", "a", "menu", "item", ".", "if", "you", "are", "changing", "a", "value", "just", "send", "a", "command", "to", "the", "device", "it", "will", "automatically", "update", "the", "tree", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L258-L260
train
davetcc/tcMenu
tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java
MenuTree.getMenuState
@SuppressWarnings("unchecked") public <T> MenuState<T> getMenuState(MenuItem<T> item) { return (MenuState<T>) menuStates.get(item.getId()); }
java
@SuppressWarnings("unchecked") public <T> MenuState<T> getMenuState(MenuItem<T> item) { return (MenuState<T>) menuStates.get(item.getId()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "MenuState", "<", "T", ">", "getMenuState", "(", "MenuItem", "<", "T", ">", "item", ")", "{", "return", "(", "MenuState", "<", "T", ">", ")", "menuStates", ".", "get", "(", ...
Gets the menu state that's associated with a given menu item. This is the current value for the menu item. @param item the item which the state belongs to @param <T> determined automatically @return the state for the given menu item
[ "Gets", "the", "menu", "state", "that", "s", "associated", "with", "a", "given", "menu", "item", ".", "This", "is", "the", "current", "value", "for", "the", "menu", "item", "." ]
61546e4b982b25ceaff384073fe9ec1fff55e64a
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L269-L272
train
itfsw/QueryBuilder
src/main/java/com/itfsw/query/builder/support/utils/spring/NumberUtils.java
NumberUtils.convertNumberToTargetClass
@SuppressWarnings("unchecked") public static <T extends Number> T convertNumberToTargetClass(Number number, Class<T> targetClass) throws IllegalArgumentException { Assert.notNull(number, "Number must not be null"); Assert.notNull(targetClass, "Target class must not be null"); i...
java
@SuppressWarnings("unchecked") public static <T extends Number> T convertNumberToTargetClass(Number number, Class<T> targetClass) throws IllegalArgumentException { Assert.notNull(number, "Number must not be null"); Assert.notNull(targetClass, "Target class must not be null"); i...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Number", ">", "T", "convertNumberToTargetClass", "(", "Number", "number", ",", "Class", "<", "T", ">", "targetClass", ")", "throws", "IllegalArgumentException", "{", "A...
Convert the given number into an instance of the given target class. @param number the number to convert @param targetClass the target class to convert to @return the converted number @throws IllegalArgumentException if the target class is not supported (i.e. not a standard Number subclass as included in the JDK) ...
[ "Convert", "the", "given", "number", "into", "an", "instance", "of", "the", "given", "target", "class", "." ]
231dc9a334d54cf98755cfcb236202201ddee162
https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/support/utils/spring/NumberUtils.java#L78-L128
train
itfsw/QueryBuilder
src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java
AbstractQueryBuilderFactory.addFilterBefore
public void addFilterBefore(IRuleFilter filter, Class<? extends IRuleFilter> beforeFilter) { int index = getIndexOfClass(filters, beforeFilter); if (index == -1) { throw new FilterAddException("filter " + beforeFilter.getSimpleName() + " has not been added"); } filters.add(in...
java
public void addFilterBefore(IRuleFilter filter, Class<? extends IRuleFilter> beforeFilter) { int index = getIndexOfClass(filters, beforeFilter); if (index == -1) { throw new FilterAddException("filter " + beforeFilter.getSimpleName() + " has not been added"); } filters.add(in...
[ "public", "void", "addFilterBefore", "(", "IRuleFilter", "filter", ",", "Class", "<", "?", "extends", "IRuleFilter", ">", "beforeFilter", ")", "{", "int", "index", "=", "getIndexOfClass", "(", "filters", ",", "beforeFilter", ")", ";", "if", "(", "index", "==...
add filter before @param filter @param beforeFilter
[ "add", "filter", "before" ]
231dc9a334d54cf98755cfcb236202201ddee162
https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java#L77-L83
train
itfsw/QueryBuilder
src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java
AbstractQueryBuilderFactory.addFilterAfter
public void addFilterAfter(IRuleFilter filter, Class<? extends IRuleFilter> afterFilter) { int index = getIndexOfClass(filters, afterFilter); if (index == -1) { throw new FilterAddException("filter " + afterFilter.getSimpleName() + " has not been added"); } filters.add(index ...
java
public void addFilterAfter(IRuleFilter filter, Class<? extends IRuleFilter> afterFilter) { int index = getIndexOfClass(filters, afterFilter); if (index == -1) { throw new FilterAddException("filter " + afterFilter.getSimpleName() + " has not been added"); } filters.add(index ...
[ "public", "void", "addFilterAfter", "(", "IRuleFilter", "filter", ",", "Class", "<", "?", "extends", "IRuleFilter", ">", "afterFilter", ")", "{", "int", "index", "=", "getIndexOfClass", "(", "filters", ",", "afterFilter", ")", ";", "if", "(", "index", "==", ...
add filter after @param filter @param afterFilter
[ "add", "filter", "after" ]
231dc9a334d54cf98755cfcb236202201ddee162
https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java#L90-L96
train
itfsw/QueryBuilder
src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java
AbstractQueryBuilderFactory.addRuleParserBefore
public void addRuleParserBefore(IRuleParser parser, Class<? extends IRuleParser> beforeParser) { int index = getIndexOfClass(ruleParsers, beforeParser); if (index == -1) { throw new ParserAddException("parser " + beforeParser.getSimpleName() + " has not been added"); } rulePa...
java
public void addRuleParserBefore(IRuleParser parser, Class<? extends IRuleParser> beforeParser) { int index = getIndexOfClass(ruleParsers, beforeParser); if (index == -1) { throw new ParserAddException("parser " + beforeParser.getSimpleName() + " has not been added"); } rulePa...
[ "public", "void", "addRuleParserBefore", "(", "IRuleParser", "parser", ",", "Class", "<", "?", "extends", "IRuleParser", ">", "beforeParser", ")", "{", "int", "index", "=", "getIndexOfClass", "(", "ruleParsers", ",", "beforeParser", ")", ";", "if", "(", "index...
add parser before @param parser @param beforeParser
[ "add", "parser", "before" ]
231dc9a334d54cf98755cfcb236202201ddee162
https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java#L125-L131
train
itfsw/QueryBuilder
src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java
AbstractQueryBuilderFactory.addRuleParserAfter
public void addRuleParserAfter(IRuleParser parser, Class<? extends IRuleParser> afterParser) { int index = getIndexOfClass(ruleParsers, afterParser); if (index == -1) { throw new ParserAddException("parser " + afterParser.getSimpleName() + " has not been added"); } ruleParser...
java
public void addRuleParserAfter(IRuleParser parser, Class<? extends IRuleParser> afterParser) { int index = getIndexOfClass(ruleParsers, afterParser); if (index == -1) { throw new ParserAddException("parser " + afterParser.getSimpleName() + " has not been added"); } ruleParser...
[ "public", "void", "addRuleParserAfter", "(", "IRuleParser", "parser", ",", "Class", "<", "?", "extends", "IRuleParser", ">", "afterParser", ")", "{", "int", "index", "=", "getIndexOfClass", "(", "ruleParsers", ",", "afterParser", ")", ";", "if", "(", "index", ...
add parser after @param parser @param afterParser
[ "add", "parser", "after" ]
231dc9a334d54cf98755cfcb236202201ddee162
https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java#L138-L144
train
itfsw/QueryBuilder
src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java
AbstractQueryBuilderFactory.getIndexOfClass
private int getIndexOfClass(List list, Class cls) { for (int i = 0; i < list.size(); i++) { if (list.get(i).getClass().equals(cls)) { return i; } } return -1; }
java
private int getIndexOfClass(List list, Class cls) { for (int i = 0; i < list.size(); i++) { if (list.get(i).getClass().equals(cls)) { return i; } } return -1; }
[ "private", "int", "getIndexOfClass", "(", "List", "list", ",", "Class", "cls", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "list", ".", "get", "(", "i", ")", ...
get class index of list @param list @param cls @return
[ "get", "class", "index", "of", "list" ]
231dc9a334d54cf98755cfcb236202201ddee162
https://github.com/itfsw/QueryBuilder/blob/231dc9a334d54cf98755cfcb236202201ddee162/src/main/java/com/itfsw/query/builder/AbstractQueryBuilderFactory.java#L203-L210
train
arquillian/arquillian-container-chameleon
arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/AnnotationExtractor.java
AnnotationExtractor.findAndSortAnnotations
static Annotation[] findAndSortAnnotations(Annotation annotation) { final Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); Arrays.sort(metaAnnotations, new Comparator<Annotation>() { @Override public int compare(Annotation o1, Annotation o2) { ...
java
static Annotation[] findAndSortAnnotations(Annotation annotation) { final Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); Arrays.sort(metaAnnotations, new Comparator<Annotation>() { @Override public int compare(Annotation o1, Annotation o2) { ...
[ "static", "Annotation", "[", "]", "findAndSortAnnotations", "(", "Annotation", "annotation", ")", "{", "final", "Annotation", "[", "]", "metaAnnotations", "=", "annotation", ".", "annotationType", "(", ")", ".", "getAnnotations", "(", ")", ";", "Arrays", ".", ...
We need to sort annotations so the first one processed is ChameleonTarget so these properties has bigger preference that the inherit ones. @param annotation @return
[ "We", "need", "to", "sort", "annotations", "so", "the", "first", "one", "processed", "is", "ChameleonTarget", "so", "these", "properties", "has", "bigger", "preference", "that", "the", "inherit", "ones", "." ]
7e9bbd3eaab9b5dfab1fa6ffd8fb16c39b7cc856
https://github.com/arquillian/arquillian-container-chameleon/blob/7e9bbd3eaab9b5dfab1fa6ffd8fb16c39b7cc856/arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/AnnotationExtractor.java#L40-L58
train
arquillian/arquillian-container-chameleon
arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/ChameleonTargetConfiguration.java
ChameleonTargetConfiguration.importConfiguration
public ChameleonTargetConfiguration importConfiguration(ChameleonTargetConfiguration other) { if (this.container == null || this.container.isEmpty()) { this.container = other.getContainer(); } if (this.version == null || this.version.isEmpty()) { this.version = other.ge...
java
public ChameleonTargetConfiguration importConfiguration(ChameleonTargetConfiguration other) { if (this.container == null || this.container.isEmpty()) { this.container = other.getContainer(); } if (this.version == null || this.version.isEmpty()) { this.version = other.ge...
[ "public", "ChameleonTargetConfiguration", "importConfiguration", "(", "ChameleonTargetConfiguration", "other", ")", "{", "if", "(", "this", ".", "container", "==", "null", "||", "this", ".", "container", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "containe...
This methods copies attribute values that are not set in this object other object @param other object where attribute values are copied in case of not set in this object @return this object with new attribute values set
[ "This", "methods", "copies", "attribute", "values", "that", "are", "not", "set", "in", "this", "object", "other", "object" ]
7e9bbd3eaab9b5dfab1fa6ffd8fb16c39b7cc856
https://github.com/arquillian/arquillian-container-chameleon/blob/7e9bbd3eaab9b5dfab1fa6ffd8fb16c39b7cc856/arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/ChameleonTargetConfiguration.java#L89-L112
train
arquillian/arquillian-container-chameleon
arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/ArquillianChameleon.java
ArquillianChameleon.createChameleonMarkerFile
private void createChameleonMarkerFile(Path parent) throws IOException { final Path chameleon = parent.resolve("chameleonrunner"); Files.write(chameleon, "Chameleon Runner was there".getBytes()); }
java
private void createChameleonMarkerFile(Path parent) throws IOException { final Path chameleon = parent.resolve("chameleonrunner"); Files.write(chameleon, "Chameleon Runner was there".getBytes()); }
[ "private", "void", "createChameleonMarkerFile", "(", "Path", "parent", ")", "throws", "IOException", "{", "final", "Path", "chameleon", "=", "parent", ".", "resolve", "(", "\"chameleonrunner\"", ")", ";", "Files", ".", "write", "(", "chameleon", ",", "\"Chameleo...
representing different versions, because then you have uncertainty on which configuration file is really used
[ "representing", "different", "versions", "because", "then", "you", "have", "uncertainty", "on", "which", "configuration", "file", "is", "really", "used" ]
7e9bbd3eaab9b5dfab1fa6ffd8fb16c39b7cc856
https://github.com/arquillian/arquillian-container-chameleon/blob/7e9bbd3eaab9b5dfab1fa6ffd8fb16c39b7cc856/arquillian-chameleon-runner/runner/src/main/java/org/arquillian/container/chameleon/runner/ArquillianChameleon.java#L55-L58
train
gpedro/slack-webhook
src/main/java/net/gpedro/integrations/slack/SlackMessage.java
SlackMessage.prepare
public JsonObject prepare() { if (channel != null) { slackMessage.addProperty(CHANNEL, channel); } if (username != null) { slackMessage.addProperty(USERNAME, username); } if (icon != null) { if (icon.contains(HTTP)) { slackMessage.addProperty(ICON_URL, icon); } else { slackMessage.addPro...
java
public JsonObject prepare() { if (channel != null) { slackMessage.addProperty(CHANNEL, channel); } if (username != null) { slackMessage.addProperty(USERNAME, username); } if (icon != null) { if (icon.contains(HTTP)) { slackMessage.addProperty(ICON_URL, icon); } else { slackMessage.addPro...
[ "public", "JsonObject", "prepare", "(", ")", "{", "if", "(", "channel", "!=", "null", ")", "{", "slackMessage", ".", "addProperty", "(", "CHANNEL", ",", "channel", ")", ";", "}", "if", "(", "username", "!=", "null", ")", "{", "slackMessage", ".", "addP...
Convert SlackMessage to JSON @return JsonObject
[ "Convert", "SlackMessage", "to", "JSON" ]
bcb855e94165d363b7594ad88124ee4e3691dd55
https://github.com/gpedro/slack-webhook/blob/bcb855e94165d363b7594ad88124ee4e3691dd55/src/main/java/net/gpedro/integrations/slack/SlackMessage.java#L69-L101
train
binaryfoo/emv-bertlv
src/main/java/io/github/binaryfoo/tlv/ISOUtil.java
ISOUtil.dumpString
public static String dumpString(byte[] b) { StringBuilder d = new StringBuilder(b.length * 2); for (byte aB : b) { char c = (char) aB; if (Character.isISOControl(c)) { switch (c) { case '\r': d.append("{CR}"); break; case '\n': d.append...
java
public static String dumpString(byte[] b) { StringBuilder d = new StringBuilder(b.length * 2); for (byte aB : b) { char c = (char) aB; if (Character.isISOControl(c)) { switch (c) { case '\r': d.append("{CR}"); break; case '\n': d.append...
[ "public", "static", "String", "dumpString", "(", "byte", "[", "]", "b", ")", "{", "StringBuilder", "d", "=", "new", "StringBuilder", "(", "b", ".", "length", "*", "2", ")", ";", "for", "(", "byte", "aB", ":", "b", ")", "{", "char", "c", "=", "(",...
converts a byte array to printable characters @param b - byte array @return String representation
[ "converts", "a", "byte", "array", "to", "printable", "characters" ]
d49a1801f314f10714b50c292366634f7fe15d93
https://github.com/binaryfoo/emv-bertlv/blob/d49a1801f314f10714b50c292366634f7fe15d93/src/main/java/io/github/binaryfoo/tlv/ISOUtil.java#L89-L115
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/conditions/Disjunction.java
Disjunction.add
public Disjunction add( IDisjunct disjunct) { for( Iterator<IAssertion> assertions = disjunct.getAssertions(); assertions.hasNext();) { add( assertions.next()); } return this; }
java
public Disjunction add( IDisjunct disjunct) { for( Iterator<IAssertion> assertions = disjunct.getAssertions(); assertions.hasNext();) { add( assertions.next()); } return this; }
[ "public", "Disjunction", "add", "(", "IDisjunct", "disjunct", ")", "{", "for", "(", "Iterator", "<", "IAssertion", ">", "assertions", "=", "disjunct", ".", "getAssertions", "(", ")", ";", "assertions", ".", "hasNext", "(", ")", ";", ")", "{", "add", "(",...
Adds all assertions for the given IDisjunct to this disjunction.
[ "Adds", "all", "assertions", "for", "the", "given", "IDisjunct", "to", "this", "disjunction", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Disjunction.java#L109-L117
train
Cornutum/tcases
tcases-openapi/src/main/java/org/cornutum/tcases/openapi/FormattedString.java
FormattedString.of
public static FormattedString of( String format, Object object) { return object == null? new Null() : "binary".equals( format)? new Base64( (byte[]) object) : "byte".equals( format)? new Base64( (byte[]) object) : "date".equals( format)? new D...
java
public static FormattedString of( String format, Object object) { return object == null? new Null() : "binary".equals( format)? new Base64( (byte[]) object) : "byte".equals( format)? new Base64( (byte[]) object) : "date".equals( format)? new D...
[ "public", "static", "FormattedString", "of", "(", "String", "format", ",", "Object", "object", ")", "{", "return", "object", "==", "null", "?", "new", "Null", "(", ")", ":", "\"binary\"", ".", "equals", "(", "format", ")", "?", "new", "Base64", "(", "(...
Creates a FormattedString for the given object.
[ "Creates", "a", "FormattedString", "for", "the", "given", "object", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-openapi/src/main/java/org/cornutum/tcases/openapi/FormattedString.java#L23-L45
train
Cornutum/tcases
tcases-openapi/src/main/java/org/cornutum/tcases/openapi/FormattedString.java
FormattedString.of
public static List<FormattedString> of( String format, List<?> objects) { return objects.stream().map( object -> of( format, object)).collect( toList()); }
java
public static List<FormattedString> of( String format, List<?> objects) { return objects.stream().map( object -> of( format, object)).collect( toList()); }
[ "public", "static", "List", "<", "FormattedString", ">", "of", "(", "String", "format", ",", "List", "<", "?", ">", "objects", ")", "{", "return", "objects", ".", "stream", "(", ")", ".", "map", "(", "object", "->", "of", "(", "format", ",", "object"...
Creates a FormattedString for each of the given objects.
[ "Creates", "a", "FormattedString", "for", "each", "of", "the", "given", "objects", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-openapi/src/main/java/org/cornutum/tcases/openapi/FormattedString.java#L50-L53
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java
SystemInputDocWriter.write
public void write( SystemInputDef systemInput) { xmlWriter_.writeDeclaration(); xmlWriter_ .element( SYSTEM_TAG) .attribute( NAME_ATR, systemInput.getName()) .content( () -> { writeAnnotations( systemInput); toStream( systemInput.getFunctionInputDefs()).forEach( th...
java
public void write( SystemInputDef systemInput) { xmlWriter_.writeDeclaration(); xmlWriter_ .element( SYSTEM_TAG) .attribute( NAME_ATR, systemInput.getName()) .content( () -> { writeAnnotations( systemInput); toStream( systemInput.getFunctionInputDefs()).forEach( th...
[ "public", "void", "write", "(", "SystemInputDef", "systemInput", ")", "{", "xmlWriter_", ".", "writeDeclaration", "(", ")", ";", "xmlWriter_", ".", "element", "(", "SYSTEM_TAG", ")", ".", "attribute", "(", "NAME_ATR", ",", "systemInput", ".", "getName", "(", ...
Writes the given system test definition the form of an XML document.
[ "Writes", "the", "given", "system", "test", "definition", "the", "form", "of", "an", "XML", "document", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java#L56-L69
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java
SystemInputDocWriter.writeFunction
protected void writeFunction( FunctionInputDef function) { xmlWriter_ .element( FUNCTION_TAG) .attribute( NAME_ATR, function.getName()) .content( () -> { writeAnnotations( function); for( String varType : function.getVarTypes()) { writeInputs( ...
java
protected void writeFunction( FunctionInputDef function) { xmlWriter_ .element( FUNCTION_TAG) .attribute( NAME_ATR, function.getName()) .content( () -> { writeAnnotations( function); for( String varType : function.getVarTypes()) { writeInputs( ...
[ "protected", "void", "writeFunction", "(", "FunctionInputDef", "function", ")", "{", "xmlWriter_", ".", "element", "(", "FUNCTION_TAG", ")", ".", "attribute", "(", "NAME_ATR", ",", "function", ".", "getName", "(", ")", ")", ".", "content", "(", "(", ")", "...
Writes the given function input definition.
[ "Writes", "the", "given", "function", "input", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java#L74-L92
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java
SystemInputDocWriter.writeInputs
protected void writeInputs( String varType, Stream<IVarDef> varDefs) { xmlWriter_ .element( INPUT_TAG) .attribute( TYPE_ATR, varType) .content( () -> varDefs.forEach( this::writeVarDef)) .write(); }
java
protected void writeInputs( String varType, Stream<IVarDef> varDefs) { xmlWriter_ .element( INPUT_TAG) .attribute( TYPE_ATR, varType) .content( () -> varDefs.forEach( this::writeVarDef)) .write(); }
[ "protected", "void", "writeInputs", "(", "String", "varType", ",", "Stream", "<", "IVarDef", ">", "varDefs", ")", "{", "xmlWriter_", ".", "element", "(", "INPUT_TAG", ")", ".", "attribute", "(", "TYPE_ATR", ",", "varType", ")", ".", "content", "(", "(", ...
Writes the given input variable list.
[ "Writes", "the", "given", "input", "variable", "list", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java#L97-L104
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java
SystemInputDocWriter.writeVarDef
protected void writeVarDef( IVarDef varDef) { Stream<VarValueDef> values = varDef.getValues() == null ? null : toStream( varDef.getValues()); Stream<IVarDef> members = varDef.getMembers() == null ? null : toStream( varDef.getMembers()); String varTag = member...
java
protected void writeVarDef( IVarDef varDef) { Stream<VarValueDef> values = varDef.getValues() == null ? null : toStream( varDef.getValues()); Stream<IVarDef> members = varDef.getMembers() == null ? null : toStream( varDef.getMembers()); String varTag = member...
[ "protected", "void", "writeVarDef", "(", "IVarDef", "varDef", ")", "{", "Stream", "<", "VarValueDef", ">", "values", "=", "varDef", ".", "getValues", "(", ")", "==", "null", "?", "null", ":", "toStream", "(", "varDef", ".", "getValues", "(", ")", ")", ...
Writes the given variable definition.
[ "Writes", "the", "given", "variable", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java#L109-L146
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java
SystemInputDocWriter.writeValue
protected void writeValue( VarValueDef value) { ConditionWriter conditionWriter = new ConditionWriter( value.getCondition()); xmlWriter_ .element( VALUE_TAG) .attribute( NAME_ATR, String.valueOf( value.getName())) .attributeIf( value.getType() == FAILURE, FAILURE_ATR, "true") .attri...
java
protected void writeValue( VarValueDef value) { ConditionWriter conditionWriter = new ConditionWriter( value.getCondition()); xmlWriter_ .element( VALUE_TAG) .attribute( NAME_ATR, String.valueOf( value.getName())) .attributeIf( value.getType() == FAILURE, FAILURE_ATR, "true") .attri...
[ "protected", "void", "writeValue", "(", "VarValueDef", "value", ")", "{", "ConditionWriter", "conditionWriter", "=", "new", "ConditionWriter", "(", "value", ".", "getCondition", "(", ")", ")", ";", "xmlWriter_", ".", "element", "(", "VALUE_TAG", ")", ".", "att...
Writes the given variable input value definition.
[ "Writes", "the", "given", "variable", "input", "value", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java#L151-L166
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java
SystemInputDocWriter.writeAnnotations
protected void writeAnnotations( IAnnotated annotated) { toStream( annotated.getAnnotations()) .sorted() .forEach( annotation -> { xmlWriter_ .element( HAS_TAG) .attribute( NAME_ATR, annotation) .attribute( VALUE_ATR, annotated.getAnnotation( annotation)) ...
java
protected void writeAnnotations( IAnnotated annotated) { toStream( annotated.getAnnotations()) .sorted() .forEach( annotation -> { xmlWriter_ .element( HAS_TAG) .attribute( NAME_ATR, annotation) .attribute( VALUE_ATR, annotated.getAnnotation( annotation)) ...
[ "protected", "void", "writeAnnotations", "(", "IAnnotated", "annotated", ")", "{", "toStream", "(", "annotated", ".", "getAnnotations", "(", ")", ")", ".", "sorted", "(", ")", ".", "forEach", "(", "annotation", "->", "{", "xmlWriter_", ".", "element", "(", ...
Writes the given annotation definitions.
[ "Writes", "the", "given", "annotation", "definitions", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/SystemInputDocWriter.java#L171-L182
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conjunction.java
Conjunction.append
public Conjunction append( IConjunct conjunct) { for( Iterator<IDisjunct> disjuncts = conjunct.getDisjuncts(); disjuncts.hasNext(); add( disjuncts.next())); return this; }
java
public Conjunction append( IConjunct conjunct) { for( Iterator<IDisjunct> disjuncts = conjunct.getDisjuncts(); disjuncts.hasNext(); add( disjuncts.next())); return this; }
[ "public", "Conjunction", "append", "(", "IConjunct", "conjunct", ")", "{", "for", "(", "Iterator", "<", "IDisjunct", ">", "disjuncts", "=", "conjunct", ".", "getDisjuncts", "(", ")", ";", "disjuncts", ".", "hasNext", "(", ")", ";", "add", "(", "disjuncts",...
Appends another conjunction to this conjunction.
[ "Appends", "another", "conjunction", "to", "this", "conjunction", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Conjunction.java#L101-L107
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java
DefUtils.assertIdentifier
public static void assertIdentifier( String id) throws IllegalArgumentException { if( !isIdentifier( id)) { throw new IllegalArgumentException ( (id==null? "null" : ("\"" + String.valueOf( id) + "\"")) + " is not a valid identifier"); } }
java
public static void assertIdentifier( String id) throws IllegalArgumentException { if( !isIdentifier( id)) { throw new IllegalArgumentException ( (id==null? "null" : ("\"" + String.valueOf( id) + "\"")) + " is not a valid identifier"); } }
[ "public", "static", "void", "assertIdentifier", "(", "String", "id", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "isIdentifier", "(", "id", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "(", "id", "==", "null", "?", "\"n...
Throws an exception if the given string is not a valid identifier.
[ "Throws", "an", "exception", "if", "the", "given", "string", "is", "not", "a", "valid", "identifier", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java#L47-L56
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java
DefUtils.isVarValue
public static boolean isVarValue( Object val) { return val == null || !val.getClass().equals( String.class) || varValueRegex_.matcher( val.toString()).matches(); }
java
public static boolean isVarValue( Object val) { return val == null || !val.getClass().equals( String.class) || varValueRegex_.matcher( val.toString()).matches(); }
[ "public", "static", "boolean", "isVarValue", "(", "Object", "val", ")", "{", "return", "val", "==", "null", "||", "!", "val", ".", "getClass", "(", ")", ".", "equals", "(", "String", ".", "class", ")", "||", "varValueRegex_", ".", "matcher", "(", "val"...
Returns true if the given string is a valid variable value.
[ "Returns", "true", "if", "the", "given", "string", "is", "a", "valid", "variable", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java#L61-L67
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java
DefUtils.assertVarValue
public static void assertVarValue( Object val) throws IllegalArgumentException { if( !isVarValue( val)) { throw new IllegalArgumentException( "\"" + String.valueOf( val) + "\"" + " is not a valid variable value"); } }
java
public static void assertVarValue( Object val) throws IllegalArgumentException { if( !isVarValue( val)) { throw new IllegalArgumentException( "\"" + String.valueOf( val) + "\"" + " is not a valid variable value"); } }
[ "public", "static", "void", "assertVarValue", "(", "Object", "val", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "isVarValue", "(", "val", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"\\\"\"", "+", "String", ".", "value...
Throws an exception if the given string is not a valid variable value.
[ "Throws", "an", "exception", "if", "the", "given", "string", "is", "not", "a", "valid", "variable", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java#L72-L78
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java
DefUtils.assertPath
public static void assertPath( String pathName) throws IllegalArgumentException { String ids[] = toPath( pathName); for( int i = 0; i < ids.length; i++) { assertIdentifier( ids[i]); } }
java
public static void assertPath( String pathName) throws IllegalArgumentException { String ids[] = toPath( pathName); for( int i = 0; i < ids.length; i++) { assertIdentifier( ids[i]); } }
[ "public", "static", "void", "assertPath", "(", "String", "pathName", ")", "throws", "IllegalArgumentException", "{", "String", "ids", "[", "]", "=", "toPath", "(", "pathName", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ids", ".", "leng...
Throws an exception if the given string is not a valid identifier path name.
[ "Throws", "an", "exception", "if", "the", "given", "string", "is", "not", "a", "valid", "identifier", "path", "name", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java#L84-L91
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java
DefUtils.assertPropertyIdentifiers
public static void assertPropertyIdentifiers( Collection<String> properties) throws IllegalArgumentException { if( properties != null) { for( String property : properties) { assertIdentifier( property); } } }
java
public static void assertPropertyIdentifiers( Collection<String> properties) throws IllegalArgumentException { if( properties != null) { for( String property : properties) { assertIdentifier( property); } } }
[ "public", "static", "void", "assertPropertyIdentifiers", "(", "Collection", "<", "String", ">", "properties", ")", "throws", "IllegalArgumentException", "{", "if", "(", "properties", "!=", "null", ")", "{", "for", "(", "String", "property", ":", "properties", ")...
Throws an exception if any member of the given set of properties is not a valid identifier.
[ "Throws", "an", "exception", "if", "any", "member", "of", "the", "given", "set", "of", "properties", "is", "not", "a", "valid", "identifier", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/DefUtils.java#L96-L105
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/conditions/PropertyExpr.java
PropertyExpr.addProperty
public void addProperty( String property) { String candidate = StringUtils.trimToNull( property); if( candidate != null) { properties_.add( property); } }
java
public void addProperty( String property) { String candidate = StringUtils.trimToNull( property); if( candidate != null) { properties_.add( property); } }
[ "public", "void", "addProperty", "(", "String", "property", ")", "{", "String", "candidate", "=", "StringUtils", ".", "trimToNull", "(", "property", ")", ";", "if", "(", "candidate", "!=", "null", ")", "{", "properties_", ".", "add", "(", "property", ")", ...
Adds a property to this set.
[ "Adds", "a", "property", "to", "this", "set", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/PropertyExpr.java#L47-L54
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJsonWriter.java
GeneratorSetJsonWriter.setWriter
protected void setWriter( Writer writer) { writer_ = writer == null ? writerFor( System.out) : writer; }
java
protected void setWriter( Writer writer) { writer_ = writer == null ? writerFor( System.out) : writer; }
[ "protected", "void", "setWriter", "(", "Writer", "writer", ")", "{", "writer_", "=", "writer", "==", "null", "?", "writerFor", "(", "System", ".", "out", ")", ":", "writer", ";", "}" ]
Changes the output stream for this writer.
[ "Changes", "the", "output", "stream", "for", "this", "writer", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJsonWriter.java#L92-L98
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJsonWriter.java
GeneratorSetJsonWriter.writerFor
private static Writer writerFor( OutputStream stream) { try { return stream == null ? null : new OutputStreamWriter( stream, "UTF-8"); } catch( Exception e) { throw new RuntimeException( "Can't create writer", e); } }
java
private static Writer writerFor( OutputStream stream) { try { return stream == null ? null : new OutputStreamWriter( stream, "UTF-8"); } catch( Exception e) { throw new RuntimeException( "Can't create writer", e); } }
[ "private", "static", "Writer", "writerFor", "(", "OutputStream", "stream", ")", "{", "try", "{", "return", "stream", "==", "null", "?", "null", ":", "new", "OutputStreamWriter", "(", "stream", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "Exception", "e"...
Returns a Writer for the given output stream;
[ "Returns", "a", "Writer", "for", "the", "given", "output", "stream", ";" ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJsonWriter.java#L111-L124
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java
ProjectJson.asProject
public static Project asProject( JsonObject json) { return ProjectBuilder.with( asSystemInputDef( json.get( INPUTDEF_KEY))) .systemInputRef( asSystemInputRef( json.get( INPUTDEF_KEY))) .generators( asGeneratorSet( json.get( GENERATORS_KEY))) .generatorsRef( asGeneratorSetRef( json.get...
java
public static Project asProject( JsonObject json) { return ProjectBuilder.with( asSystemInputDef( json.get( INPUTDEF_KEY))) .systemInputRef( asSystemInputRef( json.get( INPUTDEF_KEY))) .generators( asGeneratorSet( json.get( GENERATORS_KEY))) .generatorsRef( asGeneratorSetRef( json.get...
[ "public", "static", "Project", "asProject", "(", "JsonObject", "json", ")", "{", "return", "ProjectBuilder", ".", "with", "(", "asSystemInputDef", "(", "json", ".", "get", "(", "INPUTDEF_KEY", ")", ")", ")", ".", "systemInputRef", "(", "asSystemInputRef", "(",...
Returns the Project represented by the given JSON object.
[ "Returns", "the", "Project", "represented", "by", "the", "given", "JSON", "object", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L38-L52
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java
ProjectJson.asRefBase
private static URI asRefBase( JsonString uri) { try { return uri == null ? null : new URI( uri.getChars().toString()); } catch( Exception e) { throw new ProjectException( String.format( "Error defining reference base=%s", uri), e); } }
java
private static URI asRefBase( JsonString uri) { try { return uri == null ? null : new URI( uri.getChars().toString()); } catch( Exception e) { throw new ProjectException( String.format( "Error defining reference base=%s", uri), e); } }
[ "private", "static", "URI", "asRefBase", "(", "JsonString", "uri", ")", "{", "try", "{", "return", "uri", "==", "null", "?", "null", ":", "new", "URI", "(", "uri", ".", "getChars", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", ...
Returns the reference base URI represented by the given JSON string.
[ "Returns", "the", "reference", "base", "URI", "represented", "by", "the", "given", "JSON", "string", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L57-L70
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java
ProjectJson.asSystemInputDef
private static SystemInputDef asSystemInputDef( JsonValue json) { try { SystemInputDef systemInput = null; if( json != null && json.getValueType() == OBJECT) { systemInput = SystemInputJson.asSystemInputDef( (JsonObject) json); } return systemInput; } c...
java
private static SystemInputDef asSystemInputDef( JsonValue json) { try { SystemInputDef systemInput = null; if( json != null && json.getValueType() == OBJECT) { systemInput = SystemInputJson.asSystemInputDef( (JsonObject) json); } return systemInput; } c...
[ "private", "static", "SystemInputDef", "asSystemInputDef", "(", "JsonValue", "json", ")", "{", "try", "{", "SystemInputDef", "systemInput", "=", "null", ";", "if", "(", "json", "!=", "null", "&&", "json", ".", "getValueType", "(", ")", "==", "OBJECT", ")", ...
Returns the system input definition represented by the given JSON value.
[ "Returns", "the", "system", "input", "definition", "represented", "by", "the", "given", "JSON", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L75-L91
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java
ProjectJson.asSystemInputRef
private static URI asSystemInputRef( JsonValue json) { try { URI uri = null; if( json != null && json.getValueType() == STRING) { uri = new URI( ((JsonString) json).getChars().toString()); } return uri; } catch( Exception e) { throw new Proj...
java
private static URI asSystemInputRef( JsonValue json) { try { URI uri = null; if( json != null && json.getValueType() == STRING) { uri = new URI( ((JsonString) json).getChars().toString()); } return uri; } catch( Exception e) { throw new Proj...
[ "private", "static", "URI", "asSystemInputRef", "(", "JsonValue", "json", ")", "{", "try", "{", "URI", "uri", "=", "null", ";", "if", "(", "json", "!=", "null", "&&", "json", ".", "getValueType", "(", ")", "==", "STRING", ")", "{", "uri", "=", "new",...
Returns the system input definition URL represented by the given JSON value.
[ "Returns", "the", "system", "input", "definition", "URL", "represented", "by", "the", "given", "JSON", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L96-L112
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java
ProjectJson.asGeneratorSet
private static IGeneratorSet asGeneratorSet( JsonValue json) { try { IGeneratorSet generators = null; if( json != null && json.getValueType() == OBJECT) { generators = GeneratorSetJson.asGeneratorSet( (JsonObject) json); } return generators; } catch( Ex...
java
private static IGeneratorSet asGeneratorSet( JsonValue json) { try { IGeneratorSet generators = null; if( json != null && json.getValueType() == OBJECT) { generators = GeneratorSetJson.asGeneratorSet( (JsonObject) json); } return generators; } catch( Ex...
[ "private", "static", "IGeneratorSet", "asGeneratorSet", "(", "JsonValue", "json", ")", "{", "try", "{", "IGeneratorSet", "generators", "=", "null", ";", "if", "(", "json", "!=", "null", "&&", "json", ".", "getValueType", "(", ")", "==", "OBJECT", ")", "{",...
Returns the generator set represented by the given JSON value.
[ "Returns", "the", "generator", "set", "represented", "by", "the", "given", "JSON", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L117-L133
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java
ProjectJson.toJson
public static JsonObject toJson( Project project) { JsonObjectBuilder builder = Json.createObjectBuilder(); Optional.ofNullable( project.getBaseLocation()) .ifPresent( uri -> builder.add( REFBASE_KEY, String.valueOf( uri))); if( project.getSystemInputLocation() != null) { builder.add...
java
public static JsonObject toJson( Project project) { JsonObjectBuilder builder = Json.createObjectBuilder(); Optional.ofNullable( project.getBaseLocation()) .ifPresent( uri -> builder.add( REFBASE_KEY, String.valueOf( uri))); if( project.getSystemInputLocation() != null) { builder.add...
[ "public", "static", "JsonObject", "toJson", "(", "Project", "project", ")", "{", "JsonObjectBuilder", "builder", "=", "Json", ".", "createObjectBuilder", "(", ")", ";", "Optional", ".", "ofNullable", "(", "project", ".", "getBaseLocation", "(", ")", ")", ".", ...
Returns the JSON object that represents the given project definition.
[ "Returns", "the", "JSON", "object", "that", "represents", "the", "given", "project", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/ProjectJson.java#L201-L236
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java
GeneratorSetDocWriter.write
public void write( IGeneratorSet generatorSet) { writer_.writeDeclaration(); writer_ .element( GENERATORS_TAG) .content( () -> { Arrays.stream( generatorSet.getGeneratorFunctions()) .sorted() .forEach( function -> writeGenerator( function, generatorSet.getGen...
java
public void write( IGeneratorSet generatorSet) { writer_.writeDeclaration(); writer_ .element( GENERATORS_TAG) .content( () -> { Arrays.stream( generatorSet.getGeneratorFunctions()) .sorted() .forEach( function -> writeGenerator( function, generatorSet.getGen...
[ "public", "void", "write", "(", "IGeneratorSet", "generatorSet", ")", "{", "writer_", ".", "writeDeclaration", "(", ")", ";", "writer_", ".", "element", "(", "GENERATORS_TAG", ")", ".", "content", "(", "(", ")", "->", "{", "Arrays", ".", "stream", "(", "...
Writes the given generator definition in the form of an XML document.
[ "Writes", "the", "given", "generator", "definition", "in", "the", "form", "of", "an", "XML", "document", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java#L65-L78
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java
GeneratorSetDocWriter.writeCombiner
protected void writeCombiner( TupleCombiner combiner) { writer_ .element( COMBINE_TAG) .attribute( TUPLES_ATR, String.valueOf( combiner.getTupleSize())) .content( () -> { Arrays.stream( combiner.getIncluded()) .sorted() .forEach( this::writeIncluded); ...
java
protected void writeCombiner( TupleCombiner combiner) { writer_ .element( COMBINE_TAG) .attribute( TUPLES_ATR, String.valueOf( combiner.getTupleSize())) .content( () -> { Arrays.stream( combiner.getIncluded()) .sorted() .forEach( this::writeIncluded); ...
[ "protected", "void", "writeCombiner", "(", "TupleCombiner", "combiner", ")", "{", "writer_", ".", "element", "(", "COMBINE_TAG", ")", ".", "attribute", "(", "TUPLES_ATR", ",", "String", ".", "valueOf", "(", "combiner", ".", "getTupleSize", "(", ")", ")", ")"...
Writes the given combiner definition.
[ "Writes", "the", "given", "combiner", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java#L117-L135
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java
GeneratorSetDocWriter.writeOnceTuple
protected void writeOnceTuple( TupleRef tuple) { writer_ .element( ONCE_TAG) .content( () -> toStream( tuple.getVarBindings()).forEach( this::writeVarBinding)) .write(); }
java
protected void writeOnceTuple( TupleRef tuple) { writer_ .element( ONCE_TAG) .content( () -> toStream( tuple.getVarBindings()).forEach( this::writeVarBinding)) .write(); }
[ "protected", "void", "writeOnceTuple", "(", "TupleRef", "tuple", ")", "{", "writer_", ".", "element", "(", "ONCE_TAG", ")", ".", "content", "(", "(", ")", "->", "toStream", "(", "tuple", ".", "getVarBindings", "(", ")", ")", ".", "forEach", "(", "this", ...
Writes the given once-only tuple definition.
[ "Writes", "the", "given", "once", "-", "only", "tuple", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java#L140-L146
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java
GeneratorSetDocWriter.writeVarBinding
protected void writeVarBinding( VarBinding binding) { writer_ .element( VAR_TAG) .attribute( NAME_ATR, binding.getVar()) .attribute( VALUE_ATR, String.valueOf( binding.getValue())) .write(); }
java
protected void writeVarBinding( VarBinding binding) { writer_ .element( VAR_TAG) .attribute( NAME_ATR, binding.getVar()) .attribute( VALUE_ATR, String.valueOf( binding.getValue())) .write(); }
[ "protected", "void", "writeVarBinding", "(", "VarBinding", "binding", ")", "{", "writer_", ".", "element", "(", "VAR_TAG", ")", ".", "attribute", "(", "NAME_ATR", ",", "binding", ".", "getVar", "(", ")", ")", ".", "attribute", "(", "VALUE_ATR", ",", "Strin...
Writes the given variable binding definition.
[ "Writes", "the", "given", "variable", "binding", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetDocWriter.java#L151-L158
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/VarBindingDef.java
VarBindingDef.bind
public VarBindingDef bind( VarDef varDef, VarValueDef valueDef) { if( valueDef != null && !varDef.isApplicable( valueDef)) { throw new IllegalArgumentException( "Value=" + valueDef + " is not defined for var=" + varDef); } varDef_ = varDef; valueDef_ = valueDef; effCondition_ ...
java
public VarBindingDef bind( VarDef varDef, VarValueDef valueDef) { if( valueDef != null && !varDef.isApplicable( valueDef)) { throw new IllegalArgumentException( "Value=" + valueDef + " is not defined for var=" + varDef); } varDef_ = varDef; valueDef_ = valueDef; effCondition_ ...
[ "public", "VarBindingDef", "bind", "(", "VarDef", "varDef", ",", "VarValueDef", "valueDef", ")", "{", "if", "(", "valueDef", "!=", "null", "&&", "!", "varDef", ".", "isApplicable", "(", "valueDef", ")", ")", "{", "throw", "new", "IllegalArgumentException", "...
Changes this input variable binding.
[ "Changes", "this", "input", "variable", "binding", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/VarBindingDef.java#L47-L59
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/VarBindingDef.java
VarBindingDef.getEffectiveCondition
public ICondition getEffectiveCondition() { if( effCondition_ == null) { effCondition_ = getValueDef().getEffectiveCondition( getVarDef().getEffectiveCondition()); } return effCondition_; }
java
public ICondition getEffectiveCondition() { if( effCondition_ == null) { effCondition_ = getValueDef().getEffectiveCondition( getVarDef().getEffectiveCondition()); } return effCondition_; }
[ "public", "ICondition", "getEffectiveCondition", "(", ")", "{", "if", "(", "effCondition_", "==", "null", ")", "{", "effCondition_", "=", "getValueDef", "(", ")", ".", "getEffectiveCondition", "(", "getVarDef", "(", ")", ".", "getEffectiveCondition", "(", ")", ...
Returns the effective condition that defines when this binding is applicable.
[ "Returns", "the", "effective", "condition", "that", "defines", "when", "this", "binding", "is", "applicable", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/VarBindingDef.java#L88-L96
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/VarDefIterator.java
VarDefIterator.getNextVarDef
private VarDef getNextVarDef() { if( nextVarDef_ == null) { // Still traversing current VarSet? if( nextVarSet_ != null && nextVarSet_.hasNext()) { // Yes, return next VarSet member. nextVarDef_ = nextVarSet_.next(); } else { // No, get nex...
java
private VarDef getNextVarDef() { if( nextVarDef_ == null) { // Still traversing current VarSet? if( nextVarSet_ != null && nextVarSet_.hasNext()) { // Yes, return next VarSet member. nextVarDef_ = nextVarSet_.next(); } else { // No, get nex...
[ "private", "VarDef", "getNextVarDef", "(", ")", "{", "if", "(", "nextVarDef_", "==", "null", ")", "{", "// Still traversing current VarSet?", "if", "(", "nextVarSet_", "!=", "null", "&&", "nextVarSet_", ".", "hasNext", "(", ")", ")", "{", "// Yes, return next Va...
Returns the next
[ "Returns", "the", "next" ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/VarDefIterator.java#L72-L110
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.asGeneratorSet
public static IGeneratorSet asGeneratorSet( JsonObject json) { GeneratorSet generatorSet = new GeneratorSet(); // Get generator definitions json.keySet().stream() .forEach( function -> { try { generatorSet.addGenerator( validFunction( function), asGenerator( json.getJs...
java
public static IGeneratorSet asGeneratorSet( JsonObject json) { GeneratorSet generatorSet = new GeneratorSet(); // Get generator definitions json.keySet().stream() .forEach( function -> { try { generatorSet.addGenerator( validFunction( function), asGenerator( json.getJs...
[ "public", "static", "IGeneratorSet", "asGeneratorSet", "(", "JsonObject", "json", ")", "{", "GeneratorSet", "generatorSet", "=", "new", "GeneratorSet", "(", ")", ";", "// Get generator definitions", "json", ".", "keySet", "(", ")", ".", "stream", "(", ")", ".", ...
Returns the IGeneratorSet represented by the given JSON object.
[ "Returns", "the", "IGeneratorSet", "represented", "by", "the", "given", "JSON", "object", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L41-L59
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.asGenerator
private static TupleGenerator asGenerator( JsonObject json) { TupleGenerator tupleGenerator = new TupleGenerator(); Optional.ofNullable( json.getJsonNumber( TUPLES_KEY)) .ifPresent( n -> tupleGenerator.setDefaultTupleSize( n.intValue())); Optional.ofNullable( json.getJsonNumber( SEED_KEY)) ...
java
private static TupleGenerator asGenerator( JsonObject json) { TupleGenerator tupleGenerator = new TupleGenerator(); Optional.ofNullable( json.getJsonNumber( TUPLES_KEY)) .ifPresent( n -> tupleGenerator.setDefaultTupleSize( n.intValue())); Optional.ofNullable( json.getJsonNumber( SEED_KEY)) ...
[ "private", "static", "TupleGenerator", "asGenerator", "(", "JsonObject", "json", ")", "{", "TupleGenerator", "tupleGenerator", "=", "new", "TupleGenerator", "(", ")", ";", "Optional", ".", "ofNullable", "(", "json", ".", "getJsonNumber", "(", "TUPLES_KEY", ")", ...
Returns the generator represented by the given JSON object.
[ "Returns", "the", "generator", "represented", "by", "the", "given", "JSON", "object", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L64-L81
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.asCombiner
private static TupleCombiner asCombiner( JsonObject json) { try { TupleCombiner tupleCombiner = new TupleCombiner(); Optional.ofNullable( json.getJsonNumber( TUPLES_KEY)) .ifPresent( n -> tupleCombiner.setTupleSize( n.intValue())); Optional.ofNullable( json.getJsonArray( INCLUD...
java
private static TupleCombiner asCombiner( JsonObject json) { try { TupleCombiner tupleCombiner = new TupleCombiner(); Optional.ofNullable( json.getJsonNumber( TUPLES_KEY)) .ifPresent( n -> tupleCombiner.setTupleSize( n.intValue())); Optional.ofNullable( json.getJsonArray( INCLUD...
[ "private", "static", "TupleCombiner", "asCombiner", "(", "JsonObject", "json", ")", "{", "try", "{", "TupleCombiner", "tupleCombiner", "=", "new", "TupleCombiner", "(", ")", ";", "Optional", ".", "ofNullable", "(", "json", ".", "getJsonNumber", "(", "TUPLES_KEY"...
Returns the combiner represented by the given JSON object.
[ "Returns", "the", "combiner", "represented", "by", "the", "given", "JSON", "object", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L86-L167
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.asTupleRef
private static TupleRef asTupleRef( JsonObject json) { TupleRef tupleRef = new TupleRef(); json.keySet().stream() .forEach( var -> { try { tupleRef.addVarBinding( new VarBinding( var, ObjectUtils.toObject( json.getString( var)))); } catch( GeneratorSetExc...
java
private static TupleRef asTupleRef( JsonObject json) { TupleRef tupleRef = new TupleRef(); json.keySet().stream() .forEach( var -> { try { tupleRef.addVarBinding( new VarBinding( var, ObjectUtils.toObject( json.getString( var)))); } catch( GeneratorSetExc...
[ "private", "static", "TupleRef", "asTupleRef", "(", "JsonObject", "json", ")", "{", "TupleRef", "tupleRef", "=", "new", "TupleRef", "(", ")", ";", "json", ".", "keySet", "(", ")", ".", "stream", "(", ")", ".", "forEach", "(", "var", "->", "{", "try", ...
Returns the TupleRef represented by the given JSON object.
[ "Returns", "the", "TupleRef", "represented", "by", "the", "given", "JSON", "object", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L172-L189
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.validFunction
private static String validFunction( String string) { return GeneratorSet.ALL.equals( string) ? string : validIdentifier( string); }
java
private static String validFunction( String string) { return GeneratorSet.ALL.equals( string) ? string : validIdentifier( string); }
[ "private", "static", "String", "validFunction", "(", "String", "string", ")", "{", "return", "GeneratorSet", ".", "ALL", ".", "equals", "(", "string", ")", "?", "string", ":", "validIdentifier", "(", "string", ")", ";", "}" ]
Reports a GeneratorSetException if the given string is not a valid function id. Otherwise, returns this string.
[ "Reports", "a", "GeneratorSetException", "if", "the", "given", "string", "is", "not", "a", "valid", "function", "id", ".", "Otherwise", "returns", "this", "string", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L194-L200
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.validIdentifier
private static String validIdentifier( String string) { try { DefUtils.assertIdentifier( string); } catch( Exception e) { throw new GeneratorSetException( e.getMessage()); } return string; }
java
private static String validIdentifier( String string) { try { DefUtils.assertIdentifier( string); } catch( Exception e) { throw new GeneratorSetException( e.getMessage()); } return string; }
[ "private", "static", "String", "validIdentifier", "(", "String", "string", ")", "{", "try", "{", "DefUtils", ".", "assertIdentifier", "(", "string", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "GeneratorSetException", "(", "e", ...
Reports a GeneratorSetException if the given string is not a valid identifier. Otherwise, returns this string.
[ "Reports", "a", "GeneratorSetException", "if", "the", "given", "string", "is", "not", "a", "valid", "identifier", ".", "Otherwise", "returns", "this", "string", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L205-L217
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.toJson
public static JsonObject toJson( IGeneratorSet generatorSet) { JsonObjectBuilder builder = Json.createObjectBuilder(); for( String function : generatorSet.getGeneratorFunctions()) { builder.add( function, toJson( generatorSet.getGenerator( function))); } return builder.build(); }
java
public static JsonObject toJson( IGeneratorSet generatorSet) { JsonObjectBuilder builder = Json.createObjectBuilder(); for( String function : generatorSet.getGeneratorFunctions()) { builder.add( function, toJson( generatorSet.getGenerator( function))); } return builder.build(); }
[ "public", "static", "JsonObject", "toJson", "(", "IGeneratorSet", "generatorSet", ")", "{", "JsonObjectBuilder", "builder", "=", "Json", ".", "createObjectBuilder", "(", ")", ";", "for", "(", "String", "function", ":", "generatorSet", ".", "getGeneratorFunctions", ...
Returns the JSON object that represents the given generator set.
[ "Returns", "the", "JSON", "object", "that", "represents", "the", "given", "generator", "set", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L222-L232
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.toJson
private static JsonStructure toJson( ITestCaseGenerator generator) { JsonObjectBuilder builder = Json.createObjectBuilder(); if( generator.getClass().equals( TupleGenerator.class)) { TupleGenerator tupleGenerator = (TupleGenerator) generator; builder.add( TUPLES_KEY, tupleGenerator.getDef...
java
private static JsonStructure toJson( ITestCaseGenerator generator) { JsonObjectBuilder builder = Json.createObjectBuilder(); if( generator.getClass().equals( TupleGenerator.class)) { TupleGenerator tupleGenerator = (TupleGenerator) generator; builder.add( TUPLES_KEY, tupleGenerator.getDef...
[ "private", "static", "JsonStructure", "toJson", "(", "ITestCaseGenerator", "generator", ")", "{", "JsonObjectBuilder", "builder", "=", "Json", ".", "createObjectBuilder", "(", ")", ";", "if", "(", "generator", ".", "getClass", "(", ")", ".", "equals", "(", "Tu...
Returns the JSON object that represents the given generator.
[ "Returns", "the", "JSON", "object", "that", "represents", "the", "given", "generator", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L237-L257
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.toJson
private static JsonStructure toJson( TupleCombiner combiner) { JsonObjectBuilder builder = Json.createObjectBuilder(); builder.add( TUPLES_KEY, combiner.getTupleSize()); JsonArrayBuilder includeBuilder = Json.createArrayBuilder(); Arrays.stream( combiner.getIncluded()).forEach( var -> includeBuild...
java
private static JsonStructure toJson( TupleCombiner combiner) { JsonObjectBuilder builder = Json.createObjectBuilder(); builder.add( TUPLES_KEY, combiner.getTupleSize()); JsonArrayBuilder includeBuilder = Json.createArrayBuilder(); Arrays.stream( combiner.getIncluded()).forEach( var -> includeBuild...
[ "private", "static", "JsonStructure", "toJson", "(", "TupleCombiner", "combiner", ")", "{", "JsonObjectBuilder", "builder", "=", "Json", ".", "createObjectBuilder", "(", ")", ";", "builder", ".", "add", "(", "TUPLES_KEY", ",", "combiner", ".", "getTupleSize", "(...
Returns the JSON object that represents the given combiner.
[ "Returns", "the", "JSON", "object", "that", "represents", "the", "given", "combiner", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L262-L293
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java
GeneratorSetJson.toJson
private static JsonStructure toJson( TupleRef tuple) { JsonObjectBuilder builder = Json.createObjectBuilder(); toStream( tuple.getVarBindings()).forEach( binding -> builder.add( binding.getVar(), String.valueOf( binding.getValue()))); return builder.build(); }
java
private static JsonStructure toJson( TupleRef tuple) { JsonObjectBuilder builder = Json.createObjectBuilder(); toStream( tuple.getVarBindings()).forEach( binding -> builder.add( binding.getVar(), String.valueOf( binding.getValue()))); return builder.build(); }
[ "private", "static", "JsonStructure", "toJson", "(", "TupleRef", "tuple", ")", "{", "JsonObjectBuilder", "builder", "=", "Json", ".", "createObjectBuilder", "(", ")", ";", "toStream", "(", "tuple", ".", "getVarBindings", "(", ")", ")", ".", "forEach", "(", "...
Returns the JSON object that represents the given once tuple.
[ "Returns", "the", "JSON", "object", "that", "represents", "the", "given", "once", "tuple", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/generator/io/GeneratorSetJson.java#L298-L305
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toObject
public static Object toObject( String value) { return toObject( value, ObjectUtils::toBoolean, ObjectUtils::toNumber, ObjectUtils::toExternalString); }
java
public static Object toObject( String value) { return toObject( value, ObjectUtils::toBoolean, ObjectUtils::toNumber, ObjectUtils::toExternalString); }
[ "public", "static", "Object", "toObject", "(", "String", "value", ")", "{", "return", "toObject", "(", "value", ",", "ObjectUtils", "::", "toBoolean", ",", "ObjectUtils", "::", "toNumber", ",", "ObjectUtils", "::", "toExternalString", ")", ";", "}" ]
Returns the object represented by the given string.
[ "Returns", "the", "object", "represented", "by", "the", "given", "string", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L30-L38
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toExternalObject
public static Object toExternalObject( Object value) { return Optional.ofNullable( toExternalNumber( value)) .orElse( toObject( String.valueOf( value))); }
java
public static Object toExternalObject( Object value) { return Optional.ofNullable( toExternalNumber( value)) .orElse( toObject( String.valueOf( value))); }
[ "public", "static", "Object", "toExternalObject", "(", "Object", "value", ")", "{", "return", "Optional", ".", "ofNullable", "(", "toExternalNumber", "(", "value", ")", ")", ".", "orElse", "(", "toObject", "(", "String", ".", "valueOf", "(", "value", ")", ...
Returns an object equal to the external form of the given value.
[ "Returns", "an", "object", "equal", "to", "the", "external", "form", "of", "the", "given", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L43-L50
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toObject
@SafeVarargs private static <T> Object toObject( T value, Function<T,Object>... converters) { return Stream.of( converters) .map( converter -> converter.apply( value)) .filter( Objects::nonNull) .findFirst() .orElse( null); }
java
@SafeVarargs private static <T> Object toObject( T value, Function<T,Object>... converters) { return Stream.of( converters) .map( converter -> converter.apply( value)) .filter( Objects::nonNull) .findFirst() .orElse( null); }
[ "@", "SafeVarargs", "private", "static", "<", "T", ">", "Object", "toObject", "(", "T", "value", ",", "Function", "<", "T", ",", "Object", ">", "...", "converters", ")", "{", "return", "Stream", ".", "of", "(", "converters", ")", ".", "map", "(", "co...
Returns the first non-null object produced by the given converters. Returns null if no such object found.
[ "Returns", "the", "first", "non", "-", "null", "object", "produced", "by", "the", "given", "converters", ".", "Returns", "null", "if", "no", "such", "object", "found", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L56-L65
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toBoolean
private static Object toBoolean( String value) { return "true".equalsIgnoreCase( value)? Boolean.TRUE : "false".equalsIgnoreCase( value)? Boolean.FALSE : null; }
java
private static Object toBoolean( String value) { return "true".equalsIgnoreCase( value)? Boolean.TRUE : "false".equalsIgnoreCase( value)? Boolean.FALSE : null; }
[ "private", "static", "Object", "toBoolean", "(", "String", "value", ")", "{", "return", "\"true\"", ".", "equalsIgnoreCase", "(", "value", ")", "?", "Boolean", ".", "TRUE", ":", "\"false\"", ".", "equalsIgnoreCase", "(", "value", ")", "?", "Boolean", ".", ...
Returns the Boolean represented by the given string, or null if not a boolean value.
[ "Returns", "the", "Boolean", "represented", "by", "the", "given", "string", "or", "null", "if", "not", "a", "boolean", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L70-L80
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toNumber
private static Object toNumber( String value) { Object number; try { number = toExternalNumber( new BigDecimal( value)); } catch( Exception e) { number = null; } return number; }
java
private static Object toNumber( String value) { Object number; try { number = toExternalNumber( new BigDecimal( value)); } catch( Exception e) { number = null; } return number; }
[ "private", "static", "Object", "toNumber", "(", "String", "value", ")", "{", "Object", "number", ";", "try", "{", "number", "=", "toExternalNumber", "(", "new", "BigDecimal", "(", "value", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "...
Returns the Number represented by the given string, or null if not a numeric value.
[ "Returns", "the", "Number", "represented", "by", "the", "given", "string", "or", "null", "if", "not", "a", "numeric", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L85-L99
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toInt
private static Object toInt( BigDecimal value) { Object number; try { number = value.scale() == 0 ? Integer.valueOf( value.intValueExact()) : null; } catch( Exception e) { number = null; } return number; }
java
private static Object toInt( BigDecimal value) { Object number; try { number = value.scale() == 0 ? Integer.valueOf( value.intValueExact()) : null; } catch( Exception e) { number = null; } return number; }
[ "private", "static", "Object", "toInt", "(", "BigDecimal", "value", ")", "{", "Object", "number", ";", "try", "{", "number", "=", "value", ".", "scale", "(", ")", "==", "0", "?", "Integer", ".", "valueOf", "(", "value", ".", "intValueExact", "(", ")", ...
Returns the Integer represented by the given value, or null if not an integer value.
[ "Returns", "the", "Integer", "represented", "by", "the", "given", "value", "or", "null", "if", "not", "an", "integer", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L116-L133
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toLong
private static Object toLong( BigDecimal value) { Object number; try { number = value.scale() == 0 ? Long.valueOf( value.longValueExact()) : null; } catch( Exception e) { number = null; } return number; }
java
private static Object toLong( BigDecimal value) { Object number; try { number = value.scale() == 0 ? Long.valueOf( value.longValueExact()) : null; } catch( Exception e) { number = null; } return number; }
[ "private", "static", "Object", "toLong", "(", "BigDecimal", "value", ")", "{", "Object", "number", ";", "try", "{", "number", "=", "value", ".", "scale", "(", ")", "==", "0", "?", "Long", ".", "valueOf", "(", "value", ".", "longValueExact", "(", ")", ...
Returns the Long represented by the given value, or null if not an long value.
[ "Returns", "the", "Long", "represented", "by", "the", "given", "value", "or", "null", "if", "not", "an", "long", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L138-L155
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toExternalNumber
private static Object toExternalNumber( Object value) { Class<?> valueType = value == null ? null : value.getClass(); return !(valueType != null && Number.class.isAssignableFrom( valueType))? null : valueType.equals( BigDecimal.class)? toExternalNumber( (BigDecima...
java
private static Object toExternalNumber( Object value) { Class<?> valueType = value == null ? null : value.getClass(); return !(valueType != null && Number.class.isAssignableFrom( valueType))? null : valueType.equals( BigDecimal.class)? toExternalNumber( (BigDecima...
[ "private", "static", "Object", "toExternalNumber", "(", "Object", "value", ")", "{", "Class", "<", "?", ">", "valueType", "=", "value", "==", "null", "?", "null", ":", "value", ".", "getClass", "(", ")", ";", "return", "!", "(", "valueType", "!=", "nul...
If the given value is a number, returns an object equal to its external form. Otherwise, returns null.
[ "If", "the", "given", "value", "is", "a", "number", "returns", "an", "object", "equal", "to", "its", "external", "form", ".", "Otherwise", "returns", "null", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L161-L179
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java
ObjectUtils.toExternalNumber
private static Object toExternalNumber( BigDecimal number) { return Optional.ofNullable( toObject( number, ObjectUtils::toInt, ObjectUtils::toLong)) .orElse( number); }
java
private static Object toExternalNumber( BigDecimal number) { return Optional.ofNullable( toObject( number, ObjectUtils::toInt, ObjectUtils::toLong)) .orElse( number); }
[ "private", "static", "Object", "toExternalNumber", "(", "BigDecimal", "number", ")", "{", "return", "Optional", ".", "ofNullable", "(", "toObject", "(", "number", ",", "ObjectUtils", "::", "toInt", ",", "ObjectUtils", "::", "toLong", ")", ")", ".", "orElse", ...
Returns an object equal to the external form of the given number value.
[ "Returns", "an", "object", "equal", "to", "the", "external", "form", "of", "the", "given", "number", "value", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/util/ObjectUtils.java#L184-L194
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java
AbstractVarDef.getPathName
public String getPathName() { if( pathName_ == null) { StringBuilder pathName = new StringBuilder(); IVarDef parent = getParent(); if( parent != null) { pathName .append( parent.getPathName()) .append( '.'); } String name = getName(); ...
java
public String getPathName() { if( pathName_ == null) { StringBuilder pathName = new StringBuilder(); IVarDef parent = getParent(); if( parent != null) { pathName .append( parent.getPathName()) .append( '.'); } String name = getName(); ...
[ "public", "String", "getPathName", "(", ")", "{", "if", "(", "pathName_", "==", "null", ")", "{", "StringBuilder", "pathName", "=", "new", "StringBuilder", "(", ")", ";", "IVarDef", "parent", "=", "getParent", "(", ")", ";", "if", "(", "parent", "!=", ...
Returns the hierarchical path name of this variable.
[ "Returns", "the", "hierarchical", "path", "name", "of", "this", "variable", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java#L122-L146
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java
AbstractVarDef.getType
public String getType() { IVarDef parent = getParent(); return parent==null? type_ : parent.getType(); }
java
public String getType() { IVarDef parent = getParent(); return parent==null? type_ : parent.getType(); }
[ "public", "String", "getType", "(", ")", "{", "IVarDef", "parent", "=", "getParent", "(", ")", ";", "return", "parent", "==", "null", "?", "type_", ":", "parent", ".", "getType", "(", ")", ";", "}" ]
Returns the type identifier for this variable.
[ "Returns", "the", "type", "identifier", "for", "this", "variable", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java#L160-L164
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java
AbstractVarDef.getEffectiveCondition
public ICondition getEffectiveCondition() { if( effCondition_ == null) { effCondition_ = getEffectiveCondition( Optional.ofNullable( getParent()) .map( IVarDef::getEffectiveCondition) .orElse( null)); } return effCondition_; }
java
public ICondition getEffectiveCondition() { if( effCondition_ == null) { effCondition_ = getEffectiveCondition( Optional.ofNullable( getParent()) .map( IVarDef::getEffectiveCondition) .orElse( null)); } return effCondition_; }
[ "public", "ICondition", "getEffectiveCondition", "(", ")", "{", "if", "(", "effCondition_", "==", "null", ")", "{", "effCondition_", "=", "getEffectiveCondition", "(", "Optional", ".", "ofNullable", "(", "getParent", "(", ")", ")", ".", "map", "(", "IVarDef", ...
Returns the effective condition that defines when this variable is applicable, based on the conditions for this variable and all of its ancestors.
[ "Returns", "the", "effective", "condition", "that", "defines", "when", "this", "variable", "is", "applicable", "based", "on", "the", "conditions", "for", "this", "variable", "and", "all", "of", "its", "ancestors", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java#L189-L201
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java
AbstractVarDef.getPosition
public IVarDef.Position getPosition() { if( position_ == null) { setPosition( new Position( getParent(), seqNum_)); } return position_; }
java
public IVarDef.Position getPosition() { if( position_ == null) { setPosition( new Position( getParent(), seqNum_)); } return position_; }
[ "public", "IVarDef", ".", "Position", "getPosition", "(", ")", "{", "if", "(", "position_", "==", "null", ")", "{", "setPosition", "(", "new", "Position", "(", "getParent", "(", ")", ",", "seqNum_", ")", ")", ";", "}", "return", "position_", ";", "}" ]
Returns the position of this variable definition.
[ "Returns", "the", "position", "of", "this", "variable", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/AbstractVarDef.java#L231-L239
train
Cornutum/tcases
tcases-io/src/main/java/org/cornutum/tcases/io/XmlWriter.java
XmlWriter.writeAttribute
protected void writeAttribute( String name, String value) { print( " "); print( name); print( "=\""); // StringEscapeUtils escapes symbols ', < >, &, ", and some control characters // NumericEntityEscaper translates additional control characters \n, \t, ... print( NumericEntityEscaper.below(...
java
protected void writeAttribute( String name, String value) { print( " "); print( name); print( "=\""); // StringEscapeUtils escapes symbols ', < >, &, ", and some control characters // NumericEntityEscaper translates additional control characters \n, \t, ... print( NumericEntityEscaper.below(...
[ "protected", "void", "writeAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "print", "(", "\" \"", ")", ";", "print", "(", "name", ")", ";", "print", "(", "\"=\\\"\"", ")", ";", "// StringEscapeUtils escapes symbols ', < >, &, \", and some cont...
Writes an attribute definition.
[ "Writes", "an", "attribute", "definition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-io/src/main/java/org/cornutum/tcases/io/XmlWriter.java#L105-L114
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java
VarNamePattern.matches
public boolean matches( VarNamePattern varName) { boolean matched = // Variable name defined? varName != null // Variable name and this pattern both (non-)empty? && (varName.varNamePath_ == null) == (varNamePath_ == null) // Variable name identifies single variable of depth no le...
java
public boolean matches( VarNamePattern varName) { boolean matched = // Variable name defined? varName != null // Variable name and this pattern both (non-)empty? && (varName.varNamePath_ == null) == (varNamePath_ == null) // Variable name identifies single variable of depth no le...
[ "public", "boolean", "matches", "(", "VarNamePattern", "varName", ")", "{", "boolean", "matched", "=", "// Variable name defined?", "varName", "!=", "null", "// Variable name and this pattern both (non-)empty?", "&&", "(", "varName", ".", "varNamePath_", "==", "null", "...
Returns true if the given variable name matches this pattern.
[ "Returns", "true", "if", "the", "given", "variable", "name", "matches", "this", "pattern", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java#L55-L102
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java
VarNamePattern.isValid
public boolean isValid() { // Must be non-empty... boolean valid = varNamePath_ != null; if( valid) { // Containing a sequence of identifiers... int i; for( i = 0; i < varNamePath_.length && DefUtils.isIdentifier( varNamePath_[i]); i++); // Optionally terminated by a sing...
java
public boolean isValid() { // Must be non-empty... boolean valid = varNamePath_ != null; if( valid) { // Containing a sequence of identifiers... int i; for( i = 0; i < varNamePath_.length && DefUtils.isIdentifier( varNamePath_[i]); i++); // Optionally terminated by a sing...
[ "public", "boolean", "isValid", "(", ")", "{", "// Must be non-empty...", "boolean", "valid", "=", "varNamePath_", "!=", "null", ";", "if", "(", "valid", ")", "{", "// Containing a sequence of identifiers...", "int", "i", ";", "for", "(", "i", "=", "0", ";", ...
Returns true if this pattern is valid.
[ "Returns", "true", "if", "this", "pattern", "is", "valid", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java#L107-L129
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java
VarNamePattern.isApplicable
private boolean isApplicable( Iterator<IVarDef> varDefs) { boolean applicable = false; while( varDefs.hasNext() && !(applicable = isApplicable( varDefs.next()))); return applicable; }
java
private boolean isApplicable( Iterator<IVarDef> varDefs) { boolean applicable = false; while( varDefs.hasNext() && !(applicable = isApplicable( varDefs.next()))); return applicable; }
[ "private", "boolean", "isApplicable", "(", "Iterator", "<", "IVarDef", ">", "varDefs", ")", "{", "boolean", "applicable", "=", "false", ";", "while", "(", "varDefs", ".", "hasNext", "(", ")", "&&", "!", "(", "applicable", "=", "isApplicable", "(", "varDefs...
Returns true if this pattern is applicable to the given set of variables.
[ "Returns", "true", "if", "this", "pattern", "is", "applicable", "to", "the", "given", "set", "of", "variables", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java#L142-L147
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java
VarNamePattern.isApplicable
private boolean isApplicable( IVarDef var) { Iterator<IVarDef> members = var.getMembers(); return members == null ? matches( var.getPathName()) : isApplicable( members); }
java
private boolean isApplicable( IVarDef var) { Iterator<IVarDef> members = var.getMembers(); return members == null ? matches( var.getPathName()) : isApplicable( members); }
[ "private", "boolean", "isApplicable", "(", "IVarDef", "var", ")", "{", "Iterator", "<", "IVarDef", ">", "members", "=", "var", ".", "getMembers", "(", ")", ";", "return", "members", "==", "null", "?", "matches", "(", "var", ".", "getPathName", "(", ")", ...
Returns true if this pattern is applicable to the given variable.
[ "Returns", "true", "if", "this", "pattern", "is", "applicable", "to", "the", "given", "variable", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/generator/VarNamePattern.java#L152-L160
train
Cornutum/tcases
tcases-lib/src/main/java/org/cornutum/tcases/conditions/Cnf.java
Cnf.negate
public static IConjunct negate( IConjunct conjunct) { AnyOf anyOf = new AnyOf(); for( Iterator<IDisjunct> disjuncts = conjunct.getDisjuncts(); disjuncts.hasNext();) { Conjunction conjunction = new Conjunction(); for( Iterator<IAssertion> assertions = disjuncts.next().getAs...
java
public static IConjunct negate( IConjunct conjunct) { AnyOf anyOf = new AnyOf(); for( Iterator<IDisjunct> disjuncts = conjunct.getDisjuncts(); disjuncts.hasNext();) { Conjunction conjunction = new Conjunction(); for( Iterator<IAssertion> assertions = disjuncts.next().getAs...
[ "public", "static", "IConjunct", "negate", "(", "IConjunct", "conjunct", ")", "{", "AnyOf", "anyOf", "=", "new", "AnyOf", "(", ")", ";", "for", "(", "Iterator", "<", "IDisjunct", ">", "disjuncts", "=", "conjunct", ".", "getDisjuncts", "(", ")", ";", "dis...
Returns the negation of the given CNF condition.
[ "Returns", "the", "negation", "of", "the", "given", "CNF", "condition", "." ]
21e15cf107fa149620c40f4bda1829c1224fcfb1
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-lib/src/main/java/org/cornutum/tcases/conditions/Cnf.java#L154-L171
train