repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
ModeShape/modeshape
index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/LuceneQueryFactory.java
LuceneQueryFactory.forSingleColumnIndex
public static LuceneQueryFactory forSingleColumnIndex( ValueFactories factories, Map<String, Object> variables, Map<String, PropertyType> propertyTypesByName ) { """ Creates a new query factory which can be used to produce Lucene queries for {@link org.modeshape.jcr.index.lucene.SingleColumnIndex} indexes. @param factories a {@link ValueFactories} instance; may not be null @param variables a {@link Map} instance which contains the query variables for a particular query; may be {@code null} @param propertyTypesByName a {@link Map} representing the columns and their types for the index definition for which the query should be created; may not be null. @return a {@link LuceneQueryFactory} instance, never {@code null} """ return new SingleColumnQueryFactory(factories, variables, propertyTypesByName); }
java
public static LuceneQueryFactory forSingleColumnIndex( ValueFactories factories, Map<String, Object> variables, Map<String, PropertyType> propertyTypesByName ) { return new SingleColumnQueryFactory(factories, variables, propertyTypesByName); }
[ "public", "static", "LuceneQueryFactory", "forSingleColumnIndex", "(", "ValueFactories", "factories", ",", "Map", "<", "String", ",", "Object", ">", "variables", ",", "Map", "<", "String", ",", "PropertyType", ">", "propertyTypesByName", ")", "{", "return", "new", "SingleColumnQueryFactory", "(", "factories", ",", "variables", ",", "propertyTypesByName", ")", ";", "}" ]
Creates a new query factory which can be used to produce Lucene queries for {@link org.modeshape.jcr.index.lucene.SingleColumnIndex} indexes. @param factories a {@link ValueFactories} instance; may not be null @param variables a {@link Map} instance which contains the query variables for a particular query; may be {@code null} @param propertyTypesByName a {@link Map} representing the columns and their types for the index definition for which the query should be created; may not be null. @return a {@link LuceneQueryFactory} instance, never {@code null}
[ "Creates", "a", "new", "query", "factory", "which", "can", "be", "used", "to", "produce", "Lucene", "queries", "for", "{", "@link", "org", ".", "modeshape", ".", "jcr", ".", "index", ".", "lucene", ".", "SingleColumnIndex", "}", "indexes", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-lucene-index-provider/src/main/java/org/modeshape/jcr/index/lucene/query/LuceneQueryFactory.java#L142-L146
pebble/pebble-android-sdk
PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java
PebbleKit.registerPebbleConnectedReceiver
public static BroadcastReceiver registerPebbleConnectedReceiver(final Context context, final BroadcastReceiver receiver) { """ A convenience function to assist in programatically registering a broadcast receiver for the 'CONNECTED' intent. To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the Activity's {@link android.app.Activity#onPause()} method. @param context The context in which to register the BroadcastReceiver. @param receiver The receiver to be registered. @return The registered receiver. @see Constants#INTENT_PEBBLE_CONNECTED """ return registerBroadcastReceiverInternal(context, INTENT_PEBBLE_CONNECTED, receiver); }
java
public static BroadcastReceiver registerPebbleConnectedReceiver(final Context context, final BroadcastReceiver receiver) { return registerBroadcastReceiverInternal(context, INTENT_PEBBLE_CONNECTED, receiver); }
[ "public", "static", "BroadcastReceiver", "registerPebbleConnectedReceiver", "(", "final", "Context", "context", ",", "final", "BroadcastReceiver", "receiver", ")", "{", "return", "registerBroadcastReceiverInternal", "(", "context", ",", "INTENT_PEBBLE_CONNECTED", ",", "receiver", ")", ";", "}" ]
A convenience function to assist in programatically registering a broadcast receiver for the 'CONNECTED' intent. To avoid leaking memory, activities registering BroadcastReceivers <em>must</em> unregister them in the Activity's {@link android.app.Activity#onPause()} method. @param context The context in which to register the BroadcastReceiver. @param receiver The receiver to be registered. @return The registered receiver. @see Constants#INTENT_PEBBLE_CONNECTED
[ "A", "convenience", "function", "to", "assist", "in", "programatically", "registering", "a", "broadcast", "receiver", "for", "the", "CONNECTED", "intent", "." ]
train
https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L385-L388
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.requiredBooleanAttribute
public static boolean requiredBooleanAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { """ Returns the value of an attribute as a boolean. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as boolean @throws XMLStreamException if attribute is empty. """ return requiredBooleanAttribute(reader, null, localName); }
java
public static boolean requiredBooleanAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredBooleanAttribute(reader, null, localName); }
[ "public", "static", "boolean", "requiredBooleanAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ")", "throws", "XMLStreamException", "{", "return", "requiredBooleanAttribute", "(", "reader", ",", "null", ",", "localName", ")", ";", "}" ]
Returns the value of an attribute as a boolean. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as boolean @throws XMLStreamException if attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "boolean", ".", "If", "the", "attribute", "is", "empty", "this", "method", "throws", "an", "exception", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L995-L998
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP9Reader.java
MPP9Reader.populateMemberData
private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException { """ Populate member data used by the rest of the reader. @param reader parent file reader @param file parent MPP file @param root Root of the POI file system. """ m_reader = reader; m_file = file; m_eventManager = file.getEventManager(); m_root = root; // // Retrieve the high level document properties (never encoded) // Props9 props9 = new Props9(new DocumentInputStream(((DocumentEntry) root.getEntry("Props9")))); //System.out.println(props9); file.getProjectProperties().setProjectFilePath(props9.getUnicodeString(Props.PROJECT_FILE_PATH)); m_inputStreamFactory = new DocumentInputStreamFactory(props9); // // Test for password protection. In the single byte retrieved here: // // 0x00 = no password // 0x01 = protection password has been supplied // 0x02 = write reservation password has been supplied // 0x03 = both passwords have been supplied // if ((props9.getByte(Props.PASSWORD_FLAG) & 0x01) != 0) { // File is password protected for reading, let's read the password // and see if the correct read password was given to us. String readPassword = MPPUtility.decodePassword(props9.getByteArray(Props.PROTECTION_PASSWORD_HASH), m_inputStreamFactory.getEncryptionCode()); // It looks like it is possible for a project file to have the password protection flag on without a password. In // this case MS Project treats the file as NOT protected. We need to do the same. It is worth noting that MS Project does // correct the problem if the file is re-saved (at least it did for me). if (readPassword != null && readPassword.length() > 0) { // See if the correct read password was given if (reader.getReadPassword() == null || reader.getReadPassword().matches(readPassword) == false) { // Passwords don't match throw new MPXJException(MPXJException.PASSWORD_PROTECTED_ENTER_PASSWORD); } } // Passwords matched so let's allow the reading to continue. } m_resourceMap = new HashMap<Integer, ProjectCalendar>(); m_projectDir = (DirectoryEntry) root.getEntry(" 19"); m_viewDir = (DirectoryEntry) root.getEntry(" 29"); DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode"); VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta")))); m_outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data")))); m_projectProps = new Props9(m_inputStreamFactory.getInstance(m_projectDir, "Props")); //MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes()); m_fontBases = new HashMap<Integer, FontBase>(); m_taskSubProjects = new HashMap<Integer, SubProject>(); m_file.getProjectProperties().setMppFileType(Integer.valueOf(9)); m_file.getProjectProperties().setAutoFilter(props9.getBoolean(Props.AUTO_FILTER)); }
java
private void populateMemberData(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException { m_reader = reader; m_file = file; m_eventManager = file.getEventManager(); m_root = root; // // Retrieve the high level document properties (never encoded) // Props9 props9 = new Props9(new DocumentInputStream(((DocumentEntry) root.getEntry("Props9")))); //System.out.println(props9); file.getProjectProperties().setProjectFilePath(props9.getUnicodeString(Props.PROJECT_FILE_PATH)); m_inputStreamFactory = new DocumentInputStreamFactory(props9); // // Test for password protection. In the single byte retrieved here: // // 0x00 = no password // 0x01 = protection password has been supplied // 0x02 = write reservation password has been supplied // 0x03 = both passwords have been supplied // if ((props9.getByte(Props.PASSWORD_FLAG) & 0x01) != 0) { // File is password protected for reading, let's read the password // and see if the correct read password was given to us. String readPassword = MPPUtility.decodePassword(props9.getByteArray(Props.PROTECTION_PASSWORD_HASH), m_inputStreamFactory.getEncryptionCode()); // It looks like it is possible for a project file to have the password protection flag on without a password. In // this case MS Project treats the file as NOT protected. We need to do the same. It is worth noting that MS Project does // correct the problem if the file is re-saved (at least it did for me). if (readPassword != null && readPassword.length() > 0) { // See if the correct read password was given if (reader.getReadPassword() == null || reader.getReadPassword().matches(readPassword) == false) { // Passwords don't match throw new MPXJException(MPXJException.PASSWORD_PROTECTED_ENTER_PASSWORD); } } // Passwords matched so let's allow the reading to continue. } m_resourceMap = new HashMap<Integer, ProjectCalendar>(); m_projectDir = (DirectoryEntry) root.getEntry(" 19"); m_viewDir = (DirectoryEntry) root.getEntry(" 29"); DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode"); VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta")))); m_outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data")))); m_projectProps = new Props9(m_inputStreamFactory.getInstance(m_projectDir, "Props")); //MPPUtility.fileDump("c:\\temp\\props.txt", m_projectProps.toString().getBytes()); m_fontBases = new HashMap<Integer, FontBase>(); m_taskSubProjects = new HashMap<Integer, SubProject>(); m_file.getProjectProperties().setMppFileType(Integer.valueOf(9)); m_file.getProjectProperties().setAutoFilter(props9.getBoolean(Props.AUTO_FILTER)); }
[ "private", "void", "populateMemberData", "(", "MPPReader", "reader", ",", "ProjectFile", "file", ",", "DirectoryEntry", "root", ")", "throws", "MPXJException", ",", "IOException", "{", "m_reader", "=", "reader", ";", "m_file", "=", "file", ";", "m_eventManager", "=", "file", ".", "getEventManager", "(", ")", ";", "m_root", "=", "root", ";", "//", "// Retrieve the high level document properties (never encoded)", "//", "Props9", "props9", "=", "new", "Props9", "(", "new", "DocumentInputStream", "(", "(", "(", "DocumentEntry", ")", "root", ".", "getEntry", "(", "\"Props9\"", ")", ")", ")", ")", ";", "//System.out.println(props9);", "file", ".", "getProjectProperties", "(", ")", ".", "setProjectFilePath", "(", "props9", ".", "getUnicodeString", "(", "Props", ".", "PROJECT_FILE_PATH", ")", ")", ";", "m_inputStreamFactory", "=", "new", "DocumentInputStreamFactory", "(", "props9", ")", ";", "//", "// Test for password protection. In the single byte retrieved here:", "//", "// 0x00 = no password", "// 0x01 = protection password has been supplied", "// 0x02 = write reservation password has been supplied", "// 0x03 = both passwords have been supplied", "//", "if", "(", "(", "props9", ".", "getByte", "(", "Props", ".", "PASSWORD_FLAG", ")", "&", "0x01", ")", "!=", "0", ")", "{", "// File is password protected for reading, let's read the password", "// and see if the correct read password was given to us.", "String", "readPassword", "=", "MPPUtility", ".", "decodePassword", "(", "props9", ".", "getByteArray", "(", "Props", ".", "PROTECTION_PASSWORD_HASH", ")", ",", "m_inputStreamFactory", ".", "getEncryptionCode", "(", ")", ")", ";", "// It looks like it is possible for a project file to have the password protection flag on without a password. In", "// this case MS Project treats the file as NOT protected. We need to do the same. It is worth noting that MS Project does", "// correct the problem if the file is re-saved (at least it did for me).", "if", "(", "readPassword", "!=", "null", "&&", "readPassword", ".", "length", "(", ")", ">", "0", ")", "{", "// See if the correct read password was given", "if", "(", "reader", ".", "getReadPassword", "(", ")", "==", "null", "||", "reader", ".", "getReadPassword", "(", ")", ".", "matches", "(", "readPassword", ")", "==", "false", ")", "{", "// Passwords don't match", "throw", "new", "MPXJException", "(", "MPXJException", ".", "PASSWORD_PROTECTED_ENTER_PASSWORD", ")", ";", "}", "}", "// Passwords matched so let's allow the reading to continue.", "}", "m_resourceMap", "=", "new", "HashMap", "<", "Integer", ",", "ProjectCalendar", ">", "(", ")", ";", "m_projectDir", "=", "(", "DirectoryEntry", ")", "root", ".", "getEntry", "(", "\" 19\"", ")", ";", "m_viewDir", "=", "(", "DirectoryEntry", ")", "root", ".", "getEntry", "(", "\" 29\"", ")", ";", "DirectoryEntry", "outlineCodeDir", "=", "(", "DirectoryEntry", ")", "m_projectDir", ".", "getEntry", "(", "\"TBkndOutlCode\"", ")", ";", "VarMeta", "outlineCodeVarMeta", "=", "new", "VarMeta9", "(", "new", "DocumentInputStream", "(", "(", "(", "DocumentEntry", ")", "outlineCodeDir", ".", "getEntry", "(", "\"VarMeta\"", ")", ")", ")", ")", ";", "m_outlineCodeVarData", "=", "new", "Var2Data", "(", "outlineCodeVarMeta", ",", "new", "DocumentInputStream", "(", "(", "(", "DocumentEntry", ")", "outlineCodeDir", ".", "getEntry", "(", "\"Var2Data\"", ")", ")", ")", ")", ";", "m_projectProps", "=", "new", "Props9", "(", "m_inputStreamFactory", ".", "getInstance", "(", "m_projectDir", ",", "\"Props\"", ")", ")", ";", "//MPPUtility.fileDump(\"c:\\\\temp\\\\props.txt\", m_projectProps.toString().getBytes());", "m_fontBases", "=", "new", "HashMap", "<", "Integer", ",", "FontBase", ">", "(", ")", ";", "m_taskSubProjects", "=", "new", "HashMap", "<", "Integer", ",", "SubProject", ">", "(", ")", ";", "m_file", ".", "getProjectProperties", "(", ")", ".", "setMppFileType", "(", "Integer", ".", "valueOf", "(", "9", ")", ")", ";", "m_file", ".", "getProjectProperties", "(", ")", ".", "setAutoFilter", "(", "props9", ".", "getBoolean", "(", "Props", ".", "AUTO_FILTER", ")", ")", ";", "}" ]
Populate member data used by the rest of the reader. @param reader parent file reader @param file parent MPP file @param root Root of the POI file system.
[ "Populate", "member", "data", "used", "by", "the", "rest", "of", "the", "reader", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9Reader.java#L125-L183
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java
ClipboardUtils.setClipboardText
public static void setClipboardText(final Context context, final String text) { """ Set the clipboard text. @param text Text to put in the clipboard. """ if(text != null) { final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); final ClipData clipData = ClipData.newPlainText(text, text); clipboard.setPrimaryClip(clipData); } }
java
public static void setClipboardText(final Context context, final String text) { if(text != null) { final ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); final ClipData clipData = ClipData.newPlainText(text, text); clipboard.setPrimaryClip(clipData); } }
[ "public", "static", "void", "setClipboardText", "(", "final", "Context", "context", ",", "final", "String", "text", ")", "{", "if", "(", "text", "!=", "null", ")", "{", "final", "ClipboardManager", "clipboard", "=", "(", "ClipboardManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "CLIPBOARD_SERVICE", ")", ";", "final", "ClipData", "clipData", "=", "ClipData", ".", "newPlainText", "(", "text", ",", "text", ")", ";", "clipboard", ".", "setPrimaryClip", "(", "clipData", ")", ";", "}", "}" ]
Set the clipboard text. @param text Text to put in the clipboard.
[ "Set", "the", "clipboard", "text", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ClipboardUtils.java#L34-L40
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
ServletUtil.getHeader
public final static String getHeader(HttpServletRequest request, String name, String charset) { """ 获得请求header中的信息 @param request 请求对象{@link HttpServletRequest} @param name 头信息的KEY @param charset 字符集 @return header值 """ final String header = request.getHeader(name); if (null != header) { try { return new String(header.getBytes(CharsetUtil.ISO_8859_1), charset); } catch (UnsupportedEncodingException e) { throw new UtilException(StrUtil.format("Error charset {} for http request header.", charset)); } } return null; }
java
public final static String getHeader(HttpServletRequest request, String name, String charset) { final String header = request.getHeader(name); if (null != header) { try { return new String(header.getBytes(CharsetUtil.ISO_8859_1), charset); } catch (UnsupportedEncodingException e) { throw new UtilException(StrUtil.format("Error charset {} for http request header.", charset)); } } return null; }
[ "public", "final", "static", "String", "getHeader", "(", "HttpServletRequest", "request", ",", "String", "name", ",", "String", "charset", ")", "{", "final", "String", "header", "=", "request", ".", "getHeader", "(", "name", ")", ";", "if", "(", "null", "!=", "header", ")", "{", "try", "{", "return", "new", "String", "(", "header", ".", "getBytes", "(", "CharsetUtil", ".", "ISO_8859_1", ")", ",", "charset", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "UtilException", "(", "StrUtil", ".", "format", "(", "\"Error charset {} for http request header.\"", ",", "charset", ")", ")", ";", "}", "}", "return", "null", ";", "}" ]
获得请求header中的信息 @param request 请求对象{@link HttpServletRequest} @param name 头信息的KEY @param charset 字符集 @return header值
[ "获得请求header中的信息" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L298-L308
mike10004/common-helper
native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java
StreamConduit.createProcessErrorPump
private void createProcessErrorPump(InputStream is, OutputStream os) { """ Create the pump to handle error output. @param is the input stream to copy from. @param os the output stream to copy to. """ errorThread = createPump(is, os, CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED); }
java
private void createProcessErrorPump(InputStream is, OutputStream os) { errorThread = createPump(is, os, CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED); }
[ "private", "void", "createProcessErrorPump", "(", "InputStream", "is", ",", "OutputStream", "os", ")", "{", "errorThread", "=", "createPump", "(", "is", ",", "os", ",", "CLOSE_STDOUT_AND_STDERR_INSTREAMS_WHEN_EXHAUSTED", ")", ";", "}" ]
Create the pump to handle error output. @param is the input stream to copy from. @param os the output stream to copy to.
[ "Create", "the", "pump", "to", "handle", "error", "output", "." ]
train
https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/native-helper/src/main/java/com/github/mike10004/nativehelper/subprocess/StreamConduit.java#L199-L201
rpau/javalang-compiler
src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java
SymbolType.markDisabledCode
public SymbolType markDisabledCode() { """ If code is disabled via conditional compilation the symbol information is typically incomplete because no class has been created. (For conditional compilation see JLS 14.21. Unreachable Statements, http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.21) @return a copy of this symbol type marked as a disabled anonymous class. """ if (marker != Marker.None && marker != Marker.DisabledAnonymousClass) { throw new IllegalStateException("disabled code marker not supported for symbol marked with " + marker); } return clone(Marker.DisabledAnonymousClass, name, arrayCount, typeVariable, null, null); }
java
public SymbolType markDisabledCode() { if (marker != Marker.None && marker != Marker.DisabledAnonymousClass) { throw new IllegalStateException("disabled code marker not supported for symbol marked with " + marker); } return clone(Marker.DisabledAnonymousClass, name, arrayCount, typeVariable, null, null); }
[ "public", "SymbolType", "markDisabledCode", "(", ")", "{", "if", "(", "marker", "!=", "Marker", ".", "None", "&&", "marker", "!=", "Marker", ".", "DisabledAnonymousClass", ")", "{", "throw", "new", "IllegalStateException", "(", "\"disabled code marker not supported for symbol marked with \"", "+", "marker", ")", ";", "}", "return", "clone", "(", "Marker", ".", "DisabledAnonymousClass", ",", "name", ",", "arrayCount", ",", "typeVariable", ",", "null", ",", "null", ")", ";", "}" ]
If code is disabled via conditional compilation the symbol information is typically incomplete because no class has been created. (For conditional compilation see JLS 14.21. Unreachable Statements, http://docs.oracle.com/javase/specs/jls/se8/html/jls-14.html#jls-14.21) @return a copy of this symbol type marked as a disabled anonymous class.
[ "If", "code", "is", "disabled", "via", "conditional", "compilation", "the", "symbol", "information", "is", "typically", "incomplete", "because", "no", "class", "has", "been", "created", ".", "(", "For", "conditional", "compilation", "see", "JLS", "14", ".", "21", ".", "Unreachable", "Statements", "http", ":", "//", "docs", ".", "oracle", ".", "com", "/", "javase", "/", "specs", "/", "jls", "/", "se8", "/", "html", "/", "jls", "-", "14", ".", "html#jls", "-", "14", ".", "21", ")" ]
train
https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/symbols/SymbolType.java#L623-L628
zaproxy/zaproxy
src/org/parosproxy/paros/common/FileXML.java
FileXML.getElement
protected Element getElement(Element base, String childTag) { """ /* Get a single element (first element) under a base element matching a tag """ Element[] elements = getElements(base, childTag); if (elements == null) { return null; } else { return elements[0]; } }
java
protected Element getElement(Element base, String childTag) { Element[] elements = getElements(base, childTag); if (elements == null) { return null; } else { return elements[0]; } }
[ "protected", "Element", "getElement", "(", "Element", "base", ",", "String", "childTag", ")", "{", "Element", "[", "]", "elements", "=", "getElements", "(", "base", ",", "childTag", ")", ";", "if", "(", "elements", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "elements", "[", "0", "]", ";", "}", "}" ]
/* Get a single element (first element) under a base element matching a tag
[ "/", "*", "Get", "a", "single", "element", "(", "first", "element", ")", "under", "a", "base", "element", "matching", "a", "tag" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/common/FileXML.java#L88-L95
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.registerScope
public String registerScope(FullHttpRequest req) throws OAuthException { """ Register an oauth scope. If the scope already exists, returns an error. @param req http request @return String message that will be returned in the response """ String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { try { Scope scope = InputValidator.validate(req.content().toString(CharsetUtil.UTF_8), Scope.class); if (scope.valid()) { if (!Scope.validScopeName(scope.getScope())) { LOG.error("scope name is not valid"); throw new OAuthException(SCOPE_NAME_INVALID_ERROR, HttpResponseStatus.BAD_REQUEST); } LOG.info(">>>>>>>>>>>>>>> scope = " + scope); Scope foundScope = DBManagerFactory.getInstance().findScope(scope.getScope()).blockingGet(); if (foundScope != null) { LOG.error("scope already exists"); throw new OAuthException(SCOPE_ALREADY_EXISTS, HttpResponseStatus.BAD_REQUEST); } else { // store in the DB, if already exists such a scope, overwrites it DBManagerFactory.getInstance().storeScope(scope).blockingGet(); } } else { LOG.error("scope is not valid"); throw new OAuthException(MANDATORY_FIELDS_ERROR, HttpResponseStatus.BAD_REQUEST); } } catch (Throwable e) { LOG.error("cannot handle scope request", e); throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST); } } else { throw new OAuthException(ResponseBuilder.UNSUPPORTED_MEDIA_TYPE, HttpResponseStatus.BAD_REQUEST); } return SCOPE_STORED_OK_MESSAGE; }
java
public String registerScope(FullHttpRequest req) throws OAuthException { String contentType = (req.headers() != null) ? req.headers().get(HttpHeaderNames.CONTENT_TYPE) : null; // check Content-Type if (contentType != null && contentType.contains(ResponseBuilder.APPLICATION_JSON)) { try { Scope scope = InputValidator.validate(req.content().toString(CharsetUtil.UTF_8), Scope.class); if (scope.valid()) { if (!Scope.validScopeName(scope.getScope())) { LOG.error("scope name is not valid"); throw new OAuthException(SCOPE_NAME_INVALID_ERROR, HttpResponseStatus.BAD_REQUEST); } LOG.info(">>>>>>>>>>>>>>> scope = " + scope); Scope foundScope = DBManagerFactory.getInstance().findScope(scope.getScope()).blockingGet(); if (foundScope != null) { LOG.error("scope already exists"); throw new OAuthException(SCOPE_ALREADY_EXISTS, HttpResponseStatus.BAD_REQUEST); } else { // store in the DB, if already exists such a scope, overwrites it DBManagerFactory.getInstance().storeScope(scope).blockingGet(); } } else { LOG.error("scope is not valid"); throw new OAuthException(MANDATORY_FIELDS_ERROR, HttpResponseStatus.BAD_REQUEST); } } catch (Throwable e) { LOG.error("cannot handle scope request", e); throw new OAuthException(e, null, HttpResponseStatus.BAD_REQUEST); } } else { throw new OAuthException(ResponseBuilder.UNSUPPORTED_MEDIA_TYPE, HttpResponseStatus.BAD_REQUEST); } return SCOPE_STORED_OK_MESSAGE; }
[ "public", "String", "registerScope", "(", "FullHttpRequest", "req", ")", "throws", "OAuthException", "{", "String", "contentType", "=", "(", "req", ".", "headers", "(", ")", "!=", "null", ")", "?", "req", ".", "headers", "(", ")", ".", "get", "(", "HttpHeaderNames", ".", "CONTENT_TYPE", ")", ":", "null", ";", "// check Content-Type", "if", "(", "contentType", "!=", "null", "&&", "contentType", ".", "contains", "(", "ResponseBuilder", ".", "APPLICATION_JSON", ")", ")", "{", "try", "{", "Scope", "scope", "=", "InputValidator", ".", "validate", "(", "req", ".", "content", "(", ")", ".", "toString", "(", "CharsetUtil", ".", "UTF_8", ")", ",", "Scope", ".", "class", ")", ";", "if", "(", "scope", ".", "valid", "(", ")", ")", "{", "if", "(", "!", "Scope", ".", "validScopeName", "(", "scope", ".", "getScope", "(", ")", ")", ")", "{", "LOG", ".", "error", "(", "\"scope name is not valid\"", ")", ";", "throw", "new", "OAuthException", "(", "SCOPE_NAME_INVALID_ERROR", ",", "HttpResponseStatus", ".", "BAD_REQUEST", ")", ";", "}", "LOG", ".", "info", "(", "\">>>>>>>>>>>>>>> scope = \"", "+", "scope", ")", ";", "Scope", "foundScope", "=", "DBManagerFactory", ".", "getInstance", "(", ")", ".", "findScope", "(", "scope", ".", "getScope", "(", ")", ")", ".", "blockingGet", "(", ")", ";", "if", "(", "foundScope", "!=", "null", ")", "{", "LOG", ".", "error", "(", "\"scope already exists\"", ")", ";", "throw", "new", "OAuthException", "(", "SCOPE_ALREADY_EXISTS", ",", "HttpResponseStatus", ".", "BAD_REQUEST", ")", ";", "}", "else", "{", "// store in the DB, if already exists such a scope, overwrites it", "DBManagerFactory", ".", "getInstance", "(", ")", ".", "storeScope", "(", "scope", ")", ".", "blockingGet", "(", ")", ";", "}", "}", "else", "{", "LOG", ".", "error", "(", "\"scope is not valid\"", ")", ";", "throw", "new", "OAuthException", "(", "MANDATORY_FIELDS_ERROR", ",", "HttpResponseStatus", ".", "BAD_REQUEST", ")", ";", "}", "}", "catch", "(", "Throwable", "e", ")", "{", "LOG", ".", "error", "(", "\"cannot handle scope request\"", ",", "e", ")", ";", "throw", "new", "OAuthException", "(", "e", ",", "null", ",", "HttpResponseStatus", ".", "BAD_REQUEST", ")", ";", "}", "}", "else", "{", "throw", "new", "OAuthException", "(", "ResponseBuilder", ".", "UNSUPPORTED_MEDIA_TYPE", ",", "HttpResponseStatus", ".", "BAD_REQUEST", ")", ";", "}", "return", "SCOPE_STORED_OK_MESSAGE", ";", "}" ]
Register an oauth scope. If the scope already exists, returns an error. @param req http request @return String message that will be returned in the response
[ "Register", "an", "oauth", "scope", ".", "If", "the", "scope", "already", "exists", "returns", "an", "error", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L67-L99
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java
JobExecutionsInner.create
public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { """ Starts an elastic job execution. @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. @param jobAgentName The name of the job agent. @param jobName The name of the job to get. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobExecutionInner object if successful. """ return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().last().body(); }
java
public JobExecutionInner create(String resourceGroupName, String serverName, String jobAgentName, String jobName) { return createWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName).toBlocking().last().body(); }
[ "public", "JobExecutionInner", "create", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "jobName", ")", "{", "return", "createWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "jobAgentName", ",", "jobName", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Starts an elastic job execution. @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. @param jobAgentName The name of the job agent. @param jobName The name of the job to get. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobExecutionInner object if successful.
[ "Starts", "an", "elastic", "job", "execution", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L521-L523
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.publish0
private PubsubFuture<List<String>> publish0(final List<Message> messages, final String canonicalTopic) { """ Publish a batch of messages. @param messages The batch of messages. @param canonicalTopic The canonical topic to publish on. @return a future that is completed with a list of message ID's for the published messages. """ final String path = canonicalTopic + ":publish"; for (final Message message : messages) { if (!isEncoded(message)) { throw new IllegalArgumentException("Message data must be Base64 encoded: " + message); } } return post("publish", path, PublishRequest.of(messages), readJson(PublishResponse.class) .andThen(PublishResponse::messageIds)); }
java
private PubsubFuture<List<String>> publish0(final List<Message> messages, final String canonicalTopic) { final String path = canonicalTopic + ":publish"; for (final Message message : messages) { if (!isEncoded(message)) { throw new IllegalArgumentException("Message data must be Base64 encoded: " + message); } } return post("publish", path, PublishRequest.of(messages), readJson(PublishResponse.class) .andThen(PublishResponse::messageIds)); }
[ "private", "PubsubFuture", "<", "List", "<", "String", ">", ">", "publish0", "(", "final", "List", "<", "Message", ">", "messages", ",", "final", "String", "canonicalTopic", ")", "{", "final", "String", "path", "=", "canonicalTopic", "+", "\":publish\"", ";", "for", "(", "final", "Message", "message", ":", "messages", ")", "{", "if", "(", "!", "isEncoded", "(", "message", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Message data must be Base64 encoded: \"", "+", "message", ")", ";", "}", "}", "return", "post", "(", "\"publish\"", ",", "path", ",", "PublishRequest", ".", "of", "(", "messages", ")", ",", "readJson", "(", "PublishResponse", ".", "class", ")", ".", "andThen", "(", "PublishResponse", "::", "messageIds", ")", ")", ";", "}" ]
Publish a batch of messages. @param messages The batch of messages. @param canonicalTopic The canonical topic to publish on. @return a future that is completed with a list of message ID's for the published messages.
[ "Publish", "a", "batch", "of", "messages", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L518-L527
citrusframework/citrus
modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java
MailMessageConverter.getMailRequest
private MailRequest getMailRequest(Message message, MailEndpointConfiguration endpointConfiguration) { """ Reads Citrus internal mail message model object from message payload. Either payload is actually a mail message object or XML payload String is unmarshalled to mail message object. @param message @param endpointConfiguration @return """ Object payload = message.getPayload(); MailRequest mailRequest = null; if (payload != null) { if (payload instanceof MailRequest) { mailRequest = (MailRequest) payload; } else { mailRequest = (MailRequest) endpointConfiguration.getMarshaller() .unmarshal(message.getPayload(Source.class)); } } if (mailRequest == null) { throw new CitrusRuntimeException("Unable to create proper mail message from payload: " + payload); } return mailRequest; }
java
private MailRequest getMailRequest(Message message, MailEndpointConfiguration endpointConfiguration) { Object payload = message.getPayload(); MailRequest mailRequest = null; if (payload != null) { if (payload instanceof MailRequest) { mailRequest = (MailRequest) payload; } else { mailRequest = (MailRequest) endpointConfiguration.getMarshaller() .unmarshal(message.getPayload(Source.class)); } } if (mailRequest == null) { throw new CitrusRuntimeException("Unable to create proper mail message from payload: " + payload); } return mailRequest; }
[ "private", "MailRequest", "getMailRequest", "(", "Message", "message", ",", "MailEndpointConfiguration", "endpointConfiguration", ")", "{", "Object", "payload", "=", "message", ".", "getPayload", "(", ")", ";", "MailRequest", "mailRequest", "=", "null", ";", "if", "(", "payload", "!=", "null", ")", "{", "if", "(", "payload", "instanceof", "MailRequest", ")", "{", "mailRequest", "=", "(", "MailRequest", ")", "payload", ";", "}", "else", "{", "mailRequest", "=", "(", "MailRequest", ")", "endpointConfiguration", ".", "getMarshaller", "(", ")", ".", "unmarshal", "(", "message", ".", "getPayload", "(", "Source", ".", "class", ")", ")", ";", "}", "}", "if", "(", "mailRequest", "==", "null", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Unable to create proper mail message from payload: \"", "+", "payload", ")", ";", "}", "return", "mailRequest", ";", "}" ]
Reads Citrus internal mail message model object from message payload. Either payload is actually a mail message object or XML payload String is unmarshalled to mail message object. @param message @param endpointConfiguration @return
[ "Reads", "Citrus", "internal", "mail", "message", "model", "object", "from", "message", "payload", ".", "Either", "payload", "is", "actually", "a", "mail", "message", "object", "or", "XML", "payload", "String", "is", "unmarshalled", "to", "mail", "message", "object", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java#L316-L334
rey5137/material
material/src/main/java/com/rey/material/widget/Slider.java
Slider.setValue
public void setValue(float value, boolean animation) { """ Set the selected value of this Slider. @param value The selected value. @param animation Indicate that should show animation when change thumb's position. """ value = Math.min(mMaxValue, Math.max(value, mMinValue)); setPosition((value - mMinValue) / (mMaxValue - mMinValue), animation); }
java
public void setValue(float value, boolean animation){ value = Math.min(mMaxValue, Math.max(value, mMinValue)); setPosition((value - mMinValue) / (mMaxValue - mMinValue), animation); }
[ "public", "void", "setValue", "(", "float", "value", ",", "boolean", "animation", ")", "{", "value", "=", "Math", ".", "min", "(", "mMaxValue", ",", "Math", ".", "max", "(", "value", ",", "mMinValue", ")", ")", ";", "setPosition", "(", "(", "value", "-", "mMinValue", ")", "/", "(", "mMaxValue", "-", "mMinValue", ")", ",", "animation", ")", ";", "}" ]
Set the selected value of this Slider. @param value The selected value. @param animation Indicate that should show animation when change thumb's position.
[ "Set", "the", "selected", "value", "of", "this", "Slider", "." ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/widget/Slider.java#L476-L479
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/lifecycle/LifeCycleController.java
LifeCycleController.registerLifeCycleObserver
public static void registerLifeCycleObserver(@NonNull Application application, @NonNull LifecycleListener listener) { """ Creates and registers application lifecycle listener. @param application {@link Application} instance. """ application.registerActivityLifecycleCallbacks(new LifeCycleController(listener).createLifecycleCallback()); }
java
public static void registerLifeCycleObserver(@NonNull Application application, @NonNull LifecycleListener listener) { application.registerActivityLifecycleCallbacks(new LifeCycleController(listener).createLifecycleCallback()); }
[ "public", "static", "void", "registerLifeCycleObserver", "(", "@", "NonNull", "Application", "application", ",", "@", "NonNull", "LifecycleListener", "listener", ")", "{", "application", ".", "registerActivityLifecycleCallbacks", "(", "new", "LifeCycleController", "(", "listener", ")", ".", "createLifecycleCallback", "(", ")", ")", ";", "}" ]
Creates and registers application lifecycle listener. @param application {@link Application} instance.
[ "Creates", "and", "registers", "application", "lifecycle", "listener", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/lifecycle/LifeCycleController.java#L86-L88
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java
AbstractMessageHandler.handleRequest
protected <T, A> void handleRequest(final Channel channel, final DataInput message, final ManagementProtocolHeader header, ActiveRequest<T, A> activeRequest) { """ Handle a message. @param channel the channel @param message the message @param header the protocol header @param activeRequest the active request """ handleMessage(channel, message, header, activeRequest.context, activeRequest.handler); }
java
protected <T, A> void handleRequest(final Channel channel, final DataInput message, final ManagementProtocolHeader header, ActiveRequest<T, A> activeRequest) { handleMessage(channel, message, header, activeRequest.context, activeRequest.handler); }
[ "protected", "<", "T", ",", "A", ">", "void", "handleRequest", "(", "final", "Channel", "channel", ",", "final", "DataInput", "message", ",", "final", "ManagementProtocolHeader", "header", ",", "ActiveRequest", "<", "T", ",", "A", ">", "activeRequest", ")", "{", "handleMessage", "(", "channel", ",", "message", ",", "header", ",", "activeRequest", ".", "context", ",", "activeRequest", ".", "handler", ")", ";", "}" ]
Handle a message. @param channel the channel @param message the message @param header the protocol header @param activeRequest the active request
[ "Handle", "a", "message", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/AbstractMessageHandler.java#L285-L287
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.getByResourceGroup
public StorageAccountInner getByResourceGroup(String resourceGroupName, String accountName) { """ Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StorageAccountInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
java
public StorageAccountInner getByResourceGroup(String resourceGroupName, String accountName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
[ "public", "StorageAccountInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Returns the properties for the specified storage account including but not limited to name, SKU name, location, and account status. The ListKeys operation should be used to retrieve storage keys. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StorageAccountInner object if successful.
[ "Returns", "the", "properties", "for", "the", "specified", "storage", "account", "including", "but", "not", "limited", "to", "name", "SKU", "name", "location", "and", "account", "status", ".", "The", "ListKeys", "operation", "should", "be", "used", "to", "retrieve", "storage", "keys", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L484-L486
VoltDB/voltdb
src/frontend/org/voltdb/DefaultProcedureManager.java
DefaultProcedureManager.generateCrudMigrate
private static String generateCrudMigrate(Table table, Column partitioncolumn, Constraint pkey) { """ Create a statement like: "MIGRATE FROM <table> where {...}" @param table target table @param partitioncolumn partition column of a partitioned table, or null if table is replicated @param pkey primary key @return statement string """ final StringBuilder sb = new StringBuilder("MIGRATE FROM ").append(table.getTypeName()); generateCrudPKeyWhereClause(partitioncolumn, pkey, sb); return sb.append(';').toString(); }
java
private static String generateCrudMigrate(Table table, Column partitioncolumn, Constraint pkey) { final StringBuilder sb = new StringBuilder("MIGRATE FROM ").append(table.getTypeName()); generateCrudPKeyWhereClause(partitioncolumn, pkey, sb); return sb.append(';').toString(); }
[ "private", "static", "String", "generateCrudMigrate", "(", "Table", "table", ",", "Column", "partitioncolumn", ",", "Constraint", "pkey", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"MIGRATE FROM \"", ")", ".", "append", "(", "table", ".", "getTypeName", "(", ")", ")", ";", "generateCrudPKeyWhereClause", "(", "partitioncolumn", ",", "pkey", ",", "sb", ")", ";", "return", "sb", ".", "append", "(", "'", "'", ")", ".", "toString", "(", ")", ";", "}" ]
Create a statement like: "MIGRATE FROM <table> where {...}" @param table target table @param partitioncolumn partition column of a partitioned table, or null if table is replicated @param pkey primary key @return statement string
[ "Create", "a", "statement", "like", ":", "MIGRATE", "FROM", "<table", ">", "where", "{", "...", "}" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/DefaultProcedureManager.java#L331-L335
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java
ObjectArrayList.replaceFromWith
public void replaceFromWith(int from, java.util.Collection other) { """ Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the elements of the specified collection. Does not alter the size of the receiver. Replaces exactly <tt>Math.max(0,Math.min(size()-from, other.size()))</tt> elements. @param from the index at which to copy the first element from the specified collection. @param other Collection to replace part of the receiver @exception IndexOutOfBoundsException index is out of range (index &lt; 0 || index &gt;= size()). """ checkRange(from,size); java.util.Iterator e = other.iterator(); int index=from; int limit = Math.min(size-from, other.size()); for (int i=0; i<limit; i++) elements[index++] = e.next(); //delta }
java
public void replaceFromWith(int from, java.util.Collection other) { checkRange(from,size); java.util.Iterator e = other.iterator(); int index=from; int limit = Math.min(size-from, other.size()); for (int i=0; i<limit; i++) elements[index++] = e.next(); //delta }
[ "public", "void", "replaceFromWith", "(", "int", "from", ",", "java", ".", "util", ".", "Collection", "other", ")", "{", "checkRange", "(", "from", ",", "size", ")", ";", "java", ".", "util", ".", "Iterator", "e", "=", "other", ".", "iterator", "(", ")", ";", "int", "index", "=", "from", ";", "int", "limit", "=", "Math", ".", "min", "(", "size", "-", "from", ",", "other", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "limit", ";", "i", "++", ")", "elements", "[", "index", "++", "]", "=", ".", "next", "(", ")", ";", "//delta\r", "}" ]
Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the elements of the specified collection. Does not alter the size of the receiver. Replaces exactly <tt>Math.max(0,Math.min(size()-from, other.size()))</tt> elements. @param from the index at which to copy the first element from the specified collection. @param other Collection to replace part of the receiver @exception IndexOutOfBoundsException index is out of range (index &lt; 0 || index &gt;= size()).
[ "Replaces", "the", "part", "of", "the", "receiver", "starting", "at", "<code", ">", "from<", "/", "code", ">", "(", "inclusive", ")", "with", "all", "the", "elements", "of", "the", "specified", "collection", ".", "Does", "not", "alter", "the", "size", "of", "the", "receiver", ".", "Replaces", "exactly", "<tt", ">", "Math", ".", "max", "(", "0", "Math", ".", "min", "(", "size", "()", "-", "from", "other", ".", "size", "()", "))", "<", "/", "tt", ">", "elements", "." ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L780-L787
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java
RoutesInner.beginCreateOrUpdate
public RouteInner beginCreateOrUpdate(String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters) { """ Creates or updates a route in the specified route table. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param routeName The name of the route. @param routeParameters Parameters supplied to the create or update route operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RouteInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, routeName, routeParameters).toBlocking().single().body(); }
java
public RouteInner beginCreateOrUpdate(String resourceGroupName, String routeTableName, String routeName, RouteInner routeParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, routeName, routeParameters).toBlocking().single().body(); }
[ "public", "RouteInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "routeTableName", ",", "String", "routeName", ",", "RouteInner", "routeParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "routeTableName", ",", "routeName", ",", "routeParameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a route in the specified route table. @param resourceGroupName The name of the resource group. @param routeTableName The name of the route table. @param routeName The name of the route. @param routeParameters Parameters supplied to the create or update route operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RouteInner object if successful.
[ "Creates", "or", "updates", "a", "route", "in", "the", "specified", "route", "table", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/RoutesInner.java#L444-L446
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceClassLoader.java
ResourceClassLoader.getCustomResourceClassLoader
public ResourceClassLoader getCustomResourceClassLoader(Resource[] resources) throws IOException { """ /* public synchronized void addResources(Resource[] reses) throws IOException { for(int i=0;i<reses.length;i++){ if(!this.resources.contains(reses[i])){ this.resources.add(reses[i]); addURL(doURL(reses[i])); } } } """ if (ArrayUtil.isEmpty(resources)) return this; String key = hash(resources); ResourceClassLoader rcl = (customCLs == null) ? null : customCLs.get(key); if (rcl != null) return rcl; resources = ResourceUtil.merge(this.getResources(), resources); rcl = new ResourceClassLoader(resources, getParent()); if (customCLs == null) customCLs = new ReferenceMap<String, ResourceClassLoader>(); customCLs.put(key, rcl); return rcl; }
java
public ResourceClassLoader getCustomResourceClassLoader(Resource[] resources) throws IOException { if (ArrayUtil.isEmpty(resources)) return this; String key = hash(resources); ResourceClassLoader rcl = (customCLs == null) ? null : customCLs.get(key); if (rcl != null) return rcl; resources = ResourceUtil.merge(this.getResources(), resources); rcl = new ResourceClassLoader(resources, getParent()); if (customCLs == null) customCLs = new ReferenceMap<String, ResourceClassLoader>(); customCLs.put(key, rcl); return rcl; }
[ "public", "ResourceClassLoader", "getCustomResourceClassLoader", "(", "Resource", "[", "]", "resources", ")", "throws", "IOException", "{", "if", "(", "ArrayUtil", ".", "isEmpty", "(", "resources", ")", ")", "return", "this", ";", "String", "key", "=", "hash", "(", "resources", ")", ";", "ResourceClassLoader", "rcl", "=", "(", "customCLs", "==", "null", ")", "?", "null", ":", "customCLs", ".", "get", "(", "key", ")", ";", "if", "(", "rcl", "!=", "null", ")", "return", "rcl", ";", "resources", "=", "ResourceUtil", ".", "merge", "(", "this", ".", "getResources", "(", ")", ",", "resources", ")", ";", "rcl", "=", "new", "ResourceClassLoader", "(", "resources", ",", "getParent", "(", ")", ")", ";", "if", "(", "customCLs", "==", "null", ")", "customCLs", "=", "new", "ReferenceMap", "<", "String", ",", "ResourceClassLoader", ">", "(", ")", ";", "customCLs", ".", "put", "(", "key", ",", "rcl", ")", ";", "return", "rcl", ";", "}" ]
/* public synchronized void addResources(Resource[] reses) throws IOException { for(int i=0;i<reses.length;i++){ if(!this.resources.contains(reses[i])){ this.resources.add(reses[i]); addURL(doURL(reses[i])); } } }
[ "/", "*", "public", "synchronized", "void", "addResources", "(", "Resource", "[]", "reses", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i<reses", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!this", ".", "resources", ".", "contains", "(", "reses", "[", "i", "]", "))", "{", "this", ".", "resources", ".", "add", "(", "reses", "[", "i", "]", ")", ";", "addURL", "(", "doURL", "(", "reses", "[", "i", "]", "))", ";", "}", "}", "}" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceClassLoader.java#L105-L121
bazaarvoice/jolt
complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java
ChainrFactory.fromFile
public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) { """ Builds a Chainr instance using the spec described in the File that is passed in. @param chainrSpecFile The File which contains the chainr spec. @param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance @return a Chainr instance """ Object chainrSpec; try { FileInputStream fileInputStream = new FileInputStream( chainrSpecFile ); chainrSpec = JsonUtils.jsonToObject( fileInputStream ); } catch ( Exception e ) { throw new RuntimeException( "Unable to load chainr spec file " + chainrSpecFile.getAbsolutePath() ); } return getChainr( chainrInstantiator, chainrSpec ); }
java
public static Chainr fromFile( File chainrSpecFile, ChainrInstantiator chainrInstantiator ) { Object chainrSpec; try { FileInputStream fileInputStream = new FileInputStream( chainrSpecFile ); chainrSpec = JsonUtils.jsonToObject( fileInputStream ); } catch ( Exception e ) { throw new RuntimeException( "Unable to load chainr spec file " + chainrSpecFile.getAbsolutePath() ); } return getChainr( chainrInstantiator, chainrSpec ); }
[ "public", "static", "Chainr", "fromFile", "(", "File", "chainrSpecFile", ",", "ChainrInstantiator", "chainrInstantiator", ")", "{", "Object", "chainrSpec", ";", "try", "{", "FileInputStream", "fileInputStream", "=", "new", "FileInputStream", "(", "chainrSpecFile", ")", ";", "chainrSpec", "=", "JsonUtils", ".", "jsonToObject", "(", "fileInputStream", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to load chainr spec file \"", "+", "chainrSpecFile", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "return", "getChainr", "(", "chainrInstantiator", ",", "chainrSpec", ")", ";", "}" ]
Builds a Chainr instance using the spec described in the File that is passed in. @param chainrSpecFile The File which contains the chainr spec. @param chainrInstantiator the ChainrInstantiator to use to initialze the Chainr instance @return a Chainr instance
[ "Builds", "a", "Chainr", "instance", "using", "the", "spec", "described", "in", "the", "File", "that", "is", "passed", "in", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/complete/src/main/java/com/bazaarvoice/jolt/ChainrFactory.java#L89-L98
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.constructorOfClass
public static Matcher<MethodTree> constructorOfClass(final String className) { """ Matches a constructor declaration in a specific enclosing class. @param className The fully-qualified name of the enclosing class, e.g. "com.google.common.base.Preconditions" """ return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { Symbol symbol = ASTHelpers.getSymbol(methodTree); return symbol.getEnclosingElement().getQualifiedName().contentEquals(className) && symbol.isConstructor(); } }; }
java
public static Matcher<MethodTree> constructorOfClass(final String className) { return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { Symbol symbol = ASTHelpers.getSymbol(methodTree); return symbol.getEnclosingElement().getQualifiedName().contentEquals(className) && symbol.isConstructor(); } }; }
[ "public", "static", "Matcher", "<", "MethodTree", ">", "constructorOfClass", "(", "final", "String", "className", ")", "{", "return", "new", "Matcher", "<", "MethodTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "MethodTree", "methodTree", ",", "VisitorState", "state", ")", "{", "Symbol", "symbol", "=", "ASTHelpers", ".", "getSymbol", "(", "methodTree", ")", ";", "return", "symbol", ".", "getEnclosingElement", "(", ")", ".", "getQualifiedName", "(", ")", ".", "contentEquals", "(", "className", ")", "&&", "symbol", ".", "isConstructor", "(", ")", ";", "}", "}", ";", "}" ]
Matches a constructor declaration in a specific enclosing class. @param className The fully-qualified name of the enclosing class, e.g. "com.google.common.base.Preconditions"
[ "Matches", "a", "constructor", "declaration", "in", "a", "specific", "enclosing", "class", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1032-L1041
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.createSubscription
private PubsubFuture<Subscription> createSubscription(final String canonicalSubscriptionName, final Subscription subscription) { """ Create a Pub/Sub subscription. @param canonicalSubscriptionName The canonical (including project) name of the subscription to create. @param subscription The subscription to create. @return A future that is completed when this request is completed. """ validateCanonicalSubscription(canonicalSubscriptionName); return put("create subscription", canonicalSubscriptionName, SubscriptionCreateRequest.of(subscription), readJson(Subscription.class)); }
java
private PubsubFuture<Subscription> createSubscription(final String canonicalSubscriptionName, final Subscription subscription) { validateCanonicalSubscription(canonicalSubscriptionName); return put("create subscription", canonicalSubscriptionName, SubscriptionCreateRequest.of(subscription), readJson(Subscription.class)); }
[ "private", "PubsubFuture", "<", "Subscription", ">", "createSubscription", "(", "final", "String", "canonicalSubscriptionName", ",", "final", "Subscription", "subscription", ")", "{", "validateCanonicalSubscription", "(", "canonicalSubscriptionName", ")", ";", "return", "put", "(", "\"create subscription\"", ",", "canonicalSubscriptionName", ",", "SubscriptionCreateRequest", ".", "of", "(", "subscription", ")", ",", "readJson", "(", "Subscription", ".", "class", ")", ")", ";", "}" ]
Create a Pub/Sub subscription. @param canonicalSubscriptionName The canonical (including project) name of the subscription to create. @param subscription The subscription to create. @return A future that is completed when this request is completed.
[ "Create", "a", "Pub", "/", "Sub", "subscription", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L417-L422
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.expectBetween
@Deprecated public C expectBetween(int minAllowedStatements, int maxAllowedStatements, Query query) { """ Adds an expectation to the current instance that at least {@code minAllowedStatements} and at most {@code maxAllowedStatements} were called between the creation of the current instance and a call to {@link #verify()} method @since 2.2 """ return expect(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).type(adapter(query))); }
java
@Deprecated public C expectBetween(int minAllowedStatements, int maxAllowedStatements, Query query) { return expect(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).type(adapter(query))); }
[ "@", "Deprecated", "public", "C", "expectBetween", "(", "int", "minAllowedStatements", ",", "int", "maxAllowedStatements", ",", "Query", "query", ")", "{", "return", "expect", "(", "SqlQueries", ".", "queriesBetween", "(", "minAllowedStatements", ",", "maxAllowedStatements", ")", ".", "type", "(", "adapter", "(", "query", ")", ")", ")", ";", "}" ]
Adds an expectation to the current instance that at least {@code minAllowedStatements} and at most {@code maxAllowedStatements} were called between the creation of the current instance and a call to {@link #verify()} method @since 2.2
[ "Adds", "an", "expectation", "to", "the", "current", "instance", "that", "at", "least", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L608-L611
bazaarvoice/jolt
jolt-core/src/main/java/com/bazaarvoice/jolt/traversr/Traversr.java
Traversr.get
public Optional<DataType> get( Object tree, List<String> keys ) { """ Note : Calling this method MAY modify the tree object by adding new Maps and Lists as needed for the traversal. This is determined by the behavior of the implementations of the abstract methods of this class. """ if ( keys.size() != traversalLength ) { throw new TraversrException( "Traversal Path and number of keys mismatch, traversalLength:" + traversalLength + " numKeys:" + keys.size() ); } return root.traverse( tree, TraversalStep.Operation.GET, keys.iterator(), null ); }
java
public Optional<DataType> get( Object tree, List<String> keys ) { if ( keys.size() != traversalLength ) { throw new TraversrException( "Traversal Path and number of keys mismatch, traversalLength:" + traversalLength + " numKeys:" + keys.size() ); } return root.traverse( tree, TraversalStep.Operation.GET, keys.iterator(), null ); }
[ "public", "Optional", "<", "DataType", ">", "get", "(", "Object", "tree", ",", "List", "<", "String", ">", "keys", ")", "{", "if", "(", "keys", ".", "size", "(", ")", "!=", "traversalLength", ")", "{", "throw", "new", "TraversrException", "(", "\"Traversal Path and number of keys mismatch, traversalLength:\"", "+", "traversalLength", "+", "\" numKeys:\"", "+", "keys", ".", "size", "(", ")", ")", ";", "}", "return", "root", ".", "traverse", "(", "tree", ",", "TraversalStep", ".", "Operation", ".", "GET", ",", "keys", ".", "iterator", "(", ")", ",", "null", ")", ";", "}" ]
Note : Calling this method MAY modify the tree object by adding new Maps and Lists as needed for the traversal. This is determined by the behavior of the implementations of the abstract methods of this class.
[ "Note", ":", "Calling", "this", "method", "MAY", "modify", "the", "tree", "object", "by", "adding", "new", "Maps", "and", "Lists", "as", "needed", "for", "the", "traversal", ".", "This", "is", "determined", "by", "the", "behavior", "of", "the", "implementations", "of", "the", "abstract", "methods", "of", "this", "class", "." ]
train
https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/traversr/Traversr.java#L117-L124
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/embeddings/KerasEmbedding.java
KerasEmbedding.setWeights
@Override public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException { """ Set weights for layer. @param weights Embedding layer weights """ this.weights = new HashMap<>(); // TODO: "embeddings" is incorrectly read as "s" for some applications if (weights.containsKey("s")) { INDArray kernel = weights.get("s"); weights.remove("s"); weights.put(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS(), kernel); } if (!weights.containsKey(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS())) throw new InvalidKerasConfigurationException( "Parameter " + conf.getLAYER_FIELD_EMBEDDING_WEIGHTS() + " does not exist in weights"); INDArray kernel = weights.get(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS()); if (this.zeroMasking) { kernel.putRow(0, Nd4j.zeros(kernel.columns())); } this.weights.put(DefaultParamInitializer.WEIGHT_KEY, kernel); if (weights.size() > 2) { Set<String> paramNames = weights.keySet(); paramNames.remove(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS()); String unknownParamNames = paramNames.toString(); log.warn("Attemping to set weights for unknown parameters: " + unknownParamNames.substring(1, unknownParamNames.length() - 1)); } }
java
@Override public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException { this.weights = new HashMap<>(); // TODO: "embeddings" is incorrectly read as "s" for some applications if (weights.containsKey("s")) { INDArray kernel = weights.get("s"); weights.remove("s"); weights.put(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS(), kernel); } if (!weights.containsKey(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS())) throw new InvalidKerasConfigurationException( "Parameter " + conf.getLAYER_FIELD_EMBEDDING_WEIGHTS() + " does not exist in weights"); INDArray kernel = weights.get(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS()); if (this.zeroMasking) { kernel.putRow(0, Nd4j.zeros(kernel.columns())); } this.weights.put(DefaultParamInitializer.WEIGHT_KEY, kernel); if (weights.size() > 2) { Set<String> paramNames = weights.keySet(); paramNames.remove(conf.getLAYER_FIELD_EMBEDDING_WEIGHTS()); String unknownParamNames = paramNames.toString(); log.warn("Attemping to set weights for unknown parameters: " + unknownParamNames.substring(1, unknownParamNames.length() - 1)); } }
[ "@", "Override", "public", "void", "setWeights", "(", "Map", "<", "String", ",", "INDArray", ">", "weights", ")", "throws", "InvalidKerasConfigurationException", "{", "this", ".", "weights", "=", "new", "HashMap", "<>", "(", ")", ";", "// TODO: \"embeddings\" is incorrectly read as \"s\" for some applications", "if", "(", "weights", ".", "containsKey", "(", "\"s\"", ")", ")", "{", "INDArray", "kernel", "=", "weights", ".", "get", "(", "\"s\"", ")", ";", "weights", ".", "remove", "(", "\"s\"", ")", ";", "weights", ".", "put", "(", "conf", ".", "getLAYER_FIELD_EMBEDDING_WEIGHTS", "(", ")", ",", "kernel", ")", ";", "}", "if", "(", "!", "weights", ".", "containsKey", "(", "conf", ".", "getLAYER_FIELD_EMBEDDING_WEIGHTS", "(", ")", ")", ")", "throw", "new", "InvalidKerasConfigurationException", "(", "\"Parameter \"", "+", "conf", ".", "getLAYER_FIELD_EMBEDDING_WEIGHTS", "(", ")", "+", "\" does not exist in weights\"", ")", ";", "INDArray", "kernel", "=", "weights", ".", "get", "(", "conf", ".", "getLAYER_FIELD_EMBEDDING_WEIGHTS", "(", ")", ")", ";", "if", "(", "this", ".", "zeroMasking", ")", "{", "kernel", ".", "putRow", "(", "0", ",", "Nd4j", ".", "zeros", "(", "kernel", ".", "columns", "(", ")", ")", ")", ";", "}", "this", ".", "weights", ".", "put", "(", "DefaultParamInitializer", ".", "WEIGHT_KEY", ",", "kernel", ")", ";", "if", "(", "weights", ".", "size", "(", ")", ">", "2", ")", "{", "Set", "<", "String", ">", "paramNames", "=", "weights", ".", "keySet", "(", ")", ";", "paramNames", ".", "remove", "(", "conf", ".", "getLAYER_FIELD_EMBEDDING_WEIGHTS", "(", ")", ")", ";", "String", "unknownParamNames", "=", "paramNames", ".", "toString", "(", ")", ";", "log", ".", "warn", "(", "\"Attemping to set weights for unknown parameters: \"", "+", "unknownParamNames", ".", "substring", "(", "1", ",", "unknownParamNames", ".", "length", "(", ")", "-", "1", ")", ")", ";", "}", "}" ]
Set weights for layer. @param weights Embedding layer weights
[ "Set", "weights", "for", "layer", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/embeddings/KerasEmbedding.java#L175-L201
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java
AipImageSearch.similarUpdateContSign
public JSONObject similarUpdateContSign(String contSign, HashMap<String, String> options) { """ 相似图检索—更新接口 **更新图库中图片的摘要和分类信息(具体变量为brief、tags)** @param contSign - 图片签名 @param options - 可选参数对象,key: value都为string类型 options - options列表: brief 更新的摘要信息,最长256B。样例:{"name":"周杰伦", "id":"666"} tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 @return JSONObject """ AipRequest request = new AipRequest(); preOperation(request); request.addBody("cont_sign", contSign); if (options != null) { request.addBody(options); } request.setUri(ImageSearchConsts.SIMILAR_UPDATE); postOperation(request); return requestServer(request); }
java
public JSONObject similarUpdateContSign(String contSign, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("cont_sign", contSign); if (options != null) { request.addBody(options); } request.setUri(ImageSearchConsts.SIMILAR_UPDATE); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "similarUpdateContSign", "(", "String", "contSign", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ".", "addBody", "(", "\"cont_sign\"", ",", "contSign", ")", ";", "if", "(", "options", "!=", "null", ")", "{", "request", ".", "addBody", "(", "options", ")", ";", "}", "request", ".", "setUri", "(", "ImageSearchConsts", ".", "SIMILAR_UPDATE", ")", ";", "postOperation", "(", "request", ")", ";", "return", "requestServer", "(", "request", ")", ";", "}" ]
相似图检索—更新接口 **更新图库中图片的摘要和分类信息(具体变量为brief、tags)** @param contSign - 图片签名 @param options - 可选参数对象,key: value都为string类型 options - options列表: brief 更新的摘要信息,最长256B。样例:{"name":"周杰伦", "id":"666"} tags 1 - 65535范围内的整数,tag间以逗号分隔,最多2个tag。样例:"100,11" ;检索时可圈定分类维度进行检索 @return JSONObject
[ "相似图检索—更新接口", "**", "更新图库中图片的摘要和分类信息(具体变量为brief、tags)", "**" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L585-L596
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.getNode
public static int getNode(BayesianReasonerShanksAgent agent, String nodeName) throws ShanksException { """ Return the complete node @param agent @param nodeName @return the ProbabilisticNode object @throws ShanksException """ return ShanksAgentBayesianReasoningCapability.getNode( agent.getBayesianNetwork(), nodeName); }
java
public static int getNode(BayesianReasonerShanksAgent agent, String nodeName) throws ShanksException { return ShanksAgentBayesianReasoningCapability.getNode( agent.getBayesianNetwork(), nodeName); }
[ "public", "static", "int", "getNode", "(", "BayesianReasonerShanksAgent", "agent", ",", "String", "nodeName", ")", "throws", "ShanksException", "{", "return", "ShanksAgentBayesianReasoningCapability", ".", "getNode", "(", "agent", ".", "getBayesianNetwork", "(", ")", ",", "nodeName", ")", ";", "}" ]
Return the complete node @param agent @param nodeName @return the ProbabilisticNode object @throws ShanksException
[ "Return", "the", "complete", "node" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java#L588-L592
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/NetworkParameters.java
NetworkParameters.passesCheckpoint
public boolean passesCheckpoint(int height, Sha256Hash hash) { """ Returns true if the block height is either not a checkpoint, or is a checkpoint and the hash matches. """ Sha256Hash checkpointHash = checkpoints.get(height); return checkpointHash == null || checkpointHash.equals(hash); }
java
public boolean passesCheckpoint(int height, Sha256Hash hash) { Sha256Hash checkpointHash = checkpoints.get(height); return checkpointHash == null || checkpointHash.equals(hash); }
[ "public", "boolean", "passesCheckpoint", "(", "int", "height", ",", "Sha256Hash", "hash", ")", "{", "Sha256Hash", "checkpointHash", "=", "checkpoints", ".", "get", "(", "height", ")", ";", "return", "checkpointHash", "==", "null", "||", "checkpointHash", ".", "equals", "(", "hash", ")", ";", "}" ]
Returns true if the block height is either not a checkpoint, or is a checkpoint and the hash matches.
[ "Returns", "true", "if", "the", "block", "height", "is", "either", "not", "a", "checkpoint", "or", "is", "a", "checkpoint", "and", "the", "hash", "matches", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/NetworkParameters.java#L227-L230
Erudika/para
para-server/src/main/java/com/erudika/para/security/RestAuthFilter.java
RestAuthFilter.doFilter
@Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { """ Authenticates an application or user or guest. @param req a request @param res a response @param chain filter chain @throws IOException ex @throws ServletException ex """ // We must wrap the request in order to read the InputStream twice: // - first read - used to calculate the signature // - second read - used as request payload BufferedRequestWrapper request = new BufferedRequestWrapper((HttpServletRequest) req); HttpServletResponse response = (HttpServletResponse) res; boolean proceed = true; try { // users are allowed to GET '/_me' - used on the client-side for checking authentication String appid = RestUtils.extractAccessKey(request); boolean isApp = !StringUtils.isBlank(appid); boolean isGuest = RestUtils.isAnonymousRequest(request); if (isGuest && RestRequestMatcher.INSTANCE.matches(request)) { proceed = guestAuthRequestHandler(appid, (HttpServletRequest) req, response); } else if (!isApp && RestRequestMatcher.INSTANCE.matches(request)) { proceed = userAuthRequestHandler((HttpServletRequest) req, response); } else if (isApp && RestRequestMatcher.INSTANCE_STRICT.matches(request)) { proceed = appAuthRequestHandler(appid, request, response); } } catch (Exception e) { logger.error("Failed to authorize request.", e); } if (proceed) { chain.doFilter(request, res); } }
java
@Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { // We must wrap the request in order to read the InputStream twice: // - first read - used to calculate the signature // - second read - used as request payload BufferedRequestWrapper request = new BufferedRequestWrapper((HttpServletRequest) req); HttpServletResponse response = (HttpServletResponse) res; boolean proceed = true; try { // users are allowed to GET '/_me' - used on the client-side for checking authentication String appid = RestUtils.extractAccessKey(request); boolean isApp = !StringUtils.isBlank(appid); boolean isGuest = RestUtils.isAnonymousRequest(request); if (isGuest && RestRequestMatcher.INSTANCE.matches(request)) { proceed = guestAuthRequestHandler(appid, (HttpServletRequest) req, response); } else if (!isApp && RestRequestMatcher.INSTANCE.matches(request)) { proceed = userAuthRequestHandler((HttpServletRequest) req, response); } else if (isApp && RestRequestMatcher.INSTANCE_STRICT.matches(request)) { proceed = appAuthRequestHandler(appid, request, response); } } catch (Exception e) { logger.error("Failed to authorize request.", e); } if (proceed) { chain.doFilter(request, res); } }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "req", ",", "ServletResponse", "res", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "// We must wrap the request in order to read the InputStream twice:", "// - first read - used to calculate the signature", "// - second read - used as request payload", "BufferedRequestWrapper", "request", "=", "new", "BufferedRequestWrapper", "(", "(", "HttpServletRequest", ")", "req", ")", ";", "HttpServletResponse", "response", "=", "(", "HttpServletResponse", ")", "res", ";", "boolean", "proceed", "=", "true", ";", "try", "{", "// users are allowed to GET '/_me' - used on the client-side for checking authentication", "String", "appid", "=", "RestUtils", ".", "extractAccessKey", "(", "request", ")", ";", "boolean", "isApp", "=", "!", "StringUtils", ".", "isBlank", "(", "appid", ")", ";", "boolean", "isGuest", "=", "RestUtils", ".", "isAnonymousRequest", "(", "request", ")", ";", "if", "(", "isGuest", "&&", "RestRequestMatcher", ".", "INSTANCE", ".", "matches", "(", "request", ")", ")", "{", "proceed", "=", "guestAuthRequestHandler", "(", "appid", ",", "(", "HttpServletRequest", ")", "req", ",", "response", ")", ";", "}", "else", "if", "(", "!", "isApp", "&&", "RestRequestMatcher", ".", "INSTANCE", ".", "matches", "(", "request", ")", ")", "{", "proceed", "=", "userAuthRequestHandler", "(", "(", "HttpServletRequest", ")", "req", ",", "response", ")", ";", "}", "else", "if", "(", "isApp", "&&", "RestRequestMatcher", ".", "INSTANCE_STRICT", ".", "matches", "(", "request", ")", ")", "{", "proceed", "=", "appAuthRequestHandler", "(", "appid", ",", "request", ",", "response", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"Failed to authorize request.\"", ",", "e", ")", ";", "}", "if", "(", "proceed", ")", "{", "chain", ".", "doFilter", "(", "request", ",", "res", ")", ";", "}", "}" ]
Authenticates an application or user or guest. @param req a request @param res a response @param chain filter chain @throws IOException ex @throws ServletException ex
[ "Authenticates", "an", "application", "or", "user", "or", "guest", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/RestAuthFilter.java#L66-L95
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.createVariable
public Variable createVariable(Object projectIdOrPath, String key, String value, Boolean isProtected, String environmentScope) throws GitLabApiException { """ Create a new project variable. <p>NOTE: Setting the environmentScope is only available on GitLab EE.</p> <pre><code>GitLab Endpoint: POST /projects/:id/variables</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required @param value the value for the variable, required @param isProtected whether the variable is protected, optional @param environmentScope the environment_scope of the variable, optional @return a Variable instance with the newly created variable @throws GitLabApiException if any exception occurs during execution """ GitLabApiForm formData = new GitLabApiForm() .withParam("key", key, true) .withParam("value", value, true) .withParam("protected", isProtected) .withParam("environment_scope", environmentScope); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables"); return (response.readEntity(Variable.class)); }
java
public Variable createVariable(Object projectIdOrPath, String key, String value, Boolean isProtected, String environmentScope) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("key", key, true) .withParam("value", value, true) .withParam("protected", isProtected) .withParam("environment_scope", environmentScope); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "variables"); return (response.readEntity(Variable.class)); }
[ "public", "Variable", "createVariable", "(", "Object", "projectIdOrPath", ",", "String", "key", ",", "String", "value", ",", "Boolean", "isProtected", ",", "String", "environmentScope", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"key\"", ",", "key", ",", "true", ")", ".", "withParam", "(", "\"value\"", ",", "value", ",", "true", ")", ".", "withParam", "(", "\"protected\"", ",", "isProtected", ")", ".", "withParam", "(", "\"environment_scope\"", ",", "environmentScope", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"variables\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Variable", ".", "class", ")", ")", ";", "}" ]
Create a new project variable. <p>NOTE: Setting the environmentScope is only available on GitLab EE.</p> <pre><code>GitLab Endpoint: POST /projects/:id/variables</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param key the key of a variable; must have no more than 255 characters; only A-Z, a-z, 0-9, and _ are allowed, required @param value the value for the variable, required @param isProtected whether the variable is protected, optional @param environmentScope the environment_scope of the variable, optional @return a Variable instance with the newly created variable @throws GitLabApiException if any exception occurs during execution
[ "Create", "a", "new", "project", "variable", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2519-L2528
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRImporter.java
LRImporter.getExtractResourceJSONData
public LRResult getExtractResourceJSONData(String dataServiceName, String viewName, String resource, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException { """ Get a result from an extract discriminator request @param dataServiceName the name of the data service to request through (e.g. resource-by-discriminator) @param viewName the name of the view to request through (e.g. standards-alignment-related) @param resource the resource for the request @param partial true/false if this is a partial start of a resource, rather than a full resource @param from the starting date from which to extract items @param until the ending date from which to extract items @param idsOnly true/false to only extract ids with this request @return result of the request """ String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, resource, partial, resourceParam); JSONObject json = getJSONFromPath(path); return new LRResult(json); }
java
public LRResult getExtractResourceJSONData(String dataServiceName, String viewName, String resource, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException { String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, resource, partial, resourceParam); JSONObject json = getJSONFromPath(path); return new LRResult(json); }
[ "public", "LRResult", "getExtractResourceJSONData", "(", "String", "dataServiceName", ",", "String", "viewName", ",", "String", "resource", ",", "Boolean", "partial", ",", "Date", "from", ",", "Date", "until", ",", "Boolean", "idsOnly", ")", "throws", "LRException", "{", "String", "path", "=", "getExtractRequestPath", "(", "dataServiceName", ",", "viewName", ",", "from", ",", "until", ",", "idsOnly", ",", "resource", ",", "partial", ",", "resourceParam", ")", ";", "JSONObject", "json", "=", "getJSONFromPath", "(", "path", ")", ";", "return", "new", "LRResult", "(", "json", ")", ";", "}" ]
Get a result from an extract discriminator request @param dataServiceName the name of the data service to request through (e.g. resource-by-discriminator) @param viewName the name of the view to request through (e.g. standards-alignment-related) @param resource the resource for the request @param partial true/false if this is a partial start of a resource, rather than a full resource @param from the starting date from which to extract items @param until the ending date from which to extract items @param idsOnly true/false to only extract ids with this request @return result of the request
[ "Get", "a", "result", "from", "an", "extract", "discriminator", "request" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L375-L382
Harium/keel
src/main/java/com/harium/keel/catalano/math/TaylorSeries.java
TaylorSeries.Sin
public static double Sin(double x, int nTerms) { """ compute Sin using Taylor Series. @param x An angle, in radians. @param nTerms Number of terms. @return Result. """ if (nTerms < 2) return x; if (nTerms == 2) { return x - (x * x * x) / 6D; } else { double mult = x * x * x; double fact = 6; double sign = 1; int factS = 5; double result = x - mult / fact; for (int i = 3; i <= nTerms; i++) { mult *= x * x; fact *= factS * (factS - 1); factS += 2; result += sign * (mult / fact); sign *= -1; } return result; } }
java
public static double Sin(double x, int nTerms) { if (nTerms < 2) return x; if (nTerms == 2) { return x - (x * x * x) / 6D; } else { double mult = x * x * x; double fact = 6; double sign = 1; int factS = 5; double result = x - mult / fact; for (int i = 3; i <= nTerms; i++) { mult *= x * x; fact *= factS * (factS - 1); factS += 2; result += sign * (mult / fact); sign *= -1; } return result; } }
[ "public", "static", "double", "Sin", "(", "double", "x", ",", "int", "nTerms", ")", "{", "if", "(", "nTerms", "<", "2", ")", "return", "x", ";", "if", "(", "nTerms", "==", "2", ")", "{", "return", "x", "-", "(", "x", "*", "x", "*", "x", ")", "/", "6D", ";", "}", "else", "{", "double", "mult", "=", "x", "*", "x", "*", "x", ";", "double", "fact", "=", "6", ";", "double", "sign", "=", "1", ";", "int", "factS", "=", "5", ";", "double", "result", "=", "x", "-", "mult", "/", "fact", ";", "for", "(", "int", "i", "=", "3", ";", "i", "<=", "nTerms", ";", "i", "++", ")", "{", "mult", "*=", "x", "*", "x", ";", "fact", "*=", "factS", "*", "(", "factS", "-", "1", ")", ";", "factS", "+=", "2", ";", "result", "+=", "sign", "*", "(", "mult", "/", "fact", ")", ";", "sign", "*=", "-", "1", ";", "}", "return", "result", ";", "}", "}" ]
compute Sin using Taylor Series. @param x An angle, in radians. @param nTerms Number of terms. @return Result.
[ "compute", "Sin", "using", "Taylor", "Series", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/TaylorSeries.java#L47-L68
jenkinsci/mask-passwords-plugin
src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsBuildWrapper.java
MaskPasswordsBuildWrapper.makeBuildVariables
@Override public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) { """ Contributes the passwords defined by the user as variables that can be reused from build steps (and other places). """ // global var/password pairs MaskPasswordsConfig config = MaskPasswordsConfig.getInstance(); List<VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs(); // we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs for(VarPasswordPair globalVarPasswordPair: globalVarPasswordPairs) { variables.put(globalVarPasswordPair.getVar(), globalVarPasswordPair.getPassword()); } // job's var/password pairs if(varPasswordPairs != null) { // cf. comment above for(VarPasswordPair varPasswordPair: varPasswordPairs) { if(StringUtils.isNotBlank(varPasswordPair.getVar())) { variables.put(varPasswordPair.getVar(), varPasswordPair.getPassword()); } } } }
java
@Override public void makeBuildVariables(AbstractBuild build, Map<String, String> variables) { // global var/password pairs MaskPasswordsConfig config = MaskPasswordsConfig.getInstance(); List<VarPasswordPair> globalVarPasswordPairs = config.getGlobalVarPasswordPairs(); // we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs for(VarPasswordPair globalVarPasswordPair: globalVarPasswordPairs) { variables.put(globalVarPasswordPair.getVar(), globalVarPasswordPair.getPassword()); } // job's var/password pairs if(varPasswordPairs != null) { // cf. comment above for(VarPasswordPair varPasswordPair: varPasswordPairs) { if(StringUtils.isNotBlank(varPasswordPair.getVar())) { variables.put(varPasswordPair.getVar(), varPasswordPair.getPassword()); } } } }
[ "@", "Override", "public", "void", "makeBuildVariables", "(", "AbstractBuild", "build", ",", "Map", "<", "String", ",", "String", ">", "variables", ")", "{", "// global var/password pairs\r", "MaskPasswordsConfig", "config", "=", "MaskPasswordsConfig", ".", "getInstance", "(", ")", ";", "List", "<", "VarPasswordPair", ">", "globalVarPasswordPairs", "=", "config", ".", "getGlobalVarPasswordPairs", "(", ")", ";", "// we can't use variables.putAll() since passwords are ciphered when in varPasswordPairs\r", "for", "(", "VarPasswordPair", "globalVarPasswordPair", ":", "globalVarPasswordPairs", ")", "{", "variables", ".", "put", "(", "globalVarPasswordPair", ".", "getVar", "(", ")", ",", "globalVarPasswordPair", ".", "getPassword", "(", ")", ")", ";", "}", "// job's var/password pairs\r", "if", "(", "varPasswordPairs", "!=", "null", ")", "{", "// cf. comment above\r", "for", "(", "VarPasswordPair", "varPasswordPair", ":", "varPasswordPairs", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "varPasswordPair", ".", "getVar", "(", ")", ")", ")", "{", "variables", ".", "put", "(", "varPasswordPair", ".", "getVar", "(", ")", ",", "varPasswordPair", ".", "getPassword", "(", ")", ")", ";", "}", "}", "}", "}" ]
Contributes the passwords defined by the user as variables that can be reused from build steps (and other places).
[ "Contributes", "the", "passwords", "defined", "by", "the", "user", "as", "variables", "that", "can", "be", "reused", "from", "build", "steps", "(", "and", "other", "places", ")", "." ]
train
https://github.com/jenkinsci/mask-passwords-plugin/blob/3440b0aa5d2553889245327a9d37a006b4b17c3f/src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsBuildWrapper.java#L184-L203
spring-projects/spring-mobile
spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/SiteSwitcherHandlerInterceptor.java
SiteSwitcherHandlerInterceptor.dotMobi
public static SiteSwitcherHandlerInterceptor dotMobi(String serverName, Boolean tabletIsMobile) { """ Creates a site switcher that redirects to a <code>.mobi</code> domain for normal site requests that either originate from a mobile device or indicate a mobile site preference. Will strip off the trailing domain name when building the mobile domain e.g. "app.com" will become "app.mobi" (the .com will be stripped). Uses a {@link CookieSitePreferenceRepository} that saves a cookie that is shared between the two domains. """ return new SiteSwitcherHandlerInterceptor(StandardSiteSwitcherHandlerFactory.dotMobi(serverName, tabletIsMobile)); }
java
public static SiteSwitcherHandlerInterceptor dotMobi(String serverName, Boolean tabletIsMobile) { return new SiteSwitcherHandlerInterceptor(StandardSiteSwitcherHandlerFactory.dotMobi(serverName, tabletIsMobile)); }
[ "public", "static", "SiteSwitcherHandlerInterceptor", "dotMobi", "(", "String", "serverName", ",", "Boolean", "tabletIsMobile", ")", "{", "return", "new", "SiteSwitcherHandlerInterceptor", "(", "StandardSiteSwitcherHandlerFactory", ".", "dotMobi", "(", "serverName", ",", "tabletIsMobile", ")", ")", ";", "}" ]
Creates a site switcher that redirects to a <code>.mobi</code> domain for normal site requests that either originate from a mobile device or indicate a mobile site preference. Will strip off the trailing domain name when building the mobile domain e.g. "app.com" will become "app.mobi" (the .com will be stripped). Uses a {@link CookieSitePreferenceRepository} that saves a cookie that is shared between the two domains.
[ "Creates", "a", "site", "switcher", "that", "redirects", "to", "a", "<code", ">", ".", "mobi<", "/", "code", ">", "domain", "for", "normal", "site", "requests", "that", "either", "originate", "from", "a", "mobile", "device", "or", "indicate", "a", "mobile", "site", "preference", ".", "Will", "strip", "off", "the", "trailing", "domain", "name", "when", "building", "the", "mobile", "domain", "e", ".", "g", ".", "app", ".", "com", "will", "become", "app", ".", "mobi", "(", "the", ".", "com", "will", "be", "stripped", ")", ".", "Uses", "a", "{" ]
train
https://github.com/spring-projects/spring-mobile/blob/a402cbcaf208e24288b957f44c9984bd6e8bf064/spring-mobile-device/src/main/java/org/springframework/mobile/device/switcher/SiteSwitcherHandlerInterceptor.java#L152-L154
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/social/SocialTemplate.java
SocialTemplate.parseProfile
protected SocialProfile parseProfile(Map<String, Object> props) { """ Property names for Facebook - Override to customize @param props @return """ if (!props.containsKey("id")) { throw new IllegalArgumentException("No id in profile"); } SocialProfile profile = SocialProfile.with(props) .displayName("name") .first("first_name") .last("last_name") .id("id") .username("username") .profileUrl("link") .build(); profile.setThumbnailUrl(getBaseUrl() + "/" + profile.getId() + "/picture"); return profile; }
java
protected SocialProfile parseProfile(Map<String, Object> props) { if (!props.containsKey("id")) { throw new IllegalArgumentException("No id in profile"); } SocialProfile profile = SocialProfile.with(props) .displayName("name") .first("first_name") .last("last_name") .id("id") .username("username") .profileUrl("link") .build(); profile.setThumbnailUrl(getBaseUrl() + "/" + profile.getId() + "/picture"); return profile; }
[ "protected", "SocialProfile", "parseProfile", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "if", "(", "!", "props", ".", "containsKey", "(", "\"id\"", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"No id in profile\"", ")", ";", "}", "SocialProfile", "profile", "=", "SocialProfile", ".", "with", "(", "props", ")", ".", "displayName", "(", "\"name\"", ")", ".", "first", "(", "\"first_name\"", ")", ".", "last", "(", "\"last_name\"", ")", ".", "id", "(", "\"id\"", ")", ".", "username", "(", "\"username\"", ")", ".", "profileUrl", "(", "\"link\"", ")", ".", "build", "(", ")", ";", "profile", ".", "setThumbnailUrl", "(", "getBaseUrl", "(", ")", "+", "\"/\"", "+", "profile", ".", "getId", "(", ")", "+", "\"/picture\"", ")", ";", "return", "profile", ";", "}" ]
Property names for Facebook - Override to customize @param props @return
[ "Property", "names", "for", "Facebook", "-", "Override", "to", "customize" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/social/SocialTemplate.java#L94-L108
tomgibara/bits
src/main/java/com/tomgibara/bits/Bits.java
Bits.asStore
public static BitStore asStore(byte[] bytes, int offset, int length) { """ Exposes a subrange of the bits of a byte array as a {@link BitStore}. The returned bit store is a live view over the bytes; changes made to the array are reflected in bit store and vice versa. The size of the returned bit vector is the length of the sub range. @param bytes the byte data @param offset the index, in bits of the first bit in the bit store @param length the number of bits spanned by the bit store @return a {@link BitStore} over some range of bytes @see #asStore(byte[]) @see BitVector#fromByteArray(byte[], int) """ if (bytes == null) throw new IllegalArgumentException("null bytes"); int size = bytes.length << 3; if (offset < 0) throw new IllegalArgumentException("negative offset"); if (length < 0) throw new IllegalArgumentException("negative length"); int finish = offset + length; if (finish < 0) throw new IllegalArgumentException("index overflow"); if (finish > size) throw new IllegalArgumentException("exceeds size"); return new BytesBitStore(bytes, offset, finish, true); }
java
public static BitStore asStore(byte[] bytes, int offset, int length) { if (bytes == null) throw new IllegalArgumentException("null bytes"); int size = bytes.length << 3; if (offset < 0) throw new IllegalArgumentException("negative offset"); if (length < 0) throw new IllegalArgumentException("negative length"); int finish = offset + length; if (finish < 0) throw new IllegalArgumentException("index overflow"); if (finish > size) throw new IllegalArgumentException("exceeds size"); return new BytesBitStore(bytes, offset, finish, true); }
[ "public", "static", "BitStore", "asStore", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "bytes", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"null bytes\"", ")", ";", "int", "size", "=", "bytes", ".", "length", "<<", "3", ";", "if", "(", "offset", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"negative offset\"", ")", ";", "if", "(", "length", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"negative length\"", ")", ";", "int", "finish", "=", "offset", "+", "length", ";", "if", "(", "finish", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"index overflow\"", ")", ";", "if", "(", "finish", ">", "size", ")", "throw", "new", "IllegalArgumentException", "(", "\"exceeds size\"", ")", ";", "return", "new", "BytesBitStore", "(", "bytes", ",", "offset", ",", "finish", ",", "true", ")", ";", "}" ]
Exposes a subrange of the bits of a byte array as a {@link BitStore}. The returned bit store is a live view over the bytes; changes made to the array are reflected in bit store and vice versa. The size of the returned bit vector is the length of the sub range. @param bytes the byte data @param offset the index, in bits of the first bit in the bit store @param length the number of bits spanned by the bit store @return a {@link BitStore} over some range of bytes @see #asStore(byte[]) @see BitVector#fromByteArray(byte[], int)
[ "Exposes", "a", "subrange", "of", "the", "bits", "of", "a", "byte", "array", "as", "a", "{", "@link", "BitStore", "}", ".", "The", "returned", "bit", "store", "is", "a", "live", "view", "over", "the", "bytes", ";", "changes", "made", "to", "the", "array", "are", "reflected", "in", "bit", "store", "and", "vice", "versa", ".", "The", "size", "of", "the", "returned", "bit", "vector", "is", "the", "length", "of", "the", "sub", "range", "." ]
train
https://github.com/tomgibara/bits/blob/56c32c0a30efd3d7c4e7c6600a0ca39e51eecc97/src/main/java/com/tomgibara/bits/Bits.java#L535-L544
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java
AbstractCollQuery.leftJoin
public <P> Q leftJoin(Path<? extends Collection<P>> target, Path<P> alias) { """ Define a left join from the Collection typed path to the alias @param <P> type of expression @param target target of the join @param alias alias for the join target @return current object """ getMetadata().addJoin(JoinType.LEFTJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
java
public <P> Q leftJoin(Path<? extends Collection<P>> target, Path<P> alias) { getMetadata().addJoin(JoinType.LEFTJOIN, createAlias(target, alias)); return queryMixin.getSelf(); }
[ "public", "<", "P", ">", "Q", "leftJoin", "(", "Path", "<", "?", "extends", "Collection", "<", "P", ">", ">", "target", ",", "Path", "<", "P", ">", "alias", ")", "{", "getMetadata", "(", ")", ".", "addJoin", "(", "JoinType", ".", "LEFTJOIN", ",", "createAlias", "(", "target", ",", "alias", ")", ")", ";", "return", "queryMixin", ".", "getSelf", "(", ")", ";", "}" ]
Define a left join from the Collection typed path to the alias @param <P> type of expression @param target target of the join @param alias alias for the join target @return current object
[ "Define", "a", "left", "join", "from", "the", "Collection", "typed", "path", "to", "the", "alias" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/AbstractCollQuery.java#L153-L156
line/armeria
core/src/main/java/com/linecorp/armeria/server/PathMappingResultBuilder.java
PathMappingResultBuilder.rawParam
public PathMappingResultBuilder rawParam(String name, String value) { """ Adds an encoded path parameter, which will be decoded in UTF-8 automatically. """ params.put(requireNonNull(name, "name"), ArmeriaHttpUtil.decodePath(requireNonNull(value, "value"))); return this; }
java
public PathMappingResultBuilder rawParam(String name, String value) { params.put(requireNonNull(name, "name"), ArmeriaHttpUtil.decodePath(requireNonNull(value, "value"))); return this; }
[ "public", "PathMappingResultBuilder", "rawParam", "(", "String", "name", ",", "String", "value", ")", "{", "params", ".", "put", "(", "requireNonNull", "(", "name", ",", "\"name\"", ")", ",", "ArmeriaHttpUtil", ".", "decodePath", "(", "requireNonNull", "(", "value", ",", "\"value\"", ")", ")", ")", ";", "return", "this", ";", "}" ]
Adds an encoded path parameter, which will be decoded in UTF-8 automatically.
[ "Adds", "an", "encoded", "path", "parameter", "which", "will", "be", "decoded", "in", "UTF", "-", "8", "automatically", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/PathMappingResultBuilder.java#L77-L80
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getRegexEntityEntityInfoAsync
public Observable<RegexEntityExtractor> getRegexEntityEntityInfoAsync(UUID appId, String versionId, UUID regexEntityId) { """ Gets information of a regex entity model. @param appId The application ID. @param versionId The version ID. @param regexEntityId The regex entity model ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegexEntityExtractor object """ return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).map(new Func1<ServiceResponse<RegexEntityExtractor>, RegexEntityExtractor>() { @Override public RegexEntityExtractor call(ServiceResponse<RegexEntityExtractor> response) { return response.body(); } }); }
java
public Observable<RegexEntityExtractor> getRegexEntityEntityInfoAsync(UUID appId, String versionId, UUID regexEntityId) { return getRegexEntityEntityInfoWithServiceResponseAsync(appId, versionId, regexEntityId).map(new Func1<ServiceResponse<RegexEntityExtractor>, RegexEntityExtractor>() { @Override public RegexEntityExtractor call(ServiceResponse<RegexEntityExtractor> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RegexEntityExtractor", ">", "getRegexEntityEntityInfoAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "regexEntityId", ")", "{", "return", "getRegexEntityEntityInfoWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "regexEntityId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "RegexEntityExtractor", ">", ",", "RegexEntityExtractor", ">", "(", ")", "{", "@", "Override", "public", "RegexEntityExtractor", "call", "(", "ServiceResponse", "<", "RegexEntityExtractor", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets information of a regex entity model. @param appId The application ID. @param versionId The version ID. @param regexEntityId The regex entity model ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RegexEntityExtractor object
[ "Gets", "information", "of", "a", "regex", "entity", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10206-L10213
classgraph/classgraph
src/main/java/io/github/classgraph/TypeArgument.java
TypeArgument.parseList
static List<TypeArgument> parseList(final Parser parser, final String definingClassName) throws ParseException { """ Parse a list of type arguments. @param parser The parser. @param definingClassName The name of the defining class (for resolving type variables). @return The list of type arguments. @throws ParseException If type signature could not be parsed. """ if (parser.peek() == '<') { parser.expect('<'); final List<TypeArgument> typeArguments = new ArrayList<>(2); while (parser.peek() != '>') { if (!parser.hasMore()) { throw new ParseException(parser, "Missing '>'"); } typeArguments.add(parse(parser, definingClassName)); } parser.expect('>'); return typeArguments; } else { return Collections.emptyList(); } }
java
static List<TypeArgument> parseList(final Parser parser, final String definingClassName) throws ParseException { if (parser.peek() == '<') { parser.expect('<'); final List<TypeArgument> typeArguments = new ArrayList<>(2); while (parser.peek() != '>') { if (!parser.hasMore()) { throw new ParseException(parser, "Missing '>'"); } typeArguments.add(parse(parser, definingClassName)); } parser.expect('>'); return typeArguments; } else { return Collections.emptyList(); } }
[ "static", "List", "<", "TypeArgument", ">", "parseList", "(", "final", "Parser", "parser", ",", "final", "String", "definingClassName", ")", "throws", "ParseException", "{", "if", "(", "parser", ".", "peek", "(", ")", "==", "'", "'", ")", "{", "parser", ".", "expect", "(", "'", "'", ")", ";", "final", "List", "<", "TypeArgument", ">", "typeArguments", "=", "new", "ArrayList", "<>", "(", "2", ")", ";", "while", "(", "parser", ".", "peek", "(", ")", "!=", "'", "'", ")", "{", "if", "(", "!", "parser", ".", "hasMore", "(", ")", ")", "{", "throw", "new", "ParseException", "(", "parser", ",", "\"Missing '>'\"", ")", ";", "}", "typeArguments", ".", "add", "(", "parse", "(", "parser", ",", "definingClassName", ")", ")", ";", "}", "parser", ".", "expect", "(", "'", "'", ")", ";", "return", "typeArguments", ";", "}", "else", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "}" ]
Parse a list of type arguments. @param parser The parser. @param definingClassName The name of the defining class (for resolving type variables). @return The list of type arguments. @throws ParseException If type signature could not be parsed.
[ "Parse", "a", "list", "of", "type", "arguments", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/TypeArgument.java#L153-L168
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/message/query/RawQueryRequest.java
RawQueryRequest.jsonQuery
public static RawQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String contextId) { """ Create a {@link RawQueryRequest} containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object: <pre>{"statement":"SELECT * FROM default"}</pre>. @param jsonQuery the N1QL query in json form. @param bucket the bucket on which to perform the query. @param password the password for the target bucket. @param contextId the context id to store and use for tracing purposes. @return a {@link RawQueryRequest} for this full query. """ return new RawQueryRequest(jsonQuery, bucket, bucket, password, null, contextId); }
java
public static RawQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String contextId) { return new RawQueryRequest(jsonQuery, bucket, bucket, password, null, contextId); }
[ "public", "static", "RawQueryRequest", "jsonQuery", "(", "String", "jsonQuery", ",", "String", "bucket", ",", "String", "password", ",", "String", "contextId", ")", "{", "return", "new", "RawQueryRequest", "(", "jsonQuery", ",", "bucket", ",", "bucket", ",", "password", ",", "null", ",", "contextId", ")", ";", "}" ]
Create a {@link RawQueryRequest} containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object: <pre>{"statement":"SELECT * FROM default"}</pre>. @param jsonQuery the N1QL query in json form. @param bucket the bucket on which to perform the query. @param password the password for the target bucket. @param contextId the context id to store and use for tracing purposes. @return a {@link RawQueryRequest} for this full query.
[ "Create", "a", "{", "@link", "RawQueryRequest", "}", "containing", "a", "full", "N1QL", "query", "in", "Json", "form", "(", "including", "additional", "query", "parameters", "like", "named", "arguments", "etc", "...", ")", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/query/RawQueryRequest.java#L55-L57
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemMap.java
ItemMap.put
public final void put(long key, AbstractItemLink link) { """ Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced. @param key key with which the specified value is to be associated. @param link link to be associated with the specified key. """ int i = _indexOfKey(key); synchronized (_getLock(i)) { // NOTE: this pushes the new entry onto the front of the list. Means we // will retrieve in lifo order. This may not be optimal Entry nextEntry = _entry[i]; Entry newEntry = new Entry(key, link, nextEntry); _entry[i] = newEntry; _size++; } }
java
public final void put(long key, AbstractItemLink link) { int i = _indexOfKey(key); synchronized (_getLock(i)) { // NOTE: this pushes the new entry onto the front of the list. Means we // will retrieve in lifo order. This may not be optimal Entry nextEntry = _entry[i]; Entry newEntry = new Entry(key, link, nextEntry); _entry[i] = newEntry; _size++; } }
[ "public", "final", "void", "put", "(", "long", "key", ",", "AbstractItemLink", "link", ")", "{", "int", "i", "=", "_indexOfKey", "(", "key", ")", ";", "synchronized", "(", "_getLock", "(", "i", ")", ")", "{", "// NOTE: this pushes the new entry onto the front of the list. Means we", "// will retrieve in lifo order. This may not be optimal", "Entry", "nextEntry", "=", "_entry", "[", "i", "]", ";", "Entry", "newEntry", "=", "new", "Entry", "(", "key", ",", "link", ",", "nextEntry", ")", ";", "_entry", "[", "i", "]", "=", "newEntry", ";", "_size", "++", ";", "}", "}" ]
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced. @param key key with which the specified value is to be associated. @param link link to be associated with the specified key.
[ "Associates", "the", "specified", "value", "with", "the", "specified", "key", "in", "this", "map", ".", "If", "the", "map", "previously", "contained", "a", "mapping", "for", "this", "key", "the", "old", "value", "is", "replaced", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/impl/ItemMap.java#L182-L193
networknt/light-4j
client/src/main/java/com/networknt/client/Http2Client.java
Http2Client.addAuthToken
public void addAuthToken(ClientRequest request, String token) { """ Add Authorization Code grant token the caller app gets from OAuth2 server. This is the method called from client like web server @param request the http request @param token the bearer token """ if(token != null && !token.startsWith("Bearer ")) { if(token.toUpperCase().startsWith("BEARER ")) { // other cases of Bearer token = "Bearer " + token.substring(7); } else { token = "Bearer " + token; } } request.getRequestHeaders().put(Headers.AUTHORIZATION, token); }
java
public void addAuthToken(ClientRequest request, String token) { if(token != null && !token.startsWith("Bearer ")) { if(token.toUpperCase().startsWith("BEARER ")) { // other cases of Bearer token = "Bearer " + token.substring(7); } else { token = "Bearer " + token; } } request.getRequestHeaders().put(Headers.AUTHORIZATION, token); }
[ "public", "void", "addAuthToken", "(", "ClientRequest", "request", ",", "String", "token", ")", "{", "if", "(", "token", "!=", "null", "&&", "!", "token", ".", "startsWith", "(", "\"Bearer \"", ")", ")", "{", "if", "(", "token", ".", "toUpperCase", "(", ")", ".", "startsWith", "(", "\"BEARER \"", ")", ")", "{", "// other cases of Bearer", "token", "=", "\"Bearer \"", "+", "token", ".", "substring", "(", "7", ")", ";", "}", "else", "{", "token", "=", "\"Bearer \"", "+", "token", ";", "}", "}", "request", ".", "getRequestHeaders", "(", ")", ".", "put", "(", "Headers", ".", "AUTHORIZATION", ",", "token", ")", ";", "}" ]
Add Authorization Code grant token the caller app gets from OAuth2 server. This is the method called from client like web server @param request the http request @param token the bearer token
[ "Add", "Authorization", "Code", "grant", "token", "the", "caller", "app", "gets", "from", "OAuth2", "server", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/Http2Client.java#L273-L283
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java
VisOdomMonoPlaneInfinity.computeAngleOfRotation
private void computeAngleOfRotation(PointTrack t, Vector3D_F64 pointingPlane) { """ Computes the angle of rotation between two pointing vectors on the ground plane and adds it to a list. @param pointingPlane Pointing vector of observation in plane reference frame """ VoTrack p = t.getCookie(); // Compute ground pointing vector groundCurr.x = pointingPlane.z; groundCurr.y = -pointingPlane.x; double norm = groundCurr.norm(); groundCurr.x /= norm; groundCurr.y /= norm; // dot product. vectors are normalized to 1 already double dot = groundCurr.x * p.ground.x + groundCurr.y * p.ground.y; // floating point round off error some times knocks it above 1.0 if (dot > 1.0) dot = 1.0; double angle = Math.acos(dot); // cross product to figure out direction if (groundCurr.x * p.ground.y - groundCurr.y * p.ground.x > 0) angle = -angle; farAngles.add(angle); }
java
private void computeAngleOfRotation(PointTrack t, Vector3D_F64 pointingPlane) { VoTrack p = t.getCookie(); // Compute ground pointing vector groundCurr.x = pointingPlane.z; groundCurr.y = -pointingPlane.x; double norm = groundCurr.norm(); groundCurr.x /= norm; groundCurr.y /= norm; // dot product. vectors are normalized to 1 already double dot = groundCurr.x * p.ground.x + groundCurr.y * p.ground.y; // floating point round off error some times knocks it above 1.0 if (dot > 1.0) dot = 1.0; double angle = Math.acos(dot); // cross product to figure out direction if (groundCurr.x * p.ground.y - groundCurr.y * p.ground.x > 0) angle = -angle; farAngles.add(angle); }
[ "private", "void", "computeAngleOfRotation", "(", "PointTrack", "t", ",", "Vector3D_F64", "pointingPlane", ")", "{", "VoTrack", "p", "=", "t", ".", "getCookie", "(", ")", ";", "// Compute ground pointing vector", "groundCurr", ".", "x", "=", "pointingPlane", ".", "z", ";", "groundCurr", ".", "y", "=", "-", "pointingPlane", ".", "x", ";", "double", "norm", "=", "groundCurr", ".", "norm", "(", ")", ";", "groundCurr", ".", "x", "/=", "norm", ";", "groundCurr", ".", "y", "/=", "norm", ";", "// dot product. vectors are normalized to 1 already", "double", "dot", "=", "groundCurr", ".", "x", "*", "p", ".", "ground", ".", "x", "+", "groundCurr", ".", "y", "*", "p", ".", "ground", ".", "y", ";", "// floating point round off error some times knocks it above 1.0", "if", "(", "dot", ">", "1.0", ")", "dot", "=", "1.0", ";", "double", "angle", "=", "Math", ".", "acos", "(", "dot", ")", ";", "// cross product to figure out direction", "if", "(", "groundCurr", ".", "x", "*", "p", ".", "ground", ".", "y", "-", "groundCurr", ".", "y", "*", "p", ".", "ground", ".", "x", ">", "0", ")", "angle", "=", "-", "angle", ";", "farAngles", ".", "add", "(", "angle", ")", ";", "}" ]
Computes the angle of rotation between two pointing vectors on the ground plane and adds it to a list. @param pointingPlane Pointing vector of observation in plane reference frame
[ "Computes", "the", "angle", "of", "rotation", "between", "two", "pointing", "vectors", "on", "the", "ground", "plane", "and", "adds", "it", "to", "a", "list", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomMonoPlaneInfinity.java#L418-L440
algermissen/hawkj
src/main/java/net/jalg/hawkj/util/StringUtils.java
StringUtils.newString
private static String newString(byte[] bytes, Charset charset) { """ Constructs a new <code>String</code> by decoding the specified array of bytes using the given charset. @param bytes The bytes to be decoded into characters @param charset The {@link Charset} to encode the {@code String} @return A new <code>String</code> decoded from the specified array of bytes using the given charset, or {@code null} if the input byte array was {@code null}. @throws NullPointerException Thrown if {@link Charsets#UTF_8} is not initialized, which should never happen since it is required by the Java platform specification. """ return bytes == null ? null : new String(bytes, charset); }
java
private static String newString(byte[] bytes, Charset charset) { return bytes == null ? null : new String(bytes, charset); }
[ "private", "static", "String", "newString", "(", "byte", "[", "]", "bytes", ",", "Charset", "charset", ")", "{", "return", "bytes", "==", "null", "?", "null", ":", "new", "String", "(", "bytes", ",", "charset", ")", ";", "}" ]
Constructs a new <code>String</code> by decoding the specified array of bytes using the given charset. @param bytes The bytes to be decoded into characters @param charset The {@link Charset} to encode the {@code String} @return A new <code>String</code> decoded from the specified array of bytes using the given charset, or {@code null} if the input byte array was {@code null}. @throws NullPointerException Thrown if {@link Charsets#UTF_8} is not initialized, which should never happen since it is required by the Java platform specification.
[ "Constructs", "a", "new", "<code", ">", "String<", "/", "code", ">", "by", "decoding", "the", "specified", "array", "of", "bytes", "using", "the", "given", "charset", "." ]
train
https://github.com/algermissen/hawkj/blob/f798a20f058474bcfe761f7c5c02afee17326c71/src/main/java/net/jalg/hawkj/util/StringUtils.java#L121-L123
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java
SQLExpressions.groupConcat
public static StringExpression groupConcat(Expression<String> expr, String separator) { """ Get a group_concat(expr, separator) expression @param expr expression to be aggregated @param separator separator string @return group_concat(expr, separator) """ return Expressions.stringOperation(SQLOps.GROUP_CONCAT2, expr, Expressions.constant(separator)); }
java
public static StringExpression groupConcat(Expression<String> expr, String separator) { return Expressions.stringOperation(SQLOps.GROUP_CONCAT2, expr, Expressions.constant(separator)); }
[ "public", "static", "StringExpression", "groupConcat", "(", "Expression", "<", "String", ">", "expr", ",", "String", "separator", ")", "{", "return", "Expressions", ".", "stringOperation", "(", "SQLOps", ".", "GROUP_CONCAT2", ",", "expr", ",", "Expressions", ".", "constant", "(", "separator", ")", ")", ";", "}" ]
Get a group_concat(expr, separator) expression @param expr expression to be aggregated @param separator separator string @return group_concat(expr, separator)
[ "Get", "a", "group_concat", "(", "expr", "separator", ")", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/SQLExpressions.java#L1244-L1246
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyRegistry.java
ProxyRegistry.getOrCreateProxyFuture
public DistributedObjectFuture getOrCreateProxyFuture(String name, boolean publishEvent, boolean initialize) { """ Retrieves a DistributedObjectFuture or creates it if it is not available. If {@code initialize} is false and DistributedObject implements {@link InitializingObject}, {@link InitializingObject#initialize()} will be called before {@link DistributedObjectFuture#get()} returns. @param name The name of the DistributedObject proxy object to retrieve or create. @param publishEvent true if a DistributedObjectEvent should be fired. @param initialize true if the DistributedObject proxy object should be initialized. """ DistributedObjectFuture proxyFuture = proxies.get(name); if (proxyFuture == null) { if (!proxyService.nodeEngine.isRunning()) { throw new HazelcastInstanceNotActiveException(); } proxyFuture = createProxy(name, publishEvent, initialize); if (proxyFuture == null) { return getOrCreateProxyFuture(name, publishEvent, initialize); } } return proxyFuture; }
java
public DistributedObjectFuture getOrCreateProxyFuture(String name, boolean publishEvent, boolean initialize) { DistributedObjectFuture proxyFuture = proxies.get(name); if (proxyFuture == null) { if (!proxyService.nodeEngine.isRunning()) { throw new HazelcastInstanceNotActiveException(); } proxyFuture = createProxy(name, publishEvent, initialize); if (proxyFuture == null) { return getOrCreateProxyFuture(name, publishEvent, initialize); } } return proxyFuture; }
[ "public", "DistributedObjectFuture", "getOrCreateProxyFuture", "(", "String", "name", ",", "boolean", "publishEvent", ",", "boolean", "initialize", ")", "{", "DistributedObjectFuture", "proxyFuture", "=", "proxies", ".", "get", "(", "name", ")", ";", "if", "(", "proxyFuture", "==", "null", ")", "{", "if", "(", "!", "proxyService", ".", "nodeEngine", ".", "isRunning", "(", ")", ")", "{", "throw", "new", "HazelcastInstanceNotActiveException", "(", ")", ";", "}", "proxyFuture", "=", "createProxy", "(", "name", ",", "publishEvent", ",", "initialize", ")", ";", "if", "(", "proxyFuture", "==", "null", ")", "{", "return", "getOrCreateProxyFuture", "(", "name", ",", "publishEvent", ",", "initialize", ")", ";", "}", "}", "return", "proxyFuture", ";", "}" ]
Retrieves a DistributedObjectFuture or creates it if it is not available. If {@code initialize} is false and DistributedObject implements {@link InitializingObject}, {@link InitializingObject#initialize()} will be called before {@link DistributedObjectFuture#get()} returns. @param name The name of the DistributedObject proxy object to retrieve or create. @param publishEvent true if a DistributedObjectEvent should be fired. @param initialize true if the DistributedObject proxy object should be initialized.
[ "Retrieves", "a", "DistributedObjectFuture", "or", "creates", "it", "if", "it", "is", "not", "available", ".", "If", "{", "@code", "initialize", "}", "is", "false", "and", "DistributedObject", "implements", "{", "@link", "InitializingObject", "}", "{", "@link", "InitializingObject#initialize", "()", "}", "will", "be", "called", "before", "{", "@link", "DistributedObjectFuture#get", "()", "}", "returns", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/proxyservice/impl/ProxyRegistry.java#L173-L185
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java
ExecutorServiceMetrics.monitor
public static Executor monitor(MeterRegistry registry, Executor executor, String executorName, Tag... tags) { """ Record metrics on the use of an {@link Executor}. @param registry The registry to bind metrics to. @param executor The executor to instrument. @param executorName Will be used to tag metrics with "name". @param tags Tags to apply to all recorded metrics. @return The instrumented executor, proxied. """ return monitor(registry, executor, executorName, asList(tags)); }
java
public static Executor monitor(MeterRegistry registry, Executor executor, String executorName, Tag... tags) { return monitor(registry, executor, executorName, asList(tags)); }
[ "public", "static", "Executor", "monitor", "(", "MeterRegistry", "registry", ",", "Executor", "executor", ",", "String", "executorName", ",", "Tag", "...", "tags", ")", "{", "return", "monitor", "(", "registry", ",", "executor", ",", "executorName", ",", "asList", "(", "tags", ")", ")", ";", "}" ]
Record metrics on the use of an {@link Executor}. @param registry The registry to bind metrics to. @param executor The executor to instrument. @param executorName Will be used to tag metrics with "name". @param tags Tags to apply to all recorded metrics. @return The instrumented executor, proxied.
[ "Record", "metrics", "on", "the", "use", "of", "an", "{", "@link", "Executor", "}", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java#L78-L80
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java
PermissionUtil.getExplicitPermission
public static long getExplicitPermission(Channel channel, Role role) { """ Retrieves the explicit permissions of the specified {@link net.dv8tion.jda.core.entities.Role Role} in its hosting {@link net.dv8tion.jda.core.entities.Guild Guild} and specific {@link net.dv8tion.jda.core.entities.Channel Channel}. <br><b>Allowed permissions override denied permissions of {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides}!</b> <p>All permissions returned are explicitly granted to this Role. <br>Permissions like {@link net.dv8tion.jda.core.Permission#ADMINISTRATOR Permission.ADMINISTRATOR} do not grant other permissions in this value. <p>This factor in existing {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} if possible. @param channel The target channel of which to check {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} @param role The non-null {@link net.dv8tion.jda.core.entities.Role Role} for which to get implicit permissions @throws IllegalArgumentException If any of the arguments is {@code null} or the specified entities are not from the same {@link net.dv8tion.jda.core.entities.Guild Guild} @return Primitive (unsigned) long value with the implicit permissions of the specified role in the specified channel @since 3.1 """ Checks.notNull(channel, "Channel"); Checks.notNull(role, "Role"); final Guild guild = role.getGuild(); checkGuild(channel.getGuild(), guild, "Role"); long permission = role.getPermissionsRaw() | guild.getPublicRole().getPermissionsRaw(); PermissionOverride override = channel.getPermissionOverride(guild.getPublicRole()); if (override != null) permission = apply(permission, override.getAllowedRaw(), override.getDeniedRaw()); if (role.isPublicRole()) return permission; override = channel.getPermissionOverride(role); return override == null ? permission : apply(permission, override.getAllowedRaw(), override.getDeniedRaw()); }
java
public static long getExplicitPermission(Channel channel, Role role) { Checks.notNull(channel, "Channel"); Checks.notNull(role, "Role"); final Guild guild = role.getGuild(); checkGuild(channel.getGuild(), guild, "Role"); long permission = role.getPermissionsRaw() | guild.getPublicRole().getPermissionsRaw(); PermissionOverride override = channel.getPermissionOverride(guild.getPublicRole()); if (override != null) permission = apply(permission, override.getAllowedRaw(), override.getDeniedRaw()); if (role.isPublicRole()) return permission; override = channel.getPermissionOverride(role); return override == null ? permission : apply(permission, override.getAllowedRaw(), override.getDeniedRaw()); }
[ "public", "static", "long", "getExplicitPermission", "(", "Channel", "channel", ",", "Role", "role", ")", "{", "Checks", ".", "notNull", "(", "channel", ",", "\"Channel\"", ")", ";", "Checks", ".", "notNull", "(", "role", ",", "\"Role\"", ")", ";", "final", "Guild", "guild", "=", "role", ".", "getGuild", "(", ")", ";", "checkGuild", "(", "channel", ".", "getGuild", "(", ")", ",", "guild", ",", "\"Role\"", ")", ";", "long", "permission", "=", "role", ".", "getPermissionsRaw", "(", ")", "|", "guild", ".", "getPublicRole", "(", ")", ".", "getPermissionsRaw", "(", ")", ";", "PermissionOverride", "override", "=", "channel", ".", "getPermissionOverride", "(", "guild", ".", "getPublicRole", "(", ")", ")", ";", "if", "(", "override", "!=", "null", ")", "permission", "=", "apply", "(", "permission", ",", "override", ".", "getAllowedRaw", "(", ")", ",", "override", ".", "getDeniedRaw", "(", ")", ")", ";", "if", "(", "role", ".", "isPublicRole", "(", ")", ")", "return", "permission", ";", "override", "=", "channel", ".", "getPermissionOverride", "(", "role", ")", ";", "return", "override", "==", "null", "?", "permission", ":", "apply", "(", "permission", ",", "override", ".", "getAllowedRaw", "(", ")", ",", "override", ".", "getDeniedRaw", "(", ")", ")", ";", "}" ]
Retrieves the explicit permissions of the specified {@link net.dv8tion.jda.core.entities.Role Role} in its hosting {@link net.dv8tion.jda.core.entities.Guild Guild} and specific {@link net.dv8tion.jda.core.entities.Channel Channel}. <br><b>Allowed permissions override denied permissions of {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides}!</b> <p>All permissions returned are explicitly granted to this Role. <br>Permissions like {@link net.dv8tion.jda.core.Permission#ADMINISTRATOR Permission.ADMINISTRATOR} do not grant other permissions in this value. <p>This factor in existing {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} if possible. @param channel The target channel of which to check {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} @param role The non-null {@link net.dv8tion.jda.core.entities.Role Role} for which to get implicit permissions @throws IllegalArgumentException If any of the arguments is {@code null} or the specified entities are not from the same {@link net.dv8tion.jda.core.entities.Guild Guild} @return Primitive (unsigned) long value with the implicit permissions of the specified role in the specified channel @since 3.1
[ "Retrieves", "the", "explicit", "permissions", "of", "the", "specified", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Role", "Role", "}", "in", "its", "hosting", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Guild", "Guild", "}", "and", "specific", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Channel", "Channel", "}", ".", "<br", ">", "<b", ">", "Allowed", "permissions", "override", "denied", "permissions", "of", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "PermissionOverride", "PermissionOverrides", "}", "!<", "/", "b", ">" ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L552-L572
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/preference/DiSHPreferenceVectorIndex.java
DiSHPreferenceVectorIndex.maxIntersection
private int maxIntersection(Map<Integer, ModifiableDBIDs> candidates, ModifiableDBIDs set) { """ Returns the index of the set having the maximum intersection set with the specified set contained in the specified map. @param candidates the map containing the sets @param set the set to intersect with and output the result to @return the set with the maximum size """ int maxDim = -1; ModifiableDBIDs maxIntersection = null; for(Integer nextDim : candidates.keySet()) { DBIDs nextSet = candidates.get(nextDim); ModifiableDBIDs nextIntersection = DBIDUtil.intersection(set, nextSet); if(maxDim < 0 || maxIntersection.size() < nextIntersection.size()) { maxIntersection = nextIntersection; maxDim = nextDim; } } if(maxDim >= 0) { set.clear(); set.addDBIDs(maxIntersection); } return maxDim; }
java
private int maxIntersection(Map<Integer, ModifiableDBIDs> candidates, ModifiableDBIDs set) { int maxDim = -1; ModifiableDBIDs maxIntersection = null; for(Integer nextDim : candidates.keySet()) { DBIDs nextSet = candidates.get(nextDim); ModifiableDBIDs nextIntersection = DBIDUtil.intersection(set, nextSet); if(maxDim < 0 || maxIntersection.size() < nextIntersection.size()) { maxIntersection = nextIntersection; maxDim = nextDim; } } if(maxDim >= 0) { set.clear(); set.addDBIDs(maxIntersection); } return maxDim; }
[ "private", "int", "maxIntersection", "(", "Map", "<", "Integer", ",", "ModifiableDBIDs", ">", "candidates", ",", "ModifiableDBIDs", "set", ")", "{", "int", "maxDim", "=", "-", "1", ";", "ModifiableDBIDs", "maxIntersection", "=", "null", ";", "for", "(", "Integer", "nextDim", ":", "candidates", ".", "keySet", "(", ")", ")", "{", "DBIDs", "nextSet", "=", "candidates", ".", "get", "(", "nextDim", ")", ";", "ModifiableDBIDs", "nextIntersection", "=", "DBIDUtil", ".", "intersection", "(", "set", ",", "nextSet", ")", ";", "if", "(", "maxDim", "<", "0", "||", "maxIntersection", ".", "size", "(", ")", "<", "nextIntersection", ".", "size", "(", ")", ")", "{", "maxIntersection", "=", "nextIntersection", ";", "maxDim", "=", "nextDim", ";", "}", "}", "if", "(", "maxDim", ">=", "0", ")", "{", "set", ".", "clear", "(", ")", ";", "set", ".", "addDBIDs", "(", "maxIntersection", ")", ";", "}", "return", "maxDim", ";", "}" ]
Returns the index of the set having the maximum intersection set with the specified set contained in the specified map. @param candidates the map containing the sets @param set the set to intersect with and output the result to @return the set with the maximum size
[ "Returns", "the", "index", "of", "the", "set", "having", "the", "maximum", "intersection", "set", "with", "the", "specified", "set", "contained", "in", "the", "specified", "map", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/index/preprocessed/preference/DiSHPreferenceVectorIndex.java#L334-L350
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryTypeClass.java
RepositoryTypeClass.newInstance
public static RepositoryTypeClass newInstance(RepositoryType repositoryType, EnvironmentType envType, String className) { """ <p>newInstance.</p> @param repositoryType a {@link com.greenpepper.server.domain.RepositoryType} object. @param envType a {@link com.greenpepper.server.domain.EnvironmentType} object. @param className a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.RepositoryTypeClass} object. """ RepositoryTypeClass repoTypeClass = new RepositoryTypeClass(); repoTypeClass.setRepositoryType(repositoryType); repoTypeClass.setEnvType(envType); repoTypeClass.setClassName(className); return repoTypeClass; }
java
public static RepositoryTypeClass newInstance(RepositoryType repositoryType, EnvironmentType envType, String className) { RepositoryTypeClass repoTypeClass = new RepositoryTypeClass(); repoTypeClass.setRepositoryType(repositoryType); repoTypeClass.setEnvType(envType); repoTypeClass.setClassName(className); return repoTypeClass; }
[ "public", "static", "RepositoryTypeClass", "newInstance", "(", "RepositoryType", "repositoryType", ",", "EnvironmentType", "envType", ",", "String", "className", ")", "{", "RepositoryTypeClass", "repoTypeClass", "=", "new", "RepositoryTypeClass", "(", ")", ";", "repoTypeClass", ".", "setRepositoryType", "(", "repositoryType", ")", ";", "repoTypeClass", ".", "setEnvType", "(", "envType", ")", ";", "repoTypeClass", ".", "setClassName", "(", "className", ")", ";", "return", "repoTypeClass", ";", "}" ]
<p>newInstance.</p> @param repositoryType a {@link com.greenpepper.server.domain.RepositoryType} object. @param envType a {@link com.greenpepper.server.domain.EnvironmentType} object. @param className a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.RepositoryTypeClass} object.
[ "<p", ">", "newInstance", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryTypeClass.java#L37-L45
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java
ZonedDateTime.ofLocal
public static ZonedDateTime ofLocal(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset) { """ Obtains an instance of {@code ZonedDateTime} from a local date-time using the preferred offset if possible. <p> The local date-time is resolved to a single instant on the time-line. This is achieved by finding a valid offset from UTC/Greenwich for the local date-time as defined by the {@link ZoneRules rules} of the zone ID. <p> In most cases, there is only one valid offset for a local date-time. In the case of an overlap, where clocks are set back, there are two valid offsets. If the preferred offset is one of the valid offsets then it is used. Otherwise the earlier valid offset is used, typically corresponding to "summer". <p> In the case of a gap, where clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap. For a typical one hour daylight savings change, the local date-time will be moved one hour later into the offset typically corresponding to "summer". @param localDateTime the local date-time, not null @param zone the time-zone, not null @param preferredOffset the zone offset, null if no preference @return the zoned date-time, not null """ Objects.requireNonNull(localDateTime, "localDateTime"); Objects.requireNonNull(zone, "zone"); if (zone instanceof ZoneOffset) { return new ZonedDateTime(localDateTime, (ZoneOffset) zone, zone); } ZoneRules rules = zone.getRules(); List<ZoneOffset> validOffsets = rules.getValidOffsets(localDateTime); ZoneOffset offset; if (validOffsets.size() == 1) { offset = validOffsets.get(0); } else if (validOffsets.size() == 0) { ZoneOffsetTransition trans = rules.getTransition(localDateTime); localDateTime = localDateTime.plusSeconds(trans.getDuration().getSeconds()); offset = trans.getOffsetAfter(); } else { if (preferredOffset != null && validOffsets.contains(preferredOffset)) { offset = preferredOffset; } else { offset = Objects.requireNonNull(validOffsets.get(0), "offset"); // protect against bad ZoneRules } } return new ZonedDateTime(localDateTime, offset, zone); }
java
public static ZonedDateTime ofLocal(LocalDateTime localDateTime, ZoneId zone, ZoneOffset preferredOffset) { Objects.requireNonNull(localDateTime, "localDateTime"); Objects.requireNonNull(zone, "zone"); if (zone instanceof ZoneOffset) { return new ZonedDateTime(localDateTime, (ZoneOffset) zone, zone); } ZoneRules rules = zone.getRules(); List<ZoneOffset> validOffsets = rules.getValidOffsets(localDateTime); ZoneOffset offset; if (validOffsets.size() == 1) { offset = validOffsets.get(0); } else if (validOffsets.size() == 0) { ZoneOffsetTransition trans = rules.getTransition(localDateTime); localDateTime = localDateTime.plusSeconds(trans.getDuration().getSeconds()); offset = trans.getOffsetAfter(); } else { if (preferredOffset != null && validOffsets.contains(preferredOffset)) { offset = preferredOffset; } else { offset = Objects.requireNonNull(validOffsets.get(0), "offset"); // protect against bad ZoneRules } } return new ZonedDateTime(localDateTime, offset, zone); }
[ "public", "static", "ZonedDateTime", "ofLocal", "(", "LocalDateTime", "localDateTime", ",", "ZoneId", "zone", ",", "ZoneOffset", "preferredOffset", ")", "{", "Objects", ".", "requireNonNull", "(", "localDateTime", ",", "\"localDateTime\"", ")", ";", "Objects", ".", "requireNonNull", "(", "zone", ",", "\"zone\"", ")", ";", "if", "(", "zone", "instanceof", "ZoneOffset", ")", "{", "return", "new", "ZonedDateTime", "(", "localDateTime", ",", "(", "ZoneOffset", ")", "zone", ",", "zone", ")", ";", "}", "ZoneRules", "rules", "=", "zone", ".", "getRules", "(", ")", ";", "List", "<", "ZoneOffset", ">", "validOffsets", "=", "rules", ".", "getValidOffsets", "(", "localDateTime", ")", ";", "ZoneOffset", "offset", ";", "if", "(", "validOffsets", ".", "size", "(", ")", "==", "1", ")", "{", "offset", "=", "validOffsets", ".", "get", "(", "0", ")", ";", "}", "else", "if", "(", "validOffsets", ".", "size", "(", ")", "==", "0", ")", "{", "ZoneOffsetTransition", "trans", "=", "rules", ".", "getTransition", "(", "localDateTime", ")", ";", "localDateTime", "=", "localDateTime", ".", "plusSeconds", "(", "trans", ".", "getDuration", "(", ")", ".", "getSeconds", "(", ")", ")", ";", "offset", "=", "trans", ".", "getOffsetAfter", "(", ")", ";", "}", "else", "{", "if", "(", "preferredOffset", "!=", "null", "&&", "validOffsets", ".", "contains", "(", "preferredOffset", ")", ")", "{", "offset", "=", "preferredOffset", ";", "}", "else", "{", "offset", "=", "Objects", ".", "requireNonNull", "(", "validOffsets", ".", "get", "(", "0", ")", ",", "\"offset\"", ")", ";", "// protect against bad ZoneRules", "}", "}", "return", "new", "ZonedDateTime", "(", "localDateTime", ",", "offset", ",", "zone", ")", ";", "}" ]
Obtains an instance of {@code ZonedDateTime} from a local date-time using the preferred offset if possible. <p> The local date-time is resolved to a single instant on the time-line. This is achieved by finding a valid offset from UTC/Greenwich for the local date-time as defined by the {@link ZoneRules rules} of the zone ID. <p> In most cases, there is only one valid offset for a local date-time. In the case of an overlap, where clocks are set back, there are two valid offsets. If the preferred offset is one of the valid offsets then it is used. Otherwise the earlier valid offset is used, typically corresponding to "summer". <p> In the case of a gap, where clocks jump forward, there is no valid offset. Instead, the local date-time is adjusted to be later by the length of the gap. For a typical one hour daylight savings change, the local date-time will be moved one hour later into the offset typically corresponding to "summer". @param localDateTime the local date-time, not null @param zone the time-zone, not null @param preferredOffset the zone offset, null if no preference @return the zoned date-time, not null
[ "Obtains", "an", "instance", "of", "{", "@code", "ZonedDateTime", "}", "from", "a", "local", "date", "-", "time", "using", "the", "preferred", "offset", "if", "possible", ".", "<p", ">", "The", "local", "date", "-", "time", "is", "resolved", "to", "a", "single", "instant", "on", "the", "time", "-", "line", ".", "This", "is", "achieved", "by", "finding", "a", "valid", "offset", "from", "UTC", "/", "Greenwich", "for", "the", "local", "date", "-", "time", "as", "defined", "by", "the", "{", "@link", "ZoneRules", "rules", "}", "of", "the", "zone", "ID", ".", "<p", ">", "In", "most", "cases", "there", "is", "only", "one", "valid", "offset", "for", "a", "local", "date", "-", "time", ".", "In", "the", "case", "of", "an", "overlap", "where", "clocks", "are", "set", "back", "there", "are", "two", "valid", "offsets", ".", "If", "the", "preferred", "offset", "is", "one", "of", "the", "valid", "offsets", "then", "it", "is", "used", ".", "Otherwise", "the", "earlier", "valid", "offset", "is", "used", "typically", "corresponding", "to", "summer", ".", "<p", ">", "In", "the", "case", "of", "a", "gap", "where", "clocks", "jump", "forward", "there", "is", "no", "valid", "offset", ".", "Instead", "the", "local", "date", "-", "time", "is", "adjusted", "to", "be", "later", "by", "the", "length", "of", "the", "gap", ".", "For", "a", "typical", "one", "hour", "daylight", "savings", "change", "the", "local", "date", "-", "time", "will", "be", "moved", "one", "hour", "later", "into", "the", "offset", "typically", "corresponding", "to", "summer", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZonedDateTime.java#L360-L383
kevinherron/opc-ua-stack
stack-core/src/main/java/com/digitalpetri/opcua/stack/core/types/builtin/DataValue.java
DataValue.derivedNonValue
public static DataValue derivedNonValue(DataValue from, TimestampsToReturn timestamps) { """ Derive a new {@link DataValue} from a given {@link DataValue}. <p> The value is assumed to be for a non-value Node attribute, and therefore the source timestamp is not returned. @param from the {@link DataValue} to derive from. @param timestamps the timestamps to return in the derived value. @return a derived {@link DataValue}. """ boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both; return new DataValue( from.value, from.status, null, includeServer ? from.serverTime : null ); }
java
public static DataValue derivedNonValue(DataValue from, TimestampsToReturn timestamps) { boolean includeServer = timestamps == TimestampsToReturn.Server || timestamps == TimestampsToReturn.Both; return new DataValue( from.value, from.status, null, includeServer ? from.serverTime : null ); }
[ "public", "static", "DataValue", "derivedNonValue", "(", "DataValue", "from", ",", "TimestampsToReturn", "timestamps", ")", "{", "boolean", "includeServer", "=", "timestamps", "==", "TimestampsToReturn", ".", "Server", "||", "timestamps", "==", "TimestampsToReturn", ".", "Both", ";", "return", "new", "DataValue", "(", "from", ".", "value", ",", "from", ".", "status", ",", "null", ",", "includeServer", "?", "from", ".", "serverTime", ":", "null", ")", ";", "}" ]
Derive a new {@link DataValue} from a given {@link DataValue}. <p> The value is assumed to be for a non-value Node attribute, and therefore the source timestamp is not returned. @param from the {@link DataValue} to derive from. @param timestamps the timestamps to return in the derived value. @return a derived {@link DataValue}.
[ "Derive", "a", "new", "{", "@link", "DataValue", "}", "from", "a", "given", "{", "@link", "DataValue", "}", ".", "<p", ">", "The", "value", "is", "assumed", "to", "be", "for", "a", "non", "-", "value", "Node", "attribute", "and", "therefore", "the", "source", "timestamp", "is", "not", "returned", "." ]
train
https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/types/builtin/DataValue.java#L157-L166
selenide/selenide
src/main/java/com/codeborne/selenide/Condition.java
Condition.exactText
public static Condition exactText(final String text) { """ <p>Sample: <code>$("h1").shouldHave(exactText("Hello"))</code></p> <p>Case insensitive</p> <p>NB! Ignores multiple whitespaces between words</p> @param text expected text of HTML element """ return new Condition("exact text") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.equals(element.getText(), text); } @Override public String toString() { return name + " '" + text + '\''; } }; }
java
public static Condition exactText(final String text) { return new Condition("exact text") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.equals(element.getText(), text); } @Override public String toString() { return name + " '" + text + '\''; } }; }
[ "public", "static", "Condition", "exactText", "(", "final", "String", "text", ")", "{", "return", "new", "Condition", "(", "\"exact text\"", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "Driver", "driver", ",", "WebElement", "element", ")", "{", "return", "Html", ".", "text", ".", "equals", "(", "element", ".", "getText", "(", ")", ",", "text", ")", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "name", "+", "\" '\"", "+", "text", "+", "'", "'", ";", "}", "}", ";", "}" ]
<p>Sample: <code>$("h1").shouldHave(exactText("Hello"))</code></p> <p>Case insensitive</p> <p>NB! Ignores multiple whitespaces between words</p> @param text expected text of HTML element
[ "<p", ">", "Sample", ":", "<code", ">", "$", "(", "h1", ")", ".", "shouldHave", "(", "exactText", "(", "Hello", "))", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/Condition.java#L320-L332
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java
ServerUpdater.addRoleToUser
public ServerUpdater addRoleToUser(User user, Role role) { """ Queues a role to be assigned to the user. @param user The server member the role should be added to. @param role The role which should be added to the server member. @return The current instance in order to chain call methods. """ delegate.addRoleToUser(user, role); return this; }
java
public ServerUpdater addRoleToUser(User user, Role role) { delegate.addRoleToUser(user, role); return this; }
[ "public", "ServerUpdater", "addRoleToUser", "(", "User", "user", ",", "Role", "role", ")", "{", "delegate", ".", "addRoleToUser", "(", "user", ",", "role", ")", ";", "return", "this", ";", "}" ]
Queues a role to be assigned to the user. @param user The server member the role should be added to. @param role The role which should be added to the server member. @return The current instance in order to chain call methods.
[ "Queues", "a", "role", "to", "be", "assigned", "to", "the", "user", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L467-L470
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerColumnOverride
@Deprecated public String registerColumnOverride(String schema, String table, String oldColumn, String newColumn) { """ Register a column override @param schema schema @param table table @param oldColumn column @param newColumn override @return previous override @deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead. """ return internalNameMapping.registerColumnOverride(schema, table, oldColumn, newColumn); }
java
@Deprecated public String registerColumnOverride(String schema, String table, String oldColumn, String newColumn) { return internalNameMapping.registerColumnOverride(schema, table, oldColumn, newColumn); }
[ "@", "Deprecated", "public", "String", "registerColumnOverride", "(", "String", "schema", ",", "String", "table", ",", "String", "oldColumn", ",", "String", "newColumn", ")", "{", "return", "internalNameMapping", ".", "registerColumnOverride", "(", "schema", ",", "table", ",", "oldColumn", ",", "newColumn", ")", ";", "}" ]
Register a column override @param schema schema @param table table @param oldColumn column @param newColumn override @return previous override @deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead.
[ "Register", "a", "column", "override" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L398-L401
deeplearning4j/deeplearning4j
datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java
LocalTransformExecutor.executeSequenceToSequence
public static List<List<List<Writable>>> executeSequenceToSequence(List<List<List<Writable>>> inputSequence, TransformProcess transformProcess) { """ Execute the specified TransformProcess with the given <i>sequence</i> input data<br> Note: this method can only be used if the TransformProcess starts with sequence data, and also returns sequence data @param inputSequence Input sequence data to process @param transformProcess TransformProcess to execute @return Processed (non-sequential) data """ if (!(transformProcess.getFinalSchema() instanceof SequenceSchema)) { List<List<List<Writable>>> ret = new ArrayList<>(inputSequence.size()); for(List<List<Writable>> timeStep : inputSequence) { ret.add(execute(timeStep,null, transformProcess).getFirst()); } return ret; } return execute(null, inputSequence, transformProcess).getSecond(); }
java
public static List<List<List<Writable>>> executeSequenceToSequence(List<List<List<Writable>>> inputSequence, TransformProcess transformProcess) { if (!(transformProcess.getFinalSchema() instanceof SequenceSchema)) { List<List<List<Writable>>> ret = new ArrayList<>(inputSequence.size()); for(List<List<Writable>> timeStep : inputSequence) { ret.add(execute(timeStep,null, transformProcess).getFirst()); } return ret; } return execute(null, inputSequence, transformProcess).getSecond(); }
[ "public", "static", "List", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "executeSequenceToSequence", "(", "List", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "inputSequence", ",", "TransformProcess", "transformProcess", ")", "{", "if", "(", "!", "(", "transformProcess", ".", "getFinalSchema", "(", ")", "instanceof", "SequenceSchema", ")", ")", "{", "List", "<", "List", "<", "List", "<", "Writable", ">>>", "ret", "=", "new", "ArrayList", "<>", "(", "inputSequence", ".", "size", "(", ")", ")", ";", "for", "(", "List", "<", "List", "<", "Writable", ">", ">", "timeStep", ":", "inputSequence", ")", "{", "ret", ".", "add", "(", "execute", "(", "timeStep", ",", "null", ",", "transformProcess", ")", ".", "getFirst", "(", ")", ")", ";", "}", "return", "ret", ";", "}", "return", "execute", "(", "null", ",", "inputSequence", ",", "transformProcess", ")", ".", "getSecond", "(", ")", ";", "}" ]
Execute the specified TransformProcess with the given <i>sequence</i> input data<br> Note: this method can only be used if the TransformProcess starts with sequence data, and also returns sequence data @param inputSequence Input sequence data to process @param transformProcess TransformProcess to execute @return Processed (non-sequential) data
[ "Execute", "the", "specified", "TransformProcess", "with", "the", "given", "<i", ">", "sequence<", "/", "i", ">", "input", "data<br", ">", "Note", ":", "this", "method", "can", "only", "be", "used", "if", "the", "TransformProcess", "starts", "with", "sequence", "data", "and", "also", "returns", "sequence", "data" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java#L142-L154
demidenko05/beigesoft-accounting
src/main/java/org/beigesoft/accounting/processor/PrcBankStatementLineGfe.java
PrcBankStatementLineGfe.evalDayStartEndFor
public final long[] evalDayStartEndFor(final Date pDateFor) { """ <p>Evaluate start and end of day for given pDateFor.</p> @param pDateFor date for @return Start and end of day for pDateFor """ Calendar cal = Calendar.getInstance(new Locale("en", "US")); cal.setTime(pDateFor); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); long[] result = new long[2]; result[0] = cal.getTimeInMillis(); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); result[1] = cal.getTimeInMillis(); return result; }
java
public final long[] evalDayStartEndFor(final Date pDateFor) { Calendar cal = Calendar.getInstance(new Locale("en", "US")); cal.setTime(pDateFor); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); long[] result = new long[2]; result[0] = cal.getTimeInMillis(); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); result[1] = cal.getTimeInMillis(); return result; }
[ "public", "final", "long", "[", "]", "evalDayStartEndFor", "(", "final", "Date", "pDateFor", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", "new", "Locale", "(", "\"en\"", ",", "\"US\"", ")", ")", ";", "cal", ".", "setTime", "(", "pDateFor", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "long", "[", "]", "result", "=", "new", "long", "[", "2", "]", ";", "result", "[", "0", "]", "=", "cal", ".", "getTimeInMillis", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "23", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "59", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "59", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "999", ")", ";", "result", "[", "1", "]", "=", "cal", ".", "getTimeInMillis", "(", ")", ";", "return", "result", ";", "}" ]
<p>Evaluate start and end of day for given pDateFor.</p> @param pDateFor date for @return Start and end of day for pDateFor
[ "<p", ">", "Evaluate", "start", "and", "end", "of", "day", "for", "given", "pDateFor", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-accounting/blob/e6f423949008218ddd05953b078f1ea8805095c1/src/main/java/org/beigesoft/accounting/processor/PrcBankStatementLineGfe.java#L162-L177
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java
SynchronizationGenerators.enterStoredMonitors
public static InsnList enterStoredMonitors(MarkerType markerType, LockVariables lockVars) { """ Generates instruction to enter all monitors in the {@link LockState} object sitting in the lockstate variable. @param markerType debug marker type @param lockVars variables for lock/synchpoint functionality @return instructions to enter all monitors in the {@link LockState} object @throws NullPointerException if any argument is {@code null} @throws IllegalArgumentException if lock variables aren't set (the method doesn't contain any monitorenter/monitorexit instructions) """ Validate.notNull(markerType); Validate.notNull(lockVars); Variable lockStateVar = lockVars.getLockStateVar(); Variable counterVar = lockVars.getCounterVar(); Variable arrayLenVar = lockVars.getArrayLenVar(); Validate.isTrue(lockStateVar != null); Validate.isTrue(counterVar != null); Validate.isTrue(arrayLenVar != null); return forEach(counterVar, arrayLenVar, merge( debugMarker(markerType, "Loading monitors to enter"), call(LOCKSTATE_TOARRAY_METHOD, loadVar(lockStateVar)) ), merge( debugMarker(markerType, "Entering monitor"), new InsnNode(Opcodes.MONITORENTER) ) ); }
java
public static InsnList enterStoredMonitors(MarkerType markerType, LockVariables lockVars) { Validate.notNull(markerType); Validate.notNull(lockVars); Variable lockStateVar = lockVars.getLockStateVar(); Variable counterVar = lockVars.getCounterVar(); Variable arrayLenVar = lockVars.getArrayLenVar(); Validate.isTrue(lockStateVar != null); Validate.isTrue(counterVar != null); Validate.isTrue(arrayLenVar != null); return forEach(counterVar, arrayLenVar, merge( debugMarker(markerType, "Loading monitors to enter"), call(LOCKSTATE_TOARRAY_METHOD, loadVar(lockStateVar)) ), merge( debugMarker(markerType, "Entering monitor"), new InsnNode(Opcodes.MONITORENTER) ) ); }
[ "public", "static", "InsnList", "enterStoredMonitors", "(", "MarkerType", "markerType", ",", "LockVariables", "lockVars", ")", "{", "Validate", ".", "notNull", "(", "markerType", ")", ";", "Validate", ".", "notNull", "(", "lockVars", ")", ";", "Variable", "lockStateVar", "=", "lockVars", ".", "getLockStateVar", "(", ")", ";", "Variable", "counterVar", "=", "lockVars", ".", "getCounterVar", "(", ")", ";", "Variable", "arrayLenVar", "=", "lockVars", ".", "getArrayLenVar", "(", ")", ";", "Validate", ".", "isTrue", "(", "lockStateVar", "!=", "null", ")", ";", "Validate", ".", "isTrue", "(", "counterVar", "!=", "null", ")", ";", "Validate", ".", "isTrue", "(", "arrayLenVar", "!=", "null", ")", ";", "return", "forEach", "(", "counterVar", ",", "arrayLenVar", ",", "merge", "(", "debugMarker", "(", "markerType", ",", "\"Loading monitors to enter\"", ")", ",", "call", "(", "LOCKSTATE_TOARRAY_METHOD", ",", "loadVar", "(", "lockStateVar", ")", ")", ")", ",", "merge", "(", "debugMarker", "(", "markerType", ",", "\"Entering monitor\"", ")", ",", "new", "InsnNode", "(", "Opcodes", ".", "MONITORENTER", ")", ")", ")", ";", "}" ]
Generates instruction to enter all monitors in the {@link LockState} object sitting in the lockstate variable. @param markerType debug marker type @param lockVars variables for lock/synchpoint functionality @return instructions to enter all monitors in the {@link LockState} object @throws NullPointerException if any argument is {@code null} @throws IllegalArgumentException if lock variables aren't set (the method doesn't contain any monitorenter/monitorexit instructions)
[ "Generates", "instruction", "to", "enter", "all", "monitors", "in", "the", "{" ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/SynchronizationGenerators.java#L86-L107
osglworks/java-tool
src/main/java/org/osgl/util/FastStr.java
FastStr.unsafeOf
@SuppressWarnings("unused") public static FastStr unsafeOf(char[] buf) { """ Construct a FastStr instance from char array without array copying @param buf the char array @return a FastStr instance from the char array """ E.NPE(buf); return new FastStr(buf, 0, buf.length); }
java
@SuppressWarnings("unused") public static FastStr unsafeOf(char[] buf) { E.NPE(buf); return new FastStr(buf, 0, buf.length); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "FastStr", "unsafeOf", "(", "char", "[", "]", "buf", ")", "{", "E", ".", "NPE", "(", "buf", ")", ";", "return", "new", "FastStr", "(", "buf", ",", "0", ",", "buf", ".", "length", ")", ";", "}" ]
Construct a FastStr instance from char array without array copying @param buf the char array @return a FastStr instance from the char array
[ "Construct", "a", "FastStr", "instance", "from", "char", "array", "without", "array", "copying" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/FastStr.java#L1674-L1678
motown-io/motown
vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java
VasEventHandler.updateReservableForChargingStation
private void updateReservableForChargingStation(ChargingStationId chargingStationId, boolean reservable) { """ Updates the 'reservable' property of the charging station. If the charging station cannot be found in the repository an error is logged. @param chargingStationId charging station identifier. @param reservable true if the charging station is reservable, false otherwise. """ ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { chargingStation.setReservable(reservable); chargingStationRepository.createOrUpdate(chargingStation); } }
java
private void updateReservableForChargingStation(ChargingStationId chargingStationId, boolean reservable) { ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { chargingStation.setReservable(reservable); chargingStationRepository.createOrUpdate(chargingStation); } }
[ "private", "void", "updateReservableForChargingStation", "(", "ChargingStationId", "chargingStationId", ",", "boolean", "reservable", ")", "{", "ChargingStation", "chargingStation", "=", "getChargingStation", "(", "chargingStationId", ")", ";", "if", "(", "chargingStation", "!=", "null", ")", "{", "chargingStation", ".", "setReservable", "(", "reservable", ")", ";", "chargingStationRepository", ".", "createOrUpdate", "(", "chargingStation", ")", ";", "}", "}" ]
Updates the 'reservable' property of the charging station. If the charging station cannot be found in the repository an error is logged. @param chargingStationId charging station identifier. @param reservable true if the charging station is reservable, false otherwise.
[ "Updates", "the", "reservable", "property", "of", "the", "charging", "station", ".", "If", "the", "charging", "station", "cannot", "be", "found", "in", "the", "repository", "an", "error", "is", "logged", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java#L251-L258
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java
BeetlUtil.renderFromStr
public static String renderFromStr(String templateContent, Map<String, Object> bindingMap) { """ 渲染模板 @param templateContent 模板内容 @param bindingMap 绑定参数 @return 渲染后的内容 @since 3.2.0 """ return render(getStrTemplate(templateContent), bindingMap); }
java
public static String renderFromStr(String templateContent, Map<String, Object> bindingMap) { return render(getStrTemplate(templateContent), bindingMap); }
[ "public", "static", "String", "renderFromStr", "(", "String", "templateContent", ",", "Map", "<", "String", ",", "Object", ">", "bindingMap", ")", "{", "return", "render", "(", "getStrTemplate", "(", "templateContent", ")", ",", "bindingMap", ")", ";", "}" ]
渲染模板 @param templateContent 模板内容 @param bindingMap 绑定参数 @return 渲染后的内容 @since 3.2.0
[ "渲染模板" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlUtil.java#L211-L213
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java
WaveformFinder.getWaveformDetail
WaveformDetail getWaveformDetail(int rekordboxId, SlotReference slot, Client client) throws IOException { """ Requests the waveform detail for a specific track ID, given a connection to a player that has already been set up. @param rekordboxId the track whose waveform detail is desired @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved waveform detail, or {@code null} if none was available @throws IOException if there is a communication problem """ final NumberField idField = new NumberField(rekordboxId); // First try to get the NXS2-style color waveform if we are supposed to. if (preferColor.get()) { try { Message response = client.simpleRequest(Message.KnownType.ANLZ_TAG_REQ, Message.KnownType.ANLZ_TAG, client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, new NumberField(Message.ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL), new NumberField(Message.ALNZ_FILE_TYPE_EXT)); return new WaveformDetail(new DataReference(slot, rekordboxId), response); } catch (Exception e) { logger.info("No color waveform available for slot " + slot + ", id " + rekordboxId + "; requesting blue version.", e); } } Message response = client.simpleRequest(Message.KnownType.WAVE_DETAIL_REQ, Message.KnownType.WAVE_DETAIL, client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, NumberField.WORD_0); return new WaveformDetail(new DataReference(slot, rekordboxId), response); }
java
WaveformDetail getWaveformDetail(int rekordboxId, SlotReference slot, Client client) throws IOException { final NumberField idField = new NumberField(rekordboxId); // First try to get the NXS2-style color waveform if we are supposed to. if (preferColor.get()) { try { Message response = client.simpleRequest(Message.KnownType.ANLZ_TAG_REQ, Message.KnownType.ANLZ_TAG, client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, new NumberField(Message.ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL), new NumberField(Message.ALNZ_FILE_TYPE_EXT)); return new WaveformDetail(new DataReference(slot, rekordboxId), response); } catch (Exception e) { logger.info("No color waveform available for slot " + slot + ", id " + rekordboxId + "; requesting blue version.", e); } } Message response = client.simpleRequest(Message.KnownType.WAVE_DETAIL_REQ, Message.KnownType.WAVE_DETAIL, client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, NumberField.WORD_0); return new WaveformDetail(new DataReference(slot, rekordboxId), response); }
[ "WaveformDetail", "getWaveformDetail", "(", "int", "rekordboxId", ",", "SlotReference", "slot", ",", "Client", "client", ")", "throws", "IOException", "{", "final", "NumberField", "idField", "=", "new", "NumberField", "(", "rekordboxId", ")", ";", "// First try to get the NXS2-style color waveform if we are supposed to.", "if", "(", "preferColor", ".", "get", "(", ")", ")", "{", "try", "{", "Message", "response", "=", "client", ".", "simpleRequest", "(", "Message", ".", "KnownType", ".", "ANLZ_TAG_REQ", ",", "Message", ".", "KnownType", ".", "ANLZ_TAG", ",", "client", ".", "buildRMST", "(", "Message", ".", "MenuIdentifier", ".", "MAIN_MENU", ",", "slot", ".", "slot", ")", ",", "idField", ",", "new", "NumberField", "(", "Message", ".", "ANLZ_FILE_TAG_COLOR_WAVEFORM_DETAIL", ")", ",", "new", "NumberField", "(", "Message", ".", "ALNZ_FILE_TYPE_EXT", ")", ")", ";", "return", "new", "WaveformDetail", "(", "new", "DataReference", "(", "slot", ",", "rekordboxId", ")", ",", "response", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "info", "(", "\"No color waveform available for slot \"", "+", "slot", "+", "\", id \"", "+", "rekordboxId", "+", "\"; requesting blue version.\"", ",", "e", ")", ";", "}", "}", "Message", "response", "=", "client", ".", "simpleRequest", "(", "Message", ".", "KnownType", ".", "WAVE_DETAIL_REQ", ",", "Message", ".", "KnownType", ".", "WAVE_DETAIL", ",", "client", ".", "buildRMST", "(", "Message", ".", "MenuIdentifier", ".", "MAIN_MENU", ",", "slot", ".", "slot", ")", ",", "idField", ",", "NumberField", ".", "WORD_0", ")", ";", "return", "new", "WaveformDetail", "(", "new", "DataReference", "(", "slot", ",", "rekordboxId", ")", ",", "response", ")", ";", "}" ]
Requests the waveform detail for a specific track ID, given a connection to a player that has already been set up. @param rekordboxId the track whose waveform detail is desired @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved waveform detail, or {@code null} if none was available @throws IOException if there is a communication problem
[ "Requests", "the", "waveform", "detail", "for", "a", "specific", "track", "ID", "given", "a", "connection", "to", "a", "player", "that", "has", "already", "been", "set", "up", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java#L584-L603
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.addYear
public final Timestamp addYear(int amount) { """ Returns a timestamp relative to this one by the given number of years. The day field may be adjusted to account for leap days. For example, adding one year to {@code 2012-02-29} results in {@code 2013-02-28}. @param amount a number of years. """ if (amount == 0) return this; Calendar cal = calendarValue(); cal.add(Calendar.YEAR, amount); return new Timestamp(cal, _precision, _fraction, _offset); }
java
public final Timestamp addYear(int amount) { if (amount == 0) return this; Calendar cal = calendarValue(); cal.add(Calendar.YEAR, amount); return new Timestamp(cal, _precision, _fraction, _offset); }
[ "public", "final", "Timestamp", "addYear", "(", "int", "amount", ")", "{", "if", "(", "amount", "==", "0", ")", "return", "this", ";", "Calendar", "cal", "=", "calendarValue", "(", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "YEAR", ",", "amount", ")", ";", "return", "new", "Timestamp", "(", "cal", ",", "_precision", ",", "_fraction", ",", "_offset", ")", ";", "}" ]
Returns a timestamp relative to this one by the given number of years. The day field may be adjusted to account for leap days. For example, adding one year to {@code 2012-02-29} results in {@code 2013-02-28}. @param amount a number of years.
[ "Returns", "a", "timestamp", "relative", "to", "this", "one", "by", "the", "given", "number", "of", "years", ".", "The", "day", "field", "may", "be", "adjusted", "to", "account", "for", "leap", "days", ".", "For", "example", "adding", "one", "year", "to", "{", "@code", "2012", "-", "02", "-", "29", "}", "results", "in", "{", "@code", "2013", "-", "02", "-", "28", "}", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L2522-L2529
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java
CommonUtils.putToConcurrentMap
public static <K, V> V putToConcurrentMap(ConcurrentMap<K, V> map, K key, V value) { """ 将值放入ConcurrentMap,已经考虑第一次并发问题 @param map ConcurrentMap @param key 关键字 @param value 值 @param <K> 关键字类型 @param <V> 值类型 @return 旧值 """ V old = map.putIfAbsent(key, value); return old != null ? old : value; }
java
public static <K, V> V putToConcurrentMap(ConcurrentMap<K, V> map, K key, V value) { V old = map.putIfAbsent(key, value); return old != null ? old : value; }
[ "public", "static", "<", "K", ",", "V", ">", "V", "putToConcurrentMap", "(", "ConcurrentMap", "<", "K", ",", "V", ">", "map", ",", "K", "key", ",", "V", "value", ")", "{", "V", "old", "=", "map", ".", "putIfAbsent", "(", "key", ",", "value", ")", ";", "return", "old", "!=", "null", "?", "old", ":", "value", ";", "}" ]
将值放入ConcurrentMap,已经考虑第一次并发问题 @param map ConcurrentMap @param key 关键字 @param value 值 @param <K> 关键字类型 @param <V> 值类型 @return 旧值
[ "将值放入ConcurrentMap,已经考虑第一次并发问题" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java#L42-L45
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java
ModbusSerialTransport.readBytes
void readBytes(byte[] buffer, long bytesToRead) throws IOException { """ Reads the specified number of bytes from the input stream @param buffer Buffer to put data into @param bytesToRead Number of bytes to read @throws IOException If the port is invalid or if the number of bytes returned is not equal to that asked for """ if (commPort != null && commPort.isOpen()) { int cnt = commPort.readBytes(buffer, bytesToRead); if (cnt != bytesToRead) { throw new IOException("Cannot read from serial port - truncated"); } } else { throw new IOException("Comm port is not valid or not open"); } }
java
void readBytes(byte[] buffer, long bytesToRead) throws IOException { if (commPort != null && commPort.isOpen()) { int cnt = commPort.readBytes(buffer, bytesToRead); if (cnt != bytesToRead) { throw new IOException("Cannot read from serial port - truncated"); } } else { throw new IOException("Comm port is not valid or not open"); } }
[ "void", "readBytes", "(", "byte", "[", "]", "buffer", ",", "long", "bytesToRead", ")", "throws", "IOException", "{", "if", "(", "commPort", "!=", "null", "&&", "commPort", ".", "isOpen", "(", ")", ")", "{", "int", "cnt", "=", "commPort", ".", "readBytes", "(", "buffer", ",", "bytesToRead", ")", ";", "if", "(", "cnt", "!=", "bytesToRead", ")", "{", "throw", "new", "IOException", "(", "\"Cannot read from serial port - truncated\"", ")", ";", "}", "}", "else", "{", "throw", "new", "IOException", "(", "\"Comm port is not valid or not open\"", ")", ";", "}", "}" ]
Reads the specified number of bytes from the input stream @param buffer Buffer to put data into @param bytesToRead Number of bytes to read @throws IOException If the port is invalid or if the number of bytes returned is not equal to that asked for
[ "Reads", "the", "specified", "number", "of", "bytes", "from", "the", "input", "stream" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java#L418-L428
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.resemblesPattern
public static boolean resemblesPattern(String pattern, int pos) { """ Return true if the given position, in the given pattern, appears to be the start of a UnicodeSet pattern. @hide unsupported on Android """ return ((pos+1) < pattern.length() && pattern.charAt(pos) == '[') || resemblesPropertyPattern(pattern, pos); }
java
public static boolean resemblesPattern(String pattern, int pos) { return ((pos+1) < pattern.length() && pattern.charAt(pos) == '[') || resemblesPropertyPattern(pattern, pos); }
[ "public", "static", "boolean", "resemblesPattern", "(", "String", "pattern", ",", "int", "pos", ")", "{", "return", "(", "(", "pos", "+", "1", ")", "<", "pattern", ".", "length", "(", ")", "&&", "pattern", ".", "charAt", "(", "pos", ")", "==", "'", "'", ")", "||", "resemblesPropertyPattern", "(", "pattern", ",", "pos", ")", ";", "}" ]
Return true if the given position, in the given pattern, appears to be the start of a UnicodeSet pattern. @hide unsupported on Android
[ "Return", "true", "if", "the", "given", "position", "in", "the", "given", "pattern", "appears", "to", "be", "the", "start", "of", "a", "UnicodeSet", "pattern", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L583-L587
google/error-prone
check_api/src/main/java/com/google/errorprone/util/ErrorProneTokens.java
ErrorProneTokens.getTokens
public static ImmutableList<ErrorProneToken> getTokens(String source, Context context) { """ Returns the tokens for the given source text, including comments. """ return new ErrorProneTokens(source, context).getTokens(); }
java
public static ImmutableList<ErrorProneToken> getTokens(String source, Context context) { return new ErrorProneTokens(source, context).getTokens(); }
[ "public", "static", "ImmutableList", "<", "ErrorProneToken", ">", "getTokens", "(", "String", "source", ",", "Context", "context", ")", "{", "return", "new", "ErrorProneTokens", "(", "source", ",", "context", ")", ".", "getTokens", "(", ")", ";", "}" ]
Returns the tokens for the given source text, including comments.
[ "Returns", "the", "tokens", "for", "the", "given", "source", "text", "including", "comments", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ErrorProneTokens.java#L59-L61
s1-platform/s1
s1-core/src/java/org/s1/ws/SOAPHelper.java
SOAPHelper.validateMessage
public static void validateMessage(String basePath, Document wsdl, SOAPMessage msg) throws XSDFormatException, XSDValidationException { """ Validate message on wsdl @param wsdl @param msg @throws XSDFormatException @throws XSDValidationException """ LOG.debug("Validating message on WSDL"); //get schema //Element schemaNode = (Element)wsdl.getElementsByTagNameNS(XMLConstants"http://www.w3.org/2001/XMLSchema","schema").item(0); NodeList schemaNodes = wsdl.getElementsByTagNameNS( XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema"); int nrSchemas = schemaNodes.getLength(); Source[] schemas = new Source[nrSchemas]; for (int i = 0; i < nrSchemas; i++) { schemas[i] = new DOMSource(schemaNodes.item(i)); } //get body Element body = null; try { body = msg.getSOAPBody(); } catch (SOAPException e) { throw S1SystemError.wrap(e); } if(msg.getAttachments().hasNext()){ //copy body = (Element)body.cloneNode(true); //remove xop:Includes NodeList nl = body.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/include","Include"); for(int i=0;i<nl.getLength();i++){ Node n = nl.item(i); n.getParentNode().removeChild(n); } } //validate Body children for(Element el:XMLFormat.getChildElementList(body,null,null)){ XMLFormat.validate(basePath, schemas, el); } }
java
public static void validateMessage(String basePath, Document wsdl, SOAPMessage msg) throws XSDFormatException, XSDValidationException{ LOG.debug("Validating message on WSDL"); //get schema //Element schemaNode = (Element)wsdl.getElementsByTagNameNS(XMLConstants"http://www.w3.org/2001/XMLSchema","schema").item(0); NodeList schemaNodes = wsdl.getElementsByTagNameNS( XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema"); int nrSchemas = schemaNodes.getLength(); Source[] schemas = new Source[nrSchemas]; for (int i = 0; i < nrSchemas; i++) { schemas[i] = new DOMSource(schemaNodes.item(i)); } //get body Element body = null; try { body = msg.getSOAPBody(); } catch (SOAPException e) { throw S1SystemError.wrap(e); } if(msg.getAttachments().hasNext()){ //copy body = (Element)body.cloneNode(true); //remove xop:Includes NodeList nl = body.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/include","Include"); for(int i=0;i<nl.getLength();i++){ Node n = nl.item(i); n.getParentNode().removeChild(n); } } //validate Body children for(Element el:XMLFormat.getChildElementList(body,null,null)){ XMLFormat.validate(basePath, schemas, el); } }
[ "public", "static", "void", "validateMessage", "(", "String", "basePath", ",", "Document", "wsdl", ",", "SOAPMessage", "msg", ")", "throws", "XSDFormatException", ",", "XSDValidationException", "{", "LOG", ".", "debug", "(", "\"Validating message on WSDL\"", ")", ";", "//get schema", "//Element schemaNode = (Element)wsdl.getElementsByTagNameNS(XMLConstants\"http://www.w3.org/2001/XMLSchema\",\"schema\").item(0);", "NodeList", "schemaNodes", "=", "wsdl", ".", "getElementsByTagNameNS", "(", "XMLConstants", ".", "W3C_XML_SCHEMA_NS_URI", ",", "\"schema\"", ")", ";", "int", "nrSchemas", "=", "schemaNodes", ".", "getLength", "(", ")", ";", "Source", "[", "]", "schemas", "=", "new", "Source", "[", "nrSchemas", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nrSchemas", ";", "i", "++", ")", "{", "schemas", "[", "i", "]", "=", "new", "DOMSource", "(", "schemaNodes", ".", "item", "(", "i", ")", ")", ";", "}", "//get body", "Element", "body", "=", "null", ";", "try", "{", "body", "=", "msg", ".", "getSOAPBody", "(", ")", ";", "}", "catch", "(", "SOAPException", "e", ")", "{", "throw", "S1SystemError", ".", "wrap", "(", "e", ")", ";", "}", "if", "(", "msg", ".", "getAttachments", "(", ")", ".", "hasNext", "(", ")", ")", "{", "//copy", "body", "=", "(", "Element", ")", "body", ".", "cloneNode", "(", "true", ")", ";", "//remove xop:Includes", "NodeList", "nl", "=", "body", ".", "getElementsByTagNameNS", "(", "\"http://www.w3.org/2004/08/xop/include\"", ",", "\"Include\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nl", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Node", "n", "=", "nl", ".", "item", "(", "i", ")", ";", "n", ".", "getParentNode", "(", ")", ".", "removeChild", "(", "n", ")", ";", "}", "}", "//validate Body children", "for", "(", "Element", "el", ":", "XMLFormat", ".", "getChildElementList", "(", "body", ",", "null", ",", "null", ")", ")", "{", "XMLFormat", ".", "validate", "(", "basePath", ",", "schemas", ",", "el", ")", ";", "}", "}" ]
Validate message on wsdl @param wsdl @param msg @throws XSDFormatException @throws XSDValidationException
[ "Validate", "message", "on", "wsdl" ]
train
https://github.com/s1-platform/s1/blob/370101c13fef01af524bc171bcc1a97e5acc76e8/s1-core/src/java/org/s1/ws/SOAPHelper.java#L140-L179
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java
NetworkServiceDescriptorAgent.deleteSecurity
@Help(help = "Delete the Security of a NetworkServiceDescriptor with specific id") public void deleteSecurity(final String idNsd, final String idSecurity) throws SDKException { """ Delete a Security object. @param idNsd the NetworkServiceDescriptor's ID @param idSecurity the Security object's ID @throws SDKException if the request fails """ String url = idNsd + "/security" + "/" + idSecurity; requestDelete(url); }
java
@Help(help = "Delete the Security of a NetworkServiceDescriptor with specific id") public void deleteSecurity(final String idNsd, final String idSecurity) throws SDKException { String url = idNsd + "/security" + "/" + idSecurity; requestDelete(url); }
[ "@", "Help", "(", "help", "=", "\"Delete the Security of a NetworkServiceDescriptor with specific id\"", ")", "public", "void", "deleteSecurity", "(", "final", "String", "idNsd", ",", "final", "String", "idSecurity", ")", "throws", "SDKException", "{", "String", "url", "=", "idNsd", "+", "\"/security\"", "+", "\"/\"", "+", "idSecurity", ";", "requestDelete", "(", "url", ")", ";", "}" ]
Delete a Security object. @param idNsd the NetworkServiceDescriptor's ID @param idSecurity the Security object's ID @throws SDKException if the request fails
[ "Delete", "a", "Security", "object", "." ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceDescriptorAgent.java#L412-L416
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java
MessageRetriever.printError
private void printError(SourcePosition pos, String msg) { """ Print error message, increment error count. @param pos the position of the source @param msg message to print """ configuration.root.printError(pos, msg); }
java
private void printError(SourcePosition pos, String msg) { configuration.root.printError(pos, msg); }
[ "private", "void", "printError", "(", "SourcePosition", "pos", ",", "String", "msg", ")", "{", "configuration", ".", "root", ".", "printError", "(", "pos", ",", "msg", ")", ";", "}" ]
Print error message, increment error count. @param pos the position of the source @param msg message to print
[ "Print", "error", "message", "increment", "error", "count", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java#L135-L137
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCouponRedemptionsByInvoice
@Deprecated public Redemptions getCouponRedemptionsByInvoice(final Integer invoiceNumber, final QueryParams params) { """ Lookup all coupon redemptions on an invoice given query params. @deprecated Prefer using Invoice#getId() as the id param (which is a String) @param invoiceNumber invoice number @param params {@link QueryParams} @return the coupon redemptions for this invoice on success, null otherwise """ return getCouponRedemptionsByInvoice(invoiceNumber.toString(), params); }
java
@Deprecated public Redemptions getCouponRedemptionsByInvoice(final Integer invoiceNumber, final QueryParams params) { return getCouponRedemptionsByInvoice(invoiceNumber.toString(), params); }
[ "@", "Deprecated", "public", "Redemptions", "getCouponRedemptionsByInvoice", "(", "final", "Integer", "invoiceNumber", ",", "final", "QueryParams", "params", ")", "{", "return", "getCouponRedemptionsByInvoice", "(", "invoiceNumber", ".", "toString", "(", ")", ",", "params", ")", ";", "}" ]
Lookup all coupon redemptions on an invoice given query params. @deprecated Prefer using Invoice#getId() as the id param (which is a String) @param invoiceNumber invoice number @param params {@link QueryParams} @return the coupon redemptions for this invoice on success, null otherwise
[ "Lookup", "all", "coupon", "redemptions", "on", "an", "invoice", "given", "query", "params", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1677-L1680
jMetal/jMetal
jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java
SolutionUtils.distanceBetweenObjectives
public static <S extends Solution<?>> double distanceBetweenObjectives(S firstSolution, S secondSolution) { """ Returns the euclidean distance between a pair of solutions in the objective space """ double diff; double distance = 0.0; //euclidean distance for (int nObj = 0; nObj < firstSolution.getNumberOfObjectives(); nObj++) { diff = firstSolution.getObjective(nObj) - secondSolution.getObjective(nObj); distance += Math.pow(diff, 2.0); } return Math.sqrt(distance); }
java
public static <S extends Solution<?>> double distanceBetweenObjectives(S firstSolution, S secondSolution) { double diff; double distance = 0.0; //euclidean distance for (int nObj = 0; nObj < firstSolution.getNumberOfObjectives(); nObj++) { diff = firstSolution.getObjective(nObj) - secondSolution.getObjective(nObj); distance += Math.pow(diff, 2.0); } return Math.sqrt(distance); }
[ "public", "static", "<", "S", "extends", "Solution", "<", "?", ">", ">", "double", "distanceBetweenObjectives", "(", "S", "firstSolution", ",", "S", "secondSolution", ")", "{", "double", "diff", ";", "double", "distance", "=", "0.0", ";", "//euclidean distance", "for", "(", "int", "nObj", "=", "0", ";", "nObj", "<", "firstSolution", ".", "getNumberOfObjectives", "(", ")", ";", "nObj", "++", ")", "{", "diff", "=", "firstSolution", ".", "getObjective", "(", "nObj", ")", "-", "secondSolution", ".", "getObjective", "(", "nObj", ")", ";", "distance", "+=", "Math", ".", "pow", "(", "diff", ",", "2.0", ")", ";", "}", "return", "Math", ".", "sqrt", "(", "distance", ")", ";", "}" ]
Returns the euclidean distance between a pair of solutions in the objective space
[ "Returns", "the", "euclidean", "distance", "between", "a", "pair", "of", "solutions", "in", "the", "objective", "space" ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java#L61-L73
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageInfoDisplay.java
CmsImageInfoDisplay.fillContent
public void fillContent(CmsResourceInfoBean infoBean, String crop, String point) { """ Fills the contend data.<p> @param infoBean the image info bean @param crop the cropping text @param point the focal point text """ m_displayPath.setText(infoBean.getResourcePath()); if (infoBean instanceof CmsImageInfoBean) { CmsImageInfoBean imageInfo = (CmsImageInfoBean)infoBean; m_displayFormat.setText(imageInfo.getWidth() + " x " + imageInfo.getHeight()); } String path = infoBean.getResourcePath(); String typePrefix = "???"; int slashPos = path.lastIndexOf("/"); String name; if (slashPos >= 0) { name = path.substring(slashPos + 1); } else { name = path; } int dotPos = name.lastIndexOf("."); if (dotPos >= 0) { String extension = name.substring(dotPos + 1).toLowerCase(); if ("jpg".equals(extension) || "jpeg".equals(extension)) { typePrefix = "JPEG"; } else { typePrefix = extension.toUpperCase(); } } m_removePoint.setEnabled(CmsStringUtil.isEmptyOrWhitespaceOnly(infoBean.getNoEditReason())); m_displayType.setText(Messages.get().key(Messages.GUI_PREVIEW_VALUE_TYPE_1, typePrefix)); setCropFormat(crop); setFocalPoint(point); }
java
public void fillContent(CmsResourceInfoBean infoBean, String crop, String point) { m_displayPath.setText(infoBean.getResourcePath()); if (infoBean instanceof CmsImageInfoBean) { CmsImageInfoBean imageInfo = (CmsImageInfoBean)infoBean; m_displayFormat.setText(imageInfo.getWidth() + " x " + imageInfo.getHeight()); } String path = infoBean.getResourcePath(); String typePrefix = "???"; int slashPos = path.lastIndexOf("/"); String name; if (slashPos >= 0) { name = path.substring(slashPos + 1); } else { name = path; } int dotPos = name.lastIndexOf("."); if (dotPos >= 0) { String extension = name.substring(dotPos + 1).toLowerCase(); if ("jpg".equals(extension) || "jpeg".equals(extension)) { typePrefix = "JPEG"; } else { typePrefix = extension.toUpperCase(); } } m_removePoint.setEnabled(CmsStringUtil.isEmptyOrWhitespaceOnly(infoBean.getNoEditReason())); m_displayType.setText(Messages.get().key(Messages.GUI_PREVIEW_VALUE_TYPE_1, typePrefix)); setCropFormat(crop); setFocalPoint(point); }
[ "public", "void", "fillContent", "(", "CmsResourceInfoBean", "infoBean", ",", "String", "crop", ",", "String", "point", ")", "{", "m_displayPath", ".", "setText", "(", "infoBean", ".", "getResourcePath", "(", ")", ")", ";", "if", "(", "infoBean", "instanceof", "CmsImageInfoBean", ")", "{", "CmsImageInfoBean", "imageInfo", "=", "(", "CmsImageInfoBean", ")", "infoBean", ";", "m_displayFormat", ".", "setText", "(", "imageInfo", ".", "getWidth", "(", ")", "+", "\" x \"", "+", "imageInfo", ".", "getHeight", "(", ")", ")", ";", "}", "String", "path", "=", "infoBean", ".", "getResourcePath", "(", ")", ";", "String", "typePrefix", "=", "\"???\"", ";", "int", "slashPos", "=", "path", ".", "lastIndexOf", "(", "\"/\"", ")", ";", "String", "name", ";", "if", "(", "slashPos", ">=", "0", ")", "{", "name", "=", "path", ".", "substring", "(", "slashPos", "+", "1", ")", ";", "}", "else", "{", "name", "=", "path", ";", "}", "int", "dotPos", "=", "name", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "dotPos", ">=", "0", ")", "{", "String", "extension", "=", "name", ".", "substring", "(", "dotPos", "+", "1", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "\"jpg\"", ".", "equals", "(", "extension", ")", "||", "\"jpeg\"", ".", "equals", "(", "extension", ")", ")", "{", "typePrefix", "=", "\"JPEG\"", ";", "}", "else", "{", "typePrefix", "=", "extension", ".", "toUpperCase", "(", ")", ";", "}", "}", "m_removePoint", ".", "setEnabled", "(", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "infoBean", ".", "getNoEditReason", "(", ")", ")", ")", ";", "m_displayType", ".", "setText", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_PREVIEW_VALUE_TYPE_1", ",", "typePrefix", ")", ")", ";", "setCropFormat", "(", "crop", ")", ";", "setFocalPoint", "(", "point", ")", ";", "}" ]
Fills the contend data.<p> @param infoBean the image info bean @param crop the cropping text @param point the focal point text
[ "Fills", "the", "contend", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageInfoDisplay.java#L148-L177
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java
AbstractCreator.getKeySerializerFromType
protected final JSerializerType getKeySerializerFromType( JType type ) throws UnsupportedTypeException, UnableToCompleteException { """ Build the {@link JSerializerType} that instantiate a {@link KeySerializer} for the given type. @param type type @return the {@link JSerializerType}. @throws com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException if any. """ return getKeySerializerFromType( type, false, false ); }
java
protected final JSerializerType getKeySerializerFromType( JType type ) throws UnsupportedTypeException, UnableToCompleteException { return getKeySerializerFromType( type, false, false ); }
[ "protected", "final", "JSerializerType", "getKeySerializerFromType", "(", "JType", "type", ")", "throws", "UnsupportedTypeException", ",", "UnableToCompleteException", "{", "return", "getKeySerializerFromType", "(", "type", ",", "false", ",", "false", ")", ";", "}" ]
Build the {@link JSerializerType} that instantiate a {@link KeySerializer} for the given type. @param type type @return the {@link JSerializerType}. @throws com.github.nmorel.gwtjackson.rebind.exception.UnsupportedTypeException if any.
[ "Build", "the", "{", "@link", "JSerializerType", "}", "that", "instantiate", "a", "{", "@link", "KeySerializer", "}", "for", "the", "given", "type", "." ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L388-L390
Red5/red5-io
src/main/java/org/red5/io/matroska/parser/TagCrawler.java
TagCrawler.createSkipHandler
public TagHandler createSkipHandler() { """ Method to create "default" handler (the one will be used if none other handlers were found) can be overridden to change the logic @return - this for chaining """ return new TagHandler() { @Override public void handle(Tag tag, InputStream input) throws IOException, ConverterException { log.debug("Going to skip tag: " + tag.getName()); long size = tag.getSize(); while (size > 0) { size -= input.skip(size); } } }; }
java
public TagHandler createSkipHandler() { return new TagHandler() { @Override public void handle(Tag tag, InputStream input) throws IOException, ConverterException { log.debug("Going to skip tag: " + tag.getName()); long size = tag.getSize(); while (size > 0) { size -= input.skip(size); } } }; }
[ "public", "TagHandler", "createSkipHandler", "(", ")", "{", "return", "new", "TagHandler", "(", ")", "{", "@", "Override", "public", "void", "handle", "(", "Tag", "tag", ",", "InputStream", "input", ")", "throws", "IOException", ",", "ConverterException", "{", "log", ".", "debug", "(", "\"Going to skip tag: \"", "+", "tag", ".", "getName", "(", ")", ")", ";", "long", "size", "=", "tag", ".", "getSize", "(", ")", ";", "while", "(", "size", ">", "0", ")", "{", "size", "-=", "input", ".", "skip", "(", "size", ")", ";", "}", "}", "}", ";", "}" ]
Method to create "default" handler (the one will be used if none other handlers were found) can be overridden to change the logic @return - this for chaining
[ "Method", "to", "create", "default", "handler", "(", "the", "one", "will", "be", "used", "if", "none", "other", "handlers", "were", "found", ")", "can", "be", "overridden", "to", "change", "the", "logic" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/parser/TagCrawler.java#L98-L109
anotheria/moskito
moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java
AbstractMoskitoAspect.createAccumulators
private void createAccumulators(final OnDemandStatsProducer<S> producer, final Method method, Accumulate... annotations) { """ Create method/class level accumulators from {@link Accumulate} annotations. @param producer {@link OnDemandStatsProducer} @param method annotated method for method level accumulators or null for class level @param annotations {@link Accumulate} annotations to process """ for (final Accumulate annotation : annotations) if (annotation != null) AccumulatorUtil.getInstance().createAccumulator(producer, annotation, method); }
java
private void createAccumulators(final OnDemandStatsProducer<S> producer, final Method method, Accumulate... annotations) { for (final Accumulate annotation : annotations) if (annotation != null) AccumulatorUtil.getInstance().createAccumulator(producer, annotation, method); }
[ "private", "void", "createAccumulators", "(", "final", "OnDemandStatsProducer", "<", "S", ">", "producer", ",", "final", "Method", "method", ",", "Accumulate", "...", "annotations", ")", "{", "for", "(", "final", "Accumulate", "annotation", ":", "annotations", ")", "if", "(", "annotation", "!=", "null", ")", "AccumulatorUtil", ".", "getInstance", "(", ")", ".", "createAccumulator", "(", "producer", ",", "annotation", ",", "method", ")", ";", "}" ]
Create method/class level accumulators from {@link Accumulate} annotations. @param producer {@link OnDemandStatsProducer} @param method annotated method for method level accumulators or null for class level @param annotations {@link Accumulate} annotations to process
[ "Create", "method", "/", "class", "level", "accumulators", "from", "{", "@link", "Accumulate", "}", "annotations", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java#L265-L269
JM-Lab/utils-java8
src/main/java/kr/jm/utils/JMFileAppender.java
JMFileAppender.appendLinesAndClose
public static Path appendLinesAndClose(String filePath, Collection<String> lineCollection) { """ Append lines and close path. @param filePath the file path @param lineCollection the line collection @return the path """ return appendLinesAndClose(filePath, UTF_8, lineCollection); }
java
public static Path appendLinesAndClose(String filePath, Collection<String> lineCollection) { return appendLinesAndClose(filePath, UTF_8, lineCollection); }
[ "public", "static", "Path", "appendLinesAndClose", "(", "String", "filePath", ",", "Collection", "<", "String", ">", "lineCollection", ")", "{", "return", "appendLinesAndClose", "(", "filePath", ",", "UTF_8", ",", "lineCollection", ")", ";", "}" ]
Append lines and close path. @param filePath the file path @param lineCollection the line collection @return the path
[ "Append", "lines", "and", "close", "path", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMFileAppender.java#L133-L136
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java
CmsAliasTableController.editNewAlias
public void editNewAlias(String aliasPath, String resourcePath, CmsAliasMode mode) { """ This method is called when the user wants to add a new alias entry.<p> @param aliasPath the alias path @param resourcePath the resource site path @param mode the alias mode """ CmsAliasTableRow row = new CmsAliasTableRow(); row.setEdited(true); row.setAliasPath(aliasPath); row.setResourcePath(resourcePath); row.setMode(mode); validateNew(row); }
java
public void editNewAlias(String aliasPath, String resourcePath, CmsAliasMode mode) { CmsAliasTableRow row = new CmsAliasTableRow(); row.setEdited(true); row.setAliasPath(aliasPath); row.setResourcePath(resourcePath); row.setMode(mode); validateNew(row); }
[ "public", "void", "editNewAlias", "(", "String", "aliasPath", ",", "String", "resourcePath", ",", "CmsAliasMode", "mode", ")", "{", "CmsAliasTableRow", "row", "=", "new", "CmsAliasTableRow", "(", ")", ";", "row", ".", "setEdited", "(", "true", ")", ";", "row", ".", "setAliasPath", "(", "aliasPath", ")", ";", "row", ".", "setResourcePath", "(", "resourcePath", ")", ";", "row", ".", "setMode", "(", "mode", ")", ";", "validateNew", "(", "row", ")", ";", "}" ]
This method is called when the user wants to add a new alias entry.<p> @param aliasPath the alias path @param resourcePath the resource site path @param mode the alias mode
[ "This", "method", "is", "called", "when", "the", "user", "wants", "to", "add", "a", "new", "alias", "entry", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasTableController.java#L181-L189
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/VisualContext.java
VisualContext.getFontName
private String getFontName(TermList list, CSSProperty.FontWeight weight, CSSProperty.FontStyle style) { """ Scans a list of font definitions and chooses the first one that is available @param list of terms obtained from the font-family property @return a font name string according to java.awt.Font """ for (Term<?> term : list) { Object value = term.getValue(); if (value instanceof CSSProperty.FontFamily) return ((CSSProperty.FontFamily) value).getAWTValue(); else { String name = lookupFont(value.toString(), weight, style); if (name != null) return name; } } //nothing found, use Serif return java.awt.Font.SERIF; }
java
private String getFontName(TermList list, CSSProperty.FontWeight weight, CSSProperty.FontStyle style) { for (Term<?> term : list) { Object value = term.getValue(); if (value instanceof CSSProperty.FontFamily) return ((CSSProperty.FontFamily) value).getAWTValue(); else { String name = lookupFont(value.toString(), weight, style); if (name != null) return name; } } //nothing found, use Serif return java.awt.Font.SERIF; }
[ "private", "String", "getFontName", "(", "TermList", "list", ",", "CSSProperty", ".", "FontWeight", "weight", ",", "CSSProperty", ".", "FontStyle", "style", ")", "{", "for", "(", "Term", "<", "?", ">", "term", ":", "list", ")", "{", "Object", "value", "=", "term", ".", "getValue", "(", ")", ";", "if", "(", "value", "instanceof", "CSSProperty", ".", "FontFamily", ")", "return", "(", "(", "CSSProperty", ".", "FontFamily", ")", "value", ")", ".", "getAWTValue", "(", ")", ";", "else", "{", "String", "name", "=", "lookupFont", "(", "value", ".", "toString", "(", ")", ",", "weight", ",", "style", ")", ";", "if", "(", "name", "!=", "null", ")", "return", "name", ";", "}", "}", "//nothing found, use Serif", "return", "java", ".", "awt", ".", "Font", ".", "SERIF", ";", "}" ]
Scans a list of font definitions and chooses the first one that is available @param list of terms obtained from the font-family property @return a font name string according to java.awt.Font
[ "Scans", "a", "list", "of", "font", "definitions", "and", "chooses", "the", "first", "one", "that", "is", "available" ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/VisualContext.java#L609-L624
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Transaction.java
Transaction.addOutput
public TransactionOutput addOutput(Coin value, Address address) { """ Creates an output based on the given address and value, adds it to this transaction, and returns the new output. """ return addOutput(new TransactionOutput(params, this, value, address)); }
java
public TransactionOutput addOutput(Coin value, Address address) { return addOutput(new TransactionOutput(params, this, value, address)); }
[ "public", "TransactionOutput", "addOutput", "(", "Coin", "value", ",", "Address", "address", ")", "{", "return", "addOutput", "(", "new", "TransactionOutput", "(", "params", ",", "this", ",", "value", ",", "address", ")", ")", ";", "}" ]
Creates an output based on the given address and value, adds it to this transaction, and returns the new output.
[ "Creates", "an", "output", "based", "on", "the", "given", "address", "and", "value", "adds", "it", "to", "this", "transaction", "and", "returns", "the", "new", "output", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1041-L1043
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java
PermissionAwareCrudService.findAllUserGroupPermissionsOfUserGroup
@PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#userGroup, 'READ')") @Transactional(readOnly = true) public Map<PersistentObject, PermissionCollection> findAllUserGroupPermissionsOfUserGroup(UserGroup userGroup) { """ This method returns a {@link Map} that maps {@link PersistentObject}s to PermissionCollections for the passed {@link UserGroup}. I.e. the keySet of the map is the collection of all {@link PersistentObject}s where the user group has at least one permission and the corresponding value contains the {@link PermissionCollection} for the passed user group on the entity. @param userGroup @return """ return dao.findAllUserGroupPermissionsOfUserGroup(userGroup); }
java
@PreAuthorize("hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#userGroup, 'READ')") @Transactional(readOnly = true) public Map<PersistentObject, PermissionCollection> findAllUserGroupPermissionsOfUserGroup(UserGroup userGroup) { return dao.findAllUserGroupPermissionsOfUserGroup(userGroup); }
[ "@", "PreAuthorize", "(", "\"hasRole(@configHolder.getSuperAdminRoleName()) or hasPermission(#userGroup, 'READ')\"", ")", "@", "Transactional", "(", "readOnly", "=", "true", ")", "public", "Map", "<", "PersistentObject", ",", "PermissionCollection", ">", "findAllUserGroupPermissionsOfUserGroup", "(", "UserGroup", "userGroup", ")", "{", "return", "dao", ".", "findAllUserGroupPermissionsOfUserGroup", "(", "userGroup", ")", ";", "}" ]
This method returns a {@link Map} that maps {@link PersistentObject}s to PermissionCollections for the passed {@link UserGroup}. I.e. the keySet of the map is the collection of all {@link PersistentObject}s where the user group has at least one permission and the corresponding value contains the {@link PermissionCollection} for the passed user group on the entity. @param userGroup @return
[ "This", "method", "returns", "a", "{", "@link", "Map", "}", "that", "maps", "{", "@link", "PersistentObject", "}", "s", "to", "PermissionCollections", "for", "the", "passed", "{", "@link", "UserGroup", "}", ".", "I", ".", "e", ".", "the", "keySet", "of", "the", "map", "is", "the", "collection", "of", "all", "{", "@link", "PersistentObject", "}", "s", "where", "the", "user", "group", "has", "at", "least", "one", "permission", "and", "the", "corresponding", "value", "contains", "the", "{", "@link", "PermissionCollection", "}", "for", "the", "passed", "user", "group", "on", "the", "entity", "." ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PermissionAwareCrudService.java#L361-L365
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java
RecommendationsInner.getRuleDetailsByWebApp
public RecommendationRuleInner getRuleDetailsByWebApp(String resourceGroupName, String siteName, String name, Boolean updateSeen, String recommendationId) { """ Get a recommendation rule for an app. Get a recommendation rule for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @param name Name of the recommendation. @param updateSeen Specify &lt;code&gt;true&lt;/code&gt; to update the last-seen timestamp of the recommendation object. @param recommendationId The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RecommendationRuleInner object if successful. """ return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen, recommendationId).toBlocking().single().body(); }
java
public RecommendationRuleInner getRuleDetailsByWebApp(String resourceGroupName, String siteName, String name, Boolean updateSeen, String recommendationId) { return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen, recommendationId).toBlocking().single().body(); }
[ "public", "RecommendationRuleInner", "getRuleDetailsByWebApp", "(", "String", "resourceGroupName", ",", "String", "siteName", ",", "String", "name", ",", "Boolean", "updateSeen", ",", "String", "recommendationId", ")", "{", "return", "getRuleDetailsByWebAppWithServiceResponseAsync", "(", "resourceGroupName", ",", "siteName", ",", "name", ",", "updateSeen", ",", "recommendationId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get a recommendation rule for an app. Get a recommendation rule for an app. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Name of the app. @param name Name of the recommendation. @param updateSeen Specify &lt;code&gt;true&lt;/code&gt; to update the last-seen timestamp of the recommendation object. @param recommendationId The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry. @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RecommendationRuleInner object if successful.
[ "Get", "a", "recommendation", "rule", "for", "an", "app", ".", "Get", "a", "recommendation", "rule", "for", "an", "app", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/RecommendationsInner.java#L1304-L1306
diirt/util
src/main/java/org/epics/util/time/TimeDuration.java
TimeDuration.dividedBy
public TimeDuration dividedBy(int factor) { """ Returns a new duration which is smaller by the given factor. @param factor constant to divide @return a new duration """ return createWithCarry(sec / factor, ((sec % factor) * NANOSEC_IN_SEC + (long) nanoSec) / factor); }
java
public TimeDuration dividedBy(int factor) { return createWithCarry(sec / factor, ((sec % factor) * NANOSEC_IN_SEC + (long) nanoSec) / factor); }
[ "public", "TimeDuration", "dividedBy", "(", "int", "factor", ")", "{", "return", "createWithCarry", "(", "sec", "/", "factor", ",", "(", "(", "sec", "%", "factor", ")", "*", "NANOSEC_IN_SEC", "+", "(", "long", ")", "nanoSec", ")", "/", "factor", ")", ";", "}" ]
Returns a new duration which is smaller by the given factor. @param factor constant to divide @return a new duration
[ "Returns", "a", "new", "duration", "which", "is", "smaller", "by", "the", "given", "factor", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/time/TimeDuration.java#L155-L157
netty/netty
buffer/src/main/java/io/netty/buffer/Unpooled.java
Unpooled.wrappedBuffer
public static ByteBuf wrappedBuffer(byte[] array, int offset, int length) { """ Creates a new big-endian buffer which wraps the sub-region of the specified {@code array}. A modification on the specified array's content will be visible to the returned buffer. """ if (length == 0) { return EMPTY_BUFFER; } if (offset == 0 && length == array.length) { return wrappedBuffer(array); } return wrappedBuffer(array).slice(offset, length); }
java
public static ByteBuf wrappedBuffer(byte[] array, int offset, int length) { if (length == 0) { return EMPTY_BUFFER; } if (offset == 0 && length == array.length) { return wrappedBuffer(array); } return wrappedBuffer(array).slice(offset, length); }
[ "public", "static", "ByteBuf", "wrappedBuffer", "(", "byte", "[", "]", "array", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "length", "==", "0", ")", "{", "return", "EMPTY_BUFFER", ";", "}", "if", "(", "offset", "==", "0", "&&", "length", "==", "array", ".", "length", ")", "{", "return", "wrappedBuffer", "(", "array", ")", ";", "}", "return", "wrappedBuffer", "(", "array", ")", ".", "slice", "(", "offset", ",", "length", ")", ";", "}" ]
Creates a new big-endian buffer which wraps the sub-region of the specified {@code array}. A modification on the specified array's content will be visible to the returned buffer.
[ "Creates", "a", "new", "big", "-", "endian", "buffer", "which", "wraps", "the", "sub", "-", "region", "of", "the", "specified", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L165-L175
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java
CertificatesInner.listByIntegrationAccountsAsync
public Observable<Page<IntegrationAccountCertificateInner>> listByIntegrationAccountsAsync(final String resourceGroupName, final String integrationAccountName) { """ Gets a list of integration account certificates. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;IntegrationAccountCertificateInner&gt; object """ return listByIntegrationAccountsWithServiceResponseAsync(resourceGroupName, integrationAccountName) .map(new Func1<ServiceResponse<Page<IntegrationAccountCertificateInner>>, Page<IntegrationAccountCertificateInner>>() { @Override public Page<IntegrationAccountCertificateInner> call(ServiceResponse<Page<IntegrationAccountCertificateInner>> response) { return response.body(); } }); }
java
public Observable<Page<IntegrationAccountCertificateInner>> listByIntegrationAccountsAsync(final String resourceGroupName, final String integrationAccountName) { return listByIntegrationAccountsWithServiceResponseAsync(resourceGroupName, integrationAccountName) .map(new Func1<ServiceResponse<Page<IntegrationAccountCertificateInner>>, Page<IntegrationAccountCertificateInner>>() { @Override public Page<IntegrationAccountCertificateInner> call(ServiceResponse<Page<IntegrationAccountCertificateInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "IntegrationAccountCertificateInner", ">", ">", "listByIntegrationAccountsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "integrationAccountName", ")", "{", "return", "listByIntegrationAccountsWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "IntegrationAccountCertificateInner", ">", ">", ",", "Page", "<", "IntegrationAccountCertificateInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "IntegrationAccountCertificateInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "IntegrationAccountCertificateInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a list of integration account certificates. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;IntegrationAccountCertificateInner&gt; object
[ "Gets", "a", "list", "of", "integration", "account", "certificates", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java#L135-L143
vkostyukov/la4j
src/main/java/org/la4j/Vector.java
Vector.mkString
public String mkString(NumberFormat formatter, String delimiter) { """ Converts this vector into the string representation. @param formatter the number formatter @param delimiter the element's delimiter @return the vector converted to a string """ StringBuilder sb = new StringBuilder(); VectorIterator it = iterator(); while (it.hasNext()) { double x = it.next(); int i = it.index(); sb.append(formatter.format(x)) .append((i < length - 1 ? delimiter : "")); } return sb.toString(); }
java
public String mkString(NumberFormat formatter, String delimiter) { StringBuilder sb = new StringBuilder(); VectorIterator it = iterator(); while (it.hasNext()) { double x = it.next(); int i = it.index(); sb.append(formatter.format(x)) .append((i < length - 1 ? delimiter : "")); } return sb.toString(); }
[ "public", "String", "mkString", "(", "NumberFormat", "formatter", ",", "String", "delimiter", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "VectorIterator", "it", "=", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "double", "x", "=", "it", ".", "next", "(", ")", ";", "int", "i", "=", "it", ".", "index", "(", ")", ";", "sb", ".", "append", "(", "formatter", ".", "format", "(", "x", ")", ")", ".", "append", "(", "(", "i", "<", "length", "-", "1", "?", "delimiter", ":", "\"\"", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Converts this vector into the string representation. @param formatter the number formatter @param delimiter the element's delimiter @return the vector converted to a string
[ "Converts", "this", "vector", "into", "the", "string", "representation", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L849-L861
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java
TreeEditDistance.preorderTreeDepth
private void preorderTreeDepth(INode root, HashMap<INode, Integer> order, HashMap<INode, Integer> depth) { """ Implementing method "preorder_tree_depth" by Gabriel Valiente: See http://www.lsi.upc.es/~valiente/algorithm/combin.cpp @param root root @param order order @param depth depth """ order.clear(); depth.clear(); int num = 1; Deque<INode> stack = new ArrayDeque<INode>(); stack.push(root); while (!stack.isEmpty()) { INode v = stack.pop(); order.put(v, num++); if (!v.hasParent()) { depth.put(v, 0); } else { depth.put(v, depth.get(v.getParent()) + 1); } for (int i = v.getChildCount() - 1; i >= 0; i--) { stack.push(v.getChildAt(i)); } } }
java
private void preorderTreeDepth(INode root, HashMap<INode, Integer> order, HashMap<INode, Integer> depth) { order.clear(); depth.clear(); int num = 1; Deque<INode> stack = new ArrayDeque<INode>(); stack.push(root); while (!stack.isEmpty()) { INode v = stack.pop(); order.put(v, num++); if (!v.hasParent()) { depth.put(v, 0); } else { depth.put(v, depth.get(v.getParent()) + 1); } for (int i = v.getChildCount() - 1; i >= 0; i--) { stack.push(v.getChildAt(i)); } } }
[ "private", "void", "preorderTreeDepth", "(", "INode", "root", ",", "HashMap", "<", "INode", ",", "Integer", ">", "order", ",", "HashMap", "<", "INode", ",", "Integer", ">", "depth", ")", "{", "order", ".", "clear", "(", ")", ";", "depth", ".", "clear", "(", ")", ";", "int", "num", "=", "1", ";", "Deque", "<", "INode", ">", "stack", "=", "new", "ArrayDeque", "<", "INode", ">", "(", ")", ";", "stack", ".", "push", "(", "root", ")", ";", "while", "(", "!", "stack", ".", "isEmpty", "(", ")", ")", "{", "INode", "v", "=", "stack", ".", "pop", "(", ")", ";", "order", ".", "put", "(", "v", ",", "num", "++", ")", ";", "if", "(", "!", "v", ".", "hasParent", "(", ")", ")", "{", "depth", ".", "put", "(", "v", ",", "0", ")", ";", "}", "else", "{", "depth", ".", "put", "(", "v", ",", "depth", ".", "get", "(", "v", ".", "getParent", "(", ")", ")", "+", "1", ")", ";", "}", "for", "(", "int", "i", "=", "v", ".", "getChildCount", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "stack", ".", "push", "(", "v", ".", "getChildAt", "(", "i", ")", ")", ";", "}", "}", "}" ]
Implementing method "preorder_tree_depth" by Gabriel Valiente: See http://www.lsi.upc.es/~valiente/algorithm/combin.cpp @param root root @param order order @param depth depth
[ "Implementing", "method", "preorder_tree_depth", "by", "Gabriel", "Valiente", ":", "See", "http", ":", "//", "www", ".", "lsi", ".", "upc", ".", "es", "/", "~valiente", "/", "algorithm", "/", "combin", ".", "cpp" ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java#L395-L417
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
PersistenceBrokerImpl.setFKField
private void setFKField(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject) { """ Set the FK value on the target object, extracted from the referenced object. If the referenced object was <i>null</i> the FK values were set to <i>null</i>, expect when the FK field was declared as PK. @param targetObject real (non-proxy) target object @param cld {@link ClassDescriptor} of the real target object @param rds An {@link ObjectReferenceDescriptor} or {@link CollectionDescriptor} @param referencedObject The referenced object or <i>null</i> """ ValueContainer[] refPkValues; FieldDescriptor fld; FieldDescriptor[] objFkFields = rds.getForeignKeyFieldDescriptors(cld); if (objFkFields == null) { throw new PersistenceBrokerException("No foreign key fields defined for class '"+cld.getClassNameOfObject()+"'"); } if(referencedObject == null) { refPkValues = null; } else { Class refClass = proxyFactory.getRealClass(referencedObject); ClassDescriptor refCld = getClassDescriptor(refClass); refPkValues = brokerHelper.getKeyValues(refCld, referencedObject, false); } for (int i = 0; i < objFkFields.length; i++) { fld = objFkFields[i]; /* arminw: we set the FK value when the extracted PK fields from the referenced object are not null at all or if null, the FK field was not a PK field of target object too. Should be ok, because the values of the extracted PK field values should never be null and never change, so it doesn't matter if the target field is a PK too. */ if(refPkValues != null || !fld.isPrimaryKey()) { fld.getPersistentField().set(targetObject, refPkValues != null ? refPkValues[i].getValue(): null); } } }
java
private void setFKField(Object targetObject, ClassDescriptor cld, ObjectReferenceDescriptor rds, Object referencedObject) { ValueContainer[] refPkValues; FieldDescriptor fld; FieldDescriptor[] objFkFields = rds.getForeignKeyFieldDescriptors(cld); if (objFkFields == null) { throw new PersistenceBrokerException("No foreign key fields defined for class '"+cld.getClassNameOfObject()+"'"); } if(referencedObject == null) { refPkValues = null; } else { Class refClass = proxyFactory.getRealClass(referencedObject); ClassDescriptor refCld = getClassDescriptor(refClass); refPkValues = brokerHelper.getKeyValues(refCld, referencedObject, false); } for (int i = 0; i < objFkFields.length; i++) { fld = objFkFields[i]; /* arminw: we set the FK value when the extracted PK fields from the referenced object are not null at all or if null, the FK field was not a PK field of target object too. Should be ok, because the values of the extracted PK field values should never be null and never change, so it doesn't matter if the target field is a PK too. */ if(refPkValues != null || !fld.isPrimaryKey()) { fld.getPersistentField().set(targetObject, refPkValues != null ? refPkValues[i].getValue(): null); } } }
[ "private", "void", "setFKField", "(", "Object", "targetObject", ",", "ClassDescriptor", "cld", ",", "ObjectReferenceDescriptor", "rds", ",", "Object", "referencedObject", ")", "{", "ValueContainer", "[", "]", "refPkValues", ";", "FieldDescriptor", "fld", ";", "FieldDescriptor", "[", "]", "objFkFields", "=", "rds", ".", "getForeignKeyFieldDescriptors", "(", "cld", ")", ";", "if", "(", "objFkFields", "==", "null", ")", "{", "throw", "new", "PersistenceBrokerException", "(", "\"No foreign key fields defined for class '\"", "+", "cld", ".", "getClassNameOfObject", "(", ")", "+", "\"'\"", ")", ";", "}", "if", "(", "referencedObject", "==", "null", ")", "{", "refPkValues", "=", "null", ";", "}", "else", "{", "Class", "refClass", "=", "proxyFactory", ".", "getRealClass", "(", "referencedObject", ")", ";", "ClassDescriptor", "refCld", "=", "getClassDescriptor", "(", "refClass", ")", ";", "refPkValues", "=", "brokerHelper", ".", "getKeyValues", "(", "refCld", ",", "referencedObject", ",", "false", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "objFkFields", ".", "length", ";", "i", "++", ")", "{", "fld", "=", "objFkFields", "[", "i", "]", ";", "/*\n arminw:\n we set the FK value when the extracted PK fields from the referenced object are not null at all\n or if null, the FK field was not a PK field of target object too.\n Should be ok, because the values of the extracted PK field values should never be null and never\n change, so it doesn't matter if the target field is a PK too.\n */", "if", "(", "refPkValues", "!=", "null", "||", "!", "fld", ".", "isPrimaryKey", "(", ")", ")", "{", "fld", ".", "getPersistentField", "(", ")", ".", "set", "(", "targetObject", ",", "refPkValues", "!=", "null", "?", "refPkValues", "[", "i", "]", ".", "getValue", "(", ")", ":", "null", ")", ";", "}", "}", "}" ]
Set the FK value on the target object, extracted from the referenced object. If the referenced object was <i>null</i> the FK values were set to <i>null</i>, expect when the FK field was declared as PK. @param targetObject real (non-proxy) target object @param cld {@link ClassDescriptor} of the real target object @param rds An {@link ObjectReferenceDescriptor} or {@link CollectionDescriptor} @param referencedObject The referenced object or <i>null</i>
[ "Set", "the", "FK", "value", "on", "the", "target", "object", "extracted", "from", "the", "referenced", "object", ".", "If", "the", "referenced", "object", "was", "<i", ">", "null<", "/", "i", ">", "the", "FK", "values", "were", "set", "to", "<i", ">", "null<", "/", "i", ">", "expect", "when", "the", "FK", "field", "was", "declared", "as", "PK", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java#L1255-L1289
dmerkushov/log-helper
src/main/java/ru/dmerkushov/loghelper/LoggerWrapper.java
LoggerWrapper.logDomNode
public void logDomNode (String msg, Node node, Level level, StackTraceElement caller) { """ Log a DOM node at a given logging level and a specified caller @param msg The message to show with the node, or null if no message needed @param node @param level @param caller The caller's stack trace element @see ru.dmerkushov.loghelper.StackTraceUtils#getMyStackTraceElement() """ String toLog = (msg != null ? msg + "\n" : "DOM node:\n") + domNodeDescription (node, 0); if (caller != null) { logger.logp (level, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), toLog); } else { logger.logp (level, "(UnknownSourceClass)", "(unknownSourceMethod)", toLog); } }
java
public void logDomNode (String msg, Node node, Level level, StackTraceElement caller) { String toLog = (msg != null ? msg + "\n" : "DOM node:\n") + domNodeDescription (node, 0); if (caller != null) { logger.logp (level, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), toLog); } else { logger.logp (level, "(UnknownSourceClass)", "(unknownSourceMethod)", toLog); } }
[ "public", "void", "logDomNode", "(", "String", "msg", ",", "Node", "node", ",", "Level", "level", ",", "StackTraceElement", "caller", ")", "{", "String", "toLog", "=", "(", "msg", "!=", "null", "?", "msg", "+", "\"\\n\"", ":", "\"DOM node:\\n\"", ")", "+", "domNodeDescription", "(", "node", ",", "0", ")", ";", "if", "(", "caller", "!=", "null", ")", "{", "logger", ".", "logp", "(", "level", ",", "caller", ".", "getClassName", "(", ")", ",", "caller", ".", "getMethodName", "(", ")", "+", "\"():\"", "+", "caller", ".", "getLineNumber", "(", ")", ",", "toLog", ")", ";", "}", "else", "{", "logger", ".", "logp", "(", "level", ",", "\"(UnknownSourceClass)\"", ",", "\"(unknownSourceMethod)\"", ",", "toLog", ")", ";", "}", "}" ]
Log a DOM node at a given logging level and a specified caller @param msg The message to show with the node, or null if no message needed @param node @param level @param caller The caller's stack trace element @see ru.dmerkushov.loghelper.StackTraceUtils#getMyStackTraceElement()
[ "Log", "a", "DOM", "node", "at", "a", "given", "logging", "level", "and", "a", "specified", "caller" ]
train
https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LoggerWrapper.java#L466-L474
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java
StringConcatenation.appendSegments
protected void appendSegments(String indentation, int index, List<String> otherSegments, String otherDelimiter) { """ Add the list of segments to this sequence at the given index. The given indentation will be prepended to each line except the first one if the object has a multi-line string representation. @param indentation the indentation string that should be prepended. May not be <code>null</code>. @param index the index in this instance's list of segments. @param otherSegments the to-be-appended segments. May not be <code>null</code>. @param otherDelimiter the line delimiter that was used in the otherSegments list. """ if (otherSegments.isEmpty()) { return; } // This may not be accurate, but it's better than nothing growSegments(otherSegments.size()); for (String otherSegment : otherSegments) { if (otherDelimiter.equals(otherSegment)) { segments.add(index++, lineDelimiter); segments.add(index++, indentation); } else { segments.add(index++, otherSegment); } } cachedToString = null; }
java
protected void appendSegments(String indentation, int index, List<String> otherSegments, String otherDelimiter) { if (otherSegments.isEmpty()) { return; } // This may not be accurate, but it's better than nothing growSegments(otherSegments.size()); for (String otherSegment : otherSegments) { if (otherDelimiter.equals(otherSegment)) { segments.add(index++, lineDelimiter); segments.add(index++, indentation); } else { segments.add(index++, otherSegment); } } cachedToString = null; }
[ "protected", "void", "appendSegments", "(", "String", "indentation", ",", "int", "index", ",", "List", "<", "String", ">", "otherSegments", ",", "String", "otherDelimiter", ")", "{", "if", "(", "otherSegments", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "// This may not be accurate, but it's better than nothing", "growSegments", "(", "otherSegments", ".", "size", "(", ")", ")", ";", "for", "(", "String", "otherSegment", ":", "otherSegments", ")", "{", "if", "(", "otherDelimiter", ".", "equals", "(", "otherSegment", ")", ")", "{", "segments", ".", "add", "(", "index", "++", ",", "lineDelimiter", ")", ";", "segments", ".", "add", "(", "index", "++", ",", "indentation", ")", ";", "}", "else", "{", "segments", ".", "add", "(", "index", "++", ",", "otherSegment", ")", ";", "}", "}", "cachedToString", "=", "null", ";", "}" ]
Add the list of segments to this sequence at the given index. The given indentation will be prepended to each line except the first one if the object has a multi-line string representation. @param indentation the indentation string that should be prepended. May not be <code>null</code>. @param index the index in this instance's list of segments. @param otherSegments the to-be-appended segments. May not be <code>null</code>. @param otherDelimiter the line delimiter that was used in the otherSegments list.
[ "Add", "the", "list", "of", "segments", "to", "this", "sequence", "at", "the", "given", "index", ".", "The", "given", "indentation", "will", "be", "prepended", "to", "each", "line", "except", "the", "first", "one", "if", "the", "object", "has", "a", "multi", "-", "line", "string", "representation", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java#L376-L392
KyoriPowered/text
api/src/main/java/net/kyori/text/event/ClickEvent.java
ClickEvent.openFile
public static @NonNull ClickEvent openFile(final @NonNull String file) { """ Creates a click event that opens a file. <p>This action is not readable, and may only be used locally on the client.</p> @param file the file to open @return a click event """ return new ClickEvent(Action.OPEN_FILE, file); }
java
public static @NonNull ClickEvent openFile(final @NonNull String file) { return new ClickEvent(Action.OPEN_FILE, file); }
[ "public", "static", "@", "NonNull", "ClickEvent", "openFile", "(", "final", "@", "NonNull", "String", "file", ")", "{", "return", "new", "ClickEvent", "(", "Action", ".", "OPEN_FILE", ",", "file", ")", ";", "}" ]
Creates a click event that opens a file. <p>This action is not readable, and may only be used locally on the client.</p> @param file the file to open @return a click event
[ "Creates", "a", "click", "event", "that", "opens", "a", "file", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/ClickEvent.java#L66-L68
finmath/finmath-lib
src/main/java6/net/finmath/functions/AnalyticFormulas.java
AnalyticFormulas.margrabeExchangeOptionValue
public static double margrabeExchangeOptionValue( double spot1, double spot2, double volatility1, double volatility2, double correlation, double optionMaturity) { """ Calculates the value of an Exchange option under a generalized Black-Scholes model, i.e., the payoff \( max(S_{1}(T)-S_{2}(T),0) \), where \( S_{1} \) and \( S_{2} \) follow a log-normal process with constant log-volatility and constant instantaneous correlation. The method also handles cases where the forward and/or option strike is negative and some limit cases where the forward and/or the option strike is zero. @param spot1 Value of \( S_{1}(0) \) @param spot2 Value of \( S_{2}(0) \) @param volatility1 Volatility of \( \log(S_{1}(t)) \) @param volatility2 Volatility of \( \log(S_{2}(t)) \) @param correlation Instantaneous correlation of \( \log(S_{1}(t)) \) and \( \log(S_{2}(t)) \) @param optionMaturity The option maturity \( T \). @return Returns the value of a European exchange option under the Black-Scholes model. """ double volatility = Math.sqrt(volatility1*volatility1 + volatility2*volatility2 - 2.0 * volatility1*volatility2*correlation); return blackScholesGeneralizedOptionValue(spot1, volatility, optionMaturity, spot2, 1.0); }
java
public static double margrabeExchangeOptionValue( double spot1, double spot2, double volatility1, double volatility2, double correlation, double optionMaturity) { double volatility = Math.sqrt(volatility1*volatility1 + volatility2*volatility2 - 2.0 * volatility1*volatility2*correlation); return blackScholesGeneralizedOptionValue(spot1, volatility, optionMaturity, spot2, 1.0); }
[ "public", "static", "double", "margrabeExchangeOptionValue", "(", "double", "spot1", ",", "double", "spot2", ",", "double", "volatility1", ",", "double", "volatility2", ",", "double", "correlation", ",", "double", "optionMaturity", ")", "{", "double", "volatility", "=", "Math", ".", "sqrt", "(", "volatility1", "*", "volatility1", "+", "volatility2", "*", "volatility2", "-", "2.0", "*", "volatility1", "*", "volatility2", "*", "correlation", ")", ";", "return", "blackScholesGeneralizedOptionValue", "(", "spot1", ",", "volatility", ",", "optionMaturity", ",", "spot2", ",", "1.0", ")", ";", "}" ]
Calculates the value of an Exchange option under a generalized Black-Scholes model, i.e., the payoff \( max(S_{1}(T)-S_{2}(T),0) \), where \( S_{1} \) and \( S_{2} \) follow a log-normal process with constant log-volatility and constant instantaneous correlation. The method also handles cases where the forward and/or option strike is negative and some limit cases where the forward and/or the option strike is zero. @param spot1 Value of \( S_{1}(0) \) @param spot2 Value of \( S_{2}(0) \) @param volatility1 Volatility of \( \log(S_{1}(t)) \) @param volatility2 Volatility of \( \log(S_{2}(t)) \) @param correlation Instantaneous correlation of \( \log(S_{1}(t)) \) and \( \log(S_{2}(t)) \) @param optionMaturity The option maturity \( T \). @return Returns the value of a European exchange option under the Black-Scholes model.
[ "Calculates", "the", "value", "of", "an", "Exchange", "option", "under", "a", "generalized", "Black", "-", "Scholes", "model", "i", ".", "e", ".", "the", "payoff", "\\", "(", "max", "(", "S_", "{", "1", "}", "(", "T", ")", "-", "S_", "{", "2", "}", "(", "T", ")", "0", ")", "\\", ")", "where", "\\", "(", "S_", "{", "1", "}", "\\", ")", "and", "\\", "(", "S_", "{", "2", "}", "\\", ")", "follow", "a", "log", "-", "normal", "process", "with", "constant", "log", "-", "volatility", "and", "constant", "instantaneous", "correlation", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/functions/AnalyticFormulas.java#L756-L766
powermock/powermock
powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java
PowerMockito.mockStatic
public static void mockStatic(Class<?> classMock, @SuppressWarnings("rawtypes") Answer defaultAnswer) { """ Creates class mock with a specified strategy for its answers to interactions. It's quite advanced feature and typically you don't need it to write decent tests. However it can be helpful when working with legacy systems. <p> It is the default answer so it will be used <b>only when you don't</b> stub the method call. <p> <pre> mockStatic(Foo.class, RETURNS_SMART_NULLS); mockStatic(Foo.class, new YourOwnAnswer()); </pre> @param classMock class to mock @param defaultAnswer default answer for unstubbed methods """ mockStatic(classMock, withSettings().defaultAnswer(defaultAnswer)); }
java
public static void mockStatic(Class<?> classMock, @SuppressWarnings("rawtypes") Answer defaultAnswer) { mockStatic(classMock, withSettings().defaultAnswer(defaultAnswer)); }
[ "public", "static", "void", "mockStatic", "(", "Class", "<", "?", ">", "classMock", ",", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "Answer", "defaultAnswer", ")", "{", "mockStatic", "(", "classMock", ",", "withSettings", "(", ")", ".", "defaultAnswer", "(", "defaultAnswer", ")", ")", ";", "}" ]
Creates class mock with a specified strategy for its answers to interactions. It's quite advanced feature and typically you don't need it to write decent tests. However it can be helpful when working with legacy systems. <p> It is the default answer so it will be used <b>only when you don't</b> stub the method call. <p> <pre> mockStatic(Foo.class, RETURNS_SMART_NULLS); mockStatic(Foo.class, new YourOwnAnswer()); </pre> @param classMock class to mock @param defaultAnswer default answer for unstubbed methods
[ "Creates", "class", "mock", "with", "a", "specified", "strategy", "for", "its", "answers", "to", "interactions", ".", "It", "s", "quite", "advanced", "feature", "and", "typically", "you", "don", "t", "need", "it", "to", "write", "decent", "tests", ".", "However", "it", "can", "be", "helpful", "when", "working", "with", "legacy", "systems", ".", "<p", ">", "It", "is", "the", "default", "answer", "so", "it", "will", "be", "used", "<b", ">", "only", "when", "you", "don", "t<", "/", "b", ">", "stub", "the", "method", "call", ".", "<p", ">", "<pre", ">", "mockStatic", "(", "Foo", ".", "class", "RETURNS_SMART_NULLS", ")", ";", "mockStatic", "(", "Foo", ".", "class", "new", "YourOwnAnswer", "()", ")", ";", "<", "/", "pre", ">" ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-mockito2/src/main/java/org/powermock/api/mockito/PowerMockito.java#L87-L89
zeroturnaround/zt-exec
src/main/java/org/zeroturnaround/exec/close/ExceptionUtil.java
ExceptionUtil.addSuppressed
public static void addSuppressed(Throwable t, Throwable suppressed) { """ If supported. appends the specified exception to the exceptions that were suppressed in order to deliver this exception. """ if (METHOD_ADD_SUPPRESSED != null) { try { METHOD_ADD_SUPPRESSED.invoke(t, suppressed); } catch (Exception e) { throw new IllegalStateException("Could not add suppressed exception:", e); } } }
java
public static void addSuppressed(Throwable t, Throwable suppressed) { if (METHOD_ADD_SUPPRESSED != null) { try { METHOD_ADD_SUPPRESSED.invoke(t, suppressed); } catch (Exception e) { throw new IllegalStateException("Could not add suppressed exception:", e); } } }
[ "public", "static", "void", "addSuppressed", "(", "Throwable", "t", ",", "Throwable", "suppressed", ")", "{", "if", "(", "METHOD_ADD_SUPPRESSED", "!=", "null", ")", "{", "try", "{", "METHOD_ADD_SUPPRESSED", ".", "invoke", "(", "t", ",", "suppressed", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not add suppressed exception:\"", ",", "e", ")", ";", "}", "}", "}" ]
If supported. appends the specified exception to the exceptions that were suppressed in order to deliver this exception.
[ "If", "supported", ".", "appends", "the", "specified", "exception", "to", "the", "exceptions", "that", "were", "suppressed", "in", "order", "to", "deliver", "this", "exception", "." ]
train
https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/close/ExceptionUtil.java#L25-L34
structr/structr
structr-ui/src/main/java/org/structr/web/datasource/RestDataSource.java
RestDataSource.parseInt
private static int parseInt(String value, int defaultValue) { """ Tries to parse the given String to an int value, returning defaultValue on error. @param value the source String to parse @param defaultValue the default value that will be returned when parsing fails @return the parsed value or the given default value when parsing fails """ if (value == null) { return defaultValue; } try { return Integer.parseInt(value); } catch (Throwable ignore) {} return defaultValue; }
java
private static int parseInt(String value, int defaultValue) { if (value == null) { return defaultValue; } try { return Integer.parseInt(value); } catch (Throwable ignore) {} return defaultValue; }
[ "private", "static", "int", "parseInt", "(", "String", "value", ",", "int", "defaultValue", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "try", "{", "return", "Integer", ".", "parseInt", "(", "value", ")", ";", "}", "catch", "(", "Throwable", "ignore", ")", "{", "}", "return", "defaultValue", ";", "}" ]
Tries to parse the given String to an int value, returning defaultValue on error. @param value the source String to parse @param defaultValue the default value that will be returned when parsing fails @return the parsed value or the given default value when parsing fails
[ "Tries", "to", "parse", "the", "given", "String", "to", "an", "int", "value", "returning", "defaultValue", "on", "error", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/datasource/RestDataSource.java#L230-L243
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.createEnumClasses
private static List<Class<?>> createEnumClasses(Map<String, EnumElement> enumTypes, Map<String, String> packageMapping, boolean generateSouceOnly, File sourceOutputDir, Set<String> compiledClass, Map<String, String> mappedUniName, boolean isUniName) { """ Creates the enum classes. @param enumTypes the enum types @param packageMapping the package mapping @param generateSouceOnly the generate souce only @param sourceOutputDir the source output dir @param compiledClass the compiled class @param mappedUniName the mapped uni name @param isUniName the is uni name @return the list """ List<Class<?>> ret = new ArrayList<Class<?>>(); Set<String> enumNames = new HashSet<String>(); Collection<EnumElement> enums = enumTypes.values(); for (EnumElement enumType : enums) { String name = enumType.name(); if (enumNames.contains(name)) { continue; } enumNames.add(name); String packageName = packageMapping.get(name); Class cls = checkClass(packageName, enumType, mappedUniName, isUniName); if (cls != null) { ret.add(cls); continue; } CodeDependent codeDependent = createCodeByType(enumType, true, packageName, mappedUniName, isUniName); compiledClass.add(codeDependent.name); compiledClass.add(packageName + PACKAGE_SPLIT_CHAR + codeDependent.name); if (!generateSouceOnly) { Class<?> newClass = JDKCompilerHelper.getJdkCompiler().compile(codeDependent.getClassName(), codeDependent.code, ProtobufIDLProxy.class.getClassLoader(), null, -1); ret.add(newClass); } else { // need to output source code to target path writeSourceCode(codeDependent, sourceOutputDir); } } return ret; }
java
private static List<Class<?>> createEnumClasses(Map<String, EnumElement> enumTypes, Map<String, String> packageMapping, boolean generateSouceOnly, File sourceOutputDir, Set<String> compiledClass, Map<String, String> mappedUniName, boolean isUniName) { List<Class<?>> ret = new ArrayList<Class<?>>(); Set<String> enumNames = new HashSet<String>(); Collection<EnumElement> enums = enumTypes.values(); for (EnumElement enumType : enums) { String name = enumType.name(); if (enumNames.contains(name)) { continue; } enumNames.add(name); String packageName = packageMapping.get(name); Class cls = checkClass(packageName, enumType, mappedUniName, isUniName); if (cls != null) { ret.add(cls); continue; } CodeDependent codeDependent = createCodeByType(enumType, true, packageName, mappedUniName, isUniName); compiledClass.add(codeDependent.name); compiledClass.add(packageName + PACKAGE_SPLIT_CHAR + codeDependent.name); if (!generateSouceOnly) { Class<?> newClass = JDKCompilerHelper.getJdkCompiler().compile(codeDependent.getClassName(), codeDependent.code, ProtobufIDLProxy.class.getClassLoader(), null, -1); ret.add(newClass); } else { // need to output source code to target path writeSourceCode(codeDependent, sourceOutputDir); } } return ret; }
[ "private", "static", "List", "<", "Class", "<", "?", ">", ">", "createEnumClasses", "(", "Map", "<", "String", ",", "EnumElement", ">", "enumTypes", ",", "Map", "<", "String", ",", "String", ">", "packageMapping", ",", "boolean", "generateSouceOnly", ",", "File", "sourceOutputDir", ",", "Set", "<", "String", ">", "compiledClass", ",", "Map", "<", "String", ",", "String", ">", "mappedUniName", ",", "boolean", "isUniName", ")", "{", "List", "<", "Class", "<", "?", ">", ">", "ret", "=", "new", "ArrayList", "<", "Class", "<", "?", ">", ">", "(", ")", ";", "Set", "<", "String", ">", "enumNames", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "Collection", "<", "EnumElement", ">", "enums", "=", "enumTypes", ".", "values", "(", ")", ";", "for", "(", "EnumElement", "enumType", ":", "enums", ")", "{", "String", "name", "=", "enumType", ".", "name", "(", ")", ";", "if", "(", "enumNames", ".", "contains", "(", "name", ")", ")", "{", "continue", ";", "}", "enumNames", ".", "add", "(", "name", ")", ";", "String", "packageName", "=", "packageMapping", ".", "get", "(", "name", ")", ";", "Class", "cls", "=", "checkClass", "(", "packageName", ",", "enumType", ",", "mappedUniName", ",", "isUniName", ")", ";", "if", "(", "cls", "!=", "null", ")", "{", "ret", ".", "add", "(", "cls", ")", ";", "continue", ";", "}", "CodeDependent", "codeDependent", "=", "createCodeByType", "(", "enumType", ",", "true", ",", "packageName", ",", "mappedUniName", ",", "isUniName", ")", ";", "compiledClass", ".", "add", "(", "codeDependent", ".", "name", ")", ";", "compiledClass", ".", "add", "(", "packageName", "+", "PACKAGE_SPLIT_CHAR", "+", "codeDependent", ".", "name", ")", ";", "if", "(", "!", "generateSouceOnly", ")", "{", "Class", "<", "?", ">", "newClass", "=", "JDKCompilerHelper", ".", "getJdkCompiler", "(", ")", ".", "compile", "(", "codeDependent", ".", "getClassName", "(", ")", ",", "codeDependent", ".", "code", ",", "ProtobufIDLProxy", ".", "class", ".", "getClassLoader", "(", ")", ",", "null", ",", "-", "1", ")", ";", "ret", ".", "add", "(", "newClass", ")", ";", "}", "else", "{", "// need to output source code to target path\r", "writeSourceCode", "(", "codeDependent", ",", "sourceOutputDir", ")", ";", "}", "}", "return", "ret", ";", "}" ]
Creates the enum classes. @param enumTypes the enum types @param packageMapping the package mapping @param generateSouceOnly the generate souce only @param sourceOutputDir the source output dir @param compiledClass the compiled class @param mappedUniName the mapped uni name @param isUniName the is uni name @return the list
[ "Creates", "the", "enum", "classes", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L848-L881
zaproxy/zaproxy
src/org/zaproxy/zap/spider/URLResolver.java
URLResolver.indexOf
private static int indexOf(final String s, final char searchChar, final int beginIndex, final int endIndex) { """ Returns the index within the specified string of the first occurrence of the specified search character. @param s the string to search @param searchChar the character to search for @param beginIndex the index at which to start the search @param endIndex the index at which to stop the search @return the index of the first occurrence of the character in the string or <tt>-1</tt> """ for (int i = beginIndex; i < endIndex; i++) { if (s.charAt(i) == searchChar) { return i; } } return -1; }
java
private static int indexOf(final String s, final char searchChar, final int beginIndex, final int endIndex) { for (int i = beginIndex; i < endIndex; i++) { if (s.charAt(i) == searchChar) { return i; } } return -1; }
[ "private", "static", "int", "indexOf", "(", "final", "String", "s", ",", "final", "char", "searchChar", ",", "final", "int", "beginIndex", ",", "final", "int", "endIndex", ")", "{", "for", "(", "int", "i", "=", "beginIndex", ";", "i", "<", "endIndex", ";", "i", "++", ")", "{", "if", "(", "s", ".", "charAt", "(", "i", ")", "==", "searchChar", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Returns the index within the specified string of the first occurrence of the specified search character. @param s the string to search @param searchChar the character to search for @param beginIndex the index at which to start the search @param endIndex the index at which to stop the search @return the index of the first occurrence of the character in the string or <tt>-1</tt>
[ "Returns", "the", "index", "within", "the", "specified", "string", "of", "the", "first", "occurrence", "of", "the", "specified", "search", "character", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/URLResolver.java#L63-L70