repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
jboss/jboss-jstl-api_spec
src/main/java/org/apache/taglibs/standard/util/XmlUtil.java
XmlUtil.newInputSource
public static InputSource newInputSource(Reader reader, String systemId) { InputSource source = new InputSource(reader); source.setSystemId(wrapSystemId(systemId)); return source; }
java
public static InputSource newInputSource(Reader reader, String systemId) { InputSource source = new InputSource(reader); source.setSystemId(wrapSystemId(systemId)); return source; }
[ "public", "static", "InputSource", "newInputSource", "(", "Reader", "reader", ",", "String", "systemId", ")", "{", "InputSource", "source", "=", "new", "InputSource", "(", "reader", ")", ";", "source", ".", "setSystemId", "(", "wrapSystemId", "(", "systemId", ...
Create an InputSource from a Reader. The systemId will be wrapped for use with JSTL's EntityResolver and UriResolver. @param reader the source of the XML @param systemId the system id @return a configured InputSource
[ "Create", "an", "InputSource", "from", "a", "Reader", "." ]
train
https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/util/XmlUtil.java#L215-L219
amaembo/streamex
src/main/java/one/util/streamex/StreamEx.java
StreamEx.cartesianPower
public static <T> StreamEx<List<T>> cartesianPower(int n, Collection<T> source) { if (n == 0) return StreamEx.of(new ConstSpliterator.OfRef<>(Collections.emptyList(), 1, true)); return of(new CrossSpliterator.ToList<>(Collections.nCopies(n, source))); }
java
public static <T> StreamEx<List<T>> cartesianPower(int n, Collection<T> source) { if (n == 0) return StreamEx.of(new ConstSpliterator.OfRef<>(Collections.emptyList(), 1, true)); return of(new CrossSpliterator.ToList<>(Collections.nCopies(n, source))); }
[ "public", "static", "<", "T", ">", "StreamEx", "<", "List", "<", "T", ">", ">", "cartesianPower", "(", "int", "n", ",", "Collection", "<", "T", ">", "source", ")", "{", "if", "(", "n", "==", "0", ")", "return", "StreamEx", ".", "of", "(", "new", ...
Returns a new {@code StreamEx} which elements are {@link List} objects containing all possible n-tuples of the elements of supplied collection. The whole stream forms an n-fold Cartesian product of input collection with itself or n-ary Cartesian power of the input collection. <p> Every stream element is the {@code List} of the supplied size. The elements are ordered lexicographically according to the order of the input collection. <p> There are no guarantees on the type, mutability, serializability, or thread-safety of the {@code List} elements. It's however guaranteed that each element is the distinct object. <p> The supplied collection is assumed to be unchanged during the operation. @param <T> the type of the elements @param n the size of the {@code List} elements of the resulting stream. @param source the input collection of collections which is used to generate the Cartesian power. @return the new stream of lists. @see #cartesianProduct(Collection) @since 0.3.8
[ "Returns", "a", "new", "{", "@code", "StreamEx", "}", "which", "elements", "are", "{", "@link", "List", "}", "objects", "containing", "all", "possible", "n", "-", "tuples", "of", "the", "elements", "of", "supplied", "collection", ".", "The", "whole", "stre...
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L3173-L3177
GenesysPureEngage/authentication-client-java
src/main/java/com/genesys/authentication/AuthenticationApi.java
AuthenticationApi.signOutPost
public ModelApiResponse signOutPost(String authorization, Boolean global) throws AuthenticationApiException { try { return authenticationApi.signOut(authorization, global); } catch (ApiException e) { throw new AuthenticationApiException("Error sign out", e); } }
java
public ModelApiResponse signOutPost(String authorization, Boolean global) throws AuthenticationApiException { try { return authenticationApi.signOut(authorization, global); } catch (ApiException e) { throw new AuthenticationApiException("Error sign out", e); } }
[ "public", "ModelApiResponse", "signOutPost", "(", "String", "authorization", ",", "Boolean", "global", ")", "throws", "AuthenticationApiException", "{", "try", "{", "return", "authenticationApi", ".", "signOut", "(", "authorization", ",", "global", ")", ";", "}", ...
Sign-out a logged in user Sign-out the current user and invalidate either the current token or all tokens associated with the user. @param authorization The OAuth 2 bearer access token you received from [/auth/v3/oauth/token](/reference/authentication/Authentication/index.html#retrieveToken). For example: \&quot;Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\&quot; (required) @param global Specifies whether to invalidate all tokens for the current user (&#x60;true&#x60;) or only the current token (&#x60;false&#x60;). (optional) @return ModelApiResponse @throws AuthenticationApiException if the call is unsuccessful.
[ "Sign", "-", "out", "a", "logged", "in", "user", "Sign", "-", "out", "the", "current", "user", "and", "invalidate", "either", "the", "current", "token", "or", "all", "tokens", "associated", "with", "the", "user", "." ]
train
https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/authentication/AuthenticationApi.java#L169-L175
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteMemberGroup
public Response deleteMemberGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/members/group/" + groupName, new HashMap<String, String>()); }
java
public Response deleteMemberGroup(String roomName, String groupName) { return restClient.delete("chatrooms/" + roomName + "/members/group/" + groupName, new HashMap<String, String>()); }
[ "public", "Response", "deleteMemberGroup", "(", "String", "roomName", ",", "String", "groupName", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/members/group/\"", "+", "groupName", ",", "new", "HashMap", "<", "...
Delete member group from chatroom. @param roomName the room name @param groupName the groupName @return the response
[ "Delete", "member", "group", "from", "chatroom", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L423-L426
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/ble/SendBuffer.java
SendBuffer.send
public void send(byte[] data, int id) { boolean isFirstPacket = (packets.size() == 0); packets.add(data); ids.add(id); if (isFirstPacket) { scheduleSendTask(true); } Log.d(TAG, "Added packet " + id + " to buffer; " + packets.size() + " packets in buffer"); }
java
public void send(byte[] data, int id) { boolean isFirstPacket = (packets.size() == 0); packets.add(data); ids.add(id); if (isFirstPacket) { scheduleSendTask(true); } Log.d(TAG, "Added packet " + id + " to buffer; " + packets.size() + " packets in buffer"); }
[ "public", "void", "send", "(", "byte", "[", "]", "data", ",", "int", "id", ")", "{", "boolean", "isFirstPacket", "=", "(", "packets", ".", "size", "(", ")", "==", "0", ")", ";", "packets", ".", "add", "(", "data", ")", ";", "ids", ".", "add", "...
Add a packet to the buffer to be sent. If no other packets are in the buffer, it will be sent immediately. @param data The packet to be sent @param id The ID of the packet to be used in debug messages and callbacks
[ "Add", "a", "packet", "to", "the", "buffer", "to", "be", "sent", ".", "If", "no", "other", "packets", "are", "in", "the", "buffer", "it", "will", "be", "sent", "immediately", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/ble/SendBuffer.java#L49-L57
snazy/ohc
ohc-core/src/main/java/org/caffinitas/ohc/linked/Timeouts.java
Timeouts.remove
void remove(long hashEntryAdr, long expireAt) { int slot = slot(expireAt); slots[slot].remove(hashEntryAdr); }
java
void remove(long hashEntryAdr, long expireAt) { int slot = slot(expireAt); slots[slot].remove(hashEntryAdr); }
[ "void", "remove", "(", "long", "hashEntryAdr", ",", "long", "expireAt", ")", "{", "int", "slot", "=", "slot", "(", "expireAt", ")", ";", "slots", "[", "slot", "]", ".", "remove", "(", "hashEntryAdr", ")", ";", "}" ]
Remote a cache entry. @param hashEntryAdr address of the cache entry @param expireAt absolute expiration timestamp
[ "Remote", "a", "cache", "entry", "." ]
train
https://github.com/snazy/ohc/blob/af47142711993a3eaaf3b496332c27e2b43454e4/ohc-core/src/main/java/org/caffinitas/ohc/linked/Timeouts.java#L95-L99
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.getArgumentForFunction
static Node getArgumentForFunction(Node function, int index) { checkState(function.isFunction()); return getNthSibling( function.getSecondChild().getFirstChild(), index); }
java
static Node getArgumentForFunction(Node function, int index) { checkState(function.isFunction()); return getNthSibling( function.getSecondChild().getFirstChild(), index); }
[ "static", "Node", "getArgumentForFunction", "(", "Node", "function", ",", "int", "index", ")", "{", "checkState", "(", "function", ".", "isFunction", "(", ")", ")", ";", "return", "getNthSibling", "(", "function", ".", "getSecondChild", "(", ")", ".", "getFi...
Given the function, this returns the nth argument or null if no such parameter exists.
[ "Given", "the", "function", "this", "returns", "the", "nth", "argument", "or", "null", "if", "no", "such", "parameter", "exists", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L5210-L5214
alibaba/ARouter
arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java
Postcard.withDouble
public Postcard withDouble(@Nullable String key, double value) { mBundle.putDouble(key, value); return this; }
java
public Postcard withDouble(@Nullable String key, double value) { mBundle.putDouble(key, value); return this; }
[ "public", "Postcard", "withDouble", "(", "@", "Nullable", "String", "key", ",", "double", "value", ")", "{", "mBundle", ".", "putDouble", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a double value into the mapping of this Bundle, replacing any existing value for the given key. @param key a String, or null @param value a double @return current
[ "Inserts", "a", "double", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", "." ]
train
https://github.com/alibaba/ARouter/blob/1a06912a6e14a57112db1204b43f81c43d721732/arouter-api/src/main/java/com/alibaba/android/arouter/facade/Postcard.java#L309-L312
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java
RabinKarpHash.rollHash
private int rollHash(int hashvalue, String str, int i) { // 'roll' hash char outchar = str.charAt(str.length() - 1 - i); char inchar = str.charAt(str.length() - _block - 1 - i); hashvalue = A * hashvalue + CHAR_HASHES[inchar] - _Apowblock * CHAR_HASHES[outchar]; return hashvalue; }
java
private int rollHash(int hashvalue, String str, int i) { // 'roll' hash char outchar = str.charAt(str.length() - 1 - i); char inchar = str.charAt(str.length() - _block - 1 - i); hashvalue = A * hashvalue + CHAR_HASHES[inchar] - _Apowblock * CHAR_HASHES[outchar]; return hashvalue; }
[ "private", "int", "rollHash", "(", "int", "hashvalue", ",", "String", "str", ",", "int", "i", ")", "{", "// 'roll' hash", "char", "outchar", "=", "str", ".", "charAt", "(", "str", ".", "length", "(", ")", "-", "1", "-", "i", ")", ";", "char", "inch...
Update rolling hash values. @param hashvalue @param str @param i @return
[ "Update", "rolling", "hash", "values", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/internal/gosu/util/RabinKarpHash.java#L121-L127
rythmengine/rythmengine
src/main/java/org/rythmengine/toString/ToStringStyle.java
ToStringStyle.appendFieldStart
protected void appendFieldStart(StringBuilder buffer, String fieldName) { if (useFieldNames && fieldName != null) { buffer.append(fieldName); buffer.append(fieldNameValueSeparator); } }
java
protected void appendFieldStart(StringBuilder buffer, String fieldName) { if (useFieldNames && fieldName != null) { buffer.append(fieldName); buffer.append(fieldNameValueSeparator); } }
[ "protected", "void", "appendFieldStart", "(", "StringBuilder", "buffer", ",", "String", "fieldName", ")", "{", "if", "(", "useFieldNames", "&&", "fieldName", "!=", "null", ")", "{", "buffer", ".", "append", "(", "fieldName", ")", ";", "buffer", ".", "append"...
<p>Append to the <code>toString</code> the field start.</p> @param buffer the <code>StringBuilder</code> to populate @param fieldName the field name
[ "<p", ">", "Append", "to", "the", "<code", ">", "toString<", "/", "code", ">", "the", "field", "start", ".", "<", "/", "p", ">" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringStyle.java#L1518-L1523
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/Tesseract1.java
Tesseract1.doOCR
@Override public String doOCR(int xsize, int ysize, ByteBuffer buf, String filename, Rectangle rect, int bpp) throws TesseractException { init(); setTessVariables(); try { setImage(xsize, ysize, buf, rect, bpp); return getOCRText(filename, 1); } catch (Exception e) { logger.error(e.getMessage(), e); throw new TesseractException(e); } finally { dispose(); } }
java
@Override public String doOCR(int xsize, int ysize, ByteBuffer buf, String filename, Rectangle rect, int bpp) throws TesseractException { init(); setTessVariables(); try { setImage(xsize, ysize, buf, rect, bpp); return getOCRText(filename, 1); } catch (Exception e) { logger.error(e.getMessage(), e); throw new TesseractException(e); } finally { dispose(); } }
[ "@", "Override", "public", "String", "doOCR", "(", "int", "xsize", ",", "int", "ysize", ",", "ByteBuffer", "buf", ",", "String", "filename", ",", "Rectangle", "rect", ",", "int", "bpp", ")", "throws", "TesseractException", "{", "init", "(", ")", ";", "se...
Performs OCR operation. Use <code>SetImage</code>, (optionally) <code>SetRectangle</code>, and one or more of the <code>Get*Text</code> functions. @param xsize width of image @param ysize height of image @param buf pixel data @param filename input file name. Needed only for training and reading a UNLV zone file. @param rect the bounding rectangle defines the region of the image to be recognized. A rectangle of zero dimension or <code>null</code> indicates the whole image. @param bpp bits per pixel, represents the bit depth of the image, with 1 for binary bitmap, 8 for gray, and 24 for color RGB. @return the recognized text @throws TesseractException
[ "Performs", "OCR", "operation", ".", "Use", "<code", ">", "SetImage<", "/", "code", ">", "(", "optionally", ")", "<code", ">", "SetRectangle<", "/", "code", ">", "and", "one", "or", "more", "of", "the", "<code", ">", "Get", "*", "Text<", "/", "code", ...
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract1.java#L387-L401
signit-wesign/java-sdk
src/main/java/cn/signit/sdk/util/FastjsonDecoder.java
FastjsonDecoder.decodeAsBean
@SuppressWarnings("unchecked") public static <T> T decodeAsBean(String jsonStr,Class<?> objectClass){ return (T) JSON.parseObject(jsonStr, objectClass); }
java
@SuppressWarnings("unchecked") public static <T> T decodeAsBean(String jsonStr,Class<?> objectClass){ return (T) JSON.parseObject(jsonStr, objectClass); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "decodeAsBean", "(", "String", "jsonStr", ",", "Class", "<", "?", ">", "objectClass", ")", "{", "return", "(", "T", ")", "JSON", ".", "parseObject", "(", "jsonStr...
反序列化JSON字符串到指定的java bean对象 @param jsonStr JSON字符串 @param objectClass java bean对象字节码对象 @param <T> 泛型参数 @return java bean对象 @since 0.0.2 @author Zhanghongdong
[ "反序列化JSON字符串到指定的java", "bean对象" ]
train
https://github.com/signit-wesign/java-sdk/blob/6f3196c9d444818a953396fdaa8ffed9794d9530/src/main/java/cn/signit/sdk/util/FastjsonDecoder.java#L31-L34
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplaceManager.java
CmsWorkplaceManager.setFileViewSettings
public void setFileViewSettings(CmsObject cms, CmsRfsFileViewer fileViewSettings) throws CmsRoleViolationException { if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) { OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN); } m_fileViewSettings = fileViewSettings; // disallow modifications of this "new original" m_fileViewSettings.setFrozen(true); }
java
public void setFileViewSettings(CmsObject cms, CmsRfsFileViewer fileViewSettings) throws CmsRoleViolationException { if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_2_INITIALIZING) { OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN); } m_fileViewSettings = fileViewSettings; // disallow modifications of this "new original" m_fileViewSettings.setFrozen(true); }
[ "public", "void", "setFileViewSettings", "(", "CmsObject", "cms", ",", "CmsRfsFileViewer", "fileViewSettings", ")", "throws", "CmsRoleViolationException", "{", "if", "(", "OpenCms", ".", "getRunLevel", "(", ")", ">", "OpenCms", ".", "RUNLEVEL_2_INITIALIZING", ")", "...
Sets the system-wide file view settings for the workplace.<p> @param cms the CmsObject for ensuring security constraints. @param fileViewSettings the system-wide file view settings for the workplace to set @throws CmsRoleViolationException if the current user does not own the administrator role ({@link CmsRole#ROOT_ADMIN})
[ "Sets", "the", "system", "-", "wide", "file", "view", "settings", "for", "the", "workplace", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceManager.java#L2071-L2079
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/calendar/CalendarRecordItem.java
CalendarRecordItem.updateField
public void updateField(int iSFieldSeq, Object objData) { try { ScreenField sField = null; if (iSFieldSeq != -1) sField = m_gridScreen.getSField(this.getRelativeSField(iSFieldSeq)); if (sField != null) { this.editTargetRecord(); sField.getConverter().setData(objData); this.updateTargetRecord(); // Read this record } } catch (Exception ex) { ex.printStackTrace(); } }
java
public void updateField(int iSFieldSeq, Object objData) { try { ScreenField sField = null; if (iSFieldSeq != -1) sField = m_gridScreen.getSField(this.getRelativeSField(iSFieldSeq)); if (sField != null) { this.editTargetRecord(); sField.getConverter().setData(objData); this.updateTargetRecord(); // Read this record } } catch (Exception ex) { ex.printStackTrace(); } }
[ "public", "void", "updateField", "(", "int", "iSFieldSeq", ",", "Object", "objData", ")", "{", "try", "{", "ScreenField", "sField", "=", "null", ";", "if", "(", "iSFieldSeq", "!=", "-", "1", ")", "sField", "=", "m_gridScreen", ".", "getSField", "(", "thi...
Change the data in this field. @param iFieldSeq The field sequence to set. @param objData The new data.
[ "Change", "the", "data", "in", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/calendar/CalendarRecordItem.java#L246-L261
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/protocol/AuroraProtocol.java
AuroraProtocol.getNewProtocol
public static AuroraProtocol getNewProtocol(FailoverProxy proxy, final GlobalStateInfo globalInfo, UrlParser urlParser) { AuroraProtocol newProtocol = new AuroraProtocol(urlParser, globalInfo, proxy.lock); newProtocol.setProxy(proxy); return newProtocol; }
java
public static AuroraProtocol getNewProtocol(FailoverProxy proxy, final GlobalStateInfo globalInfo, UrlParser urlParser) { AuroraProtocol newProtocol = new AuroraProtocol(urlParser, globalInfo, proxy.lock); newProtocol.setProxy(proxy); return newProtocol; }
[ "public", "static", "AuroraProtocol", "getNewProtocol", "(", "FailoverProxy", "proxy", ",", "final", "GlobalStateInfo", "globalInfo", ",", "UrlParser", "urlParser", ")", "{", "AuroraProtocol", "newProtocol", "=", "new", "AuroraProtocol", "(", "urlParser", ",", "global...
Initialize new protocol instance. @param proxy proxy @param globalInfo server global variables information @param urlParser connection string data's @return new AuroraProtocol
[ "Initialize", "new", "protocol", "instance", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AuroraProtocol.java#L335-L340
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
AnnotationTypeRequiredMemberBuilder.buildSignature
public void buildSignature(XMLNode node, Content annotationDocTree) { annotationDocTree.addContent(writer.getSignature(currentMember)); }
java
public void buildSignature(XMLNode node, Content annotationDocTree) { annotationDocTree.addContent(writer.getSignature(currentMember)); }
[ "public", "void", "buildSignature", "(", "XMLNode", "node", ",", "Content", "annotationDocTree", ")", "{", "annotationDocTree", ".", "addContent", "(", "writer", ".", "getSignature", "(", "currentMember", ")", ")", ";", "}" ]
Build the signature. @param node the XML element that specifies which components to document @param annotationDocTree the content tree to which the documentation will be added
[ "Build", "the", "signature", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java#L179-L181
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java
Validator.validateHostImpl
static ParsedHost validateHostImpl(HostName fromHost) throws HostNameException { final String str = fromHost.toString(); HostNameParameters validationOptions = fromHost.getValidationOptions(); return validateHost(fromHost, str, validationOptions); }
java
static ParsedHost validateHostImpl(HostName fromHost) throws HostNameException { final String str = fromHost.toString(); HostNameParameters validationOptions = fromHost.getValidationOptions(); return validateHost(fromHost, str, validationOptions); }
[ "static", "ParsedHost", "validateHostImpl", "(", "HostName", "fromHost", ")", "throws", "HostNameException", "{", "final", "String", "str", "=", "fromHost", ".", "toString", "(", ")", ";", "HostNameParameters", "validationOptions", "=", "fromHost", ".", "getValidati...
So we will follow rfc 1035 and in addition allow the underscore.
[ "So", "we", "will", "follow", "rfc", "1035", "and", "in", "addition", "allow", "the", "underscore", "." ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/format/validate/Validator.java#L2426-L2430
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/util/UaaUrlUtils.java
UaaUrlUtils.findMatchingRedirectUri
public static String findMatchingRedirectUri(Collection<String> redirectUris, String requestedRedirectUri, String fallbackRedirectUri) { AntPathMatcher matcher = new AntPathMatcher(); for (String pattern : ofNullable(redirectUris).orElse(emptyList())) { if (matcher.match(pattern, requestedRedirectUri)) { return requestedRedirectUri; } } return ofNullable(fallbackRedirectUri).orElse(requestedRedirectUri); }
java
public static String findMatchingRedirectUri(Collection<String> redirectUris, String requestedRedirectUri, String fallbackRedirectUri) { AntPathMatcher matcher = new AntPathMatcher(); for (String pattern : ofNullable(redirectUris).orElse(emptyList())) { if (matcher.match(pattern, requestedRedirectUri)) { return requestedRedirectUri; } } return ofNullable(fallbackRedirectUri).orElse(requestedRedirectUri); }
[ "public", "static", "String", "findMatchingRedirectUri", "(", "Collection", "<", "String", ">", "redirectUris", ",", "String", "requestedRedirectUri", ",", "String", "fallbackRedirectUri", ")", "{", "AntPathMatcher", "matcher", "=", "new", "AntPathMatcher", "(", ")", ...
Finds and returns a matching redirect URL according to the following logic: <ul> <li>If the requstedRedirectUri matches the whitelist the requestedRedirectUri is returned</li> <li>If the whitelist is null or empty AND the fallbackRedirectUri is null, the requestedRedirectUri is returned - OPEN REDIRECT</li> <li>If the whitelist is null or empty AND the fallbackRedirectUri is not null, the fallbackRedirectUri is returned</li> </ul> @param redirectUris - a whitelist collection of ant path patterns @param requestedRedirectUri - the requested redirect URI, returned if whitelist matches or the fallbackRedirectUri is null @param fallbackRedirectUri - returned if non null and the requestedRedirectUri doesn't match the whitelist redirectUris @return a redirect URI, either the requested or fallback as described above
[ "Finds", "and", "returns", "a", "matching", "redirect", "URL", "according", "to", "the", "following", "logic", ":", "<ul", ">", "<li", ">", "If", "the", "requstedRedirectUri", "matches", "the", "whitelist", "the", "requestedRedirectUri", "is", "returned<", "/", ...
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/util/UaaUrlUtils.java#L87-L97
geomajas/geomajas-project-server
plugin/print/print/src/main/java/org/geomajas/plugin/printing/service/PrintServiceImpl.java
PrintServiceImpl.removeDocument
public Document removeDocument(String key) throws PrintingException { if (documentMap.containsKey(key)) { return documentMap.remove(key); } else { throw new PrintingException(PrintingException.DOCUMENT_NOT_FOUND, key); } }
java
public Document removeDocument(String key) throws PrintingException { if (documentMap.containsKey(key)) { return documentMap.remove(key); } else { throw new PrintingException(PrintingException.DOCUMENT_NOT_FOUND, key); } }
[ "public", "Document", "removeDocument", "(", "String", "key", ")", "throws", "PrintingException", "{", "if", "(", "documentMap", ".", "containsKey", "(", "key", ")", ")", "{", "return", "documentMap", ".", "remove", "(", "key", ")", ";", "}", "else", "{", ...
Gets a document from the service. @param key unique key to reference the document @return the document or null if no such document
[ "Gets", "a", "document", "from", "the", "service", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/service/PrintServiceImpl.java#L169-L175
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/StringHelper.java
StringHelper.isEqualIgnoreCase
public static boolean isEqualIgnoreCase(String pStr1, String pStr2) { if (pStr1 == null && pStr2 == null) { return true; } else if (pStr1 == null || pStr2 == null) { return false; } else if (pStr1.equalsIgnoreCase(pStr2)) { return true; } return false; }
java
public static boolean isEqualIgnoreCase(String pStr1, String pStr2) { if (pStr1 == null && pStr2 == null) { return true; } else if (pStr1 == null || pStr2 == null) { return false; } else if (pStr1.equalsIgnoreCase(pStr2)) { return true; } return false; }
[ "public", "static", "boolean", "isEqualIgnoreCase", "(", "String", "pStr1", ",", "String", "pStr2", ")", "{", "if", "(", "pStr1", "==", "null", "&&", "pStr2", "==", "null", ")", "{", "return", "true", ";", "}", "else", "if", "(", "pStr1", "==", "null",...
Checks if both the strings are equal for value - Not Case sensitive. @param pStr1 A String value. @param pStr2 A String value. @return boolean A boolean <code>true</code> if the Strings are equal, otherwise <code>false</code>. @see String#equalsIgnoreCase(java.lang.String)
[ "Checks", "if", "both", "the", "strings", "are", "equal", "for", "value", "-", "Not", "Case", "sensitive", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L878-L887
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigFileMonitor.java
ConfigFileMonitor.updateFileMonitor
void updateFileMonitor(Long monitorInterval, String fileMonitorType) { if (this.monitorInterval.equals(monitorInterval) && this.monitorType.equals(fileMonitorType)) { return; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Updating FileMonitor with a new monitoring interval: " + monitorInterval + " and type: " + fileMonitorType); } this.monitorInterval = monitorInterval; this.monitorType = fileMonitorType; Hashtable<String, Object> properties = getFileMonitorProperties(); serviceRegistration.setProperties(properties); }
java
void updateFileMonitor(Long monitorInterval, String fileMonitorType) { if (this.monitorInterval.equals(monitorInterval) && this.monitorType.equals(fileMonitorType)) { return; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Updating FileMonitor with a new monitoring interval: " + monitorInterval + " and type: " + fileMonitorType); } this.monitorInterval = monitorInterval; this.monitorType = fileMonitorType; Hashtable<String, Object> properties = getFileMonitorProperties(); serviceRegistration.setProperties(properties); }
[ "void", "updateFileMonitor", "(", "Long", "monitorInterval", ",", "String", "fileMonitorType", ")", "{", "if", "(", "this", ".", "monitorInterval", ".", "equals", "(", "monitorInterval", ")", "&&", "this", ".", "monitorType", ".", "equals", "(", "fileMonitorType...
Update FileMonitor service with a new monitoring interval and monitor type. Both parameters must not be <code>null</code>.
[ "Update", "FileMonitor", "service", "with", "a", "new", "monitoring", "interval", "and", "monitor", "type", ".", "Both", "parameters", "must", "not", "be", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigFileMonitor.java#L86-L100
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/mapper/JsonMapper.java
JsonMapper.fromJson
public <T> T fromJson(@Nullable String jsonString, Class<T> clazz) { if (StringUtils.isEmpty(jsonString)) { return null; } try { return mapper.readValue(jsonString, clazz); } catch (IOException e) { logger.warn("parse json string error:" + jsonString, e); return null; } }
java
public <T> T fromJson(@Nullable String jsonString, Class<T> clazz) { if (StringUtils.isEmpty(jsonString)) { return null; } try { return mapper.readValue(jsonString, clazz); } catch (IOException e) { logger.warn("parse json string error:" + jsonString, e); return null; } }
[ "public", "<", "T", ">", "T", "fromJson", "(", "@", "Nullable", "String", "jsonString", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "jsonString", ")", ")", "{", "return", "null", ";", "}", "try", "...
反序列化POJO或简单Collection如List<String>. 如果JSON字符串为Null或"null"字符串, 返回Null. 如果JSON字符串为"[]", 返回空集合. 如需反序列化复杂Collection如List<MyBean>, 请使用fromJson(String, JavaType) @see #fromJson(String, JavaType)
[ "反序列化POJO或简单Collection如List<String", ">", "." ]
train
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/mapper/JsonMapper.java#L98-L109
mikepenz/FastAdapter
library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterDiffUtil.java
FastAdapterDiffUtil.set
public static <A extends ModelAdapter<Model, Item>, Model, Item extends IItem> A set(final A adapter, DiffUtil.DiffResult result) { result.dispatchUpdatesTo(new FastAdapterListUpdateCallback<>(adapter)); return adapter; }
java
public static <A extends ModelAdapter<Model, Item>, Model, Item extends IItem> A set(final A adapter, DiffUtil.DiffResult result) { result.dispatchUpdatesTo(new FastAdapterListUpdateCallback<>(adapter)); return adapter; }
[ "public", "static", "<", "A", "extends", "ModelAdapter", "<", "Model", ",", "Item", ">", ",", "Model", ",", "Item", "extends", "IItem", ">", "A", "set", "(", "final", "A", "adapter", ",", "DiffUtil", ".", "DiffResult", "result", ")", "{", "result", "."...
Dispatches a {@link androidx.recyclerview.widget.DiffUtil.DiffResult} to the given Adapter. @param adapter the adapter to dispatch the updates to @param result the computed {@link androidx.recyclerview.widget.DiffUtil.DiffResult} @return the adapter to allow chaining
[ "Dispatches", "a", "{", "@link", "androidx", ".", "recyclerview", ".", "widget", ".", "DiffUtil", ".", "DiffResult", "}", "to", "the", "given", "Adapter", "." ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterDiffUtil.java#L107-L110
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CProductLocalServiceBaseImpl.java
CProductLocalServiceBaseImpl.getCProductByUuidAndGroupId
@Override public CProduct getCProductByUuidAndGroupId(String uuid, long groupId) throws PortalException { return cProductPersistence.findByUUID_G(uuid, groupId); }
java
@Override public CProduct getCProductByUuidAndGroupId(String uuid, long groupId) throws PortalException { return cProductPersistence.findByUUID_G(uuid, groupId); }
[ "@", "Override", "public", "CProduct", "getCProductByUuidAndGroupId", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "PortalException", "{", "return", "cProductPersistence", ".", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Returns the c product matching the UUID and group. @param uuid the c product's UUID @param groupId the primary key of the group @return the matching c product @throws PortalException if a matching c product could not be found
[ "Returns", "the", "c", "product", "matching", "the", "UUID", "and", "group", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CProductLocalServiceBaseImpl.java#L407-L411
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java
SeaGlassTextFieldUI.paintBackground
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) { context.getPainter().paintTextFieldBackground(context, g, 0, 0, c.getWidth(), c.getHeight()); // If necessary, paint the placeholder text. if (placeholderText != null && ((JTextComponent) c).getText().length() == 0 && !c.hasFocus()) { paintPlaceholderText(context, g, c); } }
java
void paintBackground(SeaGlassContext context, Graphics g, JComponent c) { context.getPainter().paintTextFieldBackground(context, g, 0, 0, c.getWidth(), c.getHeight()); // If necessary, paint the placeholder text. if (placeholderText != null && ((JTextComponent) c).getText().length() == 0 && !c.hasFocus()) { paintPlaceholderText(context, g, c); } }
[ "void", "paintBackground", "(", "SeaGlassContext", "context", ",", "Graphics", "g", ",", "JComponent", "c", ")", "{", "context", ".", "getPainter", "(", ")", ".", "paintTextFieldBackground", "(", "context", ",", "g", ",", "0", ",", "0", ",", "c", ".", "g...
DOCUMENT ME! @param context DOCUMENT ME! @param g DOCUMENT ME! @param c DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java#L458-L464
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/ChatApi.java
ChatApi.sendTypingStopped
public ApiSuccessResponse sendTypingStopped(String id, AcceptData4 acceptData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendTypingStoppedWithHttpInfo(id, acceptData); return resp.getData(); }
java
public ApiSuccessResponse sendTypingStopped(String id, AcceptData4 acceptData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendTypingStoppedWithHttpInfo(id, acceptData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "sendTypingStopped", "(", "String", "id", ",", "AcceptData4", "acceptData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "sendTypingStoppedWithHttpInfo", "(", "id", ",", "acceptData", "...
Send notification that the agent stopped typing Send notification that the agent stopped typing to the other participants in the specified chat. @param id The ID of the chat interaction. (required) @param acceptData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Send", "notification", "that", "the", "agent", "stopped", "typing", "Send", "notification", "that", "the", "agent", "stopped", "typing", "to", "the", "other", "participants", "in", "the", "specified", "chat", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L1953-L1956
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.encryptAsString
public static String encryptAsString(final SecretKey secretKey, final String plainText) throws Exception { return Base64.getEncoder().encodeToString(encryptAsBytes(secretKey, plainText)); }
java
public static String encryptAsString(final SecretKey secretKey, final String plainText) throws Exception { return Base64.getEncoder().encodeToString(encryptAsBytes(secretKey, plainText)); }
[ "public", "static", "String", "encryptAsString", "(", "final", "SecretKey", "secretKey", ",", "final", "String", "plainText", ")", "throws", "Exception", "{", "return", "Base64", ".", "getEncoder", "(", ")", ".", "encodeToString", "(", "encryptAsBytes", "(", "se...
Encrypts the specified plainText using AES-256 and returns a Base64 encoded representation of the encrypted bytes. @param secretKey the secret key to use to encrypt with @param plainText the text to encrypt @return a Base64 encoded representation of the encrypted bytes @throws Exception a number of exceptions may be thrown @since 1.3.0
[ "Encrypts", "the", "specified", "plainText", "using", "AES", "-", "256", "and", "returns", "a", "Base64", "encoded", "representation", "of", "the", "encrypted", "bytes", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L95-L97
OpenLiberty/open-liberty
dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/EndpointActivationService.java
EndpointActivationService.processAuthData
private void processAuthData(String id, Map<String, Object> activationProps) throws UnavailableException { final String filter = FilterUtils.createPropertyFilter(ID, id); ServiceReference<?> authDataRef; try { ServiceReference<?>[] authDataRefs = ConnectionFactoryService.priv.getServiceReferences(componentContext, "com.ibm.websphere.security.auth.data.AuthData", filter); if (authDataRefs == null || authDataRefs.length != 1) throw new UnavailableException("authData: " + id); authDataRef = authDataRefs[0]; } catch (Exception x) { throw new UnavailableException("authData: " + id, x); } activationProps.put(USER_NAME, authDataRef.getProperty("user")); activationProps.put(PASSWORD, authDataRef.getProperty("password")); }
java
private void processAuthData(String id, Map<String, Object> activationProps) throws UnavailableException { final String filter = FilterUtils.createPropertyFilter(ID, id); ServiceReference<?> authDataRef; try { ServiceReference<?>[] authDataRefs = ConnectionFactoryService.priv.getServiceReferences(componentContext, "com.ibm.websphere.security.auth.data.AuthData", filter); if (authDataRefs == null || authDataRefs.length != 1) throw new UnavailableException("authData: " + id); authDataRef = authDataRefs[0]; } catch (Exception x) { throw new UnavailableException("authData: " + id, x); } activationProps.put(USER_NAME, authDataRef.getProperty("user")); activationProps.put(PASSWORD, authDataRef.getProperty("password")); }
[ "private", "void", "processAuthData", "(", "String", "id", ",", "Map", "<", "String", ",", "Object", ">", "activationProps", ")", "throws", "UnavailableException", "{", "final", "String", "filter", "=", "FilterUtils", ".", "createPropertyFilter", "(", "ID", ",",...
Update the activation config properties with the userName/password of the authAlias. @param id unique identifier for an authData config element. @param activationProps activation config properties. @throws UnavailableException if the authData element is not available.
[ "Update", "the", "activation", "config", "properties", "with", "the", "userName", "/", "password", "of", "the", "authAlias", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca/src/com/ibm/ws/jca/service/EndpointActivationService.java#L436-L449
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_transpose.java
Scs_transpose.cs_transpose
public static Scs cs_transpose(Scs A, boolean values) { int p, q, j, Cp[], Ci[], n, m, Ap[], Ai[], w[]; float Cx[], Ax[]; Scs C; if (!Scs_util.CS_CSC(A)) return (null); /* check inputs */ m = A.m; n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; C = Scs_util.cs_spalloc(n, m, Ap[n], values && (Ax != null), false); /* allocate result */ w = new int[m]; /* get workspace */ Cp = C.p; Ci = C.i; Cx = C.x; for (p = 0; p < Ap[n]; p++) w[Ai[p]]++; /* row counts */ Scs_cumsum.cs_cumsum(Cp, w, m); /* row pointers */ for (j = 0; j < n; j++) { for (p = Ap[j]; p < Ap[j + 1]; p++) { Ci[q = w[Ai[p]]++] = j; /* place A(i,j) as entry C(j,i) */ if (Cx != null) Cx[q] = Ax[p]; } } return C; }
java
public static Scs cs_transpose(Scs A, boolean values) { int p, q, j, Cp[], Ci[], n, m, Ap[], Ai[], w[]; float Cx[], Ax[]; Scs C; if (!Scs_util.CS_CSC(A)) return (null); /* check inputs */ m = A.m; n = A.n; Ap = A.p; Ai = A.i; Ax = A.x; C = Scs_util.cs_spalloc(n, m, Ap[n], values && (Ax != null), false); /* allocate result */ w = new int[m]; /* get workspace */ Cp = C.p; Ci = C.i; Cx = C.x; for (p = 0; p < Ap[n]; p++) w[Ai[p]]++; /* row counts */ Scs_cumsum.cs_cumsum(Cp, w, m); /* row pointers */ for (j = 0; j < n; j++) { for (p = Ap[j]; p < Ap[j + 1]; p++) { Ci[q = w[Ai[p]]++] = j; /* place A(i,j) as entry C(j,i) */ if (Cx != null) Cx[q] = Ax[p]; } } return C; }
[ "public", "static", "Scs", "cs_transpose", "(", "Scs", "A", ",", "boolean", "values", ")", "{", "int", "p", ",", "q", ",", "j", ",", "Cp", "[", "]", ",", "Ci", "[", "]", ",", "n", ",", "m", ",", "Ap", "[", "]", ",", "Ai", "[", "]", ",", "...
Computes the transpose of a sparse matrix, C =A'; @param A column-compressed matrix @param values pattern only if false, both pattern and values otherwise @return C=A', null on error
[ "Computes", "the", "transpose", "of", "a", "sparse", "matrix", "C", "=", "A", ";" ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tfloat/Scs_transpose.java#L46-L73
eclipse/xtext-extras
org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/xtext/AbstractProjectAwareResourceDescriptionsProvider.java
AbstractProjectAwareResourceDescriptionsProvider.getResourceDescriptions
@Override public IResourceDescriptions getResourceDescriptions(ResourceSet resourceSet) { IResourceDescriptions result = super.getResourceDescriptions(resourceSet); if (compilerPhases.isIndexing(resourceSet)) { // during indexing we don't want to see any local files String projectName = getProjectName(resourceSet); if(projectName != null) { final String encodedProjectName = URI.encodeSegment(projectName, true); Predicate<URI> predicate = new Predicate<URI>() { @Override public boolean apply(URI uri) { return isProjectLocal(uri, encodedProjectName); } }; if (result instanceof IShadowedResourceDescriptions) { return new ShadowedFilteringResourceDescriptions(result, predicate); } else { return new FilteringResourceDescriptions(result, predicate); } } } return result; }
java
@Override public IResourceDescriptions getResourceDescriptions(ResourceSet resourceSet) { IResourceDescriptions result = super.getResourceDescriptions(resourceSet); if (compilerPhases.isIndexing(resourceSet)) { // during indexing we don't want to see any local files String projectName = getProjectName(resourceSet); if(projectName != null) { final String encodedProjectName = URI.encodeSegment(projectName, true); Predicate<URI> predicate = new Predicate<URI>() { @Override public boolean apply(URI uri) { return isProjectLocal(uri, encodedProjectName); } }; if (result instanceof IShadowedResourceDescriptions) { return new ShadowedFilteringResourceDescriptions(result, predicate); } else { return new FilteringResourceDescriptions(result, predicate); } } } return result; }
[ "@", "Override", "public", "IResourceDescriptions", "getResourceDescriptions", "(", "ResourceSet", "resourceSet", ")", "{", "IResourceDescriptions", "result", "=", "super", ".", "getResourceDescriptions", "(", "resourceSet", ")", ";", "if", "(", "compilerPhases", ".", ...
And if we are in the indexing phase, we don't want to see the local resources.
[ "And", "if", "we", "are", "in", "the", "indexing", "phase", "we", "don", "t", "want", "to", "see", "the", "local", "resources", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/xtext/AbstractProjectAwareResourceDescriptionsProvider.java#L43-L66
cdk/cdk
storage/inchi/src/main/java/org/openscience/cdk/graph/invariant/InChINumbersTools.java
InChINumbersTools.getUSmilesNumbers
public static long[] getUSmilesNumbers(IAtomContainer container) throws CDKException { String aux = auxInfo(container, INCHI_OPTION.RecMet, INCHI_OPTION.FixedH); return parseUSmilesNumbers(aux, container); }
java
public static long[] getUSmilesNumbers(IAtomContainer container) throws CDKException { String aux = auxInfo(container, INCHI_OPTION.RecMet, INCHI_OPTION.FixedH); return parseUSmilesNumbers(aux, container); }
[ "public", "static", "long", "[", "]", "getUSmilesNumbers", "(", "IAtomContainer", "container", ")", "throws", "CDKException", "{", "String", "aux", "=", "auxInfo", "(", "container", ",", "INCHI_OPTION", ".", "RecMet", ",", "INCHI_OPTION", ".", "FixedH", ")", "...
Obtain the InChI numbers for the input container to be used to order atoms in Universal SMILES {@cdk.cite OBoyle12}. The numbers are obtained using the fixedH and RecMet options of the InChI. All non-bridged hydrogens are labelled as 0. @param container the structure to obtain the numbers of @return the atom numbers @throws CDKException
[ "Obtain", "the", "InChI", "numbers", "for", "the", "input", "container", "to", "be", "used", "to", "order", "atoms", "in", "Universal", "SMILES", "{", "@cdk", ".", "cite", "OBoyle12", "}", ".", "The", "numbers", "are", "obtained", "using", "the", "fixedH",...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/inchi/src/main/java/org/openscience/cdk/graph/invariant/InChINumbersTools.java#L81-L84
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java
StructuredDataMessage.getFormattedMessage
@Override public String getFormattedMessage(final String[] formats) { if (formats != null && formats.length > 0) { for (int i = 0; i < formats.length; i++) { final String format = formats[i]; if (Format.XML.name().equalsIgnoreCase(format)) { return asXml(); } else if (Format.FULL.name().equalsIgnoreCase(format)) { return asString(Format.FULL, null); } } return asString(null, null); } return asString(Format.FULL, null); }
java
@Override public String getFormattedMessage(final String[] formats) { if (formats != null && formats.length > 0) { for (int i = 0; i < formats.length; i++) { final String format = formats[i]; if (Format.XML.name().equalsIgnoreCase(format)) { return asXml(); } else if (Format.FULL.name().equalsIgnoreCase(format)) { return asString(Format.FULL, null); } } return asString(null, null); } return asString(Format.FULL, null); }
[ "@", "Override", "public", "String", "getFormattedMessage", "(", "final", "String", "[", "]", "formats", ")", "{", "if", "(", "formats", "!=", "null", "&&", "formats", ".", "length", ">", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "...
Formats the message according the the specified format. @param formats An array of Strings that provide extra information about how to format the message. StructuredDataMessage accepts only a format of "FULL" which will cause the event type to be prepended and the event message to be appended. Specifying any other value will cause only the StructuredData to be included. The default is "FULL". @return the formatted message.
[ "Formats", "the", "message", "according", "the", "the", "specified", "format", ".", "@param", "formats", "An", "array", "of", "Strings", "that", "provide", "extra", "information", "about", "how", "to", "format", "the", "message", ".", "StructuredDataMessage", "a...
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java#L368-L382
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.getProp
private String getProp(Map<Object, Object> props, String key) { String value = (String) props.get(key); if (null == value) { value = (String) props.get(key.toLowerCase()); } return (null != value) ? value.trim() : null; }
java
private String getProp(Map<Object, Object> props, String key) { String value = (String) props.get(key); if (null == value) { value = (String) props.get(key.toLowerCase()); } return (null != value) ? value.trim() : null; }
[ "private", "String", "getProp", "(", "Map", "<", "Object", ",", "Object", ">", "props", ",", "String", "key", ")", "{", "String", "value", "=", "(", "String", ")", "props", ".", "get", "(", "key", ")", ";", "if", "(", "null", "==", "value", ")", ...
Access the property that may or may not exist for the given key. @param props @param key @return String
[ "Access", "the", "property", "that", "may", "or", "may", "not", "exist", "for", "the", "given", "key", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L462-L468
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/BMPSet.java
BMPSet.findCodePoint
private int findCodePoint(int c, int lo, int hi) { /* Examples: findCodePoint(c) set list[] c=0 1 3 4 7 8 === ============== =========== [] [110000] 0 0 0 0 0 0 [\u0000-\u0003] [0, 4, 110000] 1 1 1 2 2 2 [\u0004-\u0007] [4, 8, 110000] 0 0 0 1 1 2 [:Any:] [0, 110000] 1 1 1 1 1 1 */ // Return the smallest i such that c < list[i]. Assume // list[len - 1] == HIGH and that c is legal (0..HIGH-1). if (c < list[lo]) return lo; // High runner test. c is often after the last range, so an // initial check for this condition pays off. if (lo >= hi || c >= list[hi - 1]) return hi; // invariant: c >= list[lo] // invariant: c < list[hi] for (;;) { int i = (lo + hi) >>> 1; if (i == lo) { break; // Found! } else if (c < list[i]) { hi = i; } else { lo = i; } } return hi; }
java
private int findCodePoint(int c, int lo, int hi) { /* Examples: findCodePoint(c) set list[] c=0 1 3 4 7 8 === ============== =========== [] [110000] 0 0 0 0 0 0 [\u0000-\u0003] [0, 4, 110000] 1 1 1 2 2 2 [\u0004-\u0007] [4, 8, 110000] 0 0 0 1 1 2 [:Any:] [0, 110000] 1 1 1 1 1 1 */ // Return the smallest i such that c < list[i]. Assume // list[len - 1] == HIGH and that c is legal (0..HIGH-1). if (c < list[lo]) return lo; // High runner test. c is often after the last range, so an // initial check for this condition pays off. if (lo >= hi || c >= list[hi - 1]) return hi; // invariant: c >= list[lo] // invariant: c < list[hi] for (;;) { int i = (lo + hi) >>> 1; if (i == lo) { break; // Found! } else if (c < list[i]) { hi = i; } else { lo = i; } } return hi; }
[ "private", "int", "findCodePoint", "(", "int", "c", ",", "int", "lo", ",", "int", "hi", ")", "{", "/* Examples:\n findCodePoint(c)\n set list[] c=0 1 3 4 7 8\n === ============== ===========...
Same as UnicodeSet.findCodePoint(int c) except that the binary search is restricted for finding code points in a certain range. For restricting the search for finding in the range start..end, pass in lo=findCodePoint(start) and hi=findCodePoint(end) with 0<=lo<=hi<len. findCodePoint(c) defaults to lo=0 and hi=len-1. @param c a character in a subrange of MIN_VALUE..MAX_VALUE @param lo The lowest index to be returned. @param hi The highest index to be returned. @return the smallest integer i in the range lo..hi, inclusive, such that c < list[i]
[ "Same", "as", "UnicodeSet", ".", "findCodePoint", "(", "int", "c", ")", "except", "that", "the", "binary", "search", "is", "restricted", "for", "finding", "code", "points", "in", "a", "certain", "range", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/BMPSet.java#L479-L511
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringArray.java
RoaringArray.appendCopy
protected void appendCopy(RoaringArray sa, int index) { extendArray(1); this.keys[this.size] = sa.keys[index]; this.values[this.size] = sa.values[index].clone(); this.size++; }
java
protected void appendCopy(RoaringArray sa, int index) { extendArray(1); this.keys[this.size] = sa.keys[index]; this.values[this.size] = sa.values[index].clone(); this.size++; }
[ "protected", "void", "appendCopy", "(", "RoaringArray", "sa", ",", "int", "index", ")", "{", "extendArray", "(", "1", ")", ";", "this", ".", "keys", "[", "this", ".", "size", "]", "=", "sa", ".", "keys", "[", "index", "]", ";", "this", ".", "values...
Append copy of the one value from another array @param sa other array @param index index in the other array
[ "Append", "copy", "of", "the", "one", "value", "from", "another", "array" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringArray.java#L194-L199
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/retry/RetryPolicies.java
RetryPolicies.retryUpToMaximumTimeWithFixedSleep
public static final RetryPolicy retryUpToMaximumTimeWithFixedSleep(long maxTime, long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumTimeWithFixedSleep(maxTime, sleepTime, timeUnit); }
java
public static final RetryPolicy retryUpToMaximumTimeWithFixedSleep(long maxTime, long sleepTime, TimeUnit timeUnit) { return new RetryUpToMaximumTimeWithFixedSleep(maxTime, sleepTime, timeUnit); }
[ "public", "static", "final", "RetryPolicy", "retryUpToMaximumTimeWithFixedSleep", "(", "long", "maxTime", ",", "long", "sleepTime", ",", "TimeUnit", "timeUnit", ")", "{", "return", "new", "RetryUpToMaximumTimeWithFixedSleep", "(", "maxTime", ",", "sleepTime", ",", "ti...
<p> Keep trying for a maximum time, waiting a fixed time between attempts, and then fail by re-throwing the exception. </p>
[ "<p", ">", "Keep", "trying", "for", "a", "maximum", "time", "waiting", "a", "fixed", "time", "between", "attempts", "and", "then", "fail", "by", "re", "-", "throwing", "the", "exception", ".", "<", "/", "p", ">" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/retry/RetryPolicies.java#L75-L77
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteRosterEntry
public Response deleteRosterEntry(String username, String jid) { return restClient.delete("users/" + username + "/roster/" + jid, new HashMap<String, String>()); }
java
public Response deleteRosterEntry(String username, String jid) { return restClient.delete("users/" + username + "/roster/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteRosterEntry", "(", "String", "username", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"users/\"", "+", "username", "+", "\"/roster/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "Stri...
Delete roster entry. @param username the username @param jid the jid @return the response
[ "Delete", "roster", "entry", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L718-L720
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.acceptSessionFromConnectionString
public static IMessageSession acceptSessionFromConnectionString(String amqpConnectionString, String sessionId) throws InterruptedException, ServiceBusException { return acceptSessionFromConnectionString(amqpConnectionString, sessionId, DEFAULTRECEIVEMODE); }
java
public static IMessageSession acceptSessionFromConnectionString(String amqpConnectionString, String sessionId) throws InterruptedException, ServiceBusException { return acceptSessionFromConnectionString(amqpConnectionString, sessionId, DEFAULTRECEIVEMODE); }
[ "public", "static", "IMessageSession", "acceptSessionFromConnectionString", "(", "String", "amqpConnectionString", ",", "String", "sessionId", ")", "throws", "InterruptedException", ",", "ServiceBusException", "{", "return", "acceptSessionFromConnectionString", "(", "amqpConnec...
Accept a {@link IMessageSession} in default {@link ReceiveMode#PEEKLOCK} mode from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session. @param amqpConnectionString connection string @param sessionId session id, if null, service will return the first available session, otherwise, service will return specified session @return {@link IMessageSession} instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the session cannot be accepted
[ "Accept", "a", "{", "@link", "IMessageSession", "}", "in", "default", "{", "@link", "ReceiveMode#PEEKLOCK", "}", "mode", "from", "service", "bus", "connection", "string", "with", "specified", "session", "id", ".", "Session", "Id", "can", "be", "null", "if", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L485-L487
networknt/light-4j
dump/src/main/java/com/networknt/dump/UrlDumper.java
UrlDumper.putDumpInfoTo
@Override protected void putDumpInfoTo(Map<String, Object> result) { if(StringUtils.isNotBlank(this.url)) { result.put(DumpConstants.URL, this.url); } }
java
@Override protected void putDumpInfoTo(Map<String, Object> result) { if(StringUtils.isNotBlank(this.url)) { result.put(DumpConstants.URL, this.url); } }
[ "@", "Override", "protected", "void", "putDumpInfoTo", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "this", ".", "url", ")", ")", "{", "result", ".", "put", "(", "DumpConstants", "...
put this.url to result @param result a Map you want to put dumping info to.
[ "put", "this", ".", "url", "to", "result" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/UrlDumper.java#L48-L53
languagetool-org/languagetool
languagetool-core/src/main/java/org/languagetool/ResourceBundleTools.java
ResourceBundleTools.getMessageBundle
static ResourceBundle getMessageBundle(Language lang) { try { ResourceBundle bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocaleWithCountryAndVariant()); if (!isValidBundleFor(lang, bundle)) { bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocale()); if (!isValidBundleFor(lang, bundle)) { // happens if 'xx' is requested but only a MessagesBundle_xx_YY.properties exists: Language defaultVariant = lang.getDefaultLanguageVariant(); if (defaultVariant != null && defaultVariant.getCountries().length > 0) { Locale locale = new Locale(defaultVariant.getShortCode(), defaultVariant.getCountries()[0]); bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, locale); } } } ResourceBundle fallbackBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); return new ResourceBundleWithFallback(bundle, fallbackBundle); } catch (MissingResourceException e) { return ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); } }
java
static ResourceBundle getMessageBundle(Language lang) { try { ResourceBundle bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocaleWithCountryAndVariant()); if (!isValidBundleFor(lang, bundle)) { bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, lang.getLocale()); if (!isValidBundleFor(lang, bundle)) { // happens if 'xx' is requested but only a MessagesBundle_xx_YY.properties exists: Language defaultVariant = lang.getDefaultLanguageVariant(); if (defaultVariant != null && defaultVariant.getCountries().length > 0) { Locale locale = new Locale(defaultVariant.getShortCode(), defaultVariant.getCountries()[0]); bundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, locale); } } } ResourceBundle fallbackBundle = ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); return new ResourceBundleWithFallback(bundle, fallbackBundle); } catch (MissingResourceException e) { return ResourceBundle.getBundle(MESSAGE_BUNDLE, Locale.ENGLISH); } }
[ "static", "ResourceBundle", "getMessageBundle", "(", "Language", "lang", ")", "{", "try", "{", "ResourceBundle", "bundle", "=", "ResourceBundle", ".", "getBundle", "(", "MESSAGE_BUNDLE", ",", "lang", ".", "getLocaleWithCountryAndVariant", "(", ")", ")", ";", "if",...
Gets the ResourceBundle (i18n strings) for the given user interface language.
[ "Gets", "the", "ResourceBundle", "(", "i18n", "strings", ")", "for", "the", "given", "user", "interface", "language", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/ResourceBundleTools.java#L52-L71
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.getLong
public static long getLong(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 8)) { return segments[0].getLong(offset); } else { return getLongMultiSegments(segments, offset); } }
java
public static long getLong(MemorySegment[] segments, int offset) { if (inFirstSegment(segments, offset, 8)) { return segments[0].getLong(offset); } else { return getLongMultiSegments(segments, offset); } }
[ "public", "static", "long", "getLong", "(", "MemorySegment", "[", "]", "segments", ",", "int", "offset", ")", "{", "if", "(", "inFirstSegment", "(", "segments", ",", "offset", ",", "8", ")", ")", "{", "return", "segments", "[", "0", "]", ".", "getLong"...
get long from segments. @param segments target segments. @param offset value offset.
[ "get", "long", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L709-L715
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java
BitfinexSymbols.executedTrades
public static BitfinexExecutedTradeSymbol executedTrades(final String currency, final String profitCurrency) { final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase(); final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase(); return executedTrades(BitfinexCurrencyPair.of(currencyNonNull, profitCurrencyNonNull)); }
java
public static BitfinexExecutedTradeSymbol executedTrades(final String currency, final String profitCurrency) { final String currencyNonNull = Objects.requireNonNull(currency).toUpperCase(); final String profitCurrencyNonNull = Objects.requireNonNull(profitCurrency).toUpperCase(); return executedTrades(BitfinexCurrencyPair.of(currencyNonNull, profitCurrencyNonNull)); }
[ "public", "static", "BitfinexExecutedTradeSymbol", "executedTrades", "(", "final", "String", "currency", ",", "final", "String", "profitCurrency", ")", "{", "final", "String", "currencyNonNull", "=", "Objects", ".", "requireNonNull", "(", "currency", ")", ".", "toUp...
Returns symbol for candlestick channel @param currency of trades channel @param profitCurrency of trades channel @return symbol
[ "Returns", "symbol", "for", "candlestick", "channel" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/symbol/BitfinexSymbols.java#L92-L99
RuedigerMoeller/kontraktor
modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/KxReactiveStreams.java
KxReactiveStreams.newAsyncProcessor
public <IN, OUT> Processor<IN, OUT> newAsyncProcessor(Function<IN, OUT> processingFunction) { return newAsyncProcessor(processingFunction, scheduler, batchSize); }
java
public <IN, OUT> Processor<IN, OUT> newAsyncProcessor(Function<IN, OUT> processingFunction) { return newAsyncProcessor(processingFunction, scheduler, batchSize); }
[ "public", "<", "IN", ",", "OUT", ">", "Processor", "<", "IN", ",", "OUT", ">", "newAsyncProcessor", "(", "Function", "<", "IN", ",", "OUT", ">", "processingFunction", ")", "{", "return", "newAsyncProcessor", "(", "processingFunction", ",", "scheduler", ",", ...
create async processor. Usually not called directly (see EventSink+RxPublisher) @param processingFunction @param <IN> @param <OUT> @return
[ "create", "async", "processor", ".", "Usually", "not", "called", "directly", "(", "see", "EventSink", "+", "RxPublisher", ")" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/KxReactiveStreams.java#L344-L346
nlalevee/jsourcemap
jsourcemap/src/java/org/hibnet/jsourcemap/IndexedSourceMapConsumer.java
IndexedSourceMapConsumer.sourceContentFor
@Override String sourceContentFor(String aSource, Boolean nullOnMissing) { for (int i = 0; i < this._sections.size(); i++) { ParsedSection section = this._sections.get(i); String content = section.consumer.sourceContentFor(aSource, true); if (content != null) { return content; } } if (nullOnMissing != null && nullOnMissing) { return null; } else { throw new RuntimeException("\"" + aSource + "\" is not in the SourceMap."); } }
java
@Override String sourceContentFor(String aSource, Boolean nullOnMissing) { for (int i = 0; i < this._sections.size(); i++) { ParsedSection section = this._sections.get(i); String content = section.consumer.sourceContentFor(aSource, true); if (content != null) { return content; } } if (nullOnMissing != null && nullOnMissing) { return null; } else { throw new RuntimeException("\"" + aSource + "\" is not in the SourceMap."); } }
[ "@", "Override", "String", "sourceContentFor", "(", "String", "aSource", ",", "Boolean", "nullOnMissing", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "_sections", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ParsedSec...
Returns the original source content. The only argument is the url of the original source file. Returns null if no original source content is available.
[ "Returns", "the", "original", "source", "content", ".", "The", "only", "argument", "is", "the", "url", "of", "the", "original", "source", "file", ".", "Returns", "null", "if", "no", "original", "source", "content", "is", "available", "." ]
train
https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/IndexedSourceMapConsumer.java#L193-L207
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java
ReflectionUtils.getMethod
public static Optional<Method> getMethod(Class type, String methodName, Class... argTypes) { try { return Optional.of(type.getMethod(methodName, argTypes)); } catch (NoSuchMethodException e) { return findMethod(type, methodName, argTypes); } }
java
public static Optional<Method> getMethod(Class type, String methodName, Class... argTypes) { try { return Optional.of(type.getMethod(methodName, argTypes)); } catch (NoSuchMethodException e) { return findMethod(type, methodName, argTypes); } }
[ "public", "static", "Optional", "<", "Method", ">", "getMethod", "(", "Class", "type", ",", "String", "methodName", ",", "Class", "...", "argTypes", ")", "{", "try", "{", "return", "Optional", ".", "of", "(", "type", ".", "getMethod", "(", "methodName", ...
Obtains a method. @param type The type @param methodName The method name @param argTypes The argument types @return An optional {@link Method}
[ "Obtains", "a", "method", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java#L162-L168
zxing/zxing
android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java
IntentIntegrator.shareText
public final AlertDialog shareText(CharSequence text, CharSequence type) { Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setAction(BS_PACKAGE + ".ENCODE"); intent.putExtra("ENCODE_TYPE", type); intent.putExtra("ENCODE_DATA", text); String targetAppPackage = findTargetAppPackage(intent); if (targetAppPackage == null) { return showDownloadDialog(); } intent.setPackage(targetAppPackage); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(FLAG_NEW_DOC); attachMoreExtras(intent); if (fragment == null) { activity.startActivity(intent); } else { fragment.startActivity(intent); } return null; }
java
public final AlertDialog shareText(CharSequence text, CharSequence type) { Intent intent = new Intent(); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setAction(BS_PACKAGE + ".ENCODE"); intent.putExtra("ENCODE_TYPE", type); intent.putExtra("ENCODE_DATA", text); String targetAppPackage = findTargetAppPackage(intent); if (targetAppPackage == null) { return showDownloadDialog(); } intent.setPackage(targetAppPackage); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(FLAG_NEW_DOC); attachMoreExtras(intent); if (fragment == null) { activity.startActivity(intent); } else { fragment.startActivity(intent); } return null; }
[ "public", "final", "AlertDialog", "shareText", "(", "CharSequence", "text", ",", "CharSequence", "type", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", ")", ";", "intent", ".", "addCategory", "(", "Intent", ".", "CATEGORY_DEFAULT", ")", ";", "inten...
Shares the given text by encoding it as a barcode, such that another user can scan the text off the screen of the device. @param text the text string to encode as a barcode @param type type of data to encode. See {@code com.google.zxing.client.android.Contents.Type} constants. @return the {@link AlertDialog} that was shown to the user prompting them to download the app if a prompt was needed, or null otherwise
[ "Shares", "the", "given", "text", "by", "encoding", "it", "as", "a", "barcode", "such", "that", "another", "user", "can", "scan", "the", "text", "off", "the", "screen", "of", "the", "device", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android-integration/src/main/java/com/google/zxing/integration/android/IntentIntegrator.java#L461-L481
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/DeLiClu.java
DeLiClu.expandDirNodes
private void expandDirNodes(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluNode node1, DeLiCluNode node2) { if(LOG.isDebuggingFinest()) { LOG.debugFinest("ExpandDirNodes: " + node1.getPageID() + " + " + node2.getPageID()); } int numEntries_1 = node1.getNumEntries(); int numEntries_2 = node2.getNumEntries(); // insert all combinations of unhandled - handled children of // node1-node2 into pq for(int i = 0; i < numEntries_1; i++) { DeLiCluEntry entry1 = node1.getEntry(i); if(!entry1.hasUnhandled()) { continue; } for(int j = 0; j < numEntries_2; j++) { DeLiCluEntry entry2 = node2.getEntry(j); if(!entry2.hasHandled()) { continue; } double distance = distFunction.minDist(entry1, entry2); heap.add(new SpatialObjectPair(distance, entry1, entry2, true)); } } }
java
private void expandDirNodes(SpatialPrimitiveDistanceFunction<V> distFunction, DeLiCluNode node1, DeLiCluNode node2) { if(LOG.isDebuggingFinest()) { LOG.debugFinest("ExpandDirNodes: " + node1.getPageID() + " + " + node2.getPageID()); } int numEntries_1 = node1.getNumEntries(); int numEntries_2 = node2.getNumEntries(); // insert all combinations of unhandled - handled children of // node1-node2 into pq for(int i = 0; i < numEntries_1; i++) { DeLiCluEntry entry1 = node1.getEntry(i); if(!entry1.hasUnhandled()) { continue; } for(int j = 0; j < numEntries_2; j++) { DeLiCluEntry entry2 = node2.getEntry(j); if(!entry2.hasHandled()) { continue; } double distance = distFunction.minDist(entry1, entry2); heap.add(new SpatialObjectPair(distance, entry1, entry2, true)); } } }
[ "private", "void", "expandDirNodes", "(", "SpatialPrimitiveDistanceFunction", "<", "V", ">", "distFunction", ",", "DeLiCluNode", "node1", ",", "DeLiCluNode", "node2", ")", "{", "if", "(", "LOG", ".", "isDebuggingFinest", "(", ")", ")", "{", "LOG", ".", "debugF...
Expands the specified directory nodes. @param distFunction the spatial distance function of this algorithm @param node1 the first node @param node2 the second node
[ "Expands", "the", "specified", "directory", "nodes", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/optics/DeLiClu.java#L230-L254
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java
RaftServiceContext.closeSession
public void closeSession(long index, long timestamp, RaftSession session, boolean expired) { log.debug("Closing session {}", session.sessionId()); // Update the session's timestamp to prevent it from being expired. session.setLastUpdated(timestamp); // Update the state machine index/timestamp. tick(index, timestamp); // Expire sessions that have timed out. expireSessions(currentTimestamp); // Remove the session from the sessions list. if (expired) { session = sessions.removeSession(session.sessionId()); if (session != null) { session.expire(); service.expire(session.sessionId()); } } else { session = sessions.removeSession(session.sessionId()); if (session != null) { session.close(); service.close(session.sessionId()); } } // Commit the index, causing events to be sent to clients if necessary. commit(); }
java
public void closeSession(long index, long timestamp, RaftSession session, boolean expired) { log.debug("Closing session {}", session.sessionId()); // Update the session's timestamp to prevent it from being expired. session.setLastUpdated(timestamp); // Update the state machine index/timestamp. tick(index, timestamp); // Expire sessions that have timed out. expireSessions(currentTimestamp); // Remove the session from the sessions list. if (expired) { session = sessions.removeSession(session.sessionId()); if (session != null) { session.expire(); service.expire(session.sessionId()); } } else { session = sessions.removeSession(session.sessionId()); if (session != null) { session.close(); service.close(session.sessionId()); } } // Commit the index, causing events to be sent to clients if necessary. commit(); }
[ "public", "void", "closeSession", "(", "long", "index", ",", "long", "timestamp", ",", "RaftSession", "session", ",", "boolean", "expired", ")", "{", "log", ".", "debug", "(", "\"Closing session {}\"", ",", "session", ".", "sessionId", "(", ")", ")", ";", ...
Unregister the given session. @param index The index of the unregister. @param timestamp The timestamp of the unregister. @param session The session to unregister. @param expired Whether the session was expired by the leader.
[ "Unregister", "the", "given", "session", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java#L442-L471
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java
AbstractTreebankParserParams.unorderedTypedDependencyObjectify
public static Collection<List<String>> unorderedTypedDependencyObjectify(Tree t, HeadFinder hf, TreeTransformer collinizer) { return dependencyObjectify(t, hf, collinizer, new UnorderedTypedDependencyTyper(hf)); }
java
public static Collection<List<String>> unorderedTypedDependencyObjectify(Tree t, HeadFinder hf, TreeTransformer collinizer) { return dependencyObjectify(t, hf, collinizer, new UnorderedTypedDependencyTyper(hf)); }
[ "public", "static", "Collection", "<", "List", "<", "String", ">", ">", "unorderedTypedDependencyObjectify", "(", "Tree", "t", ",", "HeadFinder", "hf", ",", "TreeTransformer", "collinizer", ")", "{", "return", "dependencyObjectify", "(", "t", ",", "hf", ",", "...
Returns a collection of unordered (but directed!) typed word-word dependencies for the tree.
[ "Returns", "a", "collection", "of", "unordered", "(", "but", "directed!", ")", "typed", "word", "-", "word", "dependencies", "for", "the", "tree", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java#L365-L367
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/MapperFactory.java
MapperFactory.getMapper
public Mapper getMapper(Field field) { PropertyMapper propertyMapperAnnotation = field.getAnnotation(PropertyMapper.class); if (propertyMapperAnnotation != null) { return createCustomMapper(field, propertyMapperAnnotation); } Class<?> fieldType = field.getType(); if (fieldType.equals(BigDecimal.class)) { Decimal decimalAnnotation = field.getAnnotation(Decimal.class); if (decimalAnnotation != null) { return new DecimalMapper(decimalAnnotation.precision(), decimalAnnotation.scale()); } } if (List.class.isAssignableFrom(fieldType) || Set.class.isAssignableFrom(fieldType)) { return CollectionMapperFactory.getInstance().getMapper(field); } return getMapper(field.getGenericType()); }
java
public Mapper getMapper(Field field) { PropertyMapper propertyMapperAnnotation = field.getAnnotation(PropertyMapper.class); if (propertyMapperAnnotation != null) { return createCustomMapper(field, propertyMapperAnnotation); } Class<?> fieldType = field.getType(); if (fieldType.equals(BigDecimal.class)) { Decimal decimalAnnotation = field.getAnnotation(Decimal.class); if (decimalAnnotation != null) { return new DecimalMapper(decimalAnnotation.precision(), decimalAnnotation.scale()); } } if (List.class.isAssignableFrom(fieldType) || Set.class.isAssignableFrom(fieldType)) { return CollectionMapperFactory.getInstance().getMapper(field); } return getMapper(field.getGenericType()); }
[ "public", "Mapper", "getMapper", "(", "Field", "field", ")", "{", "PropertyMapper", "propertyMapperAnnotation", "=", "field", ".", "getAnnotation", "(", "PropertyMapper", ".", "class", ")", ";", "if", "(", "propertyMapperAnnotation", "!=", "null", ")", "{", "ret...
Returns the mapper for the given field. If the field has a custom mapper, a new instance of the specified mapper will be created and returned. Otherwise, one of the built-in mappers will be returned based on the field type. @param field the field @return the mapper for the given field.
[ "Returns", "the", "mapper", "for", "the", "given", "field", ".", "If", "the", "field", "has", "a", "custom", "mapper", "a", "new", "instance", "of", "the", "specified", "mapper", "will", "be", "created", "and", "returned", ".", "Otherwise", "one", "of", ...
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/MapperFactory.java#L116-L132
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java
WTree.handleShuffleState
private void handleShuffleState(final Request request) { String json = request.getParameter(SHUFFLE_REQUEST_KEY); if (Util.empty(json)) { return; } // New TreeItemIdNode newTree; try { newTree = TreeItemUtil.convertJsonToTree(json); } catch (Exception e) { LOG.warn("Could not parse JSON for shuffle tree items. " + e.getMessage()); return; } // Current TreeItemIdNode currentTree = getCustomTree(); boolean changed = !TreeItemUtil.isTreeSame(newTree, currentTree); if (changed) { setCustomTree(newTree); // Run the shuffle action (if set) final Action action = getShuffleAction(); if (action != null) { final ActionEvent event = new ActionEvent(this, "shuffle"); Runnable later = new Runnable() { @Override public void run() { action.execute(event); } }; invokeLater(later); } } }
java
private void handleShuffleState(final Request request) { String json = request.getParameter(SHUFFLE_REQUEST_KEY); if (Util.empty(json)) { return; } // New TreeItemIdNode newTree; try { newTree = TreeItemUtil.convertJsonToTree(json); } catch (Exception e) { LOG.warn("Could not parse JSON for shuffle tree items. " + e.getMessage()); return; } // Current TreeItemIdNode currentTree = getCustomTree(); boolean changed = !TreeItemUtil.isTreeSame(newTree, currentTree); if (changed) { setCustomTree(newTree); // Run the shuffle action (if set) final Action action = getShuffleAction(); if (action != null) { final ActionEvent event = new ActionEvent(this, "shuffle"); Runnable later = new Runnable() { @Override public void run() { action.execute(event); } }; invokeLater(later); } } }
[ "private", "void", "handleShuffleState", "(", "final", "Request", "request", ")", "{", "String", "json", "=", "request", ".", "getParameter", "(", "SHUFFLE_REQUEST_KEY", ")", ";", "if", "(", "Util", ".", "empty", "(", "json", ")", ")", "{", "return", ";", ...
Handle the tree items that have been shuffled by the client. @param request the request being processed
[ "Handle", "the", "tree", "items", "that", "have", "been", "shuffled", "by", "the", "client", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java#L952-L988
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java
RandomAccessListIterate.forEachWithIndex
public static <T> void forEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure) { int size = list.size(); for (int i = 0; i < size; i++) { objectIntProcedure.value(list.get(i), i); } }
java
public static <T> void forEachWithIndex(List<T> list, ObjectIntProcedure<? super T> objectIntProcedure) { int size = list.size(); for (int i = 0; i < size; i++) { objectIntProcedure.value(list.get(i), i); } }
[ "public", "static", "<", "T", ">", "void", "forEachWithIndex", "(", "List", "<", "T", ">", "list", ",", "ObjectIntProcedure", "<", "?", "super", "T", ">", "objectIntProcedure", ")", "{", "int", "size", "=", "list", ".", "size", "(", ")", ";", "for", ...
Iterates over a collection passing each element and the current relative int index to the specified instance of ObjectIntProcedure.
[ "Iterates", "over", "a", "collection", "passing", "each", "element", "and", "the", "current", "relative", "int", "index", "to", "the", "specified", "instance", "of", "ObjectIntProcedure", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/internal/RandomAccessListIterate.java#L717-L724
tvesalainen/util
util/src/main/java/org/vesalainen/math/BezierCurve.java
BezierCurve.operator
public ParameterizedOperator operator(double... controlPoints) { if (controlPoints.length != 2*length) { throw new IllegalArgumentException("control-points length not "+length); } return operator(controlPoints, 0); }
java
public ParameterizedOperator operator(double... controlPoints) { if (controlPoints.length != 2*length) { throw new IllegalArgumentException("control-points length not "+length); } return operator(controlPoints, 0); }
[ "public", "ParameterizedOperator", "operator", "(", "double", "...", "controlPoints", ")", "{", "if", "(", "controlPoints", ".", "length", "!=", "2", "*", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"control-points length not \"", "+", "...
Creates Bezier function for fixed control points. Note that it is not same if you pass an array or separate parameters. Array is not copied, so if you modify it it will make change. If you want to have function with immutable control points, use separate parameters or copy the array. @param controlPoints @return
[ "Creates", "Bezier", "function", "for", "fixed", "control", "points", ".", "Note", "that", "it", "is", "not", "same", "if", "you", "pass", "an", "array", "or", "separate", "parameters", ".", "Array", "is", "not", "copied", "so", "if", "you", "modify", "i...
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BezierCurve.java#L88-L95
ag-gipp/MathMLTools
mathml-similarity/src/main/java/com/formulasearchengine/mathmltools/similarity/distances/Distances.java
Distances.computeAbsoluteDistance
public static double computeAbsoluteDistance(Map<String, Double> h1, Map<String, Double> h2) { double distance = 0; final Set<String> keySet = new HashSet(); keySet.addAll(h1.keySet()); keySet.addAll(h2.keySet()); for (String key : keySet) { double v1 = 0.0; double v2 = 0.0; if (h1.get(key) != null) { v1 = h1.get(key); } if (h2.get(key) != null) { v2 = h2.get(key); } distance += Math.abs(v1 - v2); } return distance; }
java
public static double computeAbsoluteDistance(Map<String, Double> h1, Map<String, Double> h2) { double distance = 0; final Set<String> keySet = new HashSet(); keySet.addAll(h1.keySet()); keySet.addAll(h2.keySet()); for (String key : keySet) { double v1 = 0.0; double v2 = 0.0; if (h1.get(key) != null) { v1 = h1.get(key); } if (h2.get(key) != null) { v2 = h2.get(key); } distance += Math.abs(v1 - v2); } return distance; }
[ "public", "static", "double", "computeAbsoluteDistance", "(", "Map", "<", "String", ",", "Double", ">", "h1", ",", "Map", "<", "String", ",", "Double", ">", "h2", ")", "{", "double", "distance", "=", "0", ";", "final", "Set", "<", "String", ">", "keySe...
compares two histograms and returns the accumulated number of differences (absolute) @param h1 @param h2 @return
[ "compares", "two", "histograms", "and", "returns", "the", "accumulated", "number", "of", "differences", "(", "absolute", ")" ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-similarity/src/main/java/com/formulasearchengine/mathmltools/similarity/distances/Distances.java#L68-L89
craterdog/java-security-framework
java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java
MessageCryptex.encryptStream
public final void encryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException { logger.entry(); CipherOutputStream cipherOutput = null; byte[] buffer = new byte[2048]; try { logger.debug("Creating a special output stream to do the work..."); cipherOutput = encryptionOutputStream(sharedKey, output); logger.debug("Reading from the input and writing to the encrypting output stream..."); // Can't use IOUtils.copy(input, cipherOutput) here because need to purge buffer later... int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { cipherOutput.write(buffer, 0, bytesRead); } cipherOutput.flush(); } finally { logger.debug("Purging any plaintext hanging around in memory..."); Arrays.fill(buffer, (byte) 0); if (cipherOutput != null) cipherOutput.close(); } logger.exit(); }
java
public final void encryptStream(SecretKey sharedKey, InputStream input, OutputStream output) throws IOException { logger.entry(); CipherOutputStream cipherOutput = null; byte[] buffer = new byte[2048]; try { logger.debug("Creating a special output stream to do the work..."); cipherOutput = encryptionOutputStream(sharedKey, output); logger.debug("Reading from the input and writing to the encrypting output stream..."); // Can't use IOUtils.copy(input, cipherOutput) here because need to purge buffer later... int bytesRead; while ((bytesRead = input.read(buffer)) != -1) { cipherOutput.write(buffer, 0, bytesRead); } cipherOutput.flush(); } finally { logger.debug("Purging any plaintext hanging around in memory..."); Arrays.fill(buffer, (byte) 0); if (cipherOutput != null) cipherOutput.close(); } logger.exit(); }
[ "public", "final", "void", "encryptStream", "(", "SecretKey", "sharedKey", ",", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "logger", ".", "entry", "(", ")", ";", "CipherOutputStream", "cipherOutput", "=", "null", ";...
This method encrypts a byte stream using a shared key. @param sharedKey The shared key used for the encryption. @param input The byte stream to be encrypted. @param output The encrypted output stream. @throws java.io.IOException Unable to encrypt the stream.
[ "This", "method", "encrypts", "a", "byte", "stream", "using", "a", "shared", "key", "." ]
train
https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L196-L218
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deleteGroup
public void deleteGroup(CmsRequestContext context, CmsUUID groupId, CmsUUID replacementId) throws CmsException, CmsRoleViolationException, CmsSecurityException { CmsGroup group = readGroup(context, groupId); if (group.isRole()) { throw new CmsSecurityException(Messages.get().container(Messages.ERR_DELETE_ROLE_GROUP_1, group.getName())); } CmsDbContext dbc = null; try { dbc = getDbContextForDeletePrincipal(context); // catch own exception as special cause for general "Error deleting group". checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName()))); m_driverManager.deleteGroup(dbc, group, replacementId); } catch (Exception e) { CmsDbContext dbcForException = m_dbContextFactory.getDbContext(context); dbcForException.report(null, Messages.get().container(Messages.ERR_DELETE_GROUP_1, group.getName()), e); dbcForException.clear(); } finally { if (null != dbc) { dbc.clear(); } } }
java
public void deleteGroup(CmsRequestContext context, CmsUUID groupId, CmsUUID replacementId) throws CmsException, CmsRoleViolationException, CmsSecurityException { CmsGroup group = readGroup(context, groupId); if (group.isRole()) { throw new CmsSecurityException(Messages.get().container(Messages.ERR_DELETE_ROLE_GROUP_1, group.getName())); } CmsDbContext dbc = null; try { dbc = getDbContextForDeletePrincipal(context); // catch own exception as special cause for general "Error deleting group". checkRole(dbc, CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(group.getName()))); m_driverManager.deleteGroup(dbc, group, replacementId); } catch (Exception e) { CmsDbContext dbcForException = m_dbContextFactory.getDbContext(context); dbcForException.report(null, Messages.get().container(Messages.ERR_DELETE_GROUP_1, group.getName()), e); dbcForException.clear(); } finally { if (null != dbc) { dbc.clear(); } } }
[ "public", "void", "deleteGroup", "(", "CmsRequestContext", "context", ",", "CmsUUID", "groupId", ",", "CmsUUID", "replacementId", ")", "throws", "CmsException", ",", "CmsRoleViolationException", ",", "CmsSecurityException", "{", "CmsGroup", "group", "=", "readGroup", ...
Deletes a group, where all permissions, users and children of the group are transfered to a replacement group.<p> @param context the current request context @param groupId the id of the group to be deleted @param replacementId the id of the group to be transfered, can be <code>null</code> @throws CmsException if operation was not successful @throws CmsSecurityException if the group is a default group. @throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}
[ "Deletes", "a", "group", "where", "all", "permissions", "users", "and", "children", "of", "the", "group", "are", "transfered", "to", "a", "replacement", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1304-L1326
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/boosting/Bagging.java
Bagging.sampleWithReplacement
static public void sampleWithReplacement(int[] sampleCounts, int samples, Random rand) { Arrays.fill(sampleCounts, 0); for(int i = 0; i < samples; i++) sampleCounts[rand.nextInt(sampleCounts.length)]++; }
java
static public void sampleWithReplacement(int[] sampleCounts, int samples, Random rand) { Arrays.fill(sampleCounts, 0); for(int i = 0; i < samples; i++) sampleCounts[rand.nextInt(sampleCounts.length)]++; }
[ "static", "public", "void", "sampleWithReplacement", "(", "int", "[", "]", "sampleCounts", ",", "int", "samples", ",", "Random", "rand", ")", "{", "Arrays", ".", "fill", "(", "sampleCounts", ",", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", ...
Performs the sampling based on the number of data points, storing the counts in an array to be constructed from XXXX @param sampleCounts an array to keep count of how many times each data point was sampled. The array will be filled with zeros before sampling starts @param samples the number of samples to take from the data set @param rand the source of randomness
[ "Performs", "the", "sampling", "based", "on", "the", "number", "of", "data", "points", "storing", "the", "counts", "in", "an", "array", "to", "be", "constructed", "from", "XXXX" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/Bagging.java#L369-L374
craftercms/commons
utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java
PGPUtils.getPublicKey
public static PGPPublicKey getPublicKey(InputStream content) throws Exception { InputStream in = PGPUtil.getDecoderStream(content); PGPPublicKeyRingCollection keyRingCollection = new PGPPublicKeyRingCollection(in, new BcKeyFingerprintCalculator()); PGPPublicKey key = null; Iterator<PGPPublicKeyRing> keyRings = keyRingCollection.getKeyRings(); while(key == null && keyRings.hasNext()) { PGPPublicKeyRing keyRing = keyRings.next(); Iterator<PGPPublicKey> keys = keyRing.getPublicKeys(); while(key == null && keys.hasNext()) { PGPPublicKey current = keys.next(); if(current.isEncryptionKey()) { key = current; } } } return key; }
java
public static PGPPublicKey getPublicKey(InputStream content) throws Exception { InputStream in = PGPUtil.getDecoderStream(content); PGPPublicKeyRingCollection keyRingCollection = new PGPPublicKeyRingCollection(in, new BcKeyFingerprintCalculator()); PGPPublicKey key = null; Iterator<PGPPublicKeyRing> keyRings = keyRingCollection.getKeyRings(); while(key == null && keyRings.hasNext()) { PGPPublicKeyRing keyRing = keyRings.next(); Iterator<PGPPublicKey> keys = keyRing.getPublicKeys(); while(key == null && keys.hasNext()) { PGPPublicKey current = keys.next(); if(current.isEncryptionKey()) { key = current; } } } return key; }
[ "public", "static", "PGPPublicKey", "getPublicKey", "(", "InputStream", "content", ")", "throws", "Exception", "{", "InputStream", "in", "=", "PGPUtil", ".", "getDecoderStream", "(", "content", ")", ";", "PGPPublicKeyRingCollection", "keyRingCollection", "=", "new", ...
Extracts the PGP public key from an encoded stream. @param content stream to extract the key @return key object @throws IOException if there is an error reading the stream @throws PGPException if the public key cannot be extracted
[ "Extracts", "the", "PGP", "public", "key", "from", "an", "encoded", "stream", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/crypto/PGPUtils.java#L134-L150
konvergeio/cofoja
src/main/java/com/google/java/contract/core/apt/FactoryUtils.java
FactoryUtils.getClassNameForType
@Requires({ "type != null", "type.getKind() == javax.lang.model.type.TypeKind.DECLARED" }) @Ensures("result == null || result.getDeclaredName().equals(type.toString())") ClassName getClassNameForType(TypeMirror type) { DeclaredType tmp = (DeclaredType) type; TypeElement element = (TypeElement) tmp.asElement(); String binaryName = elementUtils.getBinaryName(element) .toString().replace('.', '/'); return new ClassName(binaryName, type.toString()); }
java
@Requires({ "type != null", "type.getKind() == javax.lang.model.type.TypeKind.DECLARED" }) @Ensures("result == null || result.getDeclaredName().equals(type.toString())") ClassName getClassNameForType(TypeMirror type) { DeclaredType tmp = (DeclaredType) type; TypeElement element = (TypeElement) tmp.asElement(); String binaryName = elementUtils.getBinaryName(element) .toString().replace('.', '/'); return new ClassName(binaryName, type.toString()); }
[ "@", "Requires", "(", "{", "\"type != null\"", ",", "\"type.getKind() == javax.lang.model.type.TypeKind.DECLARED\"", "}", ")", "@", "Ensures", "(", "\"result == null || result.getDeclaredName().equals(type.toString())\"", ")", "ClassName", "getClassNameForType", "(", "TypeMirror", ...
Creates a {@link ClassName} from a {@link TypeMirror}. The created ClassName bears generic parameters, if any.
[ "Creates", "a", "{" ]
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/apt/FactoryUtils.java#L80-L91
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newEqualityException
public static EqualityException newEqualityException(String message, Object... args) { return newEqualityException(null, message, args); }
java
public static EqualityException newEqualityException(String message, Object... args) { return newEqualityException(null, message, args); }
[ "public", "static", "EqualityException", "newEqualityException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newEqualityException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link EqualityException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link EqualityException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link EqualityException} with the given {@link String message}. @see #newEqualityException(Throwable, String, Object...) @see org.cp.elements.lang.EqualityException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "EqualityException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L327-L329
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java
WebDriverHelper.isElementPresent
public boolean isElementPresent(final WebElement element, final By by) { try { element.findElement(by); } catch (Exception e) { return false; } return true; }
java
public boolean isElementPresent(final WebElement element, final By by) { try { element.findElement(by); } catch (Exception e) { return false; } return true; }
[ "public", "boolean", "isElementPresent", "(", "final", "WebElement", "element", ",", "final", "By", "by", ")", "{", "try", "{", "element", ".", "findElement", "(", "by", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "...
Checks if the supplied {@code element} contains another element identified by {@code by}. @param by the method of identifying the element @param element the root element that will be searched @return true if {@code element} contains an element identified by {@code by} or false otherwise
[ "Checks", "if", "the", "supplied", "{", "@code", "element", "}", "contains", "another", "element", "identified", "by", "{", "@code", "by", "}", "." ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/webdriver/WebDriverHelper.java#L452-L459
mapbox/mapbox-java
services-turf/src/main/java/com/mapbox/turf/TurfConversion.java
TurfConversion.lengthToRadians
public static double lengthToRadians(double distance, @NonNull @TurfUnitCriteria String units) { return distance / FACTORS.get(units); }
java
public static double lengthToRadians(double distance, @NonNull @TurfUnitCriteria String units) { return distance / FACTORS.get(units); }
[ "public", "static", "double", "lengthToRadians", "(", "double", "distance", ",", "@", "NonNull", "@", "TurfUnitCriteria", "String", "units", ")", "{", "return", "distance", "/", "FACTORS", ".", "get", "(", "units", ")", ";", "}" ]
Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians. @param distance double representing a distance value @param units pass in one of the units defined in {@link TurfUnitCriteria} @return converted distance to radians value @since 1.2.0
[ "Convert", "a", "distance", "measurement", "(", "assuming", "a", "spherical", "Earth", ")", "from", "a", "real", "-", "world", "unit", "into", "radians", "." ]
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfConversion.java#L129-L131
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java
IteratorExtensions.findFirst
public static <T> T findFirst(Iterator<T> iterator, Function1<? super T, Boolean> predicate) { if (predicate == null) throw new NullPointerException("predicate"); while(iterator.hasNext()) { T t = iterator.next(); if (predicate.apply(t)) return t; } return null; }
java
public static <T> T findFirst(Iterator<T> iterator, Function1<? super T, Boolean> predicate) { if (predicate == null) throw new NullPointerException("predicate"); while(iterator.hasNext()) { T t = iterator.next(); if (predicate.apply(t)) return t; } return null; }
[ "public", "static", "<", "T", ">", "T", "findFirst", "(", "Iterator", "<", "T", ">", "iterator", ",", "Function1", "<", "?", "super", "T", ",", "Boolean", ">", "predicate", ")", "{", "if", "(", "predicate", "==", "null", ")", "throw", "new", "NullPoi...
Finds the first element in the given iterator that fulfills the predicate. If none is found or the iterator is empty, <code>null</code> is returned. @param iterator the iterator. May not be <code>null</code>. @param predicate the predicate. May not be <code>null</code>. @return the first element in the iterator for which the given predicate returns <code>true</code>, returns <code>null</code> if no element matches the predicate or the iterator is empty.
[ "Finds", "the", "first", "element", "in", "the", "given", "iterator", "that", "fulfills", "the", "predicate", ".", "If", "none", "is", "found", "or", "the", "iterator", "is", "empty", "<code", ">", "null<", "/", "code", ">", "is", "returned", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IteratorExtensions.java#L103-L112
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java
ReferenceEntityLockService.newLock
@Override public IEntityLock newLock(Class entityType, String entityKey, int lockType, String owner) throws LockingException { return newLock(entityType, entityKey, lockType, owner, defaultLockPeriod); }
java
@Override public IEntityLock newLock(Class entityType, String entityKey, int lockType, String owner) throws LockingException { return newLock(entityType, entityKey, lockType, owner, defaultLockPeriod); }
[ "@", "Override", "public", "IEntityLock", "newLock", "(", "Class", "entityType", ",", "String", "entityKey", ",", "int", "lockType", ",", "String", "owner", ")", "throws", "LockingException", "{", "return", "newLock", "(", "entityType", ",", "entityKey", ",", ...
Returns a lock for the entity, lock type and owner if no conflicting locks exist. @param entityType @param entityKey @param lockType @param owner @return org.apereo.portal.groups.IEntityLock @exception LockingException
[ "Returns", "a", "lock", "for", "the", "entity", "lock", "type", "and", "owner", "if", "no", "conflicting", "locks", "exist", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/concurrency/locking/ReferenceEntityLockService.java#L244-L248
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointBrief.java
DescribePointBrief.process
public void process( double c_x , double c_y , TupleDesc_B feature ) { describe.process((int)c_x,(int)c_y,feature); }
java
public void process( double c_x , double c_y , TupleDesc_B feature ) { describe.process((int)c_x,(int)c_y,feature); }
[ "public", "void", "process", "(", "double", "c_x", ",", "double", "c_y", ",", "TupleDesc_B", "feature", ")", "{", "describe", ".", "process", "(", "(", "int", ")", "c_x", ",", "(", "int", ")", "c_y", ",", "feature", ")", ";", "}" ]
Computes the descriptor at the specified point. If the region go outside of the image then a description will not be made. @param c_x Center of region being described. @param c_y Center of region being described. @param feature Where the descriptor is written to.
[ "Computes", "the", "descriptor", "at", "the", "specified", "point", ".", "If", "the", "region", "go", "outside", "of", "the", "image", "then", "a", "description", "will", "not", "be", "made", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointBrief.java#L87-L89
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.checkIsStructuredType
public static StructuredType checkIsStructuredType(Type type) { if (!isStructuredType(type)) { throw new ODataSystemException("A structured type is required, but '" + type.getFullyQualifiedName() + "' is not a structured type: " + type.getMetaType()); } return (StructuredType) type; }
java
public static StructuredType checkIsStructuredType(Type type) { if (!isStructuredType(type)) { throw new ODataSystemException("A structured type is required, but '" + type.getFullyQualifiedName() + "' is not a structured type: " + type.getMetaType()); } return (StructuredType) type; }
[ "public", "static", "StructuredType", "checkIsStructuredType", "(", "Type", "type", ")", "{", "if", "(", "!", "isStructuredType", "(", "type", ")", ")", "{", "throw", "new", "ODataSystemException", "(", "\"A structured type is required, but '\"", "+", "type", ".", ...
Checks if the specified OData type is a structured type and throws an exception if it is not. @param type The OData type. @return The OData type. @throws ODataSystemException If the OData type is not a structured type.
[ "Checks", "if", "the", "specified", "OData", "type", "is", "a", "structured", "type", "and", "throws", "an", "exception", "if", "it", "is", "not", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L151-L157
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/AbstractGeneratedSQLTransform.java
AbstractGeneratedSQLTransform.generateWriteParam2ContentValues
@Override public void generateWriteParam2ContentValues(Builder methodBuilder, SQLiteModelMethod method, String paramName, TypeName paramTypeName, ModelProperty property) { String methodName = method.getParent().generateJava2ContentSerializer(paramTypeName); methodBuilder.addCode("$L($L)", methodName, paramName); }
java
@Override public void generateWriteParam2ContentValues(Builder methodBuilder, SQLiteModelMethod method, String paramName, TypeName paramTypeName, ModelProperty property) { String methodName = method.getParent().generateJava2ContentSerializer(paramTypeName); methodBuilder.addCode("$L($L)", methodName, paramName); }
[ "@", "Override", "public", "void", "generateWriteParam2ContentValues", "(", "Builder", "methodBuilder", ",", "SQLiteModelMethod", "method", ",", "String", "paramName", ",", "TypeName", "paramTypeName", ",", "ModelProperty", "property", ")", "{", "String", "methodName", ...
/* (non-Javadoc) @see com.abubusoft.kripton.processor.sqlite.transform.AbstractSQLTransform#generateWriteParam2ContentValues(com.squareup.javapoet.MethodSpec.Builder, com.abubusoft.kripton.processor.sqlite.model.SQLiteModelMethod, java.lang.String, com.squareup.javapoet.TypeName, com.abubusoft.kripton.processor.core.ModelProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/AbstractGeneratedSQLTransform.java#L49-L54
apiman/apiman
gateway/engine/redis/src/main/java/io/apiman/gateway/engine/redis/common/RedisBackingStore.java
RedisBackingStore.onMap
private <T> T onMap(Function<RMap<String, String>, T> func) { final RMap<String, String> map = client.getMap(prefix); return func.apply(map); }
java
private <T> T onMap(Function<RMap<String, String>, T> func) { final RMap<String, String> map = client.getMap(prefix); return func.apply(map); }
[ "private", "<", "T", ">", "T", "onMap", "(", "Function", "<", "RMap", "<", "String", ",", "String", ">", ",", "T", ">", "func", ")", "{", "final", "RMap", "<", "String", ",", "String", ">", "map", "=", "client", ".", "getMap", "(", "prefix", ")",...
Pass an {@link RMap} to the function and return its result. @param func the function to apply using the {@link RMap} @return the result
[ "Pass", "an", "{", "@link", "RMap", "}", "to", "the", "function", "and", "return", "its", "result", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/redis/src/main/java/io/apiman/gateway/engine/redis/common/RedisBackingStore.java#L50-L53
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.setOutputStream
public Jar setOutputStream(OutputStream os) { if (os == null) throw new NullPointerException("The OutputStream is null"); if (jos != null) throw new IllegalStateException("Entries have already been added, the JAR has been written or setOutputStream has already been called."); this.os = os; return this; }
java
public Jar setOutputStream(OutputStream os) { if (os == null) throw new NullPointerException("The OutputStream is null"); if (jos != null) throw new IllegalStateException("Entries have already been added, the JAR has been written or setOutputStream has already been called."); this.os = os; return this; }
[ "public", "Jar", "setOutputStream", "(", "OutputStream", "os", ")", "{", "if", "(", "os", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"The OutputStream is null\"", ")", ";", "if", "(", "jos", "!=", "null", ")", "throw", "new", "IllegalS...
Sets an {@link OutputStream} to which the JAR will be written. If used, this method must be called before any entries have been added or the JAR written. Calling this method prevents this object from using an internal buffer to store the JAR, and therefore, none of the other {@code write} methods can be called. @param os the target OutputStream of this JAR. @return {@code this}
[ "Sets", "an", "{", "@link", "OutputStream", "}", "to", "which", "the", "JAR", "will", "be", "written", ".", "If", "used", "this", "method", "must", "be", "called", "before", "any", "entries", "have", "been", "added", "or", "the", "JAR", "written", ".", ...
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L629-L636
alkacon/opencms-core
src/org/opencms/acacia/shared/CmsEntity.java
CmsEntity.removeAttributeValue
public void removeAttributeValue(String attributeName, int index) { if (m_simpleAttributes.containsKey(attributeName)) { List<String> values = m_simpleAttributes.get(attributeName); if ((values.size() == 1) && (index == 0)) { removeAttributeSilent(attributeName); } else { values.remove(index); } } else if (m_entityAttributes.containsKey(attributeName)) { List<CmsEntity> values = m_entityAttributes.get(attributeName); if ((values.size() == 1) && (index == 0)) { removeAttributeSilent(attributeName); } else { CmsEntity child = values.remove(index); removeChildChangeHandler(child); } } fireChange(); }
java
public void removeAttributeValue(String attributeName, int index) { if (m_simpleAttributes.containsKey(attributeName)) { List<String> values = m_simpleAttributes.get(attributeName); if ((values.size() == 1) && (index == 0)) { removeAttributeSilent(attributeName); } else { values.remove(index); } } else if (m_entityAttributes.containsKey(attributeName)) { List<CmsEntity> values = m_entityAttributes.get(attributeName); if ((values.size() == 1) && (index == 0)) { removeAttributeSilent(attributeName); } else { CmsEntity child = values.remove(index); removeChildChangeHandler(child); } } fireChange(); }
[ "public", "void", "removeAttributeValue", "(", "String", "attributeName", ",", "int", "index", ")", "{", "if", "(", "m_simpleAttributes", ".", "containsKey", "(", "attributeName", ")", ")", "{", "List", "<", "String", ">", "values", "=", "m_simpleAttributes", ...
Removes a specific attribute value.<p> @param attributeName the attribute name @param index the value index
[ "Removes", "a", "specific", "attribute", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/acacia/shared/CmsEntity.java#L556-L575
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.genCond
public CondItem genCond(JCTree tree, int crtFlags) { if (!genCrt) return genCond(tree, false); int startpc = code.curCP(); CondItem item = genCond(tree, (crtFlags & CRT_FLOW_CONTROLLER) != 0); code.crt.put(tree, crtFlags, startpc, code.curCP()); return item; }
java
public CondItem genCond(JCTree tree, int crtFlags) { if (!genCrt) return genCond(tree, false); int startpc = code.curCP(); CondItem item = genCond(tree, (crtFlags & CRT_FLOW_CONTROLLER) != 0); code.crt.put(tree, crtFlags, startpc, code.curCP()); return item; }
[ "public", "CondItem", "genCond", "(", "JCTree", "tree", ",", "int", "crtFlags", ")", "{", "if", "(", "!", "genCrt", ")", "return", "genCond", "(", "tree", ",", "false", ")", ";", "int", "startpc", "=", "code", ".", "curCP", "(", ")", ";", "CondItem",...
Derived visitor method: check whether CharacterRangeTable should be emitted, if so, put a new entry into CRTable and call method to generate bytecode. If not, just call method to generate bytecode. @see #genCond(JCTree,boolean) @param tree The tree to be visited. @param crtFlags The CharacterRangeTable flags indicating type of the entry.
[ "Derived", "visitor", "method", ":", "check", "whether", "CharacterRangeTable", "should", "be", "emitted", "if", "so", "put", "a", "new", "entry", "into", "CRTable", "and", "call", "method", "to", "generate", "bytecode", ".", "If", "not", "just", "call", "me...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L678-L684
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java
VisOdomDualTrackPnP.process
public boolean process( T left , T right ) { // System.out.println("----------- Process --------------"); this.inputLeft = left; this.inputRight = right; tick++; trackerLeft.process(left); trackerRight.process(right); if( first ) { addNewTracks(); first = false; } else { mutualTrackDrop(); selectCandidateTracks(); boolean failed = !estimateMotion(); dropUnusedTracks(); if( failed ) return false; int N = matcher.getMatchSet().size(); if( modelRefiner != null ) refineMotionEstimate(); if( thresholdAdd <= 0 || N < thresholdAdd ) { changePoseToReference(); addNewTracks(); } } return true; }
java
public boolean process( T left , T right ) { // System.out.println("----------- Process --------------"); this.inputLeft = left; this.inputRight = right; tick++; trackerLeft.process(left); trackerRight.process(right); if( first ) { addNewTracks(); first = false; } else { mutualTrackDrop(); selectCandidateTracks(); boolean failed = !estimateMotion(); dropUnusedTracks(); if( failed ) return false; int N = matcher.getMatchSet().size(); if( modelRefiner != null ) refineMotionEstimate(); if( thresholdAdd <= 0 || N < thresholdAdd ) { changePoseToReference(); addNewTracks(); } } return true; }
[ "public", "boolean", "process", "(", "T", "left", ",", "T", "right", ")", "{", "//\t\tSystem.out.println(\"----------- Process --------------\");", "this", ".", "inputLeft", "=", "left", ";", "this", ".", "inputRight", "=", "right", ";", "tick", "++", ";", "trac...
Updates motion estimate using the stereo pair. @param left Image from left camera @param right Image from right camera @return true if motion estimate was updated and false if not
[ "Updates", "motion", "estimate", "using", "the", "stereo", "pair", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomDualTrackPnP.java#L181-L214
woxblom/DragListView
library/src/main/java/com/woxthebox/draglistview/BoardView.java
BoardView.insertColumn
public DragItemRecyclerView insertColumn(final DragItemAdapter adapter, int index, final @Nullable View header, @Nullable View columnDragView, boolean hasFixedItemSize) { final DragItemRecyclerView recyclerView = insertColumn(adapter, index, header, hasFixedItemSize); setupColumnDragListener(columnDragView, recyclerView); return recyclerView; }
java
public DragItemRecyclerView insertColumn(final DragItemAdapter adapter, int index, final @Nullable View header, @Nullable View columnDragView, boolean hasFixedItemSize) { final DragItemRecyclerView recyclerView = insertColumn(adapter, index, header, hasFixedItemSize); setupColumnDragListener(columnDragView, recyclerView); return recyclerView; }
[ "public", "DragItemRecyclerView", "insertColumn", "(", "final", "DragItemAdapter", "adapter", ",", "int", "index", ",", "final", "@", "Nullable", "View", "header", ",", "@", "Nullable", "View", "columnDragView", ",", "boolean", "hasFixedItemSize", ")", "{", "final...
Inserts a column to the board at a specific index. @param adapter Adapter with the items for the column. @param index Index where on the board to add the column. @param header Header view that will be positioned above the column. Can be null. @param columnDragView View that will act as handle to drag and drop columns. Can be null. @param hasFixedItemSize If the items will have a fixed or dynamic size. @return The created DragItemRecyclerView.
[ "Inserts", "a", "column", "to", "the", "board", "at", "a", "specific", "index", "." ]
train
https://github.com/woxblom/DragListView/blob/9823406f21d96035e88d8fd173f64419d0bb89f3/library/src/main/java/com/woxthebox/draglistview/BoardView.java#L799-L803
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getURLTemplateKey
public static String getURLTemplateKey( URLType urlType, boolean needsToBeSecure ) { String key = URLTemplatesFactory.ACTION_TEMPLATE; if ( urlType.equals( URLType.ACTION ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_ACTION_TEMPLATE; } else { key = URLTemplatesFactory.ACTION_TEMPLATE; } } else if ( urlType.equals( URLType.RESOURCE ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_RESOURCE_TEMPLATE; } else { key = URLTemplatesFactory.RESOURCE_TEMPLATE; } } return key; }
java
public static String getURLTemplateKey( URLType urlType, boolean needsToBeSecure ) { String key = URLTemplatesFactory.ACTION_TEMPLATE; if ( urlType.equals( URLType.ACTION ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_ACTION_TEMPLATE; } else { key = URLTemplatesFactory.ACTION_TEMPLATE; } } else if ( urlType.equals( URLType.RESOURCE ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_RESOURCE_TEMPLATE; } else { key = URLTemplatesFactory.RESOURCE_TEMPLATE; } } return key; }
[ "public", "static", "String", "getURLTemplateKey", "(", "URLType", "urlType", ",", "boolean", "needsToBeSecure", ")", "{", "String", "key", "=", "URLTemplatesFactory", ".", "ACTION_TEMPLATE", ";", "if", "(", "urlType", ".", "equals", "(", "URLType", ".", "ACTION...
Returns a key for the URL template type given the URL type and a flag indicating a secure URL or not. @param urlType the type of URL (ACTION, RESOURCE). @param needsToBeSecure indicates that the template should be for a secure URL. @return the key/type of template to use.
[ "Returns", "a", "key", "for", "the", "URL", "template", "type", "given", "the", "URL", "type", "and", "a", "flag", "indicating", "a", "secure", "URL", "or", "not", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1685-L1712
hageldave/ImagingKit
ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java
ComplexImg.computePhase
public double computePhase(int idx){ double r = real[idx]; double i = imag[idx]; return atan2(r, i); }
java
public double computePhase(int idx){ double r = real[idx]; double i = imag[idx]; return atan2(r, i); }
[ "public", "double", "computePhase", "(", "int", "idx", ")", "{", "double", "r", "=", "real", "[", "idx", "]", ";", "double", "i", "=", "imag", "[", "idx", "]", ";", "return", "atan2", "(", "r", ",", "i", ")", ";", "}" ]
Calculates the phase of the pixel at the specified index. The phase is the argument of the complex number, i.e. the angle of the complex vector in the complex plane. @param idx index @return the phase in [0,2pi] of the complex number at index
[ "Calculates", "the", "phase", "of", "the", "pixel", "at", "the", "specified", "index", ".", "The", "phase", "is", "the", "argument", "of", "the", "complex", "number", "i", ".", "e", ".", "the", "angle", "of", "the", "complex", "vector", "in", "the", "c...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java#L510-L514
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsPushButton.java
CmsPushButton.getFaceHtml
protected String getFaceHtml(String text, String imageClass) { return CmsDomUtil.createFaceHtml(text, imageClass, m_align); }
java
protected String getFaceHtml(String text, String imageClass) { return CmsDomUtil.createFaceHtml(text, imageClass, m_align); }
[ "protected", "String", "getFaceHtml", "(", "String", "text", ",", "String", "imageClass", ")", "{", "return", "CmsDomUtil", ".", "createFaceHtml", "(", "text", ",", "imageClass", ",", "m_align", ")", ";", "}" ]
Convenience method to assemble the HTML to use for a button face.<p> @param text text the up face text to set, set to <code>null</code> to not show any @param imageClass the up face image class to use, set to <code>null</code> to not show any @return the HTML
[ "Convenience", "method", "to", "assemble", "the", "HTML", "to", "use", "for", "a", "button", "face", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsPushButton.java#L443-L446
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/simple/RDBMUserLayoutStore.java
RDBMUserLayoutStore.getLayoutId
private int getLayoutId(final IPerson person, final IUserProfile profile) { final Hashtable<Integer, UserProfile> profiles = getUserProfileList(person); int layoutId = profile.getLayoutId(); Set<Integer> layoutIds = getAllNonZeroLayoutIdsFromProfiles(profiles.values()); if (!layoutIds.isEmpty()) { layoutId = layoutIds.iterator().next(); } if (layoutIds.size() > 1) { // log that only one non-zero layout id assumption has been broken logger.error(UNSUPPORTED_MULTIPLE_LAYOUTS_FOUND, person.getID()); } return layoutId; }
java
private int getLayoutId(final IPerson person, final IUserProfile profile) { final Hashtable<Integer, UserProfile> profiles = getUserProfileList(person); int layoutId = profile.getLayoutId(); Set<Integer> layoutIds = getAllNonZeroLayoutIdsFromProfiles(profiles.values()); if (!layoutIds.isEmpty()) { layoutId = layoutIds.iterator().next(); } if (layoutIds.size() > 1) { // log that only one non-zero layout id assumption has been broken logger.error(UNSUPPORTED_MULTIPLE_LAYOUTS_FOUND, person.getID()); } return layoutId; }
[ "private", "int", "getLayoutId", "(", "final", "IPerson", "person", ",", "final", "IUserProfile", "profile", ")", "{", "final", "Hashtable", "<", "Integer", ",", "UserProfile", ">", "profiles", "=", "getUserProfileList", "(", "person", ")", ";", "int", "layout...
/* The code currently only supports one instantiated/saved layout for a user's set of profiles. If the layout hasn't been instantiated/saved for a user the layout id will be zero for all the profiles and if it has been saved it will be one. When more than one layout becomes supported, this logic will need to be reworked to support multiple layouts. It currently just checks if the layout for the user has been instantiated/saved and sets the new profile to the saved layout id (currently hardcoded elsewhere to always be one)
[ "/", "*", "The", "code", "currently", "only", "supports", "one", "instantiated", "/", "saved", "layout", "for", "a", "user", "s", "set", "of", "profiles", ".", "If", "the", "layout", "hasn", "t", "been", "instantiated", "/", "saved", "for", "a", "user", ...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/simple/RDBMUserLayoutStore.java#L283-L295
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java
ReflectionHelper.propertyExists
public static boolean propertyExists(Class<?> clazz, String property, ElementType elementType) { if ( ElementType.FIELD.equals( elementType ) ) { return getDeclaredField( clazz, property ) != null; } else { String capitalizedPropertyName = capitalize( property ); Method method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_GET + capitalizedPropertyName ); if ( method != null && method.getReturnType() != void.class ) { return true; } method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_IS + capitalizedPropertyName ); if ( method != null && method.getReturnType() == boolean.class ) { return true; } } return false; }
java
public static boolean propertyExists(Class<?> clazz, String property, ElementType elementType) { if ( ElementType.FIELD.equals( elementType ) ) { return getDeclaredField( clazz, property ) != null; } else { String capitalizedPropertyName = capitalize( property ); Method method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_GET + capitalizedPropertyName ); if ( method != null && method.getReturnType() != void.class ) { return true; } method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_IS + capitalizedPropertyName ); if ( method != null && method.getReturnType() == boolean.class ) { return true; } } return false; }
[ "public", "static", "boolean", "propertyExists", "(", "Class", "<", "?", ">", "clazz", ",", "String", "property", ",", "ElementType", "elementType", ")", "{", "if", "(", "ElementType", ".", "FIELD", ".", "equals", "(", "elementType", ")", ")", "{", "return...
Whether the specified JavaBeans property exists on the given type or not. @param clazz the type of interest @param property the JavaBeans property name @param elementType the element type to check, must be either {@link ElementType#FIELD} or {@link ElementType#METHOD}. @return {@code true} if the specified property exists, {@code false} otherwise
[ "Whether", "the", "specified", "JavaBeans", "property", "exists", "on", "the", "given", "type", "or", "not", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java#L65-L84
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doPost
protected <T> T doPost(String path, MultivaluedMap<String, String> formParams, Class<T> cls, MultivaluedMap<String, String> headers) throws ClientException { this.readLock.lock(); try { WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder(); ensurePostFormHeaders(headers, requestBuilder, true, true); ClientResponse response = requestBuilder.post(ClientResponse.class, formParams); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK); return response.getEntity(cls); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
java
protected <T> T doPost(String path, MultivaluedMap<String, String> formParams, Class<T> cls, MultivaluedMap<String, String> headers) throws ClientException { this.readLock.lock(); try { WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder(); ensurePostFormHeaders(headers, requestBuilder, true, true); ClientResponse response = requestBuilder.post(ClientResponse.class, formParams); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK); return response.getEntity(cls); } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } }
[ "protected", "<", "T", ">", "T", "doPost", "(", "String", "path", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "formParams", ",", "Class", "<", "T", ">", "cls", ",", "MultivaluedMap", "<", "String", ",", "String", ">", "headers", ")", "thr...
Submits a form and gets back a JSON object. @param <T> the type of the object that is expected in the response. @param path the API to call. @param formParams the form parameters to send. @param cls the type of object that is expected in the response. @param headers any headers. If there is no Accepts header, an Accepts header is added for JSON. If there is no Content Type header, a Content Type header is added for forms. @return the object in the response. @throws ClientException if a status code other than 200 (OK) is returned.
[ "Submits", "a", "form", "and", "gets", "back", "a", "JSON", "object", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L460-L473
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/DBUpdate.java
DBUpdate.push
public static Builder push(String field, Object value) { return new Builder().push(field, value); }
java
public static Builder push(String field, Object value) { return new Builder().push(field, value); }
[ "public", "static", "Builder", "push", "(", "String", "field", ",", "Object", "value", ")", "{", "return", "new", "Builder", "(", ")", ".", "push", "(", "field", ",", "value", ")", ";", "}" ]
Add the given value to the array value at the specified field atomically @param field The field to add the value to @param value The value to add @return this object
[ "Add", "the", "given", "value", "to", "the", "array", "value", "at", "the", "specified", "field", "atomically" ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBUpdate.java#L90-L92
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java
CommonOps_ZDRM.elementDivide
public static void elementDivide(ZMatrixD1 input , double real , double imaginary, ZMatrixD1 output ) { if( input.numCols != output.numCols || input.numRows != output.numRows ) { throw new IllegalArgumentException("The 'input' and 'output' matrices do not have compatible dimensions"); } double norm = real*real + imaginary*imaginary; int N = input.getDataLength(); for (int i = 0; i < N; i += 2 ) { double inReal = input.data[i]; double inImag = input.data[i+1]; output.data[i] = (inReal*real + inImag*imaginary)/norm; output.data[i+1] = (inImag*real - inReal*imaginary)/norm; } }
java
public static void elementDivide(ZMatrixD1 input , double real , double imaginary, ZMatrixD1 output ) { if( input.numCols != output.numCols || input.numRows != output.numRows ) { throw new IllegalArgumentException("The 'input' and 'output' matrices do not have compatible dimensions"); } double norm = real*real + imaginary*imaginary; int N = input.getDataLength(); for (int i = 0; i < N; i += 2 ) { double inReal = input.data[i]; double inImag = input.data[i+1]; output.data[i] = (inReal*real + inImag*imaginary)/norm; output.data[i+1] = (inImag*real - inReal*imaginary)/norm; } }
[ "public", "static", "void", "elementDivide", "(", "ZMatrixD1", "input", ",", "double", "real", ",", "double", "imaginary", ",", "ZMatrixD1", "output", ")", "{", "if", "(", "input", ".", "numCols", "!=", "output", ".", "numCols", "||", "input", ".", "numRow...
<p>Performs element by element division operation with a complex number on the right<br> <br> output<sub>ij</sub> = input<sub>ij</sub> / (real + imaginary*i) <br> </p> @param input The left matrix in the multiplication operation. Not modified. @param real Real component of the number it is multiplied by @param imaginary Imaginary component of the number it is multiplied by @param output Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "element", "by", "element", "division", "operation", "with", "a", "complex", "number", "on", "the", "right<br", ">", "<br", ">", "output<sub", ">", "ij<", "/", "sub", ">", "=", "input<sub", ">", "ij<", "/", "sub", ">", "/", "(", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/CommonOps_ZDRM.java#L962-L978
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/tileprovider/util/ManifestUtil.java
ManifestUtil.retrieveKey
public static String retrieveKey(final Context aContext, final String aKey) { // get the key from the manifest final PackageManager pm = aContext.getPackageManager(); try { final ApplicationInfo info = pm.getApplicationInfo(aContext.getPackageName(), PackageManager.GET_META_DATA); if (info.metaData == null) { Log.i(IMapView.LOGTAG,"Key %s not found in manifest"+aKey); } else { final String value = info.metaData.getString(aKey); if (value == null) { Log.i(IMapView.LOGTAG,"Key %s not found in manifest"+aKey); } else { return value.trim(); } } } catch (final PackageManager.NameNotFoundException e) { Log.i(IMapView.LOGTAG,"Key %s not found in manifest" +aKey); } return ""; }
java
public static String retrieveKey(final Context aContext, final String aKey) { // get the key from the manifest final PackageManager pm = aContext.getPackageManager(); try { final ApplicationInfo info = pm.getApplicationInfo(aContext.getPackageName(), PackageManager.GET_META_DATA); if (info.metaData == null) { Log.i(IMapView.LOGTAG,"Key %s not found in manifest"+aKey); } else { final String value = info.metaData.getString(aKey); if (value == null) { Log.i(IMapView.LOGTAG,"Key %s not found in manifest"+aKey); } else { return value.trim(); } } } catch (final PackageManager.NameNotFoundException e) { Log.i(IMapView.LOGTAG,"Key %s not found in manifest" +aKey); } return ""; }
[ "public", "static", "String", "retrieveKey", "(", "final", "Context", "aContext", ",", "final", "String", "aKey", ")", "{", "// get the key from the manifest", "final", "PackageManager", "pm", "=", "aContext", ".", "getPackageManager", "(", ")", ";", "try", "{", ...
Retrieve a key from the manifest meta data, or empty string if not found.
[ "Retrieve", "a", "key", "from", "the", "manifest", "meta", "data", "or", "empty", "string", "if", "not", "found", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/util/ManifestUtil.java#L17-L38
linkhub-sdk/popbill.sdk.java
src/main/java/com/popbill/api/BaseServiceImp.java
BaseServiceImp.fromJsonString
protected <T> T fromJsonString(String json, Class<T> clazz) { return _gsonParser.fromJson(json, clazz); }
java
protected <T> T fromJsonString(String json, Class<T> clazz) { return _gsonParser.fromJson(json, clazz); }
[ "protected", "<", "T", ">", "T", "fromJsonString", "(", "String", "json", ",", "Class", "<", "T", ">", "clazz", ")", "{", "return", "_gsonParser", ".", "fromJson", "(", "json", ",", "clazz", ")", ";", "}" ]
Convert JsonString to Object of Clazz @param json @param clazz @return Object of Clazz
[ "Convert", "JsonString", "to", "Object", "of", "Clazz" ]
train
https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/BaseServiceImp.java#L464-L466
gliga/ekstazi
org.ekstazi.core/src/main/java/org/ekstazi/data/TxtStorer.java
TxtStorer.printLine
protected void printLine(State state, Writer pw, String externalForm, String hash) throws IOException { pw.write(externalForm); pw.write(SEPARATOR); pw.write(hash); pw.write('\n'); }
java
protected void printLine(State state, Writer pw, String externalForm, String hash) throws IOException { pw.write(externalForm); pw.write(SEPARATOR); pw.write(hash); pw.write('\n'); }
[ "protected", "void", "printLine", "(", "State", "state", ",", "Writer", "pw", ",", "String", "externalForm", ",", "String", "hash", ")", "throws", "IOException", "{", "pw", ".", "write", "(", "externalForm", ")", ";", "pw", ".", "write", "(", "SEPARATOR", ...
Prints one line to the given writer; the line includes path to file and hash. Subclasses may include more fields.
[ "Prints", "one", "line", "to", "the", "given", "writer", ";", "the", "line", "includes", "path", "to", "file", "and", "hash", ".", "Subclasses", "may", "include", "more", "fields", "." ]
train
https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/data/TxtStorer.java#L185-L190
Teddy-Zhu/SilentGo
utils/src/main/java/com/silentgo/utils/asm/ClassUtils.java
ClassUtils.isOverridable
private static boolean isOverridable(Method method, Class<?> targetClass) { if (Modifier.isPrivate(method.getModifiers())) { return false; } if (Modifier.isPublic(method.getModifiers()) || Modifier.isProtected(method.getModifiers())) { return true; } return (targetClass == null || getPackageName(method.getDeclaringClass()).equals(getPackageName(targetClass))); }
java
private static boolean isOverridable(Method method, Class<?> targetClass) { if (Modifier.isPrivate(method.getModifiers())) { return false; } if (Modifier.isPublic(method.getModifiers()) || Modifier.isProtected(method.getModifiers())) { return true; } return (targetClass == null || getPackageName(method.getDeclaringClass()).equals(getPackageName(targetClass))); }
[ "private", "static", "boolean", "isOverridable", "(", "Method", "method", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "if", "(", "Modifier", ".", "isPrivate", "(", "method", ".", "getModifiers", "(", ")", ")", ")", "{", "return", "false", ";", ...
Determine whether the given method is overridable in the given target class. @param method the method to check @param targetClass the target class to check against
[ "Determine", "whether", "the", "given", "method", "is", "overridable", "in", "the", "given", "target", "class", "." ]
train
https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/ClassUtils.java#L837-L846
zalando-stups/spring-boot-etcd
zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java
EtcdClient.get
public EtcdResponse get(String key) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); return execute(builder, HttpMethod.GET, null, EtcdResponse.class); }
java
public EtcdResponse get(String key) throws EtcdException { UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(KEYSPACE); builder.pathSegment(key); return execute(builder, HttpMethod.GET, null, EtcdResponse.class); }
[ "public", "EtcdResponse", "get", "(", "String", "key", ")", "throws", "EtcdException", "{", "UriComponentsBuilder", "builder", "=", "UriComponentsBuilder", ".", "fromUriString", "(", "KEYSPACE", ")", ";", "builder", ".", "pathSegment", "(", "key", ")", ";", "ret...
Returns the node with the given key from etcd. @param key the node's key @return the response from etcd with the node @throws EtcdException in case etcd returned an error
[ "Returns", "the", "node", "with", "the", "given", "key", "from", "etcd", "." ]
train
https://github.com/zalando-stups/spring-boot-etcd/blob/6b4f48663d424777326c38b1e7da75c8b68a3841/zalando-boot-etcd/src/main/java/org/zalando/boot/etcd/EtcdClient.java#L211-L216
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/pool/JDBCXADataSource.java
JDBCXADataSource.getXAConnection
public XAConnection getXAConnection() throws SQLException { // Comment out before public release: System.err.print("Executing " + getClass().getName() + ".getXAConnection()..."); try { Class.forName(driver).newInstance(); } catch (ClassNotFoundException e) { throw new SQLException("Error opening connection: " + e.getMessage()); } catch (IllegalAccessException e) { throw new SQLException("Error opening connection: " + e.getMessage()); } catch (InstantiationException e) { throw new SQLException("Error opening connection: " + e.getMessage()); } JDBCConnection connection = (JDBCConnection) DriverManager.getConnection(url, connProperties); // Comment out before public release: System.err.print("New phys: " + connection); JDBCXAResource xaResource = new JDBCXAResource(connection, this); JDBCXAConnectionWrapper xaWrapper = new JDBCXAConnectionWrapper(connection, xaResource, connectionDefaults); JDBCXAConnection xaConnection = new JDBCXAConnection(xaWrapper, xaResource); xaWrapper.setPooledConnection(xaConnection); return xaConnection; }
java
public XAConnection getXAConnection() throws SQLException { // Comment out before public release: System.err.print("Executing " + getClass().getName() + ".getXAConnection()..."); try { Class.forName(driver).newInstance(); } catch (ClassNotFoundException e) { throw new SQLException("Error opening connection: " + e.getMessage()); } catch (IllegalAccessException e) { throw new SQLException("Error opening connection: " + e.getMessage()); } catch (InstantiationException e) { throw new SQLException("Error opening connection: " + e.getMessage()); } JDBCConnection connection = (JDBCConnection) DriverManager.getConnection(url, connProperties); // Comment out before public release: System.err.print("New phys: " + connection); JDBCXAResource xaResource = new JDBCXAResource(connection, this); JDBCXAConnectionWrapper xaWrapper = new JDBCXAConnectionWrapper(connection, xaResource, connectionDefaults); JDBCXAConnection xaConnection = new JDBCXAConnection(xaWrapper, xaResource); xaWrapper.setPooledConnection(xaConnection); return xaConnection; }
[ "public", "XAConnection", "getXAConnection", "(", ")", "throws", "SQLException", "{", "// Comment out before public release:", "System", ".", "err", ".", "print", "(", "\"Executing \"", "+", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".getXAConnection()....
Get new PHYSICAL connection, to be managed by a connection manager.
[ "Get", "new", "PHYSICAL", "connection", "to", "be", "managed", "by", "a", "connection", "manager", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/pool/JDBCXADataSource.java#L122-L157
amaembo/streamex
src/main/java/one/util/streamex/StreamEx.java
StreamEx.toSortedMap
public <K, V> SortedMap<K, V> toSortedMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valMapper) { SortedMap<K, V> map = isParallel() ? new ConcurrentSkipListMap<>() : new TreeMap<>(); return toMapThrowing(keyMapper, valMapper, map); }
java
public <K, V> SortedMap<K, V> toSortedMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valMapper) { SortedMap<K, V> map = isParallel() ? new ConcurrentSkipListMap<>() : new TreeMap<>(); return toMapThrowing(keyMapper, valMapper, map); }
[ "public", "<", "K", ",", "V", ">", "SortedMap", "<", "K", ",", "V", ">", "toSortedMap", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "keyMapper", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "V", ">", ...
Returns a {@link SortedMap} whose keys and values are the result of applying the provided mapping functions to the input elements. <p> This is a <a href="package-summary.html#StreamOps">terminal</a> operation. <p> If the mapped keys contains duplicates (according to {@link Object#equals(Object)}), an {@code IllegalStateException} is thrown when the collection operation is performed. <p> For parallel stream the concurrent {@code SortedMap} is created. <p> Returned {@code SortedMap} is guaranteed to be modifiable. @param <K> the output type of the key mapping function @param <V> the output type of the value mapping function @param keyMapper a mapping function to produce keys @param valMapper a mapping function to produce values @return a {@code SortedMap} whose keys and values are the result of applying mapping functions to the input elements @see Collectors#toMap(Function, Function) @see Collectors#toConcurrentMap(Function, Function) @see #toSortedMap(Function) @see #toNavigableMap(Function, Function) @since 0.1.0
[ "Returns", "a", "{", "@link", "SortedMap", "}", "whose", "keys", "and", "values", "are", "the", "result", "of", "applying", "the", "provided", "mapping", "functions", "to", "the", "input", "elements", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1107-L1111
apache/incubator-gobblin
gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/HiveProxyQueryExecutor.java
HiveProxyQueryExecutor.executeQuery
public void executeQuery(String query, Optional<String> proxy) throws SQLException { executeQueries(Collections.singletonList(query), proxy); }
java
public void executeQuery(String query, Optional<String> proxy) throws SQLException { executeQueries(Collections.singletonList(query), proxy); }
[ "public", "void", "executeQuery", "(", "String", "query", ",", "Optional", "<", "String", ">", "proxy", ")", "throws", "SQLException", "{", "executeQueries", "(", "Collections", ".", "singletonList", "(", "query", ")", ",", "proxy", ")", ";", "}" ]
Execute query. @param query the query @param proxy the proxy @throws SQLException the sql exception
[ "Execute", "query", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/HiveProxyQueryExecutor.java#L200-L203
spotify/logging-java
src/main/java/com/spotify/logging/LoggingConfigurator.java
LoggingConfigurator.addSentryAppender
public static SentryAppender addSentryAppender(final String dsn, Level logLevelThreshold) { final Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); final LoggerContext context = rootLogger.getLoggerContext(); SentryAppender appender = new SentryAppender(); appender.setDsn(dsn); appender.setContext(context); ThresholdFilter levelFilter = new ThresholdFilter(); levelFilter.setLevel(logLevelThreshold.logbackLevel.toString()); levelFilter.start(); appender.addFilter(levelFilter); appender.start(); rootLogger.addAppender(appender); return appender; }
java
public static SentryAppender addSentryAppender(final String dsn, Level logLevelThreshold) { final Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); final LoggerContext context = rootLogger.getLoggerContext(); SentryAppender appender = new SentryAppender(); appender.setDsn(dsn); appender.setContext(context); ThresholdFilter levelFilter = new ThresholdFilter(); levelFilter.setLevel(logLevelThreshold.logbackLevel.toString()); levelFilter.start(); appender.addFilter(levelFilter); appender.start(); rootLogger.addAppender(appender); return appender; }
[ "public", "static", "SentryAppender", "addSentryAppender", "(", "final", "String", "dsn", ",", "Level", "logLevelThreshold", ")", "{", "final", "Logger", "rootLogger", "=", "(", "Logger", ")", "LoggerFactory", ".", "getLogger", "(", "Logger", ".", "ROOT_LOGGER_NAM...
Add a sentry appender. @param dsn the sentry dsn to use (as produced by the sentry webinterface). @param logLevelThreshold the threshold for log events to be sent to sentry. @return the configured sentry appender.
[ "Add", "a", "sentry", "appender", "." ]
train
https://github.com/spotify/logging-java/blob/73a7ebf6578c5f4228953375214a0afb44318d4d/src/main/java/com/spotify/logging/LoggingConfigurator.java#L300-L319
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/SloppyMath.java
SloppyMath.nChooseK
public static int nChooseK(int n, int k) { k = Math.min(k, n - k); if (k == 0) { return 1; } int accum = n; for (int i = 1; i < k; i++) { accum *= (n - i); accum /= i; } return accum / k; }
java
public static int nChooseK(int n, int k) { k = Math.min(k, n - k); if (k == 0) { return 1; } int accum = n; for (int i = 1; i < k; i++) { accum *= (n - i); accum /= i; } return accum / k; }
[ "public", "static", "int", "nChooseK", "(", "int", "n", ",", "int", "k", ")", "{", "k", "=", "Math", ".", "min", "(", "k", ",", "n", "-", "k", ")", ";", "if", "(", "k", "==", "0", ")", "{", "return", "1", ";", "}", "int", "accum", "=", "n...
Computes n choose k in an efficient way. Works with k == 0 or k == n but undefined if k < 0 or k > n @return fact(n) / fact(k) * fact(n-k)
[ "Computes", "n", "choose", "k", "in", "an", "efficient", "way", ".", "Works", "with", "k", "==", "0", "or", "k", "==", "n", "but", "undefined", "if", "k", "<", "0", "or", "k", ">", "n" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/SloppyMath.java#L295-L306
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java
AbstractSQLInsertClause.addFlag
@WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public C addFlag(Position position, Expression<?> flag) { metadata.addFlag(new QueryFlag(position, flag)); return (C) this; }
java
@WithBridgeMethods(value = SQLInsertClause.class, castRequired = true) public C addFlag(Position position, Expression<?> flag) { metadata.addFlag(new QueryFlag(position, flag)); return (C) this; }
[ "@", "WithBridgeMethods", "(", "value", "=", "SQLInsertClause", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "addFlag", "(", "Position", "position", ",", "Expression", "<", "?", ">", "flag", ")", "{", "metadata", ".", "addFlag", "(",...
Add the given Expression at the given position as a query flag @param position position @param flag query flag @return the current object
[ "Add", "the", "given", "Expression", "at", "the", "given", "position", "as", "a", "query", "flag" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLInsertClause.java#L114-L118
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderpolicy.java
responderpolicy.get
public static responderpolicy get(nitro_service service, String name) throws Exception{ responderpolicy obj = new responderpolicy(); obj.set_name(name); responderpolicy response = (responderpolicy) obj.get_resource(service); return response; }
java
public static responderpolicy get(nitro_service service, String name) throws Exception{ responderpolicy obj = new responderpolicy(); obj.set_name(name); responderpolicy response = (responderpolicy) obj.get_resource(service); return response; }
[ "public", "static", "responderpolicy", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "responderpolicy", "obj", "=", "new", "responderpolicy", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "res...
Use this API to fetch responderpolicy resource of given name .
[ "Use", "this", "API", "to", "fetch", "responderpolicy", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderpolicy.java#L485-L490
irmen/Pyrolite
java/src/main/java/net/razorvine/pickle/PickleUtils.java
PickleUtils.readline
public static String readline(InputStream input, boolean includeLF) throws IOException { StringBuilder sb = new StringBuilder(); while (true) { int c = input.read(); if (c == -1) { if (sb.length() == 0) throw new IOException("premature end of file"); break; } if (c != '\n' || includeLF) sb.append((char) c); if (c == '\n') break; } return sb.toString(); }
java
public static String readline(InputStream input, boolean includeLF) throws IOException { StringBuilder sb = new StringBuilder(); while (true) { int c = input.read(); if (c == -1) { if (sb.length() == 0) throw new IOException("premature end of file"); break; } if (c != '\n' || includeLF) sb.append((char) c); if (c == '\n') break; } return sb.toString(); }
[ "public", "static", "String", "readline", "(", "InputStream", "input", ",", "boolean", "includeLF", ")", "throws", "IOException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "while", "(", "true", ")", "{", "int", "c", "=", "inpu...
read a line of text, possibly including the terminating LF char
[ "read", "a", "line", "of", "text", "possibly", "including", "the", "terminating", "LF", "char" ]
train
https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pickle/PickleUtils.java#L25-L40
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.debtAccount_debt_debtId_operation_operationId_GET
public OvhOperation debtAccount_debt_debtId_operation_operationId_GET(Long debtId, Long operationId) throws IOException { String qPath = "/me/debtAccount/debt/{debtId}/operation/{operationId}"; StringBuilder sb = path(qPath, debtId, operationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation debtAccount_debt_debtId_operation_operationId_GET(Long debtId, Long operationId) throws IOException { String qPath = "/me/debtAccount/debt/{debtId}/operation/{operationId}"; StringBuilder sb = path(qPath, debtId, operationId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "debtAccount_debt_debtId_operation_operationId_GET", "(", "Long", "debtId", ",", "Long", "operationId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/debtAccount/debt/{debtId}/operation/{operationId}\"", ";", "StringBuilder", "sb", ...
Get this object properties REST: GET /me/debtAccount/debt/{debtId}/operation/{operationId} @param debtId [required] @param operationId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2703-L2708
tzaeschke/zoodb
src/org/zoodb/internal/server/index/LLIndexPage.java
LLIndexPage.binarySearchNonUnique
private int binarySearchNonUnique(int fromIndex, int toIndex, long key1, long key2) { int low = fromIndex; int high = toIndex - 1; while (low <= high) { int mid = (low + high) >>> 1; long midVal1 = keys[mid]; long midVal2 = values[mid]; if (midVal1 < key1) { low = mid + 1; } else if (midVal1 > key1) { high = mid - 1; } else { if (midVal2 < key2) { low = mid + 1; } else if (midVal2 > key2) { high = mid - 1; } else { return mid; // key found } } } return -(low + 1); // key not found. }
java
private int binarySearchNonUnique(int fromIndex, int toIndex, long key1, long key2) { int low = fromIndex; int high = toIndex - 1; while (low <= high) { int mid = (low + high) >>> 1; long midVal1 = keys[mid]; long midVal2 = values[mid]; if (midVal1 < key1) { low = mid + 1; } else if (midVal1 > key1) { high = mid - 1; } else { if (midVal2 < key2) { low = mid + 1; } else if (midVal2 > key2) { high = mid - 1; } else { return mid; // key found } } } return -(low + 1); // key not found. }
[ "private", "int", "binarySearchNonUnique", "(", "int", "fromIndex", ",", "int", "toIndex", ",", "long", "key1", ",", "long", "key2", ")", "{", "int", "low", "=", "fromIndex", ";", "int", "high", "=", "toIndex", "-", "1", ";", "while", "(", "low", "<=",...
This effectively implements a binary search of a double-long array (128bit values).
[ "This", "effectively", "implements", "a", "binary", "search", "of", "a", "double", "-", "long", "array", "(", "128bit", "values", ")", "." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/server/index/LLIndexPage.java#L256-L280
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.jaccardCoefficient
public static <E> double jaccardCoefficient(Counter<E> c1, Counter<E> c2) { double minCount = 0.0, maxCount = 0.0; for (E key : Sets.union(c1.keySet(), c2.keySet())) { double count1 = c1.getCount(key); double count2 = c2.getCount(key); minCount += (count1 < count2 ? count1 : count2); maxCount += (count1 > count2 ? count1 : count2); } return minCount / maxCount; }
java
public static <E> double jaccardCoefficient(Counter<E> c1, Counter<E> c2) { double minCount = 0.0, maxCount = 0.0; for (E key : Sets.union(c1.keySet(), c2.keySet())) { double count1 = c1.getCount(key); double count2 = c2.getCount(key); minCount += (count1 < count2 ? count1 : count2); maxCount += (count1 > count2 ? count1 : count2); } return minCount / maxCount; }
[ "public", "static", "<", "E", ">", "double", "jaccardCoefficient", "(", "Counter", "<", "E", ">", "c1", ",", "Counter", "<", "E", ">", "c2", ")", "{", "double", "minCount", "=", "0.0", ",", "maxCount", "=", "0.0", ";", "for", "(", "E", "key", ":", ...
Returns the Jaccard Coefficient of the two counters. Calculated as |c1 intersect c2| / ( |c1| + |c2| - |c1 intersect c2| @return The Jaccard Coefficient of the two counters
[ "Returns", "the", "Jaccard", "Coefficient", "of", "the", "two", "counters", ".", "Calculated", "as", "|c1", "intersect", "c2|", "/", "(", "|c1|", "+", "|c2|", "-", "|c1", "intersect", "c2|" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L990-L999
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ReflectUtils.java
ReflectUtils.getMethod
public static Method getMethod(String clazzName, String methodName, String[] argsType) { Class clazz = ClassUtils.forName(clazzName); Class[] classes = ClassTypeUtils.getClasses(argsType); return getMethod(clazz, methodName, classes); }
java
public static Method getMethod(String clazzName, String methodName, String[] argsType) { Class clazz = ClassUtils.forName(clazzName); Class[] classes = ClassTypeUtils.getClasses(argsType); return getMethod(clazz, methodName, classes); }
[ "public", "static", "Method", "getMethod", "(", "String", "clazzName", ",", "String", "methodName", ",", "String", "[", "]", "argsType", ")", "{", "Class", "clazz", "=", "ClassUtils", ".", "forName", "(", "clazzName", ")", ";", "Class", "[", "]", "classes"...
加载Method方法 @param clazzName 类名 @param methodName 方法名 @param argsType 参数列表 @return Method对象
[ "加载Method方法" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ReflectUtils.java#L95-L99
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/preprocessor/css/smartsprites/CssSmartSpritesGlobalPreprocessor.java
CssSmartSpritesGlobalPreprocessor.updateBundlesDirtyState
private void updateBundlesDirtyState(List<JoinableResourceBundle> bundles, CssSmartSpritesResourceReader cssSpriteResourceReader) { for (JoinableResourceBundle bundle : bundles) { List<BundlePath> bundlePaths = bundle.getItemPathList(); for (BundlePath bundlePath : bundlePaths) { String path = bundlePath.getPath(); File stdFile = cssSpriteResourceReader.getGeneratedCssFile(path); File bckFile = cssSpriteResourceReader.getBackupFile(path); if (bckFile.exists()) { try { if (!FileUtils.contentEquals(stdFile, bckFile)) { bundle.setDirty(true); break; } } catch (IOException e) { throw new BundlingProcessException("Issue while generating smartsprite bundle", e); } } cssSpriteResourceReader.getResource(bundle, path); } } }
java
private void updateBundlesDirtyState(List<JoinableResourceBundle> bundles, CssSmartSpritesResourceReader cssSpriteResourceReader) { for (JoinableResourceBundle bundle : bundles) { List<BundlePath> bundlePaths = bundle.getItemPathList(); for (BundlePath bundlePath : bundlePaths) { String path = bundlePath.getPath(); File stdFile = cssSpriteResourceReader.getGeneratedCssFile(path); File bckFile = cssSpriteResourceReader.getBackupFile(path); if (bckFile.exists()) { try { if (!FileUtils.contentEquals(stdFile, bckFile)) { bundle.setDirty(true); break; } } catch (IOException e) { throw new BundlingProcessException("Issue while generating smartsprite bundle", e); } } cssSpriteResourceReader.getResource(bundle, path); } } }
[ "private", "void", "updateBundlesDirtyState", "(", "List", "<", "JoinableResourceBundle", ">", "bundles", ",", "CssSmartSpritesResourceReader", "cssSpriteResourceReader", ")", "{", "for", "(", "JoinableResourceBundle", "bundle", ":", "bundles", ")", "{", "List", "<", ...
Update the bundles dirty state @param bundles the list of bundle @param cssSpriteResourceReader the css sprite resource reader
[ "Update", "the", "bundles", "dirty", "state" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/global/preprocessor/css/smartsprites/CssSmartSpritesGlobalPreprocessor.java#L114-L137
aws/aws-sdk-java
aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/CancelJobExecutionRequest.java
CancelJobExecutionRequest.withStatusDetails
public CancelJobExecutionRequest withStatusDetails(java.util.Map<String, String> statusDetails) { setStatusDetails(statusDetails); return this; }
java
public CancelJobExecutionRequest withStatusDetails(java.util.Map<String, String> statusDetails) { setStatusDetails(statusDetails); return this; }
[ "public", "CancelJobExecutionRequest", "withStatusDetails", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "statusDetails", ")", "{", "setStatusDetails", "(", "statusDetails", ")", ";", "return", "this", ";", "}" ]
<p> A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged. You can specify at most 10 name/value pairs. </p> @param statusDetails A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged. You can specify at most 10 name/value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "collection", "of", "name", "/", "value", "pairs", "that", "describe", "the", "status", "of", "the", "job", "execution", ".", "If", "not", "specified", "the", "statusDetails", "are", "unchanged", ".", "You", "can", "specify", "at", "most", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/CancelJobExecutionRequest.java#L357-L360