repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java
NativeLibraryLoader.extractToTemp
private File extractToTemp(InputStream _fileToExtract, String _tmpName, String _fileSuffix) throws IOException { """ Extract the file behind InputStream _fileToExtract to the tmp-folder. @param _fileToExtract InputStream with file to extract @param _tmpName temp file name @param _fileSuffix temp file suffix @return temp file object @throws IOException on any error """ if (_fileToExtract == null) { throw new IOException("Null stream"); } File tempFile = File.createTempFile(_tmpName, _fileSuffix); tempFile.deleteOnExit(); if (!tempFile.exists()) { throw new FileNotFoundException("File " + tempFile.getAbsolutePath() + " could not be created"); } byte[] buffer = new byte[1024]; int readBytes; OutputStream os = new FileOutputStream(tempFile); try { while ((readBytes = _fileToExtract.read(buffer)) != -1) { os.write(buffer, 0, readBytes); } } finally { os.close(); _fileToExtract.close(); } return tempFile; }
java
private File extractToTemp(InputStream _fileToExtract, String _tmpName, String _fileSuffix) throws IOException { if (_fileToExtract == null) { throw new IOException("Null stream"); } File tempFile = File.createTempFile(_tmpName, _fileSuffix); tempFile.deleteOnExit(); if (!tempFile.exists()) { throw new FileNotFoundException("File " + tempFile.getAbsolutePath() + " could not be created"); } byte[] buffer = new byte[1024]; int readBytes; OutputStream os = new FileOutputStream(tempFile); try { while ((readBytes = _fileToExtract.read(buffer)) != -1) { os.write(buffer, 0, readBytes); } } finally { os.close(); _fileToExtract.close(); } return tempFile; }
[ "private", "File", "extractToTemp", "(", "InputStream", "_fileToExtract", ",", "String", "_tmpName", ",", "String", "_fileSuffix", ")", "throws", "IOException", "{", "if", "(", "_fileToExtract", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Null stream\"", ")", ";", "}", "File", "tempFile", "=", "File", ".", "createTempFile", "(", "_tmpName", ",", "_fileSuffix", ")", ";", "tempFile", ".", "deleteOnExit", "(", ")", ";", "if", "(", "!", "tempFile", ".", "exists", "(", ")", ")", "{", "throw", "new", "FileNotFoundException", "(", "\"File \"", "+", "tempFile", ".", "getAbsolutePath", "(", ")", "+", "\" could not be created\"", ")", ";", "}", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "1024", "]", ";", "int", "readBytes", ";", "OutputStream", "os", "=", "new", "FileOutputStream", "(", "tempFile", ")", ";", "try", "{", "while", "(", "(", "readBytes", "=", "_fileToExtract", ".", "read", "(", "buffer", ")", ")", "!=", "-", "1", ")", "{", "os", ".", "write", "(", "buffer", ",", "0", ",", "readBytes", ")", ";", "}", "}", "finally", "{", "os", ".", "close", "(", ")", ";", "_fileToExtract", ".", "close", "(", ")", ";", "}", "return", "tempFile", ";", "}" ]
Extract the file behind InputStream _fileToExtract to the tmp-folder. @param _fileToExtract InputStream with file to extract @param _tmpName temp file name @param _fileSuffix temp file suffix @return temp file object @throws IOException on any error
[ "Extract", "the", "file", "behind", "InputStream", "_fileToExtract", "to", "the", "tmp", "-", "folder", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java#L235-L259
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/js/JSMarshaller.java
JSMarshaller.javaScriptEscapeForRegEx
@Nullable public static String javaScriptEscapeForRegEx (@Nullable final String sInput) { """ Turn special regular expression characters into escaped characters conforming to JavaScript.<br> Reference: <a href= "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions" >MDN Regular Expressions</a> @param sInput the input string @return the escaped string """ if (StringHelper.hasNoText (sInput)) return sInput; final char [] aInput = sInput.toCharArray (); if (!StringHelper.containsAny (aInput, CHARS_TO_MASK_REGEX)) return sInput; // At last each character has one masking character final char [] ret = new char [aInput.length * 2]; int nIndex = 0; for (final char cCurrent : aInput) if (ArrayHelper.contains (CHARS_TO_MASK_REGEX, cCurrent)) { ret[nIndex++] = MASK_CHAR_REGEX; ret[nIndex++] = cCurrent; } else ret[nIndex++] = cCurrent; return new String (ret, 0, nIndex); }
java
@Nullable public static String javaScriptEscapeForRegEx (@Nullable final String sInput) { if (StringHelper.hasNoText (sInput)) return sInput; final char [] aInput = sInput.toCharArray (); if (!StringHelper.containsAny (aInput, CHARS_TO_MASK_REGEX)) return sInput; // At last each character has one masking character final char [] ret = new char [aInput.length * 2]; int nIndex = 0; for (final char cCurrent : aInput) if (ArrayHelper.contains (CHARS_TO_MASK_REGEX, cCurrent)) { ret[nIndex++] = MASK_CHAR_REGEX; ret[nIndex++] = cCurrent; } else ret[nIndex++] = cCurrent; return new String (ret, 0, nIndex); }
[ "@", "Nullable", "public", "static", "String", "javaScriptEscapeForRegEx", "(", "@", "Nullable", "final", "String", "sInput", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sInput", ")", ")", "return", "sInput", ";", "final", "char", "[", "]", "aInput", "=", "sInput", ".", "toCharArray", "(", ")", ";", "if", "(", "!", "StringHelper", ".", "containsAny", "(", "aInput", ",", "CHARS_TO_MASK_REGEX", ")", ")", "return", "sInput", ";", "// At last each character has one masking character", "final", "char", "[", "]", "ret", "=", "new", "char", "[", "aInput", ".", "length", "*", "2", "]", ";", "int", "nIndex", "=", "0", ";", "for", "(", "final", "char", "cCurrent", ":", "aInput", ")", "if", "(", "ArrayHelper", ".", "contains", "(", "CHARS_TO_MASK_REGEX", ",", "cCurrent", ")", ")", "{", "ret", "[", "nIndex", "++", "]", "=", "MASK_CHAR_REGEX", ";", "ret", "[", "nIndex", "++", "]", "=", "cCurrent", ";", "}", "else", "ret", "[", "nIndex", "++", "]", "=", "cCurrent", ";", "return", "new", "String", "(", "ret", ",", "0", ",", "nIndex", ")", ";", "}" ]
Turn special regular expression characters into escaped characters conforming to JavaScript.<br> Reference: <a href= "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions" >MDN Regular Expressions</a> @param sInput the input string @return the escaped string
[ "Turn", "special", "regular", "expression", "characters", "into", "escaped", "characters", "conforming", "to", "JavaScript", ".", "<br", ">", "Reference", ":", "<a", "href", "=", "https", ":", "//", "developer", ".", "mozilla", ".", "org", "/", "en", "-", "US", "/", "docs", "/", "Web", "/", "JavaScript", "/", "Guide", "/", "Regular_Expressions", ">", "MDN", "Regular", "Expressions<", "/", "a", ">" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSMarshaller.java#L186-L209
GoogleCloudPlatform/appengine-pipelines
java/src/main/java/com/google/appengine/tools/pipeline/Job.java
Job.futureCall
public <T, T1, T2> FutureValue<T> futureCall(Job2<T, T1, T2> jobInstance, Value<? extends T1> v1, Value<? extends T2> v2, JobSetting... settings) { """ Invoke this method from within the {@code run} method of a <b>generator job</b> in order to specify a job node in the generated child job graph. This version of the method is for child jobs that take two arguments. @param <T> The return type of the child job being specified @param <T1> The type of the first input to the child job @param <T2> The type of the second input to the child job @param jobInstance A user-written job object @param v1 the first input to the child job @param v2 the second input to the child job @param settings Optional one or more {@code JobSetting} @return a {@code FutureValue} representing an empty value slot that will be filled by the output of {@code jobInstance} when it finalizes. This may be passed in to further invocations of {@code futureCall()} in order to specify a data dependency. """ return futureCallUnchecked(settings, jobInstance, v1, v2); }
java
public <T, T1, T2> FutureValue<T> futureCall(Job2<T, T1, T2> jobInstance, Value<? extends T1> v1, Value<? extends T2> v2, JobSetting... settings) { return futureCallUnchecked(settings, jobInstance, v1, v2); }
[ "public", "<", "T", ",", "T1", ",", "T2", ">", "FutureValue", "<", "T", ">", "futureCall", "(", "Job2", "<", "T", ",", "T1", ",", "T2", ">", "jobInstance", ",", "Value", "<", "?", "extends", "T1", ">", "v1", ",", "Value", "<", "?", "extends", "T2", ">", "v2", ",", "JobSetting", "...", "settings", ")", "{", "return", "futureCallUnchecked", "(", "settings", ",", "jobInstance", ",", "v1", ",", "v2", ")", ";", "}" ]
Invoke this method from within the {@code run} method of a <b>generator job</b> in order to specify a job node in the generated child job graph. This version of the method is for child jobs that take two arguments. @param <T> The return type of the child job being specified @param <T1> The type of the first input to the child job @param <T2> The type of the second input to the child job @param jobInstance A user-written job object @param v1 the first input to the child job @param v2 the second input to the child job @param settings Optional one or more {@code JobSetting} @return a {@code FutureValue} representing an empty value slot that will be filled by the output of {@code jobInstance} when it finalizes. This may be passed in to further invocations of {@code futureCall()} in order to specify a data dependency.
[ "Invoke", "this", "method", "from", "within", "the", "{", "@code", "run", "}", "method", "of", "a", "<b", ">", "generator", "job<", "/", "b", ">", "in", "order", "to", "specify", "a", "job", "node", "in", "the", "generated", "child", "job", "graph", ".", "This", "version", "of", "the", "method", "is", "for", "child", "jobs", "that", "take", "two", "arguments", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/Job.java#L240-L243
aequologica/geppaequo
geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java
MethodUtils.isAssignmentCompatible
public static final boolean isAssignmentCompatible(Class<?> parameterType, Class<?> parameterization) { """ <p>Determine whether a type can be used as a parameter in a method invocation. This method handles primitive conversions correctly.</p> <p>In order words, it will match a <code>Boolean</code> to a <code>boolean</code>, a <code>Long</code> to a <code>long</code>, a <code>Float</code> to a <code>float</code>, a <code>Integer</code> to a <code>int</code>, and a <code>Double</code> to a <code>double</code>. Now logic widening matches are allowed. For example, a <code>Long</code> will not match a <code>int</code>. @param parameterType the type of parameter accepted by the method @param parameterization the type of parameter being tested @return true if the assignment is compatible. """ // try plain assignment if (parameterType.isAssignableFrom(parameterization)) { return true; } if (parameterType.isPrimitive()) { // this method does *not* do widening - you must specify exactly // is this the right behaviour? Class<?> parameterWrapperClazz = getPrimitiveWrapper(parameterType); if (parameterWrapperClazz != null) { return parameterWrapperClazz.equals(parameterization); } } return false; }
java
public static final boolean isAssignmentCompatible(Class<?> parameterType, Class<?> parameterization) { // try plain assignment if (parameterType.isAssignableFrom(parameterization)) { return true; } if (parameterType.isPrimitive()) { // this method does *not* do widening - you must specify exactly // is this the right behaviour? Class<?> parameterWrapperClazz = getPrimitiveWrapper(parameterType); if (parameterWrapperClazz != null) { return parameterWrapperClazz.equals(parameterization); } } return false; }
[ "public", "static", "final", "boolean", "isAssignmentCompatible", "(", "Class", "<", "?", ">", "parameterType", ",", "Class", "<", "?", ">", "parameterization", ")", "{", "// try plain assignment\r", "if", "(", "parameterType", ".", "isAssignableFrom", "(", "parameterization", ")", ")", "{", "return", "true", ";", "}", "if", "(", "parameterType", ".", "isPrimitive", "(", ")", ")", "{", "// this method does *not* do widening - you must specify exactly\r", "// is this the right behaviour?\r", "Class", "<", "?", ">", "parameterWrapperClazz", "=", "getPrimitiveWrapper", "(", "parameterType", ")", ";", "if", "(", "parameterWrapperClazz", "!=", "null", ")", "{", "return", "parameterWrapperClazz", ".", "equals", "(", "parameterization", ")", ";", "}", "}", "return", "false", ";", "}" ]
<p>Determine whether a type can be used as a parameter in a method invocation. This method handles primitive conversions correctly.</p> <p>In order words, it will match a <code>Boolean</code> to a <code>boolean</code>, a <code>Long</code> to a <code>long</code>, a <code>Float</code> to a <code>float</code>, a <code>Integer</code> to a <code>int</code>, and a <code>Double</code> to a <code>double</code>. Now logic widening matches are allowed. For example, a <code>Long</code> will not match a <code>int</code>. @param parameterType the type of parameter accepted by the method @param parameterization the type of parameter being tested @return true if the assignment is compatible.
[ "<p", ">", "Determine", "whether", "a", "type", "can", "be", "used", "as", "a", "parameter", "in", "a", "method", "invocation", ".", "This", "method", "handles", "primitive", "conversions", "correctly", ".", "<", "/", "p", ">" ]
train
https://github.com/aequologica/geppaequo/blob/b72e5f6356535fd045a931f8c544d4a8ea6e35a2/geppaequo-core/src/main/java/net/aequologica/neo/geppaequo/auth/MethodUtils.java#L1175-L1191
structr/structr
structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java
GraphObjectModificationState.doValidationAndIndexing
public boolean doValidationAndIndexing(ModificationQueue modificationQueue, SecurityContext securityContext, ErrorBuffer errorBuffer, boolean doValidation) throws FrameworkException { """ Call beforeModification/Creation/Deletion methods. @param modificationQueue @param securityContext @param errorBuffer @param doValidation @return valid @throws FrameworkException """ boolean valid = true; // examine only the last 4 bits here switch (status & 0x000f) { case 6: // created, modified => only creation callback will be called case 4: // created => creation callback case 2: // modified => modification callback long t0 = System.currentTimeMillis(); if (doValidation) { valid &= object.isValid(errorBuffer); } long t1 = System.currentTimeMillis(); validationTime += t1 - t0; object.indexPassiveProperties(); long t2 = System.currentTimeMillis() - t1; indexingTime += t2; break; default: break; } return valid; }
java
public boolean doValidationAndIndexing(ModificationQueue modificationQueue, SecurityContext securityContext, ErrorBuffer errorBuffer, boolean doValidation) throws FrameworkException { boolean valid = true; // examine only the last 4 bits here switch (status & 0x000f) { case 6: // created, modified => only creation callback will be called case 4: // created => creation callback case 2: // modified => modification callback long t0 = System.currentTimeMillis(); if (doValidation) { valid &= object.isValid(errorBuffer); } long t1 = System.currentTimeMillis(); validationTime += t1 - t0; object.indexPassiveProperties(); long t2 = System.currentTimeMillis() - t1; indexingTime += t2; break; default: break; } return valid; }
[ "public", "boolean", "doValidationAndIndexing", "(", "ModificationQueue", "modificationQueue", ",", "SecurityContext", "securityContext", ",", "ErrorBuffer", "errorBuffer", ",", "boolean", "doValidation", ")", "throws", "FrameworkException", "{", "boolean", "valid", "=", "true", ";", "// examine only the last 4 bits here", "switch", "(", "status", "&", "0x000f", ")", "{", "case", "6", ":", "// created, modified => only creation callback will be called", "case", "4", ":", "// created => creation callback", "case", "2", ":", "// modified => modification callback", "long", "t0", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "doValidation", ")", "{", "valid", "&=", "object", ".", "isValid", "(", "errorBuffer", ")", ";", "}", "long", "t1", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "validationTime", "+=", "t1", "-", "t0", ";", "object", ".", "indexPassiveProperties", "(", ")", ";", "long", "t2", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "t1", ";", "indexingTime", "+=", "t2", ";", "break", ";", "default", ":", "break", ";", "}", "return", "valid", ";", "}" ]
Call beforeModification/Creation/Deletion methods. @param modificationQueue @param securityContext @param errorBuffer @param doValidation @return valid @throws FrameworkException
[ "Call", "beforeModification", "/", "Creation", "/", "Deletion", "methods", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java#L363-L395
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WContentRenderer.java
WContentRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ <p> Paints the given WContent.</p> <p> This paint method outputs a popup that opens browser window in which the content document will be displayed. The component is only rendered for requests in which the display() method of the content component has just been called.</p> <p> WContent's handleRequest() method will return the actual PDF document content via the use of an Escape.</p> @param component the WContent to paint. @param renderContext the RenderContext to paint to. """ WContent content = (WContent) component; XmlStringBuilder xml = renderContext.getWriter(); if (!content.isDisplayRequested()) { // This is the normal situation. return; } Object contentAccess = content.getContentAccess(); if (contentAccess == null) { LOG.warn("No content specified"); return; } // Ok, the content is available and should be shown switch (content.getDisplayMode()) { case DISPLAY_INLINE: case PROMPT_TO_SAVE: xml.appendTagOpen("ui:redirect"); xml.appendUrlAttribute("url", content.getUrl()); xml.appendEnd(); break; case OPEN_NEW_WINDOW: xml.appendTagOpen("ui:popup"); xml.appendUrlAttribute("url", content.getUrl()); xml.appendAttribute("width", content.getWidth().replaceAll("px", "")); xml.appendAttribute("height", content.getHeight().replaceAll("px", "")); xml.appendOptionalAttribute("resizable", content.isResizable(), "true"); xml.appendEnd(); break; default: throw new IllegalStateException("Invalid display mode: " + content.getDisplayMode()); } }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WContent content = (WContent) component; XmlStringBuilder xml = renderContext.getWriter(); if (!content.isDisplayRequested()) { // This is the normal situation. return; } Object contentAccess = content.getContentAccess(); if (contentAccess == null) { LOG.warn("No content specified"); return; } // Ok, the content is available and should be shown switch (content.getDisplayMode()) { case DISPLAY_INLINE: case PROMPT_TO_SAVE: xml.appendTagOpen("ui:redirect"); xml.appendUrlAttribute("url", content.getUrl()); xml.appendEnd(); break; case OPEN_NEW_WINDOW: xml.appendTagOpen("ui:popup"); xml.appendUrlAttribute("url", content.getUrl()); xml.appendAttribute("width", content.getWidth().replaceAll("px", "")); xml.appendAttribute("height", content.getHeight().replaceAll("px", "")); xml.appendOptionalAttribute("resizable", content.isResizable(), "true"); xml.appendEnd(); break; default: throw new IllegalStateException("Invalid display mode: " + content.getDisplayMode()); } }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WContent", "content", "=", "(", "WContent", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "if", "(", "!", "content", ".", "isDisplayRequested", "(", ")", ")", "{", "// This is the normal situation.", "return", ";", "}", "Object", "contentAccess", "=", "content", ".", "getContentAccess", "(", ")", ";", "if", "(", "contentAccess", "==", "null", ")", "{", "LOG", ".", "warn", "(", "\"No content specified\"", ")", ";", "return", ";", "}", "// Ok, the content is available and should be shown", "switch", "(", "content", ".", "getDisplayMode", "(", ")", ")", "{", "case", "DISPLAY_INLINE", ":", "case", "PROMPT_TO_SAVE", ":", "xml", ".", "appendTagOpen", "(", "\"ui:redirect\"", ")", ";", "xml", ".", "appendUrlAttribute", "(", "\"url\"", ",", "content", ".", "getUrl", "(", ")", ")", ";", "xml", ".", "appendEnd", "(", ")", ";", "break", ";", "case", "OPEN_NEW_WINDOW", ":", "xml", ".", "appendTagOpen", "(", "\"ui:popup\"", ")", ";", "xml", ".", "appendUrlAttribute", "(", "\"url\"", ",", "content", ".", "getUrl", "(", ")", ")", ";", "xml", ".", "appendAttribute", "(", "\"width\"", ",", "content", ".", "getWidth", "(", ")", ".", "replaceAll", "(", "\"px\"", ",", "\"\"", ")", ")", ";", "xml", ".", "appendAttribute", "(", "\"height\"", ",", "content", ".", "getHeight", "(", ")", ".", "replaceAll", "(", "\"px\"", ",", "\"\"", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"resizable\"", ",", "content", ".", "isResizable", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendEnd", "(", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Invalid display mode: \"", "+", "content", ".", "getDisplayMode", "(", ")", ")", ";", "}", "}" ]
<p> Paints the given WContent.</p> <p> This paint method outputs a popup that opens browser window in which the content document will be displayed. The component is only rendered for requests in which the display() method of the content component has just been called.</p> <p> WContent's handleRequest() method will return the actual PDF document content via the use of an Escape.</p> @param component the WContent to paint. @param renderContext the RenderContext to paint to.
[ "<p", ">", "Paints", "the", "given", "WContent", ".", "<", "/", "p", ">" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WContentRenderer.java#L39-L77
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java
CmsGalleryControllerHandler.onUpdateCategoriesList
public void onUpdateCategoriesList(List<CmsCategoryBean> categoriesList, List<String> selectedCategories) { """ Will be triggered when categories list is sorted.<p> @param categoriesList the updated categories list @param selectedCategories the selected categories """ m_galleryDialog.getCategoriesTab().updateContentList(categoriesList, selectedCategories); }
java
public void onUpdateCategoriesList(List<CmsCategoryBean> categoriesList, List<String> selectedCategories) { m_galleryDialog.getCategoriesTab().updateContentList(categoriesList, selectedCategories); }
[ "public", "void", "onUpdateCategoriesList", "(", "List", "<", "CmsCategoryBean", ">", "categoriesList", ",", "List", "<", "String", ">", "selectedCategories", ")", "{", "m_galleryDialog", ".", "getCategoriesTab", "(", ")", ".", "updateContentList", "(", "categoriesList", ",", "selectedCategories", ")", ";", "}" ]
Will be triggered when categories list is sorted.<p> @param categoriesList the updated categories list @param selectedCategories the selected categories
[ "Will", "be", "triggered", "when", "categories", "list", "is", "sorted", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L363-L366
future-architect/uroborosql
src/main/java/jp/co/future/uroborosql/parameter/mapper/JdbcParameterFactory.java
JdbcParameterFactory.createArrayOf
public static Array createArrayOf(final Connection conn, final String typeName, final Object[] elements) { """ {@link java.sql.Connection#createArrayOf(String, Object[])}のラッパー @param conn コネクション @param typeName 配列の要素がマッピングされる型のSQL名。typeNameはデータベース固有の名前で、組込み型、ユーザー定義型、またはこのデータベースでサポートされる標準SQL型の名前のこと。これは、Array.getBaseTypeNameで返される値 @param elements 返されるオブジェクトを生成する要素 @return 指定されたSQL型に要素がマッピングされるArrayオブジェクト @see java.sql.Connection#createArrayOf(String, Object[]) """ try { return conn.createArrayOf(typeName, elements); } catch (SQLException e) { throw new UroborosqlRuntimeException(e); } }
java
public static Array createArrayOf(final Connection conn, final String typeName, final Object[] elements) { try { return conn.createArrayOf(typeName, elements); } catch (SQLException e) { throw new UroborosqlRuntimeException(e); } }
[ "public", "static", "Array", "createArrayOf", "(", "final", "Connection", "conn", ",", "final", "String", "typeName", ",", "final", "Object", "[", "]", "elements", ")", "{", "try", "{", "return", "conn", ".", "createArrayOf", "(", "typeName", ",", "elements", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "throw", "new", "UroborosqlRuntimeException", "(", "e", ")", ";", "}", "}" ]
{@link java.sql.Connection#createArrayOf(String, Object[])}のラッパー @param conn コネクション @param typeName 配列の要素がマッピングされる型のSQL名。typeNameはデータベース固有の名前で、組込み型、ユーザー定義型、またはこのデータベースでサポートされる標準SQL型の名前のこと。これは、Array.getBaseTypeNameで返される値 @param elements 返されるオブジェクトを生成する要素 @return 指定されたSQL型に要素がマッピングされるArrayオブジェクト @see java.sql.Connection#createArrayOf(String, Object[])
[ "{", "@link", "java", ".", "sql", ".", "Connection#createArrayOf", "(", "String", "Object", "[]", ")", "}", "のラッパー" ]
train
https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/parameter/mapper/JdbcParameterFactory.java#L42-L48
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBox.java
CmsDateBox.setPickerValue
private void setPickerValue(Date date, boolean fireEvents) { """ Sets the value of the date picker.<p> @param date the value to set @param fireEvents signals whether the value changed event should be fired or not """ if (date == null) { date = new Date(); } m_picker.setValue(date, fireEvents); m_picker.setCurrentMonth(date); m_time.setFormValueAsString(CmsDateConverter.cutSuffix(CmsDateConverter.getTime(date)).trim()); if (CmsDateConverter.isAm(date)) { m_ampmGroup.selectButton(m_am); } else { m_ampmGroup.selectButton(m_pm); } }
java
private void setPickerValue(Date date, boolean fireEvents) { if (date == null) { date = new Date(); } m_picker.setValue(date, fireEvents); m_picker.setCurrentMonth(date); m_time.setFormValueAsString(CmsDateConverter.cutSuffix(CmsDateConverter.getTime(date)).trim()); if (CmsDateConverter.isAm(date)) { m_ampmGroup.selectButton(m_am); } else { m_ampmGroup.selectButton(m_pm); } }
[ "private", "void", "setPickerValue", "(", "Date", "date", ",", "boolean", "fireEvents", ")", "{", "if", "(", "date", "==", "null", ")", "{", "date", "=", "new", "Date", "(", ")", ";", "}", "m_picker", ".", "setValue", "(", "date", ",", "fireEvents", ")", ";", "m_picker", ".", "setCurrentMonth", "(", "date", ")", ";", "m_time", ".", "setFormValueAsString", "(", "CmsDateConverter", ".", "cutSuffix", "(", "CmsDateConverter", ".", "getTime", "(", "date", ")", ")", ".", "trim", "(", ")", ")", ";", "if", "(", "CmsDateConverter", ".", "isAm", "(", "date", ")", ")", "{", "m_ampmGroup", ".", "selectButton", "(", "m_am", ")", ";", "}", "else", "{", "m_ampmGroup", ".", "selectButton", "(", "m_pm", ")", ";", "}", "}" ]
Sets the value of the date picker.<p> @param date the value to set @param fireEvents signals whether the value changed event should be fired or not
[ "Sets", "the", "value", "of", "the", "date", "picker", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/datebox/CmsDateBox.java#L949-L962
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/ResponseHandler.java
ResponseHandler.onEvent
@Override public void onEvent(final ResponseEvent event, long sequence, boolean endOfBatch) throws Exception { """ Handles {@link ResponseEvent}s that come into the response RingBuffer. Hey I just mapped you, And this is crazy, But here's my data so subscribe me maybe. It's hard to block right, at you baby, But here's my data , so subscribe me maybe. """ try { CouchbaseMessage message = event.getMessage(); if (message instanceof SignalConfigReload) { configurationProvider.signalOutdated(); } else if (message instanceof CouchbaseResponse) { final CouchbaseResponse response = (CouchbaseResponse) message; ResponseStatus status = response.status(); if (status == ResponseStatus.RETRY) { retry(event, true); } else { final Scheduler.Worker worker = environment.scheduler().createWorker(); final Subject<CouchbaseResponse, CouchbaseResponse> obs = event.getObservable(); worker.schedule(new Action0() { @Override public void call() { try { obs.onNext(response); obs.onCompleted(); } catch(Exception ex) { obs.onError(ex); } finally { worker.unsubscribe(); } } }); } } else if (message instanceof CouchbaseRequest) { retry(event, false); } else { throw new IllegalStateException("Got message type I do not understand: " + message); } } finally { event.setMessage(null); event.setObservable(null); } }
java
@Override public void onEvent(final ResponseEvent event, long sequence, boolean endOfBatch) throws Exception { try { CouchbaseMessage message = event.getMessage(); if (message instanceof SignalConfigReload) { configurationProvider.signalOutdated(); } else if (message instanceof CouchbaseResponse) { final CouchbaseResponse response = (CouchbaseResponse) message; ResponseStatus status = response.status(); if (status == ResponseStatus.RETRY) { retry(event, true); } else { final Scheduler.Worker worker = environment.scheduler().createWorker(); final Subject<CouchbaseResponse, CouchbaseResponse> obs = event.getObservable(); worker.schedule(new Action0() { @Override public void call() { try { obs.onNext(response); obs.onCompleted(); } catch(Exception ex) { obs.onError(ex); } finally { worker.unsubscribe(); } } }); } } else if (message instanceof CouchbaseRequest) { retry(event, false); } else { throw new IllegalStateException("Got message type I do not understand: " + message); } } finally { event.setMessage(null); event.setObservable(null); } }
[ "@", "Override", "public", "void", "onEvent", "(", "final", "ResponseEvent", "event", ",", "long", "sequence", ",", "boolean", "endOfBatch", ")", "throws", "Exception", "{", "try", "{", "CouchbaseMessage", "message", "=", "event", ".", "getMessage", "(", ")", ";", "if", "(", "message", "instanceof", "SignalConfigReload", ")", "{", "configurationProvider", ".", "signalOutdated", "(", ")", ";", "}", "else", "if", "(", "message", "instanceof", "CouchbaseResponse", ")", "{", "final", "CouchbaseResponse", "response", "=", "(", "CouchbaseResponse", ")", "message", ";", "ResponseStatus", "status", "=", "response", ".", "status", "(", ")", ";", "if", "(", "status", "==", "ResponseStatus", ".", "RETRY", ")", "{", "retry", "(", "event", ",", "true", ")", ";", "}", "else", "{", "final", "Scheduler", ".", "Worker", "worker", "=", "environment", ".", "scheduler", "(", ")", ".", "createWorker", "(", ")", ";", "final", "Subject", "<", "CouchbaseResponse", ",", "CouchbaseResponse", ">", "obs", "=", "event", ".", "getObservable", "(", ")", ";", "worker", ".", "schedule", "(", "new", "Action0", "(", ")", "{", "@", "Override", "public", "void", "call", "(", ")", "{", "try", "{", "obs", ".", "onNext", "(", "response", ")", ";", "obs", ".", "onCompleted", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "obs", ".", "onError", "(", "ex", ")", ";", "}", "finally", "{", "worker", ".", "unsubscribe", "(", ")", ";", "}", "}", "}", ")", ";", "}", "}", "else", "if", "(", "message", "instanceof", "CouchbaseRequest", ")", "{", "retry", "(", "event", ",", "false", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "\"Got message type I do not understand: \"", "+", "message", ")", ";", "}", "}", "finally", "{", "event", ".", "setMessage", "(", "null", ")", ";", "event", ".", "setObservable", "(", "null", ")", ";", "}", "}" ]
Handles {@link ResponseEvent}s that come into the response RingBuffer. Hey I just mapped you, And this is crazy, But here's my data so subscribe me maybe. It's hard to block right, at you baby, But here's my data , so subscribe me maybe.
[ "Handles", "{", "@link", "ResponseEvent", "}", "s", "that", "come", "into", "the", "response", "RingBuffer", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/ResponseHandler.java#L94-L131
pressgang-ccms/PressGangCCMSCommonUtilities
src/main/java/org/jboss/pressgang/ccms/utils/common/ExceptionUtilities.java
ExceptionUtilities.getStackTrace
public static String getStackTrace(final Throwable ex) { """ A standard function to get the stack trace from a thrown Exception @param ex The thrown exception @return The stack trace from the exception """ final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true); ex.printStackTrace(pw); pw.flush(); sw.flush(); return sw.toString(); }
java
public static String getStackTrace(final Throwable ex) { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true); ex.printStackTrace(pw); pw.flush(); sw.flush(); return sw.toString(); }
[ "public", "static", "String", "getStackTrace", "(", "final", "Throwable", "ex", ")", "{", "final", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "final", "PrintWriter", "pw", "=", "new", "PrintWriter", "(", "sw", ",", "true", ")", ";", "ex", ".", "printStackTrace", "(", "pw", ")", ";", "pw", ".", "flush", "(", ")", ";", "sw", ".", "flush", "(", ")", ";", "return", "sw", ".", "toString", "(", ")", ";", "}" ]
A standard function to get the stack trace from a thrown Exception @param ex The thrown exception @return The stack trace from the exception
[ "A", "standard", "function", "to", "get", "the", "stack", "trace", "from", "a", "thrown", "Exception" ]
train
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/ExceptionUtilities.java#L33-L40
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.removeByG_Tw
@Override public CommerceCountry removeByG_Tw(long groupId, String twoLettersISOCode) throws NoSuchCountryException { """ Removes the commerce country where groupId = &#63; and twoLettersISOCode = &#63; from the database. @param groupId the group ID @param twoLettersISOCode the two letters iso code @return the commerce country that was removed """ CommerceCountry commerceCountry = findByG_Tw(groupId, twoLettersISOCode); return remove(commerceCountry); }
java
@Override public CommerceCountry removeByG_Tw(long groupId, String twoLettersISOCode) throws NoSuchCountryException { CommerceCountry commerceCountry = findByG_Tw(groupId, twoLettersISOCode); return remove(commerceCountry); }
[ "@", "Override", "public", "CommerceCountry", "removeByG_Tw", "(", "long", "groupId", ",", "String", "twoLettersISOCode", ")", "throws", "NoSuchCountryException", "{", "CommerceCountry", "commerceCountry", "=", "findByG_Tw", "(", "groupId", ",", "twoLettersISOCode", ")", ";", "return", "remove", "(", "commerceCountry", ")", ";", "}" ]
Removes the commerce country where groupId = &#63; and twoLettersISOCode = &#63; from the database. @param groupId the group ID @param twoLettersISOCode the two letters iso code @return the commerce country that was removed
[ "Removes", "the", "commerce", "country", "where", "groupId", "=", "&#63", ";", "and", "twoLettersISOCode", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2156-L2162
zalando-nakadi/fahrschein
fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java
NakadiClient.subscribe
@Deprecated public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException { """ Create a subscription for a single event type. @deprecated Use the {@link SubscriptionBuilder} and {@link NakadiClient#subscription(String, String)} instead. """ return subscription(applicationName, eventName).withConsumerGroup(consumerGroup).subscribe(); }
java
@Deprecated public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException { return subscription(applicationName, eventName).withConsumerGroup(consumerGroup).subscribe(); }
[ "@", "Deprecated", "public", "Subscription", "subscribe", "(", "String", "applicationName", ",", "String", "eventName", ",", "String", "consumerGroup", ")", "throws", "IOException", "{", "return", "subscription", "(", "applicationName", ",", "eventName", ")", ".", "withConsumerGroup", "(", "consumerGroup", ")", ".", "subscribe", "(", ")", ";", "}" ]
Create a subscription for a single event type. @deprecated Use the {@link SubscriptionBuilder} and {@link NakadiClient#subscription(String, String)} instead.
[ "Create", "a", "subscription", "for", "a", "single", "event", "type", "." ]
train
https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java#L82-L85
agmip/translator-dssat
src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java
DssatBatchFileOutput.writeFile
@Override public void writeFile(String arg0, Map result) { """ DSSAT Batch File Output method @param arg0 file output path @param result data holder object """ // Initial variables BufferedWriter bwB; // output object StringBuilder sbData = new StringBuilder(); // construct the data info in the output try { // Set default value for missing data setDefVal(); // Get version number if (dssatVerStr == null) { dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", ""); if (!dssatVerStr.matches("\\d+")) { dssatVerStr = DssatVersion.DSSAT45.toString(); } } // Initial BufferedWriter arg0 = revisePath(arg0); outputFile = new File(arg0 + "DSSBatch.v" + dssatVerStr); bwB = new BufferedWriter(new FileWriter(outputFile)); // Output Batch File // Titel Section String crop = getCropName(result); String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\"; String exFileName = getFileName(result, "X"); int expNo = 1; // Write title section sbData.append("$BATCH(").append(crop).append(")\r\n!\r\n"); sbData.append(String.format("! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n", dssatPath, dssatVerStr)); sbData.append("! Crop : ").append(crop).append("\r\n"); sbData.append("! Experiment : ").append(exFileName).append("\r\n"); sbData.append("! ExpNo : ").append(expNo).append("\r\n"); sbData.append(String.format("! Debug : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n", dssatPath, dssatVerStr)); // Body Section sbData.append("@FILEX TRTNO RP SQ OP CO\r\n"); // Get DSSAT Sequence info HashMap dssatSeqData = getObjectOr(result, "dssat_sequence", new HashMap()); ArrayList<HashMap> dssatSeqArr = getObjectOr(dssatSeqData, "data", new ArrayList<HashMap>()); // If missing, set default value if (dssatSeqArr.isEmpty()) { HashMap tmp = new HashMap(); tmp.put("sq", "1"); tmp.put("op", "1"); tmp.put("co", "0"); dssatSeqArr.add(tmp); } // Output all info for (HashMap dssatSeqSubData : dssatSeqArr) { sbData.append(String.format("%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s", exFileName, "1", "1", getObjectOr(dssatSeqSubData, "sq", "1"), getObjectOr(dssatSeqSubData, "op", "1"), getObjectOr(dssatSeqSubData, "co", "0"))); } // Output finish bwB.write(sbError.toString()); bwB.write(sbData.toString()); bwB.close(); } catch (IOException e) { LOG.error(DssatCommonOutput.getStackTrace(e)); } }
java
@Override public void writeFile(String arg0, Map result) { // Initial variables BufferedWriter bwB; // output object StringBuilder sbData = new StringBuilder(); // construct the data info in the output try { // Set default value for missing data setDefVal(); // Get version number if (dssatVerStr == null) { dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", ""); if (!dssatVerStr.matches("\\d+")) { dssatVerStr = DssatVersion.DSSAT45.toString(); } } // Initial BufferedWriter arg0 = revisePath(arg0); outputFile = new File(arg0 + "DSSBatch.v" + dssatVerStr); bwB = new BufferedWriter(new FileWriter(outputFile)); // Output Batch File // Titel Section String crop = getCropName(result); String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\"; String exFileName = getFileName(result, "X"); int expNo = 1; // Write title section sbData.append("$BATCH(").append(crop).append(")\r\n!\r\n"); sbData.append(String.format("! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n", dssatPath, dssatVerStr)); sbData.append("! Crop : ").append(crop).append("\r\n"); sbData.append("! Experiment : ").append(exFileName).append("\r\n"); sbData.append("! ExpNo : ").append(expNo).append("\r\n"); sbData.append(String.format("! Debug : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n", dssatPath, dssatVerStr)); // Body Section sbData.append("@FILEX TRTNO RP SQ OP CO\r\n"); // Get DSSAT Sequence info HashMap dssatSeqData = getObjectOr(result, "dssat_sequence", new HashMap()); ArrayList<HashMap> dssatSeqArr = getObjectOr(dssatSeqData, "data", new ArrayList<HashMap>()); // If missing, set default value if (dssatSeqArr.isEmpty()) { HashMap tmp = new HashMap(); tmp.put("sq", "1"); tmp.put("op", "1"); tmp.put("co", "0"); dssatSeqArr.add(tmp); } // Output all info for (HashMap dssatSeqSubData : dssatSeqArr) { sbData.append(String.format("%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s", exFileName, "1", "1", getObjectOr(dssatSeqSubData, "sq", "1"), getObjectOr(dssatSeqSubData, "op", "1"), getObjectOr(dssatSeqSubData, "co", "0"))); } // Output finish bwB.write(sbError.toString()); bwB.write(sbData.toString()); bwB.close(); } catch (IOException e) { LOG.error(DssatCommonOutput.getStackTrace(e)); } }
[ "@", "Override", "public", "void", "writeFile", "(", "String", "arg0", ",", "Map", "result", ")", "{", "// Initial variables", "BufferedWriter", "bwB", ";", "// output object", "StringBuilder", "sbData", "=", "new", "StringBuilder", "(", ")", ";", "// construct the data info in the output", "try", "{", "// Set default value for missing data", "setDefVal", "(", ")", ";", "// Get version number", "if", "(", "dssatVerStr", "==", "null", ")", "{", "dssatVerStr", "=", "getObjectOr", "(", "result", ",", "\"crop_model_version\"", ",", "\"\"", ")", ".", "replaceAll", "(", "\"\\\\D\"", ",", "\"\"", ")", ";", "if", "(", "!", "dssatVerStr", ".", "matches", "(", "\"\\\\d+\"", ")", ")", "{", "dssatVerStr", "=", "DssatVersion", ".", "DSSAT45", ".", "toString", "(", ")", ";", "}", "}", "// Initial BufferedWriter", "arg0", "=", "revisePath", "(", "arg0", ")", ";", "outputFile", "=", "new", "File", "(", "arg0", "+", "\"DSSBatch.v\"", "+", "dssatVerStr", ")", ";", "bwB", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "outputFile", ")", ")", ";", "// Output Batch File", "// Titel Section", "String", "crop", "=", "getCropName", "(", "result", ")", ";", "String", "dssatPath", "=", "\"C:\\\\DSSAT\"", "+", "dssatVerStr", "+", "\"\\\\\"", ";", "String", "exFileName", "=", "getFileName", "(", "result", ",", "\"X\"", ")", ";", "int", "expNo", "=", "1", ";", "// Write title section", "sbData", ".", "append", "(", "\"$BATCH(\"", ")", ".", "append", "(", "crop", ")", ".", "append", "(", "\")\\r\\n!\\r\\n\"", ")", ";", "sbData", ".", "append", "(", "String", ".", "format", "(", "\"! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\\r\\n\"", ",", "dssatPath", ",", "dssatVerStr", ")", ")", ";", "sbData", ".", "append", "(", "\"! Crop : \"", ")", ".", "append", "(", "crop", ")", ".", "append", "(", "\"\\r\\n\"", ")", ";", "sbData", ".", "append", "(", "\"! Experiment : \"", ")", ".", "append", "(", "exFileName", ")", ".", "append", "(", "\"\\r\\n\"", ")", ";", "sbData", ".", "append", "(", "\"! ExpNo : \"", ")", ".", "append", "(", "expNo", ")", ".", "append", "(", "\"\\r\\n\"", ")", ";", "sbData", ".", "append", "(", "String", ".", "format", "(", "\"! Debug : %1$sDSCSM0%2$s.EXE \\\" B DSSBatch.v%2$s\\\"\\r\\n!\\r\\n\"", ",", "dssatPath", ",", "dssatVerStr", ")", ")", ";", "// Body Section", "sbData", ".", "append", "(", "\"@FILEX TRTNO RP SQ OP CO\\r\\n\"", ")", ";", "// Get DSSAT Sequence info", "HashMap", "dssatSeqData", "=", "getObjectOr", "(", "result", ",", "\"dssat_sequence\"", ",", "new", "HashMap", "(", ")", ")", ";", "ArrayList", "<", "HashMap", ">", "dssatSeqArr", "=", "getObjectOr", "(", "dssatSeqData", ",", "\"data\"", ",", "new", "ArrayList", "<", "HashMap", ">", "(", ")", ")", ";", "// If missing, set default value", "if", "(", "dssatSeqArr", ".", "isEmpty", "(", ")", ")", "{", "HashMap", "tmp", "=", "new", "HashMap", "(", ")", ";", "tmp", ".", "put", "(", "\"sq\"", ",", "\"1\"", ")", ";", "tmp", ".", "put", "(", "\"op\"", ",", "\"1\"", ")", ";", "tmp", ".", "put", "(", "\"co\"", ",", "\"0\"", ")", ";", "dssatSeqArr", ".", "add", "(", "tmp", ")", ";", "}", "// Output all info", "for", "(", "HashMap", "dssatSeqSubData", ":", "dssatSeqArr", ")", "{", "sbData", ".", "append", "(", "String", ".", "format", "(", "\"%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s\"", ",", "exFileName", ",", "\"1\"", ",", "\"1\"", ",", "getObjectOr", "(", "dssatSeqSubData", ",", "\"sq\"", ",", "\"1\"", ")", ",", "getObjectOr", "(", "dssatSeqSubData", ",", "\"op\"", ",", "\"1\"", ")", ",", "getObjectOr", "(", "dssatSeqSubData", ",", "\"co\"", ",", "\"0\"", ")", ")", ")", ";", "}", "// Output finish", "bwB", ".", "write", "(", "sbError", ".", "toString", "(", ")", ")", ";", "bwB", ".", "write", "(", "sbData", ".", "toString", "(", ")", ")", ";", "bwB", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "error", "(", "DssatCommonOutput", ".", "getStackTrace", "(", "e", ")", ")", ";", "}", "}" ]
DSSAT Batch File Output method @param arg0 file output path @param result data holder object
[ "DSSAT", "Batch", "File", "Output", "method" ]
train
https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java#L145-L210
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java
BackendConnection.setCurrentSchema
public void setCurrentSchema(final String schemaName) { """ Change logic schema of current channel. @param schemaName schema name """ if (isSwitchFailed()) { throw new ShardingException("Failed to switch schema, please terminate current transaction."); } this.schemaName = schemaName; this.logicSchema = LogicSchemas.getInstance().getLogicSchema(schemaName); }
java
public void setCurrentSchema(final String schemaName) { if (isSwitchFailed()) { throw new ShardingException("Failed to switch schema, please terminate current transaction."); } this.schemaName = schemaName; this.logicSchema = LogicSchemas.getInstance().getLogicSchema(schemaName); }
[ "public", "void", "setCurrentSchema", "(", "final", "String", "schemaName", ")", "{", "if", "(", "isSwitchFailed", "(", ")", ")", "{", "throw", "new", "ShardingException", "(", "\"Failed to switch schema, please terminate current transaction.\"", ")", ";", "}", "this", ".", "schemaName", "=", "schemaName", ";", "this", ".", "logicSchema", "=", "LogicSchemas", ".", "getInstance", "(", ")", ".", "getLogicSchema", "(", "schemaName", ")", ";", "}" ]
Change logic schema of current channel. @param schemaName schema name
[ "Change", "logic", "schema", "of", "current", "channel", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java#L105-L111
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.getMessageList
public MessageListResult getMessageList(int count, String begin_time, String end_time) throws APIConnectionException, APIRequestException { """ Get message list from history, messages will store 60 days. @param count Necessary parameter. The count of the message list. @param begin_time Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @param end_time Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @return MessageListResult @throws APIConnectionException connect exception @throws APIRequestException request exception """ return _messageClient.getMessageList(count, begin_time, end_time); }
java
public MessageListResult getMessageList(int count, String begin_time, String end_time) throws APIConnectionException, APIRequestException { return _messageClient.getMessageList(count, begin_time, end_time); }
[ "public", "MessageListResult", "getMessageList", "(", "int", "count", ",", "String", "begin_time", ",", "String", "end_time", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_messageClient", ".", "getMessageList", "(", "count", ",", "begin_time", ",", "end_time", ")", ";", "}" ]
Get message list from history, messages will store 60 days. @param count Necessary parameter. The count of the message list. @param begin_time Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @param end_time Necessary parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @return MessageListResult @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Get", "message", "list", "from", "history", "messages", "will", "store", "60", "days", "." ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L500-L503
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java
FailoverGroupsInner.failoverAsync
public Observable<FailoverGroupInner> failoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { """ Fails over from the current primary server to this server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @param failoverGroupName The name of the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) { return response.body(); } }); }
java
public Observable<FailoverGroupInner> failoverAsync(String resourceGroupName, String serverName, String failoverGroupName) { return failoverWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FailoverGroupInner", ">", "failoverAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "failoverGroupName", ")", "{", "return", "failoverWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "failoverGroupName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "FailoverGroupInner", ">", ",", "FailoverGroupInner", ">", "(", ")", "{", "@", "Override", "public", "FailoverGroupInner", "call", "(", "ServiceResponse", "<", "FailoverGroupInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Fails over from the current primary server to this server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @param failoverGroupName The name of the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Fails", "over", "from", "the", "current", "primary", "server", "to", "this", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L917-L924
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/ResourceFactory.java
ResourceFactory.createResourceFromAsset
public RepositoryResourceImpl createResourceFromAsset(Asset ass, RepositoryConnection connection) throws RepositoryBackendException { """ Creates a resources from the supplied asset @param ass The asset to create the resource from. @param userId user id to log on to massive with @param password password to log on to massive with @param apiKey the apikey for the marketplace @return @throws RepositoryBackendException """ // No wlp information means no type set, so can't create a resource from this.... RepositoryResourceImpl result; if (null == ass.getWlpInformation() || ass.getType() == null) { result = new RepositoryResourceImpl(connection, ass) {}; } else { result = createResource(ass.getType(), connection, ass); } result.parseAttachmentsInAsset(); return result; }
java
public RepositoryResourceImpl createResourceFromAsset(Asset ass, RepositoryConnection connection) throws RepositoryBackendException { // No wlp information means no type set, so can't create a resource from this.... RepositoryResourceImpl result; if (null == ass.getWlpInformation() || ass.getType() == null) { result = new RepositoryResourceImpl(connection, ass) {}; } else { result = createResource(ass.getType(), connection, ass); } result.parseAttachmentsInAsset(); return result; }
[ "public", "RepositoryResourceImpl", "createResourceFromAsset", "(", "Asset", "ass", ",", "RepositoryConnection", "connection", ")", "throws", "RepositoryBackendException", "{", "// No wlp information means no type set, so can't create a resource from this....", "RepositoryResourceImpl", "result", ";", "if", "(", "null", "==", "ass", ".", "getWlpInformation", "(", ")", "||", "ass", ".", "getType", "(", ")", "==", "null", ")", "{", "result", "=", "new", "RepositoryResourceImpl", "(", "connection", ",", "ass", ")", "{", "}", ";", "}", "else", "{", "result", "=", "createResource", "(", "ass", ".", "getType", "(", ")", ",", "connection", ",", "ass", ")", ";", "}", "result", ".", "parseAttachmentsInAsset", "(", ")", ";", "return", "result", ";", "}" ]
Creates a resources from the supplied asset @param ass The asset to create the resource from. @param userId user id to log on to massive with @param password password to log on to massive with @param apiKey the apikey for the marketplace @return @throws RepositoryBackendException
[ "Creates", "a", "resources", "from", "the", "supplied", "asset" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/resources/internal/ResourceFactory.java#L49-L61
osmdroid/osmdroid
osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/MapFactory.java
MapFactory.canGetMapsFingerprint
public static boolean canGetMapsFingerprint(final PackageManager pm, final String packageName) { """ Sometimes {@link #isGoogleMapsV1Supported} can give a false positive which causes a subsequent error when starting the map activity. This method can be called as an extra check. """ try { final Class<?> cls = Class.forName("com.google.android.maps.KeyHelper"); final Method gsf = cls.getDeclaredMethod("getSignatureFingerprint", new Class[]{PackageManager.class, String.class}); gsf.setAccessible(true); final Object fingerprint = gsf.invoke(null, new Object[]{pm, packageName}); return true; } catch (final Throwable e) { } return false; }
java
public static boolean canGetMapsFingerprint(final PackageManager pm, final String packageName) { try { final Class<?> cls = Class.forName("com.google.android.maps.KeyHelper"); final Method gsf = cls.getDeclaredMethod("getSignatureFingerprint", new Class[]{PackageManager.class, String.class}); gsf.setAccessible(true); final Object fingerprint = gsf.invoke(null, new Object[]{pm, packageName}); return true; } catch (final Throwable e) { } return false; }
[ "public", "static", "boolean", "canGetMapsFingerprint", "(", "final", "PackageManager", "pm", ",", "final", "String", "packageName", ")", "{", "try", "{", "final", "Class", "<", "?", ">", "cls", "=", "Class", ".", "forName", "(", "\"com.google.android.maps.KeyHelper\"", ")", ";", "final", "Method", "gsf", "=", "cls", ".", "getDeclaredMethod", "(", "\"getSignatureFingerprint\"", ",", "new", "Class", "[", "]", "{", "PackageManager", ".", "class", ",", "String", ".", "class", "}", ")", ";", "gsf", ".", "setAccessible", "(", "true", ")", ";", "final", "Object", "fingerprint", "=", "gsf", ".", "invoke", "(", "null", ",", "new", "Object", "[", "]", "{", "pm", ",", "packageName", "}", ")", ";", "return", "true", ";", "}", "catch", "(", "final", "Throwable", "e", ")", "{", "}", "return", "false", ";", "}" ]
Sometimes {@link #isGoogleMapsV1Supported} can give a false positive which causes a subsequent error when starting the map activity. This method can be called as an extra check.
[ "Sometimes", "{" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-third-party/src/main/java/org/osmdroid/google/wrapper/v2/MapFactory.java#L82-L92
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java
BigDecimal.doRound
private static BigDecimal doRound(long compactVal, int scale, MathContext mc) { """ /* Returns a {@code BigDecimal} created from {@code long} value with given scale rounded according to the MathContext settings """ int mcp = mc.precision; if (mcp > 0 && mcp < 19) { int prec = longDigitLength(compactVal); int drop = prec - mcp; // drop can't be more than 18 while (drop > 0) { scale = checkScaleNonZero((long) scale - drop); compactVal = divideAndRound(compactVal, LONG_TEN_POWERS_TABLE[drop], mc.roundingMode.oldMode); prec = longDigitLength(compactVal); drop = prec - mcp; } return valueOf(compactVal, scale, prec); } return valueOf(compactVal, scale); }
java
private static BigDecimal doRound(long compactVal, int scale, MathContext mc) { int mcp = mc.precision; if (mcp > 0 && mcp < 19) { int prec = longDigitLength(compactVal); int drop = prec - mcp; // drop can't be more than 18 while (drop > 0) { scale = checkScaleNonZero((long) scale - drop); compactVal = divideAndRound(compactVal, LONG_TEN_POWERS_TABLE[drop], mc.roundingMode.oldMode); prec = longDigitLength(compactVal); drop = prec - mcp; } return valueOf(compactVal, scale, prec); } return valueOf(compactVal, scale); }
[ "private", "static", "BigDecimal", "doRound", "(", "long", "compactVal", ",", "int", "scale", ",", "MathContext", "mc", ")", "{", "int", "mcp", "=", "mc", ".", "precision", ";", "if", "(", "mcp", ">", "0", "&&", "mcp", "<", "19", ")", "{", "int", "prec", "=", "longDigitLength", "(", "compactVal", ")", ";", "int", "drop", "=", "prec", "-", "mcp", ";", "// drop can't be more than 18", "while", "(", "drop", ">", "0", ")", "{", "scale", "=", "checkScaleNonZero", "(", "(", "long", ")", "scale", "-", "drop", ")", ";", "compactVal", "=", "divideAndRound", "(", "compactVal", ",", "LONG_TEN_POWERS_TABLE", "[", "drop", "]", ",", "mc", ".", "roundingMode", ".", "oldMode", ")", ";", "prec", "=", "longDigitLength", "(", "compactVal", ")", ";", "drop", "=", "prec", "-", "mcp", ";", "}", "return", "valueOf", "(", "compactVal", ",", "scale", ",", "prec", ")", ";", "}", "return", "valueOf", "(", "compactVal", ",", "scale", ")", ";", "}" ]
/* Returns a {@code BigDecimal} created from {@code long} value with given scale rounded according to the MathContext settings
[ "/", "*", "Returns", "a", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4028-L4042
zaproxy/zaproxy
src/org/zaproxy/zap/utils/HarUtils.java
HarUtils.createHarEntry
public static HarEntry createHarEntry(HttpMessage httpMessage) { """ Creates a {@code HarEntry} from the given message. @param httpMessage the HTTP message. @return the {@code HarEntry}, never {@code null}. @see #createHarEntry(int, int, HttpMessage) @see #createMessageHarCustomFields(int, int, String) """ HarEntryTimings timings = new HarEntryTimings(0, 0, httpMessage.getTimeElapsedMillis()); return new HarEntry( new Date(httpMessage.getTimeSentMillis()), httpMessage.getTimeElapsedMillis(), createHarRequest(httpMessage), createHarResponse(httpMessage), new HarCache(), timings); }
java
public static HarEntry createHarEntry(HttpMessage httpMessage) { HarEntryTimings timings = new HarEntryTimings(0, 0, httpMessage.getTimeElapsedMillis()); return new HarEntry( new Date(httpMessage.getTimeSentMillis()), httpMessage.getTimeElapsedMillis(), createHarRequest(httpMessage), createHarResponse(httpMessage), new HarCache(), timings); }
[ "public", "static", "HarEntry", "createHarEntry", "(", "HttpMessage", "httpMessage", ")", "{", "HarEntryTimings", "timings", "=", "new", "HarEntryTimings", "(", "0", ",", "0", ",", "httpMessage", ".", "getTimeElapsedMillis", "(", ")", ")", ";", "return", "new", "HarEntry", "(", "new", "Date", "(", "httpMessage", ".", "getTimeSentMillis", "(", ")", ")", ",", "httpMessage", ".", "getTimeElapsedMillis", "(", ")", ",", "createHarRequest", "(", "httpMessage", ")", ",", "createHarResponse", "(", "httpMessage", ")", ",", "new", "HarCache", "(", ")", ",", "timings", ")", ";", "}" ]
Creates a {@code HarEntry} from the given message. @param httpMessage the HTTP message. @return the {@code HarEntry}, never {@code null}. @see #createHarEntry(int, int, HttpMessage) @see #createMessageHarCustomFields(int, int, String)
[ "Creates", "a", "{", "@code", "HarEntry", "}", "from", "the", "given", "message", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/HarUtils.java#L177-L187
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.setupTablePopup
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, String displayFieldName, boolean bIncludeBlankOption) { """ Add a popup for the table tied to this field. @return Return the component or ScreenField that is created for this field. """ return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, null, displayFieldName, bIncludeBlankOption, false); }
java
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, String displayFieldName, boolean bIncludeBlankOption) { return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, null, displayFieldName, bIncludeBlankOption, false); }
[ "public", "ScreenComponent", "setupTablePopup", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "int", "iDisplayFieldDesc", ",", "Rec", "record", ",", "String", "displayFieldName", ",", "boolean", "bIncludeBlankOption", ")", "{", "return", "this", ".", "setupTablePopup", "(", "itsLocation", ",", "targetScreen", ",", "this", ",", "iDisplayFieldDesc", ",", "record", ",", "null", ",", "displayFieldName", ",", "bIncludeBlankOption", ",", "false", ")", ";", "}" ]
Add a popup for the table tied to this field. @return Return the component or ScreenField that is created for this field.
[ "Add", "a", "popup", "for", "the", "table", "tied", "to", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1185-L1188
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/Database.java
Database.findOptional
public @NotNull <T> Optional<T> findOptional(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) { """ Finds a unique result from database, converting the database row to given class using default mechanisms. Returns empty if there are no results or if single null result is returned. @throws NonUniqueResultException if there are multiple result rows """ return findOptional(cl, SqlQuery.query(sql, args)); }
java
public @NotNull <T> Optional<T> findOptional(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) { return findOptional(cl, SqlQuery.query(sql, args)); }
[ "public", "@", "NotNull", "<", "T", ">", "Optional", "<", "T", ">", "findOptional", "(", "@", "NotNull", "Class", "<", "T", ">", "cl", ",", "@", "NotNull", "@", "SQL", "String", "sql", ",", "Object", "...", "args", ")", "{", "return", "findOptional", "(", "cl", ",", "SqlQuery", ".", "query", "(", "sql", ",", "args", ")", ")", ";", "}" ]
Finds a unique result from database, converting the database row to given class using default mechanisms. Returns empty if there are no results or if single null result is returned. @throws NonUniqueResultException if there are multiple result rows
[ "Finds", "a", "unique", "result", "from", "database", "converting", "the", "database", "row", "to", "given", "class", "using", "default", "mechanisms", ".", "Returns", "empty", "if", "there", "are", "no", "results", "or", "if", "single", "null", "result", "is", "returned", "." ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L402-L404
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.setIncludeExpired
public void setIncludeExpired(boolean includeExpired, boolean fireEvent) { """ Sets if the search should include expired or unreleased resources.<p> @param includeExpired if the search should include expired or unreleased resources @param fireEvent true if a change event should be fired after setting the value """ m_searchObject.setIncludeExpired(includeExpired); m_searchObjectChanged = true; if (fireEvent) { ValueChangeEvent.fire(this, m_searchObject); } }
java
public void setIncludeExpired(boolean includeExpired, boolean fireEvent) { m_searchObject.setIncludeExpired(includeExpired); m_searchObjectChanged = true; if (fireEvent) { ValueChangeEvent.fire(this, m_searchObject); } }
[ "public", "void", "setIncludeExpired", "(", "boolean", "includeExpired", ",", "boolean", "fireEvent", ")", "{", "m_searchObject", ".", "setIncludeExpired", "(", "includeExpired", ")", ";", "m_searchObjectChanged", "=", "true", ";", "if", "(", "fireEvent", ")", "{", "ValueChangeEvent", ".", "fire", "(", "this", ",", "m_searchObject", ")", ";", "}", "}" ]
Sets if the search should include expired or unreleased resources.<p> @param includeExpired if the search should include expired or unreleased resources @param fireEvent true if a change event should be fired after setting the value
[ "Sets", "if", "the", "search", "should", "include", "expired", "or", "unreleased", "resources", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1288-L1296
vtatai/srec
core/src/main/java/com/github/srec/util/Utils.java
Utils.groovyEvaluateConvert
public static Value groovyEvaluateConvert(ExecutionContext context, String expression) { """ Evaluates an expression using Groovy, converting the final value. @param context The EC @param expression The expression to evaluate @return The value converted """ Object obj = groovyEvaluate(context, expression); return Utils.convertFromJava(obj); }
java
public static Value groovyEvaluateConvert(ExecutionContext context, String expression) { Object obj = groovyEvaluate(context, expression); return Utils.convertFromJava(obj); }
[ "public", "static", "Value", "groovyEvaluateConvert", "(", "ExecutionContext", "context", ",", "String", "expression", ")", "{", "Object", "obj", "=", "groovyEvaluate", "(", "context", ",", "expression", ")", ";", "return", "Utils", ".", "convertFromJava", "(", "obj", ")", ";", "}" ]
Evaluates an expression using Groovy, converting the final value. @param context The EC @param expression The expression to evaluate @return The value converted
[ "Evaluates", "an", "expression", "using", "Groovy", "converting", "the", "final", "value", "." ]
train
https://github.com/vtatai/srec/blob/87fa6754a6a5f8569ef628db4d149eea04062568/core/src/main/java/com/github/srec/util/Utils.java#L266-L269
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/TypedProperties.java
TypedProperties.putIfAbsent
public synchronized TypedProperties putIfAbsent(String key, String value) { """ Put a value if the associated key is not present @param key new key @param value new value @return this TypedProperties instance for method chaining """ if (getProperty(key) == null) { put(key, value); } return this; }
java
public synchronized TypedProperties putIfAbsent(String key, String value) { if (getProperty(key) == null) { put(key, value); } return this; }
[ "public", "synchronized", "TypedProperties", "putIfAbsent", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "getProperty", "(", "key", ")", "==", "null", ")", "{", "put", "(", "key", ",", "value", ")", ";", "}", "return", "this", ";", "}" ]
Put a value if the associated key is not present @param key new key @param value new value @return this TypedProperties instance for method chaining
[ "Put", "a", "value", "if", "the", "associated", "key", "is", "not", "present", "@param", "key", "new", "key", "@param", "value", "new", "value", "@return", "this", "TypedProperties", "instance", "for", "method", "chaining" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/TypedProperties.java#L162-L167
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/entities/Game.java
Game.playing
public static Game playing(String name) { """ Creates a new Game instance with the specified name. <br>In order to appear as "streaming" in the official client you must provide a valid (see documentation of method) streaming URL in {@link #streaming(String, String) Game.streaming(String, String)}. @param name The not-null name of the newly created game @throws IllegalArgumentException if the specified name is null, empty or blank @return A valid Game instance with the provided name with {@link GameType#DEFAULT} """ Checks.notBlank(name, "Name"); return new Game(name, null, GameType.DEFAULT); }
java
public static Game playing(String name) { Checks.notBlank(name, "Name"); return new Game(name, null, GameType.DEFAULT); }
[ "public", "static", "Game", "playing", "(", "String", "name", ")", "{", "Checks", ".", "notBlank", "(", "name", ",", "\"Name\"", ")", ";", "return", "new", "Game", "(", "name", ",", "null", ",", "GameType", ".", "DEFAULT", ")", ";", "}" ]
Creates a new Game instance with the specified name. <br>In order to appear as "streaming" in the official client you must provide a valid (see documentation of method) streaming URL in {@link #streaming(String, String) Game.streaming(String, String)}. @param name The not-null name of the newly created game @throws IllegalArgumentException if the specified name is null, empty or blank @return A valid Game instance with the provided name with {@link GameType#DEFAULT}
[ "Creates", "a", "new", "Game", "instance", "with", "the", "specified", "name", ".", "<br", ">", "In", "order", "to", "appear", "as", "streaming", "in", "the", "official", "client", "you", "must", "provide", "a", "valid", "(", "see", "documentation", "of", "method", ")", "streaming", "URL", "in", "{", "@link", "#streaming", "(", "String", "String", ")", "Game", ".", "streaming", "(", "String", "String", ")", "}", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/entities/Game.java#L168-L172
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/Deployment.java
Deployment.of
public static Deployment of(final File content) { """ Creates a new deployment for the file. If the file is a directory the content will be deployed exploded using the file system location. @param content the file containing the content @return the deployment """ final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content).toPath()); return new Deployment(deploymentContent, null); }
java
public static Deployment of(final File content) { final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content).toPath()); return new Deployment(deploymentContent, null); }
[ "public", "static", "Deployment", "of", "(", "final", "File", "content", ")", "{", "final", "DeploymentContent", "deploymentContent", "=", "DeploymentContent", ".", "of", "(", "Assert", ".", "checkNotNullParam", "(", "\"content\"", ",", "content", ")", ".", "toPath", "(", ")", ")", ";", "return", "new", "Deployment", "(", "deploymentContent", ",", "null", ")", ";", "}" ]
Creates a new deployment for the file. If the file is a directory the content will be deployed exploded using the file system location. @param content the file containing the content @return the deployment
[ "Creates", "a", "new", "deployment", "for", "the", "file", ".", "If", "the", "file", "is", "a", "directory", "the", "content", "will", "be", "deployed", "exploded", "using", "the", "file", "system", "location", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/Deployment.java#L66-L69
otto-de/edison-microservice
edison-core/src/main/java/de/otto/edison/status/domain/StatusDetail.java
StatusDetail.withoutDetail
public StatusDetail withoutDetail(final String key) { """ Create a copy of this StatusDetail, remove a detail and return the new StatusDetail. @param key the key of the additional detail @return StatusDetail """ final LinkedHashMap<String, String> newDetails = new LinkedHashMap<>(details); newDetails.remove(key); return statusDetail(name,status,message, newDetails); }
java
public StatusDetail withoutDetail(final String key) { final LinkedHashMap<String, String> newDetails = new LinkedHashMap<>(details); newDetails.remove(key); return statusDetail(name,status,message, newDetails); }
[ "public", "StatusDetail", "withoutDetail", "(", "final", "String", "key", ")", "{", "final", "LinkedHashMap", "<", "String", ",", "String", ">", "newDetails", "=", "new", "LinkedHashMap", "<>", "(", "details", ")", ";", "newDetails", ".", "remove", "(", "key", ")", ";", "return", "statusDetail", "(", "name", ",", "status", ",", "message", ",", "newDetails", ")", ";", "}" ]
Create a copy of this StatusDetail, remove a detail and return the new StatusDetail. @param key the key of the additional detail @return StatusDetail
[ "Create", "a", "copy", "of", "this", "StatusDetail", "remove", "a", "detail", "and", "return", "the", "new", "StatusDetail", "." ]
train
https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/status/domain/StatusDetail.java#L144-L148
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/example/util/Bootstrapper.java
Bootstrapper.makeServer
public void makeServer(ConfigServer configServer, RESTServer restServer) throws IOException { """ Programmatic invocation. @param configServer the configuration server for creating the REST server @param restServer the specification of the REST server @throws IOException if a communication error occurs """ DefaultHttpClient client = new DefaultHttpClient(); String host = configServer.getHost(); int configPort = configServer.getPort(); // TODO: SSL Authentication authType = configServer.getAuthType(); if (authType != null) { List<String> prefList = new ArrayList<>(); if (authType == Authentication.BASIC) prefList.add(AuthPolicy.BASIC); else if (authType == Authentication.DIGEST) prefList.add(AuthPolicy.DIGEST); else throw new IllegalArgumentException( "Unknown authentication type: "+authType.name() ); client.getParams().setParameter( AuthPNames.PROXY_AUTH_PREF, prefList ); String configUser = configServer.getUser(); String configPassword = configServer.getPassword(); client.getCredentialsProvider().setCredentials( new AuthScope(host, configPort), new UsernamePasswordCredentials(configUser, configPassword) ); } BasicHttpContext context = new BasicHttpContext(); StringEntity content; try { content = new StringEntity(restServer.toXMLString()); } catch (XMLStreamException e) { throw new IOException("Could not create payload to bootstrap server."); } content.setContentType("application/xml"); HttpPost poster = new HttpPost("http://"+host+":"+configPort+"/v1/rest-apis"); poster.setEntity(content); HttpResponse response = client.execute(poster, context); //poster.releaseConnection(); StatusLine status = response.getStatusLine(); int statusCode = status.getStatusCode(); String statusPhrase = status.getReasonPhrase(); client.getConnectionManager().shutdown(); if (statusCode >= 300) { throw new RuntimeException( "Failed to create REST server using host=" + host + " and port=" + configPort + ": "+ statusCode+" "+ statusPhrase+"\n"+ "Please check the server log for detail" ); } }
java
public void makeServer(ConfigServer configServer, RESTServer restServer) throws IOException { DefaultHttpClient client = new DefaultHttpClient(); String host = configServer.getHost(); int configPort = configServer.getPort(); // TODO: SSL Authentication authType = configServer.getAuthType(); if (authType != null) { List<String> prefList = new ArrayList<>(); if (authType == Authentication.BASIC) prefList.add(AuthPolicy.BASIC); else if (authType == Authentication.DIGEST) prefList.add(AuthPolicy.DIGEST); else throw new IllegalArgumentException( "Unknown authentication type: "+authType.name() ); client.getParams().setParameter( AuthPNames.PROXY_AUTH_PREF, prefList ); String configUser = configServer.getUser(); String configPassword = configServer.getPassword(); client.getCredentialsProvider().setCredentials( new AuthScope(host, configPort), new UsernamePasswordCredentials(configUser, configPassword) ); } BasicHttpContext context = new BasicHttpContext(); StringEntity content; try { content = new StringEntity(restServer.toXMLString()); } catch (XMLStreamException e) { throw new IOException("Could not create payload to bootstrap server."); } content.setContentType("application/xml"); HttpPost poster = new HttpPost("http://"+host+":"+configPort+"/v1/rest-apis"); poster.setEntity(content); HttpResponse response = client.execute(poster, context); //poster.releaseConnection(); StatusLine status = response.getStatusLine(); int statusCode = status.getStatusCode(); String statusPhrase = status.getReasonPhrase(); client.getConnectionManager().shutdown(); if (statusCode >= 300) { throw new RuntimeException( "Failed to create REST server using host=" + host + " and port=" + configPort + ": "+ statusCode+" "+ statusPhrase+"\n"+ "Please check the server log for detail" ); } }
[ "public", "void", "makeServer", "(", "ConfigServer", "configServer", ",", "RESTServer", "restServer", ")", "throws", "IOException", "{", "DefaultHttpClient", "client", "=", "new", "DefaultHttpClient", "(", ")", ";", "String", "host", "=", "configServer", ".", "getHost", "(", ")", ";", "int", "configPort", "=", "configServer", ".", "getPort", "(", ")", ";", "// TODO: SSL", "Authentication", "authType", "=", "configServer", ".", "getAuthType", "(", ")", ";", "if", "(", "authType", "!=", "null", ")", "{", "List", "<", "String", ">", "prefList", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "authType", "==", "Authentication", ".", "BASIC", ")", "prefList", ".", "add", "(", "AuthPolicy", ".", "BASIC", ")", ";", "else", "if", "(", "authType", "==", "Authentication", ".", "DIGEST", ")", "prefList", ".", "add", "(", "AuthPolicy", ".", "DIGEST", ")", ";", "else", "throw", "new", "IllegalArgumentException", "(", "\"Unknown authentication type: \"", "+", "authType", ".", "name", "(", ")", ")", ";", "client", ".", "getParams", "(", ")", ".", "setParameter", "(", "AuthPNames", ".", "PROXY_AUTH_PREF", ",", "prefList", ")", ";", "String", "configUser", "=", "configServer", ".", "getUser", "(", ")", ";", "String", "configPassword", "=", "configServer", ".", "getPassword", "(", ")", ";", "client", ".", "getCredentialsProvider", "(", ")", ".", "setCredentials", "(", "new", "AuthScope", "(", "host", ",", "configPort", ")", ",", "new", "UsernamePasswordCredentials", "(", "configUser", ",", "configPassword", ")", ")", ";", "}", "BasicHttpContext", "context", "=", "new", "BasicHttpContext", "(", ")", ";", "StringEntity", "content", ";", "try", "{", "content", "=", "new", "StringEntity", "(", "restServer", ".", "toXMLString", "(", ")", ")", ";", "}", "catch", "(", "XMLStreamException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Could not create payload to bootstrap server.\"", ")", ";", "}", "content", ".", "setContentType", "(", "\"application/xml\"", ")", ";", "HttpPost", "poster", "=", "new", "HttpPost", "(", "\"http://\"", "+", "host", "+", "\":\"", "+", "configPort", "+", "\"/v1/rest-apis\"", ")", ";", "poster", ".", "setEntity", "(", "content", ")", ";", "HttpResponse", "response", "=", "client", ".", "execute", "(", "poster", ",", "context", ")", ";", "//poster.releaseConnection();", "StatusLine", "status", "=", "response", ".", "getStatusLine", "(", ")", ";", "int", "statusCode", "=", "status", ".", "getStatusCode", "(", ")", ";", "String", "statusPhrase", "=", "status", ".", "getReasonPhrase", "(", ")", ";", "client", ".", "getConnectionManager", "(", ")", ".", "shutdown", "(", ")", ";", "if", "(", "statusCode", ">=", "300", ")", "{", "throw", "new", "RuntimeException", "(", "\"Failed to create REST server using host=\"", "+", "host", "+", "\" and port=\"", "+", "configPort", "+", "\": \"", "+", "statusCode", "+", "\" \"", "+", "statusPhrase", "+", "\"\\n\"", "+", "\"Please check the server log for detail\"", ")", ";", "}", "}" ]
Programmatic invocation. @param configServer the configuration server for creating the REST server @param restServer the specification of the REST server @throws IOException if a communication error occurs
[ "Programmatic", "invocation", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/example/util/Bootstrapper.java#L115-L180
mikepenz/Android-Iconics
library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java
IconicsDrawable.backgroundColorRes
@NonNull public IconicsDrawable backgroundColorRes(@ColorRes int colorResId) { """ Set background color from res. @return The current IconicsDrawable for chaining. """ return backgroundColor(ContextCompat.getColor(mContext, colorResId)); }
java
@NonNull public IconicsDrawable backgroundColorRes(@ColorRes int colorResId) { return backgroundColor(ContextCompat.getColor(mContext, colorResId)); }
[ "@", "NonNull", "public", "IconicsDrawable", "backgroundColorRes", "(", "@", "ColorRes", "int", "colorResId", ")", "{", "return", "backgroundColor", "(", "ContextCompat", ".", "getColor", "(", "mContext", ",", "colorResId", ")", ")", ";", "}" ]
Set background color from res. @return The current IconicsDrawable for chaining.
[ "Set", "background", "color", "from", "res", "." ]
train
https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L839-L842
ical4j/ical4j
src/main/java/net/fortuna/ical4j/util/Dates.java
Dates.getAbsMonthDay
public static int getAbsMonthDay(final java.util.Date date, final int monthDay) { """ Returns the absolute month day for the month specified by the supplied date. Note that a value of zero (0) is invalid for the monthDay parameter and an <code>IllegalArgumentException</code> will be thrown. @param date a date instance representing a day of the month @param monthDay a day of month offset @return the absolute day of month for the specified offset """ if (monthDay == 0 || monthDay < -MAX_DAYS_PER_MONTH || monthDay > MAX_DAYS_PER_MONTH) { throw new IllegalArgumentException(MessageFormat.format(INVALID_MONTH_DAY_MESSAGE, monthDay)); } if (monthDay > 0) { return monthDay; } final Calendar cal = Calendar.getInstance(); cal.setTime(date); final int month = cal.get(Calendar.MONTH); // construct a list of possible month days.. final List<Integer> days = new ArrayList<Integer>(); cal.set(Calendar.DAY_OF_MONTH, 1); while (cal.get(Calendar.MONTH) == month) { days.add(cal.get(Calendar.DAY_OF_MONTH)); cal.add(Calendar.DAY_OF_MONTH, 1); } return days.get(days.size() + monthDay); }
java
public static int getAbsMonthDay(final java.util.Date date, final int monthDay) { if (monthDay == 0 || monthDay < -MAX_DAYS_PER_MONTH || monthDay > MAX_DAYS_PER_MONTH) { throw new IllegalArgumentException(MessageFormat.format(INVALID_MONTH_DAY_MESSAGE, monthDay)); } if (monthDay > 0) { return monthDay; } final Calendar cal = Calendar.getInstance(); cal.setTime(date); final int month = cal.get(Calendar.MONTH); // construct a list of possible month days.. final List<Integer> days = new ArrayList<Integer>(); cal.set(Calendar.DAY_OF_MONTH, 1); while (cal.get(Calendar.MONTH) == month) { days.add(cal.get(Calendar.DAY_OF_MONTH)); cal.add(Calendar.DAY_OF_MONTH, 1); } return days.get(days.size() + monthDay); }
[ "public", "static", "int", "getAbsMonthDay", "(", "final", "java", ".", "util", ".", "Date", "date", ",", "final", "int", "monthDay", ")", "{", "if", "(", "monthDay", "==", "0", "||", "monthDay", "<", "-", "MAX_DAYS_PER_MONTH", "||", "monthDay", ">", "MAX_DAYS_PER_MONTH", ")", "{", "throw", "new", "IllegalArgumentException", "(", "MessageFormat", ".", "format", "(", "INVALID_MONTH_DAY_MESSAGE", ",", "monthDay", ")", ")", ";", "}", "if", "(", "monthDay", ">", "0", ")", "{", "return", "monthDay", ";", "}", "final", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "final", "int", "month", "=", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "// construct a list of possible month days..", "final", "List", "<", "Integer", ">", "days", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "while", "(", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", "==", "month", ")", "{", "days", ".", "add", "(", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "}", "return", "days", ".", "get", "(", "days", ".", "size", "(", ")", "+", "monthDay", ")", ";", "}" ]
Returns the absolute month day for the month specified by the supplied date. Note that a value of zero (0) is invalid for the monthDay parameter and an <code>IllegalArgumentException</code> will be thrown. @param date a date instance representing a day of the month @param monthDay a day of month offset @return the absolute day of month for the specified offset
[ "Returns", "the", "absolute", "month", "day", "for", "the", "month", "specified", "by", "the", "supplied", "date", ".", "Note", "that", "a", "value", "of", "zero", "(", "0", ")", "is", "invalid", "for", "the", "monthDay", "parameter", "and", "an", "<code", ">", "IllegalArgumentException<", "/", "code", ">", "will", "be", "thrown", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/util/Dates.java#L192-L211
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java
MimeMessageHelper.setTexts
static void setTexts(final Email email, final MimeMultipart multipartAlternativeMessages) throws MessagingException { """ Fills the {@link Message} instance with the content bodies (text, html and calendar). @param email The message in which the content is defined. @param multipartAlternativeMessages See {@link MimeMultipart#addBodyPart(BodyPart)} @throws MessagingException See {@link BodyPart#setText(String)}, {@link BodyPart#setContent(Object, String)} and {@link MimeMultipart#addBodyPart(BodyPart)}. """ if (email.getPlainText() != null) { final MimeBodyPart messagePart = new MimeBodyPart(); messagePart.setText(email.getPlainText(), CHARACTER_ENCODING); multipartAlternativeMessages.addBodyPart(messagePart); } if (email.getHTMLText() != null) { final MimeBodyPart messagePartHTML = new MimeBodyPart(); messagePartHTML.setContent(email.getHTMLText(), "text/html; charset=\"" + CHARACTER_ENCODING + "\""); multipartAlternativeMessages.addBodyPart(messagePartHTML); } if (email.getCalendarText() != null && email.getCalendarMethod() != null) { final MimeBodyPart messagePartCalendar = new MimeBodyPart(); messagePartCalendar.setContent(email.getCalendarText(), "text/calendar; charset=\"" + CHARACTER_ENCODING + "\"; method=\"" + email.getCalendarMethod().toString() + "\""); multipartAlternativeMessages.addBodyPart(messagePartCalendar); } }
java
static void setTexts(final Email email, final MimeMultipart multipartAlternativeMessages) throws MessagingException { if (email.getPlainText() != null) { final MimeBodyPart messagePart = new MimeBodyPart(); messagePart.setText(email.getPlainText(), CHARACTER_ENCODING); multipartAlternativeMessages.addBodyPart(messagePart); } if (email.getHTMLText() != null) { final MimeBodyPart messagePartHTML = new MimeBodyPart(); messagePartHTML.setContent(email.getHTMLText(), "text/html; charset=\"" + CHARACTER_ENCODING + "\""); multipartAlternativeMessages.addBodyPart(messagePartHTML); } if (email.getCalendarText() != null && email.getCalendarMethod() != null) { final MimeBodyPart messagePartCalendar = new MimeBodyPart(); messagePartCalendar.setContent(email.getCalendarText(), "text/calendar; charset=\"" + CHARACTER_ENCODING + "\"; method=\"" + email.getCalendarMethod().toString() + "\""); multipartAlternativeMessages.addBodyPart(messagePartCalendar); } }
[ "static", "void", "setTexts", "(", "final", "Email", "email", ",", "final", "MimeMultipart", "multipartAlternativeMessages", ")", "throws", "MessagingException", "{", "if", "(", "email", ".", "getPlainText", "(", ")", "!=", "null", ")", "{", "final", "MimeBodyPart", "messagePart", "=", "new", "MimeBodyPart", "(", ")", ";", "messagePart", ".", "setText", "(", "email", ".", "getPlainText", "(", ")", ",", "CHARACTER_ENCODING", ")", ";", "multipartAlternativeMessages", ".", "addBodyPart", "(", "messagePart", ")", ";", "}", "if", "(", "email", ".", "getHTMLText", "(", ")", "!=", "null", ")", "{", "final", "MimeBodyPart", "messagePartHTML", "=", "new", "MimeBodyPart", "(", ")", ";", "messagePartHTML", ".", "setContent", "(", "email", ".", "getHTMLText", "(", ")", ",", "\"text/html; charset=\\\"\"", "+", "CHARACTER_ENCODING", "+", "\"\\\"\"", ")", ";", "multipartAlternativeMessages", ".", "addBodyPart", "(", "messagePartHTML", ")", ";", "}", "if", "(", "email", ".", "getCalendarText", "(", ")", "!=", "null", "&&", "email", ".", "getCalendarMethod", "(", ")", "!=", "null", ")", "{", "final", "MimeBodyPart", "messagePartCalendar", "=", "new", "MimeBodyPart", "(", ")", ";", "messagePartCalendar", ".", "setContent", "(", "email", ".", "getCalendarText", "(", ")", ",", "\"text/calendar; charset=\\\"\"", "+", "CHARACTER_ENCODING", "+", "\"\\\"; method=\\\"\"", "+", "email", ".", "getCalendarMethod", "(", ")", ".", "toString", "(", ")", "+", "\"\\\"\"", ")", ";", "multipartAlternativeMessages", ".", "addBodyPart", "(", "messagePartCalendar", ")", ";", "}", "}" ]
Fills the {@link Message} instance with the content bodies (text, html and calendar). @param email The message in which the content is defined. @param multipartAlternativeMessages See {@link MimeMultipart#addBodyPart(BodyPart)} @throws MessagingException See {@link BodyPart#setText(String)}, {@link BodyPart#setContent(Object, String)} and {@link MimeMultipart#addBodyPart(BodyPart)}.
[ "Fills", "the", "{", "@link", "Message", "}", "instance", "with", "the", "content", "bodies", "(", "text", "html", "and", "calendar", ")", "." ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java#L97-L114
lets-blade/blade
src/main/java/com/blade/kit/StringKit.java
StringKit.noNullElseGet
public static <T> T noNullElseGet(@NonNull Supplier<T> s1, @NonNull Supplier<T> s2) { """ we can replace if(doMethod1()!= null) { return doMethod1() } else { return doMethod2() } with return notBlankElse(bar::getName, bar::getNickName) @param s1 Supplier @param s2 Supplier """ T t1 = s1.get(); if (t1 != null) { return t1; } return s2.get(); }
java
public static <T> T noNullElseGet(@NonNull Supplier<T> s1, @NonNull Supplier<T> s2) { T t1 = s1.get(); if (t1 != null) { return t1; } return s2.get(); }
[ "public", "static", "<", "T", ">", "T", "noNullElseGet", "(", "@", "NonNull", "Supplier", "<", "T", ">", "s1", ",", "@", "NonNull", "Supplier", "<", "T", ">", "s2", ")", "{", "T", "t1", "=", "s1", ".", "get", "(", ")", ";", "if", "(", "t1", "!=", "null", ")", "{", "return", "t1", ";", "}", "return", "s2", ".", "get", "(", ")", ";", "}" ]
we can replace if(doMethod1()!= null) { return doMethod1() } else { return doMethod2() } with return notBlankElse(bar::getName, bar::getNickName) @param s1 Supplier @param s2 Supplier
[ "we", "can", "replace", "if(doMethod1", "()", "!", "=", "null)", "{", "return", "doMethod1", "()", "}", "else", "{", "return", "doMethod2", "()", "}", "with", "return", "notBlankElse", "(", "bar", "::", "getName", "bar", "::", "getNickName", ")" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L143-L149
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/ZonedChronology.java
ZonedChronology.getInstance
public static ZonedChronology getInstance(Chronology base, DateTimeZone zone) { """ Create a ZonedChronology for any chronology, overriding any time zone it may already have. @param base base chronology to wrap @param zone the time zone @throws IllegalArgumentException if chronology or time zone is null """ if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } base = base.withUTC(); if (base == null) { throw new IllegalArgumentException("UTC chronology must not be null"); } if (zone == null) { throw new IllegalArgumentException("DateTimeZone must not be null"); } return new ZonedChronology(base, zone); }
java
public static ZonedChronology getInstance(Chronology base, DateTimeZone zone) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } base = base.withUTC(); if (base == null) { throw new IllegalArgumentException("UTC chronology must not be null"); } if (zone == null) { throw new IllegalArgumentException("DateTimeZone must not be null"); } return new ZonedChronology(base, zone); }
[ "public", "static", "ZonedChronology", "getInstance", "(", "Chronology", "base", ",", "DateTimeZone", "zone", ")", "{", "if", "(", "base", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Must supply a chronology\"", ")", ";", "}", "base", "=", "base", ".", "withUTC", "(", ")", ";", "if", "(", "base", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"UTC chronology must not be null\"", ")", ";", "}", "if", "(", "zone", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"DateTimeZone must not be null\"", ")", ";", "}", "return", "new", "ZonedChronology", "(", "base", ",", "zone", ")", ";", "}" ]
Create a ZonedChronology for any chronology, overriding any time zone it may already have. @param base base chronology to wrap @param zone the time zone @throws IllegalArgumentException if chronology or time zone is null
[ "Create", "a", "ZonedChronology", "for", "any", "chronology", "overriding", "any", "time", "zone", "it", "may", "already", "have", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/ZonedChronology.java#L58-L70
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java
ConfigValidator.checkCacheConfig
public static void checkCacheConfig(CacheSimpleConfig cacheSimpleConfig, CacheMergePolicyProvider mergePolicyProvider) { """ Validates the given {@link CacheSimpleConfig}. @param cacheSimpleConfig the {@link CacheSimpleConfig} to check @param mergePolicyProvider the {@link CacheMergePolicyProvider} to resolve merge policy classes """ checkCacheConfig(cacheSimpleConfig.getInMemoryFormat(), cacheSimpleConfig.getEvictionConfig(), cacheSimpleConfig.getMergePolicy(), cacheSimpleConfig, mergePolicyProvider); }
java
public static void checkCacheConfig(CacheSimpleConfig cacheSimpleConfig, CacheMergePolicyProvider mergePolicyProvider) { checkCacheConfig(cacheSimpleConfig.getInMemoryFormat(), cacheSimpleConfig.getEvictionConfig(), cacheSimpleConfig.getMergePolicy(), cacheSimpleConfig, mergePolicyProvider); }
[ "public", "static", "void", "checkCacheConfig", "(", "CacheSimpleConfig", "cacheSimpleConfig", ",", "CacheMergePolicyProvider", "mergePolicyProvider", ")", "{", "checkCacheConfig", "(", "cacheSimpleConfig", ".", "getInMemoryFormat", "(", ")", ",", "cacheSimpleConfig", ".", "getEvictionConfig", "(", ")", ",", "cacheSimpleConfig", ".", "getMergePolicy", "(", ")", ",", "cacheSimpleConfig", ",", "mergePolicyProvider", ")", ";", "}" ]
Validates the given {@link CacheSimpleConfig}. @param cacheSimpleConfig the {@link CacheSimpleConfig} to check @param mergePolicyProvider the {@link CacheMergePolicyProvider} to resolve merge policy classes
[ "Validates", "the", "given", "{", "@link", "CacheSimpleConfig", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L319-L322
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java
OmemoManager.isDecidedOmemoIdentity
public boolean isDecidedOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint) { """ Returns true, if the fingerprint/OmemoDevice tuple is decided by the user. The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must be of length 64. @param device device @param fingerprint fingerprint @return """ if (trustCallback == null) { throw new IllegalStateException("No TrustCallback set."); } return trustCallback.getTrust(device, fingerprint) != TrustState.undecided; }
java
public boolean isDecidedOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint) { if (trustCallback == null) { throw new IllegalStateException("No TrustCallback set."); } return trustCallback.getTrust(device, fingerprint) != TrustState.undecided; }
[ "public", "boolean", "isDecidedOmemoIdentity", "(", "OmemoDevice", "device", ",", "OmemoFingerprint", "fingerprint", ")", "{", "if", "(", "trustCallback", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"No TrustCallback set.\"", ")", ";", "}", "return", "trustCallback", ".", "getTrust", "(", "device", ",", "fingerprint", ")", "!=", "TrustState", ".", "undecided", ";", "}" ]
Returns true, if the fingerprint/OmemoDevice tuple is decided by the user. The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must be of length 64. @param device device @param fingerprint fingerprint @return
[ "Returns", "true", "if", "the", "fingerprint", "/", "OmemoDevice", "tuple", "is", "decided", "by", "the", "user", ".", "The", "fingerprint", "must", "be", "the", "lowercase", "hexadecimal", "fingerprint", "of", "the", "identityKey", "of", "the", "device", "and", "must", "be", "of", "length", "64", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java#L467-L473
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.removeFromLast
public boolean removeFromLast(ST obj, PT pt) { """ Remove the path's elements after the specified one which is starting at the specified point. The specified element will be removed. <p>This function removes after the <i>last occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code> """ return removeAfter(lastIndexOf(obj, pt), true); }
java
public boolean removeFromLast(ST obj, PT pt) { return removeAfter(lastIndexOf(obj, pt), true); }
[ "public", "boolean", "removeFromLast", "(", "ST", "obj", ",", "PT", "pt", ")", "{", "return", "removeAfter", "(", "lastIndexOf", "(", "obj", ",", "pt", ")", ",", "true", ")", ";", "}" ]
Remove the path's elements after the specified one which is starting at the specified point. The specified element will be removed. <p>This function removes after the <i>last occurence</i> of the given object. @param obj is the segment to remove @param pt is the point on which the segment was connected as its first point. @return <code>true</code> on success, otherwise <code>false</code>
[ "Remove", "the", "path", "s", "elements", "after", "the", "specified", "one", "which", "is", "starting", "at", "the", "specified", "point", ".", "The", "specified", "element", "will", "be", "removed", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L840-L842
alkacon/opencms-core
src/org/opencms/ade/publish/A_CmsPublishGroupHelper.java
A_CmsPublishGroupHelper.getPublishGroupName
public String getPublishGroupName(List<RESOURCE> resources, GroupAge age) { """ Returns the localized name for a given publish group based on its age.<p> @param resources the resources of the publish group @param age the age of the publish group @return the localized name of the publish group """ long groupDate = getDateLastModified(resources.get(0)); String groupName; switch (age) { case young: groupName = Messages.get().getBundle(m_locale).key( Messages.GUI_GROUPNAME_SESSION_1, new Date(groupDate)); break; case medium: groupName = Messages.get().getBundle(m_locale).key(Messages.GUI_GROUPNAME_DAY_1, new Date(groupDate)); break; case old: default: groupName = Messages.get().getBundle(m_locale).key(Messages.GUI_GROUPNAME_EVERYTHING_ELSE_0); break; } return groupName; }
java
public String getPublishGroupName(List<RESOURCE> resources, GroupAge age) { long groupDate = getDateLastModified(resources.get(0)); String groupName; switch (age) { case young: groupName = Messages.get().getBundle(m_locale).key( Messages.GUI_GROUPNAME_SESSION_1, new Date(groupDate)); break; case medium: groupName = Messages.get().getBundle(m_locale).key(Messages.GUI_GROUPNAME_DAY_1, new Date(groupDate)); break; case old: default: groupName = Messages.get().getBundle(m_locale).key(Messages.GUI_GROUPNAME_EVERYTHING_ELSE_0); break; } return groupName; }
[ "public", "String", "getPublishGroupName", "(", "List", "<", "RESOURCE", ">", "resources", ",", "GroupAge", "age", ")", "{", "long", "groupDate", "=", "getDateLastModified", "(", "resources", ".", "get", "(", "0", ")", ")", ";", "String", "groupName", ";", "switch", "(", "age", ")", "{", "case", "young", ":", "groupName", "=", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "m_locale", ")", ".", "key", "(", "Messages", ".", "GUI_GROUPNAME_SESSION_1", ",", "new", "Date", "(", "groupDate", ")", ")", ";", "break", ";", "case", "medium", ":", "groupName", "=", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "m_locale", ")", ".", "key", "(", "Messages", ".", "GUI_GROUPNAME_DAY_1", ",", "new", "Date", "(", "groupDate", ")", ")", ";", "break", ";", "case", "old", ":", "default", ":", "groupName", "=", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "m_locale", ")", ".", "key", "(", "Messages", ".", "GUI_GROUPNAME_EVERYTHING_ELSE_0", ")", ";", "break", ";", "}", "return", "groupName", ";", "}" ]
Returns the localized name for a given publish group based on its age.<p> @param resources the resources of the publish group @param age the age of the publish group @return the localized name of the publish group
[ "Returns", "the", "localized", "name", "for", "a", "given", "publish", "group", "based", "on", "its", "age", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/A_CmsPublishGroupHelper.java#L236-L256
logic-ng/LogicNG
src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java
CCEncoder.encodeConstraint
private void encodeConstraint(final PBConstraint cc, final EncodingResult result) { """ Encodes the constraint in the given result. @param cc the constraint @param result the result """ if (!cc.isCC()) throw new IllegalArgumentException("Cannot encode a non-cardinality constraint with a cardinality constraint encoder."); final Variable[] ops = litsAsVars(cc.operands()); switch (cc.comparator()) { case LE: if (cc.rhs() == 1) this.amo(result, ops); else this.amk(result, ops, cc.rhs()); break; case LT: if (cc.rhs() == 2) this.amo(result, ops); else this.amk(result, ops, cc.rhs() - 1); break; case GE: this.alk(result, ops, cc.rhs()); break; case GT: this.alk(result, ops, cc.rhs() + 1); break; case EQ: if (cc.rhs() == 1) this.exo(result, ops); else this.exk(result, ops, cc.rhs()); break; default: throw new IllegalArgumentException("Unknown pseudo-Boolean comparator: " + cc.comparator()); } }
java
private void encodeConstraint(final PBConstraint cc, final EncodingResult result) { if (!cc.isCC()) throw new IllegalArgumentException("Cannot encode a non-cardinality constraint with a cardinality constraint encoder."); final Variable[] ops = litsAsVars(cc.operands()); switch (cc.comparator()) { case LE: if (cc.rhs() == 1) this.amo(result, ops); else this.amk(result, ops, cc.rhs()); break; case LT: if (cc.rhs() == 2) this.amo(result, ops); else this.amk(result, ops, cc.rhs() - 1); break; case GE: this.alk(result, ops, cc.rhs()); break; case GT: this.alk(result, ops, cc.rhs() + 1); break; case EQ: if (cc.rhs() == 1) this.exo(result, ops); else this.exk(result, ops, cc.rhs()); break; default: throw new IllegalArgumentException("Unknown pseudo-Boolean comparator: " + cc.comparator()); } }
[ "private", "void", "encodeConstraint", "(", "final", "PBConstraint", "cc", ",", "final", "EncodingResult", "result", ")", "{", "if", "(", "!", "cc", ".", "isCC", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cannot encode a non-cardinality constraint with a cardinality constraint encoder.\"", ")", ";", "final", "Variable", "[", "]", "ops", "=", "litsAsVars", "(", "cc", ".", "operands", "(", ")", ")", ";", "switch", "(", "cc", ".", "comparator", "(", ")", ")", "{", "case", "LE", ":", "if", "(", "cc", ".", "rhs", "(", ")", "==", "1", ")", "this", ".", "amo", "(", "result", ",", "ops", ")", ";", "else", "this", ".", "amk", "(", "result", ",", "ops", ",", "cc", ".", "rhs", "(", ")", ")", ";", "break", ";", "case", "LT", ":", "if", "(", "cc", ".", "rhs", "(", ")", "==", "2", ")", "this", ".", "amo", "(", "result", ",", "ops", ")", ";", "else", "this", ".", "amk", "(", "result", ",", "ops", ",", "cc", ".", "rhs", "(", ")", "-", "1", ")", ";", "break", ";", "case", "GE", ":", "this", ".", "alk", "(", "result", ",", "ops", ",", "cc", ".", "rhs", "(", ")", ")", ";", "break", ";", "case", "GT", ":", "this", ".", "alk", "(", "result", ",", "ops", ",", "cc", ".", "rhs", "(", ")", "+", "1", ")", ";", "break", ";", "case", "EQ", ":", "if", "(", "cc", ".", "rhs", "(", ")", "==", "1", ")", "this", ".", "exo", "(", "result", ",", "ops", ")", ";", "else", "this", ".", "exk", "(", "result", ",", "ops", ",", "cc", ".", "rhs", "(", ")", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unknown pseudo-Boolean comparator: \"", "+", "cc", ".", "comparator", "(", ")", ")", ";", "}", "}" ]
Encodes the constraint in the given result. @param cc the constraint @param result the result
[ "Encodes", "the", "constraint", "in", "the", "given", "result", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java#L198-L230
BrunoEberhard/minimal-j
src/main/java/org/minimalj/frontend/form/Form.java
Form.addDependecy
@SuppressWarnings("rawtypes") public <FROM, TO> void addDependecy(FROM from, PropertyUpdater<FROM, TO, T> updater, TO to) { """ Declares that if the key or property <i>from</i> changes the specified updater should be called and after its return the <i>to</i> key or property could have changed.<p> This is used if there is a more complex relation between two fields. @param <FROM> the type (class) of the fromKey / field @param <TO> the type (class) of the toKey / field @param from the field triggering the update @param updater the updater doing the change of the to field @param to the changed field by the updater """ PropertyInterface fromProperty = Keys.getProperty(from); if (!propertyUpdater.containsKey(fromProperty)) { propertyUpdater.put(fromProperty, new HashMap<PropertyInterface, PropertyUpdater>()); } PropertyInterface toProperty = Keys.getProperty(to); propertyUpdater.get(fromProperty).put(toProperty, updater); addDependecy(from, to); }
java
@SuppressWarnings("rawtypes") public <FROM, TO> void addDependecy(FROM from, PropertyUpdater<FROM, TO, T> updater, TO to) { PropertyInterface fromProperty = Keys.getProperty(from); if (!propertyUpdater.containsKey(fromProperty)) { propertyUpdater.put(fromProperty, new HashMap<PropertyInterface, PropertyUpdater>()); } PropertyInterface toProperty = Keys.getProperty(to); propertyUpdater.get(fromProperty).put(toProperty, updater); addDependecy(from, to); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "<", "FROM", ",", "TO", ">", "void", "addDependecy", "(", "FROM", "from", ",", "PropertyUpdater", "<", "FROM", ",", "TO", ",", "T", ">", "updater", ",", "TO", "to", ")", "{", "PropertyInterface", "fromProperty", "=", "Keys", ".", "getProperty", "(", "from", ")", ";", "if", "(", "!", "propertyUpdater", ".", "containsKey", "(", "fromProperty", ")", ")", "{", "propertyUpdater", ".", "put", "(", "fromProperty", ",", "new", "HashMap", "<", "PropertyInterface", ",", "PropertyUpdater", ">", "(", ")", ")", ";", "}", "PropertyInterface", "toProperty", "=", "Keys", ".", "getProperty", "(", "to", ")", ";", "propertyUpdater", ".", "get", "(", "fromProperty", ")", ".", "put", "(", "toProperty", ",", "updater", ")", ";", "addDependecy", "(", "from", ",", "to", ")", ";", "}" ]
Declares that if the key or property <i>from</i> changes the specified updater should be called and after its return the <i>to</i> key or property could have changed.<p> This is used if there is a more complex relation between two fields. @param <FROM> the type (class) of the fromKey / field @param <TO> the type (class) of the toKey / field @param from the field triggering the update @param updater the updater doing the change of the to field @param to the changed field by the updater
[ "Declares", "that", "if", "the", "key", "or", "property", "<i", ">", "from<", "/", "i", ">", "changes", "the", "specified", "updater", "should", "be", "called", "and", "after", "its", "return", "the", "<i", ">", "to<", "/", "i", ">", "key", "or", "property", "could", "have", "changed", ".", "<p", ">" ]
train
https://github.com/BrunoEberhard/minimal-j/blob/f7c5461b2b47a10b383aee1e2f1f150f6773703b/src/main/java/org/minimalj/frontend/form/Form.java#L272-L281
infinispan/infinispan
query/src/main/java/org/infinispan/query/dsl/embedded/impl/HibernateSearchPropertyHelper.java
HibernateSearchPropertyHelper.convertToPropertyType
@Override public Object convertToPropertyType(Class<?> entityType, String[] propertyPath, String value) { """ Returns the given value converted into the type of the given property as determined via the field bridge of the property. @param value the value to convert @param entityType the type hosting the property @param propertyPath the name of the property @return the given value converted into the type of the given property """ EntityIndexBinding indexBinding = searchFactory.getIndexBindings().get(entityType); if (indexBinding != null) { DocumentFieldMetadata fieldMetadata = getDocumentFieldMetadata(indexBinding, propertyPath); if (fieldMetadata != null) { FieldBridge bridge = fieldMetadata.getFieldBridge(); return convertToPropertyType(value, bridge); } } return super.convertToPropertyType(entityType, propertyPath, value); }
java
@Override public Object convertToPropertyType(Class<?> entityType, String[] propertyPath, String value) { EntityIndexBinding indexBinding = searchFactory.getIndexBindings().get(entityType); if (indexBinding != null) { DocumentFieldMetadata fieldMetadata = getDocumentFieldMetadata(indexBinding, propertyPath); if (fieldMetadata != null) { FieldBridge bridge = fieldMetadata.getFieldBridge(); return convertToPropertyType(value, bridge); } } return super.convertToPropertyType(entityType, propertyPath, value); }
[ "@", "Override", "public", "Object", "convertToPropertyType", "(", "Class", "<", "?", ">", "entityType", ",", "String", "[", "]", "propertyPath", ",", "String", "value", ")", "{", "EntityIndexBinding", "indexBinding", "=", "searchFactory", ".", "getIndexBindings", "(", ")", ".", "get", "(", "entityType", ")", ";", "if", "(", "indexBinding", "!=", "null", ")", "{", "DocumentFieldMetadata", "fieldMetadata", "=", "getDocumentFieldMetadata", "(", "indexBinding", ",", "propertyPath", ")", ";", "if", "(", "fieldMetadata", "!=", "null", ")", "{", "FieldBridge", "bridge", "=", "fieldMetadata", ".", "getFieldBridge", "(", ")", ";", "return", "convertToPropertyType", "(", "value", ",", "bridge", ")", ";", "}", "}", "return", "super", ".", "convertToPropertyType", "(", "entityType", ",", "propertyPath", ",", "value", ")", ";", "}" ]
Returns the given value converted into the type of the given property as determined via the field bridge of the property. @param value the value to convert @param entityType the type hosting the property @param propertyPath the name of the property @return the given value converted into the type of the given property
[ "Returns", "the", "given", "value", "converted", "into", "the", "type", "of", "the", "given", "property", "as", "determined", "via", "the", "field", "bridge", "of", "the", "property", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/dsl/embedded/impl/HibernateSearchPropertyHelper.java#L98-L109
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java
DocBookBuildUtilities.convertDocumentToCDATAFormattedString
public static String convertDocumentToCDATAFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) { """ Convert a DOM Document to a Formatted String representation and wrap it in a CDATA element. @param doc The DOM Document to be converted and formatted. @param xmlFormatProperties The XML Formatting Properties. @return The converted XML String representation. """ return XMLUtilities.wrapStringInCDATA(convertDocumentToFormattedString(doc, xmlFormatProperties)); }
java
public static String convertDocumentToCDATAFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) { return XMLUtilities.wrapStringInCDATA(convertDocumentToFormattedString(doc, xmlFormatProperties)); }
[ "public", "static", "String", "convertDocumentToCDATAFormattedString", "(", "final", "Document", "doc", ",", "final", "XMLFormatProperties", "xmlFormatProperties", ")", "{", "return", "XMLUtilities", ".", "wrapStringInCDATA", "(", "convertDocumentToFormattedString", "(", "doc", ",", "xmlFormatProperties", ")", ")", ";", "}" ]
Convert a DOM Document to a Formatted String representation and wrap it in a CDATA element. @param doc The DOM Document to be converted and formatted. @param xmlFormatProperties The XML Formatting Properties. @return The converted XML String representation.
[ "Convert", "a", "DOM", "Document", "to", "a", "Formatted", "String", "representation", "and", "wrap", "it", "in", "a", "CDATA", "element", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L474-L476
rollbar/rollbar-java
rollbar-java/src/main/java/com/rollbar/notifier/util/ObjectsUtils.java
ObjectsUtils.requireNonNull
public static <T> T requireNonNull(T object, String errorMessage) { """ Checks that the specified object reference is not null. @param object the object reference to check for nullity @param errorMessage detail message to be used in the event that a NullPointerException is thrown @param <T> the type of the reference @return object if not null """ if (object == null) { throw new NullPointerException(errorMessage); } else { return object; } }
java
public static <T> T requireNonNull(T object, String errorMessage) { if (object == null) { throw new NullPointerException(errorMessage); } else { return object; } }
[ "public", "static", "<", "T", ">", "T", "requireNonNull", "(", "T", "object", ",", "String", "errorMessage", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "errorMessage", ")", ";", "}", "else", "{", "return", "object", ";", "}", "}" ]
Checks that the specified object reference is not null. @param object the object reference to check for nullity @param errorMessage detail message to be used in the event that a NullPointerException is thrown @param <T> the type of the reference @return object if not null
[ "Checks", "that", "the", "specified", "object", "reference", "is", "not", "null", "." ]
train
https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-java/src/main/java/com/rollbar/notifier/util/ObjectsUtils.java#L33-L39
kiegroup/jbpm
jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/lifecycle/listeners/BAMTaskEventListener.java
BAMTaskEventListener.createOrUpdateTask
protected BAMTaskSummaryImpl createOrUpdateTask(TaskEvent event, Status newStatus) { """ Creates or updates a bam task summary instance. @param ti The source task @param newStatus The new state for the task. @return The created or updated bam task summary instance. """ return updateTask(event, newStatus, null); }
java
protected BAMTaskSummaryImpl createOrUpdateTask(TaskEvent event, Status newStatus) { return updateTask(event, newStatus, null); }
[ "protected", "BAMTaskSummaryImpl", "createOrUpdateTask", "(", "TaskEvent", "event", ",", "Status", "newStatus", ")", "{", "return", "updateTask", "(", "event", ",", "newStatus", ",", "null", ")", ";", "}" ]
Creates or updates a bam task summary instance. @param ti The source task @param newStatus The new state for the task. @return The created or updated bam task summary instance.
[ "Creates", "or", "updates", "a", "bam", "task", "summary", "instance", "." ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/lifecycle/listeners/BAMTaskEventListener.java#L206-L208
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/common/service/SystemMessages.java
SystemMessages.bulletinOff
public static void bulletinOff(Bulletin bulletin, Level level, String message) { """ Should be the same instance or have the same id as the bulletinOn message. """ if (bulletin == null) return; synchronized (bulletins) { bulletins.remove(bulletin.getId(), bulletin); } try { WebSocketMessenger.getInstance().send("SystemMessage", bulletin.off(message).getJson().toString()); } catch (IOException ex) { logger.warnException("Unable to publish to websocket", ex); } }
java
public static void bulletinOff(Bulletin bulletin, Level level, String message) { if (bulletin == null) return; synchronized (bulletins) { bulletins.remove(bulletin.getId(), bulletin); } try { WebSocketMessenger.getInstance().send("SystemMessage", bulletin.off(message).getJson().toString()); } catch (IOException ex) { logger.warnException("Unable to publish to websocket", ex); } }
[ "public", "static", "void", "bulletinOff", "(", "Bulletin", "bulletin", ",", "Level", "level", ",", "String", "message", ")", "{", "if", "(", "bulletin", "==", "null", ")", "return", ";", "synchronized", "(", "bulletins", ")", "{", "bulletins", ".", "remove", "(", "bulletin", ".", "getId", "(", ")", ",", "bulletin", ")", ";", "}", "try", "{", "WebSocketMessenger", ".", "getInstance", "(", ")", ".", "send", "(", "\"SystemMessage\"", ",", "bulletin", ".", "off", "(", "message", ")", ".", "getJson", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "logger", ".", "warnException", "(", "\"Unable to publish to websocket\"", ",", "ex", ")", ";", "}", "}" ]
Should be the same instance or have the same id as the bulletinOn message.
[ "Should", "be", "the", "same", "instance", "or", "have", "the", "same", "id", "as", "the", "bulletinOn", "message", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/common/service/SystemMessages.java#L76-L88
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectedItemsInner.java
ProtectedItemsInner.createOrUpdate
public void createOrUpdate(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, ProtectedItemResourceInner parameters) { """ Enables backup of an item or to modifies the backup policy information of an already backed up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated with the backup item. @param containerName Container name associated with the backup item. @param protectedItemName Item name to be backed up. @param parameters resource backed up item @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters).toBlocking().single().body(); }
java
public void createOrUpdate(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, ProtectedItemResourceInner parameters) { createOrUpdateWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters).toBlocking().single().body(); }
[ "public", "void", "createOrUpdate", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "fabricName", ",", "String", "containerName", ",", "String", "protectedItemName", ",", "ProtectedItemResourceInner", "parameters", ")", "{", "createOrUpdateWithServiceResponseAsync", "(", "vaultName", ",", "resourceGroupName", ",", "fabricName", ",", "containerName", ",", "protectedItemName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Enables backup of an item or to modifies the backup policy information of an already backed up item. This is an asynchronous operation. To know the status of the operation, call the GetItemOperationResult API. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated with the backup item. @param containerName Container name associated with the backup item. @param protectedItemName Item name to be backed up. @param parameters resource backed up item @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Enables", "backup", "of", "an", "item", "or", "to", "modifies", "the", "backup", "policy", "information", "of", "an", "already", "backed", "up", "item", ".", "This", "is", "an", "asynchronous", "operation", ".", "To", "know", "the", "status", "of", "the", "operation", "call", "the", "GetItemOperationResult", "API", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/ProtectedItemsInner.java#L297-L299
landawn/AbacusUtil
src/com/landawn/abacus/util/DoubleList.java
DoubleList.reduce
public <E extends Exception> double reduce(final double identity, final Try.DoubleBinaryOperator<E> accumulator) throws E { """ This is equivalent to: <pre> <code> if (isEmpty()) { return identity; } double result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsDouble(result, elementData[i]); } return result; </code> </pre> @param identity @param accumulator @return """ if (isEmpty()) { return identity; } double result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsDouble(result, elementData[i]); } return result; }
java
public <E extends Exception> double reduce(final double identity, final Try.DoubleBinaryOperator<E> accumulator) throws E { if (isEmpty()) { return identity; } double result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsDouble(result, elementData[i]); } return result; }
[ "public", "<", "E", "extends", "Exception", ">", "double", "reduce", "(", "final", "double", "identity", ",", "final", "Try", ".", "DoubleBinaryOperator", "<", "E", ">", "accumulator", ")", "throws", "E", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "return", "identity", ";", "}", "double", "result", "=", "identity", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "result", "=", "accumulator", ".", "applyAsDouble", "(", "result", ",", "elementData", "[", "i", "]", ")", ";", "}", "return", "result", ";", "}" ]
This is equivalent to: <pre> <code> if (isEmpty()) { return identity; } double result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsDouble(result, elementData[i]); } return result; </code> </pre> @param identity @param accumulator @return
[ "This", "is", "equivalent", "to", ":", "<pre", ">", "<code", ">", "if", "(", "isEmpty", "()", ")", "{", "return", "identity", ";", "}" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DoubleList.java#L1103-L1115
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java
CheckpointCoordinator.triggerCheckpoint
public boolean triggerCheckpoint(long timestamp, boolean isPeriodic) { """ Triggers a new standard checkpoint and uses the given timestamp as the checkpoint timestamp. @param timestamp The timestamp for the checkpoint. @param isPeriodic Flag indicating whether this triggered checkpoint is periodic. If this flag is true, but the periodic scheduler is disabled, the checkpoint will be declined. @return <code>true</code> if triggering the checkpoint succeeded. """ try { triggerCheckpoint(timestamp, checkpointProperties, null, isPeriodic, false); return true; } catch (CheckpointException e) { return false; } }
java
public boolean triggerCheckpoint(long timestamp, boolean isPeriodic) { try { triggerCheckpoint(timestamp, checkpointProperties, null, isPeriodic, false); return true; } catch (CheckpointException e) { return false; } }
[ "public", "boolean", "triggerCheckpoint", "(", "long", "timestamp", ",", "boolean", "isPeriodic", ")", "{", "try", "{", "triggerCheckpoint", "(", "timestamp", ",", "checkpointProperties", ",", "null", ",", "isPeriodic", ",", "false", ")", ";", "return", "true", ";", "}", "catch", "(", "CheckpointException", "e", ")", "{", "return", "false", ";", "}", "}" ]
Triggers a new standard checkpoint and uses the given timestamp as the checkpoint timestamp. @param timestamp The timestamp for the checkpoint. @param isPeriodic Flag indicating whether this triggered checkpoint is periodic. If this flag is true, but the periodic scheduler is disabled, the checkpoint will be declined. @return <code>true</code> if triggering the checkpoint succeeded.
[ "Triggers", "a", "new", "standard", "checkpoint", "and", "uses", "the", "given", "timestamp", "as", "the", "checkpoint", "timestamp", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinator.java#L433-L440
spring-projects/spring-security-oauth
spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java
DefaultRedirectResolver.obtainMatchingRedirect
private String obtainMatchingRedirect(Set<String> redirectUris, String requestedRedirect) { """ Attempt to match one of the registered URIs to the that of the requested one. @param redirectUris the set of the registered URIs to try and find a match. This cannot be null or empty. @param requestedRedirect the URI used as part of the request @return redirect uri @throws RedirectMismatchException if no match was found """ Assert.notEmpty(redirectUris, "Redirect URIs cannot be empty"); if (redirectUris.size() == 1 && requestedRedirect == null) { return redirectUris.iterator().next(); } for (String redirectUri : redirectUris) { if (requestedRedirect != null && redirectMatches(requestedRedirect, redirectUri)) { // Initialize with the registered redirect-uri UriComponentsBuilder redirectUriBuilder = UriComponentsBuilder.fromUriString(redirectUri); UriComponents requestedRedirectUri = UriComponentsBuilder.fromUriString(requestedRedirect).build(); if (this.matchSubdomains) { redirectUriBuilder.host(requestedRedirectUri.getHost()); } if (!this.matchPorts) { redirectUriBuilder.port(requestedRedirectUri.getPort()); } redirectUriBuilder.replaceQuery(requestedRedirectUri.getQuery()); // retain additional params (if any) redirectUriBuilder.fragment(null); return redirectUriBuilder.build().toUriString(); } } throw new RedirectMismatchException("Invalid redirect: " + requestedRedirect + " does not match one of the registered values."); }
java
private String obtainMatchingRedirect(Set<String> redirectUris, String requestedRedirect) { Assert.notEmpty(redirectUris, "Redirect URIs cannot be empty"); if (redirectUris.size() == 1 && requestedRedirect == null) { return redirectUris.iterator().next(); } for (String redirectUri : redirectUris) { if (requestedRedirect != null && redirectMatches(requestedRedirect, redirectUri)) { // Initialize with the registered redirect-uri UriComponentsBuilder redirectUriBuilder = UriComponentsBuilder.fromUriString(redirectUri); UriComponents requestedRedirectUri = UriComponentsBuilder.fromUriString(requestedRedirect).build(); if (this.matchSubdomains) { redirectUriBuilder.host(requestedRedirectUri.getHost()); } if (!this.matchPorts) { redirectUriBuilder.port(requestedRedirectUri.getPort()); } redirectUriBuilder.replaceQuery(requestedRedirectUri.getQuery()); // retain additional params (if any) redirectUriBuilder.fragment(null); return redirectUriBuilder.build().toUriString(); } } throw new RedirectMismatchException("Invalid redirect: " + requestedRedirect + " does not match one of the registered values."); }
[ "private", "String", "obtainMatchingRedirect", "(", "Set", "<", "String", ">", "redirectUris", ",", "String", "requestedRedirect", ")", "{", "Assert", ".", "notEmpty", "(", "redirectUris", ",", "\"Redirect URIs cannot be empty\"", ")", ";", "if", "(", "redirectUris", ".", "size", "(", ")", "==", "1", "&&", "requestedRedirect", "==", "null", ")", "{", "return", "redirectUris", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}", "for", "(", "String", "redirectUri", ":", "redirectUris", ")", "{", "if", "(", "requestedRedirect", "!=", "null", "&&", "redirectMatches", "(", "requestedRedirect", ",", "redirectUri", ")", ")", "{", "// Initialize with the registered redirect-uri", "UriComponentsBuilder", "redirectUriBuilder", "=", "UriComponentsBuilder", ".", "fromUriString", "(", "redirectUri", ")", ";", "UriComponents", "requestedRedirectUri", "=", "UriComponentsBuilder", ".", "fromUriString", "(", "requestedRedirect", ")", ".", "build", "(", ")", ";", "if", "(", "this", ".", "matchSubdomains", ")", "{", "redirectUriBuilder", ".", "host", "(", "requestedRedirectUri", ".", "getHost", "(", ")", ")", ";", "}", "if", "(", "!", "this", ".", "matchPorts", ")", "{", "redirectUriBuilder", ".", "port", "(", "requestedRedirectUri", ".", "getPort", "(", ")", ")", ";", "}", "redirectUriBuilder", ".", "replaceQuery", "(", "requestedRedirectUri", ".", "getQuery", "(", ")", ")", ";", "// retain additional params (if any)", "redirectUriBuilder", ".", "fragment", "(", "null", ")", ";", "return", "redirectUriBuilder", ".", "build", "(", ")", ".", "toUriString", "(", ")", ";", "}", "}", "throw", "new", "RedirectMismatchException", "(", "\"Invalid redirect: \"", "+", "requestedRedirect", "+", "\" does not match one of the registered values.\"", ")", ";", "}" ]
Attempt to match one of the registered URIs to the that of the requested one. @param redirectUris the set of the registered URIs to try and find a match. This cannot be null or empty. @param requestedRedirect the URI used as part of the request @return redirect uri @throws RedirectMismatchException if no match was found
[ "Attempt", "to", "match", "one", "of", "the", "registered", "URIs", "to", "the", "that", "of", "the", "requested", "one", "." ]
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/endpoint/DefaultRedirectResolver.java#L205-L233
dmak/jaxb-xew-plugin
src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java
CommonUtils.copyFields
public static <S, D extends S> void copyFields(final S src, D dest) throws IllegalArgumentException { """ Perform the copying of all fields from {@code src} to {@code dest}. The code was copied from {@code org.springframework.util.ReflectionUtils#shallowCopyFieldState(Object, Object)}. """ Class<?> targetClass = src.getClass(); do { Field[] fields = targetClass.getDeclaredFields(); for (Field field : fields) { // Skip static fields: if (Modifier.isStatic(field.getModifiers())) { continue; } try { if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } Object srcValue = field.get(src); field.set(dest, srcValue); } catch (IllegalAccessException ex) { throw new IllegalStateException( "Shouldn't be illegal to access field '" + field.getName() + "': " + ex); } } targetClass = targetClass.getSuperclass(); } while (targetClass != null && targetClass != Object.class); }
java
public static <S, D extends S> void copyFields(final S src, D dest) throws IllegalArgumentException { Class<?> targetClass = src.getClass(); do { Field[] fields = targetClass.getDeclaredFields(); for (Field field : fields) { // Skip static fields: if (Modifier.isStatic(field.getModifiers())) { continue; } try { if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) { field.setAccessible(true); } Object srcValue = field.get(src); field.set(dest, srcValue); } catch (IllegalAccessException ex) { throw new IllegalStateException( "Shouldn't be illegal to access field '" + field.getName() + "': " + ex); } } targetClass = targetClass.getSuperclass(); } while (targetClass != null && targetClass != Object.class); }
[ "public", "static", "<", "S", ",", "D", "extends", "S", ">", "void", "copyFields", "(", "final", "S", "src", ",", "D", "dest", ")", "throws", "IllegalArgumentException", "{", "Class", "<", "?", ">", "targetClass", "=", "src", ".", "getClass", "(", ")", ";", "do", "{", "Field", "[", "]", "fields", "=", "targetClass", ".", "getDeclaredFields", "(", ")", ";", "for", "(", "Field", "field", ":", "fields", ")", "{", "// Skip static fields:", "if", "(", "Modifier", ".", "isStatic", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "{", "continue", ";", "}", "try", "{", "if", "(", "(", "!", "Modifier", ".", "isPublic", "(", "field", ".", "getModifiers", "(", ")", ")", "||", "!", "Modifier", ".", "isPublic", "(", "field", ".", "getDeclaringClass", "(", ")", ".", "getModifiers", "(", ")", ")", "||", "Modifier", ".", "isFinal", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "&&", "!", "field", ".", "isAccessible", "(", ")", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "}", "Object", "srcValue", "=", "field", ".", "get", "(", "src", ")", ";", "field", ".", "set", "(", "dest", ",", "srcValue", ")", ";", "}", "catch", "(", "IllegalAccessException", "ex", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Shouldn't be illegal to access field '\"", "+", "field", ".", "getName", "(", ")", "+", "\"': \"", "+", "ex", ")", ";", "}", "}", "targetClass", "=", "targetClass", ".", "getSuperclass", "(", ")", ";", "}", "while", "(", "targetClass", "!=", "null", "&&", "targetClass", "!=", "Object", ".", "class", ")", ";", "}" ]
Perform the copying of all fields from {@code src} to {@code dest}. The code was copied from {@code org.springframework.util.ReflectionUtils#shallowCopyFieldState(Object, Object)}.
[ "Perform", "the", "copying", "of", "all", "fields", "from", "{" ]
train
https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java#L209-L236
kstateome/canvas-api
src/main/java/edu/ksu/canvas/CanvasApiFactory.java
CanvasApiFactory.getReader
public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken, Integer paginationPageSize) { """ Get a reader implementation class to perform API calls with while specifying an explicit page size for paginated API calls. This gets translated to a per_page= parameter on API requests. Note that Canvas does not guarantee it will honor this page size request. There is an explicit maximum page size on the server side which could change. The default page size is 10 which can be limiting when, for example, trying to get all users in a 800 person course. @param type Interface type you wish to get an implementation for @param oauthToken An OAuth token to use for authentication when making API calls @param paginationPageSize Requested pagination page size @param <T> The reader type to request an instance of @return An instance of the requested reader class """ LOG.debug("Factory call to instantiate class: " + type.getName()); RestClient restClient = new RefreshingRestClient(); @SuppressWarnings("unchecked") Class<T> concreteClass = (Class<T>)readerMap.get(type); if (concreteClass == null) { throw new UnsupportedOperationException("No implementation for requested interface found: " + type.getName()); } LOG.debug("got class: " + concreteClass); try { Constructor<T> constructor = concreteClass.getConstructor(String.class, Integer.class, OauthToken.class, RestClient.class, Integer.TYPE, Integer.TYPE, Integer.class, Boolean.class); return constructor.newInstance(canvasBaseUrl, CANVAS_API_VERSION, oauthToken, restClient, connectTimeout, readTimeout, paginationPageSize, false); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) { throw new UnsupportedOperationException("Unknown error instantiating the concrete API class: " + type.getName(), e); } }
java
public <T extends CanvasReader> T getReader(Class<T> type, OauthToken oauthToken, Integer paginationPageSize) { LOG.debug("Factory call to instantiate class: " + type.getName()); RestClient restClient = new RefreshingRestClient(); @SuppressWarnings("unchecked") Class<T> concreteClass = (Class<T>)readerMap.get(type); if (concreteClass == null) { throw new UnsupportedOperationException("No implementation for requested interface found: " + type.getName()); } LOG.debug("got class: " + concreteClass); try { Constructor<T> constructor = concreteClass.getConstructor(String.class, Integer.class, OauthToken.class, RestClient.class, Integer.TYPE, Integer.TYPE, Integer.class, Boolean.class); return constructor.newInstance(canvasBaseUrl, CANVAS_API_VERSION, oauthToken, restClient, connectTimeout, readTimeout, paginationPageSize, false); } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException | InstantiationException e) { throw new UnsupportedOperationException("Unknown error instantiating the concrete API class: " + type.getName(), e); } }
[ "public", "<", "T", "extends", "CanvasReader", ">", "T", "getReader", "(", "Class", "<", "T", ">", "type", ",", "OauthToken", "oauthToken", ",", "Integer", "paginationPageSize", ")", "{", "LOG", ".", "debug", "(", "\"Factory call to instantiate class: \"", "+", "type", ".", "getName", "(", ")", ")", ";", "RestClient", "restClient", "=", "new", "RefreshingRestClient", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Class", "<", "T", ">", "concreteClass", "=", "(", "Class", "<", "T", ">", ")", "readerMap", ".", "get", "(", "type", ")", ";", "if", "(", "concreteClass", "==", "null", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"No implementation for requested interface found: \"", "+", "type", ".", "getName", "(", ")", ")", ";", "}", "LOG", ".", "debug", "(", "\"got class: \"", "+", "concreteClass", ")", ";", "try", "{", "Constructor", "<", "T", ">", "constructor", "=", "concreteClass", ".", "getConstructor", "(", "String", ".", "class", ",", "Integer", ".", "class", ",", "OauthToken", ".", "class", ",", "RestClient", ".", "class", ",", "Integer", ".", "TYPE", ",", "Integer", ".", "TYPE", ",", "Integer", ".", "class", ",", "Boolean", ".", "class", ")", ";", "return", "constructor", ".", "newInstance", "(", "canvasBaseUrl", ",", "CANVAS_API_VERSION", ",", "oauthToken", ",", "restClient", ",", "connectTimeout", ",", "readTimeout", ",", "paginationPageSize", ",", "false", ")", ";", "}", "catch", "(", "NoSuchMethodException", "|", "InvocationTargetException", "|", "IllegalAccessException", "|", "InstantiationException", "e", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Unknown error instantiating the concrete API class: \"", "+", "type", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "}" ]
Get a reader implementation class to perform API calls with while specifying an explicit page size for paginated API calls. This gets translated to a per_page= parameter on API requests. Note that Canvas does not guarantee it will honor this page size request. There is an explicit maximum page size on the server side which could change. The default page size is 10 which can be limiting when, for example, trying to get all users in a 800 person course. @param type Interface type you wish to get an implementation for @param oauthToken An OAuth token to use for authentication when making API calls @param paginationPageSize Requested pagination page size @param <T> The reader type to request an instance of @return An instance of the requested reader class
[ "Get", "a", "reader", "implementation", "class", "to", "perform", "API", "calls", "with", "while", "specifying", "an", "explicit", "page", "size", "for", "paginated", "API", "calls", ".", "This", "gets", "translated", "to", "a", "per_page", "=", "parameter", "on", "API", "requests", ".", "Note", "that", "Canvas", "does", "not", "guarantee", "it", "will", "honor", "this", "page", "size", "request", ".", "There", "is", "an", "explicit", "maximum", "page", "size", "on", "the", "server", "side", "which", "could", "change", ".", "The", "default", "page", "size", "is", "10", "which", "can", "be", "limiting", "when", "for", "example", "trying", "to", "get", "all", "users", "in", "a", "800", "person", "course", "." ]
train
https://github.com/kstateome/canvas-api/blob/426bf403a8fd7aca3f170348005feda25b374e5a/src/main/java/edu/ksu/canvas/CanvasApiFactory.java#L83-L103
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java
InternalUtilities.getMostCommonElementInList
public static <T> T getMostCommonElementInList(List<T> sourceList) { """ getMostCommonElementInList, This returns the most common element in the supplied list. In the event of a tie, any element that is tied as the "largest element" may be returned. If the list has no elements, or if the list is null, then this will return null. This can also return null if null happens to be the most common element in the source list. """ if (sourceList == null || sourceList.isEmpty()) { return null; } Map<T, Integer> hashMap = new HashMap<T, Integer>(); for (T element : sourceList) { Integer countOrNull = hashMap.get(element); int newCount = (countOrNull == null) ? 1 : (countOrNull + 1); hashMap.put(element, newCount); } // Find the largest entry. // In the event of a tie, the first entry (the first entry in the hash map, not in the list) // with the maximum count will be returned. Entry<T, Integer> largestEntry = null; for (Entry<T, Integer> currentEntry : hashMap.entrySet()) { if (largestEntry == null || currentEntry.getValue() > largestEntry.getValue()) { largestEntry = currentEntry; } } T result = (largestEntry == null) ? null : largestEntry.getKey(); return result; }
java
public static <T> T getMostCommonElementInList(List<T> sourceList) { if (sourceList == null || sourceList.isEmpty()) { return null; } Map<T, Integer> hashMap = new HashMap<T, Integer>(); for (T element : sourceList) { Integer countOrNull = hashMap.get(element); int newCount = (countOrNull == null) ? 1 : (countOrNull + 1); hashMap.put(element, newCount); } // Find the largest entry. // In the event of a tie, the first entry (the first entry in the hash map, not in the list) // with the maximum count will be returned. Entry<T, Integer> largestEntry = null; for (Entry<T, Integer> currentEntry : hashMap.entrySet()) { if (largestEntry == null || currentEntry.getValue() > largestEntry.getValue()) { largestEntry = currentEntry; } } T result = (largestEntry == null) ? null : largestEntry.getKey(); return result; }
[ "public", "static", "<", "T", ">", "T", "getMostCommonElementInList", "(", "List", "<", "T", ">", "sourceList", ")", "{", "if", "(", "sourceList", "==", "null", "||", "sourceList", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "Map", "<", "T", ",", "Integer", ">", "hashMap", "=", "new", "HashMap", "<", "T", ",", "Integer", ">", "(", ")", ";", "for", "(", "T", "element", ":", "sourceList", ")", "{", "Integer", "countOrNull", "=", "hashMap", ".", "get", "(", "element", ")", ";", "int", "newCount", "=", "(", "countOrNull", "==", "null", ")", "?", "1", ":", "(", "countOrNull", "+", "1", ")", ";", "hashMap", ".", "put", "(", "element", ",", "newCount", ")", ";", "}", "// Find the largest entry. ", "// In the event of a tie, the first entry (the first entry in the hash map, not in the list) ", "// with the maximum count will be returned. ", "Entry", "<", "T", ",", "Integer", ">", "largestEntry", "=", "null", ";", "for", "(", "Entry", "<", "T", ",", "Integer", ">", "currentEntry", ":", "hashMap", ".", "entrySet", "(", ")", ")", "{", "if", "(", "largestEntry", "==", "null", "||", "currentEntry", ".", "getValue", "(", ")", ">", "largestEntry", ".", "getValue", "(", ")", ")", "{", "largestEntry", "=", "currentEntry", ";", "}", "}", "T", "result", "=", "(", "largestEntry", "==", "null", ")", "?", "null", ":", "largestEntry", ".", "getKey", "(", ")", ";", "return", "result", ";", "}" ]
getMostCommonElementInList, This returns the most common element in the supplied list. In the event of a tie, any element that is tied as the "largest element" may be returned. If the list has no elements, or if the list is null, then this will return null. This can also return null if null happens to be the most common element in the source list.
[ "getMostCommonElementInList", "This", "returns", "the", "most", "common", "element", "in", "the", "supplied", "list", ".", "In", "the", "event", "of", "a", "tie", "any", "element", "that", "is", "tied", "as", "the", "largest", "element", "may", "be", "returned", ".", "If", "the", "list", "has", "no", "elements", "or", "if", "the", "list", "is", "null", "then", "this", "will", "return", "null", ".", "This", "can", "also", "return", "null", "if", "null", "happens", "to", "be", "the", "most", "common", "element", "in", "the", "source", "list", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java#L100-L121
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.countByG_B_A
@Override public int countByG_B_A(long groupId, boolean billingAllowed, boolean active) { """ Returns the number of commerce countries where groupId = &#63; and billingAllowed = &#63; and active = &#63;. @param groupId the group ID @param billingAllowed the billing allowed @param active the active @return the number of matching commerce countries """ FinderPath finderPath = FINDER_PATH_COUNT_BY_G_B_A; Object[] finderArgs = new Object[] { groupId, billingAllowed, active }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE); query.append(_FINDER_COLUMN_G_B_A_GROUPID_2); query.append(_FINDER_COLUMN_G_B_A_BILLINGALLOWED_2); query.append(_FINDER_COLUMN_G_B_A_ACTIVE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(billingAllowed); qPos.add(active); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_B_A(long groupId, boolean billingAllowed, boolean active) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_B_A; Object[] finderArgs = new Object[] { groupId, billingAllowed, active }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCECOUNTRY_WHERE); query.append(_FINDER_COLUMN_G_B_A_GROUPID_2); query.append(_FINDER_COLUMN_G_B_A_BILLINGALLOWED_2); query.append(_FINDER_COLUMN_G_B_A_ACTIVE_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(billingAllowed); qPos.add(active); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_B_A", "(", "long", "groupId", ",", "boolean", "billingAllowed", ",", "boolean", "active", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_B_A", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "groupId", ",", "billingAllowed", ",", "active", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "4", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_COMMERCECOUNTRY_WHERE", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_B_A_GROUPID_2", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_B_A_BILLINGALLOWED_2", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_B_A_ACTIVE_2", ")", ";", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "qPos", ".", "add", "(", "groupId", ")", ";", "qPos", ".", "add", "(", "billingAllowed", ")", ";", "qPos", ".", "add", "(", "active", ")", ";", "count", "=", "(", "Long", ")", "q", ".", "uniqueResult", "(", ")", ";", "finderCache", ".", "putResult", "(", "finderPath", ",", "finderArgs", ",", "count", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "finderCache", ".", "removeResult", "(", "finderPath", ",", "finderArgs", ")", ";", "throw", "processException", "(", "e", ")", ";", "}", "finally", "{", "closeSession", "(", "session", ")", ";", "}", "}", "return", "count", ".", "intValue", "(", ")", ";", "}" ]
Returns the number of commerce countries where groupId = &#63; and billingAllowed = &#63; and active = &#63;. @param groupId the group ID @param billingAllowed the billing allowed @param active the active @return the number of matching commerce countries
[ "Returns", "the", "number", "of", "commerce", "countries", "where", "groupId", "=", "&#63", ";", "and", "billingAllowed", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L3538-L3589
alkacon/opencms-core
src/org/opencms/publish/CmsPublishEngine.java
CmsPublishEngine.enqueuePublishJob
public void enqueuePublishJob(CmsObject cms, CmsPublishList publishList, I_CmsReport report) throws CmsException { """ Enqueues a new publish job with the given information in publish queue.<p> All resources should already be locked.<p> If possible, the publish job starts immediately.<p> @param cms the cms context to publish for @param publishList the resources to publish @param report the report to write to @throws CmsException if something goes wrong while cloning the cms context """ // check the driver manager if ((m_driverManager == null) || (m_dbContextFactory == null)) { // the resources are unlocked in the driver manager throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_NOT_INITIALIZED_0)); } // prevent new jobs if the engine is disabled if (m_shuttingDown || (!isEnabled() && !OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN))) { // the resources are unlocked in the driver manager throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_DISABLED_0)); } // create the publish job CmsPublishJobInfoBean publishJob = new CmsPublishJobInfoBean(cms, publishList, report); try { // enqueue it and m_publishQueue.add(publishJob); // notify all listeners m_listeners.fireEnqueued(new CmsPublishJobBase(publishJob)); } catch (Throwable t) { // we really really need to catch everything here, or else the queue status is broken if (m_publishQueue.contains(publishJob)) { m_publishQueue.remove(publishJob); } // throw the exception again throw new CmsException( Messages.get().container(Messages.ERR_PUBLISH_ENGINE_QUEUE_1, publishJob.getPublishHistoryId()), t); } // try to start the publish job immediately checkCurrentPublishJobThread(); }
java
public void enqueuePublishJob(CmsObject cms, CmsPublishList publishList, I_CmsReport report) throws CmsException { // check the driver manager if ((m_driverManager == null) || (m_dbContextFactory == null)) { // the resources are unlocked in the driver manager throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_NOT_INITIALIZED_0)); } // prevent new jobs if the engine is disabled if (m_shuttingDown || (!isEnabled() && !OpenCms.getRoleManager().hasRole(cms, CmsRole.ROOT_ADMIN))) { // the resources are unlocked in the driver manager throw new CmsPublishException(Messages.get().container(Messages.ERR_PUBLISH_ENGINE_DISABLED_0)); } // create the publish job CmsPublishJobInfoBean publishJob = new CmsPublishJobInfoBean(cms, publishList, report); try { // enqueue it and m_publishQueue.add(publishJob); // notify all listeners m_listeners.fireEnqueued(new CmsPublishJobBase(publishJob)); } catch (Throwable t) { // we really really need to catch everything here, or else the queue status is broken if (m_publishQueue.contains(publishJob)) { m_publishQueue.remove(publishJob); } // throw the exception again throw new CmsException( Messages.get().container(Messages.ERR_PUBLISH_ENGINE_QUEUE_1, publishJob.getPublishHistoryId()), t); } // try to start the publish job immediately checkCurrentPublishJobThread(); }
[ "public", "void", "enqueuePublishJob", "(", "CmsObject", "cms", ",", "CmsPublishList", "publishList", ",", "I_CmsReport", "report", ")", "throws", "CmsException", "{", "// check the driver manager", "if", "(", "(", "m_driverManager", "==", "null", ")", "||", "(", "m_dbContextFactory", "==", "null", ")", ")", "{", "// the resources are unlocked in the driver manager", "throw", "new", "CmsPublishException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_PUBLISH_ENGINE_NOT_INITIALIZED_0", ")", ")", ";", "}", "// prevent new jobs if the engine is disabled", "if", "(", "m_shuttingDown", "||", "(", "!", "isEnabled", "(", ")", "&&", "!", "OpenCms", ".", "getRoleManager", "(", ")", ".", "hasRole", "(", "cms", ",", "CmsRole", ".", "ROOT_ADMIN", ")", ")", ")", "{", "// the resources are unlocked in the driver manager", "throw", "new", "CmsPublishException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_PUBLISH_ENGINE_DISABLED_0", ")", ")", ";", "}", "// create the publish job", "CmsPublishJobInfoBean", "publishJob", "=", "new", "CmsPublishJobInfoBean", "(", "cms", ",", "publishList", ",", "report", ")", ";", "try", "{", "// enqueue it and", "m_publishQueue", ".", "add", "(", "publishJob", ")", ";", "// notify all listeners", "m_listeners", ".", "fireEnqueued", "(", "new", "CmsPublishJobBase", "(", "publishJob", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// we really really need to catch everything here, or else the queue status is broken", "if", "(", "m_publishQueue", ".", "contains", "(", "publishJob", ")", ")", "{", "m_publishQueue", ".", "remove", "(", "publishJob", ")", ";", "}", "// throw the exception again", "throw", "new", "CmsException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_PUBLISH_ENGINE_QUEUE_1", ",", "publishJob", ".", "getPublishHistoryId", "(", ")", ")", ",", "t", ")", ";", "}", "// try to start the publish job immediately", "checkCurrentPublishJobThread", "(", ")", ";", "}" ]
Enqueues a new publish job with the given information in publish queue.<p> All resources should already be locked.<p> If possible, the publish job starts immediately.<p> @param cms the cms context to publish for @param publishList the resources to publish @param report the report to write to @throws CmsException if something goes wrong while cloning the cms context
[ "Enqueues", "a", "new", "publish", "job", "with", "the", "given", "information", "in", "publish", "queue", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishEngine.java#L230-L262
uber/NullAway
nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java
ErrorBuilder.createErrorDescriptionForNullAssignment
Description createErrorDescriptionForNullAssignment( ErrorMessage errorMessage, @Nullable Tree suggestTreeIfCastToNonNull, @Nullable TreePath suggestTreePathIfSuppression, Description.Builder descriptionBuilder) { """ create an error description for a generalized @Nullable value to @NonNull location assignment. <p>This includes: field assignments, method arguments and method returns @param errorMessage the error message object. @param suggestTreeIfCastToNonNull the location at which a fix suggestion should be made if a castToNonNull method is available (usually the expression to cast) @param suggestTreePathIfSuppression the location at which a fix suggestion should be made if a castToNonNull method is not available (usually the enclosing method, or any place where @SuppressWarnings can be added). @param descriptionBuilder the description builder for the error. @return the error description. """ final Tree enclosingSuppressTree = suppressibleNode(suggestTreePathIfSuppression); if (config.getCastToNonNullMethod() != null) { return createErrorDescription(errorMessage, suggestTreeIfCastToNonNull, descriptionBuilder); } else { return createErrorDescription(errorMessage, enclosingSuppressTree, descriptionBuilder); } }
java
Description createErrorDescriptionForNullAssignment( ErrorMessage errorMessage, @Nullable Tree suggestTreeIfCastToNonNull, @Nullable TreePath suggestTreePathIfSuppression, Description.Builder descriptionBuilder) { final Tree enclosingSuppressTree = suppressibleNode(suggestTreePathIfSuppression); if (config.getCastToNonNullMethod() != null) { return createErrorDescription(errorMessage, suggestTreeIfCastToNonNull, descriptionBuilder); } else { return createErrorDescription(errorMessage, enclosingSuppressTree, descriptionBuilder); } }
[ "Description", "createErrorDescriptionForNullAssignment", "(", "ErrorMessage", "errorMessage", ",", "@", "Nullable", "Tree", "suggestTreeIfCastToNonNull", ",", "@", "Nullable", "TreePath", "suggestTreePathIfSuppression", ",", "Description", ".", "Builder", "descriptionBuilder", ")", "{", "final", "Tree", "enclosingSuppressTree", "=", "suppressibleNode", "(", "suggestTreePathIfSuppression", ")", ";", "if", "(", "config", ".", "getCastToNonNullMethod", "(", ")", "!=", "null", ")", "{", "return", "createErrorDescription", "(", "errorMessage", ",", "suggestTreeIfCastToNonNull", ",", "descriptionBuilder", ")", ";", "}", "else", "{", "return", "createErrorDescription", "(", "errorMessage", ",", "enclosingSuppressTree", ",", "descriptionBuilder", ")", ";", "}", "}" ]
create an error description for a generalized @Nullable value to @NonNull location assignment. <p>This includes: field assignments, method arguments and method returns @param errorMessage the error message object. @param suggestTreeIfCastToNonNull the location at which a fix suggestion should be made if a castToNonNull method is available (usually the expression to cast) @param suggestTreePathIfSuppression the location at which a fix suggestion should be made if a castToNonNull method is not available (usually the enclosing method, or any place where @SuppressWarnings can be added). @param descriptionBuilder the description builder for the error. @return the error description.
[ "create", "an", "error", "description", "for", "a", "generalized", "@Nullable", "value", "to", "@NonNull", "location", "assignment", "." ]
train
https://github.com/uber/NullAway/blob/c3979b4241f80411dbba6aac3ff653acbb88d00b/nullaway/src/main/java/com/uber/nullaway/ErrorBuilder.java#L147-L158
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java
BoxApiBookmark.getAddToCollectionRequest
public BoxRequestsBookmark.AddBookmarkToCollection getAddToCollectionRequest(String bookmarkId, String collectionId) { """ Gets a request that adds a bookmark to a collection @param bookmarkId id of bookmark to add to collection @param collectionId id of collection to add the bookmark to @return request to add a bookmark to a collection """ BoxRequestsBookmark.AddBookmarkToCollection request = new BoxRequestsBookmark.AddBookmarkToCollection(bookmarkId, collectionId, getBookmarkInfoUrl(bookmarkId), mSession); return request; }
java
public BoxRequestsBookmark.AddBookmarkToCollection getAddToCollectionRequest(String bookmarkId, String collectionId) { BoxRequestsBookmark.AddBookmarkToCollection request = new BoxRequestsBookmark.AddBookmarkToCollection(bookmarkId, collectionId, getBookmarkInfoUrl(bookmarkId), mSession); return request; }
[ "public", "BoxRequestsBookmark", ".", "AddBookmarkToCollection", "getAddToCollectionRequest", "(", "String", "bookmarkId", ",", "String", "collectionId", ")", "{", "BoxRequestsBookmark", ".", "AddBookmarkToCollection", "request", "=", "new", "BoxRequestsBookmark", ".", "AddBookmarkToCollection", "(", "bookmarkId", ",", "collectionId", ",", "getBookmarkInfoUrl", "(", "bookmarkId", ")", ",", "mSession", ")", ";", "return", "request", ";", "}" ]
Gets a request that adds a bookmark to a collection @param bookmarkId id of bookmark to add to collection @param collectionId id of collection to add the bookmark to @return request to add a bookmark to a collection
[ "Gets", "a", "request", "that", "adds", "a", "bookmark", "to", "a", "collection" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiBookmark.java#L237-L240
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java
PublicIPAddressesInner.listVirtualMachineScaleSetVMPublicIPAddressesWithServiceResponseAsync
public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetVMPublicIPAddressesWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex, final String networkInterfaceName, final String ipConfigurationName) { """ Gets information about all public IP addresses in a virtual machine IP configuration in a virtual machine scale set. @param resourceGroupName The name of the resource group. @param virtualMachineScaleSetName The name of the virtual machine scale set. @param virtualmachineIndex The virtual machine index. @param networkInterfaceName The network interface name. @param ipConfigurationName The IP configuration name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;PublicIPAddressInner&gt; object """ return listVirtualMachineScaleSetVMPublicIPAddressesSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetVMPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<PublicIPAddressInner>>> listVirtualMachineScaleSetVMPublicIPAddressesWithServiceResponseAsync(final String resourceGroupName, final String virtualMachineScaleSetName, final String virtualmachineIndex, final String networkInterfaceName, final String ipConfigurationName) { return listVirtualMachineScaleSetVMPublicIPAddressesSinglePageAsync(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, ipConfigurationName) .concatMap(new Func1<ServiceResponse<Page<PublicIPAddressInner>>, Observable<ServiceResponse<Page<PublicIPAddressInner>>>>() { @Override public Observable<ServiceResponse<Page<PublicIPAddressInner>>> call(ServiceResponse<Page<PublicIPAddressInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listVirtualMachineScaleSetVMPublicIPAddressesNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "PublicIPAddressInner", ">", ">", ">", "listVirtualMachineScaleSetVMPublicIPAddressesWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "virtualMachineScaleSetName", ",", "final", "String", "virtualmachineIndex", ",", "final", "String", "networkInterfaceName", ",", "final", "String", "ipConfigurationName", ")", "{", "return", "listVirtualMachineScaleSetVMPublicIPAddressesSinglePageAsync", "(", "resourceGroupName", ",", "virtualMachineScaleSetName", ",", "virtualmachineIndex", ",", "networkInterfaceName", ",", "ipConfigurationName", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "PublicIPAddressInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "PublicIPAddressInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "PublicIPAddressInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "PublicIPAddressInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listVirtualMachineScaleSetVMPublicIPAddressesNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Gets information about all public IP addresses in a virtual machine IP configuration in a virtual machine scale set. @param resourceGroupName The name of the resource group. @param virtualMachineScaleSetName The name of the virtual machine scale set. @param virtualmachineIndex The virtual machine index. @param networkInterfaceName The network interface name. @param ipConfigurationName The IP configuration name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;PublicIPAddressInner&gt; object
[ "Gets", "information", "about", "all", "public", "IP", "addresses", "in", "a", "virtual", "machine", "IP", "configuration", "in", "a", "virtual", "machine", "scale", "set", "." ]
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/PublicIPAddressesInner.java#L1353-L1365
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java
CmsJspContentAccessValueWrapper.getToDateSeries
public CmsJspDateSeriesBean getToDateSeries() { """ Converts a date series configuration to a date series bean. @return the date series bean. """ if (m_dateSeries == null) { m_dateSeries = new CmsJspDateSeriesBean(this, m_cms.getRequestContext().getLocale()); } return m_dateSeries; }
java
public CmsJspDateSeriesBean getToDateSeries() { if (m_dateSeries == null) { m_dateSeries = new CmsJspDateSeriesBean(this, m_cms.getRequestContext().getLocale()); } return m_dateSeries; }
[ "public", "CmsJspDateSeriesBean", "getToDateSeries", "(", ")", "{", "if", "(", "m_dateSeries", "==", "null", ")", "{", "m_dateSeries", "=", "new", "CmsJspDateSeriesBean", "(", "this", ",", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ";", "}", "return", "m_dateSeries", ";", "}" ]
Converts a date series configuration to a date series bean. @return the date series bean.
[ "Converts", "a", "date", "series", "configuration", "to", "a", "date", "series", "bean", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspContentAccessValueWrapper.java#L850-L856
nextreports/nextreports-engine
src/ro/nextreports/engine/util/DateUtil.java
DateUtil.sameMonth
public static boolean sameMonth(Date dateOne, Date dateTwo) { """ Test to see if two dates are in the same month @param dateOne first date @param dateTwo second date @return true if the two dates are in the same month """ if ((dateOne == null) || (dateTwo == null)) { return false; } Calendar cal = Calendar.getInstance(); cal.setTime(dateOne); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); cal.setTime(dateTwo); int year2 = cal.get(Calendar.YEAR); int month2 = cal.get(Calendar.MONTH); return ( (year == year2) && (month == month2) ); }
java
public static boolean sameMonth(Date dateOne, Date dateTwo) { if ((dateOne == null) || (dateTwo == null)) { return false; } Calendar cal = Calendar.getInstance(); cal.setTime(dateOne); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); cal.setTime(dateTwo); int year2 = cal.get(Calendar.YEAR); int month2 = cal.get(Calendar.MONTH); return ( (year == year2) && (month == month2) ); }
[ "public", "static", "boolean", "sameMonth", "(", "Date", "dateOne", ",", "Date", "dateTwo", ")", "{", "if", "(", "(", "dateOne", "==", "null", ")", "||", "(", "dateTwo", "==", "null", ")", ")", "{", "return", "false", ";", "}", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "dateOne", ")", ";", "int", "year", "=", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month", "=", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "cal", ".", "setTime", "(", "dateTwo", ")", ";", "int", "year2", "=", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month2", "=", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "return", "(", "(", "year", "==", "year2", ")", "&&", "(", "month", "==", "month2", ")", ")", ";", "}" ]
Test to see if two dates are in the same month @param dateOne first date @param dateTwo second date @return true if the two dates are in the same month
[ "Test", "to", "see", "if", "two", "dates", "are", "in", "the", "same", "month" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L278-L293
mikepenz/FastAdapter
library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java
FastAdapterDialog.withPositiveButton
public FastAdapterDialog<Item> withPositiveButton(String text, OnClickListener listener) { """ Set a listener to be invoked when the positive button of the dialog is pressed. @param text The text to display in the positive button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods """ return withButton(BUTTON_POSITIVE, text, listener); }
java
public FastAdapterDialog<Item> withPositiveButton(String text, OnClickListener listener) { return withButton(BUTTON_POSITIVE, text, listener); }
[ "public", "FastAdapterDialog", "<", "Item", ">", "withPositiveButton", "(", "String", "text", ",", "OnClickListener", "listener", ")", "{", "return", "withButton", "(", "BUTTON_POSITIVE", ",", "text", ",", "listener", ")", ";", "}" ]
Set a listener to be invoked when the positive button of the dialog is pressed. @param text The text to display in the positive button @param listener The {@link DialogInterface.OnClickListener} to use. @return This Builder object to allow for chaining of calls to set methods
[ "Set", "a", "listener", "to", "be", "invoked", "when", "the", "positive", "button", "of", "the", "dialog", "is", "pressed", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L131-L133
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.setPosition
public void setPosition(float x, float y, float z) { """ Set absolute position. Use {@link #translate(float, float, float)} to <em>move</em> the object. @param x 'X' component of the absolute position. @param y 'Y' component of the absolute position. @param z 'Z' component of the absolute position. """ getTransform().setPosition(x, y, z); if (mTransformCache.setPosition(x, y, z)) { onTransformChanged(); } }
java
public void setPosition(float x, float y, float z) { getTransform().setPosition(x, y, z); if (mTransformCache.setPosition(x, y, z)) { onTransformChanged(); } }
[ "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "getTransform", "(", ")", ".", "setPosition", "(", "x", ",", "y", ",", "z", ")", ";", "if", "(", "mTransformCache", ".", "setPosition", "(", "x", ",", "y", ",", "z", ")", ")", "{", "onTransformChanged", "(", ")", ";", "}", "}" ]
Set absolute position. Use {@link #translate(float, float, float)} to <em>move</em> the object. @param x 'X' component of the absolute position. @param y 'Y' component of the absolute position. @param z 'Z' component of the absolute position.
[ "Set", "absolute", "position", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1259-L1264
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyUtil.java
PropertyUtil.findSetter
public static Method findSetter(String methodName, Object instance, Class<?> valueClass) throws NoSuchMethodException { """ Returns the requested setter method from an object instance. @param methodName Name of the setter method. @param instance Object instance to search. @param valueClass The setter parameter type (null if don't care). @return The setter method. @throws NoSuchMethodException If method was not found. """ return findMethod(methodName, instance, valueClass, true); }
java
public static Method findSetter(String methodName, Object instance, Class<?> valueClass) throws NoSuchMethodException { return findMethod(methodName, instance, valueClass, true); }
[ "public", "static", "Method", "findSetter", "(", "String", "methodName", ",", "Object", "instance", ",", "Class", "<", "?", ">", "valueClass", ")", "throws", "NoSuchMethodException", "{", "return", "findMethod", "(", "methodName", ",", "instance", ",", "valueClass", ",", "true", ")", ";", "}" ]
Returns the requested setter method from an object instance. @param methodName Name of the setter method. @param instance Object instance to search. @param valueClass The setter parameter type (null if don't care). @return The setter method. @throws NoSuchMethodException If method was not found.
[ "Returns", "the", "requested", "setter", "method", "from", "an", "object", "instance", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyUtil.java#L46-L48
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/extraction/SIFTExtractor.java
SIFTExtractor.extractFeaturesInternal
protected double[][] extractFeaturesInternal(BufferedImage image) { """ Detects key points inside the image and computes descriptions at those points. """ ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class); // create the SIFT detector and descriptor in BoofCV v0.15 ConfigSiftDetector conf = new ConfigSiftDetector(2, detectThreshold, maxFeaturesPerScale, 5); DetectDescribePoint<ImageFloat32, SurfFeature> sift = FactoryDetectDescribe.sift(null, conf, null, null); // specify the image to process sift.detect(boofcvImage); int numPoints = sift.getNumberOfFeatures(); double[][] descriptions = new double[numPoints][SIFTLength]; for (int i = 0; i < numPoints; i++) { descriptions[i] = sift.getDescription(i).getValue(); } return descriptions; }
java
protected double[][] extractFeaturesInternal(BufferedImage image) { ImageFloat32 boofcvImage = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class); // create the SIFT detector and descriptor in BoofCV v0.15 ConfigSiftDetector conf = new ConfigSiftDetector(2, detectThreshold, maxFeaturesPerScale, 5); DetectDescribePoint<ImageFloat32, SurfFeature> sift = FactoryDetectDescribe.sift(null, conf, null, null); // specify the image to process sift.detect(boofcvImage); int numPoints = sift.getNumberOfFeatures(); double[][] descriptions = new double[numPoints][SIFTLength]; for (int i = 0; i < numPoints; i++) { descriptions[i] = sift.getDescription(i).getValue(); } return descriptions; }
[ "protected", "double", "[", "]", "[", "]", "extractFeaturesInternal", "(", "BufferedImage", "image", ")", "{", "ImageFloat32", "boofcvImage", "=", "ConvertBufferedImage", ".", "convertFromSingle", "(", "image", ",", "null", ",", "ImageFloat32", ".", "class", ")", ";", "// create the SIFT detector and descriptor in BoofCV v0.15\r", "ConfigSiftDetector", "conf", "=", "new", "ConfigSiftDetector", "(", "2", ",", "detectThreshold", ",", "maxFeaturesPerScale", ",", "5", ")", ";", "DetectDescribePoint", "<", "ImageFloat32", ",", "SurfFeature", ">", "sift", "=", "FactoryDetectDescribe", ".", "sift", "(", "null", ",", "conf", ",", "null", ",", "null", ")", ";", "// specify the image to process\r", "sift", ".", "detect", "(", "boofcvImage", ")", ";", "int", "numPoints", "=", "sift", ".", "getNumberOfFeatures", "(", ")", ";", "double", "[", "]", "[", "]", "descriptions", "=", "new", "double", "[", "numPoints", "]", "[", "SIFTLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numPoints", ";", "i", "++", ")", "{", "descriptions", "[", "i", "]", "=", "sift", ".", "getDescription", "(", "i", ")", ".", "getValue", "(", ")", ";", "}", "return", "descriptions", ";", "}" ]
Detects key points inside the image and computes descriptions at those points.
[ "Detects", "key", "points", "inside", "the", "image", "and", "computes", "descriptions", "at", "those", "points", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/extraction/SIFTExtractor.java#L47-L62
JOML-CI/JOML
src/org/joml/Vector4f.java
Vector4f.set
public Vector4f set(int index, ByteBuffer buffer) { """ Read this vector from the supplied {@link ByteBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given ByteBuffer. @param index the absolute position into the ByteBuffer @param buffer values will be read in <code>x, y, z, w</code> order @return this """ MemUtil.INSTANCE.get(this, index, buffer); return this; }
java
public Vector4f set(int index, ByteBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
[ "public", "Vector4f", "set", "(", "int", "index", ",", "ByteBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "get", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "this", ";", "}" ]
Read this vector from the supplied {@link ByteBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given ByteBuffer. @param index the absolute position into the ByteBuffer @param buffer values will be read in <code>x, y, z, w</code> order @return this
[ "Read", "this", "vector", "from", "the", "supplied", "{", "@link", "ByteBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", ".", "<p", ">", "This", "method", "will", "not", "increment", "the", "position", "of", "the", "given", "ByteBuffer", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector4f.java#L459-L462
bingoohuang/westcache
src/main/java/com/github/bingoohuang/westcache/utils/Methods.java
Methods.getAllMethodsInHierarchy
public static Set<Method> getAllMethodsInHierarchy(Method method) { """ /* Gets an array of all methods in a class hierarchy walking up to parent classes """ LinkedHashSet<Method> allMethods = new LinkedHashSet<>(); val declaringClass = method.getDeclaringClass(); return getAllMethodsInHierarchy(allMethods, declaringClass, method); }
java
public static Set<Method> getAllMethodsInHierarchy(Method method) { LinkedHashSet<Method> allMethods = new LinkedHashSet<>(); val declaringClass = method.getDeclaringClass(); return getAllMethodsInHierarchy(allMethods, declaringClass, method); }
[ "public", "static", "Set", "<", "Method", ">", "getAllMethodsInHierarchy", "(", "Method", "method", ")", "{", "LinkedHashSet", "<", "Method", ">", "allMethods", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "val", "declaringClass", "=", "method", ".", "getDeclaringClass", "(", ")", ";", "return", "getAllMethodsInHierarchy", "(", "allMethods", ",", "declaringClass", ",", "method", ")", ";", "}" ]
/* Gets an array of all methods in a class hierarchy walking up to parent classes
[ "/", "*", "Gets", "an", "array", "of", "all", "methods", "in", "a", "class", "hierarchy", "walking", "up", "to", "parent", "classes" ]
train
https://github.com/bingoohuang/westcache/blob/09842bf0b9299abe75551c4b51d326fcc96da42d/src/main/java/com/github/bingoohuang/westcache/utils/Methods.java#L28-L32
Jasig/spring-portlet-contrib
spring-security-portlet-contrib/src/main/java/org/jasig/springframework/security/portlet/authentication/PortletAuthenticationProcessingFilter.java
PortletAuthenticationProcessingFilter.successfulAuthentication
protected void successfulAuthentication(PortletRequest request, PortletResponse response, Authentication authResult) { """ Puts the Authentication instance returned by the authentication manager into the secure context. @param request a {@link javax.portlet.PortletRequest} object. @param response a {@link javax.portlet.PortletResponse} object. @param authResult a {@link org.springframework.security.core.Authentication} object. """ if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + authResult); } SecurityContextHolder.getContext().setAuthentication(authResult); // Fire event if (this.eventPublisher != null) { eventPublisher.publishEvent(new InteractiveAuthenticationSuccessEvent(authResult, this.getClass())); } }
java
protected void successfulAuthentication(PortletRequest request, PortletResponse response, Authentication authResult) { if (logger.isDebugEnabled()) { logger.debug("Authentication success: " + authResult); } SecurityContextHolder.getContext().setAuthentication(authResult); // Fire event if (this.eventPublisher != null) { eventPublisher.publishEvent(new InteractiveAuthenticationSuccessEvent(authResult, this.getClass())); } }
[ "protected", "void", "successfulAuthentication", "(", "PortletRequest", "request", ",", "PortletResponse", "response", ",", "Authentication", "authResult", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Authentication success: \"", "+", "authResult", ")", ";", "}", "SecurityContextHolder", ".", "getContext", "(", ")", ".", "setAuthentication", "(", "authResult", ")", ";", "// Fire event", "if", "(", "this", ".", "eventPublisher", "!=", "null", ")", "{", "eventPublisher", ".", "publishEvent", "(", "new", "InteractiveAuthenticationSuccessEvent", "(", "authResult", ",", "this", ".", "getClass", "(", ")", ")", ")", ";", "}", "}" ]
Puts the Authentication instance returned by the authentication manager into the secure context. @param request a {@link javax.portlet.PortletRequest} object. @param response a {@link javax.portlet.PortletResponse} object. @param authResult a {@link org.springframework.security.core.Authentication} object.
[ "Puts", "the", "Authentication", "instance", "returned", "by", "the", "authentication", "manager", "into", "the", "secure", "context", "." ]
train
https://github.com/Jasig/spring-portlet-contrib/blob/719240fa268ddc69900ce9775d9cad3b9c543c6b/spring-security-portlet-contrib/src/main/java/org/jasig/springframework/security/portlet/authentication/PortletAuthenticationProcessingFilter.java#L214-L224
alkacon/opencms-core
src/org/opencms/ade/publish/CmsPublishRelationFinder.java
CmsPublishRelationFinder.removeUnchangedTopLevelResources
public void removeUnchangedTopLevelResources(ResourceMap publishRelatedResources, ResourceMap reachability) { """ Removes unchanged resources from the top level, and if they have children which do not occur anywhere else, moves these children to the top level.<p> @param publishRelatedResources the resource map to modify @param reachability the reachability map """ Set<CmsResource> unchangedParents = Sets.newHashSet(); Set<CmsResource> childrenOfUnchangedParents = Sets.newHashSet(); Set<CmsResource> other = Sets.newHashSet(); for (CmsResource parent : publishRelatedResources.keySet()) { if (isUnchangedAndShouldBeRemoved(parent)) { unchangedParents.add(parent); childrenOfUnchangedParents.addAll(publishRelatedResources.get(parent)); } else { other.add(parent); other.addAll(publishRelatedResources.get(parent)); } } // we want the resources which *only* occur as children of unchanged parents childrenOfUnchangedParents.removeAll(other); for (CmsResource parent : unchangedParents) { publishRelatedResources.remove(parent); } // Try to find hierarchical relationships in childrenOfUnchangedParents while (findAndMoveParentWithChildren(childrenOfUnchangedParents, reachability, publishRelatedResources)) { // do nothing } // only the resources with no 'children' are left, transfer them to the target map for (CmsResource remainingResource : childrenOfUnchangedParents) { publishRelatedResources.get(remainingResource); } }
java
public void removeUnchangedTopLevelResources(ResourceMap publishRelatedResources, ResourceMap reachability) { Set<CmsResource> unchangedParents = Sets.newHashSet(); Set<CmsResource> childrenOfUnchangedParents = Sets.newHashSet(); Set<CmsResource> other = Sets.newHashSet(); for (CmsResource parent : publishRelatedResources.keySet()) { if (isUnchangedAndShouldBeRemoved(parent)) { unchangedParents.add(parent); childrenOfUnchangedParents.addAll(publishRelatedResources.get(parent)); } else { other.add(parent); other.addAll(publishRelatedResources.get(parent)); } } // we want the resources which *only* occur as children of unchanged parents childrenOfUnchangedParents.removeAll(other); for (CmsResource parent : unchangedParents) { publishRelatedResources.remove(parent); } // Try to find hierarchical relationships in childrenOfUnchangedParents while (findAndMoveParentWithChildren(childrenOfUnchangedParents, reachability, publishRelatedResources)) { // do nothing } // only the resources with no 'children' are left, transfer them to the target map for (CmsResource remainingResource : childrenOfUnchangedParents) { publishRelatedResources.get(remainingResource); } }
[ "public", "void", "removeUnchangedTopLevelResources", "(", "ResourceMap", "publishRelatedResources", ",", "ResourceMap", "reachability", ")", "{", "Set", "<", "CmsResource", ">", "unchangedParents", "=", "Sets", ".", "newHashSet", "(", ")", ";", "Set", "<", "CmsResource", ">", "childrenOfUnchangedParents", "=", "Sets", ".", "newHashSet", "(", ")", ";", "Set", "<", "CmsResource", ">", "other", "=", "Sets", ".", "newHashSet", "(", ")", ";", "for", "(", "CmsResource", "parent", ":", "publishRelatedResources", ".", "keySet", "(", ")", ")", "{", "if", "(", "isUnchangedAndShouldBeRemoved", "(", "parent", ")", ")", "{", "unchangedParents", ".", "add", "(", "parent", ")", ";", "childrenOfUnchangedParents", ".", "addAll", "(", "publishRelatedResources", ".", "get", "(", "parent", ")", ")", ";", "}", "else", "{", "other", ".", "add", "(", "parent", ")", ";", "other", ".", "addAll", "(", "publishRelatedResources", ".", "get", "(", "parent", ")", ")", ";", "}", "}", "// we want the resources which *only* occur as children of unchanged parents", "childrenOfUnchangedParents", ".", "removeAll", "(", "other", ")", ";", "for", "(", "CmsResource", "parent", ":", "unchangedParents", ")", "{", "publishRelatedResources", ".", "remove", "(", "parent", ")", ";", "}", "// Try to find hierarchical relationships in childrenOfUnchangedParents", "while", "(", "findAndMoveParentWithChildren", "(", "childrenOfUnchangedParents", ",", "reachability", ",", "publishRelatedResources", ")", ")", "{", "// do nothing", "}", "// only the resources with no 'children' are left, transfer them to the target map", "for", "(", "CmsResource", "remainingResource", ":", "childrenOfUnchangedParents", ")", "{", "publishRelatedResources", ".", "get", "(", "remainingResource", ")", ";", "}", "}" ]
Removes unchanged resources from the top level, and if they have children which do not occur anywhere else, moves these children to the top level.<p> @param publishRelatedResources the resource map to modify @param reachability the reachability map
[ "Removes", "unchanged", "resources", "from", "the", "top", "level", "and", "if", "they", "have", "children", "which", "do", "not", "occur", "anywhere", "else", "moves", "these", "children", "to", "the", "top", "level", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/CmsPublishRelationFinder.java#L216-L246
jbundle/jbundle
thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java
Application.setProperty
public void setProperty(String strParam, String strValue) { """ Set this property. @param strProperty The property key. @param strValue The property value. """ if (strValue != null) m_properties.put(strParam, strValue); else m_properties.remove(strParam); }
java
public void setProperty(String strParam, String strValue) { if (strValue != null) m_properties.put(strParam, strValue); else m_properties.remove(strParam); }
[ "public", "void", "setProperty", "(", "String", "strParam", ",", "String", "strValue", ")", "{", "if", "(", "strValue", "!=", "null", ")", "m_properties", ".", "put", "(", "strParam", ",", "strValue", ")", ";", "else", "m_properties", ".", "remove", "(", "strParam", ")", ";", "}" ]
Set this property. @param strProperty The property key. @param strValue The property value.
[ "Set", "this", "property", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java#L930-L936
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/CompressionUtilities.java
CompressionUtilities.zipFolder
static public void zipFolder( String srcFolder, String destZipFile, boolean addBaseFolder ) throws IOException { """ Compress a folder and its contents. @param srcFolder path to the folder to be compressed. @param destZipFile path to the final output zip file. @param addBaseFolder flag to decide whether to add also the provided base (srcFolder) folder or not. @throws IOException """ if (new File(srcFolder).isDirectory()) { try (FileOutputStream fileWriter = new FileOutputStream(destZipFile); ZipOutputStream zip = new ZipOutputStream(fileWriter)) { addFolderToZip("", srcFolder, zip, addBaseFolder); //$NON-NLS-1$ } } else { throw new IOException(srcFolder + " is not a folder."); } }
java
static public void zipFolder( String srcFolder, String destZipFile, boolean addBaseFolder ) throws IOException { if (new File(srcFolder).isDirectory()) { try (FileOutputStream fileWriter = new FileOutputStream(destZipFile); ZipOutputStream zip = new ZipOutputStream(fileWriter)) { addFolderToZip("", srcFolder, zip, addBaseFolder); //$NON-NLS-1$ } } else { throw new IOException(srcFolder + " is not a folder."); } }
[ "static", "public", "void", "zipFolder", "(", "String", "srcFolder", ",", "String", "destZipFile", ",", "boolean", "addBaseFolder", ")", "throws", "IOException", "{", "if", "(", "new", "File", "(", "srcFolder", ")", ".", "isDirectory", "(", ")", ")", "{", "try", "(", "FileOutputStream", "fileWriter", "=", "new", "FileOutputStream", "(", "destZipFile", ")", ";", "ZipOutputStream", "zip", "=", "new", "ZipOutputStream", "(", "fileWriter", ")", ")", "{", "addFolderToZip", "(", "\"\"", ",", "srcFolder", ",", "zip", ",", "addBaseFolder", ")", ";", "//$NON-NLS-1$", "}", "}", "else", "{", "throw", "new", "IOException", "(", "srcFolder", "+", "\" is not a folder.\"", ")", ";", "}", "}" ]
Compress a folder and its contents. @param srcFolder path to the folder to be compressed. @param destZipFile path to the final output zip file. @param addBaseFolder flag to decide whether to add also the provided base (srcFolder) folder or not. @throws IOException
[ "Compress", "a", "folder", "and", "its", "contents", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/CompressionUtilities.java#L50-L59
facebookarchive/hadoop-20
src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java
MapOutputCorrectness.possiblyFail
private static void possiblyFail(float chanceFailure, Random random) { """ Should fail? @param chanceFailure Chances of failure [0.0,1.0] @param random Pseudo-random variable """ float value = random.nextFloat(); if (value < chanceFailure) { LOG.fatal("shouldFail: Failing with value " + value + " < " + chanceFailure); System.exit(-1); } }
java
private static void possiblyFail(float chanceFailure, Random random) { float value = random.nextFloat(); if (value < chanceFailure) { LOG.fatal("shouldFail: Failing with value " + value + " < " + chanceFailure); System.exit(-1); } }
[ "private", "static", "void", "possiblyFail", "(", "float", "chanceFailure", ",", "Random", "random", ")", "{", "float", "value", "=", "random", ".", "nextFloat", "(", ")", ";", "if", "(", "value", "<", "chanceFailure", ")", "{", "LOG", ".", "fatal", "(", "\"shouldFail: Failing with value \"", "+", "value", "+", "\" < \"", "+", "chanceFailure", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "}", "}" ]
Should fail? @param chanceFailure Chances of failure [0.0,1.0] @param random Pseudo-random variable
[ "Should", "fail?" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/MapOutputCorrectness.java#L373-L380
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_trend_microvpx_image.java
xen_trend_microvpx_image.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ xen_trend_microvpx_image_responses result = (xen_trend_microvpx_image_responses) service.get_payload_formatter().string_to_resource(xen_trend_microvpx_image_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_trend_microvpx_image_response_array); } xen_trend_microvpx_image[] result_xen_trend_microvpx_image = new xen_trend_microvpx_image[result.xen_trend_microvpx_image_response_array.length]; for(int i = 0; i < result.xen_trend_microvpx_image_response_array.length; i++) { result_xen_trend_microvpx_image[i] = result.xen_trend_microvpx_image_response_array[i].xen_trend_microvpx_image[0]; } return result_xen_trend_microvpx_image; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_trend_microvpx_image_responses result = (xen_trend_microvpx_image_responses) service.get_payload_formatter().string_to_resource(xen_trend_microvpx_image_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_trend_microvpx_image_response_array); } xen_trend_microvpx_image[] result_xen_trend_microvpx_image = new xen_trend_microvpx_image[result.xen_trend_microvpx_image_response_array.length]; for(int i = 0; i < result.xen_trend_microvpx_image_response_array.length; i++) { result_xen_trend_microvpx_image[i] = result.xen_trend_microvpx_image_response_array[i].xen_trend_microvpx_image[0]; } return result_xen_trend_microvpx_image; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_trend_microvpx_image_responses", "result", "=", "(", "xen_trend_microvpx_image_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "xen_trend_microvpx_image_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "xen_trend_microvpx_image_response_array", ")", ";", "}", "xen_trend_microvpx_image", "[", "]", "result_xen_trend_microvpx_image", "=", "new", "xen_trend_microvpx_image", "[", "result", ".", "xen_trend_microvpx_image_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "xen_trend_microvpx_image_response_array", ".", "length", ";", "i", "++", ")", "{", "result_xen_trend_microvpx_image", "[", "i", "]", "=", "result", ".", "xen_trend_microvpx_image_response_array", "[", "i", "]", ".", "xen_trend_microvpx_image", "[", "0", "]", ";", "}", "return", "result_xen_trend_microvpx_image", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_trend_microvpx_image.java#L264-L281
nominanuda/zen-project
zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java
HtmlUnitRegExpProxy.isEscaped
static boolean isEscaped(final String characters, final int position) { """ Indicates if the character at the given position is escaped or not. @param characters the characters to consider @param position the position @return <code>true</code> if escaped """ int p = position; int nbBackslash = 0; while (p > 0 && characters.charAt(--p) == '\\') { nbBackslash++; } return (nbBackslash % 2 == 1); }
java
static boolean isEscaped(final String characters, final int position) { int p = position; int nbBackslash = 0; while (p > 0 && characters.charAt(--p) == '\\') { nbBackslash++; } return (nbBackslash % 2 == 1); }
[ "static", "boolean", "isEscaped", "(", "final", "String", "characters", ",", "final", "int", "position", ")", "{", "int", "p", "=", "position", ";", "int", "nbBackslash", "=", "0", ";", "while", "(", "p", ">", "0", "&&", "characters", ".", "charAt", "(", "--", "p", ")", "==", "'", "'", ")", "{", "nbBackslash", "++", ";", "}", "return", "(", "nbBackslash", "%", "2", "==", "1", ")", ";", "}" ]
Indicates if the character at the given position is escaped or not. @param characters the characters to consider @param position the position @return <code>true</code> if escaped
[ "Indicates", "if", "the", "character", "at", "the", "given", "position", "is", "escaped", "or", "not", "." ]
train
https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java#L242-L249
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.leftShift
public static File leftShift(File file, InputStream data) throws IOException { """ Append binary data to the file. See {@link #append(java.io.File, java.io.InputStream)} @param file a File @param data an InputStream of data to write to the file @return the file @throws IOException if an IOException occurs. @since 1.5.0 """ append(file, data); return file; }
java
public static File leftShift(File file, InputStream data) throws IOException { append(file, data); return file; }
[ "public", "static", "File", "leftShift", "(", "File", "file", ",", "InputStream", "data", ")", "throws", "IOException", "{", "append", "(", "file", ",", "data", ")", ";", "return", "file", ";", "}" ]
Append binary data to the file. See {@link #append(java.io.File, java.io.InputStream)} @param file a File @param data an InputStream of data to write to the file @return the file @throws IOException if an IOException occurs. @since 1.5.0
[ "Append", "binary", "data", "to", "the", "file", ".", "See", "{", "@link", "#append", "(", "java", ".", "io", ".", "File", "java", ".", "io", ".", "InputStream", ")", "}" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L821-L824
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java
CLIQUESubspace.leftNeighbor
protected CLIQUEUnit leftNeighbor(CLIQUEUnit unit, int dim) { """ Returns the left neighbor of the given unit in the specified dimension. @param unit the unit to determine the left neighbor for @param dim the dimension @return the left neighbor of the given unit in the specified dimension """ for(CLIQUEUnit u : denseUnits) { if(u.containsLeftNeighbor(unit, dim)) { return u; } } return null; }
java
protected CLIQUEUnit leftNeighbor(CLIQUEUnit unit, int dim) { for(CLIQUEUnit u : denseUnits) { if(u.containsLeftNeighbor(unit, dim)) { return u; } } return null; }
[ "protected", "CLIQUEUnit", "leftNeighbor", "(", "CLIQUEUnit", "unit", ",", "int", "dim", ")", "{", "for", "(", "CLIQUEUnit", "u", ":", "denseUnits", ")", "{", "if", "(", "u", ".", "containsLeftNeighbor", "(", "unit", ",", "dim", ")", ")", "{", "return", "u", ";", "}", "}", "return", "null", ";", "}" ]
Returns the left neighbor of the given unit in the specified dimension. @param unit the unit to determine the left neighbor for @param dim the dimension @return the left neighbor of the given unit in the specified dimension
[ "Returns", "the", "left", "neighbor", "of", "the", "given", "unit", "in", "the", "specified", "dimension", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java#L146-L153
openengsb/openengsb
connector/userprojectsfile/src/main/java/org/openengsb/connector/userprojects/file/internal/file/AssignmentFileAccessObject.java
AssignmentFileAccessObject.findAllAssignments
public List<Assignment> findAllAssignments() { """ Finds all the available assignments. @return the list of available assignments """ List<Assignment> list = new ArrayList<>(); List<String> assignmentStrings; try { assignmentStrings = readLines(assignmentsFile); } catch (IOException e) { throw new FileBasedRuntimeException(e); } for (String assignmentString : assignmentStrings) { if (StringUtils.isNotBlank(assignmentString)) { String[] substrings = StringUtils .splitByWholeSeparator(assignmentString, Configuration.get().getAssociationSeparator()); if (substrings.length < 2 || StringUtils.isBlank(substrings[1])) { continue; } Assignment assignment = new Assignment(substrings[0], substrings[1]); if (substrings.length > 2) { assignment.setRoles(Arrays.asList(StringUtils.splitByWholeSeparator(substrings[2], Configuration .get().getValueSeparator()))); } list.add(assignment); } } return list; }
java
public List<Assignment> findAllAssignments() { List<Assignment> list = new ArrayList<>(); List<String> assignmentStrings; try { assignmentStrings = readLines(assignmentsFile); } catch (IOException e) { throw new FileBasedRuntimeException(e); } for (String assignmentString : assignmentStrings) { if (StringUtils.isNotBlank(assignmentString)) { String[] substrings = StringUtils .splitByWholeSeparator(assignmentString, Configuration.get().getAssociationSeparator()); if (substrings.length < 2 || StringUtils.isBlank(substrings[1])) { continue; } Assignment assignment = new Assignment(substrings[0], substrings[1]); if (substrings.length > 2) { assignment.setRoles(Arrays.asList(StringUtils.splitByWholeSeparator(substrings[2], Configuration .get().getValueSeparator()))); } list.add(assignment); } } return list; }
[ "public", "List", "<", "Assignment", ">", "findAllAssignments", "(", ")", "{", "List", "<", "Assignment", ">", "list", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "String", ">", "assignmentStrings", ";", "try", "{", "assignmentStrings", "=", "readLines", "(", "assignmentsFile", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "FileBasedRuntimeException", "(", "e", ")", ";", "}", "for", "(", "String", "assignmentString", ":", "assignmentStrings", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "assignmentString", ")", ")", "{", "String", "[", "]", "substrings", "=", "StringUtils", ".", "splitByWholeSeparator", "(", "assignmentString", ",", "Configuration", ".", "get", "(", ")", ".", "getAssociationSeparator", "(", ")", ")", ";", "if", "(", "substrings", ".", "length", "<", "2", "||", "StringUtils", ".", "isBlank", "(", "substrings", "[", "1", "]", ")", ")", "{", "continue", ";", "}", "Assignment", "assignment", "=", "new", "Assignment", "(", "substrings", "[", "0", "]", ",", "substrings", "[", "1", "]", ")", ";", "if", "(", "substrings", ".", "length", ">", "2", ")", "{", "assignment", ".", "setRoles", "(", "Arrays", ".", "asList", "(", "StringUtils", ".", "splitByWholeSeparator", "(", "substrings", "[", "2", "]", ",", "Configuration", ".", "get", "(", ")", ".", "getValueSeparator", "(", ")", ")", ")", ")", ";", "}", "list", ".", "add", "(", "assignment", ")", ";", "}", "}", "return", "list", ";", "}" ]
Finds all the available assignments. @return the list of available assignments
[ "Finds", "all", "the", "available", "assignments", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/connector/userprojectsfile/src/main/java/org/openengsb/connector/userprojects/file/internal/file/AssignmentFileAccessObject.java#L45-L71
OmarAflak/Fingerprint
fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java
FingerprintDialog.tryLimit
public FingerprintDialog tryLimit(int limit, final FailAuthCounterDialogCallback counterCallback) { """ Set a fail limit. Android blocks automatically when 5 attempts failed. @param limit number of tries @param counterCallback callback to be triggered when limit is reached @return FingerprintDialog object """ this.fingerprint.tryLimit(limit, new FailAuthCounterCallback() { @Override public void onTryLimitReached(Fingerprint fingerprint) { counterCallback.onTryLimitReached(FingerprintDialog.this); } }); return this; }
java
public FingerprintDialog tryLimit(int limit, final FailAuthCounterDialogCallback counterCallback){ this.fingerprint.tryLimit(limit, new FailAuthCounterCallback() { @Override public void onTryLimitReached(Fingerprint fingerprint) { counterCallback.onTryLimitReached(FingerprintDialog.this); } }); return this; }
[ "public", "FingerprintDialog", "tryLimit", "(", "int", "limit", ",", "final", "FailAuthCounterDialogCallback", "counterCallback", ")", "{", "this", ".", "fingerprint", ".", "tryLimit", "(", "limit", ",", "new", "FailAuthCounterCallback", "(", ")", "{", "@", "Override", "public", "void", "onTryLimitReached", "(", "Fingerprint", "fingerprint", ")", "{", "counterCallback", ".", "onTryLimitReached", "(", "FingerprintDialog", ".", "this", ")", ";", "}", "}", ")", ";", "return", "this", ";", "}" ]
Set a fail limit. Android blocks automatically when 5 attempts failed. @param limit number of tries @param counterCallback callback to be triggered when limit is reached @return FingerprintDialog object
[ "Set", "a", "fail", "limit", ".", "Android", "blocks", "automatically", "when", "5", "attempts", "failed", "." ]
train
https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java#L236-L244
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DeviceTypesApi.java
DeviceTypesApi.getDeviceTypesByApplicationAsync
public com.squareup.okhttp.Call getDeviceTypesByApplicationAsync(String appId, Boolean productInfo, Integer count, Integer offset, final ApiCallback<DeviceTypesEnvelope> callback) throws ApiException { """ Get Device Types by Application (asynchronously) Get Device Types by Application @param appId Application ID. (required) @param productInfo Flag to include the associated ProductInfo if present (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getDeviceTypesByApplicationValidateBeforeCall(appId, productInfo, count, offset, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceTypesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getDeviceTypesByApplicationAsync(String appId, Boolean productInfo, Integer count, Integer offset, final ApiCallback<DeviceTypesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getDeviceTypesByApplicationValidateBeforeCall(appId, productInfo, count, offset, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<DeviceTypesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getDeviceTypesByApplicationAsync", "(", "String", "appId", ",", "Boolean", "productInfo", ",", "Integer", "count", ",", "Integer", "offset", ",", "final", "ApiCallback", "<", "DeviceTypesEnvelope", ">", "callback", ")", "throws", "ApiException", "{", "ProgressResponseBody", ".", "ProgressListener", "progressListener", "=", "null", ";", "ProgressRequestBody", ".", "ProgressRequestListener", "progressRequestListener", "=", "null", ";", "if", "(", "callback", "!=", "null", ")", "{", "progressListener", "=", "new", "ProgressResponseBody", ".", "ProgressListener", "(", ")", "{", "@", "Override", "public", "void", "update", "(", "long", "bytesRead", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onDownloadProgress", "(", "bytesRead", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "progressRequestListener", "=", "new", "ProgressRequestBody", ".", "ProgressRequestListener", "(", ")", "{", "@", "Override", "public", "void", "onRequestProgress", "(", "long", "bytesWritten", ",", "long", "contentLength", ",", "boolean", "done", ")", "{", "callback", ".", "onUploadProgress", "(", "bytesWritten", ",", "contentLength", ",", "done", ")", ";", "}", "}", ";", "}", "com", ".", "squareup", ".", "okhttp", ".", "Call", "call", "=", "getDeviceTypesByApplicationValidateBeforeCall", "(", "appId", ",", "productInfo", ",", "count", ",", "offset", ",", "progressListener", ",", "progressRequestListener", ")", ";", "Type", "localVarReturnType", "=", "new", "TypeToken", "<", "DeviceTypesEnvelope", ">", "(", ")", "{", "}", ".", "getType", "(", ")", ";", "apiClient", ".", "executeAsync", "(", "call", ",", "localVarReturnType", ",", "callback", ")", ";", "return", "call", ";", "}" ]
Get Device Types by Application (asynchronously) Get Device Types by Application @param appId Application ID. (required) @param productInfo Flag to include the associated ProductInfo if present (optional) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "Get", "Device", "Types", "by", "Application", "(", "asynchronously", ")", "Get", "Device", "Types", "by", "Application" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DeviceTypesApi.java#L541-L566
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java
UpsertTask.doInsert
protected int doInsert(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { """ Executes the insert and returns the affected row count Moved to its own method to reduce possibility for variable name confusion """ //Setup the insert parameters and setter final List<Phrase> parametersInUse = insert_parameters != null ? insert_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the insert sql and execute the insert final String fInsertSql = (String) insert_sql.evaluate(req, res); return jdbcTemplate.update(fInsertSql, preparedStatementSetter); }
java
protected int doInsert(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { //Setup the insert parameters and setter final List<Phrase> parametersInUse = insert_parameters != null ? insert_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the insert sql and execute the insert final String fInsertSql = (String) insert_sql.evaluate(req, res); return jdbcTemplate.update(fInsertSql, preparedStatementSetter); }
[ "protected", "int", "doInsert", "(", "JdbcTemplate", "jdbcTemplate", ",", "TaskRequest", "req", ",", "TaskResponse", "res", ")", "{", "//Setup the insert parameters and setter", "final", "List", "<", "Phrase", ">", "parametersInUse", "=", "insert_parameters", "!=", "null", "?", "insert_parameters", ":", "parameters", ";", "final", "PreparedStatementSetter", "preparedStatementSetter", "=", "new", "PhraseParameterPreparedStatementSetter", "(", "parametersInUse", ",", "req", ",", "res", ")", ";", "//Get the insert sql and execute the insert", "final", "String", "fInsertSql", "=", "(", "String", ")", "insert_sql", ".", "evaluate", "(", "req", ",", "res", ")", ";", "return", "jdbcTemplate", ".", "update", "(", "fInsertSql", ",", "preparedStatementSetter", ")", ";", "}" ]
Executes the insert and returns the affected row count Moved to its own method to reduce possibility for variable name confusion
[ "Executes", "the", "insert", "and", "returns", "the", "affected", "row", "count" ]
train
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java#L173-L181
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateCrawlerRequest.java
CreateCrawlerRequest.withTags
public CreateCrawlerRequest withTags(java.util.Map<String, String> tags) { """ <p> The tags to use with this crawler request. You may use tags to limit access to the crawler. For more information about tags in AWS Glue, see <a href="http://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in the developer guide. </p> @param tags The tags to use with this crawler request. You may use tags to limit access to the crawler. For more information about tags in AWS Glue, see <a href="http://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in the developer guide. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateCrawlerRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateCrawlerRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags to use with this crawler request. You may use tags to limit access to the crawler. For more information about tags in AWS Glue, see <a href="http://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in the developer guide. </p> @param tags The tags to use with this crawler request. You may use tags to limit access to the crawler. For more information about tags in AWS Glue, see <a href="http://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in the developer guide. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "to", "use", "with", "this", "crawler", "request", ".", "You", "may", "use", "tags", "to", "limit", "access", "to", "the", "crawler", ".", "For", "more", "information", "about", "tags", "in", "AWS", "Glue", "see", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "glue", "/", "latest", "/", "dg", "/", "monitor", "-", "tags", ".", "html", ">", "AWS", "Tags", "in", "AWS", "Glue<", "/", "a", ">", "in", "the", "developer", "guide", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateCrawlerRequest.java#L678-L681
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java
ComparableExtensions.operator_greaterEqualsThan
@Pure /* not guaranteed, since compareTo() is invoked */ @Inline("($1.compareTo($2) >= 0)") public static <C> boolean operator_greaterEqualsThan(Comparable<? super C> left, C right) { """ The comparison operator <code>greater than or equals</code>. @param left a comparable @param right the value to compare with @return <code>left.compareTo(right) >= 0</code> """ return left.compareTo(right) >= 0; }
java
@Pure /* not guaranteed, since compareTo() is invoked */ @Inline("($1.compareTo($2) >= 0)") public static <C> boolean operator_greaterEqualsThan(Comparable<? super C> left, C right) { return left.compareTo(right) >= 0; }
[ "@", "Pure", "/* not guaranteed, since compareTo() is invoked */", "@", "Inline", "(", "\"($1.compareTo($2) >= 0)\"", ")", "public", "static", "<", "C", ">", "boolean", "operator_greaterEqualsThan", "(", "Comparable", "<", "?", "super", "C", ">", "left", ",", "C", "right", ")", "{", "return", "left", ".", "compareTo", "(", "right", ")", ">=", "0", ";", "}" ]
The comparison operator <code>greater than or equals</code>. @param left a comparable @param right the value to compare with @return <code>left.compareTo(right) >= 0</code>
[ "The", "comparison", "operator", "<code", ">", "greater", "than", "or", "equals<", "/", "code", ">", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ComparableExtensions.java#L74-L78
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/support/Filters.java
Filters.onlyMismatches
public static Predicate<Tuple2<Context<?>, Boolean>> onlyMismatches() { """ A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}. Enables printing of rule tracing log messages for all mismatched rules. @return a predicate """ return new Predicate<Tuple2<Context<?>, Boolean>>() { public boolean apply(Tuple2<Context<?>, Boolean> tuple) { return !tuple.b; } }; }
java
public static Predicate<Tuple2<Context<?>, Boolean>> onlyMismatches() { return new Predicate<Tuple2<Context<?>, Boolean>>() { public boolean apply(Tuple2<Context<?>, Boolean> tuple) { return !tuple.b; } }; }
[ "public", "static", "Predicate", "<", "Tuple2", "<", "Context", "<", "?", ">", ",", "Boolean", ">", ">", "onlyMismatches", "(", ")", "{", "return", "new", "Predicate", "<", "Tuple2", "<", "Context", "<", "?", ">", ",", "Boolean", ">", ">", "(", ")", "{", "public", "boolean", "apply", "(", "Tuple2", "<", "Context", "<", "?", ">", ",", "Boolean", ">", "tuple", ")", "{", "return", "!", "tuple", ".", "b", ";", "}", "}", ";", "}" ]
A predicate usable as a filter (element) of a {@link org.parboiled.parserunners.TracingParseRunner}. Enables printing of rule tracing log messages for all mismatched rules. @return a predicate
[ "A", "predicate", "usable", "as", "a", "filter", "(", "element", ")", "of", "a", "{", "@link", "org", ".", "parboiled", ".", "parserunners", ".", "TracingParseRunner", "}", ".", "Enables", "printing", "of", "rule", "tracing", "log", "messages", "for", "all", "mismatched", "rules", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Filters.java#L205-L211
Domo42/saga-lib
saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java
AbstractSaga.requestTimeout
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final Object data) { """ Requests a timeout event attaching specific timeout data. This data is returned with the timeout message received. """ return requestTimeout(delay, unit, null, data); }
java
protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final Object data) { return requestTimeout(delay, unit, null, data); }
[ "protected", "TimeoutId", "requestTimeout", "(", "final", "long", "delay", ",", "final", "TimeUnit", "unit", ",", "@", "Nullable", "final", "Object", "data", ")", "{", "return", "requestTimeout", "(", "delay", ",", "unit", ",", "null", ",", "data", ")", ";", "}" ]
Requests a timeout event attaching specific timeout data. This data is returned with the timeout message received.
[ "Requests", "a", "timeout", "event", "attaching", "specific", "timeout", "data", ".", "This", "data", "is", "returned", "with", "the", "timeout", "message", "received", "." ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java#L102-L104
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java
ChineseCalendar.offsetMonth
private void offsetMonth(int newMoon, int dom, int delta) { """ Adjust this calendar to be delta months before or after a given start position, pinning the day of month if necessary. The start position is given as a local days number for the start of the month and a day-of-month. Used by add() and roll(). @param newMoon the local days of the first day of the month of the start position (days after January 1, 1970 0:00 Asia/Shanghai) @param dom the 1-based day-of-month of the start position @param delta the number of months to move forward or backward from the start position """ // Move to the middle of the month before our target month. newMoon += (int) (CalendarAstronomer.SYNODIC_MONTH * (delta - 0.5)); // Search forward to the target month's new moon newMoon = newMoonNear(newMoon, true); // Find the target dom int jd = newMoon + EPOCH_JULIAN_DAY - 1 + dom; // Pin the dom. In this calendar all months are 29 or 30 days // so pinning just means handling dom 30. if (dom > 29) { set(JULIAN_DAY, jd-1); // TODO Fix this. We really shouldn't ever have to // explicitly call complete(). This is either a bug in // this method, in ChineseCalendar, or in // Calendar.getActualMaximum(). I suspect the last. complete(); if (getActualMaximum(DAY_OF_MONTH) >= dom) { set(JULIAN_DAY, jd); } } else { set(JULIAN_DAY, jd); } }
java
private void offsetMonth(int newMoon, int dom, int delta) { // Move to the middle of the month before our target month. newMoon += (int) (CalendarAstronomer.SYNODIC_MONTH * (delta - 0.5)); // Search forward to the target month's new moon newMoon = newMoonNear(newMoon, true); // Find the target dom int jd = newMoon + EPOCH_JULIAN_DAY - 1 + dom; // Pin the dom. In this calendar all months are 29 or 30 days // so pinning just means handling dom 30. if (dom > 29) { set(JULIAN_DAY, jd-1); // TODO Fix this. We really shouldn't ever have to // explicitly call complete(). This is either a bug in // this method, in ChineseCalendar, or in // Calendar.getActualMaximum(). I suspect the last. complete(); if (getActualMaximum(DAY_OF_MONTH) >= dom) { set(JULIAN_DAY, jd); } } else { set(JULIAN_DAY, jd); } }
[ "private", "void", "offsetMonth", "(", "int", "newMoon", ",", "int", "dom", ",", "int", "delta", ")", "{", "// Move to the middle of the month before our target month.", "newMoon", "+=", "(", "int", ")", "(", "CalendarAstronomer", ".", "SYNODIC_MONTH", "*", "(", "delta", "-", "0.5", ")", ")", ";", "// Search forward to the target month's new moon", "newMoon", "=", "newMoonNear", "(", "newMoon", ",", "true", ")", ";", "// Find the target dom", "int", "jd", "=", "newMoon", "+", "EPOCH_JULIAN_DAY", "-", "1", "+", "dom", ";", "// Pin the dom. In this calendar all months are 29 or 30 days", "// so pinning just means handling dom 30.", "if", "(", "dom", ">", "29", ")", "{", "set", "(", "JULIAN_DAY", ",", "jd", "-", "1", ")", ";", "// TODO Fix this. We really shouldn't ever have to", "// explicitly call complete(). This is either a bug in", "// this method, in ChineseCalendar, or in", "// Calendar.getActualMaximum(). I suspect the last.", "complete", "(", ")", ";", "if", "(", "getActualMaximum", "(", "DAY_OF_MONTH", ")", ">=", "dom", ")", "{", "set", "(", "JULIAN_DAY", ",", "jd", ")", ";", "}", "}", "else", "{", "set", "(", "JULIAN_DAY", ",", "jd", ")", ";", "}", "}" ]
Adjust this calendar to be delta months before or after a given start position, pinning the day of month if necessary. The start position is given as a local days number for the start of the month and a day-of-month. Used by add() and roll(). @param newMoon the local days of the first day of the month of the start position (days after January 1, 1970 0:00 Asia/Shanghai) @param dom the 1-based day-of-month of the start position @param delta the number of months to move forward or backward from the start position
[ "Adjust", "this", "calendar", "to", "be", "delta", "months", "before", "or", "after", "a", "given", "start", "position", "pinning", "the", "day", "of", "month", "if", "necessary", ".", "The", "start", "position", "is", "given", "as", "a", "local", "days", "number", "for", "the", "start", "of", "the", "month", "and", "a", "day", "-", "of", "-", "month", ".", "Used", "by", "add", "()", "and", "roll", "()", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L514-L539
google/closure-compiler
src/com/google/javascript/rhino/jstype/FunctionType.java
FunctionType.tryMergeFunctionPiecewise
private FunctionType tryMergeFunctionPiecewise(FunctionType other, boolean leastSuper) { """ Try to get the sup/inf of two functions by looking at the piecewise components. """ Node newParamsNode = null; if (call.hasEqualParameters(other.call, EquivalenceMethod.IDENTITY, EqCache.create())) { newParamsNode = call.parameters; } else { // If the parameters are not equal, don't try to merge them. // Someday, we should try to merge the individual params. return null; } JSType newReturnType = leastSuper ? call.returnType.getLeastSupertype(other.call.returnType) : call.returnType.getGreatestSubtype(other.call.returnType); JSType newTypeOfThis = null; if (isEquivalent(typeOfThis, other.typeOfThis)) { newTypeOfThis = typeOfThis; } else { JSType maybeNewTypeOfThis = leastSuper ? typeOfThis.getLeastSupertype(other.typeOfThis) : typeOfThis.getGreatestSubtype(other.typeOfThis); newTypeOfThis = maybeNewTypeOfThis; } boolean newReturnTypeInferred = call.returnTypeInferred || other.call.returnTypeInferred; return builder(registry) .withParamsNode(newParamsNode) .withReturnType(newReturnType, newReturnTypeInferred) .withTypeOfThis(newTypeOfThis) .build(); }
java
private FunctionType tryMergeFunctionPiecewise(FunctionType other, boolean leastSuper) { Node newParamsNode = null; if (call.hasEqualParameters(other.call, EquivalenceMethod.IDENTITY, EqCache.create())) { newParamsNode = call.parameters; } else { // If the parameters are not equal, don't try to merge them. // Someday, we should try to merge the individual params. return null; } JSType newReturnType = leastSuper ? call.returnType.getLeastSupertype(other.call.returnType) : call.returnType.getGreatestSubtype(other.call.returnType); JSType newTypeOfThis = null; if (isEquivalent(typeOfThis, other.typeOfThis)) { newTypeOfThis = typeOfThis; } else { JSType maybeNewTypeOfThis = leastSuper ? typeOfThis.getLeastSupertype(other.typeOfThis) : typeOfThis.getGreatestSubtype(other.typeOfThis); newTypeOfThis = maybeNewTypeOfThis; } boolean newReturnTypeInferred = call.returnTypeInferred || other.call.returnTypeInferred; return builder(registry) .withParamsNode(newParamsNode) .withReturnType(newReturnType, newReturnTypeInferred) .withTypeOfThis(newTypeOfThis) .build(); }
[ "private", "FunctionType", "tryMergeFunctionPiecewise", "(", "FunctionType", "other", ",", "boolean", "leastSuper", ")", "{", "Node", "newParamsNode", "=", "null", ";", "if", "(", "call", ".", "hasEqualParameters", "(", "other", ".", "call", ",", "EquivalenceMethod", ".", "IDENTITY", ",", "EqCache", ".", "create", "(", ")", ")", ")", "{", "newParamsNode", "=", "call", ".", "parameters", ";", "}", "else", "{", "// If the parameters are not equal, don't try to merge them.", "// Someday, we should try to merge the individual params.", "return", "null", ";", "}", "JSType", "newReturnType", "=", "leastSuper", "?", "call", ".", "returnType", ".", "getLeastSupertype", "(", "other", ".", "call", ".", "returnType", ")", ":", "call", ".", "returnType", ".", "getGreatestSubtype", "(", "other", ".", "call", ".", "returnType", ")", ";", "JSType", "newTypeOfThis", "=", "null", ";", "if", "(", "isEquivalent", "(", "typeOfThis", ",", "other", ".", "typeOfThis", ")", ")", "{", "newTypeOfThis", "=", "typeOfThis", ";", "}", "else", "{", "JSType", "maybeNewTypeOfThis", "=", "leastSuper", "?", "typeOfThis", ".", "getLeastSupertype", "(", "other", ".", "typeOfThis", ")", ":", "typeOfThis", ".", "getGreatestSubtype", "(", "other", ".", "typeOfThis", ")", ";", "newTypeOfThis", "=", "maybeNewTypeOfThis", ";", "}", "boolean", "newReturnTypeInferred", "=", "call", ".", "returnTypeInferred", "||", "other", ".", "call", ".", "returnTypeInferred", ";", "return", "builder", "(", "registry", ")", ".", "withParamsNode", "(", "newParamsNode", ")", ".", "withReturnType", "(", "newReturnType", ",", "newReturnTypeInferred", ")", ".", "withTypeOfThis", "(", "newTypeOfThis", ")", ".", "build", "(", ")", ";", "}" ]
Try to get the sup/inf of two functions by looking at the piecewise components.
[ "Try", "to", "get", "the", "sup", "/", "inf", "of", "two", "functions", "by", "looking", "at", "the", "piecewise", "components", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/FunctionType.java#L827-L860
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java
MaterialComboBox.setSingleValue
public void setSingleValue(T value, boolean fireEvents) { """ Set the selected value using a single item, generally used in single selection mode. """ int index = this.values.indexOf(value); if (index < 0 && value instanceof String) { index = getIndexByString((String) value); } if (index > -1) { List<T> before = getValue(); setSelectedIndex(index); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, before, Collections.singletonList(value)); } } }
java
public void setSingleValue(T value, boolean fireEvents) { int index = this.values.indexOf(value); if (index < 0 && value instanceof String) { index = getIndexByString((String) value); } if (index > -1) { List<T> before = getValue(); setSelectedIndex(index); if (fireEvents) { ValueChangeEvent.fireIfNotEqual(this, before, Collections.singletonList(value)); } } }
[ "public", "void", "setSingleValue", "(", "T", "value", ",", "boolean", "fireEvents", ")", "{", "int", "index", "=", "this", ".", "values", ".", "indexOf", "(", "value", ")", ";", "if", "(", "index", "<", "0", "&&", "value", "instanceof", "String", ")", "{", "index", "=", "getIndexByString", "(", "(", "String", ")", "value", ")", ";", "}", "if", "(", "index", ">", "-", "1", ")", "{", "List", "<", "T", ">", "before", "=", "getValue", "(", ")", ";", "setSelectedIndex", "(", "index", ")", ";", "if", "(", "fireEvents", ")", "{", "ValueChangeEvent", ".", "fireIfNotEqual", "(", "this", ",", "before", ",", "Collections", ".", "singletonList", "(", "value", ")", ")", ";", "}", "}", "}" ]
Set the selected value using a single item, generally used in single selection mode.
[ "Set", "the", "selected", "value", "using", "a", "single", "item", "generally", "used", "in", "single", "selection", "mode", "." ]
train
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/combobox/MaterialComboBox.java#L533-L547
threerings/nenya
core/src/main/java/com/threerings/media/tile/TrimmedObjectTileSet.java
TrimmedObjectTileSet.hasConstraint
public boolean hasConstraint (int tileIdx, String constraint) { """ Checks whether the tile at the specified index has the given constraint. """ return (_bits == null || _bits[tileIdx].constraints == null) ? false : ListUtil.contains(_bits[tileIdx].constraints, constraint); }
java
public boolean hasConstraint (int tileIdx, String constraint) { return (_bits == null || _bits[tileIdx].constraints == null) ? false : ListUtil.contains(_bits[tileIdx].constraints, constraint); }
[ "public", "boolean", "hasConstraint", "(", "int", "tileIdx", ",", "String", "constraint", ")", "{", "return", "(", "_bits", "==", "null", "||", "_bits", "[", "tileIdx", "]", ".", "constraints", "==", "null", ")", "?", "false", ":", "ListUtil", ".", "contains", "(", "_bits", "[", "tileIdx", "]", ".", "constraints", ",", "constraint", ")", ";", "}" ]
Checks whether the tile at the specified index has the given constraint.
[ "Checks", "whether", "the", "tile", "at", "the", "specified", "index", "has", "the", "given", "constraint", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TrimmedObjectTileSet.java#L96-L100
mkotsur/restito
src/main/java/com/xebialabs/restito/builder/verify/VerifyHttp.java
VerifyHttp.times
public VerifySequenced times(int t, Condition... conditions) { """ There should be <i>t</i> calls which satisfies given conditions """ final List<Call> foundCalls = filterByConditions(conditions); if (t != foundCalls.size()) { throw new AssertionError(format("Expected to happen %s time(s), but happened %s times instead", t, foundCalls.size())); } return new VerifySequenced(getCallsAfterLastFound(foundCalls)); }
java
public VerifySequenced times(int t, Condition... conditions) { final List<Call> foundCalls = filterByConditions(conditions); if (t != foundCalls.size()) { throw new AssertionError(format("Expected to happen %s time(s), but happened %s times instead", t, foundCalls.size())); } return new VerifySequenced(getCallsAfterLastFound(foundCalls)); }
[ "public", "VerifySequenced", "times", "(", "int", "t", ",", "Condition", "...", "conditions", ")", "{", "final", "List", "<", "Call", ">", "foundCalls", "=", "filterByConditions", "(", "conditions", ")", ";", "if", "(", "t", "!=", "foundCalls", ".", "size", "(", ")", ")", "{", "throw", "new", "AssertionError", "(", "format", "(", "\"Expected to happen %s time(s), but happened %s times instead\"", ",", "t", ",", "foundCalls", ".", "size", "(", ")", ")", ")", ";", "}", "return", "new", "VerifySequenced", "(", "getCallsAfterLastFound", "(", "foundCalls", ")", ")", ";", "}" ]
There should be <i>t</i> calls which satisfies given conditions
[ "There", "should", "be", "<i", ">", "t<", "/", "i", ">", "calls", "which", "satisfies", "given", "conditions" ]
train
https://github.com/mkotsur/restito/blob/b999293616ca84fdea1ffe929e92a5db29c7e415/src/main/java/com/xebialabs/restito/builder/verify/VerifyHttp.java#L55-L62
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/GrammaticalStructure.java
GrammaticalStructure.getGrammaticalRelation
public GrammaticalRelation getGrammaticalRelation(int govIndex, int depIndex) { """ Get GrammaticalRelation between gov and dep, and null if gov is not the governor of dep """ TreeGraphNode gov = getNodeByIndex(govIndex); TreeGraphNode dep = getNodeByIndex(depIndex); return getGrammaticalRelation(gov, dep); }
java
public GrammaticalRelation getGrammaticalRelation(int govIndex, int depIndex) { TreeGraphNode gov = getNodeByIndex(govIndex); TreeGraphNode dep = getNodeByIndex(depIndex); return getGrammaticalRelation(gov, dep); }
[ "public", "GrammaticalRelation", "getGrammaticalRelation", "(", "int", "govIndex", ",", "int", "depIndex", ")", "{", "TreeGraphNode", "gov", "=", "getNodeByIndex", "(", "govIndex", ")", ";", "TreeGraphNode", "dep", "=", "getNodeByIndex", "(", "depIndex", ")", ";", "return", "getGrammaticalRelation", "(", "gov", ",", "dep", ")", ";", "}" ]
Get GrammaticalRelation between gov and dep, and null if gov is not the governor of dep
[ "Get", "GrammaticalRelation", "between", "gov", "and", "dep", "and", "null", "if", "gov", "is", "not", "the", "governor", "of", "dep" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/GrammaticalStructure.java#L468-L472
JRebirth/JRebirth
org.jrebirth.af/processor/src/main/java/org/jrebirth/af/processor/ComponentProcessor.java
ComponentProcessor.createModuleStarter
private String createModuleStarter(final Map<Class<?>, Set<? extends Element>> annotationMap, ProcessingEnvironment processingEnv) { """ Creates module stater class according to the annotations @param annotationMap map of annotations to process @param processingEnv environment to access facilities the tool framework provides to the processor @return Module name """ String moduleName; try { moduleName = getModuleStarterName(processingEnv); final String starterName = moduleName.substring(moduleName.lastIndexOf('.') + 1); final String pkg = moduleName.substring(0, moduleName.lastIndexOf('.')); final JavaClassSource javaClass = Roaster.create(JavaClassSource.class); javaClass.setPackage(pkg).setName(starterName); javaClass.extendSuperType(AbstractModuleStarter.class); final StringBuilder body = new StringBuilder(); appendRegistrationPoints(javaClass, body, annotationMap.get(RegistrationPoint.class)); appendRegistrations(javaClass, body, annotationMap.get(Register.class)); appendPreload(javaClass, body, annotationMap.get(Preload.class)); appendBootComponent(javaClass, body, annotationMap.get(BootComponent.class)); if (!javaClass.hasMethodSignature("start")) { final MethodSource<?> method = javaClass.addMethod() .setName("start") .setPublic() .setBody(body.toString()) .setReturnTypeVoid(); method.getJavaDoc().setFullText("{@inheritDoc}"); method.addAnnotation(Override.class); } else { javaClass.getMethod("start").setBody(javaClass.getMethod("start").getBody() + body.toString()); } final Properties prefs = new Properties(); prefs.load(this.getClass().getResourceAsStream(FORMATTER_PROPERTIES_FILE)); final String formattedSource = Formatter.format(prefs, javaClass); // System.out.println(formattedSource); final JavaFileObject jfo = this.processingEnv.getFiler().createSourceFile(moduleName); this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "creating source file: " + jfo.toUri()); final Writer writer = jfo.openWriter(); writer.write(formattedSource); writer.close(); } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException(e); } return moduleName; }
java
private String createModuleStarter(final Map<Class<?>, Set<? extends Element>> annotationMap, ProcessingEnvironment processingEnv) { String moduleName; try { moduleName = getModuleStarterName(processingEnv); final String starterName = moduleName.substring(moduleName.lastIndexOf('.') + 1); final String pkg = moduleName.substring(0, moduleName.lastIndexOf('.')); final JavaClassSource javaClass = Roaster.create(JavaClassSource.class); javaClass.setPackage(pkg).setName(starterName); javaClass.extendSuperType(AbstractModuleStarter.class); final StringBuilder body = new StringBuilder(); appendRegistrationPoints(javaClass, body, annotationMap.get(RegistrationPoint.class)); appendRegistrations(javaClass, body, annotationMap.get(Register.class)); appendPreload(javaClass, body, annotationMap.get(Preload.class)); appendBootComponent(javaClass, body, annotationMap.get(BootComponent.class)); if (!javaClass.hasMethodSignature("start")) { final MethodSource<?> method = javaClass.addMethod() .setName("start") .setPublic() .setBody(body.toString()) .setReturnTypeVoid(); method.getJavaDoc().setFullText("{@inheritDoc}"); method.addAnnotation(Override.class); } else { javaClass.getMethod("start").setBody(javaClass.getMethod("start").getBody() + body.toString()); } final Properties prefs = new Properties(); prefs.load(this.getClass().getResourceAsStream(FORMATTER_PROPERTIES_FILE)); final String formattedSource = Formatter.format(prefs, javaClass); // System.out.println(formattedSource); final JavaFileObject jfo = this.processingEnv.getFiler().createSourceFile(moduleName); this.processingEnv.getMessager().printMessage(Diagnostic.Kind.NOTE, "creating source file: " + jfo.toUri()); final Writer writer = jfo.openWriter(); writer.write(formattedSource); writer.close(); } catch (final Exception e) { e.printStackTrace(); throw new RuntimeException(e); } return moduleName; }
[ "private", "String", "createModuleStarter", "(", "final", "Map", "<", "Class", "<", "?", ">", ",", "Set", "<", "?", "extends", "Element", ">", ">", "annotationMap", ",", "ProcessingEnvironment", "processingEnv", ")", "{", "String", "moduleName", ";", "try", "{", "moduleName", "=", "getModuleStarterName", "(", "processingEnv", ")", ";", "final", "String", "starterName", "=", "moduleName", ".", "substring", "(", "moduleName", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ";", "final", "String", "pkg", "=", "moduleName", ".", "substring", "(", "0", ",", "moduleName", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "final", "JavaClassSource", "javaClass", "=", "Roaster", ".", "create", "(", "JavaClassSource", ".", "class", ")", ";", "javaClass", ".", "setPackage", "(", "pkg", ")", ".", "setName", "(", "starterName", ")", ";", "javaClass", ".", "extendSuperType", "(", "AbstractModuleStarter", ".", "class", ")", ";", "final", "StringBuilder", "body", "=", "new", "StringBuilder", "(", ")", ";", "appendRegistrationPoints", "(", "javaClass", ",", "body", ",", "annotationMap", ".", "get", "(", "RegistrationPoint", ".", "class", ")", ")", ";", "appendRegistrations", "(", "javaClass", ",", "body", ",", "annotationMap", ".", "get", "(", "Register", ".", "class", ")", ")", ";", "appendPreload", "(", "javaClass", ",", "body", ",", "annotationMap", ".", "get", "(", "Preload", ".", "class", ")", ")", ";", "appendBootComponent", "(", "javaClass", ",", "body", ",", "annotationMap", ".", "get", "(", "BootComponent", ".", "class", ")", ")", ";", "if", "(", "!", "javaClass", ".", "hasMethodSignature", "(", "\"start\"", ")", ")", "{", "final", "MethodSource", "<", "?", ">", "method", "=", "javaClass", ".", "addMethod", "(", ")", ".", "setName", "(", "\"start\"", ")", ".", "setPublic", "(", ")", ".", "setBody", "(", "body", ".", "toString", "(", ")", ")", ".", "setReturnTypeVoid", "(", ")", ";", "method", ".", "getJavaDoc", "(", ")", ".", "setFullText", "(", "\"{@inheritDoc}\"", ")", ";", "method", ".", "addAnnotation", "(", "Override", ".", "class", ")", ";", "}", "else", "{", "javaClass", ".", "getMethod", "(", "\"start\"", ")", ".", "setBody", "(", "javaClass", ".", "getMethod", "(", "\"start\"", ")", ".", "getBody", "(", ")", "+", "body", ".", "toString", "(", ")", ")", ";", "}", "final", "Properties", "prefs", "=", "new", "Properties", "(", ")", ";", "prefs", ".", "load", "(", "this", ".", "getClass", "(", ")", ".", "getResourceAsStream", "(", "FORMATTER_PROPERTIES_FILE", ")", ")", ";", "final", "String", "formattedSource", "=", "Formatter", ".", "format", "(", "prefs", ",", "javaClass", ")", ";", "// System.out.println(formattedSource);", "final", "JavaFileObject", "jfo", "=", "this", ".", "processingEnv", ".", "getFiler", "(", ")", ".", "createSourceFile", "(", "moduleName", ")", ";", "this", ".", "processingEnv", ".", "getMessager", "(", ")", ".", "printMessage", "(", "Diagnostic", ".", "Kind", ".", "NOTE", ",", "\"creating source file: \"", "+", "jfo", ".", "toUri", "(", ")", ")", ";", "final", "Writer", "writer", "=", "jfo", ".", "openWriter", "(", ")", ";", "writer", ".", "write", "(", "formattedSource", ")", ";", "writer", ".", "close", "(", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "return", "moduleName", ";", "}" ]
Creates module stater class according to the annotations @param annotationMap map of annotations to process @param processingEnv environment to access facilities the tool framework provides to the processor @return Module name
[ "Creates", "module", "stater", "class", "according", "to", "the", "annotations" ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/processor/src/main/java/org/jrebirth/af/processor/ComponentProcessor.java#L146-L200
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/Zealot.java
Zealot.buildSqlInfo
@SuppressWarnings("unchecked") public static SqlInfo buildSqlInfo(String nameSpace, SqlInfo sqlInfo, Node node, Object paramObj) { """ 构建完整的SqlInfo对象. @param nameSpace xml命名空间 @param sqlInfo SqlInfo对象 @param node dom4j对象节点 @param paramObj 参数对象 @return 返回SqlInfo对象 """ // 获取所有子节点,并分别将其使用StringBuilder拼接起来 List<Node> nodes = node.selectNodes(ZealotConst.ATTR_CHILD); for (Node n: nodes) { if (ZealotConst.NODETYPE_TEXT.equals(n.getNodeTypeName())) { // 如果子节点node 是文本节点,则直接获取其文本 sqlInfo.getJoin().append(n.getText()); } else if (ZealotConst.NODETYPE_ELEMENT.equals(n.getNodeTypeName())) { // 如果子节点node 是元素节点,则再判断其是什么元素,动态判断条件和参数 ConditContext.buildSqlInfo(new BuildSource(nameSpace, sqlInfo, n, paramObj), n.getName()); } } return buildFinalSql(sqlInfo, paramObj); }
java
@SuppressWarnings("unchecked") public static SqlInfo buildSqlInfo(String nameSpace, SqlInfo sqlInfo, Node node, Object paramObj) { // 获取所有子节点,并分别将其使用StringBuilder拼接起来 List<Node> nodes = node.selectNodes(ZealotConst.ATTR_CHILD); for (Node n: nodes) { if (ZealotConst.NODETYPE_TEXT.equals(n.getNodeTypeName())) { // 如果子节点node 是文本节点,则直接获取其文本 sqlInfo.getJoin().append(n.getText()); } else if (ZealotConst.NODETYPE_ELEMENT.equals(n.getNodeTypeName())) { // 如果子节点node 是元素节点,则再判断其是什么元素,动态判断条件和参数 ConditContext.buildSqlInfo(new BuildSource(nameSpace, sqlInfo, n, paramObj), n.getName()); } } return buildFinalSql(sqlInfo, paramObj); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "SqlInfo", "buildSqlInfo", "(", "String", "nameSpace", ",", "SqlInfo", "sqlInfo", ",", "Node", "node", ",", "Object", "paramObj", ")", "{", "// 获取所有子节点,并分别将其使用StringBuilder拼接起来", "List", "<", "Node", ">", "nodes", "=", "node", ".", "selectNodes", "(", "ZealotConst", ".", "ATTR_CHILD", ")", ";", "for", "(", "Node", "n", ":", "nodes", ")", "{", "if", "(", "ZealotConst", ".", "NODETYPE_TEXT", ".", "equals", "(", "n", ".", "getNodeTypeName", "(", ")", ")", ")", "{", "// 如果子节点node 是文本节点,则直接获取其文本", "sqlInfo", ".", "getJoin", "(", ")", ".", "append", "(", "n", ".", "getText", "(", ")", ")", ";", "}", "else", "if", "(", "ZealotConst", ".", "NODETYPE_ELEMENT", ".", "equals", "(", "n", ".", "getNodeTypeName", "(", ")", ")", ")", "{", "// 如果子节点node 是元素节点,则再判断其是什么元素,动态判断条件和参数", "ConditContext", ".", "buildSqlInfo", "(", "new", "BuildSource", "(", "nameSpace", ",", "sqlInfo", ",", "n", ",", "paramObj", ")", ",", "n", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "buildFinalSql", "(", "sqlInfo", ",", "paramObj", ")", ";", "}" ]
构建完整的SqlInfo对象. @param nameSpace xml命名空间 @param sqlInfo SqlInfo对象 @param node dom4j对象节点 @param paramObj 参数对象 @return 返回SqlInfo对象
[ "构建完整的SqlInfo对象", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/Zealot.java#L107-L122
geomajas/geomajas-project-server
plugin/layer-geotools/geotools/src/main/java/org/geomajas/layer/shapeinmem/ShapeInMemLayer.java
ShapeInMemLayer.getBounds
public Envelope getBounds(Filter filter) throws LayerException { """ Retrieve the bounds of the specified features. @param filter filter @return the bounds of the specified features @throws LayerException cannot read features """ try { FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureSource().getFeatures(filter); return fc.getBounds(); } catch (IOException ioe) { throw new LayerException(ioe, ExceptionCode.FEATURE_MODEL_PROBLEM); } }
java
public Envelope getBounds(Filter filter) throws LayerException { try { FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureSource().getFeatures(filter); return fc.getBounds(); } catch (IOException ioe) { throw new LayerException(ioe, ExceptionCode.FEATURE_MODEL_PROBLEM); } }
[ "public", "Envelope", "getBounds", "(", "Filter", "filter", ")", "throws", "LayerException", "{", "try", "{", "FeatureCollection", "<", "SimpleFeatureType", ",", "SimpleFeature", ">", "fc", "=", "getFeatureSource", "(", ")", ".", "getFeatures", "(", "filter", ")", ";", "return", "fc", ".", "getBounds", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "LayerException", "(", "ioe", ",", "ExceptionCode", ".", "FEATURE_MODEL_PROBLEM", ")", ";", "}", "}" ]
Retrieve the bounds of the specified features. @param filter filter @return the bounds of the specified features @throws LayerException cannot read features
[ "Retrieve", "the", "bounds", "of", "the", "specified", "features", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-geotools/geotools/src/main/java/org/geomajas/layer/shapeinmem/ShapeInMemLayer.java#L176-L183
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeVocabCache
public static void writeVocabCache(@NonNull VocabCache<VocabWord> vocabCache, @NonNull File file) throws IOException { """ This method saves vocab cache to provided File. Please note: it saves only vocab content, so it's suitable mostly for BagOfWords/TF-IDF vectorizers @param vocabCache @param file @throws UnsupportedEncodingException """ try (FileOutputStream fos = new FileOutputStream(file)) { writeVocabCache(vocabCache, fos); } }
java
public static void writeVocabCache(@NonNull VocabCache<VocabWord> vocabCache, @NonNull File file) throws IOException { try (FileOutputStream fos = new FileOutputStream(file)) { writeVocabCache(vocabCache, fos); } }
[ "public", "static", "void", "writeVocabCache", "(", "@", "NonNull", "VocabCache", "<", "VocabWord", ">", "vocabCache", ",", "@", "NonNull", "File", "file", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "writeVocabCache", "(", "vocabCache", ",", "fos", ")", ";", "}", "}" ]
This method saves vocab cache to provided File. Please note: it saves only vocab content, so it's suitable mostly for BagOfWords/TF-IDF vectorizers @param vocabCache @param file @throws UnsupportedEncodingException
[ "This", "method", "saves", "vocab", "cache", "to", "provided", "File", ".", "Please", "note", ":", "it", "saves", "only", "vocab", "content", "so", "it", "s", "suitable", "mostly", "for", "BagOfWords", "/", "TF", "-", "IDF", "vectorizers" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L2186-L2191
softindex/datakernel
core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java
ByteBuf.drainTo
public int drainTo(@NotNull byte[] array, int offset, int length) { """ Drains bytes from this {@code ByteBuf} starting from current {@link #head} to a given byte array with specified offset and length. This {@code ByteBuf} must be not recycled. @param array array to which bytes will be drained to @param offset starting position in the destination data. The sum of the value and the {@code length} parameter must be smaller or equal to {@link #array} length @param length number of bytes to be drained to given array. Must be greater or equal to 0. The sum of the value and {@link #head} must be smaller or equal to {@link #tail} @return number of bytes that were drained. """ assert !isRecycled() : "Attempt to use recycled bytebuf"; assert length >= 0 && (offset + length) <= array.length; assert head + length <= tail; System.arraycopy(this.array, head, array, offset, length); head += length; return length; }
java
public int drainTo(@NotNull byte[] array, int offset, int length) { assert !isRecycled() : "Attempt to use recycled bytebuf"; assert length >= 0 && (offset + length) <= array.length; assert head + length <= tail; System.arraycopy(this.array, head, array, offset, length); head += length; return length; }
[ "public", "int", "drainTo", "(", "@", "NotNull", "byte", "[", "]", "array", ",", "int", "offset", ",", "int", "length", ")", "{", "assert", "!", "isRecycled", "(", ")", ":", "\"Attempt to use recycled bytebuf\"", ";", "assert", "length", ">=", "0", "&&", "(", "offset", "+", "length", ")", "<=", "array", ".", "length", ";", "assert", "head", "+", "length", "<=", "tail", ";", "System", ".", "arraycopy", "(", "this", ".", "array", ",", "head", ",", "array", ",", "offset", ",", "length", ")", ";", "head", "+=", "length", ";", "return", "length", ";", "}" ]
Drains bytes from this {@code ByteBuf} starting from current {@link #head} to a given byte array with specified offset and length. This {@code ByteBuf} must be not recycled. @param array array to which bytes will be drained to @param offset starting position in the destination data. The sum of the value and the {@code length} parameter must be smaller or equal to {@link #array} length @param length number of bytes to be drained to given array. Must be greater or equal to 0. The sum of the value and {@link #head} must be smaller or equal to {@link #tail} @return number of bytes that were drained.
[ "Drains", "bytes", "from", "this", "{", "@code", "ByteBuf", "}", "starting", "from", "current", "{", "@link", "#head", "}", "to", "a", "given", "byte", "array", "with", "specified", "offset", "and", "length", "." ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-bytebuf/src/main/java/io/datakernel/bytebuf/ByteBuf.java#L576-L583
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.lockResource
public void lockResource(CmsDbContext dbc, CmsResource resource, CmsLockType type) throws CmsException { """ Locks a resource.<p> The <code>type</code> parameter controls what kind of lock is used.<br> Possible values for this parameter are: <br> <ul> <li><code>{@link org.opencms.lock.CmsLockType#EXCLUSIVE}</code></li> <li><code>{@link org.opencms.lock.CmsLockType#TEMPORARY}</code></li> <li><code>{@link org.opencms.lock.CmsLockType#PUBLISH}</code></li> </ul><p> @param dbc the current database context @param resource the resource to lock @param type type of the lock @throws CmsException if something goes wrong @see CmsObject#lockResource(String) @see CmsObject#lockResourceTemporary(String) @see org.opencms.file.types.I_CmsResourceType#lockResource(CmsObject, CmsSecurityManager, CmsResource, CmsLockType) """ // update the resource cache m_monitor.clearResourceCache(); CmsProject project = dbc.currentProject(); // add the resource to the lock dispatcher m_lockManager.addResource(dbc, resource, dbc.currentUser(), project, type); boolean changedProjectLastModified = false; if (!resource.getState().isUnchanged() && !resource.getState().isKeep()) { // update the project flag of a modified resource as "last modified inside the current project" getVfsDriver(dbc).writeLastModifiedProjectId(dbc, project, project.getUuid(), resource); changedProjectLastModified = true; } // we must also clear the permission cache m_monitor.flushCache(CmsMemoryMonitor.CacheType.PERMISSION); // fire resource modification event Map<String, Object> data = new HashMap<String, Object>(2); data.put(I_CmsEventListener.KEY_RESOURCE, resource); data.put( I_CmsEventListener.KEY_CHANGE, new Integer(changedProjectLastModified ? CHANGED_PROJECT : NOTHING_CHANGED)); data.put(I_CmsEventListener.KEY_SKIPINDEX, Boolean.TRUE); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data)); }
java
public void lockResource(CmsDbContext dbc, CmsResource resource, CmsLockType type) throws CmsException { // update the resource cache m_monitor.clearResourceCache(); CmsProject project = dbc.currentProject(); // add the resource to the lock dispatcher m_lockManager.addResource(dbc, resource, dbc.currentUser(), project, type); boolean changedProjectLastModified = false; if (!resource.getState().isUnchanged() && !resource.getState().isKeep()) { // update the project flag of a modified resource as "last modified inside the current project" getVfsDriver(dbc).writeLastModifiedProjectId(dbc, project, project.getUuid(), resource); changedProjectLastModified = true; } // we must also clear the permission cache m_monitor.flushCache(CmsMemoryMonitor.CacheType.PERMISSION); // fire resource modification event Map<String, Object> data = new HashMap<String, Object>(2); data.put(I_CmsEventListener.KEY_RESOURCE, resource); data.put( I_CmsEventListener.KEY_CHANGE, new Integer(changedProjectLastModified ? CHANGED_PROJECT : NOTHING_CHANGED)); data.put(I_CmsEventListener.KEY_SKIPINDEX, Boolean.TRUE); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_RESOURCE_MODIFIED, data)); }
[ "public", "void", "lockResource", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ",", "CmsLockType", "type", ")", "throws", "CmsException", "{", "// update the resource cache", "m_monitor", ".", "clearResourceCache", "(", ")", ";", "CmsProject", "project", "=", "dbc", ".", "currentProject", "(", ")", ";", "// add the resource to the lock dispatcher", "m_lockManager", ".", "addResource", "(", "dbc", ",", "resource", ",", "dbc", ".", "currentUser", "(", ")", ",", "project", ",", "type", ")", ";", "boolean", "changedProjectLastModified", "=", "false", ";", "if", "(", "!", "resource", ".", "getState", "(", ")", ".", "isUnchanged", "(", ")", "&&", "!", "resource", ".", "getState", "(", ")", ".", "isKeep", "(", ")", ")", "{", "// update the project flag of a modified resource as \"last modified inside the current project\"", "getVfsDriver", "(", "dbc", ")", ".", "writeLastModifiedProjectId", "(", "dbc", ",", "project", ",", "project", ".", "getUuid", "(", ")", ",", "resource", ")", ";", "changedProjectLastModified", "=", "true", ";", "}", "// we must also clear the permission cache", "m_monitor", ".", "flushCache", "(", "CmsMemoryMonitor", ".", "CacheType", ".", "PERMISSION", ")", ";", "// fire resource modification event", "Map", "<", "String", ",", "Object", ">", "data", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", "2", ")", ";", "data", ".", "put", "(", "I_CmsEventListener", ".", "KEY_RESOURCE", ",", "resource", ")", ";", "data", ".", "put", "(", "I_CmsEventListener", ".", "KEY_CHANGE", ",", "new", "Integer", "(", "changedProjectLastModified", "?", "CHANGED_PROJECT", ":", "NOTHING_CHANGED", ")", ")", ";", "data", ".", "put", "(", "I_CmsEventListener", ".", "KEY_SKIPINDEX", ",", "Boolean", ".", "TRUE", ")", ";", "OpenCms", ".", "fireCmsEvent", "(", "new", "CmsEvent", "(", "I_CmsEventListener", ".", "EVENT_RESOURCE_MODIFIED", ",", "data", ")", ")", ";", "}" ]
Locks a resource.<p> The <code>type</code> parameter controls what kind of lock is used.<br> Possible values for this parameter are: <br> <ul> <li><code>{@link org.opencms.lock.CmsLockType#EXCLUSIVE}</code></li> <li><code>{@link org.opencms.lock.CmsLockType#TEMPORARY}</code></li> <li><code>{@link org.opencms.lock.CmsLockType#PUBLISH}</code></li> </ul><p> @param dbc the current database context @param resource the resource to lock @param type type of the lock @throws CmsException if something goes wrong @see CmsObject#lockResource(String) @see CmsObject#lockResourceTemporary(String) @see org.opencms.file.types.I_CmsResourceType#lockResource(CmsObject, CmsSecurityManager, CmsResource, CmsLockType)
[ "Locks", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L5406-L5433
Steveice10/OpenNBT
src/main/java/com/github/steveice10/opennbt/NBTIO.java
NBTIO.writeTag
public static void writeTag(DataOutput out, Tag tag) throws IOException { """ Writes an NBT tag. @param out Data output to write to. @param tag Tag to write. @throws java.io.IOException If an I/O error occurs. """ out.writeByte(TagRegistry.getIdFor(tag.getClass())); out.writeUTF(tag.getName()); tag.write(out); }
java
public static void writeTag(DataOutput out, Tag tag) throws IOException { out.writeByte(TagRegistry.getIdFor(tag.getClass())); out.writeUTF(tag.getName()); tag.write(out); }
[ "public", "static", "void", "writeTag", "(", "DataOutput", "out", ",", "Tag", "tag", ")", "throws", "IOException", "{", "out", ".", "writeByte", "(", "TagRegistry", ".", "getIdFor", "(", "tag", ".", "getClass", "(", ")", ")", ")", ";", "out", ".", "writeUTF", "(", "tag", ".", "getName", "(", ")", ")", ";", "tag", ".", "write", "(", "out", ")", ";", "}" ]
Writes an NBT tag. @param out Data output to write to. @param tag Tag to write. @throws java.io.IOException If an I/O error occurs.
[ "Writes", "an", "NBT", "tag", "." ]
train
https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/NBTIO.java#L227-L231
js-lib-com/template.xhtml
src/main/java/js/template/xhtml/XhtmlTemplate.java
XhtmlTemplate._serialize
private void _serialize(Writer writer, Object model) throws IOException { """ Serialize template with given domain model to a writer. Walk through template document from its root and serialize every node; if node contains operators execute them. Operators extract values from given domain model and process them, result going to the same writer. <p> Writer parameter does not need to be {@link BufferedWriter}, but is acceptable. This interface implementation takes care to initialize the writer accordingly. Given domain model can be an instance of {@link Content} or any POJO containing values needed by template operators. <p> If any argument is null or writer is already closed this method behavior is not defined. <p> This method creates and instance of {@link Serializer} then delegates {@link Serializer#write(js.dom.Element, Object)} for actual work. @param model domain model object to inject into template, @param writer writer to serialize template to. """ if(model == null) { document.serialize(writer); return; } Serializer serializer = new Serializer(); if(serializeOperators) { serializer.enableOperatorsSerialization(); } Content content = model instanceof Content ? (Content)model : new Content(model); serializer.setContent(content); serializer.setWriter(writer); if(serializeProlog) { if(document.isXML()) { serializer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); } else { // if is not XML document should be HTML5 serializer.write("<!DOCTYPE HTML>\r\n"); } } if(document.getRoot() != null) { serializer.write(document.getRoot(), content.getModel()); } serializer.flush(); }
java
private void _serialize(Writer writer, Object model) throws IOException { if(model == null) { document.serialize(writer); return; } Serializer serializer = new Serializer(); if(serializeOperators) { serializer.enableOperatorsSerialization(); } Content content = model instanceof Content ? (Content)model : new Content(model); serializer.setContent(content); serializer.setWriter(writer); if(serializeProlog) { if(document.isXML()) { serializer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); } else { // if is not XML document should be HTML5 serializer.write("<!DOCTYPE HTML>\r\n"); } } if(document.getRoot() != null) { serializer.write(document.getRoot(), content.getModel()); } serializer.flush(); }
[ "private", "void", "_serialize", "(", "Writer", "writer", ",", "Object", "model", ")", "throws", "IOException", "{", "if", "(", "model", "==", "null", ")", "{", "document", ".", "serialize", "(", "writer", ")", ";", "return", ";", "}", "Serializer", "serializer", "=", "new", "Serializer", "(", ")", ";", "if", "(", "serializeOperators", ")", "{", "serializer", ".", "enableOperatorsSerialization", "(", ")", ";", "}", "Content", "content", "=", "model", "instanceof", "Content", "?", "(", "Content", ")", "model", ":", "new", "Content", "(", "model", ")", ";", "serializer", ".", "setContent", "(", "content", ")", ";", "serializer", ".", "setWriter", "(", "writer", ")", ";", "if", "(", "serializeProlog", ")", "{", "if", "(", "document", ".", "isXML", "(", ")", ")", "{", "serializer", ".", "write", "(", "\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\r\\n\"", ")", ";", "}", "else", "{", "// if is not XML document should be HTML5\r", "serializer", ".", "write", "(", "\"<!DOCTYPE HTML>\\r\\n\"", ")", ";", "}", "}", "if", "(", "document", ".", "getRoot", "(", ")", "!=", "null", ")", "{", "serializer", ".", "write", "(", "document", ".", "getRoot", "(", ")", ",", "content", ".", "getModel", "(", ")", ")", ";", "}", "serializer", ".", "flush", "(", ")", ";", "}" ]
Serialize template with given domain model to a writer. Walk through template document from its root and serialize every node; if node contains operators execute them. Operators extract values from given domain model and process them, result going to the same writer. <p> Writer parameter does not need to be {@link BufferedWriter}, but is acceptable. This interface implementation takes care to initialize the writer accordingly. Given domain model can be an instance of {@link Content} or any POJO containing values needed by template operators. <p> If any argument is null or writer is already closed this method behavior is not defined. <p> This method creates and instance of {@link Serializer} then delegates {@link Serializer#write(js.dom.Element, Object)} for actual work. @param model domain model object to inject into template, @param writer writer to serialize template to.
[ "Serialize", "template", "with", "given", "domain", "model", "to", "a", "writer", ".", "Walk", "through", "template", "document", "from", "its", "root", "and", "serialize", "every", "node", ";", "if", "node", "contains", "operators", "execute", "them", ".", "Operators", "extract", "values", "from", "given", "domain", "model", "and", "process", "them", "result", "going", "to", "the", "same", "writer", ".", "<p", ">", "Writer", "parameter", "does", "not", "need", "to", "be", "{", "@link", "BufferedWriter", "}", "but", "is", "acceptable", ".", "This", "interface", "implementation", "takes", "care", "to", "initialize", "the", "writer", "accordingly", ".", "Given", "domain", "model", "can", "be", "an", "instance", "of", "{", "@link", "Content", "}", "or", "any", "POJO", "containing", "values", "needed", "by", "template", "operators", ".", "<p", ">", "If", "any", "argument", "is", "null", "or", "writer", "is", "already", "closed", "this", "method", "behavior", "is", "not", "defined", ".", "<p", ">", "This", "method", "creates", "and", "instance", "of", "{", "@link", "Serializer", "}", "then", "delegates", "{", "@link", "Serializer#write", "(", "js", ".", "dom", ".", "Element", "Object", ")", "}", "for", "actual", "work", "." ]
train
https://github.com/js-lib-com/template.xhtml/blob/d50cec08aca9ab9680baebe2a26a341c096564fb/src/main/java/js/template/xhtml/XhtmlTemplate.java#L138-L167
mozilla/rhino
src/org/mozilla/javascript/Parser.java
Parser.createScopeNode
protected Scope createScopeNode(int token, int lineno) { """ Create a node that can be used to hold lexically scoped variable definitions (via let declarations). @param token the token of the node to create @param lineno line number of source @return the created node """ Scope scope =new Scope(); scope.setType(token); scope.setLineno(lineno); return scope; }
java
protected Scope createScopeNode(int token, int lineno) { Scope scope =new Scope(); scope.setType(token); scope.setLineno(lineno); return scope; }
[ "protected", "Scope", "createScopeNode", "(", "int", "token", ",", "int", "lineno", ")", "{", "Scope", "scope", "=", "new", "Scope", "(", ")", ";", "scope", ".", "setType", "(", "token", ")", ";", "scope", ".", "setLineno", "(", "lineno", ")", ";", "return", "scope", ";", "}" ]
Create a node that can be used to hold lexically scoped variable definitions (via let declarations). @param token the token of the node to create @param lineno line number of source @return the created node
[ "Create", "a", "node", "that", "can", "be", "used", "to", "hold", "lexically", "scoped", "variable", "definitions", "(", "via", "let", "declarations", ")", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Parser.java#L4175-L4180
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
TypeEnter.markDeprecated
public void markDeprecated(Symbol sym, List<JCAnnotation> annotations, Env<AttrContext> env) { """ Mark sym deprecated if annotations contain @Deprecated annotation. """ // In general, we cannot fully process annotations yet, but we // can attribute the annotation types and then check to see if the // @Deprecated annotation is present. attr.attribAnnotationTypes(annotations, env); handleDeprecatedAnnotations(annotations, sym); }
java
public void markDeprecated(Symbol sym, List<JCAnnotation> annotations, Env<AttrContext> env) { // In general, we cannot fully process annotations yet, but we // can attribute the annotation types and then check to see if the // @Deprecated annotation is present. attr.attribAnnotationTypes(annotations, env); handleDeprecatedAnnotations(annotations, sym); }
[ "public", "void", "markDeprecated", "(", "Symbol", "sym", ",", "List", "<", "JCAnnotation", ">", "annotations", ",", "Env", "<", "AttrContext", ">", "env", ")", "{", "// In general, we cannot fully process annotations yet, but we", "// can attribute the annotation types and then check to see if the", "// @Deprecated annotation is present.", "attr", ".", "attribAnnotationTypes", "(", "annotations", ",", "env", ")", ";", "handleDeprecatedAnnotations", "(", "annotations", ",", "sym", ")", ";", "}" ]
Mark sym deprecated if annotations contain @Deprecated annotation.
[ "Mark", "sym", "deprecated", "if", "annotations", "contain" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java#L1121-L1127
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java
EnhancedBigtableStub.createBulkMutateRowsCallable
private UnaryCallable<BulkMutation, Void> createBulkMutateRowsCallable() { """ Creates a callable chain to handle MutatesRows RPCs. This is meant to be used for manual batching. The chain will: <ul> <li>Convert a {@link BulkMutation} into a {@link MutateRowsRequest}. <li>Process the response and schedule retries. At the end of each attempt, entries that have been applied, are filtered from the next attempt. Also, any entries that failed with a nontransient error, are filtered from the next attempt. This will continue until there are no more entries or there are no more retry attempts left. <li>Wrap batch failures in a {@link com.google.cloud.bigtable.data.v2.models.MutateRowsException}. </ul> """ UnaryCallable<MutateRowsRequest, Void> baseCallable = createMutateRowsBaseCallable(); return createUserFacingUnaryCallable( "BulkMutateRows", new BulkMutateRowsUserFacingCallable(baseCallable, requestContext)); }
java
private UnaryCallable<BulkMutation, Void> createBulkMutateRowsCallable() { UnaryCallable<MutateRowsRequest, Void> baseCallable = createMutateRowsBaseCallable(); return createUserFacingUnaryCallable( "BulkMutateRows", new BulkMutateRowsUserFacingCallable(baseCallable, requestContext)); }
[ "private", "UnaryCallable", "<", "BulkMutation", ",", "Void", ">", "createBulkMutateRowsCallable", "(", ")", "{", "UnaryCallable", "<", "MutateRowsRequest", ",", "Void", ">", "baseCallable", "=", "createMutateRowsBaseCallable", "(", ")", ";", "return", "createUserFacingUnaryCallable", "(", "\"BulkMutateRows\"", ",", "new", "BulkMutateRowsUserFacingCallable", "(", "baseCallable", ",", "requestContext", ")", ")", ";", "}" ]
Creates a callable chain to handle MutatesRows RPCs. This is meant to be used for manual batching. The chain will: <ul> <li>Convert a {@link BulkMutation} into a {@link MutateRowsRequest}. <li>Process the response and schedule retries. At the end of each attempt, entries that have been applied, are filtered from the next attempt. Also, any entries that failed with a nontransient error, are filtered from the next attempt. This will continue until there are no more entries or there are no more retry attempts left. <li>Wrap batch failures in a {@link com.google.cloud.bigtable.data.v2.models.MutateRowsException}. </ul>
[ "Creates", "a", "callable", "chain", "to", "handle", "MutatesRows", "RPCs", ".", "This", "is", "meant", "to", "be", "used", "for", "manual", "batching", ".", "The", "chain", "will", ":" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java#L316-L321