repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
playn/playn
android/src/playn/android/AndroidAudio.java
AndroidAudio.createSound
public SoundImpl<?> createSound(FileDescriptor fd, long offset, long length) { """ Creates a sound instance from the supplied file descriptor offset. """ PooledSound sound = new PooledSound(pool.load(fd, offset, length, 1)); loadingSounds.put(sound.soundId, sound); return sound; }
java
public SoundImpl<?> createSound(FileDescriptor fd, long offset, long length) { PooledSound sound = new PooledSound(pool.load(fd, offset, length, 1)); loadingSounds.put(sound.soundId, sound); return sound; }
[ "public", "SoundImpl", "<", "?", ">", "createSound", "(", "FileDescriptor", "fd", ",", "long", "offset", ",", "long", "length", ")", "{", "PooledSound", "sound", "=", "new", "PooledSound", "(", "pool", ".", "load", "(", "fd", ",", "offset", ",", "length", ",", "1", ")", ")", ";", "loadingSounds", ".", "put", "(", "sound", ".", "soundId", ",", "sound", ")", ";", "return", "sound", ";", "}" ]
Creates a sound instance from the supplied file descriptor offset.
[ "Creates", "a", "sound", "instance", "from", "the", "supplied", "file", "descriptor", "offset", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/android/src/playn/android/AndroidAudio.java#L134-L138
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java
WDataTable.updateBeanValue
@Override public void updateBeanValue() { """ Updates the bean using the table data model's {@link TableDataModel#setValueAt(Object, int, int)} method. """ TableDataModel model = getDataModel(); if (model instanceof ScrollableTableDataModel) { LOG.warn("UpdateBeanValue only updating the current page for ScrollableTableDataModel"); updateBeanValueCurrentPageOnly(); } else if (model.getRowCount() > 0) { // Temporarily widen the pagination on the repeater to hold all rows // Calling setBean with a non-null value overrides the DataTableBeanProvider repeater.setBean(new RowIdList(0, model.getRowCount() - 1)); updateBeanValueCurrentPageOnly(); repeater.setBean(null); } }
java
@Override public void updateBeanValue() { TableDataModel model = getDataModel(); if (model instanceof ScrollableTableDataModel) { LOG.warn("UpdateBeanValue only updating the current page for ScrollableTableDataModel"); updateBeanValueCurrentPageOnly(); } else if (model.getRowCount() > 0) { // Temporarily widen the pagination on the repeater to hold all rows // Calling setBean with a non-null value overrides the DataTableBeanProvider repeater.setBean(new RowIdList(0, model.getRowCount() - 1)); updateBeanValueCurrentPageOnly(); repeater.setBean(null); } }
[ "@", "Override", "public", "void", "updateBeanValue", "(", ")", "{", "TableDataModel", "model", "=", "getDataModel", "(", ")", ";", "if", "(", "model", "instanceof", "ScrollableTableDataModel", ")", "{", "LOG", ".", "warn", "(", "\"UpdateBeanValue only updating the current page for ScrollableTableDataModel\"", ")", ";", "updateBeanValueCurrentPageOnly", "(", ")", ";", "}", "else", "if", "(", "model", ".", "getRowCount", "(", ")", ">", "0", ")", "{", "// Temporarily widen the pagination on the repeater to hold all rows", "// Calling setBean with a non-null value overrides the DataTableBeanProvider", "repeater", ".", "setBean", "(", "new", "RowIdList", "(", "0", ",", "model", ".", "getRowCount", "(", ")", "-", "1", ")", ")", ";", "updateBeanValueCurrentPageOnly", "(", ")", ";", "repeater", ".", "setBean", "(", "null", ")", ";", "}", "}" ]
Updates the bean using the table data model's {@link TableDataModel#setValueAt(Object, int, int)} method.
[ "Updates", "the", "bean", "using", "the", "table", "data", "model", "s", "{" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java#L342-L356
ppiastucki/recast4j
detour-extras/src/main/java/org/recast4j/detour/extras/unity/astar/LinkBuilder.java
LinkBuilder.buildExternalLink
private void buildExternalLink(MeshData tile, Poly node, MeshData neighbourTile) { """ In case of external link to other tiles we must find the direction """ if (neighbourTile.header.bmin[0] > tile.header.bmin[0]) { node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK; } else if (neighbourTile.header.bmin[0] < tile.header.bmin[0]) { node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK | 4; } else if (neighbourTile.header.bmin[2] > tile.header.bmin[2]) { node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 2; } else { node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 6; } }
java
private void buildExternalLink(MeshData tile, Poly node, MeshData neighbourTile) { if (neighbourTile.header.bmin[0] > tile.header.bmin[0]) { node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK; } else if (neighbourTile.header.bmin[0] < tile.header.bmin[0]) { node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK | 4; } else if (neighbourTile.header.bmin[2] > tile.header.bmin[2]) { node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 2; } else { node.neis[PolyUtils.findEdge(node, tile, tile.header.bmin[2], 2)] = NavMesh.DT_EXT_LINK | 6; } }
[ "private", "void", "buildExternalLink", "(", "MeshData", "tile", ",", "Poly", "node", ",", "MeshData", "neighbourTile", ")", "{", "if", "(", "neighbourTile", ".", "header", ".", "bmin", "[", "0", "]", ">", "tile", ".", "header", ".", "bmin", "[", "0", "]", ")", "{", "node", ".", "neis", "[", "PolyUtils", ".", "findEdge", "(", "node", ",", "tile", ",", "neighbourTile", ".", "header", ".", "bmin", "[", "0", "]", ",", "0", ")", "]", "=", "NavMesh", ".", "DT_EXT_LINK", ";", "}", "else", "if", "(", "neighbourTile", ".", "header", ".", "bmin", "[", "0", "]", "<", "tile", ".", "header", ".", "bmin", "[", "0", "]", ")", "{", "node", ".", "neis", "[", "PolyUtils", ".", "findEdge", "(", "node", ",", "tile", ",", "tile", ".", "header", ".", "bmin", "[", "0", "]", ",", "0", ")", "]", "=", "NavMesh", ".", "DT_EXT_LINK", "|", "4", ";", "}", "else", "if", "(", "neighbourTile", ".", "header", ".", "bmin", "[", "2", "]", ">", "tile", ".", "header", ".", "bmin", "[", "2", "]", ")", "{", "node", ".", "neis", "[", "PolyUtils", ".", "findEdge", "(", "node", ",", "tile", ",", "neighbourTile", ".", "header", ".", "bmin", "[", "2", "]", ",", "2", ")", "]", "=", "NavMesh", ".", "DT_EXT_LINK", "|", "2", ";", "}", "else", "{", "node", ".", "neis", "[", "PolyUtils", ".", "findEdge", "(", "node", ",", "tile", ",", "tile", ".", "header", ".", "bmin", "[", "2", "]", ",", "2", ")", "]", "=", "NavMesh", ".", "DT_EXT_LINK", "|", "6", ";", "}", "}" ]
In case of external link to other tiles we must find the direction
[ "In", "case", "of", "external", "link", "to", "other", "tiles", "we", "must", "find", "the", "direction" ]
train
https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour-extras/src/main/java/org/recast4j/detour/extras/unity/astar/LinkBuilder.java#L40-L50
WASdev/ci.gradle
src/main/groovy/net/wasdev/wlp/gradle/plugins/utils/ServerConfigDocument.java
ServerConfigDocument.getFileFromConfigDirectory
private File getFileFromConfigDirectory(String file, File def) { """ /* Get the file from configDrectory if it exists; otherwise return def only if it exists, or null if not """ File f = new File(configDirectory, file); if (configDirectory != null && f.exists()) { return f; } if (def != null && def.exists()) { return def; } return null; }
java
private File getFileFromConfigDirectory(String file, File def) { File f = new File(configDirectory, file); if (configDirectory != null && f.exists()) { return f; } if (def != null && def.exists()) { return def; } return null; }
[ "private", "File", "getFileFromConfigDirectory", "(", "String", "file", ",", "File", "def", ")", "{", "File", "f", "=", "new", "File", "(", "configDirectory", ",", "file", ")", ";", "if", "(", "configDirectory", "!=", "null", "&&", "f", ".", "exists", "(", ")", ")", "{", "return", "f", ";", "}", "if", "(", "def", "!=", "null", "&&", "def", ".", "exists", "(", ")", ")", "{", "return", "def", ";", "}", "return", "null", ";", "}" ]
/* Get the file from configDrectory if it exists; otherwise return def only if it exists, or null if not
[ "/", "*", "Get", "the", "file", "from", "configDrectory", "if", "it", "exists", ";", "otherwise", "return", "def", "only", "if", "it", "exists", "or", "null", "if", "not" ]
train
https://github.com/WASdev/ci.gradle/blob/523a35e5146c1c5ab8f3aa00d353bbe91eecc180/src/main/groovy/net/wasdev/wlp/gradle/plugins/utils/ServerConfigDocument.java#L493-L502
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java
RedirectionActionHelper.buildRedirectUrlAction
public static RedirectionAction buildRedirectUrlAction(final WebContext context, final String location) { """ Build the appropriate redirection action for a location. @param context the web context @param location the location @return the appropriate redirection action """ if (ContextHelper.isPost(context) && useModernHttpCodes) { return new SeeOtherAction(location); } else { return new FoundAction(location); } }
java
public static RedirectionAction buildRedirectUrlAction(final WebContext context, final String location) { if (ContextHelper.isPost(context) && useModernHttpCodes) { return new SeeOtherAction(location); } else { return new FoundAction(location); } }
[ "public", "static", "RedirectionAction", "buildRedirectUrlAction", "(", "final", "WebContext", "context", ",", "final", "String", "location", ")", "{", "if", "(", "ContextHelper", ".", "isPost", "(", "context", ")", "&&", "useModernHttpCodes", ")", "{", "return", "new", "SeeOtherAction", "(", "location", ")", ";", "}", "else", "{", "return", "new", "FoundAction", "(", "location", ")", ";", "}", "}" ]
Build the appropriate redirection action for a location. @param context the web context @param location the location @return the appropriate redirection action
[ "Build", "the", "appropriate", "redirection", "action", "for", "a", "location", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java#L25-L31
Appendium/flatpack
flatpack/src/main/java/net/sf/flatpack/ordering/OrderBy.java
OrderBy.compare
@Override public int compare(final Row row0, final Row row1) { """ overridden from the Comparator class. Performs the sort @return int """ int result = 0; for (int i = 0; i < orderbys.size(); i++) { final OrderColumn oc = orderbys.get(i); // null indicates "detail" record which is what the parser assigns // to <column> 's setup outside of <record> elements final String mdkey0 = row0.getMdkey() == null ? FPConstants.DETAIL_ID : row0.getMdkey(); final String mdkey1 = row1.getMdkey() == null ? FPConstants.DETAIL_ID : row1.getMdkey(); // shift all non detail records to the bottom of the DataSet if (!mdkey0.equals(FPConstants.DETAIL_ID) && !mdkey1.equals(FPConstants.DETAIL_ID)) { // keep headers / trailers in the same order at the bottom of // the DataSet return 0; } else if (!mdkey0.equals(FPConstants.DETAIL_ID) || !mdkey1.equals(FPConstants.DETAIL_ID)) { return !mdkey0.equals(FPConstants.DETAIL_ID) ? 1 : 0; } result = compareCol(row0, row1, oc); // if it is = 0 then the primary sort is done, and it can start the // secondary sorts if (result != 0) { break; } } return result; }
java
@Override public int compare(final Row row0, final Row row1) { int result = 0; for (int i = 0; i < orderbys.size(); i++) { final OrderColumn oc = orderbys.get(i); // null indicates "detail" record which is what the parser assigns // to <column> 's setup outside of <record> elements final String mdkey0 = row0.getMdkey() == null ? FPConstants.DETAIL_ID : row0.getMdkey(); final String mdkey1 = row1.getMdkey() == null ? FPConstants.DETAIL_ID : row1.getMdkey(); // shift all non detail records to the bottom of the DataSet if (!mdkey0.equals(FPConstants.DETAIL_ID) && !mdkey1.equals(FPConstants.DETAIL_ID)) { // keep headers / trailers in the same order at the bottom of // the DataSet return 0; } else if (!mdkey0.equals(FPConstants.DETAIL_ID) || !mdkey1.equals(FPConstants.DETAIL_ID)) { return !mdkey0.equals(FPConstants.DETAIL_ID) ? 1 : 0; } result = compareCol(row0, row1, oc); // if it is = 0 then the primary sort is done, and it can start the // secondary sorts if (result != 0) { break; } } return result; }
[ "@", "Override", "public", "int", "compare", "(", "final", "Row", "row0", ",", "final", "Row", "row1", ")", "{", "int", "result", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "orderbys", ".", "size", "(", ")", ";", "i", "++", ")", "{", "final", "OrderColumn", "oc", "=", "orderbys", ".", "get", "(", "i", ")", ";", "// null indicates \"detail\" record which is what the parser assigns\r", "// to <column> 's setup outside of <record> elements\r", "final", "String", "mdkey0", "=", "row0", ".", "getMdkey", "(", ")", "==", "null", "?", "FPConstants", ".", "DETAIL_ID", ":", "row0", ".", "getMdkey", "(", ")", ";", "final", "String", "mdkey1", "=", "row1", ".", "getMdkey", "(", ")", "==", "null", "?", "FPConstants", ".", "DETAIL_ID", ":", "row1", ".", "getMdkey", "(", ")", ";", "// shift all non detail records to the bottom of the DataSet\r", "if", "(", "!", "mdkey0", ".", "equals", "(", "FPConstants", ".", "DETAIL_ID", ")", "&&", "!", "mdkey1", ".", "equals", "(", "FPConstants", ".", "DETAIL_ID", ")", ")", "{", "// keep headers / trailers in the same order at the bottom of\r", "// the DataSet\r", "return", "0", ";", "}", "else", "if", "(", "!", "mdkey0", ".", "equals", "(", "FPConstants", ".", "DETAIL_ID", ")", "||", "!", "mdkey1", ".", "equals", "(", "FPConstants", ".", "DETAIL_ID", ")", ")", "{", "return", "!", "mdkey0", ".", "equals", "(", "FPConstants", ".", "DETAIL_ID", ")", "?", "1", ":", "0", ";", "}", "result", "=", "compareCol", "(", "row0", ",", "row1", ",", "oc", ")", ";", "// if it is = 0 then the primary sort is done, and it can start the\r", "// secondary sorts\r", "if", "(", "result", "!=", "0", ")", "{", "break", ";", "}", "}", "return", "result", ";", "}" ]
overridden from the Comparator class. Performs the sort @return int
[ "overridden", "from", "the", "Comparator", "class", "." ]
train
https://github.com/Appendium/flatpack/blob/5e09875d97db7038e3ba6af9468f5313d99b0082/flatpack/src/main/java/net/sf/flatpack/ordering/OrderBy.java#L84-L114
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyImpl_CustomFieldSerializer.java
OWLObjectPropertyImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectProperty instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectProperty instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLObjectProperty", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyImpl_CustomFieldSerializer.java#L64-L67
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java
Dialogs.showInputDialog
public static InputDialog showInputDialog (Stage stage, String title, String fieldTitle, InputDialogListener listener) { """ Dialog with text and text field for user input. Cannot be canceled. @param title dialog title. @param fieldTitle displayed before input field, may be null. @param listener dialog buttons listener. """ InputDialog dialog = new InputDialog(title, fieldTitle, true, null, listener); stage.addActor(dialog.fadeIn()); return dialog; }
java
public static InputDialog showInputDialog (Stage stage, String title, String fieldTitle, InputDialogListener listener) { InputDialog dialog = new InputDialog(title, fieldTitle, true, null, listener); stage.addActor(dialog.fadeIn()); return dialog; }
[ "public", "static", "InputDialog", "showInputDialog", "(", "Stage", "stage", ",", "String", "title", ",", "String", "fieldTitle", ",", "InputDialogListener", "listener", ")", "{", "InputDialog", "dialog", "=", "new", "InputDialog", "(", "title", ",", "fieldTitle", ",", "true", ",", "null", ",", "listener", ")", ";", "stage", ".", "addActor", "(", "dialog", ".", "fadeIn", "(", ")", ")", ";", "return", "dialog", ";", "}" ]
Dialog with text and text field for user input. Cannot be canceled. @param title dialog title. @param fieldTitle displayed before input field, may be null. @param listener dialog buttons listener.
[ "Dialog", "with", "text", "and", "text", "field", "for", "user", "input", ".", "Cannot", "be", "canceled", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java#L110-L114
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Util.java
Util.recursiveDelete
public static void recursiveDelete(Path directory) throws IOException { """ Deletes a directory recursively with all its contents. Will ignore files and directories if they are disappear during the oprtation. @param directory directory to delete. """ try { Files.walkFileTree(directory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws java.io.IOException { try { Files.delete(file); } catch (NoSuchFileException ignore) {} return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, java.io.IOException exc) throws java.io.IOException { try{ Files.delete(dir); }catch (NoSuchFileException ignore){} return FileVisitResult.CONTINUE; } }); } catch (NoSuchFileException ignore) {} }
java
public static void recursiveDelete(Path directory) throws IOException { try { Files.walkFileTree(directory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws java.io.IOException { try { Files.delete(file); } catch (NoSuchFileException ignore) {} return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, java.io.IOException exc) throws java.io.IOException { try{ Files.delete(dir); }catch (NoSuchFileException ignore){} return FileVisitResult.CONTINUE; } }); } catch (NoSuchFileException ignore) {} }
[ "public", "static", "void", "recursiveDelete", "(", "Path", "directory", ")", "throws", "IOException", "{", "try", "{", "Files", ".", "walkFileTree", "(", "directory", ",", "new", "SimpleFileVisitor", "<", "Path", ">", "(", ")", "{", "@", "Override", "public", "FileVisitResult", "visitFile", "(", "Path", "file", ",", "BasicFileAttributes", "attrs", ")", "throws", "java", ".", "io", ".", "IOException", "{", "try", "{", "Files", ".", "delete", "(", "file", ")", ";", "}", "catch", "(", "NoSuchFileException", "ignore", ")", "{", "}", "return", "FileVisitResult", ".", "CONTINUE", ";", "}", "@", "Override", "public", "FileVisitResult", "postVisitDirectory", "(", "Path", "dir", ",", "java", ".", "io", ".", "IOException", "exc", ")", "throws", "java", ".", "io", ".", "IOException", "{", "try", "{", "Files", ".", "delete", "(", "dir", ")", ";", "}", "catch", "(", "NoSuchFileException", "ignore", ")", "{", "}", "return", "FileVisitResult", ".", "CONTINUE", ";", "}", "}", ")", ";", "}", "catch", "(", "NoSuchFileException", "ignore", ")", "{", "}", "}" ]
Deletes a directory recursively with all its contents. Will ignore files and directories if they are disappear during the oprtation. @param directory directory to delete.
[ "Deletes", "a", "directory", "recursively", "with", "all", "its", "contents", ".", "Will", "ignore", "files", "and", "directories", "if", "they", "are", "disappear", "during", "the", "oprtation", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Util.java#L547-L569
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/CollectSerIteratorFactory.java
CollectSerIteratorFactory.createIterable
@Override public SerIterable createIterable(final String metaTypeDescription, final JodaBeanSer settings, final Map<String, Class<?>> knownTypes) { """ Creates an iterator wrapper for a meta-property value. @param metaTypeDescription the description of the collection type, not null @param settings the settings object, not null @param knownTypes the known types map, null if not using known type shortening @return the iterator, null if not a collection-like type """ if (metaTypeDescription.equals("Grid")) { return grid(Object.class, EMPTY_VALUE_TYPES); } return super.createIterable(metaTypeDescription, settings, knownTypes); }
java
@Override public SerIterable createIterable(final String metaTypeDescription, final JodaBeanSer settings, final Map<String, Class<?>> knownTypes) { if (metaTypeDescription.equals("Grid")) { return grid(Object.class, EMPTY_VALUE_TYPES); } return super.createIterable(metaTypeDescription, settings, knownTypes); }
[ "@", "Override", "public", "SerIterable", "createIterable", "(", "final", "String", "metaTypeDescription", ",", "final", "JodaBeanSer", "settings", ",", "final", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "knownTypes", ")", "{", "if", "(", "metaTypeDescription", ".", "equals", "(", "\"Grid\"", ")", ")", "{", "return", "grid", "(", "Object", ".", "class", ",", "EMPTY_VALUE_TYPES", ")", ";", "}", "return", "super", ".", "createIterable", "(", "metaTypeDescription", ",", "settings", ",", "knownTypes", ")", ";", "}" ]
Creates an iterator wrapper for a meta-property value. @param metaTypeDescription the description of the collection type, not null @param settings the settings object, not null @param knownTypes the known types map, null if not using known type shortening @return the iterator, null if not a collection-like type
[ "Creates", "an", "iterator", "wrapper", "for", "a", "meta", "-", "property", "value", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/CollectSerIteratorFactory.java#L85-L91
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/xml/XmlConvertToMessage.java
XmlConvertToMessage.unmarshalRootElement
public Object unmarshalRootElement(Reader inStream, BaseXmlTrxMessageIn soapTrxMessage) throws Exception { """ Create the root element for this message. You must override this. @return The root element. """ String xml = Utility.transferURLStream(null, null, inStream, null); soapTrxMessage.getMessage().setXML(xml); return xml; }
java
public Object unmarshalRootElement(Reader inStream, BaseXmlTrxMessageIn soapTrxMessage) throws Exception { String xml = Utility.transferURLStream(null, null, inStream, null); soapTrxMessage.getMessage().setXML(xml); return xml; }
[ "public", "Object", "unmarshalRootElement", "(", "Reader", "inStream", ",", "BaseXmlTrxMessageIn", "soapTrxMessage", ")", "throws", "Exception", "{", "String", "xml", "=", "Utility", ".", "transferURLStream", "(", "null", ",", "null", ",", "inStream", ",", "null", ")", ";", "soapTrxMessage", ".", "getMessage", "(", ")", ".", "setXML", "(", "xml", ")", ";", "return", "xml", ";", "}" ]
Create the root element for this message. You must override this. @return The root element.
[ "Create", "the", "root", "element", "for", "this", "message", ".", "You", "must", "override", "this", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/xml/XmlConvertToMessage.java#L59-L65
RestComm/jss7
cap/cap-impl/src/main/java/org/restcomm/protocols/ss7/cap/CAPServiceBaseImpl.java
CAPServiceBaseImpl.createNewTCAPDialog
protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws CAPException { """ Creating new outgoing TCAP Dialog. Used when creating a new outgoing CAP Dialog @param origAddress @param destAddress @return @throws CAPException """ try { return this.capProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId); } catch (TCAPException e) { throw new CAPException(e.getMessage(), e); } }
java
protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws CAPException { try { return this.capProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId); } catch (TCAPException e) { throw new CAPException(e.getMessage(), e); } }
[ "protected", "Dialog", "createNewTCAPDialog", "(", "SccpAddress", "origAddress", ",", "SccpAddress", "destAddress", ",", "Long", "localTrId", ")", "throws", "CAPException", "{", "try", "{", "return", "this", ".", "capProviderImpl", ".", "getTCAPProvider", "(", ")", ".", "getNewDialog", "(", "origAddress", ",", "destAddress", ",", "localTrId", ")", ";", "}", "catch", "(", "TCAPException", "e", ")", "{", "throw", "new", "CAPException", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Creating new outgoing TCAP Dialog. Used when creating a new outgoing CAP Dialog @param origAddress @param destAddress @return @throws CAPException
[ "Creating", "new", "outgoing", "TCAP", "Dialog", ".", "Used", "when", "creating", "a", "new", "outgoing", "CAP", "Dialog" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/cap/cap-impl/src/main/java/org/restcomm/protocols/ss7/cap/CAPServiceBaseImpl.java#L82-L88
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/msg/MsgChecker.java
MsgChecker.replaceCallback
public MsgChecker replaceCallback(BasicCheckRule type, ValidationInvalidCallback cb) { """ Replace callback msg checker. @param type the type @param cb the cb @return the msg checker """ this.callbackMap.put(type.name(), cb); return this; }
java
public MsgChecker replaceCallback(BasicCheckRule type, ValidationInvalidCallback cb) { this.callbackMap.put(type.name(), cb); return this; }
[ "public", "MsgChecker", "replaceCallback", "(", "BasicCheckRule", "type", ",", "ValidationInvalidCallback", "cb", ")", "{", "this", ".", "callbackMap", ".", "put", "(", "type", ".", "name", "(", ")", ",", "cb", ")", ";", "return", "this", ";", "}" ]
Replace callback msg checker. @param type the type @param cb the cb @return the msg checker
[ "Replace", "callback", "msg", "checker", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/msg/MsgChecker.java#L36-L39
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringParser.java
StringParser.parseBool
public static boolean parseBool (@Nullable final Object aObject, final boolean bDefault) { """ Try to interpret the passed object as boolean. This works only if the passed object is either a {@link String} or a {@link Boolean}. @param aObject The object to be interpreted. May be <code>null</code>. @param bDefault The default value to be returned, if the object cannot be interpreted. @return The boolean representation or the default value if the passed object cannot be interpreted as a boolean. """ if (aObject instanceof Boolean) return ((Boolean) aObject).booleanValue (); if (aObject instanceof String) return parseBool ((String) aObject); return bDefault; }
java
public static boolean parseBool (@Nullable final Object aObject, final boolean bDefault) { if (aObject instanceof Boolean) return ((Boolean) aObject).booleanValue (); if (aObject instanceof String) return parseBool ((String) aObject); return bDefault; }
[ "public", "static", "boolean", "parseBool", "(", "@", "Nullable", "final", "Object", "aObject", ",", "final", "boolean", "bDefault", ")", "{", "if", "(", "aObject", "instanceof", "Boolean", ")", "return", "(", "(", "Boolean", ")", "aObject", ")", ".", "booleanValue", "(", ")", ";", "if", "(", "aObject", "instanceof", "String", ")", "return", "parseBool", "(", "(", "String", ")", "aObject", ")", ";", "return", "bDefault", ";", "}" ]
Try to interpret the passed object as boolean. This works only if the passed object is either a {@link String} or a {@link Boolean}. @param aObject The object to be interpreted. May be <code>null</code>. @param bDefault The default value to be returned, if the object cannot be interpreted. @return The boolean representation or the default value if the passed object cannot be interpreted as a boolean.
[ "Try", "to", "interpret", "the", "passed", "object", "as", "boolean", ".", "This", "works", "only", "if", "the", "passed", "object", "is", "either", "a", "{", "@link", "String", "}", "or", "a", "{", "@link", "Boolean", "}", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringParser.java#L93-L100
dita-ot/dita-ot
src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/writer/CHMIndexWriter.java
CHMIndexWriter.outputIndexTerm
private void outputIndexTerm(final IndexTerm term, final XMLSerializer serializer) throws SAXException { """ Output the given indexterm into the XML writer. @param term term to serialize @param serializer XML output to write to """ List<IndexTermTarget> targets = term.getTargetList(); final List<IndexTerm> subTerms = term.getSubTerms(); int targetNum = targets.size(); final int subTermNum = subTerms.size(); serializer.writeStartElement("li"); serializer.writeStartElement("object"); serializer.writeAttribute("type", "text/sitemap"); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", term.getTermFullName()); serializer.writeEndElement(); // param //if term doesn't has target to link to, it won't appear in the index tab //we need to create links for such terms if (targets.isEmpty()){ findTargets(term); targets = term.getTargetList(); targetNum = targets.size(); } for (int i = 0; i < targetNum; i++) { final IndexTermTarget target = targets.get(i); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", target.getTargetName()); serializer.writeEndElement(); // param serializer.writeStartElement("param"); serializer.writeAttribute("name", "Local"); serializer.writeAttribute("value", target.getTargetURI()); serializer.writeEndElement(); // param } serializer.writeEndElement(); // object if (subTermNum > 0) { serializer.writeStartElement("ul"); for (final IndexTerm subTerm : subTerms) { outputIndexTerm(subTerm, serializer); } serializer.writeEndElement(); // ul } serializer.writeEndElement(); // li }
java
private void outputIndexTerm(final IndexTerm term, final XMLSerializer serializer) throws SAXException { List<IndexTermTarget> targets = term.getTargetList(); final List<IndexTerm> subTerms = term.getSubTerms(); int targetNum = targets.size(); final int subTermNum = subTerms.size(); serializer.writeStartElement("li"); serializer.writeStartElement("object"); serializer.writeAttribute("type", "text/sitemap"); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", term.getTermFullName()); serializer.writeEndElement(); // param //if term doesn't has target to link to, it won't appear in the index tab //we need to create links for such terms if (targets.isEmpty()){ findTargets(term); targets = term.getTargetList(); targetNum = targets.size(); } for (int i = 0; i < targetNum; i++) { final IndexTermTarget target = targets.get(i); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", target.getTargetName()); serializer.writeEndElement(); // param serializer.writeStartElement("param"); serializer.writeAttribute("name", "Local"); serializer.writeAttribute("value", target.getTargetURI()); serializer.writeEndElement(); // param } serializer.writeEndElement(); // object if (subTermNum > 0) { serializer.writeStartElement("ul"); for (final IndexTerm subTerm : subTerms) { outputIndexTerm(subTerm, serializer); } serializer.writeEndElement(); // ul } serializer.writeEndElement(); // li }
[ "private", "void", "outputIndexTerm", "(", "final", "IndexTerm", "term", ",", "final", "XMLSerializer", "serializer", ")", "throws", "SAXException", "{", "List", "<", "IndexTermTarget", ">", "targets", "=", "term", ".", "getTargetList", "(", ")", ";", "final", "List", "<", "IndexTerm", ">", "subTerms", "=", "term", ".", "getSubTerms", "(", ")", ";", "int", "targetNum", "=", "targets", ".", "size", "(", ")", ";", "final", "int", "subTermNum", "=", "subTerms", ".", "size", "(", ")", ";", "serializer", ".", "writeStartElement", "(", "\"li\"", ")", ";", "serializer", ".", "writeStartElement", "(", "\"object\"", ")", ";", "serializer", ".", "writeAttribute", "(", "\"type\"", ",", "\"text/sitemap\"", ")", ";", "serializer", ".", "writeStartElement", "(", "\"param\"", ")", ";", "serializer", ".", "writeAttribute", "(", "\"name\"", ",", "\"Name\"", ")", ";", "serializer", ".", "writeAttribute", "(", "\"value\"", ",", "term", ".", "getTermFullName", "(", ")", ")", ";", "serializer", ".", "writeEndElement", "(", ")", ";", "// param", "//if term doesn't has target to link to, it won't appear in the index tab", "//we need to create links for such terms", "if", "(", "targets", ".", "isEmpty", "(", ")", ")", "{", "findTargets", "(", "term", ")", ";", "targets", "=", "term", ".", "getTargetList", "(", ")", ";", "targetNum", "=", "targets", ".", "size", "(", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "targetNum", ";", "i", "++", ")", "{", "final", "IndexTermTarget", "target", "=", "targets", ".", "get", "(", "i", ")", ";", "serializer", ".", "writeStartElement", "(", "\"param\"", ")", ";", "serializer", ".", "writeAttribute", "(", "\"name\"", ",", "\"Name\"", ")", ";", "serializer", ".", "writeAttribute", "(", "\"value\"", ",", "target", ".", "getTargetName", "(", ")", ")", ";", "serializer", ".", "writeEndElement", "(", ")", ";", "// param", "serializer", ".", "writeStartElement", "(", "\"param\"", ")", ";", "serializer", ".", "writeAttribute", "(", "\"name\"", ",", "\"Local\"", ")", ";", "serializer", ".", "writeAttribute", "(", "\"value\"", ",", "target", ".", "getTargetURI", "(", ")", ")", ";", "serializer", ".", "writeEndElement", "(", ")", ";", "// param", "}", "serializer", ".", "writeEndElement", "(", ")", ";", "// object", "if", "(", "subTermNum", ">", "0", ")", "{", "serializer", ".", "writeStartElement", "(", "\"ul\"", ")", ";", "for", "(", "final", "IndexTerm", "subTerm", ":", "subTerms", ")", "{", "outputIndexTerm", "(", "subTerm", ",", "serializer", ")", ";", "}", "serializer", ".", "writeEndElement", "(", ")", ";", "// ul", "}", "serializer", ".", "writeEndElement", "(", ")", ";", "// li", "}" ]
Output the given indexterm into the XML writer. @param term term to serialize @param serializer XML output to write to
[ "Output", "the", "given", "indexterm", "into", "the", "XML", "writer", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/writer/CHMIndexWriter.java#L87-L127
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java
JavaCompiler.genCode
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException { """ Generate code and emit a class file for a given class @param env The attribution environment of the outermost class containing this class. @param cdef The class definition from which code is generated. """ try { if (gen.genClass(env, cdef) && (errorCount() == 0)) return writer.writeClass(cdef.sym); } catch (ClassWriter.PoolOverflow ex) { log.error(cdef.pos(), "limit.pool"); } catch (ClassWriter.StringOverflow ex) { log.error(cdef.pos(), "limit.string.overflow", ex.value.substring(0, 20)); } catch (CompletionFailure ex) { chk.completionError(cdef.pos(), ex); } return null; }
java
JavaFileObject genCode(Env<AttrContext> env, JCClassDecl cdef) throws IOException { try { if (gen.genClass(env, cdef) && (errorCount() == 0)) return writer.writeClass(cdef.sym); } catch (ClassWriter.PoolOverflow ex) { log.error(cdef.pos(), "limit.pool"); } catch (ClassWriter.StringOverflow ex) { log.error(cdef.pos(), "limit.string.overflow", ex.value.substring(0, 20)); } catch (CompletionFailure ex) { chk.completionError(cdef.pos(), ex); } return null; }
[ "JavaFileObject", "genCode", "(", "Env", "<", "AttrContext", ">", "env", ",", "JCClassDecl", "cdef", ")", "throws", "IOException", "{", "try", "{", "if", "(", "gen", ".", "genClass", "(", "env", ",", "cdef", ")", "&&", "(", "errorCount", "(", ")", "==", "0", ")", ")", "return", "writer", ".", "writeClass", "(", "cdef", ".", "sym", ")", ";", "}", "catch", "(", "ClassWriter", ".", "PoolOverflow", "ex", ")", "{", "log", ".", "error", "(", "cdef", ".", "pos", "(", ")", ",", "\"limit.pool\"", ")", ";", "}", "catch", "(", "ClassWriter", ".", "StringOverflow", "ex", ")", "{", "log", ".", "error", "(", "cdef", ".", "pos", "(", ")", ",", "\"limit.string.overflow\"", ",", "ex", ".", "value", ".", "substring", "(", "0", ",", "20", ")", ")", ";", "}", "catch", "(", "CompletionFailure", "ex", ")", "{", "chk", ".", "completionError", "(", "cdef", ".", "pos", "(", ")", ",", "ex", ")", ";", "}", "return", "null", ";", "}" ]
Generate code and emit a class file for a given class @param env The attribution environment of the outermost class containing this class. @param cdef The class definition from which code is generated.
[ "Generate", "code", "and", "emit", "a", "class", "file", "for", "a", "given", "class" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L740-L753
Impetus/Kundera
examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java
ExecutorService.onPersist
static void onPersist(final EntityManager em, final User user) { """ On persist user. @param em entity manager instance. @param user user object. """ logger.info(""); logger.info(""); logger.info("#######################Persisting##########################################"); logger.info(""); logger.info(user.toString()); persist(user, em); logger.info(""); System.out.println("#######################Persisting##########################################"); logger.info(""); logger.info(""); }
java
static void onPersist(final EntityManager em, final User user) { logger.info(""); logger.info(""); logger.info("#######################Persisting##########################################"); logger.info(""); logger.info(user.toString()); persist(user, em); logger.info(""); System.out.println("#######################Persisting##########################################"); logger.info(""); logger.info(""); }
[ "static", "void", "onPersist", "(", "final", "EntityManager", "em", ",", "final", "User", "user", ")", "{", "logger", ".", "info", "(", "\"\"", ")", ";", "logger", ".", "info", "(", "\"\"", ")", ";", "logger", ".", "info", "(", "\"#######################Persisting##########################################\"", ")", ";", "logger", ".", "info", "(", "\"\"", ")", ";", "logger", ".", "info", "(", "user", ".", "toString", "(", ")", ")", ";", "persist", "(", "user", ",", "em", ")", ";", "logger", ".", "info", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"#######################Persisting##########################################\"", ")", ";", "logger", ".", "info", "(", "\"\"", ")", ";", "logger", ".", "info", "(", "\"\"", ")", ";", "}" ]
On persist user. @param em entity manager instance. @param user user object.
[ "On", "persist", "user", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java#L75-L87
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java
TopicAccessManager.checkAccessTopicFromJsTopicControl
boolean checkAccessTopicFromJsTopicControl(UserContext ctx, String topic) throws IllegalAccessException { """ Check if specific access control is allowed @param session @param topic @return true if at least one specific topicAccessControl exist @throws IllegalAccessException """ logger.debug("Looking for accessController for topic '{}' from JsTopicControl annotation", topic); Iterable<JsTopicAccessController> accessControls = topicAccessController.select(new JsTopicCtrlAnnotationLiteral(topic)); return checkAccessTopicFromControllers(ctx, topic, accessControls); }
java
boolean checkAccessTopicFromJsTopicControl(UserContext ctx, String topic) throws IllegalAccessException { logger.debug("Looking for accessController for topic '{}' from JsTopicControl annotation", topic); Iterable<JsTopicAccessController> accessControls = topicAccessController.select(new JsTopicCtrlAnnotationLiteral(topic)); return checkAccessTopicFromControllers(ctx, topic, accessControls); }
[ "boolean", "checkAccessTopicFromJsTopicControl", "(", "UserContext", "ctx", ",", "String", "topic", ")", "throws", "IllegalAccessException", "{", "logger", ".", "debug", "(", "\"Looking for accessController for topic '{}' from JsTopicControl annotation\"", ",", "topic", ")", ";", "Iterable", "<", "JsTopicAccessController", ">", "accessControls", "=", "topicAccessController", ".", "select", "(", "new", "JsTopicCtrlAnnotationLiteral", "(", "topic", ")", ")", ";", "return", "checkAccessTopicFromControllers", "(", "ctx", ",", "topic", ",", "accessControls", ")", ";", "}" ]
Check if specific access control is allowed @param session @param topic @return true if at least one specific topicAccessControl exist @throws IllegalAccessException
[ "Check", "if", "specific", "access", "control", "is", "allowed" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L80-L84
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.deleteDataLakeStoreAccount
public void deleteDataLakeStoreAccount(String resourceGroupName, String accountName, String dataLakeStoreAccountName) { """ Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account from which to remove the Data Lake Store account. @param dataLakeStoreAccountName The name of the Data Lake Store account to remove @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ deleteDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).toBlocking().single().body(); }
java
public void deleteDataLakeStoreAccount(String resourceGroupName, String accountName, String dataLakeStoreAccountName) { deleteDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName).toBlocking().single().body(); }
[ "public", "void", "deleteDataLakeStoreAccount", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "dataLakeStoreAccountName", ")", "{", "deleteDataLakeStoreAccountWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "dataLakeStoreAccountName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates the Data Lake Analytics account specified to remove the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account from which to remove the Data Lake Store account. @param dataLakeStoreAccountName The name of the Data Lake Store account to remove @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Updates", "the", "Data", "Lake", "Analytics", "account", "specified", "to", "remove", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1039-L1041
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.requiredIntAttribute
public static int requiredIntAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { """ Returns the value of an attribute as a int. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as int @throws XMLStreamException if attribute is empty. """ return requiredIntAttribute(reader, null, localName); }
java
public static int requiredIntAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredIntAttribute(reader, null, localName); }
[ "public", "static", "int", "requiredIntAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ")", "throws", "XMLStreamException", "{", "return", "requiredIntAttribute", "(", "reader", ",", "null", ",", "localName", ")", ";", "}" ]
Returns the value of an attribute as a int. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as int @throws XMLStreamException if attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "int", ".", "If", "the", "attribute", "is", "empty", "this", "method", "throws", "an", "exception", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L1217-L1220
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/util/CoronaSerializer.java
CoronaSerializer.readToken
public void readToken(String parentFieldName, JsonToken expectedToken) throws IOException { """ This is a helper method that reads a JSON token using a JsonParser instance, and throws an exception if the next token is not the same as the token we expect. @param parentFieldName The name of the field @param expectedToken The expected token @throws IOException """ JsonToken currentToken = jsonParser.nextToken(); if (currentToken != expectedToken) { throw new IOException("Expected a " + expectedToken.toString() + " token when reading the value of the field: " + parentFieldName + " but found a " + currentToken.toString() + " token"); } }
java
public void readToken(String parentFieldName, JsonToken expectedToken) throws IOException { JsonToken currentToken = jsonParser.nextToken(); if (currentToken != expectedToken) { throw new IOException("Expected a " + expectedToken.toString() + " token when reading the value of the field: " + parentFieldName + " but found a " + currentToken.toString() + " token"); } }
[ "public", "void", "readToken", "(", "String", "parentFieldName", ",", "JsonToken", "expectedToken", ")", "throws", "IOException", "{", "JsonToken", "currentToken", "=", "jsonParser", ".", "nextToken", "(", ")", ";", "if", "(", "currentToken", "!=", "expectedToken", ")", "{", "throw", "new", "IOException", "(", "\"Expected a \"", "+", "expectedToken", ".", "toString", "(", ")", "+", "\" token when reading the value of the field: \"", "+", "parentFieldName", "+", "\" but found a \"", "+", "currentToken", ".", "toString", "(", ")", "+", "\" token\"", ")", ";", "}", "}" ]
This is a helper method that reads a JSON token using a JsonParser instance, and throws an exception if the next token is not the same as the token we expect. @param parentFieldName The name of the field @param expectedToken The expected token @throws IOException
[ "This", "is", "a", "helper", "method", "that", "reads", "a", "JSON", "token", "using", "a", "JsonParser", "instance", "and", "throws", "an", "exception", "if", "the", "next", "token", "is", "not", "the", "same", "as", "the", "token", "we", "expect", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/util/CoronaSerializer.java#L121-L131
facebookarchive/hadoop-20
src/core/org/apache/hadoop/security/UnixUserGroupInformation.java
UnixUserGroupInformation.setUserGroupNames
private void setUserGroupNames(String userName, String[] groupNames) { """ /* Set this object's user name and group names @param userName a user's name @param groupNames groups list, the first of which is the default group @exception IllegalArgumentException if any argument is null """ if (userName==null || userName.length()==0 || groupNames== null || groupNames.length==0) { throw new IllegalArgumentException( "Parameters should not be null or an empty string/array"); } for (int i=0; i<groupNames.length; i++) { if(groupNames[i] == null || groupNames[i].length() == 0) { throw new IllegalArgumentException("A null group name at index " + i); } } this.userName = userName; this.groupNames = groupNames; }
java
private void setUserGroupNames(String userName, String[] groupNames) { if (userName==null || userName.length()==0 || groupNames== null || groupNames.length==0) { throw new IllegalArgumentException( "Parameters should not be null or an empty string/array"); } for (int i=0; i<groupNames.length; i++) { if(groupNames[i] == null || groupNames[i].length() == 0) { throw new IllegalArgumentException("A null group name at index " + i); } } this.userName = userName; this.groupNames = groupNames; }
[ "private", "void", "setUserGroupNames", "(", "String", "userName", ",", "String", "[", "]", "groupNames", ")", "{", "if", "(", "userName", "==", "null", "||", "userName", ".", "length", "(", ")", "==", "0", "||", "groupNames", "==", "null", "||", "groupNames", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameters should not be null or an empty string/array\"", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "groupNames", ".", "length", ";", "i", "++", ")", "{", "if", "(", "groupNames", "[", "i", "]", "==", "null", "||", "groupNames", "[", "i", "]", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A null group name at index \"", "+", "i", ")", ";", "}", "}", "this", ".", "userName", "=", "userName", ";", "this", ".", "groupNames", "=", "groupNames", ";", "}" ]
/* Set this object's user name and group names @param userName a user's name @param groupNames groups list, the first of which is the default group @exception IllegalArgumentException if any argument is null
[ "/", "*", "Set", "this", "object", "s", "user", "name", "and", "group", "names" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/UnixUserGroupInformation.java#L109-L122
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.lossyEquals
public static boolean lossyEquals(final Locale locale, final String source, final String target) { """ <p> Same as {@link #lossyEquals(String, String)} for the specified locale. </p> @param locale The target locale @param source The source string to be compared @param target The target string to be compared @return true if the two strings are equals according to primary differences only, false otherwise """ return withinLocale(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return lossyEquals(source, target); } }, locale); }
java
public static boolean lossyEquals(final Locale locale, final String source, final String target) { return withinLocale(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return lossyEquals(source, target); } }, locale); }
[ "public", "static", "boolean", "lossyEquals", "(", "final", "Locale", "locale", ",", "final", "String", "source", ",", "final", "String", "target", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "call", "(", ")", "throws", "Exception", "{", "return", "lossyEquals", "(", "source", ",", "target", ")", ";", "}", "}", ",", "locale", ")", ";", "}" ]
<p> Same as {@link #lossyEquals(String, String)} for the specified locale. </p> @param locale The target locale @param source The source string to be compared @param target The target string to be compared @return true if the two strings are equals according to primary differences only, false otherwise
[ "<p", ">", "Same", "as", "{", "@link", "#lossyEquals", "(", "String", "String", ")", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1242-L1253
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/avro/AvroSchemaManager.java
AvroSchemaManager.getOrGenerateSchemaFile
private Path getOrGenerateSchemaFile(Schema schema) throws IOException { """ If url for schema already exists, return the url. If not create a new temporary schema file and return a the url. """ Preconditions.checkNotNull(schema, "Avro Schema should not be null"); String hashedSchema = Hashing.sha256().hashString(schema.toString(), StandardCharsets.UTF_8).toString(); if (!this.schemaPaths.containsKey(hashedSchema)) { Path schemaFilePath = new Path(this.schemaDir, String.valueOf(System.currentTimeMillis() + ".avsc")); AvroUtils.writeSchemaToFile(schema, schemaFilePath, fs, true); this.schemaPaths.put(hashedSchema, schemaFilePath); } return this.schemaPaths.get(hashedSchema); }
java
private Path getOrGenerateSchemaFile(Schema schema) throws IOException { Preconditions.checkNotNull(schema, "Avro Schema should not be null"); String hashedSchema = Hashing.sha256().hashString(schema.toString(), StandardCharsets.UTF_8).toString(); if (!this.schemaPaths.containsKey(hashedSchema)) { Path schemaFilePath = new Path(this.schemaDir, String.valueOf(System.currentTimeMillis() + ".avsc")); AvroUtils.writeSchemaToFile(schema, schemaFilePath, fs, true); this.schemaPaths.put(hashedSchema, schemaFilePath); } return this.schemaPaths.get(hashedSchema); }
[ "private", "Path", "getOrGenerateSchemaFile", "(", "Schema", "schema", ")", "throws", "IOException", "{", "Preconditions", ".", "checkNotNull", "(", "schema", ",", "\"Avro Schema should not be null\"", ")", ";", "String", "hashedSchema", "=", "Hashing", ".", "sha256", "(", ")", ".", "hashString", "(", "schema", ".", "toString", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ".", "toString", "(", ")", ";", "if", "(", "!", "this", ".", "schemaPaths", ".", "containsKey", "(", "hashedSchema", ")", ")", "{", "Path", "schemaFilePath", "=", "new", "Path", "(", "this", ".", "schemaDir", ",", "String", ".", "valueOf", "(", "System", ".", "currentTimeMillis", "(", ")", "+", "\".avsc\"", ")", ")", ";", "AvroUtils", ".", "writeSchemaToFile", "(", "schema", ",", "schemaFilePath", ",", "fs", ",", "true", ")", ";", "this", ".", "schemaPaths", ".", "put", "(", "hashedSchema", ",", "schemaFilePath", ")", ";", "}", "return", "this", ".", "schemaPaths", ".", "get", "(", "hashedSchema", ")", ";", "}" ]
If url for schema already exists, return the url. If not create a new temporary schema file and return a the url.
[ "If", "url", "for", "schema", "already", "exists", "return", "the", "url", ".", "If", "not", "create", "a", "new", "temporary", "schema", "file", "and", "return", "a", "the", "url", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/avro/AvroSchemaManager.java#L185-L200
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java
DisksInner.grantAccess
public AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData) { """ Grants access to a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @param grantAccessData Access data object supplied in the body of the get disk access operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AccessUriInner object if successful. """ return grantAccessWithServiceResponseAsync(resourceGroupName, diskName, grantAccessData).toBlocking().last().body(); }
java
public AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData) { return grantAccessWithServiceResponseAsync(resourceGroupName, diskName, grantAccessData).toBlocking().last().body(); }
[ "public", "AccessUriInner", "grantAccess", "(", "String", "resourceGroupName", ",", "String", "diskName", ",", "GrantAccessData", "grantAccessData", ")", "{", "return", "grantAccessWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ",", "grantAccessData", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Grants access to a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @param grantAccessData Access data object supplied in the body of the get disk access operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AccessUriInner object if successful.
[ "Grants", "access", "to", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L951-L953
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Attributes.java
Attributes.putValue
public String putValue(String name, String value) { """ Associates the specified value with the specified attribute name, specified as a String. The attributes name is case-insensitive. If the Map previously contained a mapping for the attribute name, the old value is replaced. <p> This method is defined as: <pre> return (String)put(new Attributes.Name(name), value); </pre> @param name the attribute name as a string @param value the attribute value @return the previous value of the attribute, or null if none @exception IllegalArgumentException if the attribute name is invalid """ return (String)put(new Name(name), value); }
java
public String putValue(String name, String value) { return (String)put(new Name(name), value); }
[ "public", "String", "putValue", "(", "String", "name", ",", "String", "value", ")", "{", "return", "(", "String", ")", "put", "(", "new", "Name", "(", "name", ")", ",", "value", ")", ";", "}" ]
Associates the specified value with the specified attribute name, specified as a String. The attributes name is case-insensitive. If the Map previously contained a mapping for the attribute name, the old value is replaced. <p> This method is defined as: <pre> return (String)put(new Attributes.Name(name), value); </pre> @param name the attribute name as a string @param value the attribute value @return the previous value of the attribute, or null if none @exception IllegalArgumentException if the attribute name is invalid
[ "Associates", "the", "specified", "value", "with", "the", "specified", "attribute", "name", "specified", "as", "a", "String", ".", "The", "attributes", "name", "is", "case", "-", "insensitive", ".", "If", "the", "Map", "previously", "contained", "a", "mapping", "for", "the", "attribute", "name", "the", "old", "value", "is", "replaced", ".", "<p", ">", "This", "method", "is", "defined", "as", ":", "<pre", ">", "return", "(", "String", ")", "put", "(", "new", "Attributes", ".", "Name", "(", "name", ")", "value", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Attributes.java#L168-L170
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java
RunsInner.getAsync
public Observable<RunInner> getAsync(String resourceGroupName, String registryName, String runId) { """ Gets the detailed information for a given run. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param runId The run ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RunInner object """ return getWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
java
public Observable<RunInner> getAsync(String resourceGroupName, String registryName, String runId) { return getWithServiceResponseAsync(resourceGroupName, registryName, runId).map(new Func1<ServiceResponse<RunInner>, RunInner>() { @Override public RunInner call(ServiceResponse<RunInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RunInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "runId", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "runId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RunInner", ">", ",", "RunInner", ">", "(", ")", "{", "@", "Override", "public", "RunInner", "call", "(", "ServiceResponse", "<", "RunInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the detailed information for a given run. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param runId The run ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RunInner object
[ "Gets", "the", "detailed", "information", "for", "a", "given", "run", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RunsInner.java#L383-L390
buschmais/extended-objects
impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java
MetadataProviderImpl.isOfDefinitionType
private boolean isOfDefinitionType(AnnotatedType annotatedType, Class<? extends Annotation> definitionType) { """ Determines if an {@link AnnotatedType} represents a specific type identified by a meta annotation. @param annotatedType The {@link AnnotatedType}. @param definitionType The meta annotation. @return <code>true</code> if the annotated type represents relation type. """ Annotation definition = annotatedType.getByMetaAnnotation(definitionType); if (definition != null) { return true; } for (Class<?> superType : annotatedType.getAnnotatedElement().getInterfaces()) { if (isOfDefinitionType(new AnnotatedType(superType), definitionType)) { return true; } } return false; }
java
private boolean isOfDefinitionType(AnnotatedType annotatedType, Class<? extends Annotation> definitionType) { Annotation definition = annotatedType.getByMetaAnnotation(definitionType); if (definition != null) { return true; } for (Class<?> superType : annotatedType.getAnnotatedElement().getInterfaces()) { if (isOfDefinitionType(new AnnotatedType(superType), definitionType)) { return true; } } return false; }
[ "private", "boolean", "isOfDefinitionType", "(", "AnnotatedType", "annotatedType", ",", "Class", "<", "?", "extends", "Annotation", ">", "definitionType", ")", "{", "Annotation", "definition", "=", "annotatedType", ".", "getByMetaAnnotation", "(", "definitionType", ")", ";", "if", "(", "definition", "!=", "null", ")", "{", "return", "true", ";", "}", "for", "(", "Class", "<", "?", ">", "superType", ":", "annotatedType", ".", "getAnnotatedElement", "(", ")", ".", "getInterfaces", "(", ")", ")", "{", "if", "(", "isOfDefinitionType", "(", "new", "AnnotatedType", "(", "superType", ")", ",", "definitionType", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Determines if an {@link AnnotatedType} represents a specific type identified by a meta annotation. @param annotatedType The {@link AnnotatedType}. @param definitionType The meta annotation. @return <code>true</code> if the annotated type represents relation type.
[ "Determines", "if", "an", "{", "@link", "AnnotatedType", "}", "represents", "a", "specific", "type", "identified", "by", "a", "meta", "annotation", "." ]
train
https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java#L241-L252
apereo/cas
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java
LdapUtils.newLdaptiveSearchFilter
public static SearchFilter newLdaptiveSearchFilter(final String filterQuery, final String paramName, final List<String> params) { """ Constructs a new search filter using {@link SearchExecutor#getSearchFilter()} as a template and the username as a parameter. @param filterQuery the query filter @param paramName the param name @param params the username @return Search filter with parameters applied. """ val filter = new SearchFilter(); filter.setFilter(filterQuery); if (params != null) { IntStream.range(0, params.size()).forEach(i -> { if (filter.getFilter().contains("{" + i + '}')) { filter.setParameter(i, params.get(i)); } else { filter.setParameter(paramName, params.get(i)); } }); } LOGGER.debug("Constructed LDAP search filter [{}]", filter.format()); return filter; }
java
public static SearchFilter newLdaptiveSearchFilter(final String filterQuery, final String paramName, final List<String> params) { val filter = new SearchFilter(); filter.setFilter(filterQuery); if (params != null) { IntStream.range(0, params.size()).forEach(i -> { if (filter.getFilter().contains("{" + i + '}')) { filter.setParameter(i, params.get(i)); } else { filter.setParameter(paramName, params.get(i)); } }); } LOGGER.debug("Constructed LDAP search filter [{}]", filter.format()); return filter; }
[ "public", "static", "SearchFilter", "newLdaptiveSearchFilter", "(", "final", "String", "filterQuery", ",", "final", "String", "paramName", ",", "final", "List", "<", "String", ">", "params", ")", "{", "val", "filter", "=", "new", "SearchFilter", "(", ")", ";", "filter", ".", "setFilter", "(", "filterQuery", ")", ";", "if", "(", "params", "!=", "null", ")", "{", "IntStream", ".", "range", "(", "0", ",", "params", ".", "size", "(", ")", ")", ".", "forEach", "(", "i", "->", "{", "if", "(", "filter", ".", "getFilter", "(", ")", ".", "contains", "(", "\"{\"", "+", "i", "+", "'", "'", ")", ")", "{", "filter", ".", "setParameter", "(", "i", ",", "params", ".", "get", "(", "i", ")", ")", ";", "}", "else", "{", "filter", ".", "setParameter", "(", "paramName", ",", "params", ".", "get", "(", "i", ")", ")", ";", "}", "}", ")", ";", "}", "LOGGER", ".", "debug", "(", "\"Constructed LDAP search filter [{}]\"", ",", "filter", ".", "format", "(", ")", ")", ";", "return", "filter", ";", "}" ]
Constructs a new search filter using {@link SearchExecutor#getSearchFilter()} as a template and the username as a parameter. @param filterQuery the query filter @param paramName the param name @param params the username @return Search filter with parameters applied.
[ "Constructs", "a", "new", "search", "filter", "using", "{", "@link", "SearchExecutor#getSearchFilter", "()", "}", "as", "a", "template", "and", "the", "username", "as", "a", "parameter", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L525-L539
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java
SAXRecords.getSimpleMotifs
public ArrayList<SAXRecord> getSimpleMotifs(int num) { """ Get motifs. @param num how many motifs to report. @return the array of motif SAXRecords. """ ArrayList<SAXRecord> res = new ArrayList<SAXRecord>(num); DoublyLinkedSortedList<Entry<String, SAXRecord>> list = new DoublyLinkedSortedList<Entry<String, SAXRecord>>( num, new Comparator<Entry<String, SAXRecord>>() { @Override public int compare(Entry<String, SAXRecord> o1, Entry<String, SAXRecord> o2) { int f1 = o1.getValue().getIndexes().size(); int f2 = o2.getValue().getIndexes().size(); return Integer.compare(f1, f2); } }); for (Entry<String, SAXRecord> e : this.records.entrySet()) { list.addElement(e); } Iterator<Entry<String, SAXRecord>> i = list.iterator(); while (i.hasNext()) { res.add(i.next().getValue()); } return res; }
java
public ArrayList<SAXRecord> getSimpleMotifs(int num) { ArrayList<SAXRecord> res = new ArrayList<SAXRecord>(num); DoublyLinkedSortedList<Entry<String, SAXRecord>> list = new DoublyLinkedSortedList<Entry<String, SAXRecord>>( num, new Comparator<Entry<String, SAXRecord>>() { @Override public int compare(Entry<String, SAXRecord> o1, Entry<String, SAXRecord> o2) { int f1 = o1.getValue().getIndexes().size(); int f2 = o2.getValue().getIndexes().size(); return Integer.compare(f1, f2); } }); for (Entry<String, SAXRecord> e : this.records.entrySet()) { list.addElement(e); } Iterator<Entry<String, SAXRecord>> i = list.iterator(); while (i.hasNext()) { res.add(i.next().getValue()); } return res; }
[ "public", "ArrayList", "<", "SAXRecord", ">", "getSimpleMotifs", "(", "int", "num", ")", "{", "ArrayList", "<", "SAXRecord", ">", "res", "=", "new", "ArrayList", "<", "SAXRecord", ">", "(", "num", ")", ";", "DoublyLinkedSortedList", "<", "Entry", "<", "String", ",", "SAXRecord", ">", ">", "list", "=", "new", "DoublyLinkedSortedList", "<", "Entry", "<", "String", ",", "SAXRecord", ">", ">", "(", "num", ",", "new", "Comparator", "<", "Entry", "<", "String", ",", "SAXRecord", ">", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Entry", "<", "String", ",", "SAXRecord", ">", "o1", ",", "Entry", "<", "String", ",", "SAXRecord", ">", "o2", ")", "{", "int", "f1", "=", "o1", ".", "getValue", "(", ")", ".", "getIndexes", "(", ")", ".", "size", "(", ")", ";", "int", "f2", "=", "o2", ".", "getValue", "(", ")", ".", "getIndexes", "(", ")", ".", "size", "(", ")", ";", "return", "Integer", ".", "compare", "(", "f1", ",", "f2", ")", ";", "}", "}", ")", ";", "for", "(", "Entry", "<", "String", ",", "SAXRecord", ">", "e", ":", "this", ".", "records", ".", "entrySet", "(", ")", ")", "{", "list", ".", "addElement", "(", "e", ")", ";", "}", "Iterator", "<", "Entry", "<", "String", ",", "SAXRecord", ">", ">", "i", "=", "list", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "res", ".", "add", "(", "i", ".", "next", "(", ")", ".", "getValue", "(", ")", ")", ";", "}", "return", "res", ";", "}" ]
Get motifs. @param num how many motifs to report. @return the array of motif SAXRecords.
[ "Get", "motifs", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/datastructure/SAXRecords.java#L271-L290
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java
WorkerHelper.shredInputStream
public static void shredInputStream(final INodeWriteTrx wtx, final InputStream value, final EShredderInsert child) { """ Shreds a given InputStream @param wtx current write transaction reference @param value InputStream to be shred """ final XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLEventReader parser; try { parser = factory.createXMLEventReader(value); } catch (final XMLStreamException xmlse) { throw new WebApplicationException(xmlse); } try { final XMLShredder shredder = new XMLShredder(wtx, parser, child); shredder.call(); } catch (final Exception exce) { throw new WebApplicationException(exce); } }
java
public static void shredInputStream(final INodeWriteTrx wtx, final InputStream value, final EShredderInsert child) { final XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLEventReader parser; try { parser = factory.createXMLEventReader(value); } catch (final XMLStreamException xmlse) { throw new WebApplicationException(xmlse); } try { final XMLShredder shredder = new XMLShredder(wtx, parser, child); shredder.call(); } catch (final Exception exce) { throw new WebApplicationException(exce); } }
[ "public", "static", "void", "shredInputStream", "(", "final", "INodeWriteTrx", "wtx", ",", "final", "InputStream", "value", ",", "final", "EShredderInsert", "child", ")", "{", "final", "XMLInputFactory", "factory", "=", "XMLInputFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setProperty", "(", "XMLInputFactory", ".", "SUPPORT_DTD", ",", "false", ")", ";", "XMLEventReader", "parser", ";", "try", "{", "parser", "=", "factory", ".", "createXMLEventReader", "(", "value", ")", ";", "}", "catch", "(", "final", "XMLStreamException", "xmlse", ")", "{", "throw", "new", "WebApplicationException", "(", "xmlse", ")", ";", "}", "try", "{", "final", "XMLShredder", "shredder", "=", "new", "XMLShredder", "(", "wtx", ",", "parser", ",", "child", ")", ";", "shredder", ".", "call", "(", ")", ";", "}", "catch", "(", "final", "Exception", "exce", ")", "{", "throw", "new", "WebApplicationException", "(", "exce", ")", ";", "}", "}" ]
Shreds a given InputStream @param wtx current write transaction reference @param value InputStream to be shred
[ "Shreds", "a", "given", "InputStream" ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java#L91-L108
dbmdz/iiif-presentation-api
iiif-presentation-frontend-impl-springmvc/src/main/java/de/digitalcollections/iiif/presentation/frontend/impl/springmvc/controller/v2/IIIFPresentationApiController.java
IIIFPresentationApiController.getManifest
@CrossOrigin(allowedHeaders = { """ The manifest response contains sufficient information for the client to initialize itself and begin to display something quickly to the user. The manifest resource represents a single object and any intellectual work or works embodied within that object. In particular it includes the descriptive, rights and linking information for the object. It then embeds the sequence(s) of canvases that should be rendered to the user. @param identifier unique id of object to be shown @param request request containing client information for logging @return the JSON-Manifest @throws NotFoundException if manifest can not be delivered @throws de.digitalcollections.iiif.presentation.model.api.exceptions.InvalidDataException if manifest can not be read @see <a href="http://iiif.io/api/presentation/2.0/#manifest">IIIF 2.0</a> """"*"}, origins = {"*"}) @RequestMapping(value = {"{identifier}/manifest", "{identifier}"}, method = RequestMethod.GET, produces = "application/json") @ResponseBody public Manifest getManifest(@PathVariable String identifier, HttpServletRequest request) throws NotFoundException, InvalidDataException { HttpLoggingUtilities.addRequestClientInfoToMDC(request); MDC.put("manifestId", identifier); try { Manifest manifest = presentationService.getManifest(identifier); LOGGER.info("Serving manifest for {}", identifier); return manifest; } catch (NotFoundException e) { LOGGER.info("Did not find manifest for {}", identifier); throw e; } catch (InvalidDataException e) { LOGGER.error("Bad data for {}", identifier); throw e; } finally { MDC.clear(); } }
java
@CrossOrigin(allowedHeaders = {"*"}, origins = {"*"}) @RequestMapping(value = {"{identifier}/manifest", "{identifier}"}, method = RequestMethod.GET, produces = "application/json") @ResponseBody public Manifest getManifest(@PathVariable String identifier, HttpServletRequest request) throws NotFoundException, InvalidDataException { HttpLoggingUtilities.addRequestClientInfoToMDC(request); MDC.put("manifestId", identifier); try { Manifest manifest = presentationService.getManifest(identifier); LOGGER.info("Serving manifest for {}", identifier); return manifest; } catch (NotFoundException e) { LOGGER.info("Did not find manifest for {}", identifier); throw e; } catch (InvalidDataException e) { LOGGER.error("Bad data for {}", identifier); throw e; } finally { MDC.clear(); } }
[ "@", "CrossOrigin", "(", "allowedHeaders", "=", "{", "\"*\"", "}", ",", "origins", "=", "{", "\"*\"", "}", ")", "@", "RequestMapping", "(", "value", "=", "{", "\"{identifier}/manifest\"", ",", "\"{identifier}\"", "}", ",", "method", "=", "RequestMethod", ".", "GET", ",", "produces", "=", "\"application/json\"", ")", "@", "ResponseBody", "public", "Manifest", "getManifest", "(", "@", "PathVariable", "String", "identifier", ",", "HttpServletRequest", "request", ")", "throws", "NotFoundException", ",", "InvalidDataException", "{", "HttpLoggingUtilities", ".", "addRequestClientInfoToMDC", "(", "request", ")", ";", "MDC", ".", "put", "(", "\"manifestId\"", ",", "identifier", ")", ";", "try", "{", "Manifest", "manifest", "=", "presentationService", ".", "getManifest", "(", "identifier", ")", ";", "LOGGER", ".", "info", "(", "\"Serving manifest for {}\"", ",", "identifier", ")", ";", "return", "manifest", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "LOGGER", ".", "info", "(", "\"Did not find manifest for {}\"", ",", "identifier", ")", ";", "throw", "e", ";", "}", "catch", "(", "InvalidDataException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Bad data for {}\"", ",", "identifier", ")", ";", "throw", "e", ";", "}", "finally", "{", "MDC", ".", "clear", "(", ")", ";", "}", "}" ]
The manifest response contains sufficient information for the client to initialize itself and begin to display something quickly to the user. The manifest resource represents a single object and any intellectual work or works embodied within that object. In particular it includes the descriptive, rights and linking information for the object. It then embeds the sequence(s) of canvases that should be rendered to the user. @param identifier unique id of object to be shown @param request request containing client information for logging @return the JSON-Manifest @throws NotFoundException if manifest can not be delivered @throws de.digitalcollections.iiif.presentation.model.api.exceptions.InvalidDataException if manifest can not be read @see <a href="http://iiif.io/api/presentation/2.0/#manifest">IIIF 2.0</a>
[ "The", "manifest", "response", "contains", "sufficient", "information", "for", "the", "client", "to", "initialize", "itself", "and", "begin", "to", "display", "something", "quickly", "to", "the", "user", ".", "The", "manifest", "resource", "represents", "a", "single", "object", "and", "any", "intellectual", "work", "or", "works", "embodied", "within", "that", "object", ".", "In", "particular", "it", "includes", "the", "descriptive", "rights", "and", "linking", "information", "for", "the", "object", ".", "It", "then", "embeds", "the", "sequence", "(", "s", ")", "of", "canvases", "that", "should", "be", "rendered", "to", "the", "user", "." ]
train
https://github.com/dbmdz/iiif-presentation-api/blob/8b551d3717eed2620bc9e50b4c23f945b73b9cea/iiif-presentation-frontend-impl-springmvc/src/main/java/de/digitalcollections/iiif/presentation/frontend/impl/springmvc/controller/v2/IIIFPresentationApiController.java#L55-L75
stratosphere/stratosphere
stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/MessagingFunction.java
MessagingFunction.sendMessageTo
public void sendMessageTo(VertexKey target, Message m) { """ Sends the given message to the vertex identified by the given key. If the target vertex does not exist, the next superstep will cause an exception due to a non-deliverable message. @param target The key (id) of the target vertex to message. @param m The message. """ outValue.f0 = target; outValue.f1 = m; out.collect(outValue); }
java
public void sendMessageTo(VertexKey target, Message m) { outValue.f0 = target; outValue.f1 = m; out.collect(outValue); }
[ "public", "void", "sendMessageTo", "(", "VertexKey", "target", ",", "Message", "m", ")", "{", "outValue", ".", "f0", "=", "target", ";", "outValue", ".", "f1", "=", "m", ";", "out", ".", "collect", "(", "outValue", ")", ";", "}" ]
Sends the given message to the vertex identified by the given key. If the target vertex does not exist, the next superstep will cause an exception due to a non-deliverable message. @param target The key (id) of the target vertex to message. @param m The message.
[ "Sends", "the", "given", "message", "to", "the", "vertex", "identified", "by", "the", "given", "key", ".", "If", "the", "target", "vertex", "does", "not", "exist", "the", "next", "superstep", "will", "cause", "an", "exception", "due", "to", "a", "non", "-", "deliverable", "message", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/MessagingFunction.java#L122-L126
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/CustomMatchingStrategy.java
CustomMatchingStrategy.getCollectionMatchForWebResourceCollection
@Override protected CollectionMatch getCollectionMatchForWebResourceCollection(WebResourceCollection webResourceCollection, String resourceName, String method) { """ Gets the collection match for the web resource collection based on the following custom method algorithm. <pre> Custom method matching use case. Happy path: 1. Validate the resource name matches one of the URL patterns 2. Validate the method matches 3. Return the collection match found Exceptional path: 1.a If resource name does not match, return RESPONSE_NO_MATCH. 2.a If method does not match, determine that it is listed and return RESPONSE_NO_MATCH. 2.b When method is not listed, the match is null and it is processed by method getMatchResponse turning it into a CUSTOM_NO_MATCH_RESPONSE. </pre> """ CollectionMatch match = null; CollectionMatch collectionMatchFound = webResourceCollection.performUrlMatch(resourceName); if (collectionMatchFound != null) { if (webResourceCollection.isMethodMatched(method)) { match = collectionMatchFound; } else if (webResourceCollection.isMethodListed(method)) { match = CollectionMatch.RESPONSE_NO_MATCH; } } else { match = CollectionMatch.RESPONSE_NO_MATCH; } return match; }
java
@Override protected CollectionMatch getCollectionMatchForWebResourceCollection(WebResourceCollection webResourceCollection, String resourceName, String method) { CollectionMatch match = null; CollectionMatch collectionMatchFound = webResourceCollection.performUrlMatch(resourceName); if (collectionMatchFound != null) { if (webResourceCollection.isMethodMatched(method)) { match = collectionMatchFound; } else if (webResourceCollection.isMethodListed(method)) { match = CollectionMatch.RESPONSE_NO_MATCH; } } else { match = CollectionMatch.RESPONSE_NO_MATCH; } return match; }
[ "@", "Override", "protected", "CollectionMatch", "getCollectionMatchForWebResourceCollection", "(", "WebResourceCollection", "webResourceCollection", ",", "String", "resourceName", ",", "String", "method", ")", "{", "CollectionMatch", "match", "=", "null", ";", "CollectionMatch", "collectionMatchFound", "=", "webResourceCollection", ".", "performUrlMatch", "(", "resourceName", ")", ";", "if", "(", "collectionMatchFound", "!=", "null", ")", "{", "if", "(", "webResourceCollection", ".", "isMethodMatched", "(", "method", ")", ")", "{", "match", "=", "collectionMatchFound", ";", "}", "else", "if", "(", "webResourceCollection", ".", "isMethodListed", "(", "method", ")", ")", "{", "match", "=", "CollectionMatch", ".", "RESPONSE_NO_MATCH", ";", "}", "}", "else", "{", "match", "=", "CollectionMatch", ".", "RESPONSE_NO_MATCH", ";", "}", "return", "match", ";", "}" ]
Gets the collection match for the web resource collection based on the following custom method algorithm. <pre> Custom method matching use case. Happy path: 1. Validate the resource name matches one of the URL patterns 2. Validate the method matches 3. Return the collection match found Exceptional path: 1.a If resource name does not match, return RESPONSE_NO_MATCH. 2.a If method does not match, determine that it is listed and return RESPONSE_NO_MATCH. 2.b When method is not listed, the match is null and it is processed by method getMatchResponse turning it into a CUSTOM_NO_MATCH_RESPONSE. </pre>
[ "Gets", "the", "collection", "match", "for", "the", "web", "resource", "collection", "based", "on", "the", "following", "custom", "method", "algorithm", ".", "<pre", ">", "Custom", "method", "matching", "use", "case", ".", "Happy", "path", ":", "1", ".", "Validate", "the", "resource", "name", "matches", "one", "of", "the", "URL", "patterns", "2", ".", "Validate", "the", "method", "matches", "3", ".", "Return", "the", "collection", "match", "found" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/CustomMatchingStrategy.java#L83-L97
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java
ReflectionUtils.assertNoPrimitiveParameters
public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation) { """ Asserts method don't declare primitive parameters. @param method to validate @param annotation annotation to propagate in exception message """ for (Class<?> type : method.getParameterTypes()) { if (type.isPrimitive()) { throw annotation == null ? MESSAGES.methodCannotDeclarePrimitiveParameters(method) : MESSAGES.methodCannotDeclarePrimitiveParameters2(method, annotation); } } }
java
public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation) { for (Class<?> type : method.getParameterTypes()) { if (type.isPrimitive()) { throw annotation == null ? MESSAGES.methodCannotDeclarePrimitiveParameters(method) : MESSAGES.methodCannotDeclarePrimitiveParameters2(method, annotation); } } }
[ "public", "static", "void", "assertNoPrimitiveParameters", "(", "final", "Method", "method", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "for", "(", "Class", "<", "?", ">", "type", ":", "method", ".", "getParameterTypes", "(", ")", ")", "{", "if", "(", "type", ".", "isPrimitive", "(", ")", ")", "{", "throw", "annotation", "==", "null", "?", "MESSAGES", ".", "methodCannotDeclarePrimitiveParameters", "(", "method", ")", ":", "MESSAGES", ".", "methodCannotDeclarePrimitiveParameters2", "(", "method", ",", "annotation", ")", ";", "}", "}", "}" ]
Asserts method don't declare primitive parameters. @param method to validate @param annotation annotation to propagate in exception message
[ "Asserts", "method", "don", "t", "declare", "primitive", "parameters", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L53-L62
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java
DOMHelper.getNamespaceForPrefix
public String getNamespaceForPrefix(String prefix, Element namespaceContext) { """ Given an XML Namespace prefix and a context in which the prefix is to be evaluated, return the Namespace Name this prefix was bound to. Note that DOM Level 3 is expected to provide a version of this which deals with the DOM's "early binding" behavior. Default handling: @param prefix String containing namespace prefix to be resolved, without the ':' which separates it from the localname when used in a Node Name. The empty sting signifies the default namespace at this point in the document. @param namespaceContext Element which provides context for resolution. (We could extend this to work for other nodes by first seeking their nearest Element ancestor.) @return a String containing the Namespace URI which this prefix represents in the specified context. """ int type; Node parent = namespaceContext; String namespace = null; if (prefix.equals("xml")) { namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec } else if(prefix.equals("xmlns")) { // Hardcoded in the DOM spec, expected to be adopted by // Namespace spec. NOTE: Namespace declarations _must_ use // the xmlns: prefix; other prefixes declared as belonging // to this namespace will not be recognized and should // probably be rejected by parsers as erroneous declarations. namespace = "http://www.w3.org/2000/xmlns/"; } else { // Attribute name for this prefix's declaration String declname=(prefix=="") ? "xmlns" : "xmlns:"+prefix; // Scan until we run out of Elements or have resolved the namespace while ((null != parent) && (null == namespace) && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) || (type == Node.ENTITY_REFERENCE_NODE))) { if (type == Node.ELEMENT_NODE) { // Look for the appropriate Namespace Declaration attribute, // either "xmlns:prefix" or (if prefix is "") "xmlns". // TODO: This does not handle "implicit declarations" // which may be created when the DOM is edited. DOM Level // 3 will define how those should be interpreted. But // this issue won't arise in freshly-parsed DOMs. // NOTE: declname is set earlier, outside the loop. Attr attr=((Element)parent).getAttributeNode(declname); if(attr!=null) { namespace = attr.getNodeValue(); break; } } parent = getParentOfNode(parent); } } return namespace; }
java
public String getNamespaceForPrefix(String prefix, Element namespaceContext) { int type; Node parent = namespaceContext; String namespace = null; if (prefix.equals("xml")) { namespace = QName.S_XMLNAMESPACEURI; // Hardcoded, per Namespace spec } else if(prefix.equals("xmlns")) { // Hardcoded in the DOM spec, expected to be adopted by // Namespace spec. NOTE: Namespace declarations _must_ use // the xmlns: prefix; other prefixes declared as belonging // to this namespace will not be recognized and should // probably be rejected by parsers as erroneous declarations. namespace = "http://www.w3.org/2000/xmlns/"; } else { // Attribute name for this prefix's declaration String declname=(prefix=="") ? "xmlns" : "xmlns:"+prefix; // Scan until we run out of Elements or have resolved the namespace while ((null != parent) && (null == namespace) && (((type = parent.getNodeType()) == Node.ELEMENT_NODE) || (type == Node.ENTITY_REFERENCE_NODE))) { if (type == Node.ELEMENT_NODE) { // Look for the appropriate Namespace Declaration attribute, // either "xmlns:prefix" or (if prefix is "") "xmlns". // TODO: This does not handle "implicit declarations" // which may be created when the DOM is edited. DOM Level // 3 will define how those should be interpreted. But // this issue won't arise in freshly-parsed DOMs. // NOTE: declname is set earlier, outside the loop. Attr attr=((Element)parent).getAttributeNode(declname); if(attr!=null) { namespace = attr.getNodeValue(); break; } } parent = getParentOfNode(parent); } } return namespace; }
[ "public", "String", "getNamespaceForPrefix", "(", "String", "prefix", ",", "Element", "namespaceContext", ")", "{", "int", "type", ";", "Node", "parent", "=", "namespaceContext", ";", "String", "namespace", "=", "null", ";", "if", "(", "prefix", ".", "equals", "(", "\"xml\"", ")", ")", "{", "namespace", "=", "QName", ".", "S_XMLNAMESPACEURI", ";", "// Hardcoded, per Namespace spec", "}", "else", "if", "(", "prefix", ".", "equals", "(", "\"xmlns\"", ")", ")", "{", "// Hardcoded in the DOM spec, expected to be adopted by", "// Namespace spec. NOTE: Namespace declarations _must_ use", "// the xmlns: prefix; other prefixes declared as belonging", "// to this namespace will not be recognized and should", "// probably be rejected by parsers as erroneous declarations.", "namespace", "=", "\"http://www.w3.org/2000/xmlns/\"", ";", "}", "else", "{", "// Attribute name for this prefix's declaration", "String", "declname", "=", "(", "prefix", "==", "\"\"", ")", "?", "\"xmlns\"", ":", "\"xmlns:\"", "+", "prefix", ";", "// Scan until we run out of Elements or have resolved the namespace", "while", "(", "(", "null", "!=", "parent", ")", "&&", "(", "null", "==", "namespace", ")", "&&", "(", "(", "(", "type", "=", "parent", ".", "getNodeType", "(", ")", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "||", "(", "type", "==", "Node", ".", "ENTITY_REFERENCE_NODE", ")", ")", ")", "{", "if", "(", "type", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "// Look for the appropriate Namespace Declaration attribute,", "// either \"xmlns:prefix\" or (if prefix is \"\") \"xmlns\".", "// TODO: This does not handle \"implicit declarations\"", "// which may be created when the DOM is edited. DOM Level", "// 3 will define how those should be interpreted. But", "// this issue won't arise in freshly-parsed DOMs.", "// NOTE: declname is set earlier, outside the loop.", "Attr", "attr", "=", "(", "(", "Element", ")", "parent", ")", ".", "getAttributeNode", "(", "declname", ")", ";", "if", "(", "attr", "!=", "null", ")", "{", "namespace", "=", "attr", ".", "getNodeValue", "(", ")", ";", "break", ";", "}", "}", "parent", "=", "getParentOfNode", "(", "parent", ")", ";", "}", "}", "return", "namespace", ";", "}" ]
Given an XML Namespace prefix and a context in which the prefix is to be evaluated, return the Namespace Name this prefix was bound to. Note that DOM Level 3 is expected to provide a version of this which deals with the DOM's "early binding" behavior. Default handling: @param prefix String containing namespace prefix to be resolved, without the ':' which separates it from the localname when used in a Node Name. The empty sting signifies the default namespace at this point in the document. @param namespaceContext Element which provides context for resolution. (We could extend this to work for other nodes by first seeking their nearest Element ancestor.) @return a String containing the Namespace URI which this prefix represents in the specified context.
[ "Given", "an", "XML", "Namespace", "prefix", "and", "a", "context", "in", "which", "the", "prefix", "is", "to", "be", "evaluated", "return", "the", "Namespace", "Name", "this", "prefix", "was", "bound", "to", ".", "Note", "that", "DOM", "Level", "3", "is", "expected", "to", "provide", "a", "version", "of", "this", "which", "deals", "with", "the", "DOM", "s", "early", "binding", "behavior", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DOMHelper.java#L512-L568
gocd/gocd
util/src/main/java/com/thoughtworks/go/util/Csv.java
Csv.containsRow
public boolean containsRow(Map<String, String> row) { """ Test if this Csv contains specified row. Note: Provided row may only contain part of the columns. @param row Each row is represented as a map, with column name as key, and column value as value @return """ for (CsvRow csvRow : data) { if (csvRow.contains(row)) { return true; } } return false; }
java
public boolean containsRow(Map<String, String> row) { for (CsvRow csvRow : data) { if (csvRow.contains(row)) { return true; } } return false; }
[ "public", "boolean", "containsRow", "(", "Map", "<", "String", ",", "String", ">", "row", ")", "{", "for", "(", "CsvRow", "csvRow", ":", "data", ")", "{", "if", "(", "csvRow", ".", "contains", "(", "row", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Test if this Csv contains specified row. Note: Provided row may only contain part of the columns. @param row Each row is represented as a map, with column name as key, and column value as value @return
[ "Test", "if", "this", "Csv", "contains", "specified", "row", ".", "Note", ":", "Provided", "row", "may", "only", "contain", "part", "of", "the", "columns", "." ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/util/src/main/java/com/thoughtworks/go/util/Csv.java#L80-L87
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/SearchIndex.java
SearchIndex.findChild
public ManagedEntity findChild(ManagedEntity parent, String name) throws RuntimeFault, RemoteException { """ Find a child entity under a ManagedObjectReference in the inventory. @param parent The parent managed entity. @param name The name of the child to search. @return A child entity. @throws RemoteException @throws RuntimeFault """ if (parent == null) { throw new IllegalArgumentException("parent entity must not be null."); } ManagedObjectReference mor = getVimService().findChild(getMOR(), parent.getMOR(), name); return MorUtil.createExactManagedEntity(getServerConnection(), mor); }
java
public ManagedEntity findChild(ManagedEntity parent, String name) throws RuntimeFault, RemoteException { if (parent == null) { throw new IllegalArgumentException("parent entity must not be null."); } ManagedObjectReference mor = getVimService().findChild(getMOR(), parent.getMOR(), name); return MorUtil.createExactManagedEntity(getServerConnection(), mor); }
[ "public", "ManagedEntity", "findChild", "(", "ManagedEntity", "parent", ",", "String", "name", ")", "throws", "RuntimeFault", ",", "RemoteException", "{", "if", "(", "parent", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"parent entity must not be null.\"", ")", ";", "}", "ManagedObjectReference", "mor", "=", "getVimService", "(", ")", ".", "findChild", "(", "getMOR", "(", ")", ",", "parent", ".", "getMOR", "(", ")", ",", "name", ")", ";", "return", "MorUtil", ".", "createExactManagedEntity", "(", "getServerConnection", "(", ")", ",", "mor", ")", ";", "}" ]
Find a child entity under a ManagedObjectReference in the inventory. @param parent The parent managed entity. @param name The name of the child to search. @return A child entity. @throws RemoteException @throws RuntimeFault
[ "Find", "a", "child", "entity", "under", "a", "ManagedObjectReference", "in", "the", "inventory", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/SearchIndex.java#L172-L178
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.deleteFromComputeNode
public void deleteFromComputeNode(String poolId, String nodeId, String filePath) { """ Deletes the specified file from the compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to delete the file. @param filePath The path to the file or directory that you want to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).toBlocking().single().body(); }
java
public void deleteFromComputeNode(String poolId, String nodeId, String filePath) { deleteFromComputeNodeWithServiceResponseAsync(poolId, nodeId, filePath).toBlocking().single().body(); }
[ "public", "void", "deleteFromComputeNode", "(", "String", "poolId", ",", "String", "nodeId", ",", "String", "filePath", ")", "{", "deleteFromComputeNodeWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ",", "filePath", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Deletes the specified file from the compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to delete the file. @param filePath The path to the file or directory that you want to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "the", "specified", "file", "from", "the", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L875-L877
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/markup/DummyResponsiveImageMediaMarkupBuilder.java
DummyResponsiveImageMediaMarkupBuilder.toReponsiveImageSource
protected JSONObject toReponsiveImageSource(Media media, MediaFormat mediaFormat) { """ Build JSON metadata for one rendition as image source. @param media Media @param mediaFormat Media format @return JSON metadata """ String url = buildDummyImageUrl(mediaFormat); try { JSONObject source = new JSONObject(); source.put(MediaNameConstants.PROP_BREAKPOINT, mediaFormat.getProperties().get(MediaNameConstants.PROP_BREAKPOINT)); source.put(ResponsiveImageMediaMarkupBuilder.PROP_SRC, url); return source; } catch (JSONException ex) { throw new RuntimeException("Error building JSON source.", ex); } }
java
protected JSONObject toReponsiveImageSource(Media media, MediaFormat mediaFormat) { String url = buildDummyImageUrl(mediaFormat); try { JSONObject source = new JSONObject(); source.put(MediaNameConstants.PROP_BREAKPOINT, mediaFormat.getProperties().get(MediaNameConstants.PROP_BREAKPOINT)); source.put(ResponsiveImageMediaMarkupBuilder.PROP_SRC, url); return source; } catch (JSONException ex) { throw new RuntimeException("Error building JSON source.", ex); } }
[ "protected", "JSONObject", "toReponsiveImageSource", "(", "Media", "media", ",", "MediaFormat", "mediaFormat", ")", "{", "String", "url", "=", "buildDummyImageUrl", "(", "mediaFormat", ")", ";", "try", "{", "JSONObject", "source", "=", "new", "JSONObject", "(", ")", ";", "source", ".", "put", "(", "MediaNameConstants", ".", "PROP_BREAKPOINT", ",", "mediaFormat", ".", "getProperties", "(", ")", ".", "get", "(", "MediaNameConstants", ".", "PROP_BREAKPOINT", ")", ")", ";", "source", ".", "put", "(", "ResponsiveImageMediaMarkupBuilder", ".", "PROP_SRC", ",", "url", ")", ";", "return", "source", ";", "}", "catch", "(", "JSONException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "\"Error building JSON source.\"", ",", "ex", ")", ";", "}", "}" ]
Build JSON metadata for one rendition as image source. @param media Media @param mediaFormat Media format @return JSON metadata
[ "Build", "JSON", "metadata", "for", "one", "rendition", "as", "image", "source", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/markup/DummyResponsiveImageMediaMarkupBuilder.java#L136-L147
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldDetection.java
TldDetection.selectBestRegionsFern
protected void selectBestRegionsFern(double totalP, double totalN) { """ compute the probability that each region is the target conditional upon this image the sumP and sumN are needed for image conditional probability NOTE: This is a big change from the original paper """ for( int i = 0; i < fernInfo.size; i++ ) { TldRegionFernInfo info = fernInfo.get(i); double probP = info.sumP/totalP; double probN = info.sumN/totalN; // only consider regions with a higher P likelihood if( probP > probN ) { // reward regions with a large difference between the P and N values storageMetric.add(-(probP-probN)); storageRect.add( info.r ); } } // Select the N regions with the highest fern probability if( config.maximumCascadeConsider < storageMetric.size ) { int N = Math.min(config.maximumCascadeConsider, storageMetric.size); storageIndexes.resize(storageMetric.size); QuickSelect.selectIndex(storageMetric.data, N - 1, storageMetric.size, storageIndexes.data); for( int i = 0; i < N; i++ ) { fernRegions.add(storageRect.get(storageIndexes.get(i))); } } else { fernRegions.addAll(storageRect); } }
java
protected void selectBestRegionsFern(double totalP, double totalN) { for( int i = 0; i < fernInfo.size; i++ ) { TldRegionFernInfo info = fernInfo.get(i); double probP = info.sumP/totalP; double probN = info.sumN/totalN; // only consider regions with a higher P likelihood if( probP > probN ) { // reward regions with a large difference between the P and N values storageMetric.add(-(probP-probN)); storageRect.add( info.r ); } } // Select the N regions with the highest fern probability if( config.maximumCascadeConsider < storageMetric.size ) { int N = Math.min(config.maximumCascadeConsider, storageMetric.size); storageIndexes.resize(storageMetric.size); QuickSelect.selectIndex(storageMetric.data, N - 1, storageMetric.size, storageIndexes.data); for( int i = 0; i < N; i++ ) { fernRegions.add(storageRect.get(storageIndexes.get(i))); } } else { fernRegions.addAll(storageRect); } }
[ "protected", "void", "selectBestRegionsFern", "(", "double", "totalP", ",", "double", "totalN", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fernInfo", ".", "size", ";", "i", "++", ")", "{", "TldRegionFernInfo", "info", "=", "fernInfo", ".", "get", "(", "i", ")", ";", "double", "probP", "=", "info", ".", "sumP", "/", "totalP", ";", "double", "probN", "=", "info", ".", "sumN", "/", "totalN", ";", "// only consider regions with a higher P likelihood", "if", "(", "probP", ">", "probN", ")", "{", "// reward regions with a large difference between the P and N values", "storageMetric", ".", "add", "(", "-", "(", "probP", "-", "probN", ")", ")", ";", "storageRect", ".", "add", "(", "info", ".", "r", ")", ";", "}", "}", "// Select the N regions with the highest fern probability", "if", "(", "config", ".", "maximumCascadeConsider", "<", "storageMetric", ".", "size", ")", "{", "int", "N", "=", "Math", ".", "min", "(", "config", ".", "maximumCascadeConsider", ",", "storageMetric", ".", "size", ")", ";", "storageIndexes", ".", "resize", "(", "storageMetric", ".", "size", ")", ";", "QuickSelect", ".", "selectIndex", "(", "storageMetric", ".", "data", ",", "N", "-", "1", ",", "storageMetric", ".", "size", ",", "storageIndexes", ".", "data", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "N", ";", "i", "++", ")", "{", "fernRegions", ".", "add", "(", "storageRect", ".", "get", "(", "storageIndexes", ".", "get", "(", "i", ")", ")", ")", ";", "}", "}", "else", "{", "fernRegions", ".", "addAll", "(", "storageRect", ")", ";", "}", "}" ]
compute the probability that each region is the target conditional upon this image the sumP and sumN are needed for image conditional probability NOTE: This is a big change from the original paper
[ "compute", "the", "probability", "that", "each", "region", "is", "the", "target", "conditional", "upon", "this", "image", "the", "sumP", "and", "sumN", "are", "needed", "for", "image", "conditional", "probability" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldDetection.java#L189-L217
apollographql/apollo-android
apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java
ApolloCallTracker.activeMutationCalls
@NotNull Set<ApolloMutationCall> activeMutationCalls(@NotNull OperationName operationName) { """ Returns currently active {@link ApolloMutationCall} calls by operation name. @param operationName query operation name @return set of active mutation calls """ return activeCalls(activeMutationCalls, operationName); }
java
@NotNull Set<ApolloMutationCall> activeMutationCalls(@NotNull OperationName operationName) { return activeCalls(activeMutationCalls, operationName); }
[ "@", "NotNull", "Set", "<", "ApolloMutationCall", ">", "activeMutationCalls", "(", "@", "NotNull", "OperationName", "operationName", ")", "{", "return", "activeCalls", "(", "activeMutationCalls", ",", "operationName", ")", ";", "}" ]
Returns currently active {@link ApolloMutationCall} calls by operation name. @param operationName query operation name @return set of active mutation calls
[ "Returns", "currently", "active", "{", "@link", "ApolloMutationCall", "}", "calls", "by", "operation", "name", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java#L187-L189
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/menu/suckerfish/MenuItemFactory.java
MenuItemFactory.newMenuItem
public static MenuItem newMenuItem(final Class<? extends Page> pageClass, final String resourceModelKey, final Component component, final PageParameters parameters) { """ Creates the menu item. @param pageClass the page class @param resourceModelKey the resource model key @param component the component @param parameters the {@link PageParameters} @return the suckerfish menu panel. menu item """ final BookmarkablePageLink<String> bookmarkablePageLink = new BookmarkablePageLink<>( MenuPanel.LINK_ID, pageClass, parameters); final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceModelKey, component); final MenuItem menuItem = new MenuItem(bookmarkablePageLink, labelModel); return menuItem; }
java
public static MenuItem newMenuItem(final Class<? extends Page> pageClass, final String resourceModelKey, final Component component, final PageParameters parameters) { final BookmarkablePageLink<String> bookmarkablePageLink = new BookmarkablePageLink<>( MenuPanel.LINK_ID, pageClass, parameters); final IModel<String> labelModel = ResourceModelFactory.newResourceModel(resourceModelKey, component); final MenuItem menuItem = new MenuItem(bookmarkablePageLink, labelModel); return menuItem; }
[ "public", "static", "MenuItem", "newMenuItem", "(", "final", "Class", "<", "?", "extends", "Page", ">", "pageClass", ",", "final", "String", "resourceModelKey", ",", "final", "Component", "component", ",", "final", "PageParameters", "parameters", ")", "{", "final", "BookmarkablePageLink", "<", "String", ">", "bookmarkablePageLink", "=", "new", "BookmarkablePageLink", "<>", "(", "MenuPanel", ".", "LINK_ID", ",", "pageClass", ",", "parameters", ")", ";", "final", "IModel", "<", "String", ">", "labelModel", "=", "ResourceModelFactory", ".", "newResourceModel", "(", "resourceModelKey", ",", "component", ")", ";", "final", "MenuItem", "menuItem", "=", "new", "MenuItem", "(", "bookmarkablePageLink", ",", "labelModel", ")", ";", "return", "menuItem", ";", "}" ]
Creates the menu item. @param pageClass the page class @param resourceModelKey the resource model key @param component the component @param parameters the {@link PageParameters} @return the suckerfish menu panel. menu item
[ "Creates", "the", "menu", "item", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/menu/suckerfish/MenuItemFactory.java#L97-L106
dottydingo/hyperion
jpa/src/main/java/com/dottydingo/hyperion/jpa/persistence/query/AbstractEntityJpaQueryBuilder.java
AbstractEntityJpaQueryBuilder.createPredicate
protected Predicate createPredicate(Path root, CriteriaQuery<?> query, CriteriaBuilder cb, String propertyName, ComparisonOperator operator, Object argument, PersistenceContext context) { """ Delegate creating of a Predicate to an appropriate method according to operator. @param root root @param query query @param propertyName property name @param operator comparison operator @param argument argument @param context context @return Predicate """ logger.debug("Creating criterion: {} {} {}", propertyName, operator, argument); switch (operator) { case EQUAL: { if (containWildcard(argument)) { return createLike(root, query, cb, propertyName, argument, context); } else { return createEqual(root, query, cb, propertyName, argument, context); } } case NOT_EQUAL: { if (containWildcard(argument)) { return createNotLike(root, query, cb, propertyName, argument, context); } else { return createNotEqual(root, query, cb, propertyName, argument, context); } } case GREATER_THAN: return createGreaterThan(root, query, cb, propertyName, argument, context); case GREATER_EQUAL: return createGreaterEqual(root, query, cb, propertyName, argument, context); case LESS_THAN: return createLessThan(root, query, cb, propertyName, argument, context); case LESS_EQUAL: return createLessEqual(root, query, cb, propertyName, argument, context); case IN: return createIn(root, query, cb, propertyName, argument, context); case NOT_IN: return createNotIn(root, query, cb, propertyName, argument, context); } throw new IllegalArgumentException("Unknown operator: " + operator); }
java
protected Predicate createPredicate(Path root, CriteriaQuery<?> query, CriteriaBuilder cb, String propertyName, ComparisonOperator operator, Object argument, PersistenceContext context) { logger.debug("Creating criterion: {} {} {}", propertyName, operator, argument); switch (operator) { case EQUAL: { if (containWildcard(argument)) { return createLike(root, query, cb, propertyName, argument, context); } else { return createEqual(root, query, cb, propertyName, argument, context); } } case NOT_EQUAL: { if (containWildcard(argument)) { return createNotLike(root, query, cb, propertyName, argument, context); } else { return createNotEqual(root, query, cb, propertyName, argument, context); } } case GREATER_THAN: return createGreaterThan(root, query, cb, propertyName, argument, context); case GREATER_EQUAL: return createGreaterEqual(root, query, cb, propertyName, argument, context); case LESS_THAN: return createLessThan(root, query, cb, propertyName, argument, context); case LESS_EQUAL: return createLessEqual(root, query, cb, propertyName, argument, context); case IN: return createIn(root, query, cb, propertyName, argument, context); case NOT_IN: return createNotIn(root, query, cb, propertyName, argument, context); } throw new IllegalArgumentException("Unknown operator: " + operator); }
[ "protected", "Predicate", "createPredicate", "(", "Path", "root", ",", "CriteriaQuery", "<", "?", ">", "query", ",", "CriteriaBuilder", "cb", ",", "String", "propertyName", ",", "ComparisonOperator", "operator", ",", "Object", "argument", ",", "PersistenceContext", "context", ")", "{", "logger", ".", "debug", "(", "\"Creating criterion: {} {} {}\"", ",", "propertyName", ",", "operator", ",", "argument", ")", ";", "switch", "(", "operator", ")", "{", "case", "EQUAL", ":", "{", "if", "(", "containWildcard", "(", "argument", ")", ")", "{", "return", "createLike", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "}", "else", "{", "return", "createEqual", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "}", "}", "case", "NOT_EQUAL", ":", "{", "if", "(", "containWildcard", "(", "argument", ")", ")", "{", "return", "createNotLike", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "}", "else", "{", "return", "createNotEqual", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "}", "}", "case", "GREATER_THAN", ":", "return", "createGreaterThan", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "case", "GREATER_EQUAL", ":", "return", "createGreaterEqual", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "case", "LESS_THAN", ":", "return", "createLessThan", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "case", "LESS_EQUAL", ":", "return", "createLessEqual", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "case", "IN", ":", "return", "createIn", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "case", "NOT_IN", ":", "return", "createNotIn", "(", "root", ",", "query", ",", "cb", ",", "propertyName", ",", "argument", ",", "context", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Unknown operator: \"", "+", "operator", ")", ";", "}" ]
Delegate creating of a Predicate to an appropriate method according to operator. @param root root @param query query @param propertyName property name @param operator comparison operator @param argument argument @param context context @return Predicate
[ "Delegate", "creating", "of", "a", "Predicate", "to", "an", "appropriate", "method", "according", "to", "operator", "." ]
train
https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/jpa/src/main/java/com/dottydingo/hyperion/jpa/persistence/query/AbstractEntityJpaQueryBuilder.java#L43-L86
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeBooleanDesc
public static boolean decodeBooleanDesc(byte[] src, int srcOffset) throws CorruptEncodingException { """ Decodes a boolean from exactly 1 byte, as encoded for descending order. @param src source of encoded bytes @param srcOffset offset into source array @return boolean value """ try { return src[srcOffset] == 127; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static boolean decodeBooleanDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { return src[srcOffset] == 127; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "boolean", "decodeBooleanDesc", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "src", "[", "srcOffset", "]", "==", "127", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "throw", "new", "CorruptEncodingException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Decodes a boolean from exactly 1 byte, as encoded for descending order. @param src source of encoded bytes @param srcOffset offset into source array @return boolean value
[ "Decodes", "a", "boolean", "from", "exactly", "1", "byte", "as", "encoded", "for", "descending", "order", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L234-L242
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/HazelcastCacheMetrics.java
HazelcastCacheMetrics.monitor
public static <K, V, C extends IMap<K, V>> C monitor(MeterRegistry registry, C cache, Iterable<Tag> tags) { """ Record metrics on a Hazelcast cache. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param tags Tags to apply to all recorded metrics. @param <C> The cache type. @param <K> The cache key type. @param <V> The cache value type. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way. """ new HazelcastCacheMetrics(cache, tags).bindTo(registry); return cache; }
java
public static <K, V, C extends IMap<K, V>> C monitor(MeterRegistry registry, C cache, Iterable<Tag> tags) { new HazelcastCacheMetrics(cache, tags).bindTo(registry); return cache; }
[ "public", "static", "<", "K", ",", "V", ",", "C", "extends", "IMap", "<", "K", ",", "V", ">", ">", "C", "monitor", "(", "MeterRegistry", "registry", ",", "C", "cache", ",", "Iterable", "<", "Tag", ">", "tags", ")", "{", "new", "HazelcastCacheMetrics", "(", "cache", ",", "tags", ")", ".", "bindTo", "(", "registry", ")", ";", "return", "cache", ";", "}" ]
Record metrics on a Hazelcast cache. @param registry The registry to bind metrics to. @param cache The cache to instrument. @param tags Tags to apply to all recorded metrics. @param <C> The cache type. @param <K> The cache key type. @param <V> The cache value type. @return The instrumented cache, unchanged. The original cache is not wrapped or proxied in any way.
[ "Record", "metrics", "on", "a", "Hazelcast", "cache", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/cache/HazelcastCacheMetrics.java#L62-L65
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/utilities/FileUtils.java
FileUtils.copy
public static boolean copy(InputStream source, ByteBuffer destination) { """ This method should only be used when the ByteBuffer is known to be able to accomodate the input! @param source @param destination @return success of the operation """ try { byte [] buffer = new byte[4096]; int n = 0; while (-1 != (n = source.read(buffer))) { destination.put(buffer, 0, n); } return true; } catch (IOException e) { return false; } }
java
public static boolean copy(InputStream source, ByteBuffer destination) { try { byte [] buffer = new byte[4096]; int n = 0; while (-1 != (n = source.read(buffer))) { destination.put(buffer, 0, n); } return true; } catch (IOException e) { return false; } }
[ "public", "static", "boolean", "copy", "(", "InputStream", "source", ",", "ByteBuffer", "destination", ")", "{", "try", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "4096", "]", ";", "int", "n", "=", "0", ";", "while", "(", "-", "1", "!=", "(", "n", "=", "source", ".", "read", "(", "buffer", ")", ")", ")", "{", "destination", ".", "put", "(", "buffer", ",", "0", ",", "n", ")", ";", "}", "return", "true", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "false", ";", "}", "}" ]
This method should only be used when the ByteBuffer is known to be able to accomodate the input! @param source @param destination @return success of the operation
[ "This", "method", "should", "only", "be", "used", "when", "the", "ByteBuffer", "is", "known", "to", "be", "able", "to", "accomodate", "the", "input!" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/FileUtils.java#L58-L69
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/Searcher.java
Searcher.searchInFile
public static void searchInFile(Pattern p, String inFile, String outFile) throws FileNotFoundException { """ Searches a pattern reading the model from the given file, and creates another model that is excised using the matching patterns. @param p pattern to search for @param inFile filename for the model to search in @param outFile filename for the result model @throws FileNotFoundException when no file exists """ searchInFile(p, inFile, outFile, Integer.MAX_VALUE, Integer.MAX_VALUE); }
java
public static void searchInFile(Pattern p, String inFile, String outFile) throws FileNotFoundException { searchInFile(p, inFile, outFile, Integer.MAX_VALUE, Integer.MAX_VALUE); }
[ "public", "static", "void", "searchInFile", "(", "Pattern", "p", ",", "String", "inFile", ",", "String", "outFile", ")", "throws", "FileNotFoundException", "{", "searchInFile", "(", "p", ",", "inFile", ",", "outFile", ",", "Integer", ".", "MAX_VALUE", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Searches a pattern reading the model from the given file, and creates another model that is excised using the matching patterns. @param p pattern to search for @param inFile filename for the model to search in @param outFile filename for the result model @throws FileNotFoundException when no file exists
[ "Searches", "a", "pattern", "reading", "the", "model", "from", "the", "given", "file", "and", "creates", "another", "model", "that", "is", "excised", "using", "the", "matching", "patterns", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/Searcher.java#L327-L330
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobInProgress.java
JobInProgress.updateJobInfo
synchronized void updateJobInfo(long startTime, long launchTime) { """ Update the job start/launch time (upon restart) and log to history """ // log and change to the job's start/launch time this.startTime = startTime; this.launchTime = launchTime; JobHistory.JobInfo.logJobInfo(jobId, startTime, launchTime); }
java
synchronized void updateJobInfo(long startTime, long launchTime) { // log and change to the job's start/launch time this.startTime = startTime; this.launchTime = launchTime; JobHistory.JobInfo.logJobInfo(jobId, startTime, launchTime); }
[ "synchronized", "void", "updateJobInfo", "(", "long", "startTime", ",", "long", "launchTime", ")", "{", "// log and change to the job's start/launch time", "this", ".", "startTime", "=", "startTime", ";", "this", ".", "launchTime", "=", "launchTime", ";", "JobHistory", ".", "JobInfo", ".", "logJobInfo", "(", "jobId", ",", "startTime", ",", "launchTime", ")", ";", "}" ]
Update the job start/launch time (upon restart) and log to history
[ "Update", "the", "job", "start", "/", "launch", "time", "(", "upon", "restart", ")", "and", "log", "to", "history" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobInProgress.java#L1003-L1008
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_vrack_vrack_DELETE
public net.minidev.ovh.api.vrack.OvhTask serviceName_vrack_vrack_DELETE(String serviceName, String vrack) throws IOException { """ remove this dedicatedCloud (VmNetwork) from this vrack REST: DELETE /dedicatedCloud/{serviceName}/vrack/{vrack} @param serviceName [required] Domain of the service @param vrack [required] vrack name """ String qPath = "/dedicatedCloud/{serviceName}/vrack/{vrack}"; StringBuilder sb = path(qPath, serviceName, vrack); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, net.minidev.ovh.api.vrack.OvhTask.class); }
java
public net.minidev.ovh.api.vrack.OvhTask serviceName_vrack_vrack_DELETE(String serviceName, String vrack) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/vrack/{vrack}"; StringBuilder sb = path(qPath, serviceName, vrack); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, net.minidev.ovh.api.vrack.OvhTask.class); }
[ "public", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "vrack", ".", "OvhTask", "serviceName_vrack_vrack_DELETE", "(", "String", "serviceName", ",", "String", "vrack", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/vrack/{vrack}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "vrack", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "vrack", ".", "OvhTask", ".", "class", ")", ";", "}" ]
remove this dedicatedCloud (VmNetwork) from this vrack REST: DELETE /dedicatedCloud/{serviceName}/vrack/{vrack} @param serviceName [required] Domain of the service @param vrack [required] vrack name
[ "remove", "this", "dedicatedCloud", "(", "VmNetwork", ")", "from", "this", "vrack" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1270-L1275
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java
SpaceRest.updateSpaceACLs
@Path("/acl/ { """ This method sets the ACLs associated with a space. Only values included in the ACLs headers will be updated, others will be removed. @return 200 response """spaceID}") @POST public Response updateSpaceACLs(@PathParam("spaceID") String spaceID, @QueryParam("storeID") String storeID) { String msg = "update space ACLs(" + spaceID + ", " + storeID + ")"; try { log.debug(msg); return doUpdateSpaceACLs(spaceID, storeID); } catch (ResourceNotFoundException e) { return responseNotFound(msg, e, NOT_FOUND); } catch (ResourceException e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
java
@Path("/acl/{spaceID}") @POST public Response updateSpaceACLs(@PathParam("spaceID") String spaceID, @QueryParam("storeID") String storeID) { String msg = "update space ACLs(" + spaceID + ", " + storeID + ")"; try { log.debug(msg); return doUpdateSpaceACLs(spaceID, storeID); } catch (ResourceNotFoundException e) { return responseNotFound(msg, e, NOT_FOUND); } catch (ResourceException e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
[ "@", "Path", "(", "\"/acl/{spaceID}\"", ")", "@", "POST", "public", "Response", "updateSpaceACLs", "(", "@", "PathParam", "(", "\"spaceID\"", ")", "String", "spaceID", ",", "@", "QueryParam", "(", "\"storeID\"", ")", "String", "storeID", ")", "{", "String", "msg", "=", "\"update space ACLs(\"", "+", "spaceID", "+", "\", \"", "+", "storeID", "+", "\")\"", ";", "try", "{", "log", ".", "debug", "(", "msg", ")", ";", "return", "doUpdateSpaceACLs", "(", "spaceID", ",", "storeID", ")", ";", "}", "catch", "(", "ResourceNotFoundException", "e", ")", "{", "return", "responseNotFound", "(", "msg", ",", "e", ",", "NOT_FOUND", ")", ";", "}", "catch", "(", "ResourceException", "e", ")", "{", "return", "responseBad", "(", "msg", ",", "e", ",", "INTERNAL_SERVER_ERROR", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "responseBad", "(", "msg", ",", "e", ",", "INTERNAL_SERVER_ERROR", ")", ";", "}", "}" ]
This method sets the ACLs associated with a space. Only values included in the ACLs headers will be updated, others will be removed. @return 200 response
[ "This", "method", "sets", "the", "ACLs", "associated", "with", "a", "space", ".", "Only", "values", "included", "in", "the", "ACLs", "headers", "will", "be", "updated", "others", "will", "be", "removed", "." ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java#L288-L307
michael-rapp/AndroidBottomSheet
library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java
DraggableView.createAnimationListener
private AnimationListener createAnimationListener(final boolean show, final boolean cancel) { """ Creates and returns a listener, which allows to handle the end of an animation, which has been used to show or hide the view. @param show True, if the view should be shown at the end of the animation, false otherwise @param cancel True, if the view should be canceled, false otherwise @return The listener, which has been created, as an instance of the type {@link AnimationListener} """ return new AnimationListener() { @Override public void onAnimationStart(final Animation animation) { } @Override public void onAnimationEnd(final Animation animation) { clearAnimation(); maximized = show; if (maximized) { notifyOnMaximized(); } else { notifyOnHidden(cancel); } } @Override public void onAnimationRepeat(final Animation animation) { } }; }
java
private AnimationListener createAnimationListener(final boolean show, final boolean cancel) { return new AnimationListener() { @Override public void onAnimationStart(final Animation animation) { } @Override public void onAnimationEnd(final Animation animation) { clearAnimation(); maximized = show; if (maximized) { notifyOnMaximized(); } else { notifyOnHidden(cancel); } } @Override public void onAnimationRepeat(final Animation animation) { } }; }
[ "private", "AnimationListener", "createAnimationListener", "(", "final", "boolean", "show", ",", "final", "boolean", "cancel", ")", "{", "return", "new", "AnimationListener", "(", ")", "{", "@", "Override", "public", "void", "onAnimationStart", "(", "final", "Animation", "animation", ")", "{", "}", "@", "Override", "public", "void", "onAnimationEnd", "(", "final", "Animation", "animation", ")", "{", "clearAnimation", "(", ")", ";", "maximized", "=", "show", ";", "if", "(", "maximized", ")", "{", "notifyOnMaximized", "(", ")", ";", "}", "else", "{", "notifyOnHidden", "(", "cancel", ")", ";", "}", "}", "@", "Override", "public", "void", "onAnimationRepeat", "(", "final", "Animation", "animation", ")", "{", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to handle the end of an animation, which has been used to show or hide the view. @param show True, if the view should be shown at the end of the animation, false otherwise @param cancel True, if the view should be canceled, false otherwise @return The listener, which has been created, as an instance of the type {@link AnimationListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "handle", "the", "end", "of", "an", "animation", "which", "has", "been", "used", "to", "show", "or", "hide", "the", "view", "." ]
train
https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L331-L357
zk1931/jzab
src/main/java/com/github/zk1931/jzab/PersistentState.java
PersistentState.setSnapshotFile
File setSnapshotFile(File tempFile, Zxid zxid) throws IOException { """ Turns a temporary snapshot file into a valid snapshot file. @param tempFile the temporary file which stores current state. @param zxid the last applied zxid for state machine. @return the snapshot file. """ File snapshot = new File(dataDir, String.format("snapshot.%s", zxid.toSimpleString())); LOG.debug("Atomically move snapshot file to {}", snapshot); FileUtils.atomicMove(tempFile, snapshot); // Since the new snapshot file gets created, we need to fsync the directory. fsyncDirectory(); return snapshot; }
java
File setSnapshotFile(File tempFile, Zxid zxid) throws IOException { File snapshot = new File(dataDir, String.format("snapshot.%s", zxid.toSimpleString())); LOG.debug("Atomically move snapshot file to {}", snapshot); FileUtils.atomicMove(tempFile, snapshot); // Since the new snapshot file gets created, we need to fsync the directory. fsyncDirectory(); return snapshot; }
[ "File", "setSnapshotFile", "(", "File", "tempFile", ",", "Zxid", "zxid", ")", "throws", "IOException", "{", "File", "snapshot", "=", "new", "File", "(", "dataDir", ",", "String", ".", "format", "(", "\"snapshot.%s\"", ",", "zxid", ".", "toSimpleString", "(", ")", ")", ")", ";", "LOG", ".", "debug", "(", "\"Atomically move snapshot file to {}\"", ",", "snapshot", ")", ";", "FileUtils", ".", "atomicMove", "(", "tempFile", ",", "snapshot", ")", ";", "// Since the new snapshot file gets created, we need to fsync the directory.", "fsyncDirectory", "(", ")", ";", "return", "snapshot", ";", "}" ]
Turns a temporary snapshot file into a valid snapshot file. @param tempFile the temporary file which stores current state. @param zxid the last applied zxid for state machine. @return the snapshot file.
[ "Turns", "a", "temporary", "snapshot", "file", "into", "a", "valid", "snapshot", "file", "." ]
train
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/PersistentState.java#L286-L294
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java
ESFilterBuilder.populateBetweenFilter
private QueryBuilder populateBetweenFilter(BetweenExpression betweenExpression, EntityMetadata m) { """ Populate between filter. @param betweenExpression the between expression @param m the m @param entity the entity @return the filter builder """ String lowerBoundExpression = getBetweenBoundaryValues(betweenExpression.getLowerBoundExpression()); String upperBoundExpression = getBetweenBoundaryValues(betweenExpression.getUpperBoundExpression()); String field = getField(betweenExpression.getExpression().toParsedText()); log.debug("Between clause for field " + field + "with lower bound " + lowerBoundExpression + "and upper bound " + upperBoundExpression); return new AndQueryBuilder(getFilter(kunderaQuery.new FilterClause(field, Expression.GREATER_THAN_OR_EQUAL, lowerBoundExpression, field), m), getFilter(kunderaQuery.new FilterClause(field, Expression.LOWER_THAN_OR_EQUAL, upperBoundExpression,field), m)); }
java
private QueryBuilder populateBetweenFilter(BetweenExpression betweenExpression, EntityMetadata m) { String lowerBoundExpression = getBetweenBoundaryValues(betweenExpression.getLowerBoundExpression()); String upperBoundExpression = getBetweenBoundaryValues(betweenExpression.getUpperBoundExpression()); String field = getField(betweenExpression.getExpression().toParsedText()); log.debug("Between clause for field " + field + "with lower bound " + lowerBoundExpression + "and upper bound " + upperBoundExpression); return new AndQueryBuilder(getFilter(kunderaQuery.new FilterClause(field, Expression.GREATER_THAN_OR_EQUAL, lowerBoundExpression, field), m), getFilter(kunderaQuery.new FilterClause(field, Expression.LOWER_THAN_OR_EQUAL, upperBoundExpression,field), m)); }
[ "private", "QueryBuilder", "populateBetweenFilter", "(", "BetweenExpression", "betweenExpression", ",", "EntityMetadata", "m", ")", "{", "String", "lowerBoundExpression", "=", "getBetweenBoundaryValues", "(", "betweenExpression", ".", "getLowerBoundExpression", "(", ")", ")", ";", "String", "upperBoundExpression", "=", "getBetweenBoundaryValues", "(", "betweenExpression", ".", "getUpperBoundExpression", "(", ")", ")", ";", "String", "field", "=", "getField", "(", "betweenExpression", ".", "getExpression", "(", ")", ".", "toParsedText", "(", ")", ")", ";", "log", ".", "debug", "(", "\"Between clause for field \"", "+", "field", "+", "\"with lower bound \"", "+", "lowerBoundExpression", "+", "\"and upper bound \"", "+", "upperBoundExpression", ")", ";", "return", "new", "AndQueryBuilder", "(", "getFilter", "(", "kunderaQuery", ".", "new", "FilterClause", "(", "field", ",", "Expression", ".", "GREATER_THAN_OR_EQUAL", ",", "lowerBoundExpression", ",", "field", ")", ",", "m", ")", ",", "getFilter", "(", "kunderaQuery", ".", "new", "FilterClause", "(", "field", ",", "Expression", ".", "LOWER_THAN_OR_EQUAL", ",", "upperBoundExpression", ",", "field", ")", ",", "m", ")", ")", ";", "}" ]
Populate between filter. @param betweenExpression the between expression @param m the m @param entity the entity @return the filter builder
[ "Populate", "between", "filter", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java#L253-L265
wildfly/wildfly-core
embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java
EmbeddedProcessFactory.createHostController
public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) { """ Create an embedded host controller. @param jbossHomePath the location of the root of the host controller installation. Cannot be {@code null} or empty. @param modulePath the location of the root of the module repository. May be {@code null} if the standard location under {@code jbossHomePath} should be used @param systemPackages names of any packages that must be treated as system packages, with the same classes visible to the caller's classloader visible to host-controller-side classes loaded from the server's modular classloader @param cmdargs any additional arguments to pass to the embedded host controller (e.g. -b=192.168.100.10) @return the server. Will not be {@code null} """ if (jbossHomePath == null || jbossHomePath.isEmpty()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } File jbossHomeDir = new File(jbossHomePath); if (!jbossHomeDir.isDirectory()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } return createHostController( Configuration.Builder.of(jbossHomeDir) .setModulePath(modulePath) .setSystemPackages(systemPackages) .setCommandArguments(cmdargs) .build() ); }
java
public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) { if (jbossHomePath == null || jbossHomePath.isEmpty()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } File jbossHomeDir = new File(jbossHomePath); if (!jbossHomeDir.isDirectory()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } return createHostController( Configuration.Builder.of(jbossHomeDir) .setModulePath(modulePath) .setSystemPackages(systemPackages) .setCommandArguments(cmdargs) .build() ); }
[ "public", "static", "HostController", "createHostController", "(", "String", "jbossHomePath", ",", "String", "modulePath", ",", "String", "[", "]", "systemPackages", ",", "String", "[", "]", "cmdargs", ")", "{", "if", "(", "jbossHomePath", "==", "null", "||", "jbossHomePath", ".", "isEmpty", "(", ")", ")", "{", "throw", "EmbeddedLogger", ".", "ROOT_LOGGER", ".", "invalidJBossHome", "(", "jbossHomePath", ")", ";", "}", "File", "jbossHomeDir", "=", "new", "File", "(", "jbossHomePath", ")", ";", "if", "(", "!", "jbossHomeDir", ".", "isDirectory", "(", ")", ")", "{", "throw", "EmbeddedLogger", ".", "ROOT_LOGGER", ".", "invalidJBossHome", "(", "jbossHomePath", ")", ";", "}", "return", "createHostController", "(", "Configuration", ".", "Builder", ".", "of", "(", "jbossHomeDir", ")", ".", "setModulePath", "(", "modulePath", ")", ".", "setSystemPackages", "(", "systemPackages", ")", ".", "setCommandArguments", "(", "cmdargs", ")", ".", "build", "(", ")", ")", ";", "}" ]
Create an embedded host controller. @param jbossHomePath the location of the root of the host controller installation. Cannot be {@code null} or empty. @param modulePath the location of the root of the module repository. May be {@code null} if the standard location under {@code jbossHomePath} should be used @param systemPackages names of any packages that must be treated as system packages, with the same classes visible to the caller's classloader visible to host-controller-side classes loaded from the server's modular classloader @param cmdargs any additional arguments to pass to the embedded host controller (e.g. -b=192.168.100.10) @return the server. Will not be {@code null}
[ "Create", "an", "embedded", "host", "controller", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java#L206-L221
hsiafan/requests
src/main/java/net/dongliu/requests/utils/CookieDateUtil.java
CookieDateUtil.formatDate
public static String formatDate(Date date, String pattern) { """ Formats the given date according to the specified pattern. The pattern must conform to that used by the {@link SimpleDateFormat simple date format} class. @param date The date to format. @param pattern The pattern to use for formatting the date. @return A formatted date string. @throws IllegalArgumentException If the given date pattern is invalid. @see SimpleDateFormat """ SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.US); formatter.setTimeZone(GMT); return formatter.format(date); }
java
public static String formatDate(Date date, String pattern) { SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.US); formatter.setTimeZone(GMT); return formatter.format(date); }
[ "public", "static", "String", "formatDate", "(", "Date", "date", ",", "String", "pattern", ")", "{", "SimpleDateFormat", "formatter", "=", "new", "SimpleDateFormat", "(", "pattern", ",", "Locale", ".", "US", ")", ";", "formatter", ".", "setTimeZone", "(", "GMT", ")", ";", "return", "formatter", ".", "format", "(", "date", ")", ";", "}" ]
Formats the given date according to the specified pattern. The pattern must conform to that used by the {@link SimpleDateFormat simple date format} class. @param date The date to format. @param pattern The pattern to use for formatting the date. @return A formatted date string. @throws IllegalArgumentException If the given date pattern is invalid. @see SimpleDateFormat
[ "Formats", "the", "given", "date", "according", "to", "the", "specified", "pattern", ".", "The", "pattern", "must", "conform", "to", "that", "used", "by", "the", "{", "@link", "SimpleDateFormat", "simple", "date", "format", "}", "class", "." ]
train
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/CookieDateUtil.java#L137-L141
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java
Partitioner.getSize
public PartitionSize getSize(Date first, Date last, int maxP) { """ Attempt to find the smallest PartitionSize implementation which, spanning the range first and last specified, produces at most maxP partitions. @param first Date of beginning of time range @param last Date of end of time range @param maxP maximum number of Partitions to use @return a PartitionSize object which will divide the range into at most maxP Partitions """ long diffMS = last.getTime() - first.getTime(); for(PartitionSize pa : sizes) { long maxMS = maxP * pa.intervalMS(); if(maxMS > diffMS) { return pa; } } return twoYearSize; }
java
public PartitionSize getSize(Date first, Date last, int maxP) { long diffMS = last.getTime() - first.getTime(); for(PartitionSize pa : sizes) { long maxMS = maxP * pa.intervalMS(); if(maxMS > diffMS) { return pa; } } return twoYearSize; }
[ "public", "PartitionSize", "getSize", "(", "Date", "first", ",", "Date", "last", ",", "int", "maxP", ")", "{", "long", "diffMS", "=", "last", ".", "getTime", "(", ")", "-", "first", ".", "getTime", "(", ")", ";", "for", "(", "PartitionSize", "pa", ":", "sizes", ")", "{", "long", "maxMS", "=", "maxP", "*", "pa", ".", "intervalMS", "(", ")", ";", "if", "(", "maxMS", ">", "diffMS", ")", "{", "return", "pa", ";", "}", "}", "return", "twoYearSize", ";", "}" ]
Attempt to find the smallest PartitionSize implementation which, spanning the range first and last specified, produces at most maxP partitions. @param first Date of beginning of time range @param last Date of end of time range @param maxP maximum number of Partitions to use @return a PartitionSize object which will divide the range into at most maxP Partitions
[ "Attempt", "to", "find", "the", "smallest", "PartitionSize", "implementation", "which", "spanning", "the", "range", "first", "and", "last", "specified", "produces", "at", "most", "maxP", "partitions", "." ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java#L135-L144
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.decrease
public void decrease(final DeviceControllerChannel channel, final int steps) throws IOException { """ Decrements the volatile wiper for the given number steps. @param channel Which wiper @param steps The number of steps @throws IOException Thrown if communication fails or device returned a malformed result """ if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // decrease only works on volatile-wiper byte memAddr = channel.getVolatileMemoryAddress(); increaseOrDecrease(memAddr, false, steps); }
java
public void decrease(final DeviceControllerChannel channel, final int steps) throws IOException { if (channel == null) { throw new RuntimeException("null-channel is not allowed. For devices " + "knowing just one wiper Channel.A is mandatory for " + "parameter 'channel'"); } // decrease only works on volatile-wiper byte memAddr = channel.getVolatileMemoryAddress(); increaseOrDecrease(memAddr, false, steps); }
[ "public", "void", "decrease", "(", "final", "DeviceControllerChannel", "channel", ",", "final", "int", "steps", ")", "throws", "IOException", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"null-channel is not allowed. For devices \"", "+", "\"knowing just one wiper Channel.A is mandatory for \"", "+", "\"parameter 'channel'\"", ")", ";", "}", "// decrease only works on volatile-wiper", "byte", "memAddr", "=", "channel", ".", "getVolatileMemoryAddress", "(", ")", ";", "increaseOrDecrease", "(", "memAddr", ",", "false", ",", "steps", ")", ";", "}" ]
Decrements the volatile wiper for the given number steps. @param channel Which wiper @param steps The number of steps @throws IOException Thrown if communication fails or device returned a malformed result
[ "Decrements", "the", "volatile", "wiper", "for", "the", "given", "number", "steps", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L181-L195
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java
ReceiveQueueProxy.updateRemoteFilterProperties
public void updateRemoteFilterProperties(BaseMessageFilter messageFilter, Object[][] properties, Map<String,Object> propFilter) throws RemoteException { """ Update this filter with this new information. @param messageFilter The message filter I am updating. @param properties New filter information (ie, bookmark=345). """ BaseTransport transport = this.createProxyTransport(REMOVE_REMOTE_MESSAGE_FILTER); transport.addParam(FILTER, messageFilter); // Don't use COMMAND transport.addParam(PROPERTIES, properties); transport.addParam(MAP, propFilter); transport.sendMessageAndGetReply(); }
java
public void updateRemoteFilterProperties(BaseMessageFilter messageFilter, Object[][] properties, Map<String,Object> propFilter) throws RemoteException { BaseTransport transport = this.createProxyTransport(REMOVE_REMOTE_MESSAGE_FILTER); transport.addParam(FILTER, messageFilter); // Don't use COMMAND transport.addParam(PROPERTIES, properties); transport.addParam(MAP, propFilter); transport.sendMessageAndGetReply(); }
[ "public", "void", "updateRemoteFilterProperties", "(", "BaseMessageFilter", "messageFilter", ",", "Object", "[", "]", "[", "]", "properties", ",", "Map", "<", "String", ",", "Object", ">", "propFilter", ")", "throws", "RemoteException", "{", "BaseTransport", "transport", "=", "this", ".", "createProxyTransport", "(", "REMOVE_REMOTE_MESSAGE_FILTER", ")", ";", "transport", ".", "addParam", "(", "FILTER", ",", "messageFilter", ")", ";", "// Don't use COMMAND", "transport", ".", "addParam", "(", "PROPERTIES", ",", "properties", ")", ";", "transport", ".", "addParam", "(", "MAP", ",", "propFilter", ")", ";", "transport", ".", "sendMessageAndGetReply", "(", ")", ";", "}" ]
Update this filter with this new information. @param messageFilter The message filter I am updating. @param properties New filter information (ie, bookmark=345).
[ "Update", "this", "filter", "with", "this", "new", "information", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/ReceiveQueueProxy.java#L114-L121
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/GroupController.java
GroupController.removeOverride
@RequestMapping(value = "api/group/ { """ Remove an override from a group @param model @param overrideId @return """groupId}/{overrideId}", method = RequestMethod.DELETE) public @ResponseBody String removeOverride(Model model, @PathVariable int overrideId) { pathOverrideService.removeOverride(overrideId); return null; }
java
@RequestMapping(value = "api/group/{groupId}/{overrideId}", method = RequestMethod.DELETE) public @ResponseBody String removeOverride(Model model, @PathVariable int overrideId) { pathOverrideService.removeOverride(overrideId); return null; }
[ "@", "RequestMapping", "(", "value", "=", "\"api/group/{groupId}/{overrideId}\"", ",", "method", "=", "RequestMethod", ".", "DELETE", ")", "public", "@", "ResponseBody", "String", "removeOverride", "(", "Model", "model", ",", "@", "PathVariable", "int", "overrideId", ")", "{", "pathOverrideService", ".", "removeOverride", "(", "overrideId", ")", ";", "return", "null", ";", "}" ]
Remove an override from a group @param model @param overrideId @return
[ "Remove", "an", "override", "from", "a", "group" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/GroupController.java#L177-L183
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/UnboundTypeReference.java
UnboundTypeReference.canResolveTo
public boolean canResolveTo(LightweightTypeReference reference) { """ Returns true if the existing hints would allow to resolve to the given reference. """ if (internalIsResolved()) return reference.isAssignableFrom(resolvedTo, new TypeConformanceComputationArgument(false, true, true, true, false, false /* TODO do we need to support synonmys here? */)); List<LightweightBoundTypeArgument> hints = getAllHints(); if (!hints.isEmpty() && hasSignificantHints(hints)) { return canResolveTo(reference, hints); } return false; }
java
public boolean canResolveTo(LightweightTypeReference reference) { if (internalIsResolved()) return reference.isAssignableFrom(resolvedTo, new TypeConformanceComputationArgument(false, true, true, true, false, false /* TODO do we need to support synonmys here? */)); List<LightweightBoundTypeArgument> hints = getAllHints(); if (!hints.isEmpty() && hasSignificantHints(hints)) { return canResolveTo(reference, hints); } return false; }
[ "public", "boolean", "canResolveTo", "(", "LightweightTypeReference", "reference", ")", "{", "if", "(", "internalIsResolved", "(", ")", ")", "return", "reference", ".", "isAssignableFrom", "(", "resolvedTo", ",", "new", "TypeConformanceComputationArgument", "(", "false", ",", "true", ",", "true", ",", "true", ",", "false", ",", "false", "/* TODO do we need to support synonmys here? */", ")", ")", ";", "List", "<", "LightweightBoundTypeArgument", ">", "hints", "=", "getAllHints", "(", ")", ";", "if", "(", "!", "hints", ".", "isEmpty", "(", ")", "&&", "hasSignificantHints", "(", "hints", ")", ")", "{", "return", "canResolveTo", "(", "reference", ",", "hints", ")", ";", "}", "return", "false", ";", "}" ]
Returns true if the existing hints would allow to resolve to the given reference.
[ "Returns", "true", "if", "the", "existing", "hints", "would", "allow", "to", "resolve", "to", "the", "given", "reference", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/UnboundTypeReference.java#L147-L155
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasConstraintUtils.java
KerasConstraintUtils.mapConstraint
public static LayerConstraint mapConstraint(String kerasConstraint, KerasLayerConfiguration conf, Map<String, Object> constraintConfig) throws UnsupportedKerasConfigurationException { """ Map Keras to DL4J constraint. @param kerasConstraint String containing Keras constraint name @param conf Keras layer configuration @return DL4J LayerConstraint @see LayerConstraint """ LayerConstraint constraint; if (kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT_ALIAS())) { double min = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MIN_CONSTRAINT()); double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MAX_CONSTRAINT()); double rate = (double) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_RATE()); int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM()); constraint = new MinMaxNormConstraint(min, max, rate, dim + 1); } else if (kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS()) || kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS_2())) { double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MAX_CONSTRAINT()); int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM()); constraint = new MaxNormConstraint(max, dim + 1); } else if (kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS()) || kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS_2())) { int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM()); constraint = new UnitNormConstraint(dim + 1); } else if (kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS()) || kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS_2())) { constraint = new NonNegativeConstraint(); } else { throw new UnsupportedKerasConfigurationException("Unknown keras constraint " + kerasConstraint); } return constraint; }
java
public static LayerConstraint mapConstraint(String kerasConstraint, KerasLayerConfiguration conf, Map<String, Object> constraintConfig) throws UnsupportedKerasConfigurationException { LayerConstraint constraint; if (kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT_ALIAS())) { double min = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MIN_CONSTRAINT()); double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MAX_CONSTRAINT()); double rate = (double) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_RATE()); int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM()); constraint = new MinMaxNormConstraint(min, max, rate, dim + 1); } else if (kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS()) || kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS_2())) { double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MAX_CONSTRAINT()); int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM()); constraint = new MaxNormConstraint(max, dim + 1); } else if (kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS()) || kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS_2())) { int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM()); constraint = new UnitNormConstraint(dim + 1); } else if (kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT()) || kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS()) || kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS_2())) { constraint = new NonNegativeConstraint(); } else { throw new UnsupportedKerasConfigurationException("Unknown keras constraint " + kerasConstraint); } return constraint; }
[ "public", "static", "LayerConstraint", "mapConstraint", "(", "String", "kerasConstraint", ",", "KerasLayerConfiguration", "conf", ",", "Map", "<", "String", ",", "Object", ">", "constraintConfig", ")", "throws", "UnsupportedKerasConfigurationException", "{", "LayerConstraint", "constraint", ";", "if", "(", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_MINMAX_NORM_CONSTRAINT", "(", ")", ")", "||", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_MINMAX_NORM_CONSTRAINT_ALIAS", "(", ")", ")", ")", "{", "double", "min", "=", "(", "double", ")", "constraintConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_MINMAX_MIN_CONSTRAINT", "(", ")", ")", ";", "double", "max", "=", "(", "double", ")", "constraintConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_MINMAX_MAX_CONSTRAINT", "(", ")", ")", ";", "double", "rate", "=", "(", "double", ")", "constraintConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_CONSTRAINT_RATE", "(", ")", ")", ";", "int", "dim", "=", "(", "int", ")", "constraintConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_CONSTRAINT_DIM", "(", ")", ")", ";", "constraint", "=", "new", "MinMaxNormConstraint", "(", "min", ",", "max", ",", "rate", ",", "dim", "+", "1", ")", ";", "}", "else", "if", "(", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_MAX_NORM_CONSTRAINT", "(", ")", ")", "||", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS", "(", ")", ")", "||", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS_2", "(", ")", ")", ")", "{", "double", "max", "=", "(", "double", ")", "constraintConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_MAX_CONSTRAINT", "(", ")", ")", ";", "int", "dim", "=", "(", "int", ")", "constraintConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_CONSTRAINT_DIM", "(", ")", ")", ";", "constraint", "=", "new", "MaxNormConstraint", "(", "max", ",", "dim", "+", "1", ")", ";", "}", "else", "if", "(", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_UNIT_NORM_CONSTRAINT", "(", ")", ")", "||", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS", "(", ")", ")", "||", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS_2", "(", ")", ")", ")", "{", "int", "dim", "=", "(", "int", ")", "constraintConfig", ".", "get", "(", "conf", ".", "getLAYER_FIELD_CONSTRAINT_DIM", "(", ")", ")", ";", "constraint", "=", "new", "UnitNormConstraint", "(", "dim", "+", "1", ")", ";", "}", "else", "if", "(", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_NON_NEG_CONSTRAINT", "(", ")", ")", "||", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS", "(", ")", ")", "||", "kerasConstraint", ".", "equals", "(", "conf", ".", "getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS_2", "(", ")", ")", ")", "{", "constraint", "=", "new", "NonNegativeConstraint", "(", ")", ";", "}", "else", "{", "throw", "new", "UnsupportedKerasConfigurationException", "(", "\"Unknown keras constraint \"", "+", "kerasConstraint", ")", ";", "}", "return", "constraint", ";", "}" ]
Map Keras to DL4J constraint. @param kerasConstraint String containing Keras constraint name @param conf Keras layer configuration @return DL4J LayerConstraint @see LayerConstraint
[ "Map", "Keras", "to", "DL4J", "constraint", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasConstraintUtils.java#L48-L79
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_http_farm_farmId_PUT
public void serviceName_http_farm_farmId_PUT(String serviceName, Long farmId, OvhBackendHttp body) throws IOException { """ Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/http/farm/{farmId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm """ String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_http_farm_farmId_PUT(String serviceName, Long farmId, OvhBackendHttp body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/http/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_http_farm_farmId_PUT", "(", "String", "serviceName", ",", "Long", "farmId", ",", "OvhBackendHttp", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/http/farm/{farmId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "farmId", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/http/farm/{farmId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L379-L383
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java
FieldAccessor.setMapPosition
public void setMapPosition(final Object targetObj, final CellPosition position, final String key) { """ {@link XlsMapColumns}フィールド用の位置情報を設定します。 <p>位置情報を保持するフィールドがない場合は、処理はスキップされます。</p> @param targetObj フィールドが定義されているクラスのインスタンス @param position 位置情報 @param key マップのキー @throws IllegalArgumentException {@literal targetObj == null or position == null or key == null} @throws IllegalArgumentException {@literal key is empty.} """ ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notNull(position, "position"); ArgUtils.notEmpty(key, "key"); mapPositionSetter.ifPresent(setter -> setter.set(targetObj, position, key)); }
java
public void setMapPosition(final Object targetObj, final CellPosition position, final String key) { ArgUtils.notNull(targetObj, "targetObj"); ArgUtils.notNull(position, "position"); ArgUtils.notEmpty(key, "key"); mapPositionSetter.ifPresent(setter -> setter.set(targetObj, position, key)); }
[ "public", "void", "setMapPosition", "(", "final", "Object", "targetObj", ",", "final", "CellPosition", "position", ",", "final", "String", "key", ")", "{", "ArgUtils", ".", "notNull", "(", "targetObj", ",", "\"targetObj\"", ")", ";", "ArgUtils", ".", "notNull", "(", "position", ",", "\"position\"", ")", ";", "ArgUtils", ".", "notEmpty", "(", "key", ",", "\"key\"", ")", ";", "mapPositionSetter", ".", "ifPresent", "(", "setter", "->", "setter", ".", "set", "(", "targetObj", ",", "position", ",", "key", ")", ")", ";", "}" ]
{@link XlsMapColumns}フィールド用の位置情報を設定します。 <p>位置情報を保持するフィールドがない場合は、処理はスキップされます。</p> @param targetObj フィールドが定義されているクラスのインスタンス @param position 位置情報 @param key マップのキー @throws IllegalArgumentException {@literal targetObj == null or position == null or key == null} @throws IllegalArgumentException {@literal key is empty.}
[ "{", "@link", "XlsMapColumns", "}", "フィールド用の位置情報を設定します。", "<p", ">", "位置情報を保持するフィールドがない場合は、処理はスキップされます。<", "/", "p", ">" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldaccessor/FieldAccessor.java#L385-L393
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java
SightResourcesImpl.moveSight
public Sight moveSight(long sightId, ContainerDestination destination) throws SmartsheetException { """ Creates s copy of the specified Sight. It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/move @param sightId the Id of the Sight @param destination the destination to copy to @return the newly created Sight resource. @throws IllegalArgumentException if any argument is null or empty string @throws InvalidRequestException if there is any problem with the REST API request @throws AuthorizationException if there is any problem with the REST API authorization (access token) @throws ResourceNotFoundException if the resource cannot be found @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting) @throws SmartsheetException if there is any other error during the operation """ return this.createResource("sights/" + sightId + "/move", Sight.class, destination); }
java
public Sight moveSight(long sightId, ContainerDestination destination) throws SmartsheetException { return this.createResource("sights/" + sightId + "/move", Sight.class, destination); }
[ "public", "Sight", "moveSight", "(", "long", "sightId", ",", "ContainerDestination", "destination", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "createResource", "(", "\"sights/\"", "+", "sightId", "+", "\"/move\"", ",", "Sight", ".", "class", ",", "destination", ")", ";", "}" ]
Creates s copy of the specified Sight. It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/move @param sightId the Id of the Sight @param destination the destination to copy to @return the newly created Sight resource. @throws IllegalArgumentException if any argument is null or empty string @throws InvalidRequestException if there is any problem with the REST API request @throws AuthorizationException if there is any problem with the REST API authorization (access token) @throws ResourceNotFoundException if the resource cannot be found @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting) @throws SmartsheetException if there is any other error during the operation
[ "Creates", "s", "copy", "of", "the", "specified", "Sight", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java#L203-L205
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java
BasicBondGenerator.generateInnerElement
public LineElement generateInnerElement(IBond bond, IRing ring, RendererModel model) { """ Make the inner ring bond, which is slightly shorter than the outer bond. @param bond the ring bond @param ring the ring that the bond is in @param model the renderer model @return the line element """ Point2d center = GeometryUtil.get2DCenter(ring); Point2d a = bond.getBegin().getPoint2d(); Point2d b = bond.getEnd().getPoint2d(); // the proportion to move in towards the ring center double distanceFactor = model.getParameter(TowardsRingCenterProportion.class).getValue(); double ringDistance = distanceFactor * IDEAL_RINGSIZE / ring.getAtomCount(); if (ringDistance < distanceFactor / MIN_RINGSIZE_FACTOR) ringDistance = distanceFactor / MIN_RINGSIZE_FACTOR; Point2d w = new Point2d(); w.interpolate(a, center, ringDistance); Point2d u = new Point2d(); u.interpolate(b, center, ringDistance); double alpha = 0.2; Point2d ww = new Point2d(); ww.interpolate(w, u, alpha); Point2d uu = new Point2d(); uu.interpolate(u, w, alpha); double width = getWidthForBond(bond, model); Color color = getColorForBond(bond, model); return new LineElement(u.x, u.y, w.x, w.y, width, color); }
java
public LineElement generateInnerElement(IBond bond, IRing ring, RendererModel model) { Point2d center = GeometryUtil.get2DCenter(ring); Point2d a = bond.getBegin().getPoint2d(); Point2d b = bond.getEnd().getPoint2d(); // the proportion to move in towards the ring center double distanceFactor = model.getParameter(TowardsRingCenterProportion.class).getValue(); double ringDistance = distanceFactor * IDEAL_RINGSIZE / ring.getAtomCount(); if (ringDistance < distanceFactor / MIN_RINGSIZE_FACTOR) ringDistance = distanceFactor / MIN_RINGSIZE_FACTOR; Point2d w = new Point2d(); w.interpolate(a, center, ringDistance); Point2d u = new Point2d(); u.interpolate(b, center, ringDistance); double alpha = 0.2; Point2d ww = new Point2d(); ww.interpolate(w, u, alpha); Point2d uu = new Point2d(); uu.interpolate(u, w, alpha); double width = getWidthForBond(bond, model); Color color = getColorForBond(bond, model); return new LineElement(u.x, u.y, w.x, w.y, width, color); }
[ "public", "LineElement", "generateInnerElement", "(", "IBond", "bond", ",", "IRing", "ring", ",", "RendererModel", "model", ")", "{", "Point2d", "center", "=", "GeometryUtil", ".", "get2DCenter", "(", "ring", ")", ";", "Point2d", "a", "=", "bond", ".", "getBegin", "(", ")", ".", "getPoint2d", "(", ")", ";", "Point2d", "b", "=", "bond", ".", "getEnd", "(", ")", ".", "getPoint2d", "(", ")", ";", "// the proportion to move in towards the ring center", "double", "distanceFactor", "=", "model", ".", "getParameter", "(", "TowardsRingCenterProportion", ".", "class", ")", ".", "getValue", "(", ")", ";", "double", "ringDistance", "=", "distanceFactor", "*", "IDEAL_RINGSIZE", "/", "ring", ".", "getAtomCount", "(", ")", ";", "if", "(", "ringDistance", "<", "distanceFactor", "/", "MIN_RINGSIZE_FACTOR", ")", "ringDistance", "=", "distanceFactor", "/", "MIN_RINGSIZE_FACTOR", ";", "Point2d", "w", "=", "new", "Point2d", "(", ")", ";", "w", ".", "interpolate", "(", "a", ",", "center", ",", "ringDistance", ")", ";", "Point2d", "u", "=", "new", "Point2d", "(", ")", ";", "u", ".", "interpolate", "(", "b", ",", "center", ",", "ringDistance", ")", ";", "double", "alpha", "=", "0.2", ";", "Point2d", "ww", "=", "new", "Point2d", "(", ")", ";", "ww", ".", "interpolate", "(", "w", ",", "u", ",", "alpha", ")", ";", "Point2d", "uu", "=", "new", "Point2d", "(", ")", ";", "uu", ".", "interpolate", "(", "u", ",", "w", ",", "alpha", ")", ";", "double", "width", "=", "getWidthForBond", "(", "bond", ",", "model", ")", ";", "Color", "color", "=", "getColorForBond", "(", "bond", ",", "model", ")", ";", "return", "new", "LineElement", "(", "u", ".", "x", ",", "u", ".", "y", ",", "w", ".", "x", ",", "w", ".", "y", ",", "width", ",", "color", ")", ";", "}" ]
Make the inner ring bond, which is slightly shorter than the outer bond. @param bond the ring bond @param ring the ring that the bond is in @param model the renderer model @return the line element
[ "Make", "the", "inner", "ring", "bond", "which", "is", "slightly", "shorter", "than", "the", "outer", "bond", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L399-L424
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/utilities/StringUtility.java
StringUtility.splitAndIndent
@Deprecated public static String splitAndIndent(String str, int indent, int numChars) { """ Method that attempts to break a string up into lines no longer than the specified line length. <p>The string is assumed to a large chunk of undifferentiated text such as base 64 encoded binary data. @param str The input string to be split into lines. @param indent The number of spaces to insert at the start of each line. @param numChars The maximum length of each line (not counting the indent spaces). @return A string split into multiple indented lines whose length is less than the specified length + indent amount. """ final int inputLength = str.length(); // to prevent resizing, we can predict the size of the indented string // the formatting addition is the indent spaces plus a newline // this length is added once for each line boolean perfectFit = (inputLength % numChars == 0); int fullLines = (inputLength / numChars); int formatLength = perfectFit ? (indent + 1) * fullLines : (indent + 1) * (fullLines + 1); int outputLength = inputLength + formatLength; StringBuilder sb = new StringBuilder(outputLength); for (int offset = 0; offset < inputLength; offset += numChars) { SpaceCharacters.indent(indent, sb); sb.append(str, offset, Math.min(offset + numChars,inputLength)); sb.append('\n'); } return sb.toString(); }
java
@Deprecated public static String splitAndIndent(String str, int indent, int numChars) { final int inputLength = str.length(); // to prevent resizing, we can predict the size of the indented string // the formatting addition is the indent spaces plus a newline // this length is added once for each line boolean perfectFit = (inputLength % numChars == 0); int fullLines = (inputLength / numChars); int formatLength = perfectFit ? (indent + 1) * fullLines : (indent + 1) * (fullLines + 1); int outputLength = inputLength + formatLength; StringBuilder sb = new StringBuilder(outputLength); for (int offset = 0; offset < inputLength; offset += numChars) { SpaceCharacters.indent(indent, sb); sb.append(str, offset, Math.min(offset + numChars,inputLength)); sb.append('\n'); } return sb.toString(); }
[ "@", "Deprecated", "public", "static", "String", "splitAndIndent", "(", "String", "str", ",", "int", "indent", ",", "int", "numChars", ")", "{", "final", "int", "inputLength", "=", "str", ".", "length", "(", ")", ";", "// to prevent resizing, we can predict the size of the indented string", "// the formatting addition is the indent spaces plus a newline", "// this length is added once for each line", "boolean", "perfectFit", "=", "(", "inputLength", "%", "numChars", "==", "0", ")", ";", "int", "fullLines", "=", "(", "inputLength", "/", "numChars", ")", ";", "int", "formatLength", "=", "perfectFit", "?", "(", "indent", "+", "1", ")", "*", "fullLines", ":", "(", "indent", "+", "1", ")", "*", "(", "fullLines", "+", "1", ")", ";", "int", "outputLength", "=", "inputLength", "+", "formatLength", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "outputLength", ")", ";", "for", "(", "int", "offset", "=", "0", ";", "offset", "<", "inputLength", ";", "offset", "+=", "numChars", ")", "{", "SpaceCharacters", ".", "indent", "(", "indent", ",", "sb", ")", ";", "sb", ".", "append", "(", "str", ",", "offset", ",", "Math", ".", "min", "(", "offset", "+", "numChars", ",", "inputLength", ")", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Method that attempts to break a string up into lines no longer than the specified line length. <p>The string is assumed to a large chunk of undifferentiated text such as base 64 encoded binary data. @param str The input string to be split into lines. @param indent The number of spaces to insert at the start of each line. @param numChars The maximum length of each line (not counting the indent spaces). @return A string split into multiple indented lines whose length is less than the specified length + indent amount.
[ "Method", "that", "attempts", "to", "break", "a", "string", "up", "into", "lines", "no", "longer", "than", "the", "specified", "line", "length", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/StringUtility.java#L83-L106
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/BeanUtils.java
BeanUtils.setterMethod
public static Method setterMethod(Class<?> target, Class<?> componentClass) { """ Returns a Method object corresponding to a setter that sets an instance of componentClass from target. @param target class that the setter should exist on @param componentClass component to set @return Method object, or null of one does not exist """ try { return target.getMethod(setterName(componentClass), componentClass); } catch (NoSuchMethodException e) { //if (log.isTraceEnabled()) log.trace("Unable to find method " + setterName(componentClass) + " in class " + target); return null; } catch (NullPointerException e) { return null; } }
java
public static Method setterMethod(Class<?> target, Class<?> componentClass) { try { return target.getMethod(setterName(componentClass), componentClass); } catch (NoSuchMethodException e) { //if (log.isTraceEnabled()) log.trace("Unable to find method " + setterName(componentClass) + " in class " + target); return null; } catch (NullPointerException e) { return null; } }
[ "public", "static", "Method", "setterMethod", "(", "Class", "<", "?", ">", "target", ",", "Class", "<", "?", ">", "componentClass", ")", "{", "try", "{", "return", "target", ".", "getMethod", "(", "setterName", "(", "componentClass", ")", ",", "componentClass", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "//if (log.isTraceEnabled()) log.trace(\"Unable to find method \" + setterName(componentClass) + \" in class \" + target);", "return", "null", ";", "}", "catch", "(", "NullPointerException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Returns a Method object corresponding to a setter that sets an instance of componentClass from target. @param target class that the setter should exist on @param componentClass component to set @return Method object, or null of one does not exist
[ "Returns", "a", "Method", "object", "corresponding", "to", "a", "setter", "that", "sets", "an", "instance", "of", "componentClass", "from", "target", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/BeanUtils.java#L101-L112
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getStorageAccountsWithServiceResponseAsync
public Observable<ServiceResponse<Page<StorageAccountItem>>> getStorageAccountsWithServiceResponseAsync(final String vaultBaseUrl, final Integer maxresults) { """ List storage accounts managed by the specified key vault. This operation requires the storage/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageAccountItem&gt; object """ return getStorageAccountsSinglePageAsync(vaultBaseUrl, maxresults) .concatMap(new Func1<ServiceResponse<Page<StorageAccountItem>>, Observable<ServiceResponse<Page<StorageAccountItem>>>>() { @Override public Observable<ServiceResponse<Page<StorageAccountItem>>> call(ServiceResponse<Page<StorageAccountItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getStorageAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<StorageAccountItem>>> getStorageAccountsWithServiceResponseAsync(final String vaultBaseUrl, final Integer maxresults) { return getStorageAccountsSinglePageAsync(vaultBaseUrl, maxresults) .concatMap(new Func1<ServiceResponse<Page<StorageAccountItem>>, Observable<ServiceResponse<Page<StorageAccountItem>>>>() { @Override public Observable<ServiceResponse<Page<StorageAccountItem>>> call(ServiceResponse<Page<StorageAccountItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getStorageAccountsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountItem", ">", ">", ">", "getStorageAccountsWithServiceResponseAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getStorageAccountsSinglePageAsync", "(", "vaultBaseUrl", ",", "maxresults", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountItem", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountItem", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "StorageAccountItem", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "StorageAccountItem", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "getStorageAccountsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
List storage accounts managed by the specified key vault. This operation requires the storage/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageAccountItem&gt; object
[ "List", "storage", "accounts", "managed", "by", "the", "specified", "key", "vault", ".", "This", "operation", "requires", "the", "storage", "/", "list", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8960-L8972
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/XfaForm.java
XfaForm.setNodeText
public void setNodeText(Node n, String text) { """ Sets the text of this node. All the child's node are deleted and a new child text node is created. @param n the <CODE>Node</CODE> to add the text to @param text the text to add """ if (n == null) return; Node nc = null; while ((nc = n.getFirstChild()) != null) { n.removeChild(nc); } if (n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode") != null) n.getAttributes().removeNamedItemNS(XFA_DATA_SCHEMA, "dataNode"); n.appendChild(domDocument.createTextNode(text)); changed = true; }
java
public void setNodeText(Node n, String text) { if (n == null) return; Node nc = null; while ((nc = n.getFirstChild()) != null) { n.removeChild(nc); } if (n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode") != null) n.getAttributes().removeNamedItemNS(XFA_DATA_SCHEMA, "dataNode"); n.appendChild(domDocument.createTextNode(text)); changed = true; }
[ "public", "void", "setNodeText", "(", "Node", "n", ",", "String", "text", ")", "{", "if", "(", "n", "==", "null", ")", "return", ";", "Node", "nc", "=", "null", ";", "while", "(", "(", "nc", "=", "n", ".", "getFirstChild", "(", ")", ")", "!=", "null", ")", "{", "n", ".", "removeChild", "(", "nc", ")", ";", "}", "if", "(", "n", ".", "getAttributes", "(", ")", ".", "getNamedItemNS", "(", "XFA_DATA_SCHEMA", ",", "\"dataNode\"", ")", "!=", "null", ")", "n", ".", "getAttributes", "(", ")", ".", "removeNamedItemNS", "(", "XFA_DATA_SCHEMA", ",", "\"dataNode\"", ")", ";", "n", ".", "appendChild", "(", "domDocument", ".", "createTextNode", "(", "text", ")", ")", ";", "changed", "=", "true", ";", "}" ]
Sets the text of this node. All the child's node are deleted and a new child text node is created. @param n the <CODE>Node</CODE> to add the text to @param text the text to add
[ "Sets", "the", "text", "of", "this", "node", ".", "All", "the", "child", "s", "node", "are", "deleted", "and", "a", "new", "child", "text", "node", "is", "created", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/XfaForm.java#L351-L362
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java
MyNumberUtils.randomIntBetween
public static int randomIntBetween(int min, int max) { """ Returns an integer between interval @param min Minimum value @param max Maximum value @return int number """ Random rand = new Random(); return rand.nextInt((max - min) + 1) + min; }
java
public static int randomIntBetween(int min, int max) { Random rand = new Random(); return rand.nextInt((max - min) + 1) + min; }
[ "public", "static", "int", "randomIntBetween", "(", "int", "min", ",", "int", "max", ")", "{", "Random", "rand", "=", "new", "Random", "(", ")", ";", "return", "rand", ".", "nextInt", "(", "(", "max", "-", "min", ")", "+", "1", ")", "+", "min", ";", "}" ]
Returns an integer between interval @param min Minimum value @param max Maximum value @return int number
[ "Returns", "an", "integer", "between", "interval" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyNumberUtils.java#L34-L37
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java
GeoPackageOverlayFactory.getLinkedFeatureOverlay
public static BoundedOverlay getLinkedFeatureOverlay(FeatureOverlay featureOverlay, GeoPackage geoPackage) { """ Create a composite overlay linking the feature overly with @param featureOverlay feature overlay @param geoPackage GeoPackage @return linked bounded overlay """ BoundedOverlay overlay; // Get the linked tile daos FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage); List<TileDao> tileDaos = linker.getTileDaosForFeatureTable(featureOverlay.getFeatureTiles().getFeatureDao().getTableName()); if (!tileDaos.isEmpty()) { // Create a composite overlay to search for existing tiles before drawing from features overlay = getCompositeOverlay(tileDaos, featureOverlay); } else { overlay = featureOverlay; } return overlay; }
java
public static BoundedOverlay getLinkedFeatureOverlay(FeatureOverlay featureOverlay, GeoPackage geoPackage) { BoundedOverlay overlay; // Get the linked tile daos FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage); List<TileDao> tileDaos = linker.getTileDaosForFeatureTable(featureOverlay.getFeatureTiles().getFeatureDao().getTableName()); if (!tileDaos.isEmpty()) { // Create a composite overlay to search for existing tiles before drawing from features overlay = getCompositeOverlay(tileDaos, featureOverlay); } else { overlay = featureOverlay; } return overlay; }
[ "public", "static", "BoundedOverlay", "getLinkedFeatureOverlay", "(", "FeatureOverlay", "featureOverlay", ",", "GeoPackage", "geoPackage", ")", "{", "BoundedOverlay", "overlay", ";", "// Get the linked tile daos", "FeatureTileTableLinker", "linker", "=", "new", "FeatureTileTableLinker", "(", "geoPackage", ")", ";", "List", "<", "TileDao", ">", "tileDaos", "=", "linker", ".", "getTileDaosForFeatureTable", "(", "featureOverlay", ".", "getFeatureTiles", "(", ")", ".", "getFeatureDao", "(", ")", ".", "getTableName", "(", ")", ")", ";", "if", "(", "!", "tileDaos", ".", "isEmpty", "(", ")", ")", "{", "// Create a composite overlay to search for existing tiles before drawing from features", "overlay", "=", "getCompositeOverlay", "(", "tileDaos", ",", "featureOverlay", ")", ";", "}", "else", "{", "overlay", "=", "featureOverlay", ";", "}", "return", "overlay", ";", "}" ]
Create a composite overlay linking the feature overly with @param featureOverlay feature overlay @param geoPackage GeoPackage @return linked bounded overlay
[ "Create", "a", "composite", "overlay", "linking", "the", "feature", "overly", "with" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java#L165-L181
pac4j/spring-security-pac4j
src/main/java/org/pac4j/springframework/security/util/SpringSecurityHelper.java
SpringSecurityHelper.populateAuthentication
public static void populateAuthentication(final LinkedHashMap<String, CommonProfile> profiles) { """ Populate the authenticated user profiles in the Spring Security context. @param profiles the linked hashmap of profiles """ if (profiles != null && profiles.size() > 0) { final List<CommonProfile> listProfiles = ProfileHelper.flatIntoAProfileList(profiles); try { if (IS_FULLY_AUTHENTICATED_AUTHORIZER.isAuthorized(null, listProfiles)) { SecurityContextHolder.getContext().setAuthentication(new Pac4jAuthenticationToken(listProfiles)); } else if (IS_REMEMBERED_AUTHORIZER.isAuthorized(null, listProfiles)) { SecurityContextHolder.getContext().setAuthentication(new Pac4jRememberMeAuthenticationToken(listProfiles)); } } catch (final HttpAction e) { throw new TechnicalException(e); } } }
java
public static void populateAuthentication(final LinkedHashMap<String, CommonProfile> profiles) { if (profiles != null && profiles.size() > 0) { final List<CommonProfile> listProfiles = ProfileHelper.flatIntoAProfileList(profiles); try { if (IS_FULLY_AUTHENTICATED_AUTHORIZER.isAuthorized(null, listProfiles)) { SecurityContextHolder.getContext().setAuthentication(new Pac4jAuthenticationToken(listProfiles)); } else if (IS_REMEMBERED_AUTHORIZER.isAuthorized(null, listProfiles)) { SecurityContextHolder.getContext().setAuthentication(new Pac4jRememberMeAuthenticationToken(listProfiles)); } } catch (final HttpAction e) { throw new TechnicalException(e); } } }
[ "public", "static", "void", "populateAuthentication", "(", "final", "LinkedHashMap", "<", "String", ",", "CommonProfile", ">", "profiles", ")", "{", "if", "(", "profiles", "!=", "null", "&&", "profiles", ".", "size", "(", ")", ">", "0", ")", "{", "final", "List", "<", "CommonProfile", ">", "listProfiles", "=", "ProfileHelper", ".", "flatIntoAProfileList", "(", "profiles", ")", ";", "try", "{", "if", "(", "IS_FULLY_AUTHENTICATED_AUTHORIZER", ".", "isAuthorized", "(", "null", ",", "listProfiles", ")", ")", "{", "SecurityContextHolder", ".", "getContext", "(", ")", ".", "setAuthentication", "(", "new", "Pac4jAuthenticationToken", "(", "listProfiles", ")", ")", ";", "}", "else", "if", "(", "IS_REMEMBERED_AUTHORIZER", ".", "isAuthorized", "(", "null", ",", "listProfiles", ")", ")", "{", "SecurityContextHolder", ".", "getContext", "(", ")", ".", "setAuthentication", "(", "new", "Pac4jRememberMeAuthenticationToken", "(", "listProfiles", ")", ")", ";", "}", "}", "catch", "(", "final", "HttpAction", "e", ")", "{", "throw", "new", "TechnicalException", "(", "e", ")", ";", "}", "}", "}" ]
Populate the authenticated user profiles in the Spring Security context. @param profiles the linked hashmap of profiles
[ "Populate", "the", "authenticated", "user", "profiles", "in", "the", "Spring", "Security", "context", "." ]
train
https://github.com/pac4j/spring-security-pac4j/blob/5beaea9c9667a60dc933fa9738a5bfe24830c63d/src/main/java/org/pac4j/springframework/security/util/SpringSecurityHelper.java#L55-L68
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/text/CompressionUtil.java
CompressionUtil.decodeLZToString
public static String decodeLZToString(byte[] data, String dictionary) { """ Decode lz to string string. @param data the data @param dictionary the dictionary @return the string """ try { return new String(decodeLZ(data), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
java
public static String decodeLZToString(byte[] data, String dictionary) { try { return new String(decodeLZ(data), "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
[ "public", "static", "String", "decodeLZToString", "(", "byte", "[", "]", "data", ",", "String", "dictionary", ")", "{", "try", "{", "return", "new", "String", "(", "decodeLZ", "(", "data", ")", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Decode lz to string string. @param data the data @param dictionary the dictionary @return the string
[ "Decode", "lz", "to", "string", "string", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/text/CompressionUtil.java#L143-L149
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.putAt
public static void putAt(BitSet self, IntRange range, boolean value) { """ Support assigning a range of values with a single assignment statement. @param self a BitSet @param range the range of values to set @param value value @see java.util.BitSet @see groovy.lang.Range @since 1.5.0 """ RangeInfo info = subListBorders(self.length(), range); self.set(info.from, info.to, value); }
java
public static void putAt(BitSet self, IntRange range, boolean value) { RangeInfo info = subListBorders(self.length(), range); self.set(info.from, info.to, value); }
[ "public", "static", "void", "putAt", "(", "BitSet", "self", ",", "IntRange", "range", ",", "boolean", "value", ")", "{", "RangeInfo", "info", "=", "subListBorders", "(", "self", ".", "length", "(", ")", ",", "range", ")", ";", "self", ".", "set", "(", "info", ".", "from", ",", "info", ".", "to", ",", "value", ")", ";", "}" ]
Support assigning a range of values with a single assignment statement. @param self a BitSet @param range the range of values to set @param value value @see java.util.BitSet @see groovy.lang.Range @since 1.5.0
[ "Support", "assigning", "a", "range", "of", "values", "with", "a", "single", "assignment", "statement", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14151-L14154
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java
CmsSitemapView.addGalleryEntries
private void addGalleryEntries(CmsGalleryTreeItem parent, List<CmsGalleryFolderEntry> galleries) { """ Adds the gallery tree items to the parent.<p> @param parent the parent item @param galleries the gallery folder entries """ for (CmsGalleryFolderEntry galleryFolder : galleries) { CmsGalleryTreeItem folderItem = createGalleryFolderItem(galleryFolder); parent.addChild(folderItem); m_galleryTreeItems.put(galleryFolder.getStructureId(), folderItem); addGalleryEntries(folderItem, galleryFolder.getSubGalleries()); } }
java
private void addGalleryEntries(CmsGalleryTreeItem parent, List<CmsGalleryFolderEntry> galleries) { for (CmsGalleryFolderEntry galleryFolder : galleries) { CmsGalleryTreeItem folderItem = createGalleryFolderItem(galleryFolder); parent.addChild(folderItem); m_galleryTreeItems.put(galleryFolder.getStructureId(), folderItem); addGalleryEntries(folderItem, galleryFolder.getSubGalleries()); } }
[ "private", "void", "addGalleryEntries", "(", "CmsGalleryTreeItem", "parent", ",", "List", "<", "CmsGalleryFolderEntry", ">", "galleries", ")", "{", "for", "(", "CmsGalleryFolderEntry", "galleryFolder", ":", "galleries", ")", "{", "CmsGalleryTreeItem", "folderItem", "=", "createGalleryFolderItem", "(", "galleryFolder", ")", ";", "parent", ".", "addChild", "(", "folderItem", ")", ";", "m_galleryTreeItems", ".", "put", "(", "galleryFolder", ".", "getStructureId", "(", ")", ",", "folderItem", ")", ";", "addGalleryEntries", "(", "folderItem", ",", "galleryFolder", ".", "getSubGalleries", "(", ")", ")", ";", "}", "}" ]
Adds the gallery tree items to the parent.<p> @param parent the parent item @param galleries the gallery folder entries
[ "Adds", "the", "gallery", "tree", "items", "to", "the", "parent", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapView.java#L1518-L1526
googleapis/google-cloud-java
google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java
GroupServiceClient.createGroup
public final Group createGroup(ProjectName name, Group group) { """ Creates a new group. <p>Sample code: <pre><code> try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); Group group = Group.newBuilder().build(); Group response = groupServiceClient.createGroup(name, group); } </code></pre> @param name The project in which to create the group. The format is `"projects/{project_id_or_number}"`. @param group A group definition. It is an error to define the `name` field because the system assigns the name. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateGroupRequest request = CreateGroupRequest.newBuilder() .setName(name == null ? null : name.toString()) .setGroup(group) .build(); return createGroup(request); }
java
public final Group createGroup(ProjectName name, Group group) { CreateGroupRequest request = CreateGroupRequest.newBuilder() .setName(name == null ? null : name.toString()) .setGroup(group) .build(); return createGroup(request); }
[ "public", "final", "Group", "createGroup", "(", "ProjectName", "name", ",", "Group", "group", ")", "{", "CreateGroupRequest", "request", "=", "CreateGroupRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "null", "?", "null", ":", "name", ".", "toString", "(", ")", ")", ".", "setGroup", "(", "group", ")", ".", "build", "(", ")", ";", "return", "createGroup", "(", "request", ")", ";", "}" ]
Creates a new group. <p>Sample code: <pre><code> try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) { ProjectName name = ProjectName.of("[PROJECT]"); Group group = Group.newBuilder().build(); Group response = groupServiceClient.createGroup(name, group); } </code></pre> @param name The project in which to create the group. The format is `"projects/{project_id_or_number}"`. @param group A group definition. It is an error to define the `name` field because the system assigns the name. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "group", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java#L367-L375
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/manager/QRCode.java
QRCode.tryParse
public static QRCode tryParse(String hhd, String msg) { """ Versucht die Daten als QR-Code zu parsen. @param hhd der HHDuc. @param msg die Nachricht. @return der QR-Code oder NULL. """ try { return new QRCode(hhd, msg); } catch (Exception e) { return null; } }
java
public static QRCode tryParse(String hhd, String msg) { try { return new QRCode(hhd, msg); } catch (Exception e) { return null; } }
[ "public", "static", "QRCode", "tryParse", "(", "String", "hhd", ",", "String", "msg", ")", "{", "try", "{", "return", "new", "QRCode", "(", "hhd", ",", "msg", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "null", ";", "}", "}" ]
Versucht die Daten als QR-Code zu parsen. @param hhd der HHDuc. @param msg die Nachricht. @return der QR-Code oder NULL.
[ "Versucht", "die", "Daten", "als", "QR", "-", "Code", "zu", "parsen", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/QRCode.java#L139-L145
cache2k/cache2k
cache2k-api/src/main/java/org/cache2k/expiry/Expiry.java
Expiry.mixTimeSpanAndPointInTime
public static long mixTimeSpanAndPointInTime(long loadTime, long refreshAfter, long pointInTime) { """ Combine a refresh time span and an expiry at a specified point in time. <p>If the expiry time is far ahead of time the refresh time span takes precedence. If the point in time is close by this time takes precedence. If the refresh time is too close to the requested point an earlier refresh time is used to keep maximum distance to the requested point time, which is {@code abs(pointInTime) - refreshAfter} <p>Rationale: Usually the expiry is allowed to lag behind. This is okay when a normal expiry interval is used. If sharp expiry is requested an old value may not be visible at or after the expiry time. Refresh ahead implies lagging expiry, since the refresh is triggered when the value would usually expire. The two concepts can be combined in the expiry policy, e.g. using an interval for triggering refresh ahead and requesting a sharp expiry only when needed. If effective expiry time for the lagging variant and the for the sharp variant are in close proximity, conflicts need to be resolved. @param loadTime time when the load was started @param refreshAfter time span in milliseconds when the next refresh should happen @param pointInTime time in milliseconds since epoch for the next expiry. Can be negative if sharp expiry is requested, or {@link #ETERNAL} if no point in time expiry is needed. """ long _refreshTime = loadTime + refreshAfter; if (_refreshTime < 0) { _refreshTime = ETERNAL; } if (pointInTime == ETERNAL) { return _refreshTime; } if (pointInTime > _refreshTime) { return _refreshTime; } long _absPointInTime = Math.abs(pointInTime); if (_absPointInTime <= _refreshTime) { return pointInTime; } long _pointInTimeMinusDelta = _absPointInTime - refreshAfter; if (_pointInTimeMinusDelta < _refreshTime) { return _pointInTimeMinusDelta; } return _refreshTime; }
java
public static long mixTimeSpanAndPointInTime(long loadTime, long refreshAfter, long pointInTime) { long _refreshTime = loadTime + refreshAfter; if (_refreshTime < 0) { _refreshTime = ETERNAL; } if (pointInTime == ETERNAL) { return _refreshTime; } if (pointInTime > _refreshTime) { return _refreshTime; } long _absPointInTime = Math.abs(pointInTime); if (_absPointInTime <= _refreshTime) { return pointInTime; } long _pointInTimeMinusDelta = _absPointInTime - refreshAfter; if (_pointInTimeMinusDelta < _refreshTime) { return _pointInTimeMinusDelta; } return _refreshTime; }
[ "public", "static", "long", "mixTimeSpanAndPointInTime", "(", "long", "loadTime", ",", "long", "refreshAfter", ",", "long", "pointInTime", ")", "{", "long", "_refreshTime", "=", "loadTime", "+", "refreshAfter", ";", "if", "(", "_refreshTime", "<", "0", ")", "{", "_refreshTime", "=", "ETERNAL", ";", "}", "if", "(", "pointInTime", "==", "ETERNAL", ")", "{", "return", "_refreshTime", ";", "}", "if", "(", "pointInTime", ">", "_refreshTime", ")", "{", "return", "_refreshTime", ";", "}", "long", "_absPointInTime", "=", "Math", ".", "abs", "(", "pointInTime", ")", ";", "if", "(", "_absPointInTime", "<=", "_refreshTime", ")", "{", "return", "pointInTime", ";", "}", "long", "_pointInTimeMinusDelta", "=", "_absPointInTime", "-", "refreshAfter", ";", "if", "(", "_pointInTimeMinusDelta", "<", "_refreshTime", ")", "{", "return", "_pointInTimeMinusDelta", ";", "}", "return", "_refreshTime", ";", "}" ]
Combine a refresh time span and an expiry at a specified point in time. <p>If the expiry time is far ahead of time the refresh time span takes precedence. If the point in time is close by this time takes precedence. If the refresh time is too close to the requested point an earlier refresh time is used to keep maximum distance to the requested point time, which is {@code abs(pointInTime) - refreshAfter} <p>Rationale: Usually the expiry is allowed to lag behind. This is okay when a normal expiry interval is used. If sharp expiry is requested an old value may not be visible at or after the expiry time. Refresh ahead implies lagging expiry, since the refresh is triggered when the value would usually expire. The two concepts can be combined in the expiry policy, e.g. using an interval for triggering refresh ahead and requesting a sharp expiry only when needed. If effective expiry time for the lagging variant and the for the sharp variant are in close proximity, conflicts need to be resolved. @param loadTime time when the load was started @param refreshAfter time span in milliseconds when the next refresh should happen @param pointInTime time in milliseconds since epoch for the next expiry. Can be negative if sharp expiry is requested, or {@link #ETERNAL} if no point in time expiry is needed.
[ "Combine", "a", "refresh", "time", "span", "and", "an", "expiry", "at", "a", "specified", "point", "in", "time", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/expiry/Expiry.java#L98-L118
ops4j/org.ops4j.pax.wicket
service/src/main/java/org/ops4j/pax/wicket/internal/filter/FilterTrackerCustomizer.java
FilterTrackerCustomizer.modifiedService
public void modifiedService(ServiceReference<FilterFactory> reference, FilterFactoryReference service) { """ <p>modifiedService.</p> @param reference a {@link org.osgi.framework.ServiceReference} object. @param service a {@link org.ops4j.pax.wicket.internal.filter.FilterFactoryReference} object. """ if (service != null) { service.setProperties(reference); LOGGER.debug("updated FilterFactory {} for application {}", service.getFactory().getClass().getName(), applicationName); } }
java
public void modifiedService(ServiceReference<FilterFactory> reference, FilterFactoryReference service) { if (service != null) { service.setProperties(reference); LOGGER.debug("updated FilterFactory {} for application {}", service.getFactory().getClass().getName(), applicationName); } }
[ "public", "void", "modifiedService", "(", "ServiceReference", "<", "FilterFactory", ">", "reference", ",", "FilterFactoryReference", "service", ")", "{", "if", "(", "service", "!=", "null", ")", "{", "service", ".", "setProperties", "(", "reference", ")", ";", "LOGGER", ".", "debug", "(", "\"updated FilterFactory {} for application {}\"", ",", "service", ".", "getFactory", "(", ")", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "applicationName", ")", ";", "}", "}" ]
<p>modifiedService.</p> @param reference a {@link org.osgi.framework.ServiceReference} object. @param service a {@link org.ops4j.pax.wicket.internal.filter.FilterFactoryReference} object.
[ "<p", ">", "modifiedService", ".", "<", "/", "p", ">" ]
train
https://github.com/ops4j/org.ops4j.pax.wicket/blob/ef7cb4bdf918e9e61ec69789b9c690567616faa9/service/src/main/java/org/ops4j/pax/wicket/internal/filter/FilterTrackerCustomizer.java#L76-L82
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getResourceAsStream
public static InputStream getResourceAsStream(String name) { """ Retrieve resource, identified by qualified name, as input stream. This method does its best to load requested resource but throws exception if fail. Resource is loaded using {@link ClassLoader#getResourceAsStream(String)} and <code>name</code> argument should follow Java class loader convention: it is always considered as absolute path, that is, should contain package but does not start with leading path separator, e.g. <code>js/fop/config.xml</code> . <p> Resource is searched into next class loaders, in given order: <ul> <li>current thread context class loader, <li>this utility class loader, <li>system class loader, as returned by {@link ClassLoader#getSystemClassLoader()} </ul> @param name resource qualified name, using path separators instead of dots. @return resource input stream. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws NoSuchBeingException if resource not found. """ Params.notNullOrEmpty(name, "Resource name"); // not documented behavior: accept but ignore trailing path separator if(name.charAt(0) == '/') { name = name.substring(1); } InputStream stream = getResourceAsStream(name, new ClassLoader[] { Thread.currentThread().getContextClassLoader(), Classes.class.getClassLoader(), ClassLoader.getSystemClassLoader() }); if(stream == null) { throw new NoSuchBeingException("Resource |%s| not found.", name); } return stream; }
java
public static InputStream getResourceAsStream(String name) { Params.notNullOrEmpty(name, "Resource name"); // not documented behavior: accept but ignore trailing path separator if(name.charAt(0) == '/') { name = name.substring(1); } InputStream stream = getResourceAsStream(name, new ClassLoader[] { Thread.currentThread().getContextClassLoader(), Classes.class.getClassLoader(), ClassLoader.getSystemClassLoader() }); if(stream == null) { throw new NoSuchBeingException("Resource |%s| not found.", name); } return stream; }
[ "public", "static", "InputStream", "getResourceAsStream", "(", "String", "name", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Resource name\"", ")", ";", "// not documented behavior: accept but ignore trailing path separator\r", "if", "(", "name", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "name", "=", "name", ".", "substring", "(", "1", ")", ";", "}", "InputStream", "stream", "=", "getResourceAsStream", "(", "name", ",", "new", "ClassLoader", "[", "]", "{", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ",", "Classes", ".", "class", ".", "getClassLoader", "(", ")", ",", "ClassLoader", ".", "getSystemClassLoader", "(", ")", "}", ")", ";", "if", "(", "stream", "==", "null", ")", "{", "throw", "new", "NoSuchBeingException", "(", "\"Resource |%s| not found.\"", ",", "name", ")", ";", "}", "return", "stream", ";", "}" ]
Retrieve resource, identified by qualified name, as input stream. This method does its best to load requested resource but throws exception if fail. Resource is loaded using {@link ClassLoader#getResourceAsStream(String)} and <code>name</code> argument should follow Java class loader convention: it is always considered as absolute path, that is, should contain package but does not start with leading path separator, e.g. <code>js/fop/config.xml</code> . <p> Resource is searched into next class loaders, in given order: <ul> <li>current thread context class loader, <li>this utility class loader, <li>system class loader, as returned by {@link ClassLoader#getSystemClassLoader()} </ul> @param name resource qualified name, using path separators instead of dots. @return resource input stream. @throws IllegalArgumentException if <code>name</code> argument is null or empty. @throws NoSuchBeingException if resource not found.
[ "Retrieve", "resource", "identified", "by", "qualified", "name", "as", "input", "stream", ".", "This", "method", "does", "its", "best", "to", "load", "requested", "resource", "but", "throws", "exception", "if", "fail", ".", "Resource", "is", "loaded", "using", "{", "@link", "ClassLoader#getResourceAsStream", "(", "String", ")", "}", "and", "<code", ">", "name<", "/", "code", ">", "argument", "should", "follow", "Java", "class", "loader", "convention", ":", "it", "is", "always", "considered", "as", "absolute", "path", "that", "is", "should", "contain", "package", "but", "does", "not", "start", "with", "leading", "path", "separator", "e", ".", "g", ".", "<code", ">", "js", "/", "fop", "/", "config", ".", "xml<", "/", "code", ">", ".", "<p", ">", "Resource", "is", "searched", "into", "next", "class", "loaders", "in", "given", "order", ":", "<ul", ">", "<li", ">", "current", "thread", "context", "class", "loader", "<li", ">", "this", "utility", "class", "loader", "<li", ">", "system", "class", "loader", "as", "returned", "by", "{", "@link", "ClassLoader#getSystemClassLoader", "()", "}", "<", "/", "ul", ">" ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1035-L1051
alkacon/opencms-core
src/org/opencms/db/generic/CmsSqlManager.java
CmsSqlManager.getPreparedStatement
public PreparedStatement getPreparedStatement(Connection con, CmsUUID projectId, String queryKey) throws SQLException { """ Returns a PreparedStatement for a JDBC connection specified by the key of a SQL query and the project-ID.<p> @param con the JDBC connection @param projectId the ID of the specified CmsProject @param queryKey the key of the SQL query @return PreparedStatement a new PreparedStatement containing the pre-compiled SQL statement @throws SQLException if a database access error occurs """ String rawSql = readQuery(projectId, queryKey); return getPreparedStatementForSql(con, rawSql); }
java
public PreparedStatement getPreparedStatement(Connection con, CmsUUID projectId, String queryKey) throws SQLException { String rawSql = readQuery(projectId, queryKey); return getPreparedStatementForSql(con, rawSql); }
[ "public", "PreparedStatement", "getPreparedStatement", "(", "Connection", "con", ",", "CmsUUID", "projectId", ",", "String", "queryKey", ")", "throws", "SQLException", "{", "String", "rawSql", "=", "readQuery", "(", "projectId", ",", "queryKey", ")", ";", "return", "getPreparedStatementForSql", "(", "con", ",", "rawSql", ")", ";", "}" ]
Returns a PreparedStatement for a JDBC connection specified by the key of a SQL query and the project-ID.<p> @param con the JDBC connection @param projectId the ID of the specified CmsProject @param queryKey the key of the SQL query @return PreparedStatement a new PreparedStatement containing the pre-compiled SQL statement @throws SQLException if a database access error occurs
[ "Returns", "a", "PreparedStatement", "for", "a", "JDBC", "connection", "specified", "by", "the", "key", "of", "a", "SQL", "query", "and", "the", "project", "-", "ID", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsSqlManager.java#L257-L262
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/allocator/RoundRobinAllocator.java
RoundRobinAllocator.getNextAvailDirInTier
private int getNextAvailDirInTier(StorageTierView tierView, long blockSize) { """ Finds an available dir in a given tier for a block with blockSize. @param tierView the tier to find a dir @param blockSize the requested block size @return the index of the dir if non-negative; -1 if fail to find a dir """ int dirViewIndex = mTierAliasToLastDirMap.get(tierView.getTierViewAlias()); for (int i = 0; i < tierView.getDirViews().size(); i++) { // try this many times dirViewIndex = (dirViewIndex + 1) % tierView.getDirViews().size(); if (tierView.getDirView(dirViewIndex).getAvailableBytes() >= blockSize) { return dirViewIndex; } } return -1; }
java
private int getNextAvailDirInTier(StorageTierView tierView, long blockSize) { int dirViewIndex = mTierAliasToLastDirMap.get(tierView.getTierViewAlias()); for (int i = 0; i < tierView.getDirViews().size(); i++) { // try this many times dirViewIndex = (dirViewIndex + 1) % tierView.getDirViews().size(); if (tierView.getDirView(dirViewIndex).getAvailableBytes() >= blockSize) { return dirViewIndex; } } return -1; }
[ "private", "int", "getNextAvailDirInTier", "(", "StorageTierView", "tierView", ",", "long", "blockSize", ")", "{", "int", "dirViewIndex", "=", "mTierAliasToLastDirMap", ".", "get", "(", "tierView", ".", "getTierViewAlias", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "tierView", ".", "getDirViews", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "// try this many times", "dirViewIndex", "=", "(", "dirViewIndex", "+", "1", ")", "%", "tierView", ".", "getDirViews", "(", ")", ".", "size", "(", ")", ";", "if", "(", "tierView", ".", "getDirView", "(", "dirViewIndex", ")", ".", "getAvailableBytes", "(", ")", ">=", "blockSize", ")", "{", "return", "dirViewIndex", ";", "}", "}", "return", "-", "1", ";", "}" ]
Finds an available dir in a given tier for a block with blockSize. @param tierView the tier to find a dir @param blockSize the requested block size @return the index of the dir if non-negative; -1 if fail to find a dir
[ "Finds", "an", "available", "dir", "in", "a", "given", "tier", "for", "a", "block", "with", "blockSize", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/allocator/RoundRobinAllocator.java#L109-L118
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutHelper.java
RolloutHelper.verifyRolloutGroupParameter
public static void verifyRolloutGroupParameter(final int amountGroup, final QuotaManagement quotaManagement) { """ Verify if the supplied amount of groups is in range @param amountGroup amount of groups @param quotaManagement to retrieve maximum number of groups allowed """ if (amountGroup <= 0) { throw new ValidationException("The amount of groups cannot be lower than zero"); } else if (amountGroup > quotaManagement.getMaxRolloutGroupsPerRollout()) { throw new QuotaExceededException( "The amount of groups cannot be greater than " + quotaManagement.getMaxRolloutGroupsPerRollout()); } }
java
public static void verifyRolloutGroupParameter(final int amountGroup, final QuotaManagement quotaManagement) { if (amountGroup <= 0) { throw new ValidationException("The amount of groups cannot be lower than zero"); } else if (amountGroup > quotaManagement.getMaxRolloutGroupsPerRollout()) { throw new QuotaExceededException( "The amount of groups cannot be greater than " + quotaManagement.getMaxRolloutGroupsPerRollout()); } }
[ "public", "static", "void", "verifyRolloutGroupParameter", "(", "final", "int", "amountGroup", ",", "final", "QuotaManagement", "quotaManagement", ")", "{", "if", "(", "amountGroup", "<=", "0", ")", "{", "throw", "new", "ValidationException", "(", "\"The amount of groups cannot be lower than zero\"", ")", ";", "}", "else", "if", "(", "amountGroup", ">", "quotaManagement", ".", "getMaxRolloutGroupsPerRollout", "(", ")", ")", "{", "throw", "new", "QuotaExceededException", "(", "\"The amount of groups cannot be greater than \"", "+", "quotaManagement", ".", "getMaxRolloutGroupsPerRollout", "(", ")", ")", ";", "}", "}" ]
Verify if the supplied amount of groups is in range @param amountGroup amount of groups @param quotaManagement to retrieve maximum number of groups allowed
[ "Verify", "if", "the", "supplied", "amount", "of", "groups", "is", "in", "range" ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutHelper.java#L77-L85
etourdot/xincproc
xpointer/src/main/java/org/etourdot/xincproc/xpointer/XPointerEngine.java
XPointerEngine.executeToDestination
public int executeToDestination(final String pointerStr, final Source source, final Destination destination) throws XPointerException { """ Execute a xpointer expression on a xml source. The result is send to a Saxon {@link net.sf.saxon.s9api.Destination} @param pointerStr xpointer expression @param source xml source @param destination Saxon destination of result stream @return number of elements in result infoset excluding comments et processing instructions @throws XPointerException the x pointer exception """ final Pointer pointer = getPointer(pointerStr); final XdmNode node = processor.newDocumentBuilder().wrap(source); if (pointer != null) { if (pointer.isShortHandPresent()) { return executeShorthandPointer(pointer.getShortHand(), node, destination); } else if (pointer.isSchemeBased()) { return executeSchemaPointer(pointer, node, destination); } else { throw new XPointerResourceException("Unknown pointer expression"); } } else { throw new XPointerResourceException("Unknown pointer expression"); } }
java
public int executeToDestination(final String pointerStr, final Source source, final Destination destination) throws XPointerException { final Pointer pointer = getPointer(pointerStr); final XdmNode node = processor.newDocumentBuilder().wrap(source); if (pointer != null) { if (pointer.isShortHandPresent()) { return executeShorthandPointer(pointer.getShortHand(), node, destination); } else if (pointer.isSchemeBased()) { return executeSchemaPointer(pointer, node, destination); } else { throw new XPointerResourceException("Unknown pointer expression"); } } else { throw new XPointerResourceException("Unknown pointer expression"); } }
[ "public", "int", "executeToDestination", "(", "final", "String", "pointerStr", ",", "final", "Source", "source", ",", "final", "Destination", "destination", ")", "throws", "XPointerException", "{", "final", "Pointer", "pointer", "=", "getPointer", "(", "pointerStr", ")", ";", "final", "XdmNode", "node", "=", "processor", ".", "newDocumentBuilder", "(", ")", ".", "wrap", "(", "source", ")", ";", "if", "(", "pointer", "!=", "null", ")", "{", "if", "(", "pointer", ".", "isShortHandPresent", "(", ")", ")", "{", "return", "executeShorthandPointer", "(", "pointer", ".", "getShortHand", "(", ")", ",", "node", ",", "destination", ")", ";", "}", "else", "if", "(", "pointer", ".", "isSchemeBased", "(", ")", ")", "{", "return", "executeSchemaPointer", "(", "pointer", ",", "node", ",", "destination", ")", ";", "}", "else", "{", "throw", "new", "XPointerResourceException", "(", "\"Unknown pointer expression\"", ")", ";", "}", "}", "else", "{", "throw", "new", "XPointerResourceException", "(", "\"Unknown pointer expression\"", ")", ";", "}", "}" ]
Execute a xpointer expression on a xml source. The result is send to a Saxon {@link net.sf.saxon.s9api.Destination} @param pointerStr xpointer expression @param source xml source @param destination Saxon destination of result stream @return number of elements in result infoset excluding comments et processing instructions @throws XPointerException the x pointer exception
[ "Execute", "a", "xpointer", "expression", "on", "a", "xml", "source", ".", "The", "result", "is", "send", "to", "a", "Saxon", "{", "@link", "net", ".", "sf", ".", "saxon", ".", "s9api", ".", "Destination", "}" ]
train
https://github.com/etourdot/xincproc/blob/6e9e9352e1975957ae6821a04c248ea49c7323ec/xpointer/src/main/java/org/etourdot/xincproc/xpointer/XPointerEngine.java#L192-L216
elibom/jogger
src/main/java/com/elibom/jogger/middleware/router/RouterMiddleware.java
RouterMiddleware.getRoute
private Route getRoute(String httpMethod, String path) { """ Retrieves the {@link Route} that matches the specified <code>httpMethod</code> and <code>path</code>. @param httpMethod the HTTP method to match. Should not be null or empty. @param path the path to match. Should not be null but can be empty (which is interpreted as /) @return a {@link Route} object that matches the arguments or null if no route matches. """ Preconditions.notEmpty(httpMethod, "no httpMethod provided."); Preconditions.notNull(path, "no path provided."); String cleanPath = parsePath(path); for (Route route : routes) { if (matchesPath(route.getPath(), cleanPath) && route.getHttpMethod().toString().equalsIgnoreCase(httpMethod)) { return route; } } return null; }
java
private Route getRoute(String httpMethod, String path) { Preconditions.notEmpty(httpMethod, "no httpMethod provided."); Preconditions.notNull(path, "no path provided."); String cleanPath = parsePath(path); for (Route route : routes) { if (matchesPath(route.getPath(), cleanPath) && route.getHttpMethod().toString().equalsIgnoreCase(httpMethod)) { return route; } } return null; }
[ "private", "Route", "getRoute", "(", "String", "httpMethod", ",", "String", "path", ")", "{", "Preconditions", ".", "notEmpty", "(", "httpMethod", ",", "\"no httpMethod provided.\"", ")", ";", "Preconditions", ".", "notNull", "(", "path", ",", "\"no path provided.\"", ")", ";", "String", "cleanPath", "=", "parsePath", "(", "path", ")", ";", "for", "(", "Route", "route", ":", "routes", ")", "{", "if", "(", "matchesPath", "(", "route", ".", "getPath", "(", ")", ",", "cleanPath", ")", "&&", "route", ".", "getHttpMethod", "(", ")", ".", "toString", "(", ")", ".", "equalsIgnoreCase", "(", "httpMethod", ")", ")", "{", "return", "route", ";", "}", "}", "return", "null", ";", "}" ]
Retrieves the {@link Route} that matches the specified <code>httpMethod</code> and <code>path</code>. @param httpMethod the HTTP method to match. Should not be null or empty. @param path the path to match. Should not be null but can be empty (which is interpreted as /) @return a {@link Route} object that matches the arguments or null if no route matches.
[ "Retrieves", "the", "{", "@link", "Route", "}", "that", "matches", "the", "specified", "<code", ">", "httpMethod<", "/", "code", ">", "and", "<code", ">", "path<", "/", "code", ">", "." ]
train
https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/middleware/router/RouterMiddleware.java#L111-L124
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java
ConfigReader.loadAccessors
public void loadAccessors(Class<?> targetClass, MappedField configuredField, MappedField targetField) { """ Fill fields with they custom methods. @param targetClass class of the target field @param configuredField configured field @param targetField target field """ // First checks xml configuration xml.fillMappedField(configuredClass, configuredField) .fillMappedField(targetClass, targetField) // fill target field with custom methods defined in the configured field .fillOppositeField(configuredClass, configuredField, targetField); // If no present custom methods in XML, it checks annotations Annotation.fillMappedField(configuredClass,configuredField); Annotation.fillMappedField(targetClass,targetField); // fill target field with custom methods defined in the configured field Annotation.fillOppositeField(configuredClass,configuredField,targetField); }
java
public void loadAccessors(Class<?> targetClass, MappedField configuredField, MappedField targetField) { // First checks xml configuration xml.fillMappedField(configuredClass, configuredField) .fillMappedField(targetClass, targetField) // fill target field with custom methods defined in the configured field .fillOppositeField(configuredClass, configuredField, targetField); // If no present custom methods in XML, it checks annotations Annotation.fillMappedField(configuredClass,configuredField); Annotation.fillMappedField(targetClass,targetField); // fill target field with custom methods defined in the configured field Annotation.fillOppositeField(configuredClass,configuredField,targetField); }
[ "public", "void", "loadAccessors", "(", "Class", "<", "?", ">", "targetClass", ",", "MappedField", "configuredField", ",", "MappedField", "targetField", ")", "{", "// First checks xml configuration\r", "xml", ".", "fillMappedField", "(", "configuredClass", ",", "configuredField", ")", ".", "fillMappedField", "(", "targetClass", ",", "targetField", ")", "// fill target field with custom methods defined in the configured field\r", ".", "fillOppositeField", "(", "configuredClass", ",", "configuredField", ",", "targetField", ")", ";", "// If no present custom methods in XML, it checks annotations\r", "Annotation", ".", "fillMappedField", "(", "configuredClass", ",", "configuredField", ")", ";", "Annotation", ".", "fillMappedField", "(", "targetClass", ",", "targetField", ")", ";", "// fill target field with custom methods defined in the configured field\r", "Annotation", ".", "fillOppositeField", "(", "configuredClass", ",", "configuredField", ",", "targetField", ")", ";", "}" ]
Fill fields with they custom methods. @param targetClass class of the target field @param configuredField configured field @param targetField target field
[ "Fill", "fields", "with", "they", "custom", "methods", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java#L301-L315
roboconf/roboconf-platform
core/roboconf-target-embedded/src/main/java/net/roboconf/target/embedded/internal/ConfiguratorOnCreation.java
ConfiguratorOnCreation.updateAgentConfigurationFile
void updateAgentConfigurationFile( TargetHandlerParameters parameters, SSHClient ssh, File tmpDir, Map<String,String> keyToNewValue ) throws IOException { """ Updates the configuration file of an agent. @param parameters @param ssh @param tmpDir @param keyToNewValue @throws IOException """ this.logger.fine( "Updating agent parameters on remote host..." ); // Update the agent's configuration file String agentConfigDir = Utils.getValue( parameters.getTargetProperties(), SCP_AGENT_CONFIG_DIR, DEFAULT_SCP_AGENT_CONFIG_DIR ); File localAgentConfig = new File( tmpDir, Constants.KARAF_CFG_FILE_AGENT ); File remoteAgentConfig = new File( agentConfigDir, Constants.KARAF_CFG_FILE_AGENT ); // Download remote agent config file... ssh.newSCPFileTransfer().download(remoteAgentConfig.getCanonicalPath(), new FileSystemFile(tmpDir)); // Replace "parameters" property to point on the user data file... String config = Utils.readFileContent(localAgentConfig); config = Utils.updateProperties( config, keyToNewValue ); Utils.writeStringInto(config, localAgentConfig); // Then upload agent config file back ssh.newSCPFileTransfer().upload(new FileSystemFile(localAgentConfig), agentConfigDir); }
java
void updateAgentConfigurationFile( TargetHandlerParameters parameters, SSHClient ssh, File tmpDir, Map<String,String> keyToNewValue ) throws IOException { this.logger.fine( "Updating agent parameters on remote host..." ); // Update the agent's configuration file String agentConfigDir = Utils.getValue( parameters.getTargetProperties(), SCP_AGENT_CONFIG_DIR, DEFAULT_SCP_AGENT_CONFIG_DIR ); File localAgentConfig = new File( tmpDir, Constants.KARAF_CFG_FILE_AGENT ); File remoteAgentConfig = new File( agentConfigDir, Constants.KARAF_CFG_FILE_AGENT ); // Download remote agent config file... ssh.newSCPFileTransfer().download(remoteAgentConfig.getCanonicalPath(), new FileSystemFile(tmpDir)); // Replace "parameters" property to point on the user data file... String config = Utils.readFileContent(localAgentConfig); config = Utils.updateProperties( config, keyToNewValue ); Utils.writeStringInto(config, localAgentConfig); // Then upload agent config file back ssh.newSCPFileTransfer().upload(new FileSystemFile(localAgentConfig), agentConfigDir); }
[ "void", "updateAgentConfigurationFile", "(", "TargetHandlerParameters", "parameters", ",", "SSHClient", "ssh", ",", "File", "tmpDir", ",", "Map", "<", "String", ",", "String", ">", "keyToNewValue", ")", "throws", "IOException", "{", "this", ".", "logger", ".", "fine", "(", "\"Updating agent parameters on remote host...\"", ")", ";", "// Update the agent's configuration file", "String", "agentConfigDir", "=", "Utils", ".", "getValue", "(", "parameters", ".", "getTargetProperties", "(", ")", ",", "SCP_AGENT_CONFIG_DIR", ",", "DEFAULT_SCP_AGENT_CONFIG_DIR", ")", ";", "File", "localAgentConfig", "=", "new", "File", "(", "tmpDir", ",", "Constants", ".", "KARAF_CFG_FILE_AGENT", ")", ";", "File", "remoteAgentConfig", "=", "new", "File", "(", "agentConfigDir", ",", "Constants", ".", "KARAF_CFG_FILE_AGENT", ")", ";", "// Download remote agent config file...", "ssh", ".", "newSCPFileTransfer", "(", ")", ".", "download", "(", "remoteAgentConfig", ".", "getCanonicalPath", "(", ")", ",", "new", "FileSystemFile", "(", "tmpDir", ")", ")", ";", "// Replace \"parameters\" property to point on the user data file...", "String", "config", "=", "Utils", ".", "readFileContent", "(", "localAgentConfig", ")", ";", "config", "=", "Utils", ".", "updateProperties", "(", "config", ",", "keyToNewValue", ")", ";", "Utils", ".", "writeStringInto", "(", "config", ",", "localAgentConfig", ")", ";", "// Then upload agent config file back", "ssh", ".", "newSCPFileTransfer", "(", ")", ".", "upload", "(", "new", "FileSystemFile", "(", "localAgentConfig", ")", ",", "agentConfigDir", ")", ";", "}" ]
Updates the configuration file of an agent. @param parameters @param ssh @param tmpDir @param keyToNewValue @throws IOException
[ "Updates", "the", "configuration", "file", "of", "an", "agent", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-embedded/src/main/java/net/roboconf/target/embedded/internal/ConfiguratorOnCreation.java#L241-L265
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenWriterThread.java
GenWriterThread.writeControlFile
private void writeControlFile(FileSystem fs, Path outputPath, Path checksumFile, String name) throws IOException { """ This is used for verification Each mapper writes one control file control file only contains the base directory written by this mapper and the checksum file path so that we could create a Read mapper which scanned the files under the base directory and verify the checksum of files with the information given in the checksum file. @param fs @param outputPath base directory of mapper @param checksumFile location of checksum file @param name name of control file @throws IOException """ SequenceFile.Writer write = null; try { Path parentDir = new Path(rtc.input, "filelists"); if (!fs.exists(parentDir)) { fs.mkdirs(parentDir); } Path controlFile = new Path(parentDir, name); write = SequenceFile.createWriter(fs, fs.getConf(), controlFile, Text.class, Text.class, CompressionType.NONE); write.append(new Text(outputPath.toString()), new Text(checksumFile.toString())); } finally { if (write != null) write.close(); write = null; } }
java
private void writeControlFile(FileSystem fs, Path outputPath, Path checksumFile, String name) throws IOException { SequenceFile.Writer write = null; try { Path parentDir = new Path(rtc.input, "filelists"); if (!fs.exists(parentDir)) { fs.mkdirs(parentDir); } Path controlFile = new Path(parentDir, name); write = SequenceFile.createWriter(fs, fs.getConf(), controlFile, Text.class, Text.class, CompressionType.NONE); write.append(new Text(outputPath.toString()), new Text(checksumFile.toString())); } finally { if (write != null) write.close(); write = null; } }
[ "private", "void", "writeControlFile", "(", "FileSystem", "fs", ",", "Path", "outputPath", ",", "Path", "checksumFile", ",", "String", "name", ")", "throws", "IOException", "{", "SequenceFile", ".", "Writer", "write", "=", "null", ";", "try", "{", "Path", "parentDir", "=", "new", "Path", "(", "rtc", ".", "input", ",", "\"filelists\"", ")", ";", "if", "(", "!", "fs", ".", "exists", "(", "parentDir", ")", ")", "{", "fs", ".", "mkdirs", "(", "parentDir", ")", ";", "}", "Path", "controlFile", "=", "new", "Path", "(", "parentDir", ",", "name", ")", ";", "write", "=", "SequenceFile", ".", "createWriter", "(", "fs", ",", "fs", ".", "getConf", "(", ")", ",", "controlFile", ",", "Text", ".", "class", ",", "Text", ".", "class", ",", "CompressionType", ".", "NONE", ")", ";", "write", ".", "append", "(", "new", "Text", "(", "outputPath", ".", "toString", "(", ")", ")", ",", "new", "Text", "(", "checksumFile", ".", "toString", "(", ")", ")", ")", ";", "}", "finally", "{", "if", "(", "write", "!=", "null", ")", "write", ".", "close", "(", ")", ";", "write", "=", "null", ";", "}", "}" ]
This is used for verification Each mapper writes one control file control file only contains the base directory written by this mapper and the checksum file path so that we could create a Read mapper which scanned the files under the base directory and verify the checksum of files with the information given in the checksum file. @param fs @param outputPath base directory of mapper @param checksumFile location of checksum file @param name name of control file @throws IOException
[ "This", "is", "used", "for", "verification", "Each", "mapper", "writes", "one", "control", "file", "control", "file", "only", "contains", "the", "base", "directory", "written", "by", "this", "mapper", "and", "the", "checksum", "file", "path", "so", "that", "we", "could", "create", "a", "Read", "mapper", "which", "scanned", "the", "files", "under", "the", "base", "directory", "and", "verify", "the", "checksum", "of", "files", "with", "the", "information", "given", "in", "the", "checksum", "file", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/GenWriterThread.java#L270-L288
h2oai/h2o-3
h2o-core/src/main/java/water/jdbc/SQLManager.java
SQLManager.buildSelectChunkSql
static String buildSelectChunkSql(String databaseType, String table, long start, int length, String columns, String[] columnNames) { """ Builds SQL SELECT to retrieve chunk of rows from a table based on row offset and number of rows in a chunk. Pagination in following Databases: SQL Server, Oracle 12c: OFFSET x ROWS FETCH NEXT y ROWS ONLY SQL Server, Vertica may need ORDER BY MySQL, PostgreSQL, MariaDB: LIMIT y OFFSET x Teradata (and possibly older Oracle): SELECT * FROM mytable QUALIFY ROW_NUMBER() OVER (ORDER BY column_name) BETWEEN x and x+y; @param databaseType @param table @param start @param length @param columns @param columnNames array of column names retrieved and parsed from single row SELECT prior to this call @return String SQL SELECT statement """ String sqlText = "SELECT " + columns + " FROM " + table; switch(databaseType) { case SQL_SERVER_DB_TYPE: // requires ORDER BY clause with OFFSET/FETCH NEXT clauses, syntax supported since SQLServer 2012 sqlText += " ORDER BY ROW_NUMBER() OVER (ORDER BY (SELECT 0))"; sqlText += " OFFSET " + start + " ROWS FETCH NEXT " + length + " ROWS ONLY"; break; case ORACLE_DB_TYPE: sqlText += " OFFSET " + start + " ROWS FETCH NEXT " + length + " ROWS ONLY"; break; case TERADATA_DB_TYPE: sqlText += " QUALIFY ROW_NUMBER() OVER (ORDER BY " + columnNames[0] + ") BETWEEN " + (start+1) + " AND " + (start+length); break; default: sqlText += " LIMIT " + length + " OFFSET " + start; } return sqlText; }
java
static String buildSelectChunkSql(String databaseType, String table, long start, int length, String columns, String[] columnNames) { String sqlText = "SELECT " + columns + " FROM " + table; switch(databaseType) { case SQL_SERVER_DB_TYPE: // requires ORDER BY clause with OFFSET/FETCH NEXT clauses, syntax supported since SQLServer 2012 sqlText += " ORDER BY ROW_NUMBER() OVER (ORDER BY (SELECT 0))"; sqlText += " OFFSET " + start + " ROWS FETCH NEXT " + length + " ROWS ONLY"; break; case ORACLE_DB_TYPE: sqlText += " OFFSET " + start + " ROWS FETCH NEXT " + length + " ROWS ONLY"; break; case TERADATA_DB_TYPE: sqlText += " QUALIFY ROW_NUMBER() OVER (ORDER BY " + columnNames[0] + ") BETWEEN " + (start+1) + " AND " + (start+length); break; default: sqlText += " LIMIT " + length + " OFFSET " + start; } return sqlText; }
[ "static", "String", "buildSelectChunkSql", "(", "String", "databaseType", ",", "String", "table", ",", "long", "start", ",", "int", "length", ",", "String", "columns", ",", "String", "[", "]", "columnNames", ")", "{", "String", "sqlText", "=", "\"SELECT \"", "+", "columns", "+", "\" FROM \"", "+", "table", ";", "switch", "(", "databaseType", ")", "{", "case", "SQL_SERVER_DB_TYPE", ":", "// requires ORDER BY clause with OFFSET/FETCH NEXT clauses, syntax supported since SQLServer 2012", "sqlText", "+=", "\" ORDER BY ROW_NUMBER() OVER (ORDER BY (SELECT 0))\"", ";", "sqlText", "+=", "\" OFFSET \"", "+", "start", "+", "\" ROWS FETCH NEXT \"", "+", "length", "+", "\" ROWS ONLY\"", ";", "break", ";", "case", "ORACLE_DB_TYPE", ":", "sqlText", "+=", "\" OFFSET \"", "+", "start", "+", "\" ROWS FETCH NEXT \"", "+", "length", "+", "\" ROWS ONLY\"", ";", "break", ";", "case", "TERADATA_DB_TYPE", ":", "sqlText", "+=", "\" QUALIFY ROW_NUMBER() OVER (ORDER BY \"", "+", "columnNames", "[", "0", "]", "+", "\") BETWEEN \"", "+", "(", "start", "+", "1", ")", "+", "\" AND \"", "+", "(", "start", "+", "length", ")", ";", "break", ";", "default", ":", "sqlText", "+=", "\" LIMIT \"", "+", "length", "+", "\" OFFSET \"", "+", "start", ";", "}", "return", "sqlText", ";", "}" ]
Builds SQL SELECT to retrieve chunk of rows from a table based on row offset and number of rows in a chunk. Pagination in following Databases: SQL Server, Oracle 12c: OFFSET x ROWS FETCH NEXT y ROWS ONLY SQL Server, Vertica may need ORDER BY MySQL, PostgreSQL, MariaDB: LIMIT y OFFSET x Teradata (and possibly older Oracle): SELECT * FROM mytable QUALIFY ROW_NUMBER() OVER (ORDER BY column_name) BETWEEN x and x+y; @param databaseType @param table @param start @param length @param columns @param columnNames array of column names retrieved and parsed from single row SELECT prior to this call @return String SQL SELECT statement
[ "Builds", "SQL", "SELECT", "to", "retrieve", "chunk", "of", "rows", "from", "a", "table", "based", "on", "row", "offset", "and", "number", "of", "rows", "in", "a", "chunk", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/jdbc/SQLManager.java#L346-L368
JOML-CI/JOML
src/org/joml/Quaternionf.java
Quaternionf.nlerpIterative
public static Quaternionfc nlerpIterative(Quaternionf[] qs, float[] weights, float dotThreshold, Quaternionf dest) { """ Interpolate between all of the quaternions given in <code>qs</code> via iterative non-spherical linear interpolation using the specified interpolation factors <code>weights</code>, and store the result in <code>dest</code>. <p> This method will interpolate between each two successive quaternions via {@link #nlerpIterative(Quaternionfc, float, float)} using their relative interpolation weights. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions#answer-62356">http://gamedev.stackexchange.com/</a> @param qs the quaternions to interpolate over @param weights the weights of each individual quaternion in <code>qs</code> @param dotThreshold the threshold for the dot product of each two interpolated quaternions above which {@link #nlerpIterative(Quaternionfc, float, float)} performs another iteration of a small-step linear interpolation @param dest will hold the result @return dest """ dest.set(qs[0]); float w = weights[0]; for (int i = 1; i < qs.length; i++) { float w0 = w; float w1 = weights[i]; float rw1 = w1 / (w0 + w1); w += w1; dest.nlerpIterative(qs[i], rw1, dotThreshold); } return dest; }
java
public static Quaternionfc nlerpIterative(Quaternionf[] qs, float[] weights, float dotThreshold, Quaternionf dest) { dest.set(qs[0]); float w = weights[0]; for (int i = 1; i < qs.length; i++) { float w0 = w; float w1 = weights[i]; float rw1 = w1 / (w0 + w1); w += w1; dest.nlerpIterative(qs[i], rw1, dotThreshold); } return dest; }
[ "public", "static", "Quaternionfc", "nlerpIterative", "(", "Quaternionf", "[", "]", "qs", ",", "float", "[", "]", "weights", ",", "float", "dotThreshold", ",", "Quaternionf", "dest", ")", "{", "dest", ".", "set", "(", "qs", "[", "0", "]", ")", ";", "float", "w", "=", "weights", "[", "0", "]", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "qs", ".", "length", ";", "i", "++", ")", "{", "float", "w0", "=", "w", ";", "float", "w1", "=", "weights", "[", "i", "]", ";", "float", "rw1", "=", "w1", "/", "(", "w0", "+", "w1", ")", ";", "w", "+=", "w1", ";", "dest", ".", "nlerpIterative", "(", "qs", "[", "i", "]", ",", "rw1", ",", "dotThreshold", ")", ";", "}", "return", "dest", ";", "}" ]
Interpolate between all of the quaternions given in <code>qs</code> via iterative non-spherical linear interpolation using the specified interpolation factors <code>weights</code>, and store the result in <code>dest</code>. <p> This method will interpolate between each two successive quaternions via {@link #nlerpIterative(Quaternionfc, float, float)} using their relative interpolation weights. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions#answer-62356">http://gamedev.stackexchange.com/</a> @param qs the quaternions to interpolate over @param weights the weights of each individual quaternion in <code>qs</code> @param dotThreshold the threshold for the dot product of each two interpolated quaternions above which {@link #nlerpIterative(Quaternionfc, float, float)} performs another iteration of a small-step linear interpolation @param dest will hold the result @return dest
[ "Interpolate", "between", "all", "of", "the", "quaternions", "given", "in", "<code", ">", "qs<", "/", "code", ">", "via", "iterative", "non", "-", "spherical", "linear", "interpolation", "using", "the", "specified", "interpolation", "factors", "<code", ">", "weights<", "/", "code", ">", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "This", "method", "will", "interpolate", "between", "each", "two", "successive", "quaternions", "via", "{", "@link", "#nlerpIterative", "(", "Quaternionfc", "float", "float", ")", "}", "using", "their", "relative", "interpolation", "weights", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "gamedev", ".", "stackexchange", ".", "com", "/", "questions", "/", "62354", "/", "method", "-", "for", "-", "interpolation", "-", "between", "-", "3", "-", "quaternions#answer", "-", "62356", ">", "http", ":", "//", "gamedev", ".", "stackexchange", ".", "com", "/", "<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaternionf.java#L2056-L2067
GCRC/nunaliit
nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java
PathComputer.computeBinDir
static public File computeBinDir(File installDir) { """ Finds the "bin" directory from the installation location and returns it. If the command-line tool is packaged and deployed, then the "bin" directory is found at the root of the installation. If the command-line tool is run from the development environment, then the "bin" directory is found in the SDK sub-project. @param installDir Directory where the command-line tool is run from. @return Directory where binaries are located or null if not found. """ if( null != installDir ) { // Command-line package File binDir = new File(installDir, "bin"); if( binDir.exists() && binDir.isDirectory() ) { return binDir; } // Development environment File nunaliit2Dir = computeNunaliitDir(installDir); binDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/target/appassembler/bin"); if( binDir.exists() && binDir.isDirectory() ) { return binDir; } } return null; }
java
static public File computeBinDir(File installDir) { if( null != installDir ) { // Command-line package File binDir = new File(installDir, "bin"); if( binDir.exists() && binDir.isDirectory() ) { return binDir; } // Development environment File nunaliit2Dir = computeNunaliitDir(installDir); binDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/target/appassembler/bin"); if( binDir.exists() && binDir.isDirectory() ) { return binDir; } } return null; }
[ "static", "public", "File", "computeBinDir", "(", "File", "installDir", ")", "{", "if", "(", "null", "!=", "installDir", ")", "{", "// Command-line package", "File", "binDir", "=", "new", "File", "(", "installDir", ",", "\"bin\"", ")", ";", "if", "(", "binDir", ".", "exists", "(", ")", "&&", "binDir", ".", "isDirectory", "(", ")", ")", "{", "return", "binDir", ";", "}", "// Development environment", "File", "nunaliit2Dir", "=", "computeNunaliitDir", "(", "installDir", ")", ";", "binDir", "=", "new", "File", "(", "nunaliit2Dir", ",", "\"nunaliit2-couch-sdk/target/appassembler/bin\"", ")", ";", "if", "(", "binDir", ".", "exists", "(", ")", "&&", "binDir", ".", "isDirectory", "(", ")", ")", "{", "return", "binDir", ";", "}", "}", "return", "null", ";", "}" ]
Finds the "bin" directory from the installation location and returns it. If the command-line tool is packaged and deployed, then the "bin" directory is found at the root of the installation. If the command-line tool is run from the development environment, then the "bin" directory is found in the SDK sub-project. @param installDir Directory where the command-line tool is run from. @return Directory where binaries are located or null if not found.
[ "Finds", "the", "bin", "directory", "from", "the", "installation", "location", "and", "returns", "it", ".", "If", "the", "command", "-", "line", "tool", "is", "packaged", "and", "deployed", "then", "the", "bin", "directory", "is", "found", "at", "the", "root", "of", "the", "installation", ".", "If", "the", "command", "-", "line", "tool", "is", "run", "from", "the", "development", "environment", "then", "the", "bin", "directory", "is", "found", "in", "the", "SDK", "sub", "-", "project", "." ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L174-L191
hector-client/hector
core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java
HFactory.getOrCreateCluster
public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { """ Calls the three argument version with a null credentials map. {@link #getOrCreateCluster(String, me.prettyprint.cassandra.service.CassandraHostConfigurator, java.util.Map)} for details. """ return createCluster(clusterName, cassandraHostConfigurator, null); }
java
public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) { return createCluster(clusterName, cassandraHostConfigurator, null); }
[ "public", "static", "Cluster", "getOrCreateCluster", "(", "String", "clusterName", ",", "CassandraHostConfigurator", "cassandraHostConfigurator", ")", "{", "return", "createCluster", "(", "clusterName", ",", "cassandraHostConfigurator", ",", "null", ")", ";", "}" ]
Calls the three argument version with a null credentials map. {@link #getOrCreateCluster(String, me.prettyprint.cassandra.service.CassandraHostConfigurator, java.util.Map)} for details.
[ "Calls", "the", "three", "argument", "version", "with", "a", "null", "credentials", "map", ".", "{" ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java#L142-L145
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/dnd/CmsDNDHandler.java
CmsDNDHandler.showEndAnimation
private void showEndAnimation(Command callback, int top, int left, boolean isDrop) { """ Shows the end animation on drop or cancel. Executes the given callback afterwards.<p> @param callback the callback to execute @param top absolute top of the animation end position @param left absolute left of the animation end position @param isDrop if the animation is done on drop """ if (!isAnimationEnabled() || (m_dragHelper == null)) { callback.execute(); return; } switch (m_animationType) { case SPECIAL: List<Element> overlays = CmsDomUtil.getElementsByClass( I_CmsLayoutBundle.INSTANCE.generalCss().disablingOverlay(), m_draggable.getElement()); Element overlay = overlays.size() > 0 ? overlays.get(0) : null; m_currentAnimation = new SpecialAnimation( m_dragHelper, m_draggable.getElement(), overlay, callback, isDrop); break; case MOVE: Element parentElement = m_dragHelper.getParentElement(); int endTop = top - parentElement.getAbsoluteTop(); int endLeft = left - parentElement.getAbsoluteLeft(); int startTop = CmsDomUtil.getCurrentStyleInt(m_dragHelper, Style.top); int startLeft = CmsDomUtil.getCurrentStyleInt(m_dragHelper, Style.left); m_currentAnimation = new CmsMoveAnimation(m_dragHelper, startTop, startLeft, endTop, endLeft, callback); break; default: // nothing to do } m_currentAnimation.run(400); }
java
private void showEndAnimation(Command callback, int top, int left, boolean isDrop) { if (!isAnimationEnabled() || (m_dragHelper == null)) { callback.execute(); return; } switch (m_animationType) { case SPECIAL: List<Element> overlays = CmsDomUtil.getElementsByClass( I_CmsLayoutBundle.INSTANCE.generalCss().disablingOverlay(), m_draggable.getElement()); Element overlay = overlays.size() > 0 ? overlays.get(0) : null; m_currentAnimation = new SpecialAnimation( m_dragHelper, m_draggable.getElement(), overlay, callback, isDrop); break; case MOVE: Element parentElement = m_dragHelper.getParentElement(); int endTop = top - parentElement.getAbsoluteTop(); int endLeft = left - parentElement.getAbsoluteLeft(); int startTop = CmsDomUtil.getCurrentStyleInt(m_dragHelper, Style.top); int startLeft = CmsDomUtil.getCurrentStyleInt(m_dragHelper, Style.left); m_currentAnimation = new CmsMoveAnimation(m_dragHelper, startTop, startLeft, endTop, endLeft, callback); break; default: // nothing to do } m_currentAnimation.run(400); }
[ "private", "void", "showEndAnimation", "(", "Command", "callback", ",", "int", "top", ",", "int", "left", ",", "boolean", "isDrop", ")", "{", "if", "(", "!", "isAnimationEnabled", "(", ")", "||", "(", "m_dragHelper", "==", "null", ")", ")", "{", "callback", ".", "execute", "(", ")", ";", "return", ";", "}", "switch", "(", "m_animationType", ")", "{", "case", "SPECIAL", ":", "List", "<", "Element", ">", "overlays", "=", "CmsDomUtil", ".", "getElementsByClass", "(", "I_CmsLayoutBundle", ".", "INSTANCE", ".", "generalCss", "(", ")", ".", "disablingOverlay", "(", ")", ",", "m_draggable", ".", "getElement", "(", ")", ")", ";", "Element", "overlay", "=", "overlays", ".", "size", "(", ")", ">", "0", "?", "overlays", ".", "get", "(", "0", ")", ":", "null", ";", "m_currentAnimation", "=", "new", "SpecialAnimation", "(", "m_dragHelper", ",", "m_draggable", ".", "getElement", "(", ")", ",", "overlay", ",", "callback", ",", "isDrop", ")", ";", "break", ";", "case", "MOVE", ":", "Element", "parentElement", "=", "m_dragHelper", ".", "getParentElement", "(", ")", ";", "int", "endTop", "=", "top", "-", "parentElement", ".", "getAbsoluteTop", "(", ")", ";", "int", "endLeft", "=", "left", "-", "parentElement", ".", "getAbsoluteLeft", "(", ")", ";", "int", "startTop", "=", "CmsDomUtil", ".", "getCurrentStyleInt", "(", "m_dragHelper", ",", "Style", ".", "top", ")", ";", "int", "startLeft", "=", "CmsDomUtil", ".", "getCurrentStyleInt", "(", "m_dragHelper", ",", "Style", ".", "left", ")", ";", "m_currentAnimation", "=", "new", "CmsMoveAnimation", "(", "m_dragHelper", ",", "startTop", ",", "startLeft", ",", "endTop", ",", "endLeft", ",", "callback", ")", ";", "break", ";", "default", ":", "// nothing to do", "}", "m_currentAnimation", ".", "run", "(", "400", ")", ";", "}" ]
Shows the end animation on drop or cancel. Executes the given callback afterwards.<p> @param callback the callback to execute @param top absolute top of the animation end position @param left absolute left of the animation end position @param isDrop if the animation is done on drop
[ "Shows", "the", "end", "animation", "on", "drop", "or", "cancel", ".", "Executes", "the", "given", "callback", "afterwards", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/dnd/CmsDNDHandler.java#L1097-L1131
Coveros/selenified
src/main/java/com/coveros/selenified/element/Element.java
Element.isNotEnabled
private boolean isNotEnabled(String action, String expected, String extra) { """ Determines if the element is displayed. If it isn't, it'll wait up to the default time (5 seconds) for the element to be displayed @param action - what action is occurring @param expected - what is the expected result @param extra - what actually is occurring @return Boolean: is the element enabled? """ // wait for element to be displayed if (!is.enabled()) { waitForState.enabled(); } if (!is.enabled()) { reporter.fail(action, expected, extra + prettyOutput() + NOT_ENABLED); // indicates element not enabled return true; } return false; }
java
private boolean isNotEnabled(String action, String expected, String extra) { // wait for element to be displayed if (!is.enabled()) { waitForState.enabled(); } if (!is.enabled()) { reporter.fail(action, expected, extra + prettyOutput() + NOT_ENABLED); // indicates element not enabled return true; } return false; }
[ "private", "boolean", "isNotEnabled", "(", "String", "action", ",", "String", "expected", ",", "String", "extra", ")", "{", "// wait for element to be displayed", "if", "(", "!", "is", ".", "enabled", "(", ")", ")", "{", "waitForState", ".", "enabled", "(", ")", ";", "}", "if", "(", "!", "is", ".", "enabled", "(", ")", ")", "{", "reporter", ".", "fail", "(", "action", ",", "expected", ",", "extra", "+", "prettyOutput", "(", ")", "+", "NOT_ENABLED", ")", ";", "// indicates element not enabled", "return", "true", ";", "}", "return", "false", ";", "}" ]
Determines if the element is displayed. If it isn't, it'll wait up to the default time (5 seconds) for the element to be displayed @param action - what action is occurring @param expected - what is the expected result @param extra - what actually is occurring @return Boolean: is the element enabled?
[ "Determines", "if", "the", "element", "is", "displayed", ".", "If", "it", "isn", "t", "it", "ll", "wait", "up", "to", "the", "default", "time", "(", "5", "seconds", ")", "for", "the", "element", "to", "be", "displayed" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L637-L648
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java
NamespaceMappings.pushNamespace
public boolean pushNamespace(String prefix, String uri, int elemDepth) { """ Declare a mapping of a prefix to namespace URI at the given element depth. @param prefix a String with the prefix for a qualified name @param uri a String with the uri to which the prefix is to map @param elemDepth the depth of current declaration """ // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; // Get the stack that contains URIs for the specified prefix if ((stack = (Stack) m_namespaces.get(prefix)) == null) { m_namespaces.put(prefix, stack = new Stack()); } if (!stack.empty()) { MappingRecord mr = (MappingRecord)stack.peek(); if (uri.equals(mr.m_uri) || elemDepth == mr.m_declarationDepth) { // If the same prefix/uri mapping is already on the stack // don't push this one. // Or if we have a mapping at the same depth // don't replace by pushing this one. return false; } } MappingRecord map = new MappingRecord(prefix,uri,elemDepth); stack.push(map); m_nodeStack.push(map); return true; }
java
public boolean pushNamespace(String prefix, String uri, int elemDepth) { // Prefixes "xml" and "xmlns" cannot be redefined if (prefix.startsWith(XML_PREFIX)) { return false; } Stack stack; // Get the stack that contains URIs for the specified prefix if ((stack = (Stack) m_namespaces.get(prefix)) == null) { m_namespaces.put(prefix, stack = new Stack()); } if (!stack.empty()) { MappingRecord mr = (MappingRecord)stack.peek(); if (uri.equals(mr.m_uri) || elemDepth == mr.m_declarationDepth) { // If the same prefix/uri mapping is already on the stack // don't push this one. // Or if we have a mapping at the same depth // don't replace by pushing this one. return false; } } MappingRecord map = new MappingRecord(prefix,uri,elemDepth); stack.push(map); m_nodeStack.push(map); return true; }
[ "public", "boolean", "pushNamespace", "(", "String", "prefix", ",", "String", "uri", ",", "int", "elemDepth", ")", "{", "// Prefixes \"xml\" and \"xmlns\" cannot be redefined", "if", "(", "prefix", ".", "startsWith", "(", "XML_PREFIX", ")", ")", "{", "return", "false", ";", "}", "Stack", "stack", ";", "// Get the stack that contains URIs for the specified prefix", "if", "(", "(", "stack", "=", "(", "Stack", ")", "m_namespaces", ".", "get", "(", "prefix", ")", ")", "==", "null", ")", "{", "m_namespaces", ".", "put", "(", "prefix", ",", "stack", "=", "new", "Stack", "(", ")", ")", ";", "}", "if", "(", "!", "stack", ".", "empty", "(", ")", ")", "{", "MappingRecord", "mr", "=", "(", "MappingRecord", ")", "stack", ".", "peek", "(", ")", ";", "if", "(", "uri", ".", "equals", "(", "mr", ".", "m_uri", ")", "||", "elemDepth", "==", "mr", ".", "m_declarationDepth", ")", "{", "// If the same prefix/uri mapping is already on the stack", "// don't push this one.", "// Or if we have a mapping at the same depth", "// don't replace by pushing this one.", "return", "false", ";", "}", "}", "MappingRecord", "map", "=", "new", "MappingRecord", "(", "prefix", ",", "uri", ",", "elemDepth", ")", ";", "stack", ".", "push", "(", "map", ")", ";", "m_nodeStack", ".", "push", "(", "map", ")", ";", "return", "true", ";", "}" ]
Declare a mapping of a prefix to namespace URI at the given element depth. @param prefix a String with the prefix for a qualified name @param uri a String with the uri to which the prefix is to map @param elemDepth the depth of current declaration
[ "Declare", "a", "mapping", "of", "a", "prefix", "to", "namespace", "URI", "at", "the", "given", "element", "depth", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/NamespaceMappings.java#L225-L255
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java
RandomUtil.randomLowerMaxLength
public String randomLowerMaxLength(int minLength, int maxLength) { """ Creates a random string consisting of lowercase letters. @param minLength minimum length of String to create. @param maxLength maximum length (non inclusive) of String to create. @return lowercase letters. """ int range = maxLength - minLength; int randomLength = 0; if (range > 0) { randomLength = random(range); } return randomLower(minLength + randomLength); }
java
public String randomLowerMaxLength(int minLength, int maxLength) { int range = maxLength - minLength; int randomLength = 0; if (range > 0) { randomLength = random(range); } return randomLower(minLength + randomLength); }
[ "public", "String", "randomLowerMaxLength", "(", "int", "minLength", ",", "int", "maxLength", ")", "{", "int", "range", "=", "maxLength", "-", "minLength", ";", "int", "randomLength", "=", "0", ";", "if", "(", "range", ">", "0", ")", "{", "randomLength", "=", "random", "(", "range", ")", ";", "}", "return", "randomLower", "(", "minLength", "+", "randomLength", ")", ";", "}" ]
Creates a random string consisting of lowercase letters. @param minLength minimum length of String to create. @param maxLength maximum length (non inclusive) of String to create. @return lowercase letters.
[ "Creates", "a", "random", "string", "consisting", "of", "lowercase", "letters", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/RandomUtil.java#L26-L33
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java
ResourceCache.wrapCallback
public static BitmapTextureCallback wrapCallback( ResourceCache<GVRImage> cache, BitmapTextureCallback callback) { """ Wrap the callback, to cache the {@link BitmapTextureCallback#loaded(GVRHybridObject, GVRAndroidResource) loaded()} resource """ return new BitmapTextureCallbackWrapper(cache, callback); }
java
public static BitmapTextureCallback wrapCallback( ResourceCache<GVRImage> cache, BitmapTextureCallback callback) { return new BitmapTextureCallbackWrapper(cache, callback); }
[ "public", "static", "BitmapTextureCallback", "wrapCallback", "(", "ResourceCache", "<", "GVRImage", ">", "cache", ",", "BitmapTextureCallback", "callback", ")", "{", "return", "new", "BitmapTextureCallbackWrapper", "(", "cache", ",", "callback", ")", ";", "}" ]
Wrap the callback, to cache the {@link BitmapTextureCallback#loaded(GVRHybridObject, GVRAndroidResource) loaded()} resource
[ "Wrap", "the", "callback", "to", "cache", "the", "{" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/ResourceCache.java#L87-L90
nikhaldi/android-view-selector
src/main/java/com/nikhaldimann/viewselector/attributes/ViewAttributes.java
ViewAttributes.callGetterNormalizingStrings
public static Object callGetterNormalizingStrings(View view, String methodName) { """ Calls the given method by name on the given view, assuming that it's a getter, i.e., it doesn't have arguments. This method normalizes all instances of CharSequences to be instances of String. This is useful because Android is using some CharSequence representations internally that don't compare well with strings (in particular as returned from TextView.getText()). @return the result of the method call @throws AttributeAccessException when the method doesn't exist or can't be called for various reasons """ Object value = callGetter(view, methodName); if (value instanceof CharSequence) { value = value.toString(); } return value; }
java
public static Object callGetterNormalizingStrings(View view, String methodName) { Object value = callGetter(view, methodName); if (value instanceof CharSequence) { value = value.toString(); } return value; }
[ "public", "static", "Object", "callGetterNormalizingStrings", "(", "View", "view", ",", "String", "methodName", ")", "{", "Object", "value", "=", "callGetter", "(", "view", ",", "methodName", ")", ";", "if", "(", "value", "instanceof", "CharSequence", ")", "{", "value", "=", "value", ".", "toString", "(", ")", ";", "}", "return", "value", ";", "}" ]
Calls the given method by name on the given view, assuming that it's a getter, i.e., it doesn't have arguments. This method normalizes all instances of CharSequences to be instances of String. This is useful because Android is using some CharSequence representations internally that don't compare well with strings (in particular as returned from TextView.getText()). @return the result of the method call @throws AttributeAccessException when the method doesn't exist or can't be called for various reasons
[ "Calls", "the", "given", "method", "by", "name", "on", "the", "given", "view", "assuming", "that", "it", "s", "a", "getter", "i", ".", "e", ".", "it", "doesn", "t", "have", "arguments", "." ]
train
https://github.com/nikhaldi/android-view-selector/blob/d3e4bf05f6111d116c6b0c1a8c51396e8bfae9b5/src/main/java/com/nikhaldimann/viewselector/attributes/ViewAttributes.java#L69-L75
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Table.java
Table.withParameters
public Table withParameters(java.util.Map<String, String> parameters) { """ <p> These key-value pairs define properties associated with the table. </p> @param parameters These key-value pairs define properties associated with the table. @return Returns a reference to this object so that method calls can be chained together. """ setParameters(parameters); return this; }
java
public Table withParameters(java.util.Map<String, String> parameters) { setParameters(parameters); return this; }
[ "public", "Table", "withParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "setParameters", "(", "parameters", ")", ";", "return", "this", ";", "}" ]
<p> These key-value pairs define properties associated with the table. </p> @param parameters These key-value pairs define properties associated with the table. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "These", "key", "-", "value", "pairs", "define", "properties", "associated", "with", "the", "table", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/Table.java#L822-L825