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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
jtrfp/javamod
src/main/java/de/quippy/javamod/main/gui/MainForm.java
MainForm.createFileFilter
private void createFileFilter() { """ Create the file filters so that we do have them for the dialogs @since 05.01.2008 """ HashMap<String, String[]> extensionMap = MultimediaContainerManager.getSupportedFileExtensionsPerContainer(); ArrayList<FileFilter> chooserFilterArray = new ArrayList<FileFilter>(extensionMap.size() + 1); // add all single file extensions grouped by container Set<String> containerNameSet = extensionMap.keySet(); Iterator<String> containerNameIterator = containerNameSet.iterator(); while (containerNameIterator.hasNext()) { String containerName = containerNameIterator.next(); String [] extensions = extensionMap.get(containerName); StringBuilder fileText = new StringBuilder(containerName); fileText.append(" ("); int ende = extensions.length-1; for (int i=0; i<=ende; i++) { fileText.append("*.").append(extensions[i]); if (i<ende) fileText.append(", "); } fileText.append(')'); chooserFilterArray.add(new FileChooserFilter(extensions, fileText.toString())); } // now add playlist as group of files chooserFilterArray.add(PlayList.PLAYLIST_FILE_FILTER); // now add all playable files at the last step (container extensions and playlist files) String [] containerExtensions = MultimediaContainerManager.getSupportedFileExtensions(); String [] fullSupportedExtensions = new String[containerExtensions.length + PlayList.SUPPORTEDPLAYLISTS.length]; System.arraycopy(PlayList.SUPPORTEDPLAYLISTS, 0, fullSupportedExtensions, 0, PlayList.SUPPORTEDPLAYLISTS.length); System.arraycopy(containerExtensions, 0, fullSupportedExtensions, PlayList.SUPPORTEDPLAYLISTS.length, containerExtensions.length); chooserFilterArray.add(new FileChooserFilter(fullSupportedExtensions, "All playable files")); // add default "all files" - WE DO NOT DO THAT ANYMORE ;) // chooserFilterArray.add(new FileChooserFilter("*", "All files")); fileFilterLoad = new FileFilter[chooserFilterArray.size()]; chooserFilterArray.toArray(fileFilterLoad); fileFilterExport = new FileFilter[1]; fileFilterExport[0] = new FileChooserFilter(javax.sound.sampled.AudioFileFormat.Type.WAVE.getExtension(), javax.sound.sampled.AudioFileFormat.Type.WAVE.toString()); }
java
private void createFileFilter() { HashMap<String, String[]> extensionMap = MultimediaContainerManager.getSupportedFileExtensionsPerContainer(); ArrayList<FileFilter> chooserFilterArray = new ArrayList<FileFilter>(extensionMap.size() + 1); // add all single file extensions grouped by container Set<String> containerNameSet = extensionMap.keySet(); Iterator<String> containerNameIterator = containerNameSet.iterator(); while (containerNameIterator.hasNext()) { String containerName = containerNameIterator.next(); String [] extensions = extensionMap.get(containerName); StringBuilder fileText = new StringBuilder(containerName); fileText.append(" ("); int ende = extensions.length-1; for (int i=0; i<=ende; i++) { fileText.append("*.").append(extensions[i]); if (i<ende) fileText.append(", "); } fileText.append(')'); chooserFilterArray.add(new FileChooserFilter(extensions, fileText.toString())); } // now add playlist as group of files chooserFilterArray.add(PlayList.PLAYLIST_FILE_FILTER); // now add all playable files at the last step (container extensions and playlist files) String [] containerExtensions = MultimediaContainerManager.getSupportedFileExtensions(); String [] fullSupportedExtensions = new String[containerExtensions.length + PlayList.SUPPORTEDPLAYLISTS.length]; System.arraycopy(PlayList.SUPPORTEDPLAYLISTS, 0, fullSupportedExtensions, 0, PlayList.SUPPORTEDPLAYLISTS.length); System.arraycopy(containerExtensions, 0, fullSupportedExtensions, PlayList.SUPPORTEDPLAYLISTS.length, containerExtensions.length); chooserFilterArray.add(new FileChooserFilter(fullSupportedExtensions, "All playable files")); // add default "all files" - WE DO NOT DO THAT ANYMORE ;) // chooserFilterArray.add(new FileChooserFilter("*", "All files")); fileFilterLoad = new FileFilter[chooserFilterArray.size()]; chooserFilterArray.toArray(fileFilterLoad); fileFilterExport = new FileFilter[1]; fileFilterExport[0] = new FileChooserFilter(javax.sound.sampled.AudioFileFormat.Type.WAVE.getExtension(), javax.sound.sampled.AudioFileFormat.Type.WAVE.toString()); }
[ "private", "void", "createFileFilter", "(", ")", "{", "HashMap", "<", "String", ",", "String", "[", "]", ">", "extensionMap", "=", "MultimediaContainerManager", ".", "getSupportedFileExtensionsPerContainer", "(", ")", ";", "ArrayList", "<", "FileFilter", ">", "cho...
Create the file filters so that we do have them for the dialogs @since 05.01.2008
[ "Create", "the", "file", "filters", "so", "that", "we", "do", "have", "them", "for", "the", "dialogs" ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/main/gui/MainForm.java#L548-L589
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/responder/responderpolicy_stats.java
responderpolicy_stats.get
public static responderpolicy_stats get(nitro_service service, String name) throws Exception { """ Use this API to fetch statistics of responderpolicy_stats resource of given name . """ responderpolicy_stats obj = new responderpolicy_stats(); obj.set_name(name); responderpolicy_stats response = (responderpolicy_stats) obj.stat_resource(service); return response; }
java
public static responderpolicy_stats get(nitro_service service, String name) throws Exception{ responderpolicy_stats obj = new responderpolicy_stats(); obj.set_name(name); responderpolicy_stats response = (responderpolicy_stats) obj.stat_resource(service); return response; }
[ "public", "static", "responderpolicy_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "responderpolicy_stats", "obj", "=", "new", "responderpolicy_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ...
Use this API to fetch statistics of responderpolicy_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "responderpolicy_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/responder/responderpolicy_stats.java#L169-L174
kiswanij/jk-util
src/main/java/com/jk/util/JKDateTimeUtil.java
JKDateTimeUtil.getMinutesDifference
public static long getMinutesDifference(Date startDate, Date endDate) { """ Gets the minutes difference. @param startDate the start date @param endDate the end date @return the minutes difference """ long startTime = startDate.getTime(); long endTime = endDate.getTime(); long diffTime = endTime - startTime; long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(diffTime); return diffInMinutes; }
java
public static long getMinutesDifference(Date startDate, Date endDate) { long startTime = startDate.getTime(); long endTime = endDate.getTime(); long diffTime = endTime - startTime; long diffInMinutes = TimeUnit.MILLISECONDS.toMinutes(diffTime); return diffInMinutes; }
[ "public", "static", "long", "getMinutesDifference", "(", "Date", "startDate", ",", "Date", "endDate", ")", "{", "long", "startTime", "=", "startDate", ".", "getTime", "(", ")", ";", "long", "endTime", "=", "endDate", ".", "getTime", "(", ")", ";", "long", ...
Gets the minutes difference. @param startDate the start date @param endDate the end date @return the minutes difference
[ "Gets", "the", "minutes", "difference", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L486-L492
jpmml/jpmml-evaluator
pmml-evaluator/src/main/java/org/jpmml/evaluator/FunctionRegistry.java
FunctionRegistry.putFunction
static public void putFunction(String name, Function function) { """ <p> Registers a function by a name other than its default name. </p> """ FunctionRegistry.functions.put(Objects.requireNonNull(name), function); }
java
static public void putFunction(String name, Function function){ FunctionRegistry.functions.put(Objects.requireNonNull(name), function); }
[ "static", "public", "void", "putFunction", "(", "String", "name", ",", "Function", "function", ")", "{", "FunctionRegistry", ".", "functions", ".", "put", "(", "Objects", ".", "requireNonNull", "(", "name", ")", ",", "function", ")", ";", "}" ]
<p> Registers a function by a name other than its default name. </p>
[ "<p", ">", "Registers", "a", "function", "by", "a", "name", "other", "than", "its", "default", "name", ".", "<", "/", "p", ">" ]
train
https://github.com/jpmml/jpmml-evaluator/blob/ac8a48775877b6fa9dbc5f259871f3278489cc61/pmml-evaluator/src/main/java/org/jpmml/evaluator/FunctionRegistry.java#L101-L104
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java
PrimitiveUtils.readDouble
public static Double readDouble(String value, Double defaultValue) { """ Read double. @param value the value @param defaultValue the default value @return the double """ if (!StringUtils.hasText(value)) return defaultValue; return Double.valueOf(value); }
java
public static Double readDouble(String value, Double defaultValue) { if (!StringUtils.hasText(value)) return defaultValue; return Double.valueOf(value); }
[ "public", "static", "Double", "readDouble", "(", "String", "value", ",", "Double", "defaultValue", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "value", ")", ")", "return", "defaultValue", ";", "return", "Double", ".", "valueOf", "(", "val...
Read double. @param value the value @param defaultValue the default value @return the double
[ "Read", "double", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java#L200-L204
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/TransformXMLInterceptor.java
TransformXMLInterceptor.initTemplates
private static Templates initTemplates() { """ Statically initialize the XSLT templates that are cached for all future transforms. @return the XSLT Templates. """ try { URL xsltURL = ThemeUtil.class.getResource(RESOURCE_NAME); if (xsltURL != null) { Source xsltSource = new StreamSource(xsltURL.openStream(), xsltURL.toExternalForm()); TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl(); Templates templates = factory.newTemplates(xsltSource); LOG.debug("Generated XSLT templates for: " + RESOURCE_NAME); return templates; } else { // Server-side XSLT enabled but theme resource not on classpath. throw new IllegalStateException(RESOURCE_NAME + " not on classpath"); } } catch (IOException | TransformerConfigurationException ex) { throw new SystemException("Could not create transformer for " + RESOURCE_NAME, ex); } }
java
private static Templates initTemplates() { try { URL xsltURL = ThemeUtil.class.getResource(RESOURCE_NAME); if (xsltURL != null) { Source xsltSource = new StreamSource(xsltURL.openStream(), xsltURL.toExternalForm()); TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl(); Templates templates = factory.newTemplates(xsltSource); LOG.debug("Generated XSLT templates for: " + RESOURCE_NAME); return templates; } else { // Server-side XSLT enabled but theme resource not on classpath. throw new IllegalStateException(RESOURCE_NAME + " not on classpath"); } } catch (IOException | TransformerConfigurationException ex) { throw new SystemException("Could not create transformer for " + RESOURCE_NAME, ex); } }
[ "private", "static", "Templates", "initTemplates", "(", ")", "{", "try", "{", "URL", "xsltURL", "=", "ThemeUtil", ".", "class", ".", "getResource", "(", "RESOURCE_NAME", ")", ";", "if", "(", "xsltURL", "!=", "null", ")", "{", "Source", "xsltSource", "=", ...
Statically initialize the XSLT templates that are cached for all future transforms. @return the XSLT Templates.
[ "Statically", "initialize", "the", "XSLT", "templates", "that", "are", "cached", "for", "all", "future", "transforms", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/container/TransformXMLInterceptor.java#L221-L237
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/util/MathUtilities.java
MathUtilities.percentFrom
public static String percentFrom(final double a, final double b) { """ Returns the result of (a / b) as a percentage string @param a value a @param b value b @return xx.xx% """ double bVal = b; if (bVal == 0.) { bVal = 1.; } StringBuilder rep = new StringBuilder(); double d = ((long) ((a / bVal) * 10000) / 100.); if (d < 10.0) { rep.append('0'); } rep.append(d); while (rep.length() < 5) { rep.append('0'); } return rep + "%"; }
java
public static String percentFrom(final double a, final double b) { double bVal = b; if (bVal == 0.) { bVal = 1.; } StringBuilder rep = new StringBuilder(); double d = ((long) ((a / bVal) * 10000) / 100.); if (d < 10.0) { rep.append('0'); } rep.append(d); while (rep.length() < 5) { rep.append('0'); } return rep + "%"; }
[ "public", "static", "String", "percentFrom", "(", "final", "double", "a", ",", "final", "double", "b", ")", "{", "double", "bVal", "=", "b", ";", "if", "(", "bVal", "==", "0.", ")", "{", "bVal", "=", "1.", ";", "}", "StringBuilder", "rep", "=", "ne...
Returns the result of (a / b) as a percentage string @param a value a @param b value b @return xx.xx%
[ "Returns", "the", "result", "of", "(", "a", "/", "b", ")", "as", "a", "percentage", "string" ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/util/MathUtilities.java#L99-L120
hpsa/hpe-application-automation-tools-plugin
src/main/java/com/hp/application/automation/tools/results/RunResultRecorder.java
RunResultRecorder.getUniqueZipFileNameInFolder
private String getUniqueZipFileNameInFolder(ArrayList<String> names, String fileName) throws IOException, InterruptedException { """ /* if we have a directory with file name "file.zip" we will return "file_1.zip" """ String result = fileName + "_Report.zip"; int index = 0; while (names.indexOf(result) > -1) { result = fileName + "_" + (++index) + "_Report.zip"; } return result; }
java
private String getUniqueZipFileNameInFolder(ArrayList<String> names, String fileName) throws IOException, InterruptedException { String result = fileName + "_Report.zip"; int index = 0; while (names.indexOf(result) > -1) { result = fileName + "_" + (++index) + "_Report.zip"; } return result; }
[ "private", "String", "getUniqueZipFileNameInFolder", "(", "ArrayList", "<", "String", ">", "names", ",", "String", "fileName", ")", "throws", "IOException", ",", "InterruptedException", "{", "String", "result", "=", "fileName", "+", "\"_Report.zip\"", ";", "int", ...
/* if we have a directory with file name "file.zip" we will return "file_1.zip"
[ "/", "*", "if", "we", "have", "a", "directory", "with", "file", "name", "file", ".", "zip", "we", "will", "return", "file_1", ".", "zip" ]
train
https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/results/RunResultRecorder.java#L956-L968
apache/groovy
src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
ClassNodeUtils.addGeneratedMethod
public static void addGeneratedMethod(ClassNode cNode, MethodNode mNode) { """ Add a method that is marked as @Generated. @see ClassNode#addMethod(MethodNode) """ cNode.addMethod(mNode); markAsGenerated(cNode, mNode); }
java
public static void addGeneratedMethod(ClassNode cNode, MethodNode mNode) { cNode.addMethod(mNode); markAsGenerated(cNode, mNode); }
[ "public", "static", "void", "addGeneratedMethod", "(", "ClassNode", "cNode", ",", "MethodNode", "mNode", ")", "{", "cNode", ".", "addMethod", "(", "mNode", ")", ";", "markAsGenerated", "(", "cNode", ",", "mNode", ")", ";", "}" ]
Add a method that is marked as @Generated. @see ClassNode#addMethod(MethodNode)
[ "Add", "a", "method", "that", "is", "marked", "as", "@Generated", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L101-L104
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/ops/ConvertMatrixData.java
ConvertMatrixData.convert
public static void convert(DMatrix input , FMatrix output ) { """ Generic, but slow, conversion function. @param input Input matrix. @param output Output matrix. """ if( input.getNumRows() != output.getNumRows() ) throw new IllegalArgumentException("Number of rows do not match"); if( input.getNumCols() != output.getNumCols() ) throw new IllegalArgumentException("Number of columns do not match"); for( int i = 0; i < input.getNumRows(); i++ ) { for( int j = 0; j < input.getNumCols(); j++ ) { output.unsafe_set(i,j, (float)input.unsafe_get(i,j)); } } }
java
public static void convert(DMatrix input , FMatrix output ) { if( input.getNumRows() != output.getNumRows() ) throw new IllegalArgumentException("Number of rows do not match"); if( input.getNumCols() != output.getNumCols() ) throw new IllegalArgumentException("Number of columns do not match"); for( int i = 0; i < input.getNumRows(); i++ ) { for( int j = 0; j < input.getNumCols(); j++ ) { output.unsafe_set(i,j, (float)input.unsafe_get(i,j)); } } }
[ "public", "static", "void", "convert", "(", "DMatrix", "input", ",", "FMatrix", "output", ")", "{", "if", "(", "input", ".", "getNumRows", "(", ")", "!=", "output", ".", "getNumRows", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Numbe...
Generic, but slow, conversion function. @param input Input matrix. @param output Output matrix.
[ "Generic", "but", "slow", "conversion", "function", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ConvertMatrixData.java#L35-L46
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java
FieldListener.syncClonedListener
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { """ Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init. """ if (!bInitCalled) listener.init(null); listener.setRespondsToMode(DBConstants.INIT_MOVE, m_bInitMove); listener.setRespondsToMode(DBConstants.READ_MOVE, m_bReadMove); listener.setRespondsToMode(DBConstants.SCREEN_MOVE, m_bScreenMove); return true; }
java
public boolean syncClonedListener(BaseField field, FieldListener listener, boolean bInitCalled) { if (!bInitCalled) listener.init(null); listener.setRespondsToMode(DBConstants.INIT_MOVE, m_bInitMove); listener.setRespondsToMode(DBConstants.READ_MOVE, m_bReadMove); listener.setRespondsToMode(DBConstants.SCREEN_MOVE, m_bScreenMove); return true; }
[ "public", "boolean", "syncClonedListener", "(", "BaseField", "field", ",", "FieldListener", "listener", ",", "boolean", "bInitCalled", ")", "{", "if", "(", "!", "bInitCalled", ")", "listener", ".", "init", "(", "null", ")", ";", "listener", ".", "setRespondsTo...
Set this cloned listener to the same state at this listener. @param field The field this new listener will be added to. @param The new listener to sync to this. @param Has the init method been called? @return True if I called init.
[ "Set", "this", "cloned", "listener", "to", "the", "same", "state", "at", "this", "listener", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java#L117-L125
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/SVMLightClassifier.java
SVMLightClassifier.logProbabilityOf
@Override public Counter<L> logProbabilityOf(Datum<L, F> example) { """ Returns a counter for the log probability of each of the classes looking at the the sum of e^v for each count v, should be 1 Note: Uses SloppyMath.logSum which isn't exact but isn't as offensively slow as doing a series of exponentials """ if (platt == null) { throw new UnsupportedOperationException("If you want to ask for the probability, you must train a Platt model!"); } Counter<L> scores = scoresOf(example); scores.incrementCount(null); Counter<L> probs = platt.logProbabilityOf(new RVFDatum<L, L>(scores)); //System.out.println(scores+" "+probs); return probs; }
java
@Override public Counter<L> logProbabilityOf(Datum<L, F> example) { if (platt == null) { throw new UnsupportedOperationException("If you want to ask for the probability, you must train a Platt model!"); } Counter<L> scores = scoresOf(example); scores.incrementCount(null); Counter<L> probs = platt.logProbabilityOf(new RVFDatum<L, L>(scores)); //System.out.println(scores+" "+probs); return probs; }
[ "@", "Override", "public", "Counter", "<", "L", ">", "logProbabilityOf", "(", "Datum", "<", "L", ",", "F", ">", "example", ")", "{", "if", "(", "platt", "==", "null", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"If you want to ask for t...
Returns a counter for the log probability of each of the classes looking at the the sum of e^v for each count v, should be 1 Note: Uses SloppyMath.logSum which isn't exact but isn't as offensively slow as doing a series of exponentials
[ "Returns", "a", "counter", "for", "the", "log", "probability", "of", "each", "of", "the", "classes", "looking", "at", "the", "the", "sum", "of", "e^v", "for", "each", "count", "v", "should", "be", "1", "Note", ":", "Uses", "SloppyMath", ".", "logSum", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/SVMLightClassifier.java#L45-L55
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java
MavenModelScannerPlugin.createMavenPomDescriptor
protected MavenPomDescriptor createMavenPomDescriptor(Model model, Scanner scanner) { """ Create the descriptor and set base information. @param model The model. @param scanner The scanner. @return The descriptor. """ ScannerContext context = scanner.getContext(); MavenPomDescriptor pomDescriptor = context.peek(MavenPomDescriptor.class); if (model instanceof EffectiveModel) { context.getStore().addDescriptorType(pomDescriptor, EffectiveDescriptor.class); } pomDescriptor.setName(model.getName()); pomDescriptor.setGroupId(model.getGroupId()); pomDescriptor.setArtifactId(model.getArtifactId()); pomDescriptor.setPackaging(model.getPackaging()); pomDescriptor.setVersion(model.getVersion()); pomDescriptor.setUrl(model.getUrl()); Coordinates artifactCoordinates = new ModelCoordinates(model); MavenArtifactDescriptor artifact = getArtifactResolver(context).resolve(artifactCoordinates, context); pomDescriptor.getDescribes().add(artifact); return pomDescriptor; }
java
protected MavenPomDescriptor createMavenPomDescriptor(Model model, Scanner scanner) { ScannerContext context = scanner.getContext(); MavenPomDescriptor pomDescriptor = context.peek(MavenPomDescriptor.class); if (model instanceof EffectiveModel) { context.getStore().addDescriptorType(pomDescriptor, EffectiveDescriptor.class); } pomDescriptor.setName(model.getName()); pomDescriptor.setGroupId(model.getGroupId()); pomDescriptor.setArtifactId(model.getArtifactId()); pomDescriptor.setPackaging(model.getPackaging()); pomDescriptor.setVersion(model.getVersion()); pomDescriptor.setUrl(model.getUrl()); Coordinates artifactCoordinates = new ModelCoordinates(model); MavenArtifactDescriptor artifact = getArtifactResolver(context).resolve(artifactCoordinates, context); pomDescriptor.getDescribes().add(artifact); return pomDescriptor; }
[ "protected", "MavenPomDescriptor", "createMavenPomDescriptor", "(", "Model", "model", ",", "Scanner", "scanner", ")", "{", "ScannerContext", "context", "=", "scanner", ".", "getContext", "(", ")", ";", "MavenPomDescriptor", "pomDescriptor", "=", "context", ".", "pee...
Create the descriptor and set base information. @param model The model. @param scanner The scanner. @return The descriptor.
[ "Create", "the", "descriptor", "and", "set", "base", "information", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L146-L162
leadware/jpersistence-tools
jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java
RestrictionsContainer.addNotLike
public RestrictionsContainer addNotLike(String property, String value) { """ Methode d'ajout de la restriction NotLike @param property Nom de la Propriete @param value Valeur de la propriete @return Conteneur """ // Ajout de la restriction restrictions.add(new NotLike(property, value)); // On retourne le conteneur return this; }
java
public RestrictionsContainer addNotLike(String property, String value) { // Ajout de la restriction restrictions.add(new NotLike(property, value)); // On retourne le conteneur return this; }
[ "public", "RestrictionsContainer", "addNotLike", "(", "String", "property", ",", "String", "value", ")", "{", "// Ajout de la restriction\r", "restrictions", ".", "add", "(", "new", "NotLike", "(", "property", ",", "value", ")", ")", ";", "// On retourne le conteneu...
Methode d'ajout de la restriction NotLike @param property Nom de la Propriete @param value Valeur de la propriete @return Conteneur
[ "Methode", "d", "ajout", "de", "la", "restriction", "NotLike" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L183-L190
landawn/AbacusUtil
src/com/landawn/abacus/util/Multimap.java
Multimap.computeIfAbsent
public <X extends Exception> V computeIfAbsent(K key, Try.Function<? super K, ? extends V, X> mappingFunction) throws X { """ The implementation is equivalent to performing the following steps for this Multimap: <pre> final V oldValue = get(key); if (N.notNullOrEmpty(oldValue)) { return oldValue; } final V newValue = mappingFunction.apply(key); if (N.notNullOrEmpty(newValue)) { valueMap.put(key, newValue); } return newValue; </pre> @param key @param mappingFunction @return """ N.checkArgNotNull(mappingFunction); final V oldValue = get(key); if (N.notNullOrEmpty(oldValue)) { return oldValue; } final V newValue = mappingFunction.apply(key); if (N.notNullOrEmpty(newValue)) { valueMap.put(key, newValue); } return newValue; }
java
public <X extends Exception> V computeIfAbsent(K key, Try.Function<? super K, ? extends V, X> mappingFunction) throws X { N.checkArgNotNull(mappingFunction); final V oldValue = get(key); if (N.notNullOrEmpty(oldValue)) { return oldValue; } final V newValue = mappingFunction.apply(key); if (N.notNullOrEmpty(newValue)) { valueMap.put(key, newValue); } return newValue; }
[ "public", "<", "X", "extends", "Exception", ">", "V", "computeIfAbsent", "(", "K", "key", ",", "Try", ".", "Function", "<", "?", "super", "K", ",", "?", "extends", "V", ",", "X", ">", "mappingFunction", ")", "throws", "X", "{", "N", ".", "checkArgNot...
The implementation is equivalent to performing the following steps for this Multimap: <pre> final V oldValue = get(key); if (N.notNullOrEmpty(oldValue)) { return oldValue; } final V newValue = mappingFunction.apply(key); if (N.notNullOrEmpty(newValue)) { valueMap.put(key, newValue); } return newValue; </pre> @param key @param mappingFunction @return
[ "The", "implementation", "is", "equivalent", "to", "performing", "the", "following", "steps", "for", "this", "Multimap", ":" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multimap.java#L1092-L1108
alipay/sofa-rpc
extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperProviderObserver.java
ZookeeperProviderObserver.updateProvider
public void updateProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { """ Update Provider @param config ConsumerConfig @param providerPath Provider path of zookeeper @param data Event data @param currentData provider data list @throws UnsupportedEncodingException decode error """ if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, false); }
java
public void updateProvider(ConsumerConfig config, String providerPath, ChildData data, List<ChildData> currentData) throws UnsupportedEncodingException { if (LOGGER.isInfoEnabled(config.getAppName())) { LOGGER.infoWithApp(config.getAppName(), "Receive update provider: path=[" + data.getPath() + "]" + ", data=[" + StringSerializer.decode(data.getData()) + "]" + ", stat=[" + data.getStat() + "]" + ", list=[" + currentData.size() + "]"); } notifyListeners(config, providerPath, currentData, false); }
[ "public", "void", "updateProvider", "(", "ConsumerConfig", "config", ",", "String", "providerPath", ",", "ChildData", "data", ",", "List", "<", "ChildData", ">", "currentData", ")", "throws", "UnsupportedEncodingException", "{", "if", "(", "LOGGER", ".", "isInfoEn...
Update Provider @param config ConsumerConfig @param providerPath Provider path of zookeeper @param data Event data @param currentData provider data list @throws UnsupportedEncodingException decode error
[ "Update", "Provider" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperProviderObserver.java#L83-L92
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java
RegistryService.recreateEntry
@Override public void recreateEntry(final SessionProvider sessionProvider, final String groupPath, final RegistryEntry entry) throws RepositoryException { """ Re-creates an entry in the group. @param sessionProvider the session provider @throws RepositoryException """ final String entryRelPath = EXO_REGISTRY + "/" + groupPath + "/" + entry.getName(); final String parentFullPath = "/" + EXO_REGISTRY + "/" + groupPath; try { Session session = session(sessionProvider, repositoryService.getCurrentRepository()); // Don't care about concurrency, Session should be dedicated to the Thread, see JCR-765 // synchronized (session) { Node node = session.getRootNode().getNode(entryRelPath); // delete existing entry... node.remove(); // create same entry, // [PN] no check we need here, as we have deleted this node before // checkGroup(sessionProvider, fullParentPath); session.importXML(parentFullPath, entry.getAsInputStream(), IMPORT_UUID_CREATE_NEW); // save recreated changes session.save(); // } } catch (IOException ioe) { throw new RepositoryException("Item " + parentFullPath + "can't be created " + ioe); } catch (TransformerException te) { throw new RepositoryException("Can't get XML representation from stream " + te); } }
java
@Override public void recreateEntry(final SessionProvider sessionProvider, final String groupPath, final RegistryEntry entry) throws RepositoryException { final String entryRelPath = EXO_REGISTRY + "/" + groupPath + "/" + entry.getName(); final String parentFullPath = "/" + EXO_REGISTRY + "/" + groupPath; try { Session session = session(sessionProvider, repositoryService.getCurrentRepository()); // Don't care about concurrency, Session should be dedicated to the Thread, see JCR-765 // synchronized (session) { Node node = session.getRootNode().getNode(entryRelPath); // delete existing entry... node.remove(); // create same entry, // [PN] no check we need here, as we have deleted this node before // checkGroup(sessionProvider, fullParentPath); session.importXML(parentFullPath, entry.getAsInputStream(), IMPORT_UUID_CREATE_NEW); // save recreated changes session.save(); // } } catch (IOException ioe) { throw new RepositoryException("Item " + parentFullPath + "can't be created " + ioe); } catch (TransformerException te) { throw new RepositoryException("Can't get XML representation from stream " + te); } }
[ "@", "Override", "public", "void", "recreateEntry", "(", "final", "SessionProvider", "sessionProvider", ",", "final", "String", "groupPath", ",", "final", "RegistryEntry", "entry", ")", "throws", "RepositoryException", "{", "final", "String", "entryRelPath", "=", "E...
Re-creates an entry in the group. @param sessionProvider the session provider @throws RepositoryException
[ "Re", "-", "creates", "an", "entry", "in", "the", "group", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java#L239-L275
alkacon/opencms-core
src/org/opencms/db/CmsImportFolder.java
CmsImportFolder.importZip
public void importZip(byte[] content, String importPath, CmsObject cms, boolean noSubFolder) throws CmsException { """ Import that will read from a ZIP file.<p> @param content the zip file to import @param importPath the path to the OpenCms VFS to import to @param cms a OpenCms context to provide the permissions @param noSubFolder if <code>true</code> no sub folders will be created, if <code>false</code> the content of the zip file is created 1:1 inclusive sub folders @throws CmsException if something goes wrong """ m_importPath = importPath; m_cms = cms; try { // open the import resource m_zipStreamIn = new ZipInputStream(new ByteArrayInputStream(content)); m_cms.readFolder(importPath, CmsResourceFilter.IGNORE_EXPIRATION); // import the resources importZipResource(m_zipStreamIn, m_importPath, noSubFolder); } catch (Exception e) { throw new CmsVfsException(Messages.get().container(Messages.ERR_IMPORT_FOLDER_1, importPath), e); } }
java
public void importZip(byte[] content, String importPath, CmsObject cms, boolean noSubFolder) throws CmsException { m_importPath = importPath; m_cms = cms; try { // open the import resource m_zipStreamIn = new ZipInputStream(new ByteArrayInputStream(content)); m_cms.readFolder(importPath, CmsResourceFilter.IGNORE_EXPIRATION); // import the resources importZipResource(m_zipStreamIn, m_importPath, noSubFolder); } catch (Exception e) { throw new CmsVfsException(Messages.get().container(Messages.ERR_IMPORT_FOLDER_1, importPath), e); } }
[ "public", "void", "importZip", "(", "byte", "[", "]", "content", ",", "String", "importPath", ",", "CmsObject", "cms", ",", "boolean", "noSubFolder", ")", "throws", "CmsException", "{", "m_importPath", "=", "importPath", ";", "m_cms", "=", "cms", ";", "try",...
Import that will read from a ZIP file.<p> @param content the zip file to import @param importPath the path to the OpenCms VFS to import to @param cms a OpenCms context to provide the permissions @param noSubFolder if <code>true</code> no sub folders will be created, if <code>false</code> the content of the zip file is created 1:1 inclusive sub folders @throws CmsException if something goes wrong
[ "Import", "that", "will", "read", "from", "a", "ZIP", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsImportFolder.java#L177-L191
Jasig/uPortal
uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java
PropertiesManager.getPropertyAsByte
public static byte getPropertyAsByte(final String name, final byte defaultValue) { """ Get the value of the given property as a byte, specifying a fallback default value. If for any reason we are unable to lookup the desired property, this method returns the supplied default value. This error handling behavior makes this method suitable for calling from static initializers. @param name - the name of the property to be accessed @param defaultValue - the default value that will be returned in the event of any error @return the looked up property value, or the defaultValue if any problem. @since 2.4 """ if (PropertiesManager.props == null) loadProps(); byte returnValue = defaultValue; try { returnValue = getPropertyAsByte(name); } catch (Throwable t) { log.error( "Could not retrieve or parse as byte property [" + name + "], defaulting to [" + defaultValue + "]", t); } return returnValue; }
java
public static byte getPropertyAsByte(final String name, final byte defaultValue) { if (PropertiesManager.props == null) loadProps(); byte returnValue = defaultValue; try { returnValue = getPropertyAsByte(name); } catch (Throwable t) { log.error( "Could not retrieve or parse as byte property [" + name + "], defaulting to [" + defaultValue + "]", t); } return returnValue; }
[ "public", "static", "byte", "getPropertyAsByte", "(", "final", "String", "name", ",", "final", "byte", "defaultValue", ")", "{", "if", "(", "PropertiesManager", ".", "props", "==", "null", ")", "loadProps", "(", ")", ";", "byte", "returnValue", "=", "default...
Get the value of the given property as a byte, specifying a fallback default value. If for any reason we are unable to lookup the desired property, this method returns the supplied default value. This error handling behavior makes this method suitable for calling from static initializers. @param name - the name of the property to be accessed @param defaultValue - the default value that will be returned in the event of any error @return the looked up property value, or the defaultValue if any problem. @since 2.4
[ "Get", "the", "value", "of", "the", "given", "property", "as", "a", "byte", "specifying", "a", "fallback", "default", "value", ".", "If", "for", "any", "reason", "we", "are", "unable", "to", "lookup", "the", "desired", "property", "this", "method", "return...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L372-L387
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java
CacheConfigurationBuilder.withLoaderWriter
public CacheConfigurationBuilder<K, V> withLoaderWriter(Class<CacheLoaderWriter<K, V>> loaderWriterClass, Object... arguments) { """ Adds a {@link CacheLoaderWriter} configured through a class and optional constructor arguments to the configured builder. <p> Configuration of a {@link CacheLoaderWriter} is what enables cache-through patterns. @param loaderWriterClass the loaderwrite class @param arguments optional constructor arguments @return a new builder with the added loaderwriter configuration """ return addOrReplaceConfiguration(new DefaultCacheLoaderWriterConfiguration(requireNonNull(loaderWriterClass, "Null loaderWriterClass"), arguments)); }
java
public CacheConfigurationBuilder<K, V> withLoaderWriter(Class<CacheLoaderWriter<K, V>> loaderWriterClass, Object... arguments) { return addOrReplaceConfiguration(new DefaultCacheLoaderWriterConfiguration(requireNonNull(loaderWriterClass, "Null loaderWriterClass"), arguments)); }
[ "public", "CacheConfigurationBuilder", "<", "K", ",", "V", ">", "withLoaderWriter", "(", "Class", "<", "CacheLoaderWriter", "<", "K", ",", "V", ">", ">", "loaderWriterClass", ",", "Object", "...", "arguments", ")", "{", "return", "addOrReplaceConfiguration", "("...
Adds a {@link CacheLoaderWriter} configured through a class and optional constructor arguments to the configured builder. <p> Configuration of a {@link CacheLoaderWriter} is what enables cache-through patterns. @param loaderWriterClass the loaderwrite class @param arguments optional constructor arguments @return a new builder with the added loaderwriter configuration
[ "Adds", "a", "{", "@link", "CacheLoaderWriter", "}", "configured", "through", "a", "class", "and", "optional", "constructor", "arguments", "to", "the", "configured", "builder", ".", "<p", ">", "Configuration", "of", "a", "{", "@link", "CacheLoaderWriter", "}", ...
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L351-L353
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_request_POST
public OvhTask serviceName_request_POST(String serviceName, OvhRequestActionEnum action) throws IOException { """ Request specific operation for your hosting REST: POST /hosting/web/{serviceName}/request @param action [required] Action you want to request @param serviceName [required] The internal name of your hosting """ String qPath = "/hosting/web/{serviceName}/request"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_request_POST(String serviceName, OvhRequestActionEnum action) throws IOException { String qPath = "/hosting/web/{serviceName}/request"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "action", action); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_request_POST", "(", "String", "serviceName", ",", "OvhRequestActionEnum", "action", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/request\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPat...
Request specific operation for your hosting REST: POST /hosting/web/{serviceName}/request @param action [required] Action you want to request @param serviceName [required] The internal name of your hosting
[ "Request", "specific", "operation", "for", "your", "hosting" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L737-L744
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java
TypeToStringUtils.toStringMethod
public static String toStringMethod(final Method method, final Map<String, Type> generics) { """ <pre>{@code class B extends A<Long> {} class A<T> { List<T> get(T one); } Method method = A.class.getMethod("get", Object.class); Map<String, Type> generics = (context of B).method().visibleGenericsMap(); TypeToStringUtils.toStringMethod(method, generics) == "List<Long> get(Long)" }</pre>. @param method method @param generics required generics (type generics and possible method generics) @return method string with replaced generic variables @see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names @see ru.vyarus.java.generics.resolver.util.map.IgnoreGenericsMap to print Object instead of not known generic """ return String.format("%s %s(%s)", toStringType(method.getGenericReturnType(), generics), method.getName(), toStringTypes(method.getGenericParameterTypes(), generics)); }
java
public static String toStringMethod(final Method method, final Map<String, Type> generics) { return String.format("%s %s(%s)", toStringType(method.getGenericReturnType(), generics), method.getName(), toStringTypes(method.getGenericParameterTypes(), generics)); }
[ "public", "static", "String", "toStringMethod", "(", "final", "Method", "method", ",", "final", "Map", "<", "String", ",", "Type", ">", "generics", ")", "{", "return", "String", ".", "format", "(", "\"%s %s(%s)\"", ",", "toStringType", "(", "method", ".", ...
<pre>{@code class B extends A<Long> {} class A<T> { List<T> get(T one); } Method method = A.class.getMethod("get", Object.class); Map<String, Type> generics = (context of B).method().visibleGenericsMap(); TypeToStringUtils.toStringMethod(method, generics) == "List<Long> get(Long)" }</pre>. @param method method @param generics required generics (type generics and possible method generics) @return method string with replaced generic variables @see ru.vyarus.java.generics.resolver.util.map.PrintableGenericsMap to print not known generic names @see ru.vyarus.java.generics.resolver.util.map.IgnoreGenericsMap to print Object instead of not known generic
[ "<pre", ">", "{", "@code", "class", "B", "extends", "A<Long", ">", "{}", "class", "A<T", ">", "{", "List<T", ">", "get", "(", "T", "one", ")", ";", "}" ]
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/TypeToStringUtils.java#L190-L195
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java
GeneratedDConnectionDaoImpl.findByAccessToken
public DConnection findByAccessToken(java.lang.String accessToken) { """ find-by method for unique field accessToken @param accessToken the unique attribute @return the unique DConnection for the specified accessToken """ return queryUniqueByField(null, DConnectionMapper.Field.ACCESSTOKEN.getFieldName(), accessToken); }
java
public DConnection findByAccessToken(java.lang.String accessToken) { return queryUniqueByField(null, DConnectionMapper.Field.ACCESSTOKEN.getFieldName(), accessToken); }
[ "public", "DConnection", "findByAccessToken", "(", "java", ".", "lang", ".", "String", "accessToken", ")", "{", "return", "queryUniqueByField", "(", "null", ",", "DConnectionMapper", ".", "Field", ".", "ACCESSTOKEN", ".", "getFieldName", "(", ")", ",", "accessTo...
find-by method for unique field accessToken @param accessToken the unique attribute @return the unique DConnection for the specified accessToken
[ "find", "-", "by", "method", "for", "unique", "field", "accessToken" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L43-L45
sahan/DroidBallet
droidballet/src/main/java/com/lonepulse/droidballet/widget/LinearMotionListView.java
LinearMotionListView.initAttributes
private void initAttributes(Context context, AttributeSet attributeSet) { """ <p>Initializes the view with the custom attributes which were declared in the XML layout. This @param context the {@link Context} in which this component is instantiated @param attributeSet the {@link AttributeSet} given in the layout declaration """ TypedArray typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.MotionView); friction = typedArray.getFloat(R.styleable.MotionView_friction, 0.75f) * 1000; typedArray.recycle(); }
java
private void initAttributes(Context context, AttributeSet attributeSet) { TypedArray typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.MotionView); friction = typedArray.getFloat(R.styleable.MotionView_friction, 0.75f) * 1000; typedArray.recycle(); }
[ "private", "void", "initAttributes", "(", "Context", "context", ",", "AttributeSet", "attributeSet", ")", "{", "TypedArray", "typedArray", "=", "context", ".", "obtainStyledAttributes", "(", "attributeSet", ",", "R", ".", "styleable", ".", "MotionView", ")", ";", ...
<p>Initializes the view with the custom attributes which were declared in the XML layout. This @param context the {@link Context} in which this component is instantiated @param attributeSet the {@link AttributeSet} given in the layout declaration
[ "<p", ">", "Initializes", "the", "view", "with", "the", "custom", "attributes", "which", "were", "declared", "in", "the", "XML", "layout", ".", "This" ]
train
https://github.com/sahan/DroidBallet/blob/c6001c9e933cb2c8dbcabe1ae561678b31b10b62/droidballet/src/main/java/com/lonepulse/droidballet/widget/LinearMotionListView.java#L109-L116
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java
Signature.setParameter
@Deprecated public final void setParameter(String param, Object value) throws InvalidParameterException { """ Sets the specified algorithm parameter to the specified value. This method supplies a general-purpose mechanism through which it is possible to set the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time. @param param the string identifier of the parameter. @param value the parameter value. @exception InvalidParameterException if {@code param} is an invalid parameter for this signature algorithm engine, the parameter is already set and cannot be set again, a security exception occurs, and so on. @see #getParameter @deprecated Use {@link #setParameter(java.security.spec.AlgorithmParameterSpec) setParameter}. """ engineSetParameter(param, value); }
java
@Deprecated public final void setParameter(String param, Object value) throws InvalidParameterException { engineSetParameter(param, value); }
[ "@", "Deprecated", "public", "final", "void", "setParameter", "(", "String", "param", ",", "Object", "value", ")", "throws", "InvalidParameterException", "{", "engineSetParameter", "(", "param", ",", "value", ")", ";", "}" ]
Sets the specified algorithm parameter to the specified value. This method supplies a general-purpose mechanism through which it is possible to set the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether or not to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time. @param param the string identifier of the parameter. @param value the parameter value. @exception InvalidParameterException if {@code param} is an invalid parameter for this signature algorithm engine, the parameter is already set and cannot be set again, a security exception occurs, and so on. @see #getParameter @deprecated Use {@link #setParameter(java.security.spec.AlgorithmParameterSpec) setParameter}.
[ "Sets", "the", "specified", "algorithm", "parameter", "to", "the", "specified", "value", ".", "This", "method", "supplies", "a", "general", "-", "purpose", "mechanism", "through", "which", "it", "is", "possible", "to", "set", "the", "various", "parameters", "o...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L1004-L1008
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java
MailService.findMessage
public MailMessage findMessage(final String accountReservationKey, final Predicate<MailMessage> condition) { """ Tries to find a message for the mail account reserved under the specified {@code accountReservationKey} applying the specified {@code condition} until it times out using the default timeout ( {@link EmailConstants#MAIL_TIMEOUT_SECONDS} and {@link EmailConstants#MAIL_SLEEP_MILLIS}). @param accountReservationKey the key under which the account has been reserved @param condition the condition a message must meet @return the mail message """ return findMessage(accountReservationKey, condition, defaultTimeoutSeconds); }
java
public MailMessage findMessage(final String accountReservationKey, final Predicate<MailMessage> condition) { return findMessage(accountReservationKey, condition, defaultTimeoutSeconds); }
[ "public", "MailMessage", "findMessage", "(", "final", "String", "accountReservationKey", ",", "final", "Predicate", "<", "MailMessage", ">", "condition", ")", "{", "return", "findMessage", "(", "accountReservationKey", ",", "condition", ",", "defaultTimeoutSeconds", "...
Tries to find a message for the mail account reserved under the specified {@code accountReservationKey} applying the specified {@code condition} until it times out using the default timeout ( {@link EmailConstants#MAIL_TIMEOUT_SECONDS} and {@link EmailConstants#MAIL_SLEEP_MILLIS}). @param accountReservationKey the key under which the account has been reserved @param condition the condition a message must meet @return the mail message
[ "Tries", "to", "find", "a", "message", "for", "the", "mail", "account", "reserved", "under", "the", "specified", "{", "@code", "accountReservationKey", "}", "applying", "the", "specified", "{", "@code", "condition", "}", "until", "it", "times", "out", "using",...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L79-L81
cdk/cdk
tool/hash/src/main/java/org/openscience/cdk/hash/stereo/DoubleBondElementEncoderFactory.java
DoubleBondElementEncoderFactory.findOther
private static int findOther(int[] vs, int u, int x) { """ Finds a vertex in 'vs' which is not 'u' or 'x'. . @param vs fixed size array of 3 elements @param u a vertex in 'vs' @param x another vertex in 'vs' @return the other vertex """ for (int v : vs) { if (v != u && v != x) return v; } throw new IllegalArgumentException("vs[] did not contain another vertex"); }
java
private static int findOther(int[] vs, int u, int x) { for (int v : vs) { if (v != u && v != x) return v; } throw new IllegalArgumentException("vs[] did not contain another vertex"); }
[ "private", "static", "int", "findOther", "(", "int", "[", "]", "vs", ",", "int", "u", ",", "int", "x", ")", "{", "for", "(", "int", "v", ":", "vs", ")", "{", "if", "(", "v", "!=", "u", "&&", "v", "!=", "x", ")", "return", "v", ";", "}", "...
Finds a vertex in 'vs' which is not 'u' or 'x'. . @param vs fixed size array of 3 elements @param u a vertex in 'vs' @param x another vertex in 'vs' @return the other vertex
[ "Finds", "a", "vertex", "in", "vs", "which", "is", "not", "u", "or", "x", ".", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/hash/src/main/java/org/openscience/cdk/hash/stereo/DoubleBondElementEncoderFactory.java#L127-L132
Netflix/spectator
spectator-api/src/main/java/com/netflix/spectator/api/Utils.java
Utils.filter
public static Iterable<Measurement> filter(Iterable<Measurement> ms, Tag t) { """ Returns a new iterable restricted to measurements that match the predicate. @param ms A set of measurements. @param t The key and value to search for. @return Measurements matching the predicate. """ return filter(ms, t.key(), t.value()); }
java
public static Iterable<Measurement> filter(Iterable<Measurement> ms, Tag t) { return filter(ms, t.key(), t.value()); }
[ "public", "static", "Iterable", "<", "Measurement", ">", "filter", "(", "Iterable", "<", "Measurement", ">", "ms", ",", "Tag", "t", ")", "{", "return", "filter", "(", "ms", ",", "t", ".", "key", "(", ")", ",", "t", ".", "value", "(", ")", ")", ";...
Returns a new iterable restricted to measurements that match the predicate. @param ms A set of measurements. @param t The key and value to search for. @return Measurements matching the predicate.
[ "Returns", "a", "new", "iterable", "restricted", "to", "measurements", "that", "match", "the", "predicate", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-api/src/main/java/com/netflix/spectator/api/Utils.java#L179-L181
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductVariationUrl.java
ProductVariationUrl.addProductVariationLocalizedPriceUrl
public static MozuUrl addProductVariationLocalizedPriceUrl(String productCode, String responseFields, String variationKey) { """ Get Resource Url for AddProductVariationLocalizedPrice @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param variationKey System-generated key that represents the attribute values that uniquely identify a specific product variation. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/variations/{variationKey}/localizedPrice?responseFields={responseFields}"); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("variationKey", variationKey); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl addProductVariationLocalizedPriceUrl(String productCode, String responseFields, String variationKey) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/variations/{variationKey}/localizedPrice?responseFields={responseFields}"); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("variationKey", variationKey); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "addProductVariationLocalizedPriceUrl", "(", "String", "productCode", ",", "String", "responseFields", ",", "String", "variationKey", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/produc...
Get Resource Url for AddProductVariationLocalizedPrice @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param variationKey System-generated key that represents the attribute values that uniquely identify a specific product variation. @return String Resource Url
[ "Get", "Resource", "Url", "for", "AddProductVariationLocalizedPrice" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/products/ProductVariationUrl.java#L141-L148
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java
MapApi.getKeysIn
public static Set<String> getKeysIn(final Map map, final Object... path) { """ Get set of string keys by path. @param map subject @param path nodes to walk in map @return value """ return getMap(map, path) .map(m -> m .keySet() .stream() .map(Object::toString) .collect(Collectors.toSet()) ).orElse(new HashSet<>()); }
java
public static Set<String> getKeysIn(final Map map, final Object... path) { return getMap(map, path) .map(m -> m .keySet() .stream() .map(Object::toString) .collect(Collectors.toSet()) ).orElse(new HashSet<>()); }
[ "public", "static", "Set", "<", "String", ">", "getKeysIn", "(", "final", "Map", "map", ",", "final", "Object", "...", "path", ")", "{", "return", "getMap", "(", "map", ",", "path", ")", ".", "map", "(", "m", "->", "m", ".", "keySet", "(", ")", "...
Get set of string keys by path. @param map subject @param path nodes to walk in map @return value
[ "Get", "set", "of", "string", "keys", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L305-L313
alkacon/opencms-core
src/org/opencms/ade/galleries/CmsPreviewService.java
CmsPreviewService.readResourceFromCurrentOrRootSite
private CmsResource readResourceFromCurrentOrRootSite(CmsObject cms, String name) throws CmsException { """ Tries to read a resource either from the current site or from the root site.<p> @param cms the CMS context to use @param name the resource path @return the resource which was read @throws CmsException if something goes wrong """ CmsResource resource = null; try { resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } catch (CmsVfsResourceNotFoundException e) { String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } } return resource; }
java
private CmsResource readResourceFromCurrentOrRootSite(CmsObject cms, String name) throws CmsException { CmsResource resource = null; try { resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } catch (CmsVfsResourceNotFoundException e) { String originalSiteRoot = cms.getRequestContext().getSiteRoot(); try { cms.getRequestContext().setSiteRoot(""); resource = cms.readResource(name, CmsResourceFilter.IGNORE_EXPIRATION); } finally { cms.getRequestContext().setSiteRoot(originalSiteRoot); } } return resource; }
[ "private", "CmsResource", "readResourceFromCurrentOrRootSite", "(", "CmsObject", "cms", ",", "String", "name", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "null", ";", "try", "{", "resource", "=", "cms", ".", "readResource", "(", "name", ...
Tries to read a resource either from the current site or from the root site.<p> @param cms the CMS context to use @param name the resource path @return the resource which was read @throws CmsException if something goes wrong
[ "Tries", "to", "read", "a", "resource", "either", "from", "the", "current", "site", "or", "from", "the", "root", "site", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsPreviewService.java#L382-L398
apereo/cas
support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java
OpenIdServiceResponseBuilder.determineIdentity
protected String determineIdentity(final OpenIdService service, final Assertion assertion) { """ Determine identity. @param service the service @param assertion the assertion @return the string """ if (assertion != null && OpenIdProtocolConstants.OPENID_IDENTIFIERSELECT.equals(service.getIdentity())) { return this.openIdPrefixUrl + '/' + assertion.getPrimaryAuthentication().getPrincipal().getId(); } return service.getIdentity(); }
java
protected String determineIdentity(final OpenIdService service, final Assertion assertion) { if (assertion != null && OpenIdProtocolConstants.OPENID_IDENTIFIERSELECT.equals(service.getIdentity())) { return this.openIdPrefixUrl + '/' + assertion.getPrimaryAuthentication().getPrincipal().getId(); } return service.getIdentity(); }
[ "protected", "String", "determineIdentity", "(", "final", "OpenIdService", "service", ",", "final", "Assertion", "assertion", ")", "{", "if", "(", "assertion", "!=", "null", "&&", "OpenIdProtocolConstants", ".", "OPENID_IDENTIFIERSELECT", ".", "equals", "(", "servic...
Determine identity. @param service the service @param assertion the assertion @return the string
[ "Determine", "identity", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java#L108-L113
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java
StreamUtils.byteBufferToOutputStream
public static void byteBufferToOutputStream(ByteBuffer in, OutputStream out) throws IOException { """ Reads the full contents of a ByteBuffer and writes them to an OutputStream. The ByteBuffer is consumed by this operation; eg in.remaining() will be 0 after it completes successfully. @param in ByteBuffer to write into the OutputStream @param out Destination stream @throws IOException If there is an error writing into the OutputStream """ final int BUF_SIZE = 8192; if (in.hasArray()) { out.write(in.array(), in.arrayOffset() + in.position(), in.remaining()); } else { final byte[] b = new byte[Math.min(in.remaining(), BUF_SIZE)]; while (in.remaining() > 0) { int bytesToRead = Math.min(in.remaining(), BUF_SIZE); in.get(b, 0, bytesToRead); out.write(b, 0, bytesToRead); } } }
java
public static void byteBufferToOutputStream(ByteBuffer in, OutputStream out) throws IOException { final int BUF_SIZE = 8192; if (in.hasArray()) { out.write(in.array(), in.arrayOffset() + in.position(), in.remaining()); } else { final byte[] b = new byte[Math.min(in.remaining(), BUF_SIZE)]; while (in.remaining() > 0) { int bytesToRead = Math.min(in.remaining(), BUF_SIZE); in.get(b, 0, bytesToRead); out.write(b, 0, bytesToRead); } } }
[ "public", "static", "void", "byteBufferToOutputStream", "(", "ByteBuffer", "in", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "final", "int", "BUF_SIZE", "=", "8192", ";", "if", "(", "in", ".", "hasArray", "(", ")", ")", "{", "out", ".", ...
Reads the full contents of a ByteBuffer and writes them to an OutputStream. The ByteBuffer is consumed by this operation; eg in.remaining() will be 0 after it completes successfully. @param in ByteBuffer to write into the OutputStream @param out Destination stream @throws IOException If there is an error writing into the OutputStream
[ "Reads", "the", "full", "contents", "of", "a", "ByteBuffer", "and", "writes", "them", "to", "an", "OutputStream", ".", "The", "ByteBuffer", "is", "consumed", "by", "this", "operation", ";", "eg", "in", ".", "remaining", "()", "will", "be", "0", "after", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java#L223-L238
opencb/java-common-libs
commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java
SolrManager.createCollection
public void createCollection(String collectionName, String configSet) throws SolrException { """ Create a Solr collection from a configuration directory. The configuration has to be uploaded to the zookeeper, $ ./bin/solr zk upconfig -n <config name> -d <path to the config dir> -z <host:port zookeeper>. For Solr, collection name, configuration name and number of shards are mandatory in order to create a collection. Number of replicas is optional. @param collectionName Collection name @param configSet Configuration name @throws SolrException Exception """ logger.debug("Creating collection: host={}, collection={}, config={}, numShards={}, numReplicas={}", host, collectionName, configSet, 1, 1); try { CollectionAdminRequest request = CollectionAdminRequest.createCollection(collectionName, configSet, 1, 1); request.process(solrClient); } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e); } }
java
public void createCollection(String collectionName, String configSet) throws SolrException { logger.debug("Creating collection: host={}, collection={}, config={}, numShards={}, numReplicas={}", host, collectionName, configSet, 1, 1); try { CollectionAdminRequest request = CollectionAdminRequest.createCollection(collectionName, configSet, 1, 1); request.process(solrClient); } catch (Exception e) { throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, e); } }
[ "public", "void", "createCollection", "(", "String", "collectionName", ",", "String", "configSet", ")", "throws", "SolrException", "{", "logger", ".", "debug", "(", "\"Creating collection: host={}, collection={}, config={}, numShards={}, numReplicas={}\"", ",", "host", ",", ...
Create a Solr collection from a configuration directory. The configuration has to be uploaded to the zookeeper, $ ./bin/solr zk upconfig -n <config name> -d <path to the config dir> -z <host:port zookeeper>. For Solr, collection name, configuration name and number of shards are mandatory in order to create a collection. Number of replicas is optional. @param collectionName Collection name @param configSet Configuration name @throws SolrException Exception
[ "Create", "a", "Solr", "collection", "from", "a", "configuration", "directory", ".", "The", "configuration", "has", "to", "be", "uploaded", "to", "the", "zookeeper", "$", ".", "/", "bin", "/", "solr", "zk", "upconfig", "-", "n", "<config", "name", ">", "...
train
https://github.com/opencb/java-common-libs/blob/5c97682530d0be55828e1e4e374ff01fceb5f198/commons-datastore/commons-datastore-solr/src/main/java/org/opencb/commons/datastore/solr/SolrManager.java#L158-L167
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/EqualizeHistTransform.java
EqualizeHistTransform.doTransform
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { """ Takes an image and returns a transformed image. Uses the random object in the case of random transformations. @param image to transform, null == end of stream @param random object to use (or null for deterministic) @return transformed image """ if (image == null) { return null; } Mat mat = (Mat) converter.convert(image.getFrame()); Mat result = new Mat(); try { if (mat.channels() == 1) { equalizeHist(mat, result); } else { split(mat, splitChannels); equalizeHist(splitChannels.get(0), splitChannels.get(0)); //equalize histogram on the 1st channel (Y) merge(splitChannels, result); } } catch (Exception e) { throw new RuntimeException(e); } return new ImageWritable(converter.convert(result)); }
java
@Override protected ImageWritable doTransform(ImageWritable image, Random random) { if (image == null) { return null; } Mat mat = (Mat) converter.convert(image.getFrame()); Mat result = new Mat(); try { if (mat.channels() == 1) { equalizeHist(mat, result); } else { split(mat, splitChannels); equalizeHist(splitChannels.get(0), splitChannels.get(0)); //equalize histogram on the 1st channel (Y) merge(splitChannels, result); } } catch (Exception e) { throw new RuntimeException(e); } return new ImageWritable(converter.convert(result)); }
[ "@", "Override", "protected", "ImageWritable", "doTransform", "(", "ImageWritable", "image", ",", "Random", "random", ")", "{", "if", "(", "image", "==", "null", ")", "{", "return", "null", ";", "}", "Mat", "mat", "=", "(", "Mat", ")", "converter", ".", ...
Takes an image and returns a transformed image. Uses the random object in the case of random transformations. @param image to transform, null == end of stream @param random object to use (or null for deterministic) @return transformed image
[ "Takes", "an", "image", "and", "returns", "a", "transformed", "image", ".", "Uses", "the", "random", "object", "in", "the", "case", "of", "random", "transformations", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/EqualizeHistTransform.java#L87-L107
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/io/gpio/NanoPiPin.java
NanoPiPin.createDigitalPin
protected static Pin createDigitalPin(int address, String name) { """ this pin is permanently pulled up; pin pull settings do not work """ return createDigitalPin(NanoPiGpioProvider.NAME, address, name); }
java
protected static Pin createDigitalPin(int address, String name) { return createDigitalPin(NanoPiGpioProvider.NAME, address, name); }
[ "protected", "static", "Pin", "createDigitalPin", "(", "int", "address", ",", "String", "name", ")", "{", "return", "createDigitalPin", "(", "NanoPiGpioProvider", ".", "NAME", ",", "address", ",", "name", ")", ";", "}" ]
this pin is permanently pulled up; pin pull settings do not work
[ "this", "pin", "is", "permanently", "pulled", "up", ";", "pin", "pull", "settings", "do", "not", "work" ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/io/gpio/NanoPiPin.java#L74-L76
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java
IPv6AddressSection.toEUI
public MACAddressSection toEUI(boolean extended) { """ Returns the corresponding mac section, or null if this address section does not correspond to a mac section. If this address section has a prefix length it is ignored. @param extended @return """ MACAddressSegment[] segs = toEUISegments(extended); if(segs == null) { return null; } MACAddressCreator creator = getMACNetwork().getAddressCreator(); return createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended); }
java
public MACAddressSection toEUI(boolean extended) { MACAddressSegment[] segs = toEUISegments(extended); if(segs == null) { return null; } MACAddressCreator creator = getMACNetwork().getAddressCreator(); return createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended); }
[ "public", "MACAddressSection", "toEUI", "(", "boolean", "extended", ")", "{", "MACAddressSegment", "[", "]", "segs", "=", "toEUISegments", "(", "extended", ")", ";", "if", "(", "segs", "==", "null", ")", "{", "return", "null", ";", "}", "MACAddressCreator", ...
Returns the corresponding mac section, or null if this address section does not correspond to a mac section. If this address section has a prefix length it is ignored. @param extended @return
[ "Returns", "the", "corresponding", "mac", "section", "or", "null", "if", "this", "address", "section", "does", "not", "correspond", "to", "a", "mac", "section", ".", "If", "this", "address", "section", "has", "a", "prefix", "length", "it", "is", "ignored", ...
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1160-L1167
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/util/OpenIntSet.java
OpenIntSet.findIndex
private static int findIndex(int[] buckets, int i) { """ Returns the index where {@code i} would be in the provided array (which include the case where an open slot exists) or {@code -1} if the probe was unable to find both {@code i} and any position where {@code i} might be stored. """ // Hash the value of i into a slot. Note that because we're using the // bitwise-and to perform the mod, the slot will always be positive even // if i is negative. int slot = i & (buckets.length - 1); int initial = slot; int firstDeletedSeen = -1; do { int val = buckets[slot]; // Record the first DELETED slot we see, but don't return until // after we've progressed to either an emtpy slot or the slot with // the value. This ensures that if we somehow delete a sequence of // values preceding the slot with the desired value the iteration // continues. However, by recording this slot, if we don't find the // value, we can return this index to indicate whether the slot // would go. if (val == DELETED_MARKER && firstDeletedSeen < 0) firstDeletedSeen = slot; // If we found the value itself, then return the slot else if (val == i) return slot; // Otherwise, if we found an EMPTY slot, then check whether the // value should be placed (potentially) in this slot or in a prior // slot that contains a deleted value. else if (val == EMPTY_MARKER) { return (firstDeletedSeen < 0) ? slot : firstDeletedSeen; } } while ((slot = (slot + 1) % buckets.length) != initial); // If the linear probe has wrapped all the way around the array and if // so, return a negative index. This should only happen if the array is // completely full and cannot be grown. return -1; }
java
private static int findIndex(int[] buckets, int i) { // Hash the value of i into a slot. Note that because we're using the // bitwise-and to perform the mod, the slot will always be positive even // if i is negative. int slot = i & (buckets.length - 1); int initial = slot; int firstDeletedSeen = -1; do { int val = buckets[slot]; // Record the first DELETED slot we see, but don't return until // after we've progressed to either an emtpy slot or the slot with // the value. This ensures that if we somehow delete a sequence of // values preceding the slot with the desired value the iteration // continues. However, by recording this slot, if we don't find the // value, we can return this index to indicate whether the slot // would go. if (val == DELETED_MARKER && firstDeletedSeen < 0) firstDeletedSeen = slot; // If we found the value itself, then return the slot else if (val == i) return slot; // Otherwise, if we found an EMPTY slot, then check whether the // value should be placed (potentially) in this slot or in a prior // slot that contains a deleted value. else if (val == EMPTY_MARKER) { return (firstDeletedSeen < 0) ? slot : firstDeletedSeen; } } while ((slot = (slot + 1) % buckets.length) != initial); // If the linear probe has wrapped all the way around the array and if // so, return a negative index. This should only happen if the array is // completely full and cannot be grown. return -1; }
[ "private", "static", "int", "findIndex", "(", "int", "[", "]", "buckets", ",", "int", "i", ")", "{", "// Hash the value of i into a slot. Note that because we're using the\r", "// bitwise-and to perform the mod, the slot will always be positive even\r", "// if i is negative.\r", "...
Returns the index where {@code i} would be in the provided array (which include the case where an open slot exists) or {@code -1} if the probe was unable to find both {@code i} and any position where {@code i} might be stored.
[ "Returns", "the", "index", "where", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/OpenIntSet.java#L199-L233
morimekta/utils
io-util/src/main/java/net/morimekta/util/FileWatcher.java
FileWatcher.weakAddWatcher
@Deprecated public void weakAddWatcher(File file, Watcher watcher) { """ Start watching file path and notify watcher for updates on that file. The watcher will be kept in a weak reference and will allow GC to delete the instance. @param file The file path to watch. @param watcher The watcher to be notified. @deprecated Use {@link #weakAddWatcher(Path, Listener)} """ weakAddWatcher(file.toPath(), watcher); }
java
@Deprecated public void weakAddWatcher(File file, Watcher watcher) { weakAddWatcher(file.toPath(), watcher); }
[ "@", "Deprecated", "public", "void", "weakAddWatcher", "(", "File", "file", ",", "Watcher", "watcher", ")", "{", "weakAddWatcher", "(", "file", ".", "toPath", "(", ")", ",", "watcher", ")", ";", "}" ]
Start watching file path and notify watcher for updates on that file. The watcher will be kept in a weak reference and will allow GC to delete the instance. @param file The file path to watch. @param watcher The watcher to be notified. @deprecated Use {@link #weakAddWatcher(Path, Listener)}
[ "Start", "watching", "file", "path", "and", "notify", "watcher", "for", "updates", "on", "that", "file", ".", "The", "watcher", "will", "be", "kept", "in", "a", "weak", "reference", "and", "will", "allow", "GC", "to", "delete", "the", "instance", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L250-L253
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
MP3FileID3Controller.setArtist
public void setArtist(String artist, int type) { """ Set the artist of this mp3. @param artist the artist of the mp3 """ if (allow(type&ID3V1)) { id3v1.setArtist(artist); } if (allow(type&ID3V2)) { id3v2.setTextFrame(ID3v2Frames.LEAD_PERFORMERS, artist); } }
java
public void setArtist(String artist, int type) { if (allow(type&ID3V1)) { id3v1.setArtist(artist); } if (allow(type&ID3V2)) { id3v2.setTextFrame(ID3v2Frames.LEAD_PERFORMERS, artist); } }
[ "public", "void", "setArtist", "(", "String", "artist", ",", "int", "type", ")", "{", "if", "(", "allow", "(", "type", "&", "ID3V1", ")", ")", "{", "id3v1", ".", "setArtist", "(", "artist", ")", ";", "}", "if", "(", "allow", "(", "type", "&", "ID...
Set the artist of this mp3. @param artist the artist of the mp3
[ "Set", "the", "artist", "of", "this", "mp3", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L193-L203
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java
URLMatchingUtils.performUrlMatch
static String performUrlMatch(String uri, Collection<String> urlPatterns) { """ Gets the match for the resource name. <pre> To perform a URL match, 1. For each URL pattern determine if the resource matches it 2. Construct the match object Exact match has first priority. The longest path match has second priority. The extension match has last priority. </pre> @param uriName @return """ String match = null; String longestUrlPattern = null; for (String urlPattern : urlPatterns) { if (URLMatchingUtils.isExactMatch(uri, urlPattern)) { return urlPattern; } else if (URLMatchingUtils.isPathNameMatch(uri, urlPattern)) { longestUrlPattern = URLMatchingUtils.getLongestUrlPattern(longestUrlPattern, urlPattern); } else if (URLMatchingUtils.isExtensionMatch(uri, urlPattern)) { match = urlPattern; } } if (longestUrlPattern != null) { match = longestUrlPattern; } return match; }
java
static String performUrlMatch(String uri, Collection<String> urlPatterns) { String match = null; String longestUrlPattern = null; for (String urlPattern : urlPatterns) { if (URLMatchingUtils.isExactMatch(uri, urlPattern)) { return urlPattern; } else if (URLMatchingUtils.isPathNameMatch(uri, urlPattern)) { longestUrlPattern = URLMatchingUtils.getLongestUrlPattern(longestUrlPattern, urlPattern); } else if (URLMatchingUtils.isExtensionMatch(uri, urlPattern)) { match = urlPattern; } } if (longestUrlPattern != null) { match = longestUrlPattern; } return match; }
[ "static", "String", "performUrlMatch", "(", "String", "uri", ",", "Collection", "<", "String", ">", "urlPatterns", ")", "{", "String", "match", "=", "null", ";", "String", "longestUrlPattern", "=", "null", ";", "for", "(", "String", "urlPattern", ":", "urlPa...
Gets the match for the resource name. <pre> To perform a URL match, 1. For each URL pattern determine if the resource matches it 2. Construct the match object Exact match has first priority. The longest path match has second priority. The extension match has last priority. </pre> @param uriName @return
[ "Gets", "the", "match", "for", "the", "resource", "name", ".", "<pre", ">", "To", "perform", "a", "URL", "match", "1", ".", "For", "each", "URL", "pattern", "determine", "if", "the", "resource", "matches", "it", "2", ".", "Construct", "the", "match", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java#L49-L65
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java
AbstractAlpineQueryManager.getCount
public long getCount(final Query query, final Object... parameters) { """ Returns the number of items that would have resulted from returning all object. This method is performant in that the objects are not actually retrieved, only the count. @param query the query to return a count from @param parameters the <code>Object</code> array with all of the parameters @return the number of items @since 1.0.0 """ final String ordering = ((JDOQuery) query).getInternalQuery().getOrdering(); query.setResult("count(id)"); query.setOrdering(null); final long count = (Long) query.executeWithArray(parameters); query.setOrdering(ordering); return count; }
java
public long getCount(final Query query, final Object... parameters) { final String ordering = ((JDOQuery) query).getInternalQuery().getOrdering(); query.setResult("count(id)"); query.setOrdering(null); final long count = (Long) query.executeWithArray(parameters); query.setOrdering(ordering); return count; }
[ "public", "long", "getCount", "(", "final", "Query", "query", ",", "final", "Object", "...", "parameters", ")", "{", "final", "String", "ordering", "=", "(", "(", "JDOQuery", ")", "query", ")", ".", "getInternalQuery", "(", ")", ".", "getOrdering", "(", ...
Returns the number of items that would have resulted from returning all object. This method is performant in that the objects are not actually retrieved, only the count. @param query the query to return a count from @param parameters the <code>Object</code> array with all of the parameters @return the number of items @since 1.0.0
[ "Returns", "the", "number", "of", "items", "that", "would", "have", "resulted", "from", "returning", "all", "object", ".", "This", "method", "is", "performant", "in", "that", "the", "objects", "are", "not", "actually", "retrieved", "only", "the", "count", "....
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java#L344-L351
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java
AbstractModbusMaster.maskWriteRegister
public boolean maskWriteRegister(int unitId, int ref, int andMask, int orMask) throws ModbusException { """ Mask write a single register to the slave. @param unitId the slave unit id. @param ref the offset of the register to start writing to. @param andMask AND mask. @param orMask OR mask. @return true if success, i.e. response data equals to request data, false otherwise. @throws ModbusException if an I/O error, a slave exception or a transaction error occurs. """ checkTransaction(); if (maskWriteRegisterRequest == null) { maskWriteRegisterRequest = new MaskWriteRegisterRequest(); } maskWriteRegisterRequest.setUnitID(unitId); maskWriteRegisterRequest.setReference(ref); maskWriteRegisterRequest.setAndMask(andMask); maskWriteRegisterRequest.setOrMask(orMask); transaction.setRequest(maskWriteRegisterRequest); transaction.execute(); MaskWriteRegisterResponse response = (MaskWriteRegisterResponse) getAndCheckResponse(); return response.getReference() == maskWriteRegisterRequest.getReference() && response.getAndMask() == maskWriteRegisterRequest.getAndMask() && response.getOrMask() == maskWriteRegisterRequest.getOrMask(); }
java
public boolean maskWriteRegister(int unitId, int ref, int andMask, int orMask) throws ModbusException { checkTransaction(); if (maskWriteRegisterRequest == null) { maskWriteRegisterRequest = new MaskWriteRegisterRequest(); } maskWriteRegisterRequest.setUnitID(unitId); maskWriteRegisterRequest.setReference(ref); maskWriteRegisterRequest.setAndMask(andMask); maskWriteRegisterRequest.setOrMask(orMask); transaction.setRequest(maskWriteRegisterRequest); transaction.execute(); MaskWriteRegisterResponse response = (MaskWriteRegisterResponse) getAndCheckResponse(); return response.getReference() == maskWriteRegisterRequest.getReference() && response.getAndMask() == maskWriteRegisterRequest.getAndMask() && response.getOrMask() == maskWriteRegisterRequest.getOrMask(); }
[ "public", "boolean", "maskWriteRegister", "(", "int", "unitId", ",", "int", "ref", ",", "int", "andMask", ",", "int", "orMask", ")", "throws", "ModbusException", "{", "checkTransaction", "(", ")", ";", "if", "(", "maskWriteRegisterRequest", "==", "null", ")", ...
Mask write a single register to the slave. @param unitId the slave unit id. @param ref the offset of the register to start writing to. @param andMask AND mask. @param orMask OR mask. @return true if success, i.e. response data equals to request data, false otherwise. @throws ModbusException if an I/O error, a slave exception or a transaction error occurs.
[ "Mask", "write", "a", "single", "register", "to", "the", "slave", "." ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java#L306-L322
cdk/cdk
tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/MMFF94ParametersCall.java
MMFF94ParametersCall.getBondData
public List getBondData(String code, String id1, String id2) throws Exception { """ Gets the bond parameter set. @param id1 atom1 id @param id2 atom2 id @return The distance value from the force field parameter set @exception Exception Description of the Exception """ String dkey = ""; if (pSet.containsKey(("bond" + code + ";" + id1 + ";" + id2))) { dkey = "bond" + code + ";" + id1 + ";" + id2; } else if (pSet.containsKey(("bond" + code + ";" + id2 + ";" + id1))) { dkey = "bond" + code + ";" + id2 + ";" + id1; } /* * else { System.out.println("KEYError:Unknown distance key in pSet: " * + code + ";" + id2 + " ;" + id1+" take default bon length:" + * DEFAULT_BOND_LENGTH); return DEFAULT_BOND_LENGTH; } */ //logger.debug("dkey = " + dkey); return (List) pSet.get(dkey); }
java
public List getBondData(String code, String id1, String id2) throws Exception { String dkey = ""; if (pSet.containsKey(("bond" + code + ";" + id1 + ";" + id2))) { dkey = "bond" + code + ";" + id1 + ";" + id2; } else if (pSet.containsKey(("bond" + code + ";" + id2 + ";" + id1))) { dkey = "bond" + code + ";" + id2 + ";" + id1; } /* * else { System.out.println("KEYError:Unknown distance key in pSet: " * + code + ";" + id2 + " ;" + id1+" take default bon length:" + * DEFAULT_BOND_LENGTH); return DEFAULT_BOND_LENGTH; } */ //logger.debug("dkey = " + dkey); return (List) pSet.get(dkey); }
[ "public", "List", "getBondData", "(", "String", "code", ",", "String", "id1", ",", "String", "id2", ")", "throws", "Exception", "{", "String", "dkey", "=", "\"\"", ";", "if", "(", "pSet", ".", "containsKey", "(", "(", "\"bond\"", "+", "code", "+", "\";...
Gets the bond parameter set. @param id1 atom1 id @param id2 atom2 id @return The distance value from the force field parameter set @exception Exception Description of the Exception
[ "Gets", "the", "bond", "parameter", "set", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/modeling/builder3d/MMFF94ParametersCall.java#L41-L54
bmwcarit/joynr
java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java
LongPollingMessagingDelegate.listChannels
public List<ChannelInformation> listChannels() { """ Gets a list of all channel information. @return list of all channel informations """ LinkedList<ChannelInformation> entries = new LinkedList<ChannelInformation>(); Collection<Broadcaster> broadcasters = BroadcasterFactory.getDefault().lookupAll(); String name; for (Broadcaster broadcaster : broadcasters) { if (broadcaster instanceof BounceProxyBroadcaster) { name = ((BounceProxyBroadcaster) broadcaster).getName(); } else { name = broadcaster.getClass().getSimpleName(); } Integer cachedSize = null; entries.add(new ChannelInformation(name, broadcaster.getAtmosphereResources().size(), cachedSize)); } return entries; }
java
public List<ChannelInformation> listChannels() { LinkedList<ChannelInformation> entries = new LinkedList<ChannelInformation>(); Collection<Broadcaster> broadcasters = BroadcasterFactory.getDefault().lookupAll(); String name; for (Broadcaster broadcaster : broadcasters) { if (broadcaster instanceof BounceProxyBroadcaster) { name = ((BounceProxyBroadcaster) broadcaster).getName(); } else { name = broadcaster.getClass().getSimpleName(); } Integer cachedSize = null; entries.add(new ChannelInformation(name, broadcaster.getAtmosphereResources().size(), cachedSize)); } return entries; }
[ "public", "List", "<", "ChannelInformation", ">", "listChannels", "(", ")", "{", "LinkedList", "<", "ChannelInformation", ">", "entries", "=", "new", "LinkedList", "<", "ChannelInformation", ">", "(", ")", ";", "Collection", "<", "Broadcaster", ">", "broadcaster...
Gets a list of all channel information. @return list of all channel informations
[ "Gets", "a", "list", "of", "all", "channel", "information", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-common/src/main/java/io/joynr/messaging/bounceproxy/LongPollingMessagingDelegate.java#L66-L82
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java
PathBuilder.get
@SuppressWarnings("unchecked") public <A extends Comparable<?>> TimePath<A> get(TimePath<A> path) { """ Create a new Time typed path @param <A> @param path existing path @return property path """ TimePath<A> newPath = getTime(toString(path), (Class<A>) path.getType()); return addMetadataOf(newPath, path); }
java
@SuppressWarnings("unchecked") public <A extends Comparable<?>> TimePath<A> get(TimePath<A> path) { TimePath<A> newPath = getTime(toString(path), (Class<A>) path.getType()); return addMetadataOf(newPath, path); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "A", "extends", "Comparable", "<", "?", ">", ">", "TimePath", "<", "A", ">", "get", "(", "TimePath", "<", "A", ">", "path", ")", "{", "TimePath", "<", "A", ">", "newPath", "=", "getTi...
Create a new Time typed path @param <A> @param path existing path @return property path
[ "Create", "a", "new", "Time", "typed", "path" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/PathBuilder.java#L501-L505
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java
VariableTranslator.realToObject
public static Object realToObject(Package pkg, String type, String value) { """ Deserializes variable string values to runtime objects. @param pkg workflow package @param type variable type @param value string value @return deserialized object """ if (StringHelper.isEmpty(value)) return null; com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(pkg, type); if (trans instanceof DocumentReferenceTranslator) return ((DocumentReferenceTranslator)trans).realToObject(value); else return trans.toObject(value); }
java
public static Object realToObject(Package pkg, String type, String value) { if (StringHelper.isEmpty(value)) return null; com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(pkg, type); if (trans instanceof DocumentReferenceTranslator) return ((DocumentReferenceTranslator)trans).realToObject(value); else return trans.toObject(value); }
[ "public", "static", "Object", "realToObject", "(", "Package", "pkg", ",", "String", "type", ",", "String", "value", ")", "{", "if", "(", "StringHelper", ".", "isEmpty", "(", "value", ")", ")", "return", "null", ";", "com", ".", "centurylink", ".", "mdw",...
Deserializes variable string values to runtime objects. @param pkg workflow package @param type variable type @param value string value @return deserialized object
[ "Deserializes", "variable", "string", "values", "to", "runtime", "objects", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java#L157-L165
keenlabs/KeenClient-Java
query/src/main/java/io/keen/client/java/RequestUrlBuilder.java
RequestUrlBuilder.getAnalysisUrl
URL getAnalysisUrl(String projectId, String analysisPath) throws KeenQueryClientException { """ Get a formatted URL for an analysis request. @param projectId The project id @param analysisPath The analysis url sub-path @return The complete URL. @throws KeenQueryClientException """ try { return new URL(String.format(Locale.US, "%s/%s/projects/%s/queries/%s", this.baseUrl, this.apiVersion, projectId, analysisPath )); } catch (MalformedURLException ex) { Logger.getLogger(RequestUrlBuilder.class.getName()) .log(Level.SEVERE, "Failed to format query URL.", ex); throw new KeenQueryClientException("Failed to format query URL.", ex); } }
java
URL getAnalysisUrl(String projectId, String analysisPath) throws KeenQueryClientException { try { return new URL(String.format(Locale.US, "%s/%s/projects/%s/queries/%s", this.baseUrl, this.apiVersion, projectId, analysisPath )); } catch (MalformedURLException ex) { Logger.getLogger(RequestUrlBuilder.class.getName()) .log(Level.SEVERE, "Failed to format query URL.", ex); throw new KeenQueryClientException("Failed to format query URL.", ex); } }
[ "URL", "getAnalysisUrl", "(", "String", "projectId", ",", "String", "analysisPath", ")", "throws", "KeenQueryClientException", "{", "try", "{", "return", "new", "URL", "(", "String", ".", "format", "(", "Locale", ".", "US", ",", "\"%s/%s/projects/%s/queries/%s\"",...
Get a formatted URL for an analysis request. @param projectId The project id @param analysisPath The analysis url sub-path @return The complete URL. @throws KeenQueryClientException
[ "Get", "a", "formatted", "URL", "for", "an", "analysis", "request", "." ]
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/query/src/main/java/io/keen/client/java/RequestUrlBuilder.java#L48-L63
tomdcc/sham
sham-core/src/main/java/org/shamdata/Sham.java
Sham.registerGenerator
public void registerGenerator(String name, ShamGenerator generator) { """ Register a data generator. The passed in generator will have its random number generator set to the same RNG as the <code>Sham</code> instance. @param name the name to give to the generator, so that it may be recalled when calling <code>getGenerator</code> or <code>getGenerators</code>. @param generator the generator to register """ generator.setRandom(random); generators.put(name, generator); }
java
public void registerGenerator(String name, ShamGenerator generator) { generator.setRandom(random); generators.put(name, generator); }
[ "public", "void", "registerGenerator", "(", "String", "name", ",", "ShamGenerator", "generator", ")", "{", "generator", ".", "setRandom", "(", "random", ")", ";", "generators", ".", "put", "(", "name", ",", "generator", ")", ";", "}" ]
Register a data generator. The passed in generator will have its random number generator set to the same RNG as the <code>Sham</code> instance. @param name the name to give to the generator, so that it may be recalled when calling <code>getGenerator</code> or <code>getGenerators</code>. @param generator the generator to register
[ "Register", "a", "data", "generator", ".", "The", "passed", "in", "generator", "will", "have", "its", "random", "number", "generator", "set", "to", "the", "same", "RNG", "as", "the", "<code", ">", "Sham<", "/", "code", ">", "instance", "." ]
train
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/Sham.java#L100-L103
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Mapper.java
Mapper.zip
public static Map zip(Iterator keys, Iterator values) { """ Creates a map where the object at index N from the first Iterator is the key for the object at index N of the second Iterator. <br> By default discards both key and value if either one is null. @param keys Iterator of keys @param values Iterator of values @return map """ return zip(keys, values, false); }
java
public static Map zip(Iterator keys, Iterator values) { return zip(keys, values, false); }
[ "public", "static", "Map", "zip", "(", "Iterator", "keys", ",", "Iterator", "values", ")", "{", "return", "zip", "(", "keys", ",", "values", ",", "false", ")", ";", "}" ]
Creates a map where the object at index N from the first Iterator is the key for the object at index N of the second Iterator. <br> By default discards both key and value if either one is null. @param keys Iterator of keys @param values Iterator of values @return map
[ "Creates", "a", "map", "where", "the", "object", "at", "index", "N", "from", "the", "first", "Iterator", "is", "the", "key", "for", "the", "object", "at", "index", "N", "of", "the", "second", "Iterator", ".", "<br", ">", "By", "default", "discards", "b...
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L231-L233
facebookarchive/hadoop-20
src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatOutputStream.java
SimpleSeekableFormatOutputStream.flush
@Override public void flush() throws IOException { """ Take the current data segment, optionally compress it, calculate the crc32, and then write it out. The method sets the lastOffsets to the end of the file before it starts writing. That means the offsets in the MetaDataBlock will be after the end of the current data block. """ // Do not do anything if no data has been written if (currentDataSegmentBuffer.size() == 0) { return; } // Create the current DataSegment DataSegmentWriter currentDataSegment = new DataSegmentWriter(currentDataSegmentBuffer, codec, codecCompressor); // Update the metadata updateMetadata(currentDataSegmentBuffer.size(), currentDataSegment.size()); // Write out the DataSegment currentDataSegment.writeTo(dataSegmentDataOut); // Clear out the current buffer. Note that this has to be done after // currentDataSegment.writeTo(...), because currentDataSegment can // keep a reference to the currentDataSegmentBuffer. currentDataSegmentBuffer.reset(); // Flush out the underlying stream dataSegmentDataOut.flush(); }
java
@Override public void flush() throws IOException { // Do not do anything if no data has been written if (currentDataSegmentBuffer.size() == 0) { return; } // Create the current DataSegment DataSegmentWriter currentDataSegment = new DataSegmentWriter(currentDataSegmentBuffer, codec, codecCompressor); // Update the metadata updateMetadata(currentDataSegmentBuffer.size(), currentDataSegment.size()); // Write out the DataSegment currentDataSegment.writeTo(dataSegmentDataOut); // Clear out the current buffer. Note that this has to be done after // currentDataSegment.writeTo(...), because currentDataSegment can // keep a reference to the currentDataSegmentBuffer. currentDataSegmentBuffer.reset(); // Flush out the underlying stream dataSegmentDataOut.flush(); }
[ "@", "Override", "public", "void", "flush", "(", ")", "throws", "IOException", "{", "// Do not do anything if no data has been written", "if", "(", "currentDataSegmentBuffer", ".", "size", "(", ")", "==", "0", ")", "{", "return", ";", "}", "// Create the current Dat...
Take the current data segment, optionally compress it, calculate the crc32, and then write it out. The method sets the lastOffsets to the end of the file before it starts writing. That means the offsets in the MetaDataBlock will be after the end of the current data block.
[ "Take", "the", "current", "data", "segment", "optionally", "compress", "it", "calculate", "the", "crc32", "and", "then", "write", "it", "out", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/SimpleSeekableFormatOutputStream.java#L151-L176
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ShakeAroundAPI.java
ShakeAroundAPI.pageDelete
public static PageDeleteResult pageDelete(String accessToken, PageDelete pageDelete) { """ 页面管理-删除页面 @param accessToken accessToken @param pageDelete pageDelete @return result """ return pageDelete(accessToken, JsonUtil.toJSONString(pageDelete)); }
java
public static PageDeleteResult pageDelete(String accessToken, PageDelete pageDelete) { return pageDelete(accessToken, JsonUtil.toJSONString(pageDelete)); }
[ "public", "static", "PageDeleteResult", "pageDelete", "(", "String", "accessToken", ",", "PageDelete", "pageDelete", ")", "{", "return", "pageDelete", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "pageDelete", ")", ")", ";", "}" ]
页面管理-删除页面 @param accessToken accessToken @param pageDelete pageDelete @return result
[ "页面管理-删除页面" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L756-L759
knowm/XChart
xchart/src/main/java/org/knowm/xchart/QuickChart.java
QuickChart.getChart
public static XYChart getChart( String chartTitle, String xTitle, String yTitle, String seriesName, double[] xData, double[] yData) { """ Creates a Chart with default style @param chartTitle the Chart title @param xTitle The X-Axis title @param yTitle The Y-Axis title @param seriesName The name of the series @param xData An array containing the X-Axis data @param yData An array containing Y-Axis data @return a Chart Object """ double[][] yData2d = {yData}; if (seriesName == null) { return getChart(chartTitle, xTitle, yTitle, null, xData, yData2d); } else { return getChart(chartTitle, xTitle, yTitle, new String[] {seriesName}, xData, yData2d); } }
java
public static XYChart getChart( String chartTitle, String xTitle, String yTitle, String seriesName, double[] xData, double[] yData) { double[][] yData2d = {yData}; if (seriesName == null) { return getChart(chartTitle, xTitle, yTitle, null, xData, yData2d); } else { return getChart(chartTitle, xTitle, yTitle, new String[] {seriesName}, xData, yData2d); } }
[ "public", "static", "XYChart", "getChart", "(", "String", "chartTitle", ",", "String", "xTitle", ",", "String", "yTitle", ",", "String", "seriesName", ",", "double", "[", "]", "xData", ",", "double", "[", "]", "yData", ")", "{", "double", "[", "]", "[", ...
Creates a Chart with default style @param chartTitle the Chart title @param xTitle The X-Axis title @param yTitle The Y-Axis title @param seriesName The name of the series @param xData An array containing the X-Axis data @param yData An array containing Y-Axis data @return a Chart Object
[ "Creates", "a", "Chart", "with", "default", "style" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/QuickChart.java#L30-L44
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnImplCodeGen.java
ConnImplCodeGen.writeClassBody
@Override public void writeClassBody(Definition def, Writer out) throws IOException { """ Output class @param def definition @param out Writer @throws IOException ioException """ out.write("public class " + getClassName(def) + " implements " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass()); writeLeftCurlyBracket(out, 0); int indent = 1; writeWithIndent(out, indent, "/** The logger */\n"); writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n"); writeWithIndent(out, indent, "/** ManagedConnection */\n"); writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc;\n\n"); writeWithIndent(out, indent, "/** ManagedConnectionFactory */\n"); writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf;\n\n"); //constructor writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " * @param mc " + def.getMcfDefs().get(getNumOfMcf()).getMcClass()); writeEol(out); writeWithIndent(out, indent, " * @param mcf " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass()); writeEol(out); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "(" + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc, " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf)"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this.mc = mc;\n"); writeWithIndent(out, indent + 1, "this.mcf = mcf;"); writeRightCurlyBracket(out, indent); writeEol(out); writeMethod(def, out, indent); writeRightCurlyBracket(out, 0); }
java
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public class " + getClassName(def) + " implements " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass()); writeLeftCurlyBracket(out, 0); int indent = 1; writeWithIndent(out, indent, "/** The logger */\n"); writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n"); writeWithIndent(out, indent, "/** ManagedConnection */\n"); writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc;\n\n"); writeWithIndent(out, indent, "/** ManagedConnectionFactory */\n"); writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf;\n\n"); //constructor writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " * @param mc " + def.getMcfDefs().get(getNumOfMcf()).getMcClass()); writeEol(out); writeWithIndent(out, indent, " * @param mcf " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass()); writeEol(out); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "(" + def.getMcfDefs().get(getNumOfMcf()).getMcClass() + " mc, " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf)"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this.mc = mc;\n"); writeWithIndent(out, indent + 1, "this.mcf = mcf;"); writeRightCurlyBracket(out, indent); writeEol(out); writeMethod(def, out, indent); writeRightCurlyBracket(out, 0); }
[ "@", "Override", "public", "void", "writeClassBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "out", ".", "write", "(", "\"public class \"", "+", "getClassName", "(", "def", ")", "+", "\" implements \"", "+", "def", ...
Output class @param def definition @param out Writer @throws IOException ioException
[ "Output", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnImplCodeGen.java#L46-L83
konmik/solid
streams/src/main/java/solid/stream/Stream.java
Stream.separate
public Stream<T> separate(final T value) { """ Returns a new stream that contains all items of the current stream except of a given item. @param value a value to filter out. @return a new stream that contains all items of the current stream except of a given item. """ return filter(new Func1<T, Boolean>() { @Override public Boolean call(T it) { return ((it == null) ? (value != null) : !it.equals(value)); } }); }
java
public Stream<T> separate(final T value) { return filter(new Func1<T, Boolean>() { @Override public Boolean call(T it) { return ((it == null) ? (value != null) : !it.equals(value)); } }); }
[ "public", "Stream", "<", "T", ">", "separate", "(", "final", "T", "value", ")", "{", "return", "filter", "(", "new", "Func1", "<", "T", ",", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "call", "(", "T", "it", ")", "{", "r...
Returns a new stream that contains all items of the current stream except of a given item. @param value a value to filter out. @return a new stream that contains all items of the current stream except of a given item.
[ "Returns", "a", "new", "stream", "that", "contains", "all", "items", "of", "the", "current", "stream", "except", "of", "a", "given", "item", "." ]
train
https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L337-L344
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastScopeSession.java
CastScopeSession.createCastOperatorScope
protected IScope createCastOperatorScope(EObject context, EReference reference, IResolvedTypes resolvedTypes) { """ create a scope for cast operator. @param context the context. @param reference the reference to the internal feature. @param resolvedTypes the resolved types. @return the scope. """ if (!(context instanceof SarlCastedExpression)) { return IScope.NULLSCOPE; } final SarlCastedExpression call = (SarlCastedExpression) context; final XExpression receiver = call.getTarget(); if (receiver == null) { return IScope.NULLSCOPE; } return getFeatureScopes().createFeatureCallScopeForReceiver(call, receiver, getParent(), resolvedTypes); }
java
protected IScope createCastOperatorScope(EObject context, EReference reference, IResolvedTypes resolvedTypes) { if (!(context instanceof SarlCastedExpression)) { return IScope.NULLSCOPE; } final SarlCastedExpression call = (SarlCastedExpression) context; final XExpression receiver = call.getTarget(); if (receiver == null) { return IScope.NULLSCOPE; } return getFeatureScopes().createFeatureCallScopeForReceiver(call, receiver, getParent(), resolvedTypes); }
[ "protected", "IScope", "createCastOperatorScope", "(", "EObject", "context", ",", "EReference", "reference", ",", "IResolvedTypes", "resolvedTypes", ")", "{", "if", "(", "!", "(", "context", "instanceof", "SarlCastedExpression", ")", ")", "{", "return", "IScope", ...
create a scope for cast operator. @param context the context. @param reference the reference to the internal feature. @param resolvedTypes the resolved types. @return the scope.
[ "create", "a", "scope", "for", "cast", "operator", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastScopeSession.java#L78-L88
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Stage.java
Stage.actorProxyFor
final <T> T actorProxyFor(final Class<T> protocol, final Actor actor, final Mailbox mailbox) { """ Answers the T protocol proxy for this newly created Actor. (INTERNAL ONLY) @param <T> the protocol type @param protocol the {@code Class<T>} protocol of the Actor @param actor the Actor instance that backs the proxy protocol @param mailbox the Mailbox instance of this Actor @return T """ return ActorProxy.createFor(protocol, actor, mailbox); }
java
final <T> T actorProxyFor(final Class<T> protocol, final Actor actor, final Mailbox mailbox) { return ActorProxy.createFor(protocol, actor, mailbox); }
[ "final", "<", "T", ">", "T", "actorProxyFor", "(", "final", "Class", "<", "T", ">", "protocol", ",", "final", "Actor", "actor", ",", "final", "Mailbox", "mailbox", ")", "{", "return", "ActorProxy", ".", "createFor", "(", "protocol", ",", "actor", ",", ...
Answers the T protocol proxy for this newly created Actor. (INTERNAL ONLY) @param <T> the protocol type @param protocol the {@code Class<T>} protocol of the Actor @param actor the Actor instance that backs the proxy protocol @param mailbox the Mailbox instance of this Actor @return T
[ "Answers", "the", "T", "protocol", "proxy", "for", "this", "newly", "created", "Actor", ".", "(", "INTERNAL", "ONLY", ")" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L477-L479
mnlipp/jgrapes
org.jgrapes.io/src/org/jgrapes/net/SslCodec.java
SslCodec.onConnected
@Handler(channels = EncryptedChannel.class) public void onConnected(Connected event, IOSubchannel encryptedChannel) { """ Creates a new downstream connection as {@link LinkedIOSubchannel} of the network connection together with an {@link SSLEngine}. @param event the accepted event """ new PlainChannel(event, encryptedChannel); }
java
@Handler(channels = EncryptedChannel.class) public void onConnected(Connected event, IOSubchannel encryptedChannel) { new PlainChannel(event, encryptedChannel); }
[ "@", "Handler", "(", "channels", "=", "EncryptedChannel", ".", "class", ")", "public", "void", "onConnected", "(", "Connected", "event", ",", "IOSubchannel", "encryptedChannel", ")", "{", "new", "PlainChannel", "(", "event", ",", "encryptedChannel", ")", ";", ...
Creates a new downstream connection as {@link LinkedIOSubchannel} of the network connection together with an {@link SSLEngine}. @param event the accepted event
[ "Creates", "a", "new", "downstream", "connection", "as", "{", "@link", "LinkedIOSubchannel", "}", "of", "the", "network", "connection", "together", "with", "an", "{", "@link", "SSLEngine", "}", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/net/SslCodec.java#L177-L180
cdk/cdk
display/render/src/main/java/org/openscience/cdk/renderer/color/RasmolColors.java
RasmolColors.getAtomColor
@Override public Color getAtomColor(IAtom atom, Color defaultColor) { """ Returns the Rasmol color for the given atom's element, or defaults to the given color if no color is defined. @param atom IAtom to get a color for @param defaultColor Color returned if this scheme does not define a color for the passed IAtom @return the atom's color according to this coloring scheme. """ Color color = defaultColor; String symbol = atom.getSymbol(); if (colorMap.containsKey(symbol)) { color = colorMap.get(symbol); } return color; }
java
@Override public Color getAtomColor(IAtom atom, Color defaultColor) { Color color = defaultColor; String symbol = atom.getSymbol(); if (colorMap.containsKey(symbol)) { color = colorMap.get(symbol); } return color; }
[ "@", "Override", "public", "Color", "getAtomColor", "(", "IAtom", "atom", ",", "Color", "defaultColor", ")", "{", "Color", "color", "=", "defaultColor", ";", "String", "symbol", "=", "atom", ".", "getSymbol", "(", ")", ";", "if", "(", "colorMap", ".", "c...
Returns the Rasmol color for the given atom's element, or defaults to the given color if no color is defined. @param atom IAtom to get a color for @param defaultColor Color returned if this scheme does not define a color for the passed IAtom @return the atom's color according to this coloring scheme.
[ "Returns", "the", "Rasmol", "color", "for", "the", "given", "atom", "s", "element", "or", "defaults", "to", "the", "given", "color", "if", "no", "color", "is", "defined", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/render/src/main/java/org/openscience/cdk/renderer/color/RasmolColors.java#L101-L109
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/in/XParser.java
XParser.endsWithIgnoreCase
protected boolean endsWithIgnoreCase(String name, String suffix) { """ Returns whether the given file name ends (ignoring the case) with the given suffix. @param name The given file name. @param suffix The given suffix. @return Whether the given file name ends (ignoring the case) with the given suffix. """ if (name == null || suffix == null) { /* * No name or no suffix. Return false. */ return false; } int i = name.length() - suffix.length(); if (i < 0) { /* * Suffix is longer than name, hence name cannot end with suffix. */ return false; } return name.substring(i).equalsIgnoreCase(suffix); }
java
protected boolean endsWithIgnoreCase(String name, String suffix) { if (name == null || suffix == null) { /* * No name or no suffix. Return false. */ return false; } int i = name.length() - suffix.length(); if (i < 0) { /* * Suffix is longer than name, hence name cannot end with suffix. */ return false; } return name.substring(i).equalsIgnoreCase(suffix); }
[ "protected", "boolean", "endsWithIgnoreCase", "(", "String", "name", ",", "String", "suffix", ")", "{", "if", "(", "name", "==", "null", "||", "suffix", "==", "null", ")", "{", "/*\n\t\t\t * No name or no suffix. Return false.\n\t\t\t */", "return", "false", ";", ...
Returns whether the given file name ends (ignoring the case) with the given suffix. @param name The given file name. @param suffix The given suffix. @return Whether the given file name ends (ignoring the case) with the given suffix.
[ "Returns", "whether", "the", "given", "file", "name", "ends", "(", "ignoring", "the", "case", ")", "with", "the", "given", "suffix", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/in/XParser.java#L127-L142
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/GenericCollectionTypeResolver.java
GenericCollectionTypeResolver.getGenericParameterType
private static Class getGenericParameterType(MethodParameter methodParam, int typeIndex) { """ Extract the generic parameter type from the given method or constructor. @param methodParam the method parameter specification @param typeIndex the index of the type (e.g. 0 for Collections, 0 for Map keys, 1 for Map values) @return the generic type, or <code>null</code> if none """ return toClass(extractType(methodParam, getTargetType(methodParam), typeIndex, methodParam.getNestingLevel())); }
java
private static Class getGenericParameterType(MethodParameter methodParam, int typeIndex) { return toClass(extractType(methodParam, getTargetType(methodParam), typeIndex, methodParam.getNestingLevel())); }
[ "private", "static", "Class", "getGenericParameterType", "(", "MethodParameter", "methodParam", ",", "int", "typeIndex", ")", "{", "return", "toClass", "(", "extractType", "(", "methodParam", ",", "getTargetType", "(", "methodParam", ")", ",", "typeIndex", ",", "m...
Extract the generic parameter type from the given method or constructor. @param methodParam the method parameter specification @param typeIndex the index of the type (e.g. 0 for Collections, 0 for Map keys, 1 for Map values) @return the generic type, or <code>null</code> if none
[ "Extract", "the", "generic", "parameter", "type", "from", "the", "given", "method", "or", "constructor", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/beans/GenericCollectionTypeResolver.java#L261-L263
assertthat/selenium-shutterbug
src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java
Shutterbug.shootPage
public static PageSnapshot shootPage(WebDriver driver, boolean useDevicePixelRatio) { """ Make screen shot of the viewport only. To be used when screen shooting the page and don't need to scroll while making screen shots (FF, IE). @param driver WebDriver instance @param useDevicePixelRatio whether or not take into account device pixel ratio @return PageSnapshot instance """ Browser browser = new Browser(driver, useDevicePixelRatio); PageSnapshot pageScreenshot = new PageSnapshot(driver,browser.getDevicePixelRatio()); pageScreenshot.setImage(browser.takeScreenshot()); return pageScreenshot; }
java
public static PageSnapshot shootPage(WebDriver driver, boolean useDevicePixelRatio) { Browser browser = new Browser(driver, useDevicePixelRatio); PageSnapshot pageScreenshot = new PageSnapshot(driver,browser.getDevicePixelRatio()); pageScreenshot.setImage(browser.takeScreenshot()); return pageScreenshot; }
[ "public", "static", "PageSnapshot", "shootPage", "(", "WebDriver", "driver", ",", "boolean", "useDevicePixelRatio", ")", "{", "Browser", "browser", "=", "new", "Browser", "(", "driver", ",", "useDevicePixelRatio", ")", ";", "PageSnapshot", "pageScreenshot", "=", "...
Make screen shot of the viewport only. To be used when screen shooting the page and don't need to scroll while making screen shots (FF, IE). @param driver WebDriver instance @param useDevicePixelRatio whether or not take into account device pixel ratio @return PageSnapshot instance
[ "Make", "screen", "shot", "of", "the", "viewport", "only", ".", "To", "be", "used", "when", "screen", "shooting", "the", "page", "and", "don", "t", "need", "to", "scroll", "while", "making", "screen", "shots", "(", "FF", "IE", ")", "." ]
train
https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java#L41-L46
js-lib-com/commons
src/main/java/js/io/FilesInputStream.java
FilesInputStream.getMeta
public <T> T getMeta(String key, Class<T> type, T defaultValue) { """ Get files archive meta data converted to requested type or default value if meta data key is missing. @param key meta data key, @param type type to convert meta data value to, @param defaultValue default value returned if key not found. @param <T> meta data type. @return meta data value converted to type or default value. """ String value = manifest.getMainAttributes().getValue(key); return value == null ? defaultValue : ConverterRegistry.getConverter().asObject(value, type); }
java
public <T> T getMeta(String key, Class<T> type, T defaultValue) { String value = manifest.getMainAttributes().getValue(key); return value == null ? defaultValue : ConverterRegistry.getConverter().asObject(value, type); }
[ "public", "<", "T", ">", "T", "getMeta", "(", "String", "key", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "String", "value", "=", "manifest", ".", "getMainAttributes", "(", ")", ".", "getValue", "(", "key", ")", ";", "...
Get files archive meta data converted to requested type or default value if meta data key is missing. @param key meta data key, @param type type to convert meta data value to, @param defaultValue default value returned if key not found. @param <T> meta data type. @return meta data value converted to type or default value.
[ "Get", "files", "archive", "meta", "data", "converted", "to", "requested", "type", "or", "default", "value", "if", "meta", "data", "key", "is", "missing", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesInputStream.java#L200-L203
korpling/ANNIS
annis-libgui/src/main/java/annis/libgui/Helper.java
Helper.createRESTClient
public static Client createRESTClient(String userName, String password) { """ Creates an authentificiated REST client @param userName @param password @return A newly created client. """ DefaultApacheHttpClient4Config rc = new DefaultApacheHttpClient4Config(); rc.getClasses().add(SaltProjectProvider.class); ThreadSafeClientConnManager clientConnMgr = new ThreadSafeClientConnManager(); clientConnMgr.setDefaultMaxPerRoute(10); rc.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER, clientConnMgr); if (userName != null && password != null) { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(userName, password)); rc.getProperties().put( ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER, credentialsProvider); rc.getProperties().put( ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION, true); } Client c = ApacheHttpClient4.create(rc); return c; }
java
public static Client createRESTClient(String userName, String password) { DefaultApacheHttpClient4Config rc = new DefaultApacheHttpClient4Config(); rc.getClasses().add(SaltProjectProvider.class); ThreadSafeClientConnManager clientConnMgr = new ThreadSafeClientConnManager(); clientConnMgr.setDefaultMaxPerRoute(10); rc.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER, clientConnMgr); if (userName != null && password != null) { CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(userName, password)); rc.getProperties().put( ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER, credentialsProvider); rc.getProperties().put( ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION, true); } Client c = ApacheHttpClient4.create(rc); return c; }
[ "public", "static", "Client", "createRESTClient", "(", "String", "userName", ",", "String", "password", ")", "{", "DefaultApacheHttpClient4Config", "rc", "=", "new", "DefaultApacheHttpClient4Config", "(", ")", ";", "rc", ".", "getClasses", "(", ")", ".", "add", ...
Creates an authentificiated REST client @param userName @param password @return A newly created client.
[ "Creates", "an", "authentificiated", "REST", "client" ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-libgui/src/main/java/annis/libgui/Helper.java#L153-L181
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java
CmsAttributeHandler.clearMoveAnimationStyles
void clearMoveAnimationStyles(Element placeHolder, CmsAttributeValueView reference) { """ Clears the inline styles used during move animation.<p> @param placeHolder the animation place holder @param reference the moved attribute widget """ placeHolder.removeFromParent(); reference.getElement().getParentElement().getStyle().clearPosition(); reference.getElement().getStyle().clearPosition(); reference.getElement().getStyle().clearWidth(); reference.getElement().getStyle().clearZIndex(); reference.showButtons(); }
java
void clearMoveAnimationStyles(Element placeHolder, CmsAttributeValueView reference) { placeHolder.removeFromParent(); reference.getElement().getParentElement().getStyle().clearPosition(); reference.getElement().getStyle().clearPosition(); reference.getElement().getStyle().clearWidth(); reference.getElement().getStyle().clearZIndex(); reference.showButtons(); }
[ "void", "clearMoveAnimationStyles", "(", "Element", "placeHolder", ",", "CmsAttributeValueView", "reference", ")", "{", "placeHolder", ".", "removeFromParent", "(", ")", ";", "reference", ".", "getElement", "(", ")", ".", "getParentElement", "(", ")", ".", "getSty...
Clears the inline styles used during move animation.<p> @param placeHolder the animation place holder @param reference the moved attribute widget
[ "Clears", "the", "inline", "styles", "used", "during", "move", "animation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L1112-L1120
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/Assembler.java
Assembler.if_tcmpge
public void if_tcmpge(TypeMirror type, String target) throws IOException { """ ge succeeds if and only if value1 &gt;= value2 <p>Stack: ..., value1, value2 =&gt; ... @param type @param target @throws IOException """ pushType(type); if_tcmpge(target); popType(); }
java
public void if_tcmpge(TypeMirror type, String target) throws IOException { pushType(type); if_tcmpge(target); popType(); }
[ "public", "void", "if_tcmpge", "(", "TypeMirror", "type", ",", "String", "target", ")", "throws", "IOException", "{", "pushType", "(", "type", ")", ";", "if_tcmpge", "(", "target", ")", ";", "popType", "(", ")", ";", "}" ]
ge succeeds if and only if value1 &gt;= value2 <p>Stack: ..., value1, value2 =&gt; ... @param type @param target @throws IOException
[ "ge", "succeeds", "if", "and", "only", "if", "value1", "&gt", ";", "=", "value2", "<p", ">", "Stack", ":", "...", "value1", "value2", "=", "&gt", ";", "..." ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L656-L661
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java
DefaultInstalledExtensionRepository.getInstalledFeatureFromCache
private InstalledFeature getInstalledFeatureFromCache(String feature, String namespace) { """ Get extension registered as installed for the provided feature and namespace (including on root namespace). @param feature the feature provided by the extension @param namespace the namespace where the extension is installed @return the installed extension informations """ if (feature == null) { return null; } Map<String, InstalledFeature> installedExtensionsForFeature = this.extensionNamespaceByFeature.get(feature); if (installedExtensionsForFeature == null) { return null; } InstalledFeature installedExtension = installedExtensionsForFeature.get(namespace); // Fallback on root namespace if the feature could not be found if (installedExtension == null && namespace != null) { installedExtension = getInstalledFeatureFromCache(feature, null); } return installedExtension; }
java
private InstalledFeature getInstalledFeatureFromCache(String feature, String namespace) { if (feature == null) { return null; } Map<String, InstalledFeature> installedExtensionsForFeature = this.extensionNamespaceByFeature.get(feature); if (installedExtensionsForFeature == null) { return null; } InstalledFeature installedExtension = installedExtensionsForFeature.get(namespace); // Fallback on root namespace if the feature could not be found if (installedExtension == null && namespace != null) { installedExtension = getInstalledFeatureFromCache(feature, null); } return installedExtension; }
[ "private", "InstalledFeature", "getInstalledFeatureFromCache", "(", "String", "feature", ",", "String", "namespace", ")", "{", "if", "(", "feature", "==", "null", ")", "{", "return", "null", ";", "}", "Map", "<", "String", ",", "InstalledFeature", ">", "instal...
Get extension registered as installed for the provided feature and namespace (including on root namespace). @param feature the feature provided by the extension @param namespace the namespace where the extension is installed @return the installed extension informations
[ "Get", "extension", "registered", "as", "installed", "for", "the", "provided", "feature", "and", "namespace", "(", "including", "on", "root", "namespace", ")", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L671-L691
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java
Strs.startAny
public static boolean startAny(String target, Integer toffset, List<String> startWith) { """ Check if target string starts with any of a list of specified strings beginning at the specified index. @param target @param toffset @param startWith @return """ if (isNull(target)) { return false; } return matcher(target).starts(toffset, startWith); }
java
public static boolean startAny(String target, Integer toffset, List<String> startWith) { if (isNull(target)) { return false; } return matcher(target).starts(toffset, startWith); }
[ "public", "static", "boolean", "startAny", "(", "String", "target", ",", "Integer", "toffset", ",", "List", "<", "String", ">", "startWith", ")", "{", "if", "(", "isNull", "(", "target", ")", ")", "{", "return", "false", ";", "}", "return", "matcher", ...
Check if target string starts with any of a list of specified strings beginning at the specified index. @param target @param toffset @param startWith @return
[ "Check", "if", "target", "string", "starts", "with", "any", "of", "a", "list", "of", "specified", "strings", "beginning", "at", "the", "specified", "index", "." ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L353-L359
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java
GobblinMetrics.addCustomTagToProperties
public static void addCustomTagToProperties(Properties properties, Tag<?> tag) { """ Add a {@link Tag} to a {@link Properties} with key {@link #METRICS_STATE_CUSTOM_TAGS}. Also see {@link #addCustomTagToState(State, Tag)} <p> The {@link Properties} passed can be used to build a {@link State}. {@link org.apache.gobblin.metrics.Tag}s under this key can later be parsed using the method {@link #getCustomTagsFromState}. </p> @param properties {@link Properties} to add the tag to. @param tag {@link Tag} to add. """ // Build a state wrapper to add custom tag to property State state = new State(properties); addCustomTagToState(state, tag); }
java
public static void addCustomTagToProperties(Properties properties, Tag<?> tag) { // Build a state wrapper to add custom tag to property State state = new State(properties); addCustomTagToState(state, tag); }
[ "public", "static", "void", "addCustomTagToProperties", "(", "Properties", "properties", ",", "Tag", "<", "?", ">", "tag", ")", "{", "// Build a state wrapper to add custom tag to property", "State", "state", "=", "new", "State", "(", "properties", ")", ";", "addCus...
Add a {@link Tag} to a {@link Properties} with key {@link #METRICS_STATE_CUSTOM_TAGS}. Also see {@link #addCustomTagToState(State, Tag)} <p> The {@link Properties} passed can be used to build a {@link State}. {@link org.apache.gobblin.metrics.Tag}s under this key can later be parsed using the method {@link #getCustomTagsFromState}. </p> @param properties {@link Properties} to add the tag to. @param tag {@link Tag} to add.
[ "Add", "a", "{", "@link", "Tag", "}", "to", "a", "{", "@link", "Properties", "}", "with", "key", "{", "@link", "#METRICS_STATE_CUSTOM_TAGS", "}", ".", "Also", "see", "{", "@link", "#addCustomTagToState", "(", "State", "Tag", ")", "}" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java#L230-L234
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ContainerStateMonitor.java
ContainerStateMonitor.awaitStability
void awaitStability(long timeout, TimeUnit timeUnit) throws InterruptedException, TimeoutException { """ Await service container stability. @param timeout maximum period to wait for service container stability @param timeUnit unit in which {@code timeout} is expressed @throws java.lang.InterruptedException if the thread is interrupted while awaiting service container stability @throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout """ if (!monitor.awaitStability(timeout, timeUnit, failed, problems)) { throw new TimeoutException(); } }
java
void awaitStability(long timeout, TimeUnit timeUnit) throws InterruptedException, TimeoutException { if (!monitor.awaitStability(timeout, timeUnit, failed, problems)) { throw new TimeoutException(); } }
[ "void", "awaitStability", "(", "long", "timeout", ",", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "if", "(", "!", "monitor", ".", "awaitStability", "(", "timeout", ",", "timeUnit", ",", "failed", ",", "problems",...
Await service container stability. @param timeout maximum period to wait for service container stability @param timeUnit unit in which {@code timeout} is expressed @throws java.lang.InterruptedException if the thread is interrupted while awaiting service container stability @throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout
[ "Await", "service", "container", "stability", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ContainerStateMonitor.java#L123-L127
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java
SparkStorageUtils.saveMapFileSequences
public static void saveMapFileSequences(String path, JavaRDD<List<List<Writable>>> rdd) { """ Save a {@code JavaRDD<List<List<Writable>>>} to a Hadoop {@link org.apache.hadoop.io.MapFile}. Each record is given a <i>unique and contiguous</i> {@link LongWritable} key, and values are stored as {@link SequenceRecordWritable} instances.<br> <b>Note 1</b>: If contiguous keys are not required, using a sequence file instead is preferable from a performance point of view. Contiguous keys are often only required for non-Spark use cases, such as with {@link org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader}<br> <b>Note 2</b>: This use a MapFile interval of {@link #DEFAULT_MAP_FILE_INTERVAL}, which is usually suitable for use cases such as {@link org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader}. Use {@link #saveMapFileSequences(String, JavaRDD, int, Integer)} or {@link #saveMapFileSequences(String, JavaRDD, Configuration, Integer)} to customize this. <br> <p> Use {@link #restoreMapFileSequences(String, JavaSparkContext)} to restore values saved with this method. @param path Path to save the MapFile @param rdd RDD to save @see #saveMapFileSequences(String, JavaRDD) @see #saveSequenceFile(String, JavaRDD) """ saveMapFileSequences(path, rdd, DEFAULT_MAP_FILE_INTERVAL, null); }
java
public static void saveMapFileSequences(String path, JavaRDD<List<List<Writable>>> rdd) { saveMapFileSequences(path, rdd, DEFAULT_MAP_FILE_INTERVAL, null); }
[ "public", "static", "void", "saveMapFileSequences", "(", "String", "path", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "rdd", ")", "{", "saveMapFileSequences", "(", "path", ",", "rdd", ",", "DEFAULT_MAP_FILE_INTERVAL", ",", "nul...
Save a {@code JavaRDD<List<List<Writable>>>} to a Hadoop {@link org.apache.hadoop.io.MapFile}. Each record is given a <i>unique and contiguous</i> {@link LongWritable} key, and values are stored as {@link SequenceRecordWritable} instances.<br> <b>Note 1</b>: If contiguous keys are not required, using a sequence file instead is preferable from a performance point of view. Contiguous keys are often only required for non-Spark use cases, such as with {@link org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader}<br> <b>Note 2</b>: This use a MapFile interval of {@link #DEFAULT_MAP_FILE_INTERVAL}, which is usually suitable for use cases such as {@link org.datavec.hadoop.records.reader.mapfile.MapFileSequenceRecordReader}. Use {@link #saveMapFileSequences(String, JavaRDD, int, Integer)} or {@link #saveMapFileSequences(String, JavaRDD, Configuration, Integer)} to customize this. <br> <p> Use {@link #restoreMapFileSequences(String, JavaSparkContext)} to restore values saved with this method. @param path Path to save the MapFile @param rdd RDD to save @see #saveMapFileSequences(String, JavaRDD) @see #saveSequenceFile(String, JavaRDD)
[ "Save", "a", "{", "@code", "JavaRDD<List<List<Writable", ">>>", "}", "to", "a", "Hadoop", "{", "@link", "org", ".", "apache", ".", "hadoop", ".", "io", ".", "MapFile", "}", ".", "Each", "record", "is", "given", "a", "<i", ">", "unique", "and", "contigu...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java#L288-L290
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
PacketParserUtils.parseSASLFailure
public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException { """ Parses SASL authentication error packets. @param parser the XML parser. @return a SASL Failure packet. @throws IOException @throws XmlPullParserException """ final int initialDepth = parser.getDepth(); String condition = null; Map<String, String> descriptiveTexts = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String name = parser.getName(); if (name.equals("text")) { descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts); } else { assert (condition == null); condition = parser.getName(); } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return new SASLFailure(condition, descriptiveTexts); }
java
public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException { final int initialDepth = parser.getDepth(); String condition = null; Map<String, String> descriptiveTexts = null; outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String name = parser.getName(); if (name.equals("text")) { descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts); } else { assert (condition == null); condition = parser.getName(); } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return new SASLFailure(condition, descriptiveTexts); }
[ "public", "static", "SASLFailure", "parseSASLFailure", "(", "XmlPullParser", "parser", ")", "throws", "XmlPullParserException", ",", "IOException", "{", "final", "int", "initialDepth", "=", "parser", ".", "getDepth", "(", ")", ";", "String", "condition", "=", "nul...
Parses SASL authentication error packets. @param parser the XML parser. @return a SASL Failure packet. @throws IOException @throws XmlPullParserException
[ "Parses", "SASL", "authentication", "error", "packets", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L780-L805
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/eigen/Eigen.java
Eigen.symmetricGeneralizedEigenvalues
public static INDArray symmetricGeneralizedEigenvalues(INDArray A, boolean calculateVectors) { """ Compute generalized eigenvalues of the problem A x = L x. Matrix A is modified in the process, holding eigenvectors as columns after execution. @param A symmetric Matrix A. After execution, A will contain the eigenvectors as columns @param calculateVectors if false, it will not modify A and calculate eigenvectors @return a vector of eigenvalues L. """ INDArray eigenvalues = Nd4j.create(A.rows()); Nd4j.getBlasWrapper().syev('V', 'L', (calculateVectors ? A : A.dup()), eigenvalues); return eigenvalues; }
java
public static INDArray symmetricGeneralizedEigenvalues(INDArray A, boolean calculateVectors) { INDArray eigenvalues = Nd4j.create(A.rows()); Nd4j.getBlasWrapper().syev('V', 'L', (calculateVectors ? A : A.dup()), eigenvalues); return eigenvalues; }
[ "public", "static", "INDArray", "symmetricGeneralizedEigenvalues", "(", "INDArray", "A", ",", "boolean", "calculateVectors", ")", "{", "INDArray", "eigenvalues", "=", "Nd4j", ".", "create", "(", "A", ".", "rows", "(", ")", ")", ";", "Nd4j", ".", "getBlasWrappe...
Compute generalized eigenvalues of the problem A x = L x. Matrix A is modified in the process, holding eigenvectors as columns after execution. @param A symmetric Matrix A. After execution, A will contain the eigenvectors as columns @param calculateVectors if false, it will not modify A and calculate eigenvectors @return a vector of eigenvalues L.
[ "Compute", "generalized", "eigenvalues", "of", "the", "problem", "A", "x", "=", "L", "x", ".", "Matrix", "A", "is", "modified", "in", "the", "process", "holding", "eigenvectors", "as", "columns", "after", "execution", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/eigen/Eigen.java#L55-L59
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussTopicsApi.java
GroupsDiscussTopicsApi.getList
public Topics getList(String groupId, int perPage, int page, boolean sign) throws JinxException { """ Get a list of discussion topics in a group. <br> This method does not require authentication. Unsigned requests can only see public topics. @param groupId (Required) The NSID of the group to fetch information for. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return object with topic metadata and a list of topics. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.groups.discuss.topics.getList.html">flickr.groups.discuss.topics.getList</a> """ JinxUtils.validateParams(groupId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.groups.discuss.topics.getList"); params.put("group_id", groupId); if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Topics.class, sign); }
java
public Topics getList(String groupId, int perPage, int page, boolean sign) throws JinxException { JinxUtils.validateParams(groupId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.groups.discuss.topics.getList"); params.put("group_id", groupId); if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Topics.class, sign); }
[ "public", "Topics", "getList", "(", "String", "groupId", ",", "int", "perPage", ",", "int", "page", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "groupId", ")", ";", "Map", "<", "String", ",", "Strin...
Get a list of discussion topics in a group. <br> This method does not require authentication. Unsigned requests can only see public topics. @param groupId (Required) The NSID of the group to fetch information for. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return object with topic metadata and a list of topics. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.groups.discuss.topics.getList.html">flickr.groups.discuss.topics.getList</a>
[ "Get", "a", "list", "of", "discussion", "topics", "in", "a", "group", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", ".", "Unsigned", "requests", "can", "only", "see", "public", "topics", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/GroupsDiscussTopicsApi.java#L100-L112
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java
DiscreteDistributions.uniformCdf
public static double uniformCdf(int k, int n) { """ Returns the cumulative probability of uniform @param k @param n @return """ if(k<0 || n<1) { throw new IllegalArgumentException("All the parameters must be positive and n larger than 1."); } k = Math.min(k, n); double probabilitySum = k*uniform(n); return probabilitySum; }
java
public static double uniformCdf(int k, int n) { if(k<0 || n<1) { throw new IllegalArgumentException("All the parameters must be positive and n larger than 1."); } k = Math.min(k, n); double probabilitySum = k*uniform(n); return probabilitySum; }
[ "public", "static", "double", "uniformCdf", "(", "int", "k", ",", "int", "n", ")", "{", "if", "(", "k", "<", "0", "||", "n", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All the parameters must be positive and n larger than 1.\"", ")...
Returns the cumulative probability of uniform @param k @param n @return
[ "Returns", "the", "cumulative", "probability", "of", "uniform" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/DiscreteDistributions.java#L248-L257
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/tiles/features/DefaultFeatureTiles.java
DefaultFeatureTiles.drawPolygon
private boolean drawPolygon(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, FeatureTileGraphics graphics, Polygon polygon, FeatureStyle featureStyle) { """ Draw a Polygon @param simplifyTolerance simplify tolerance in meters @param boundingBox bounding box @param transform projection transform @param graphics feature tile graphics @param polygon polygon @param featureStyle feature style @return true if drawn """ Area polygonArea = getArea(simplifyTolerance, boundingBox, transform, polygon); return drawPolygon(graphics, polygonArea, featureStyle); }
java
private boolean drawPolygon(double simplifyTolerance, BoundingBox boundingBox, ProjectionTransform transform, FeatureTileGraphics graphics, Polygon polygon, FeatureStyle featureStyle) { Area polygonArea = getArea(simplifyTolerance, boundingBox, transform, polygon); return drawPolygon(graphics, polygonArea, featureStyle); }
[ "private", "boolean", "drawPolygon", "(", "double", "simplifyTolerance", ",", "BoundingBox", "boundingBox", ",", "ProjectionTransform", "transform", ",", "FeatureTileGraphics", "graphics", ",", "Polygon", "polygon", ",", "FeatureStyle", "featureStyle", ")", "{", "Area",...
Draw a Polygon @param simplifyTolerance simplify tolerance in meters @param boundingBox bounding box @param transform projection transform @param graphics feature tile graphics @param polygon polygon @param featureStyle feature style @return true if drawn
[ "Draw", "a", "Polygon" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/tiles/features/DefaultFeatureTiles.java#L481-L488
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/DirectAnalyzer.java
DirectAnalyzer.getElementStyle
public NodeData getElementStyle(Element el, PseudoElementType pseudo, MediaSpec media) { """ Computes the style of an element with an eventual pseudo element for the given media. @param el The DOM element. @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). @param media Used media specification. @return The relevant declarations from the registered style sheets. """ final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media); return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules); }
java
public NodeData getElementStyle(Element el, PseudoElementType pseudo, MediaSpec media) { final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media); return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules); }
[ "public", "NodeData", "getElementStyle", "(", "Element", "el", ",", "PseudoElementType", "pseudo", ",", "MediaSpec", "media", ")", "{", "final", "OrderedRule", "[", "]", "applicableRules", "=", "AnalyzerUtil", ".", "getApplicableRules", "(", "sheets", ",", "el", ...
Computes the style of an element with an eventual pseudo element for the given media. @param el The DOM element. @param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after). @param media Used media specification. @return The relevant declarations from the registered style sheets.
[ "Computes", "the", "style", "of", "an", "element", "with", "an", "eventual", "pseudo", "element", "for", "the", "given", "media", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DirectAnalyzer.java#L57-L61
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java
InternalErrorSettings.setStorageFileProvider
public static void setStorageFileProvider (@Nonnull final IFunction <InternalErrorMetadata, File> aStorageFileProvider) { """ Set the provider that defines how to build the filename to save internal error files. @param aStorageFileProvider Storage provider. May not be <code>null</code> @since 8.0.3 """ ValueEnforcer.notNull (aStorageFileProvider, "StorageFileProvider"); s_aStorageFileProvider = aStorageFileProvider; }
java
public static void setStorageFileProvider (@Nonnull final IFunction <InternalErrorMetadata, File> aStorageFileProvider) { ValueEnforcer.notNull (aStorageFileProvider, "StorageFileProvider"); s_aStorageFileProvider = aStorageFileProvider; }
[ "public", "static", "void", "setStorageFileProvider", "(", "@", "Nonnull", "final", "IFunction", "<", "InternalErrorMetadata", ",", "File", ">", "aStorageFileProvider", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aStorageFileProvider", ",", "\"StorageFileProvider\"...
Set the provider that defines how to build the filename to save internal error files. @param aStorageFileProvider Storage provider. May not be <code>null</code> @since 8.0.3
[ "Set", "the", "provider", "that", "defines", "how", "to", "build", "the", "filename", "to", "save", "internal", "error", "files", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/interror/InternalErrorSettings.java#L198-L202
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.listEffectiveNetworkSecurityGroupsAsync
public Observable<EffectiveNetworkSecurityGroupListResultInner> listEffectiveNetworkSecurityGroupsAsync(String resourceGroupName, String networkInterfaceName) { """ Gets all network security groups applied to a network interface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return listEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>, EffectiveNetworkSecurityGroupListResultInner>() { @Override public EffectiveNetworkSecurityGroupListResultInner call(ServiceResponse<EffectiveNetworkSecurityGroupListResultInner> response) { return response.body(); } }); }
java
public Observable<EffectiveNetworkSecurityGroupListResultInner> listEffectiveNetworkSecurityGroupsAsync(String resourceGroupName, String networkInterfaceName) { return listEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>, EffectiveNetworkSecurityGroupListResultInner>() { @Override public EffectiveNetworkSecurityGroupListResultInner call(ServiceResponse<EffectiveNetworkSecurityGroupListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EffectiveNetworkSecurityGroupListResultInner", ">", "listEffectiveNetworkSecurityGroupsAsync", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ")", "{", "return", "listEffectiveNetworkSecurityGroupsWithServiceResponseAsync", "(...
Gets all network security groups applied to a network interface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Gets", "all", "network", "security", "groups", "applied", "to", "a", "network", "interface", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1369-L1376
virgo47/javasimon
core/src/main/java/org/javasimon/utils/SLF4JLoggingCallback.java
SLF4JLoggingCallback.onManagerWarning
@Override public void onManagerWarning(String warning, Exception cause) { """ Logs the warning on a specified log marker. @param warning warning message @param cause throwable cause """ logger.debug(marker, "SIMON WARNING: {}", warning, cause); }
java
@Override public void onManagerWarning(String warning, Exception cause) { logger.debug(marker, "SIMON WARNING: {}", warning, cause); }
[ "@", "Override", "public", "void", "onManagerWarning", "(", "String", "warning", ",", "Exception", "cause", ")", "{", "logger", ".", "debug", "(", "marker", ",", "\"SIMON WARNING: {}\"", ",", "warning", ",", "cause", ")", ";", "}" ]
Logs the warning on a specified log marker. @param warning warning message @param cause throwable cause
[ "Logs", "the", "warning", "on", "a", "specified", "log", "marker", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SLF4JLoggingCallback.java#L51-L54
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java
CollationElementIterator.setText
public void setText(String source) { """ Set a new source string for iteration, and reset the offset to the beginning of the text. @param source the new source string for iteration. """ string_ = source; // TODO: do we need to remember the source string in a field? CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new UTF16CollationIterator(rbc_.data, numeric, string_, 0); } else { newIter = new FCDUTF16CollationIterator(rbc_.data, numeric, string_, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
java
public void setText(String source) { string_ = source; // TODO: do we need to remember the source string in a field? CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new UTF16CollationIterator(rbc_.data, numeric, string_, 0); } else { newIter = new FCDUTF16CollationIterator(rbc_.data, numeric, string_, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
[ "public", "void", "setText", "(", "String", "source", ")", "{", "string_", "=", "source", ";", "// TODO: do we need to remember the source string in a field?", "CollationIterator", "newIter", ";", "boolean", "numeric", "=", "rbc_", ".", "settings", ".", "readOnly", "(...
Set a new source string for iteration, and reset the offset to the beginning of the text. @param source the new source string for iteration.
[ "Set", "a", "new", "source", "string", "for", "iteration", "and", "reset", "the", "offset", "to", "the", "beginning", "of", "the", "text", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L492-L504
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java
SarlLinkFactory.getLinkForTypeVariable
protected void getLinkForTypeVariable(Content link, LinkInfo linkInfo, Type type) { """ Build the link for the type variable. @param link the link. @param linkInfo the information on the link. @param type the type. """ link.addContent(getTypeAnnotationLinks(linkInfo)); linkInfo.isTypeBound = true; final Doc owner = type.asTypeVariable().owner(); if ((!linkInfo.excludeTypeParameterLinks) && owner instanceof ClassDoc) { linkInfo.classDoc = (ClassDoc) owner; final Content label = newContent(); label.addContent(type.typeName()); linkInfo.label = label; link.addContent(getClassLink(linkInfo)); } else { link.addContent(type.typeName()); } final Type[] bounds = type.asTypeVariable().bounds(); if (!linkInfo.excludeTypeBounds) { linkInfo.excludeTypeBounds = true; final SARLFeatureAccess kw = Utils.getKeywords(); for (int i = 0; i < bounds.length; ++i) { link.addContent(i > 0 ? " " + kw.getAmpersandKeyword() + " " //$NON-NLS-1$ //$NON-NLS-2$ : " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$ setBoundsLinkInfo(linkInfo, bounds[i]); link.addContent(getLink(linkInfo)); } } }
java
protected void getLinkForTypeVariable(Content link, LinkInfo linkInfo, Type type) { link.addContent(getTypeAnnotationLinks(linkInfo)); linkInfo.isTypeBound = true; final Doc owner = type.asTypeVariable().owner(); if ((!linkInfo.excludeTypeParameterLinks) && owner instanceof ClassDoc) { linkInfo.classDoc = (ClassDoc) owner; final Content label = newContent(); label.addContent(type.typeName()); linkInfo.label = label; link.addContent(getClassLink(linkInfo)); } else { link.addContent(type.typeName()); } final Type[] bounds = type.asTypeVariable().bounds(); if (!linkInfo.excludeTypeBounds) { linkInfo.excludeTypeBounds = true; final SARLFeatureAccess kw = Utils.getKeywords(); for (int i = 0; i < bounds.length; ++i) { link.addContent(i > 0 ? " " + kw.getAmpersandKeyword() + " " //$NON-NLS-1$ //$NON-NLS-2$ : " " + kw.getExtendsKeyword() + " "); //$NON-NLS-1$ //$NON-NLS-2$ setBoundsLinkInfo(linkInfo, bounds[i]); link.addContent(getLink(linkInfo)); } } }
[ "protected", "void", "getLinkForTypeVariable", "(", "Content", "link", ",", "LinkInfo", "linkInfo", ",", "Type", "type", ")", "{", "link", ".", "addContent", "(", "getTypeAnnotationLinks", "(", "linkInfo", ")", ")", ";", "linkInfo", ".", "isTypeBound", "=", "t...
Build the link for the type variable. @param link the link. @param linkInfo the information on the link. @param type the type.
[ "Build", "the", "link", "for", "the", "type", "variable", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/references/SarlLinkFactory.java#L114-L138
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlCapacity capacity, IExtraLanguageGeneratorContext context) { """ Generate the given object. @param capacity the capacity. @param context the context. """ final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(capacity); final PyAppendable appendable = createAppendable(jvmType, context); final List<? extends JvmTypeReference> superTypes; if (!capacity.getExtends().isEmpty()) { superTypes = capacity.getExtends(); } else { superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Capacity.class, capacity)); } if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(capacity).toString(), capacity.getName(), true, superTypes, getTypeBuilder().getDocumentation(capacity), true, capacity.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(capacity); writeFile(name, appendable, context); } }
java
protected void _generate(SarlCapacity capacity, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(capacity); final PyAppendable appendable = createAppendable(jvmType, context); final List<? extends JvmTypeReference> superTypes; if (!capacity.getExtends().isEmpty()) { superTypes = capacity.getExtends(); } else { superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Capacity.class, capacity)); } if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(capacity).toString(), capacity.getName(), true, superTypes, getTypeBuilder().getDocumentation(capacity), true, capacity.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(capacity); writeFile(name, appendable, context); } }
[ "protected", "void", "_generate", "(", "SarlCapacity", "capacity", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "JvmDeclaredType", "jvmType", "=", "getJvmModelAssociations", "(", ")", ".", "getInferredType", "(", "capacity", ")", ";", "final", ...
Generate the given object. @param capacity the capacity. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L825-L843
google/closure-templates
java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java
GenIncrementalDomCodeVisitor.generateIncrementalDomRenderCalls
private Statement generateIncrementalDomRenderCalls(TemplateNode node, String alias) { """ Generates idom#elementOpen, idom#elementClose, etc. function calls for the given node. """ IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder(); boolean isTextTemplate = isTextContent(node.getContentKind()); Statement typeChecks = genParamTypeChecks(node, alias); // Note: we do not try to combine this into a single return statement if the content is // computable as a JsExpr. A JavaScript compiler, such as Closure Compiler, is able to perform // the transformation. if (isTextTemplate) { // We do our own initialization below, so mark it as such. jsCodeBuilder.pushOutputVar("output").setOutputVarInited(); } Statement body = visitChildrenReturningCodeChunk(node); if (isTextTemplate) { VariableDeclaration declare = VariableDeclaration.builder("output").setRhs(LITERAL_EMPTY_STRING).build(); jsCodeBuilder.popOutputVar(); body = Statement.of(declare, body, returnValue(sanitize(declare.ref(), node.getContentKind()))); } return Statement.of(typeChecks, body); }
java
private Statement generateIncrementalDomRenderCalls(TemplateNode node, String alias) { IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder(); boolean isTextTemplate = isTextContent(node.getContentKind()); Statement typeChecks = genParamTypeChecks(node, alias); // Note: we do not try to combine this into a single return statement if the content is // computable as a JsExpr. A JavaScript compiler, such as Closure Compiler, is able to perform // the transformation. if (isTextTemplate) { // We do our own initialization below, so mark it as such. jsCodeBuilder.pushOutputVar("output").setOutputVarInited(); } Statement body = visitChildrenReturningCodeChunk(node); if (isTextTemplate) { VariableDeclaration declare = VariableDeclaration.builder("output").setRhs(LITERAL_EMPTY_STRING).build(); jsCodeBuilder.popOutputVar(); body = Statement.of(declare, body, returnValue(sanitize(declare.ref(), node.getContentKind()))); } return Statement.of(typeChecks, body); }
[ "private", "Statement", "generateIncrementalDomRenderCalls", "(", "TemplateNode", "node", ",", "String", "alias", ")", "{", "IncrementalDomCodeBuilder", "jsCodeBuilder", "=", "getJsCodeBuilder", "(", ")", ";", "boolean", "isTextTemplate", "=", "isTextContent", "(", "nod...
Generates idom#elementOpen, idom#elementClose, etc. function calls for the given node.
[ "Generates", "idom#elementOpen", "idom#elementClose", "etc", ".", "function", "calls", "for", "the", "given", "node", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/incrementaldomsrc/GenIncrementalDomCodeVisitor.java#L355-L377
alkacon/opencms-core
src/org/opencms/xml/CmsXmlUtils.java
CmsXmlUtils.removeLastComplexXpathElement
public static String removeLastComplexXpathElement(String path) { """ Removes the last complex Xpath element from the path.<p> The same as {@link #removeLastXpathElement(String)} both it works with more complex xpaths. <p>Example:<br> <code>system/backup[@date='23/10/2003']/resource[path='/a/b/c']</code> becomes <code>system/backup[@date='23/10/2003']</code><p> @param path the Xpath to remove the last element from @return the path with the last element removed """ int pos = path.lastIndexOf('/'); if (pos < 0) { return path; } // count ' chars int p = pos; int count = -1; while (p > 0) { count++; p = path.indexOf("\'", p + 1); } String parentPath = path.substring(0, pos); if ((count % 2) == 0) { // if substring is complete return parentPath; } // if not complete p = parentPath.lastIndexOf("'"); if (p >= 0) { // complete it if possible return removeLastComplexXpathElement(parentPath.substring(0, p)); } return parentPath; }
java
public static String removeLastComplexXpathElement(String path) { int pos = path.lastIndexOf('/'); if (pos < 0) { return path; } // count ' chars int p = pos; int count = -1; while (p > 0) { count++; p = path.indexOf("\'", p + 1); } String parentPath = path.substring(0, pos); if ((count % 2) == 0) { // if substring is complete return parentPath; } // if not complete p = parentPath.lastIndexOf("'"); if (p >= 0) { // complete it if possible return removeLastComplexXpathElement(parentPath.substring(0, p)); } return parentPath; }
[ "public", "static", "String", "removeLastComplexXpathElement", "(", "String", "path", ")", "{", "int", "pos", "=", "path", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "pos", "<", "0", ")", "{", "return", "path", ";", "}", "// count ' chars", ...
Removes the last complex Xpath element from the path.<p> The same as {@link #removeLastXpathElement(String)} both it works with more complex xpaths. <p>Example:<br> <code>system/backup[@date='23/10/2003']/resource[path='/a/b/c']</code> becomes <code>system/backup[@date='23/10/2003']</code><p> @param path the Xpath to remove the last element from @return the path with the last element removed
[ "Removes", "the", "last", "complex", "Xpath", "element", "from", "the", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlUtils.java#L534-L559
indeedeng/util
io/src/main/java/com/indeed/util/io/Files.java
Files.isChanged
private static boolean isChanged(final byte[] bytes, final int length, final String filepath) throws IOException { """ Returns true iff the bytes in an array are different from the bytes contained in the given file, or if the file does not exist. """ Preconditions.checkArgument(length >= 0, "invalid length value: %s", length); Preconditions.checkArgument(bytes.length >= length, "invalid length value: %s", length); File file = new File(filepath); if (!file.exists()) { return true; } if (file.length() != length) { return true; } final int BUFLEN = 1048576; // 1 megabyte byte[] buffer = new byte[BUFLEN]; InputStream is = new FileInputStream(file); try { int len; for (int offset = 0; ; offset += len) { len = is.read(buffer); if (len < 0) break; // eof if (!arrayCompare(bytes, offset, buffer, 0, len)) return true; } return false; } finally { is.close(); } }
java
private static boolean isChanged(final byte[] bytes, final int length, final String filepath) throws IOException { Preconditions.checkArgument(length >= 0, "invalid length value: %s", length); Preconditions.checkArgument(bytes.length >= length, "invalid length value: %s", length); File file = new File(filepath); if (!file.exists()) { return true; } if (file.length() != length) { return true; } final int BUFLEN = 1048576; // 1 megabyte byte[] buffer = new byte[BUFLEN]; InputStream is = new FileInputStream(file); try { int len; for (int offset = 0; ; offset += len) { len = is.read(buffer); if (len < 0) break; // eof if (!arrayCompare(bytes, offset, buffer, 0, len)) return true; } return false; } finally { is.close(); } }
[ "private", "static", "boolean", "isChanged", "(", "final", "byte", "[", "]", "bytes", ",", "final", "int", "length", ",", "final", "String", "filepath", ")", "throws", "IOException", "{", "Preconditions", ".", "checkArgument", "(", "length", ">=", "0", ",", ...
Returns true iff the bytes in an array are different from the bytes contained in the given file, or if the file does not exist.
[ "Returns", "true", "iff", "the", "bytes", "in", "an", "array", "are", "different", "from", "the", "bytes", "contained", "in", "the", "given", "file", "or", "if", "the", "file", "does", "not", "exist", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L376-L401
azkaban/azkaban
az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java
ValidationUtils.validateAllOrNone
public static void validateAllOrNone(Props props, String... keys) { """ Validates if all of the keys exist of none of them exist @throws IllegalArgumentException only if some of the keys exist """ Objects.requireNonNull(keys); boolean allExist = true; boolean someExist = false; for (String key : keys) { Object val = props.get(key); allExist &= val != null; someExist |= val != null; } if (someExist && !allExist) { throw new IllegalArgumentException( "Either all of properties exist or none of them should exist for " + Arrays .toString(keys)); } }
java
public static void validateAllOrNone(Props props, String... keys) { Objects.requireNonNull(keys); boolean allExist = true; boolean someExist = false; for (String key : keys) { Object val = props.get(key); allExist &= val != null; someExist |= val != null; } if (someExist && !allExist) { throw new IllegalArgumentException( "Either all of properties exist or none of them should exist for " + Arrays .toString(keys)); } }
[ "public", "static", "void", "validateAllOrNone", "(", "Props", "props", ",", "String", "...", "keys", ")", "{", "Objects", ".", "requireNonNull", "(", "keys", ")", ";", "boolean", "allExist", "=", "true", ";", "boolean", "someExist", "=", "false", ";", "fo...
Validates if all of the keys exist of none of them exist @throws IllegalArgumentException only if some of the keys exist
[ "Validates", "if", "all", "of", "the", "keys", "exist", "of", "none", "of", "them", "exist" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java#L38-L54
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ResourceCopy.java
ResourceCopy.copyFileToDir
public static void copyFileToDir(File file, File rel, File dir, AbstractWisdomMojo mojo, MavenResourcesFiltering filtering, Properties additionalProperties) throws IOException { """ Copies the file <tt>file</tt> to the directory <tt>dir</tt>, keeping the structure relative to <tt>rel</tt>. @param file the file to copy @param rel the base 'relative' @param dir the directory @param mojo the mojo @param filtering the filtering component @param additionalProperties additional properties @throws IOException if the file cannot be copied. """ if (filtering == null) { File out = computeRelativeFile(file, rel, dir); if (out.getParentFile() != null) { mojo.getLog().debug("Creating " + out.getParentFile() + " : " + out.getParentFile().mkdirs()); FileUtils.copyFileToDirectory(file, out.getParentFile()); } else { throw new IOException("Cannot copy file - parent directory not accessible for " + file.getAbsolutePath()); } } else { Resource resource = new Resource(); resource.setDirectory(rel.getAbsolutePath()); resource.setFiltering(true); resource.setTargetPath(dir.getAbsolutePath()); resource.setIncludes(ImmutableList.of("**/" + file.getName())); List<String> excludedExtensions = new ArrayList<>(); excludedExtensions.addAll(filtering.getDefaultNonFilteredFileExtensions()); excludedExtensions.addAll(NON_FILTERED_EXTENSIONS); MavenResourcesExecution exec = new MavenResourcesExecution(ImmutableList.of(resource), dir, mojo.project, "UTF-8", Collections.<String>emptyList(), excludedExtensions, mojo.session); if (additionalProperties != null) { exec.setAdditionalProperties(additionalProperties); } exec.setEscapeString("\\"); try { filtering.filterResources(exec); } catch (MavenFilteringException e) { throw new IOException("Error while copying resources", e); } } }
java
public static void copyFileToDir(File file, File rel, File dir, AbstractWisdomMojo mojo, MavenResourcesFiltering filtering, Properties additionalProperties) throws IOException { if (filtering == null) { File out = computeRelativeFile(file, rel, dir); if (out.getParentFile() != null) { mojo.getLog().debug("Creating " + out.getParentFile() + " : " + out.getParentFile().mkdirs()); FileUtils.copyFileToDirectory(file, out.getParentFile()); } else { throw new IOException("Cannot copy file - parent directory not accessible for " + file.getAbsolutePath()); } } else { Resource resource = new Resource(); resource.setDirectory(rel.getAbsolutePath()); resource.setFiltering(true); resource.setTargetPath(dir.getAbsolutePath()); resource.setIncludes(ImmutableList.of("**/" + file.getName())); List<String> excludedExtensions = new ArrayList<>(); excludedExtensions.addAll(filtering.getDefaultNonFilteredFileExtensions()); excludedExtensions.addAll(NON_FILTERED_EXTENSIONS); MavenResourcesExecution exec = new MavenResourcesExecution(ImmutableList.of(resource), dir, mojo.project, "UTF-8", Collections.<String>emptyList(), excludedExtensions, mojo.session); if (additionalProperties != null) { exec.setAdditionalProperties(additionalProperties); } exec.setEscapeString("\\"); try { filtering.filterResources(exec); } catch (MavenFilteringException e) { throw new IOException("Error while copying resources", e); } } }
[ "public", "static", "void", "copyFileToDir", "(", "File", "file", ",", "File", "rel", ",", "File", "dir", ",", "AbstractWisdomMojo", "mojo", ",", "MavenResourcesFiltering", "filtering", ",", "Properties", "additionalProperties", ")", "throws", "IOException", "{", ...
Copies the file <tt>file</tt> to the directory <tt>dir</tt>, keeping the structure relative to <tt>rel</tt>. @param file the file to copy @param rel the base 'relative' @param dir the directory @param mojo the mojo @param filtering the filtering component @param additionalProperties additional properties @throws IOException if the file cannot be copied.
[ "Copies", "the", "file", "<tt", ">", "file<", "/", "tt", ">", "to", "the", "directory", "<tt", ">", "dir<", "/", "tt", ">", "keeping", "the", "structure", "relative", "to", "<tt", ">", "rel<", "/", "tt", ">", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/ResourceCopy.java#L126-L163
ACRA/acra
acra-mail/src/main/java/org/acra/sender/EmailIntentSender.java
EmailIntentSender.buildAttachmentIntent
@NonNull protected Intent buildAttachmentIntent(@NonNull String subject, @Nullable String body, @NonNull ArrayList<Uri> attachments) { """ Builds an email intent with attachments @param subject the message subject @param body the message body @param attachments the attachments @return email intent """ final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{mailConfig.mailTo()}); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.setType("message/rfc822"); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
java
@NonNull protected Intent buildAttachmentIntent(@NonNull String subject, @Nullable String body, @NonNull ArrayList<Uri> attachments) { final Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{mailConfig.mailTo()}); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.setType("message/rfc822"); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
[ "@", "NonNull", "protected", "Intent", "buildAttachmentIntent", "(", "@", "NonNull", "String", "subject", ",", "@", "Nullable", "String", "body", ",", "@", "NonNull", "ArrayList", "<", "Uri", ">", "attachments", ")", "{", "final", "Intent", "intent", "=", "n...
Builds an email intent with attachments @param subject the message subject @param body the message body @param attachments the attachments @return email intent
[ "Builds", "an", "email", "intent", "with", "attachments" ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-mail/src/main/java/org/acra/sender/EmailIntentSender.java#L142-L152
GoogleCloudPlatform/appengine-plugins-core
src/main/java/com/google/cloud/tools/managedcloudsdk/command/CommandCaller.java
CommandCaller.call
public String call( List<String> command, @Nullable Path workingDirectory, @Nullable Map<String, String> environment) throws CommandExitException, CommandExecutionException, InterruptedException { """ Runs the command and returns process's stdout stream as a string. """ ProcessExecutor processExecutor = processExecutorFactory.newProcessExecutor(); AsyncStreamSaver stdOutSaver = streamSaverFactory.newSaver(); AsyncStreamSaver stdErrSaver = streamSaverFactory.newSaver(); try { int exitCode = processExecutor.run(command, workingDirectory, environment, stdOutSaver, stdErrSaver); if (exitCode != 0) { String stdOut; String stdErr; try { stdOut = stdOutSaver.getResult().get(); } catch (InterruptedException ignored) { stdOut = "stdout collection interrupted"; } try { stdErr = stdErrSaver.getResult().get(); } catch (InterruptedException ignored) { stdErr = "stderr collection interrupted"; } throw new CommandExitException(exitCode, stdOut + "\n" + stdErr); } return stdOutSaver.getResult().get(); } catch (IOException | ExecutionException ex) { throw new CommandExecutionException(ex); } }
java
public String call( List<String> command, @Nullable Path workingDirectory, @Nullable Map<String, String> environment) throws CommandExitException, CommandExecutionException, InterruptedException { ProcessExecutor processExecutor = processExecutorFactory.newProcessExecutor(); AsyncStreamSaver stdOutSaver = streamSaverFactory.newSaver(); AsyncStreamSaver stdErrSaver = streamSaverFactory.newSaver(); try { int exitCode = processExecutor.run(command, workingDirectory, environment, stdOutSaver, stdErrSaver); if (exitCode != 0) { String stdOut; String stdErr; try { stdOut = stdOutSaver.getResult().get(); } catch (InterruptedException ignored) { stdOut = "stdout collection interrupted"; } try { stdErr = stdErrSaver.getResult().get(); } catch (InterruptedException ignored) { stdErr = "stderr collection interrupted"; } throw new CommandExitException(exitCode, stdOut + "\n" + stdErr); } return stdOutSaver.getResult().get(); } catch (IOException | ExecutionException ex) { throw new CommandExecutionException(ex); } }
[ "public", "String", "call", "(", "List", "<", "String", ">", "command", ",", "@", "Nullable", "Path", "workingDirectory", ",", "@", "Nullable", "Map", "<", "String", ",", "String", ">", "environment", ")", "throws", "CommandExitException", ",", "CommandExecuti...
Runs the command and returns process's stdout stream as a string.
[ "Runs", "the", "command", "and", "returns", "process", "s", "stdout", "stream", "as", "a", "string", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/managedcloudsdk/command/CommandCaller.java#L42-L74
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java
LibraryLoader.loadPlatformDependentLibrary
public static void loadPlatformDependentLibrary(String path, String libname) throws IOException { """ Search and load the dynamic library which is fitting the current operating system (32 or 64bits operating system...). A 64 bits library is assumed to be named <code>libname64.dll</code> on Windows&reg; and <code>liblibname64.so</code> on Unix. A 32 bits library is assumed to be named <code>libname32.dll</code> on Windows&reg; and <code>liblibname32.so</code> on Unix. A library which could be ran either on 32 and 64 platforms is assumed to be named <code>libname.dll</code> on Windows&reg; and <code>liblibname.so</code> on Unix. @param path is the resource's path where the library was located. @param libname is the name of the library. @throws IOException when reading error occurs. @throws SecurityException if a security manager exists and its <code>checkLink</code> method doesn't allow loading of the specified dynamic library @throws UnsatisfiedLinkError if the file does not exist. @throws NullPointerException if <code>filename</code> is <code>null</code> @see java.lang.System#load(java.lang.String) """ loadPlatformDependentLibrary(libname, null, path); }
java
public static void loadPlatformDependentLibrary(String path, String libname) throws IOException { loadPlatformDependentLibrary(libname, null, path); }
[ "public", "static", "void", "loadPlatformDependentLibrary", "(", "String", "path", ",", "String", "libname", ")", "throws", "IOException", "{", "loadPlatformDependentLibrary", "(", "libname", ",", "null", ",", "path", ")", ";", "}" ]
Search and load the dynamic library which is fitting the current operating system (32 or 64bits operating system...). A 64 bits library is assumed to be named <code>libname64.dll</code> on Windows&reg; and <code>liblibname64.so</code> on Unix. A 32 bits library is assumed to be named <code>libname32.dll</code> on Windows&reg; and <code>liblibname32.so</code> on Unix. A library which could be ran either on 32 and 64 platforms is assumed to be named <code>libname.dll</code> on Windows&reg; and <code>liblibname.so</code> on Unix. @param path is the resource's path where the library was located. @param libname is the name of the library. @throws IOException when reading error occurs. @throws SecurityException if a security manager exists and its <code>checkLink</code> method doesn't allow loading of the specified dynamic library @throws UnsatisfiedLinkError if the file does not exist. @throws NullPointerException if <code>filename</code> is <code>null</code> @see java.lang.System#load(java.lang.String)
[ "Search", "and", "load", "the", "dynamic", "library", "which", "is", "fitting", "the", "current", "operating", "system", "(", "32", "or", "64bits", "operating", "system", "...", ")", ".", "A", "64", "bits", "library", "is", "assumed", "to", "be", "named", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java#L388-L390
apereo/cas
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/JaasAuthenticationHandler.java
JaasAuthenticationHandler.getLoginContext
protected LoginContext getLoginContext(final UsernamePasswordCredential credential) throws GeneralSecurityException { """ Gets login context. @param credential the credential @return the login context @throws GeneralSecurityException the general security exception """ val callbackHandler = new UsernamePasswordCallbackHandler(credential.getUsername(), credential.getPassword()); if (this.loginConfigurationFile != null && StringUtils.isNotBlank(this.loginConfigType) && this.loginConfigurationFile.exists() && this.loginConfigurationFile.canRead()) { final Configuration.Parameters parameters = new URIParameter(loginConfigurationFile.toURI()); val loginConfig = Configuration.getInstance(this.loginConfigType, parameters); return new LoginContext(this.realm, null, callbackHandler, loginConfig); } return new LoginContext(this.realm, callbackHandler); }
java
protected LoginContext getLoginContext(final UsernamePasswordCredential credential) throws GeneralSecurityException { val callbackHandler = new UsernamePasswordCallbackHandler(credential.getUsername(), credential.getPassword()); if (this.loginConfigurationFile != null && StringUtils.isNotBlank(this.loginConfigType) && this.loginConfigurationFile.exists() && this.loginConfigurationFile.canRead()) { final Configuration.Parameters parameters = new URIParameter(loginConfigurationFile.toURI()); val loginConfig = Configuration.getInstance(this.loginConfigType, parameters); return new LoginContext(this.realm, null, callbackHandler, loginConfig); } return new LoginContext(this.realm, callbackHandler); }
[ "protected", "LoginContext", "getLoginContext", "(", "final", "UsernamePasswordCredential", "credential", ")", "throws", "GeneralSecurityException", "{", "val", "callbackHandler", "=", "new", "UsernamePasswordCallbackHandler", "(", "credential", ".", "getUsername", "(", ")"...
Gets login context. @param credential the credential @return the login context @throws GeneralSecurityException the general security exception
[ "Gets", "login", "context", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/handler/support/jaas/JaasAuthenticationHandler.java#L166-L175
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java
WebhookCluster.buildWebhook
public WebhookCluster buildWebhook(long id, String token) { """ Creates new {@link net.dv8tion.jda.webhook.WebhookClient WebhookClients} and adds them to this cluster. <br>The {@link net.dv8tion.jda.webhook.WebhookClientBuilder WebhookClientBuilders} will be supplied with the default settings of this cluster. @param id The id for the webhook @param token The token for the webhook @throws java.lang.IllegalArgumentException If the provided webhooks token is {@code null} or contains whitespace @return The current WebhookCluster for chaining convenience @see #newBuilder(long, String) """ this.webhooks.add(newBuilder(id, token).build()); return this; }
java
public WebhookCluster buildWebhook(long id, String token) { this.webhooks.add(newBuilder(id, token).build()); return this; }
[ "public", "WebhookCluster", "buildWebhook", "(", "long", "id", ",", "String", "token", ")", "{", "this", ".", "webhooks", ".", "add", "(", "newBuilder", "(", "id", ",", "token", ")", ".", "build", "(", ")", ")", ";", "return", "this", ";", "}" ]
Creates new {@link net.dv8tion.jda.webhook.WebhookClient WebhookClients} and adds them to this cluster. <br>The {@link net.dv8tion.jda.webhook.WebhookClientBuilder WebhookClientBuilders} will be supplied with the default settings of this cluster. @param id The id for the webhook @param token The token for the webhook @throws java.lang.IllegalArgumentException If the provided webhooks token is {@code null} or contains whitespace @return The current WebhookCluster for chaining convenience @see #newBuilder(long, String)
[ "Creates", "new", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "webhook", ".", "WebhookClient", "WebhookClients", "}", "and", "adds", "them", "to", "this", "cluster", ".", "<br", ">", "The", "{", "@link", "net", ".", "dv8tion", ".", "jda", "."...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/webhook/WebhookCluster.java#L303-L307
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/PHPSimilarText.java
PHPSimilarText.similarityPercentage
public static double similarityPercentage(String txt1, String txt2) { """ Checks the similarity of two strings and returns their similarity percentage. @param txt1 @param txt2 @return """ double sim = similarityChars(txt1, txt2); return sim * 200.0 / (txt1.length() + txt2.length()); }
java
public static double similarityPercentage(String txt1, String txt2) { double sim = similarityChars(txt1, txt2); return sim * 200.0 / (txt1.length() + txt2.length()); }
[ "public", "static", "double", "similarityPercentage", "(", "String", "txt1", ",", "String", "txt2", ")", "{", "double", "sim", "=", "similarityChars", "(", "txt1", ",", "txt2", ")", ";", "return", "sim", "*", "200.0", "/", "(", "txt1", ".", "length", "("...
Checks the similarity of two strings and returns their similarity percentage. @param txt1 @param txt2 @return
[ "Checks", "the", "similarity", "of", "two", "strings", "and", "returns", "their", "similarity", "percentage", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/text/analyzers/PHPSimilarText.java#L79-L82
aws/aws-sdk-java
aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/CreateFunctionRequest.java
CreateFunctionRequest.getLayers
public java.util.List<String> getLayers() { """ <p> A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">function layers</a> to add to the function's execution environment. Specify each layer by its ARN, including the version. </p> @return A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">function layers</a> to add to the function's execution environment. Specify each layer by its ARN, including the version. """ if (layers == null) { layers = new com.amazonaws.internal.SdkInternalList<String>(); } return layers; }
java
public java.util.List<String> getLayers() { if (layers == null) { layers = new com.amazonaws.internal.SdkInternalList<String>(); } return layers; }
[ "public", "java", ".", "util", ".", "List", "<", "String", ">", "getLayers", "(", ")", "{", "if", "(", "layers", "==", "null", ")", "{", "layers", "=", "new", "com", ".", "amazonaws", ".", "internal", ".", "SdkInternalList", "<", "String", ">", "(", ...
<p> A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">function layers</a> to add to the function's execution environment. Specify each layer by its ARN, including the version. </p> @return A list of <a href="https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html">function layers</a> to add to the function's execution environment. Specify each layer by its ARN, including the version.
[ "<p", ">", "A", "list", "of", "<a", "href", "=", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "lambda", "/", "latest", "/", "dg", "/", "configuration", "-", "layers", ".", "html", ">", "function", "layers<", "/", "a", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/CreateFunctionRequest.java#L1057-L1062
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.findByCPDefinitionId
@Override public List<CPDefinitionLink> findByCPDefinitionId(long CPDefinitionId, int start, int end) { """ Returns a range of all the cp definition links where CPDefinitionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionLinkModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param start the lower bound of the range of cp definition links @param end the upper bound of the range of cp definition links (not inclusive) @return the range of matching cp definition links """ return findByCPDefinitionId(CPDefinitionId, start, end, null); }
java
@Override public List<CPDefinitionLink> findByCPDefinitionId(long CPDefinitionId, int start, int end) { return findByCPDefinitionId(CPDefinitionId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionLink", ">", "findByCPDefinitionId", "(", "long", "CPDefinitionId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPDefinitionId", "(", "CPDefinitionId", ",", "start", ",", "end", ",", "n...
Returns a range of all the cp definition links where CPDefinitionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionLinkModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param start the lower bound of the range of cp definition links @param end the upper bound of the range of cp definition links (not inclusive) @return the range of matching cp definition links
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "links", "where", "CPDefinitionId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L1533-L1537
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java
SSLConfigManager.registerSSLConfigChangeListener
public synchronized void registerSSLConfigChangeListener(SSLConfigChangeListener listener, SSLConfigChangeEvent event) { """ * This method is called by JSSEHelper to register new listeners for config changes. Notifications get sent when the config changes or gets deleted. @param listener @param event * """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "registerSSLConfigChangeListener", new Object[] { listener, event }); List<SSLConfigChangeListener> listenerList = sslConfigListenerMap.get(event.getAlias()); if (listenerList != null) { // used to hold sslconfig -> list of listener references listenerList.add(listener); sslConfigListenerMap.put(event.getAlias(), listenerList); } else { listenerList = new ArrayList<SSLConfigChangeListener>(); listenerList.add(listener); sslConfigListenerMap.put(event.getAlias(), listenerList); } // used to hold listener -> listener event references sslConfigListenerEventMap.put(listener, event); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "registerSSLConfigChangeListener"); }
java
public synchronized void registerSSLConfigChangeListener(SSLConfigChangeListener listener, SSLConfigChangeEvent event) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "registerSSLConfigChangeListener", new Object[] { listener, event }); List<SSLConfigChangeListener> listenerList = sslConfigListenerMap.get(event.getAlias()); if (listenerList != null) { // used to hold sslconfig -> list of listener references listenerList.add(listener); sslConfigListenerMap.put(event.getAlias(), listenerList); } else { listenerList = new ArrayList<SSLConfigChangeListener>(); listenerList.add(listener); sslConfigListenerMap.put(event.getAlias(), listenerList); } // used to hold listener -> listener event references sslConfigListenerEventMap.put(listener, event); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "registerSSLConfigChangeListener"); }
[ "public", "synchronized", "void", "registerSSLConfigChangeListener", "(", "SSLConfigChangeListener", "listener", ",", "SSLConfigChangeEvent", "event", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ...
* This method is called by JSSEHelper to register new listeners for config changes. Notifications get sent when the config changes or gets deleted. @param listener @param event *
[ "*", "This", "method", "is", "called", "by", "JSSEHelper", "to", "register", "new", "listeners", "for", "config", "changes", ".", "Notifications", "get", "sent", "when", "the", "config", "changes", "or", "gets", "deleted", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L1494-L1515
inloop/easygcm
easygcm-lib/src/main/java/eu/inloop/easygcm/GcmServicesHandler.java
GcmServicesHandler.onPlayServicesUnavailable
protected void onPlayServicesUnavailable(Activity context, int errorCode, boolean recoverable) { """ Check the device to make sure it has the Google Play Services APK. If it doesn't, display a dialog that allows users to download the APK from the Google Play Store or enable it in the device's system settings. """ GoogleApiAvailability.getInstance().getErrorDialog(context, errorCode, PLAY_SERVICES_RESOLUTION_REQUEST).show(); EasyGcm.Logger.d("This device is not supported. Error code " + errorCode + " Recoverable - " + recoverable); }
java
protected void onPlayServicesUnavailable(Activity context, int errorCode, boolean recoverable) { GoogleApiAvailability.getInstance().getErrorDialog(context, errorCode, PLAY_SERVICES_RESOLUTION_REQUEST).show(); EasyGcm.Logger.d("This device is not supported. Error code " + errorCode + " Recoverable - " + recoverable); }
[ "protected", "void", "onPlayServicesUnavailable", "(", "Activity", "context", ",", "int", "errorCode", ",", "boolean", "recoverable", ")", "{", "GoogleApiAvailability", ".", "getInstance", "(", ")", ".", "getErrorDialog", "(", "context", ",", "errorCode", ",", "PL...
Check the device to make sure it has the Google Play Services APK. If it doesn't, display a dialog that allows users to download the APK from the Google Play Store or enable it in the device's system settings.
[ "Check", "the", "device", "to", "make", "sure", "it", "has", "the", "Google", "Play", "Services", "APK", ".", "If", "it", "doesn", "t", "display", "a", "dialog", "that", "allows", "users", "to", "download", "the", "APK", "from", "the", "Google", "Play", ...
train
https://github.com/inloop/easygcm/blob/d06bbff11e52b956c3a7b1a2dc4f9799f20cf2c6/easygcm-lib/src/main/java/eu/inloop/easygcm/GcmServicesHandler.java#L16-L19
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java
DateUtils.fromISODateString
public static Date fromISODateString(String isoFormattedDate) throws com.fasterxml.jackson.databind.exc.InvalidFormatException { """ Converts an ISO formatted Date String to a Java Date ISO format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z' @param isoFormattedDate @return Date @throws com.fasterxml.jackson.databind.exc.InvalidFormatException """ SimpleDateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); // set UTC time zone - 'Z' indicates it isoDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); try { return isoDateFormat.parse(isoFormattedDate); } catch (ParseException e) { throw new InvalidFormatException("Error parsing as date", isoFormattedDate, Date.class); } }
java
public static Date fromISODateString(String isoFormattedDate) throws com.fasterxml.jackson.databind.exc.InvalidFormatException { SimpleDateFormat isoDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); // set UTC time zone - 'Z' indicates it isoDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); try { return isoDateFormat.parse(isoFormattedDate); } catch (ParseException e) { throw new InvalidFormatException("Error parsing as date", isoFormattedDate, Date.class); } }
[ "public", "static", "Date", "fromISODateString", "(", "String", "isoFormattedDate", ")", "throws", "com", ".", "fasterxml", ".", "jackson", ".", "databind", ".", "exc", ".", "InvalidFormatException", "{", "SimpleDateFormat", "isoDateFormat", "=", "new", "SimpleDateF...
Converts an ISO formatted Date String to a Java Date ISO format: yyyy-MM-dd'T'HH:mm:ss.SSS'Z' @param isoFormattedDate @return Date @throws com.fasterxml.jackson.databind.exc.InvalidFormatException
[ "Converts", "an", "ISO", "formatted", "Date", "String", "to", "a", "Java", "Date", "ISO", "format", ":", "yyyy", "-", "MM", "-", "dd", "T", "HH", ":", "mm", ":", "ss", ".", "SSS", "Z" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java#L53-L64
ppiastucki/recast4j
detour/src/main/java/org/recast4j/detour/NavMesh.java
NavMesh.getPolyRefBase
public long getPolyRefBase(MeshTile tile) { """ Gets the polygon reference for the tile's base polygon. @param tile The tile. @return The polygon reference for the base polygon in the specified tile. """ if (tile == null) { return 0; } int it = tile.index; return encodePolyId(tile.salt, it, 0); }
java
public long getPolyRefBase(MeshTile tile) { if (tile == null) { return 0; } int it = tile.index; return encodePolyId(tile.salt, it, 0); }
[ "public", "long", "getPolyRefBase", "(", "MeshTile", "tile", ")", "{", "if", "(", "tile", "==", "null", ")", "{", "return", "0", ";", "}", "int", "it", "=", "tile", ".", "index", ";", "return", "encodePolyId", "(", "tile", ".", "salt", ",", "it", "...
Gets the polygon reference for the tile's base polygon. @param tile The tile. @return The polygon reference for the base polygon in the specified tile.
[ "Gets", "the", "polygon", "reference", "for", "the", "tile", "s", "base", "polygon", "." ]
train
https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMesh.java#L104-L110