repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java
Normalization.zeromeanUnitVariance
public static JavaRDD<List<Writable>> zeromeanUnitVariance(Schema schema, JavaRDD<List<Writable>> data) { return zeromeanUnitVariance(schema, data, Collections.<String>emptyList()); }
java
public static JavaRDD<List<Writable>> zeromeanUnitVariance(Schema schema, JavaRDD<List<Writable>> data) { return zeromeanUnitVariance(schema, data, Collections.<String>emptyList()); }
[ "public", "static", "JavaRDD", "<", "List", "<", "Writable", ">", ">", "zeromeanUnitVariance", "(", "Schema", "schema", ",", "JavaRDD", "<", "List", "<", "Writable", ">", ">", "data", ")", "{", "return", "zeromeanUnitVariance", "(", "schema", ",", "data", ...
Normalize by zero mean unit variance @param schema the schema to use to create the data frame @param data the data to normalize @return a zero mean unit variance centered rdd
[ "Normalize", "by", "zero", "mean", "unit", "variance" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/Normalization.java#L62-L64
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java
RecordChangedHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record if ((this.getOwner().getMasterSlave() & RecordOwner.SLAVE) != 0) { // Only do this in the slave and shared code switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: this.setTheDate(); break; case DBConstants.UPDATE_TYPE: if (this.getOwner().isModified(true)) { // Don't need to set the last changed date if the record hasn't changed this.setTheDate(); if (this.isModLockMode()) this.setTemporaryKeyField(); } break; // DO NOT Reset error count! case DBConstants.AFTER_UPDATE_TYPE: this.clearTemporaryKeyField(); m_iErrorCount = 0; // Reset error count - Success break; } } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record if ((this.getOwner().getMasterSlave() & RecordOwner.SLAVE) != 0) { // Only do this in the slave and shared code switch (iChangeType) { case DBConstants.REFRESH_TYPE: case DBConstants.ADD_TYPE: this.setTheDate(); break; case DBConstants.UPDATE_TYPE: if (this.getOwner().isModified(true)) { // Don't need to set the last changed date if the record hasn't changed this.setTheDate(); if (this.isModLockMode()) this.setTemporaryKeyField(); } break; // DO NOT Reset error count! case DBConstants.AFTER_UPDATE_TYPE: this.clearTemporaryKeyField(); m_iErrorCount = 0; // Reset error count - Success break; } } return super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "// Read a valid record", "if", "(", "(", "this", ".", "getOwner", "(", ")", ".", "getMasterSlave", "(", ")", "&", "RecordOwner...
Called when a change is the record status is about to happen/has happened. This method sets the field to the current time on an add or update. @param field If this file change is due to a field, this is the field. @param changeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", ".", "This", "method", "sets", "the", "field", "to", "the", "current", "time", "on", "an", "add", "or", "update", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java#L101-L126
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/doc/DocClient.java
DocClient.getNotification
public GetNotificationResponse getNotification(GetNotificationRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, NOTIFICATION, request.getName()); return invokeHttpClient(internalRequest, GetNotificationResponse.class); }
java
public GetNotificationResponse getNotification(GetNotificationRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, NOTIFICATION, request.getName()); return invokeHttpClient(internalRequest, GetNotificationResponse.class); }
[ "public", "GetNotificationResponse", "getNotification", "(", "GetNotificationRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getName", "(", ")", ","...
Get your doc notification by doc notification name. @param request The request object containing all parameters for getting doc notification. @return Your doc notification.
[ "Get", "your", "doc", "notification", "by", "doc", "notification", "name", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/doc/DocClient.java#L869-L875
lucee/Lucee
core/src/main/java/lucee/commons/io/FileUtil.java
FileUtil.toFile
public static File toFile(File parent, String path) { return new File(parent, path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR)); }
java
public static File toFile(File parent, String path) { return new File(parent, path.replace(FILE_ANTI_SEPERATOR, FILE_SEPERATOR)); }
[ "public", "static", "File", "toFile", "(", "File", "parent", ",", "String", "path", ")", "{", "return", "new", "File", "(", "parent", ",", "path", ".", "replace", "(", "FILE_ANTI_SEPERATOR", ",", "FILE_SEPERATOR", ")", ")", ";", "}" ]
create a File from parent file and string @param parent @param path @return new File Object
[ "create", "a", "File", "from", "parent", "file", "and", "string" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/FileUtil.java#L78-L80
apache/groovy
subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java
TemplateServlet.getTemplate
protected Template getTemplate(URL url) throws ServletException { String key = url.toString(); Template template = findCachedTemplate(key, null); // Template not cached or the source file changed - compile new template! if (template == null) { try { template = createAndStoreTemplate(key, url.openConnection().getInputStream(), null); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e); } } return template; }
java
protected Template getTemplate(URL url) throws ServletException { String key = url.toString(); Template template = findCachedTemplate(key, null); // Template not cached or the source file changed - compile new template! if (template == null) { try { template = createAndStoreTemplate(key, url.openConnection().getInputStream(), null); } catch (Exception e) { throw new ServletException("Creation of template failed: " + e, e); } } return template; }
[ "protected", "Template", "getTemplate", "(", "URL", "url", ")", "throws", "ServletException", "{", "String", "key", "=", "url", ".", "toString", "(", ")", ";", "Template", "template", "=", "findCachedTemplate", "(", "key", ",", "null", ")", ";", "// Template...
Gets the template created by the underlying engine parsing the request. <p> This method looks up a simple (weak) hash map for an existing template object that matches the source URL. If there is no cache entry, a new one is created by the underlying template engine. This new instance is put to the cache for consecutive calls. @return The template that will produce the response text. @param url The URL containing the template source.. @throws ServletException If the request specified an invalid template source URL
[ "Gets", "the", "template", "created", "by", "the", "underlying", "engine", "parsing", "the", "request", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-servlet/src/main/java/groovy/servlet/TemplateServlet.java#L325-L339
lemire/sparsebitmap
src/main/java/sparsebitmap/SparseBitmap.java
SparseBitmap.fastadd
private void fastadd(int wo, int off) { this.buffer.add(off - this.sizeinwords); this.buffer.add(wo); this.sizeinwords = off + 1; }
java
private void fastadd(int wo, int off) { this.buffer.add(off - this.sizeinwords); this.buffer.add(wo); this.sizeinwords = off + 1; }
[ "private", "void", "fastadd", "(", "int", "wo", ",", "int", "off", ")", "{", "this", ".", "buffer", ".", "add", "(", "off", "-", "this", ".", "sizeinwords", ")", ";", "this", ".", "buffer", ".", "add", "(", "wo", ")", ";", "this", ".", "sizeinwor...
same as add but without updating the cardinality counter, strictly for internal use. @param wo the wo @param off the off
[ "same", "as", "add", "but", "without", "updating", "the", "cardinality", "counter", "strictly", "for", "internal", "use", "." ]
train
https://github.com/lemire/sparsebitmap/blob/f362e0811c32f68adfe4b748d513c46857898ec9/src/main/java/sparsebitmap/SparseBitmap.java#L64-L68
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java
BasicBondGenerator.generateBond
public IRenderingElement generateBond(IBond bond, RendererModel model) { boolean showExplicitHydrogens = true; if (model.hasParameter(BasicAtomGenerator.ShowExplicitHydrogens.class)) { showExplicitHydrogens = model.getParameter(BasicAtomGenerator.ShowExplicitHydrogens.class).getValue(); } if (!showExplicitHydrogens && bindsHydrogen(bond)) { return null; } if (isStereoBond(bond)) { return generateStereoElement(bond, model); } else { return generateBondElement(bond, model); } }
java
public IRenderingElement generateBond(IBond bond, RendererModel model) { boolean showExplicitHydrogens = true; if (model.hasParameter(BasicAtomGenerator.ShowExplicitHydrogens.class)) { showExplicitHydrogens = model.getParameter(BasicAtomGenerator.ShowExplicitHydrogens.class).getValue(); } if (!showExplicitHydrogens && bindsHydrogen(bond)) { return null; } if (isStereoBond(bond)) { return generateStereoElement(bond, model); } else { return generateBondElement(bond, model); } }
[ "public", "IRenderingElement", "generateBond", "(", "IBond", "bond", ",", "RendererModel", "model", ")", "{", "boolean", "showExplicitHydrogens", "=", "true", ";", "if", "(", "model", ".", "hasParameter", "(", "BasicAtomGenerator", ".", "ShowExplicitHydrogens", ".",...
Generate stereo or bond elements for this bond. @param bond the bond to use when generating elements @param model the renderer model @return one or more rendering elements
[ "Generate", "stereo", "or", "bond", "elements", "for", "this", "bond", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicBondGenerator.java#L493-L508
metafacture/metafacture-core
metafacture-commons/src/main/java/org/metafacture/commons/tries/WildcardTrie.java
WildcardTrie.put
public void put(final String keys, final P value) { if (keys.contains(OR_STRING)) { final String[] keysSplit = OR_PATTERN.split(keys); for (String string : keysSplit) { simplyPut(string, value); } } else { simplyPut(keys, value); } }
java
public void put(final String keys, final P value) { if (keys.contains(OR_STRING)) { final String[] keysSplit = OR_PATTERN.split(keys); for (String string : keysSplit) { simplyPut(string, value); } } else { simplyPut(keys, value); } }
[ "public", "void", "put", "(", "final", "String", "keys", ",", "final", "P", "value", ")", "{", "if", "(", "keys", ".", "contains", "(", "OR_STRING", ")", ")", "{", "final", "String", "[", "]", "keysSplit", "=", "OR_PATTERN", ".", "split", "(", "keys"...
Inserts keys into the try. Use '|' to concatenate. Use '*' (0,inf) and '?' (1,1) to express wildcards. @param keys pattern of keys to register @param value value to associate with the key pattern.
[ "Inserts", "keys", "into", "the", "try", ".", "Use", "|", "to", "concatenate", ".", "Use", "*", "(", "0", "inf", ")", "and", "?", "(", "1", "1", ")", "to", "express", "wildcards", "." ]
train
https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-commons/src/main/java/org/metafacture/commons/tries/WildcardTrie.java#L51-L60
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java
SelectBooleanCheckboxRenderer.startColSpanDiv
protected String startColSpanDiv(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox) throws IOException { String clazz = Responsive.getResponsiveStyleClass(selectBooleanCheckbox, false); if (clazz != null && clazz.trim().length() > 0) { rw.startElement("div", selectBooleanCheckbox); rw.writeAttribute("class", clazz, "class"); } return clazz; }
java
protected String startColSpanDiv(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox) throws IOException { String clazz = Responsive.getResponsiveStyleClass(selectBooleanCheckbox, false); if (clazz != null && clazz.trim().length() > 0) { rw.startElement("div", selectBooleanCheckbox); rw.writeAttribute("class", clazz, "class"); } return clazz; }
[ "protected", "String", "startColSpanDiv", "(", "ResponseWriter", "rw", ",", "SelectBooleanCheckbox", "selectBooleanCheckbox", ")", "throws", "IOException", "{", "String", "clazz", "=", "Responsive", ".", "getResponsiveStyleClass", "(", "selectBooleanCheckbox", ",", "false...
Start the column span div (if there's one). This method is protected in order to allow third-party frameworks to derive from it. @param rw the response writer @param selectBooleanCheckbox the component to render @throws IOException may be thrown by the response writer
[ "Start", "the", "column", "span", "div", "(", "if", "there", "s", "one", ")", ".", "This", "method", "is", "protected", "in", "order", "to", "allow", "third", "-", "party", "frameworks", "to", "derive", "from", "it", "." ]
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java#L387-L394
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/string.java
string.getFirstToken
public static String getFirstToken(String string, String token) { if ((string != null) && string.contains(token)) { return string.split(token)[0]; } return string; }
java
public static String getFirstToken(String string, String token) { if ((string != null) && string.contains(token)) { return string.split(token)[0]; } return string; }
[ "public", "static", "String", "getFirstToken", "(", "String", "string", ",", "String", "token", ")", "{", "if", "(", "(", "string", "!=", "null", ")", "&&", "string", ".", "contains", "(", "token", ")", ")", "{", "return", "string", ".", "split", "(", ...
Returns the first token of the string if that string can be split by the token, else return the unmodified input string @param string The string to split @param token The token to use as splitter @return The resultant string
[ "Returns", "the", "first", "token", "of", "the", "string", "if", "that", "string", "can", "be", "split", "by", "the", "token", "else", "return", "the", "unmodified", "input", "string" ]
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/string.java#L365-L370
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/FileUtilities.java
FileUtilities.deleteFileOrDirOnExit
public static boolean deleteFileOrDirOnExit( File filehandle ) { if (filehandle.isDirectory()) { String[] children = filehandle.list(); for( int i = 0; i < children.length; i++ ) { boolean success = deleteFileOrDir(new File(filehandle, children[i])); if (!success) { return false; } } } filehandle.deleteOnExit(); return true; }
java
public static boolean deleteFileOrDirOnExit( File filehandle ) { if (filehandle.isDirectory()) { String[] children = filehandle.list(); for( int i = 0; i < children.length; i++ ) { boolean success = deleteFileOrDir(new File(filehandle, children[i])); if (!success) { return false; } } } filehandle.deleteOnExit(); return true; }
[ "public", "static", "boolean", "deleteFileOrDirOnExit", "(", "File", "filehandle", ")", "{", "if", "(", "filehandle", ".", "isDirectory", "(", ")", ")", "{", "String", "[", "]", "children", "=", "filehandle", ".", "list", "(", ")", ";", "for", "(", "int"...
Delete file or folder recursively on exit of the program @param filehandle @return true if all went well
[ "Delete", "file", "or", "folder", "recursively", "on", "exit", "of", "the", "program" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/FileUtilities.java#L212-L224
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java
IntegralImageOps.convolveSparse
public static float convolveSparse(GrayF32 integral , IntegralKernel kernel , int x , int y ) { return ImplIntegralImageOps.convolveSparse(integral, kernel, x, y); }
java
public static float convolveSparse(GrayF32 integral , IntegralKernel kernel , int x , int y ) { return ImplIntegralImageOps.convolveSparse(integral, kernel, x, y); }
[ "public", "static", "float", "convolveSparse", "(", "GrayF32", "integral", ",", "IntegralKernel", "kernel", ",", "int", "x", ",", "int", "y", ")", "{", "return", "ImplIntegralImageOps", ".", "convolveSparse", "(", "integral", ",", "kernel", ",", "x", ",", "y...
Convolves a kernel around a single point in the integral image. @param integral Input integral image. Not modified. @param kernel Convolution kernel. @param x Pixel the convolution is performed at. @param y Pixel the convolution is performed at. @return Value of the convolution
[ "Convolves", "a", "kernel", "around", "a", "single", "point", "in", "the", "integral", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L312-L315
kiegroup/drools
drools-core/src/main/java/org/drools/core/phreak/SegmentUtilities.java
SegmentUtilities.isTipNode
public static boolean isTipNode( LeftTupleNode node, TerminalNode removingTN ) { return NodeTypeEnums.isEndNode(node) || isNonTerminalTipNode( node, removingTN ); }
java
public static boolean isTipNode( LeftTupleNode node, TerminalNode removingTN ) { return NodeTypeEnums.isEndNode(node) || isNonTerminalTipNode( node, removingTN ); }
[ "public", "static", "boolean", "isTipNode", "(", "LeftTupleNode", "node", ",", "TerminalNode", "removingTN", ")", "{", "return", "NodeTypeEnums", ".", "isEndNode", "(", "node", ")", "||", "isNonTerminalTipNode", "(", "node", ",", "removingTN", ")", ";", "}" ]
Returns whether the node is the tip of a segment. EndNodes (rtn and rian) are always the tip of a segment. node cannot be null. The result should discount any removingRule. That means it gives you the result as if the rule had already been removed from the network.
[ "Returns", "whether", "the", "node", "is", "the", "tip", "of", "a", "segment", ".", "EndNodes", "(", "rtn", "and", "rian", ")", "are", "always", "the", "tip", "of", "a", "segment", "." ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/phreak/SegmentUtilities.java#L484-L486
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/BufferedAttributeCollection.java
BufferedAttributeCollection.setAttributeFromRawValue
protected Attribute setAttributeFromRawValue(String name, AttributeType type, Object value) throws AttributeException { AttributeValue oldValue = extractValueForSafe(name); if (oldValue != null) { if (oldValue.equals(value)) { return null; } // Clone the value for avoid border effects. oldValue = new AttributeValueImpl(oldValue); } final Attribute attr = new AttributeImpl(name, type); attr.setValue(type.cast(value)); saveValue(name, attr); this.cache.put(name, attr); if (oldValue != null) { fireAttributeChangedEvent(name, oldValue, attr); } else { fireAttributeAddedEvent(name, attr); } return attr; }
java
protected Attribute setAttributeFromRawValue(String name, AttributeType type, Object value) throws AttributeException { AttributeValue oldValue = extractValueForSafe(name); if (oldValue != null) { if (oldValue.equals(value)) { return null; } // Clone the value for avoid border effects. oldValue = new AttributeValueImpl(oldValue); } final Attribute attr = new AttributeImpl(name, type); attr.setValue(type.cast(value)); saveValue(name, attr); this.cache.put(name, attr); if (oldValue != null) { fireAttributeChangedEvent(name, oldValue, attr); } else { fireAttributeAddedEvent(name, attr); } return attr; }
[ "protected", "Attribute", "setAttributeFromRawValue", "(", "String", "name", ",", "AttributeType", "type", ",", "Object", "value", ")", "throws", "AttributeException", "{", "AttributeValue", "oldValue", "=", "extractValueForSafe", "(", "name", ")", ";", "if", "(", ...
Set the attribute value. @param name is the name of the attribute @param type is the type of the attribute @param value is the raw value to store. @return the new created attribute @throws AttributeException on error.
[ "Set", "the", "attribute", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/BufferedAttributeCollection.java#L241-L265
liferay/com-liferay-commerce
commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java
CommerceNotificationTemplateWrapper.getBody
@Override public String getBody(String languageId, boolean useDefault) { return _commerceNotificationTemplate.getBody(languageId, useDefault); }
java
@Override public String getBody(String languageId, boolean useDefault) { return _commerceNotificationTemplate.getBody(languageId, useDefault); }
[ "@", "Override", "public", "String", "getBody", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_commerceNotificationTemplate", ".", "getBody", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized body of this commerce notification template in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized body of this commerce notification template
[ "Returns", "the", "localized", "body", "of", "this", "commerce", "notification", "template", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-api/src/main/java/com/liferay/commerce/notification/model/CommerceNotificationTemplateWrapper.java#L277-L280
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/sns/GetUiIntentApi.java
GetUiIntentApi.getUiIntent
public void getUiIntent(int type, long param, GetUiIntentHandler handler){ HMSAgentLog.i("getUiIntent:type=" + type + " param=" + param + " handler=" + StrUtils.objDesc(handler)); this.type = type; this.param = param; this.handler = handler; retryTimes = MAX_RETRY_TIMES; connect(); }
java
public void getUiIntent(int type, long param, GetUiIntentHandler handler){ HMSAgentLog.i("getUiIntent:type=" + type + " param=" + param + " handler=" + StrUtils.objDesc(handler)); this.type = type; this.param = param; this.handler = handler; retryTimes = MAX_RETRY_TIMES; connect(); }
[ "public", "void", "getUiIntent", "(", "int", "type", ",", "long", "param", ",", "GetUiIntentHandler", "handler", ")", "{", "HMSAgentLog", ".", "i", "(", "\"getUiIntent:type=\"", "+", "type", "+", "\" param=\"", "+", "param", "+", "\" handler=\"", "+", "StrUt...
获取拉起社交界面的intent @param type 指定打开哪个界面,取值参考{@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType} @param param 附加的参数 <br> 当{@code type}为 {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_MSG}, {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_FRIEND}, {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_FAMILY_GROUP}, {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_COMMON_GROUP} 时忽略,可以传入任意值; <br> 当{@code type}为 {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_FAMILY_GROUP_DETAIL}, {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_COMMON_GROUP_DETAIL}, {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_CHAT_GROUP} 时,需要传入群组的华为帐号ID; <br> 当{@code type}为 {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_USER_DETAIL}, {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_CHAT_FRIEND}, {@link com.huawei.hms.support.api.entity.sns.Constants.UiIntentType#UI_CHAT_ASSIST} 时,需要传入用户的华为帐号ID。 @param handler 结果回调
[ "获取拉起社交界面的intent" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/sns/GetUiIntentApi.java#L127-L134
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java
CFMLExpressionInterpreter.negateMinusOp
private Ref negateMinusOp() throws PageException { // And Operation if (cfml.forwardIfCurrent('-')) { if (cfml.forwardIfCurrent('-')) { cfml.removeSpace(); Ref expr = clip(); Ref res = preciseMath ? new BigMinus(expr, new LNumber(new Double(1)), limited) : new Minus(expr, new LNumber(new Double(1)), limited); return new Assign(expr, res, limited); } cfml.removeSpace(); return new Negate(clip(), limited); } if (cfml.forwardIfCurrent('+')) { if (cfml.forwardIfCurrent('+')) { cfml.removeSpace(); Ref expr = clip(); Ref res = preciseMath ? new BigPlus(expr, new LNumber(new Double(1)), limited) : new Plus(expr, new LNumber(new Double(1)), limited); return new Assign(expr, res, limited); } cfml.removeSpace(); return new Casting("numeric", CFTypes.TYPE_NUMERIC, clip()); } return clip(); }
java
private Ref negateMinusOp() throws PageException { // And Operation if (cfml.forwardIfCurrent('-')) { if (cfml.forwardIfCurrent('-')) { cfml.removeSpace(); Ref expr = clip(); Ref res = preciseMath ? new BigMinus(expr, new LNumber(new Double(1)), limited) : new Minus(expr, new LNumber(new Double(1)), limited); return new Assign(expr, res, limited); } cfml.removeSpace(); return new Negate(clip(), limited); } if (cfml.forwardIfCurrent('+')) { if (cfml.forwardIfCurrent('+')) { cfml.removeSpace(); Ref expr = clip(); Ref res = preciseMath ? new BigPlus(expr, new LNumber(new Double(1)), limited) : new Plus(expr, new LNumber(new Double(1)), limited); return new Assign(expr, res, limited); } cfml.removeSpace(); return new Casting("numeric", CFTypes.TYPE_NUMERIC, clip()); } return clip(); }
[ "private", "Ref", "negateMinusOp", "(", ")", "throws", "PageException", "{", "// And Operation", "if", "(", "cfml", ".", "forwardIfCurrent", "(", "'", "'", ")", ")", "{", "if", "(", "cfml", ".", "forwardIfCurrent", "(", "'", "'", ")", ")", "{", "cfml", ...
Liest die Vordlobe einer Zahl ein @return CFXD Element @throws PageException
[ "Liest", "die", "Vordlobe", "einer", "Zahl", "ein" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L894-L919
kuujo/vertigo
core/src/main/java/net/kuujo/vertigo/util/Components.java
Components.buildConfig
public static JsonObject buildConfig(InstanceContext context, Cluster cluster) { JsonObject config = context.component().config().copy(); return config.putObject("__context__", Contexts.serialize(context)); }
java
public static JsonObject buildConfig(InstanceContext context, Cluster cluster) { JsonObject config = context.component().config().copy(); return config.putObject("__context__", Contexts.serialize(context)); }
[ "public", "static", "JsonObject", "buildConfig", "(", "InstanceContext", "context", ",", "Cluster", "cluster", ")", "{", "JsonObject", "config", "=", "context", ".", "component", "(", ")", ".", "config", "(", ")", ".", "copy", "(", ")", ";", "return", "con...
Builds a verticle configuration. @param context The verticle context. @return A verticle configuration.
[ "Builds", "a", "verticle", "configuration", "." ]
train
https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Components.java#L85-L88
google/j2objc
jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java
MutableBigInteger.getBlock
private MutableBigInteger getBlock(int index, int numBlocks, int blockLength) { int blockStart = index * blockLength; if (blockStart >= intLen) { return new MutableBigInteger(); } int blockEnd; if (index == numBlocks-1) { blockEnd = intLen; } else { blockEnd = (index+1) * blockLength; } if (blockEnd > intLen) { return new MutableBigInteger(); } int[] newVal = Arrays.copyOfRange(value, offset+intLen-blockEnd, offset+intLen-blockStart); return new MutableBigInteger(newVal); }
java
private MutableBigInteger getBlock(int index, int numBlocks, int blockLength) { int blockStart = index * blockLength; if (blockStart >= intLen) { return new MutableBigInteger(); } int blockEnd; if (index == numBlocks-1) { blockEnd = intLen; } else { blockEnd = (index+1) * blockLength; } if (blockEnd > intLen) { return new MutableBigInteger(); } int[] newVal = Arrays.copyOfRange(value, offset+intLen-blockEnd, offset+intLen-blockStart); return new MutableBigInteger(newVal); }
[ "private", "MutableBigInteger", "getBlock", "(", "int", "index", ",", "int", "numBlocks", ",", "int", "blockLength", ")", "{", "int", "blockStart", "=", "index", "*", "blockLength", ";", "if", "(", "blockStart", ">=", "intLen", ")", "{", "return", "new", "...
Returns a {@code MutableBigInteger} containing {@code blockLength} ints from {@code this} number, starting at {@code index*blockLength}.<br/> Used by Burnikel-Ziegler division. @param index the block index @param numBlocks the total number of blocks in {@code this} number @param blockLength length of one block in units of 32 bits @return
[ "Returns", "a", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1403-L1421
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java
FedoraResourceImpl.getLastModifiedDate
@Override public Instant getLastModifiedDate() { final Instant createdDate = getCreatedDate(); try { final long created = createdDate == null ? NO_TIME : createdDate.toEpochMilli(); if (hasProperty(FEDORA_LASTMODIFIED)) { return ofEpochMilli(getTimestamp(FEDORA_LASTMODIFIED, created)); } else if (hasProperty(JCR_LASTMODIFIED)) { return ofEpochMilli(getTimestamp(JCR_LASTMODIFIED, created)); } } catch (final PathNotFoundException e) { throw new PathNotFoundRuntimeException(e); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } LOGGER.debug("Could not get last modified date property for node {}", node); if (createdDate != null) { LOGGER.trace("Using created date for last modified date for node {}", node); return createdDate; } return null; }
java
@Override public Instant getLastModifiedDate() { final Instant createdDate = getCreatedDate(); try { final long created = createdDate == null ? NO_TIME : createdDate.toEpochMilli(); if (hasProperty(FEDORA_LASTMODIFIED)) { return ofEpochMilli(getTimestamp(FEDORA_LASTMODIFIED, created)); } else if (hasProperty(JCR_LASTMODIFIED)) { return ofEpochMilli(getTimestamp(JCR_LASTMODIFIED, created)); } } catch (final PathNotFoundException e) { throw new PathNotFoundRuntimeException(e); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } LOGGER.debug("Could not get last modified date property for node {}", node); if (createdDate != null) { LOGGER.trace("Using created date for last modified date for node {}", node); return createdDate; } return null; }
[ "@", "Override", "public", "Instant", "getLastModifiedDate", "(", ")", "{", "final", "Instant", "createdDate", "=", "getCreatedDate", "(", ")", ";", "try", "{", "final", "long", "created", "=", "createdDate", "==", "null", "?", "NO_TIME", ":", "createdDate", ...
This method gets the last modified date for this FedoraResource. Because the last modified date is managed by fcrepo (not ModeShape) while the created date *is* sometimes managed by ModeShape in the current implementation it's possible that the last modified date will be before the created date. Instead of making a second update to correct the modified date, in cases where the modified date is ealier than the created date, this class presents the created date instead. Any method that exposes the last modified date must maintain this illusion so that that external callers are presented with a sensible and consistent representation of this resource. @return the last modified Instant (or the created Instant if it was after the last modified date)
[ "This", "method", "gets", "the", "last", "modified", "date", "for", "this", "FedoraResource", ".", "Because", "the", "last", "modified", "date", "is", "managed", "by", "fcrepo", "(", "not", "ModeShape", ")", "while", "the", "created", "date", "*", "is", "*...
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java#L702-L726
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.executePreparedQuery
protected final ResultSet executePreparedQuery(String sql, List<Object> params) throws SQLException { AbstractQueryCommand command = createPreparedQueryCommand(sql, params); ResultSet rs = null; try { rs = command.execute(); } finally { command.closeResources(); } return rs; }
java
protected final ResultSet executePreparedQuery(String sql, List<Object> params) throws SQLException { AbstractQueryCommand command = createPreparedQueryCommand(sql, params); ResultSet rs = null; try { rs = command.execute(); } finally { command.closeResources(); } return rs; }
[ "protected", "final", "ResultSet", "executePreparedQuery", "(", "String", "sql", ",", "List", "<", "Object", ">", "params", ")", "throws", "SQLException", "{", "AbstractQueryCommand", "command", "=", "createPreparedQueryCommand", "(", "sql", ",", "params", ")", ";...
Useful helper method which handles resource management when executing a prepared query which returns a result set. Derived classes of Sql can override "createPreparedQueryCommand" and then call this method to access the ResultSet returned from the provided query. @param sql query to execute @param params parameters matching question mark placeholders in the query @return the resulting ResultSet @throws SQLException if a database error occurs
[ "Useful", "helper", "method", "which", "handles", "resource", "management", "when", "executing", "a", "prepared", "query", "which", "returns", "a", "result", "set", ".", "Derived", "classes", "of", "Sql", "can", "override", "createPreparedQueryCommand", "and", "th...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L3932-L3942
orbisgis/h2gis
h2gis-utilities/src/main/java/org/h2gis/utilities/JDBCUtilities.java
JDBCUtilities.tableExists
public static boolean tableExists(Connection connection, String tableName) throws SQLException { try (Statement statement = connection.createStatement()) { statement.execute("SELECT * FROM " + TableLocation.parse(tableName) + " LIMIT 0;"); return true; } catch (SQLException ex) { return false; } }
java
public static boolean tableExists(Connection connection, String tableName) throws SQLException { try (Statement statement = connection.createStatement()) { statement.execute("SELECT * FROM " + TableLocation.parse(tableName) + " LIMIT 0;"); return true; } catch (SQLException ex) { return false; } }
[ "public", "static", "boolean", "tableExists", "(", "Connection", "connection", ",", "String", "tableName", ")", "throws", "SQLException", "{", "try", "(", "Statement", "statement", "=", "connection", ".", "createStatement", "(", ")", ")", "{", "statement", ".", ...
Return true if the table exists. @param connection Connection @param tableName Table name @return true if the table exists @throws java.sql.SQLException
[ "Return", "true", "if", "the", "table", "exists", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-utilities/src/main/java/org/h2gis/utilities/JDBCUtilities.java#L319-L326
icode/ameba
src/main/java/ameba/db/ebean/filter/CommonExprTransformer.java
CommonExprTransformer.textCommonTerms
public static Expression textCommonTerms(String operator, Val<Expression>[] args, EbeanExprInvoker invoker) { checkTextOptions(operator, args); Map<String, Val<Expression>> ops = ((TextOptionsExpression) args[1].expr()).options; TextCommonTerms common = new TextCommonTerms(); for (String k : ops.keySet()) { switch (k) { case "cutoff": common.cutoffFrequency(ops.get(k).doubleV()); break; case "lowFreqAnd": common.lowFreqOperatorAnd(ops.get(k).bool()); break; case "highFreqAnd": common.highFreqOperatorAnd(ops.get(k).bool()); break; case "minMatch": common.minShouldMatch(ops.get(k).string()); break; case "minMatchLowFreq": common.minShouldMatchLowFreq(ops.get(k).string()); break; case "minMatchHighFreq": common.minShouldMatchHighFreq(ops.get(k).string()); break; } } return factory(invoker).textCommonTerms(args[0].string(), common); }
java
public static Expression textCommonTerms(String operator, Val<Expression>[] args, EbeanExprInvoker invoker) { checkTextOptions(operator, args); Map<String, Val<Expression>> ops = ((TextOptionsExpression) args[1].expr()).options; TextCommonTerms common = new TextCommonTerms(); for (String k : ops.keySet()) { switch (k) { case "cutoff": common.cutoffFrequency(ops.get(k).doubleV()); break; case "lowFreqAnd": common.lowFreqOperatorAnd(ops.get(k).bool()); break; case "highFreqAnd": common.highFreqOperatorAnd(ops.get(k).bool()); break; case "minMatch": common.minShouldMatch(ops.get(k).string()); break; case "minMatchLowFreq": common.minShouldMatchLowFreq(ops.get(k).string()); break; case "minMatchHighFreq": common.minShouldMatchHighFreq(ops.get(k).string()); break; } } return factory(invoker).textCommonTerms(args[0].string(), common); }
[ "public", "static", "Expression", "textCommonTerms", "(", "String", "operator", ",", "Val", "<", "Expression", ">", "[", "]", "args", ",", "EbeanExprInvoker", "invoker", ")", "{", "checkTextOptions", "(", "operator", ",", "args", ")", ";", "Map", "<", "Strin...
<p>textCommonTerms.</p> @param operator a {@link java.lang.String} object. @param args an array of {@link ameba.db.dsl.QueryExprMeta.Val} objects. @param invoker a {@link ameba.db.ebean.filter.EbeanExprInvoker} object. @return a {@link io.ebean.Expression} object.
[ "<p", ">", "textCommonTerms", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/filter/CommonExprTransformer.java#L458-L485
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/util/StreamUtil.java
StreamUtil.cloneContent
public static InputStream cloneContent(InputStream source, long readbackSize, ByteArrayOutputStream target) throws IOException { return cloneContent(source, (int)Math.min((long)Integer.MAX_VALUE, readbackSize), target); }
java
public static InputStream cloneContent(InputStream source, long readbackSize, ByteArrayOutputStream target) throws IOException { return cloneContent(source, (int)Math.min((long)Integer.MAX_VALUE, readbackSize), target); }
[ "public", "static", "InputStream", "cloneContent", "(", "InputStream", "source", ",", "long", "readbackSize", ",", "ByteArrayOutputStream", "target", ")", "throws", "IOException", "{", "return", "cloneContent", "(", "source", ",", "(", "int", ")", "Math", ".", "...
a convenience method to reduce all the casting of HttpEntity.getContentLength() to int
[ "a", "convenience", "method", "to", "reduce", "all", "the", "casting", "of", "HttpEntity", ".", "getContentLength", "()", "to", "int" ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/util/StreamUtil.java#L119-L121
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/KolmogorovSmirnovIndependentSamples.java
KolmogorovSmirnovIndependentSamples.checkCriticalValue
private static boolean checkCriticalValue(double score, boolean is_twoTailed, int n1, int n2, double aLevel) { boolean rejected=false; double criticalValue= calculateCriticalValue(is_twoTailed,n1,n2,aLevel); if(score>criticalValue) { rejected=true; } return rejected; }
java
private static boolean checkCriticalValue(double score, boolean is_twoTailed, int n1, int n2, double aLevel) { boolean rejected=false; double criticalValue= calculateCriticalValue(is_twoTailed,n1,n2,aLevel); if(score>criticalValue) { rejected=true; } return rejected; }
[ "private", "static", "boolean", "checkCriticalValue", "(", "double", "score", ",", "boolean", "is_twoTailed", ",", "int", "n1", ",", "int", "n2", ",", "double", "aLevel", ")", "{", "boolean", "rejected", "=", "false", ";", "double", "criticalValue", "=", "ca...
Checks the Critical Value to determine if the Hypothesis should be rejected @param score @param is_twoTailed @param n1 @param n2 @param aLevel @return
[ "Checks", "the", "Critical", "Value", "to", "determine", "if", "the", "Hypothesis", "should", "be", "rejected" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/KolmogorovSmirnovIndependentSamples.java#L115-L126
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/images/ImageGenerator.java
ImageGenerator.drawImageWithNewMapContent
public BufferedImage drawImageWithNewMapContent( ReferencedEnvelope ref, int imageWidth, int imageHeight, double buffer ) { MapContent content = new MapContent(); content.setTitle("dump"); if (forceCrs != null) { content.getViewport().setCoordinateReferenceSystem(forceCrs); content.getViewport().setBounds(ref); } synchronized (synchronizedLayers) { for( Layer layer : synchronizedLayers ) { content.addLayer(layer); } } StreamingRenderer renderer = new StreamingRenderer(); renderer.setMapContent(content); if (buffer > 0.0) { ref = new ReferencedEnvelope(ref); ref.expandBy(buffer, buffer); } double envW = ref.getWidth(); double envH = ref.getHeight(); if (envW < envH) { double newEnvW = envH * (double) imageWidth / (double) imageHeight; double delta = newEnvW - envW; ref.expandBy(delta / 2, 0); } else { double newEnvH = envW * (double) imageHeight / (double) imageWidth; double delta = newEnvH - envH; ref.expandBy(0, delta / 2.0); } Rectangle imageBounds = new Rectangle(0, 0, imageWidth, imageHeight); BufferedImage dumpImage = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = dumpImage.createGraphics(); g2d.fillRect(0, 0, imageWidth, imageHeight); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); renderer.paint(g2d, imageBounds, ref); return dumpImage; }
java
public BufferedImage drawImageWithNewMapContent( ReferencedEnvelope ref, int imageWidth, int imageHeight, double buffer ) { MapContent content = new MapContent(); content.setTitle("dump"); if (forceCrs != null) { content.getViewport().setCoordinateReferenceSystem(forceCrs); content.getViewport().setBounds(ref); } synchronized (synchronizedLayers) { for( Layer layer : synchronizedLayers ) { content.addLayer(layer); } } StreamingRenderer renderer = new StreamingRenderer(); renderer.setMapContent(content); if (buffer > 0.0) { ref = new ReferencedEnvelope(ref); ref.expandBy(buffer, buffer); } double envW = ref.getWidth(); double envH = ref.getHeight(); if (envW < envH) { double newEnvW = envH * (double) imageWidth / (double) imageHeight; double delta = newEnvW - envW; ref.expandBy(delta / 2, 0); } else { double newEnvH = envW * (double) imageHeight / (double) imageWidth; double delta = newEnvH - envH; ref.expandBy(0, delta / 2.0); } Rectangle imageBounds = new Rectangle(0, 0, imageWidth, imageHeight); BufferedImage dumpImage = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = dumpImage.createGraphics(); g2d.fillRect(0, 0, imageWidth, imageHeight); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); renderer.paint(g2d, imageBounds, ref); return dumpImage; }
[ "public", "BufferedImage", "drawImageWithNewMapContent", "(", "ReferencedEnvelope", "ref", ",", "int", "imageWidth", ",", "int", "imageHeight", ",", "double", "buffer", ")", "{", "MapContent", "content", "=", "new", "MapContent", "(", ")", ";", "content", ".", "...
Draw the map on an image creating a new MapContent. @param bounds the area of interest. @param imageWidth the width of the image to produce. @param imageHeight the height of the image to produce. @param buffer the buffer to add around the map bounds in map units. @return the image.
[ "Draw", "the", "map", "on", "an", "image", "creating", "a", "new", "MapContent", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/images/ImageGenerator.java#L512-L557
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java
FailoverGroupsInner.forceFailoverAllowDataLossAsync
public Observable<FailoverGroupInner> forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) { return response.body(); } }); }
java
public Observable<FailoverGroupInner> forceFailoverAllowDataLossAsync(String resourceGroupName, String serverName, String failoverGroupName) { return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, failoverGroupName).map(new Func1<ServiceResponse<FailoverGroupInner>, FailoverGroupInner>() { @Override public FailoverGroupInner call(ServiceResponse<FailoverGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "FailoverGroupInner", ">", "forceFailoverAllowDataLossAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "failoverGroupName", ")", "{", "return", "forceFailoverAllowDataLossWithServiceResponseAsync", "(", "reso...
Fails over from the current primary server to this server. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server containing the failover group. @param failoverGroupName The name of the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Fails", "over", "from", "the", "current", "primary", "server", "to", "this", "server", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/FailoverGroupsInner.java#L1087-L1094
nohana/Amalgam
amalgam/src/main/java/com/amalgam/security/MessageDigestUtils.java
MessageDigestUtils.computeSha256
public static byte[] computeSha256(final byte[] data) { try { return MessageDigest.getInstance(ALGORITHM_SHA_256).digest(data); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("unsupported algorithm for message digest: ", e); } }
java
public static byte[] computeSha256(final byte[] data) { try { return MessageDigest.getInstance(ALGORITHM_SHA_256).digest(data); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("unsupported algorithm for message digest: ", e); } }
[ "public", "static", "byte", "[", "]", "computeSha256", "(", "final", "byte", "[", "]", "data", ")", "{", "try", "{", "return", "MessageDigest", ".", "getInstance", "(", "ALGORITHM_SHA_256", ")", ".", "digest", "(", "data", ")", ";", "}", "catch", "(", ...
Calculate the message digest value with SHA 256 algorithm. @param data to calculate. @return message digest value.
[ "Calculate", "the", "message", "digest", "value", "with", "SHA", "256", "algorithm", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/security/MessageDigestUtils.java#L38-L44
kiswanij/jk-util
src/main/java/com/jk/util/validation/builtin/ValidationBundle.java
ValidationBundle.getMessage
public static String getMessage(final Class class1, final String string, final Object[] objects) { return JKMessage.get(string, objects); }
java
public static String getMessage(final Class class1, final String string, final Object[] objects) { return JKMessage.get(string, objects); }
[ "public", "static", "String", "getMessage", "(", "final", "Class", "class1", ",", "final", "String", "string", ",", "final", "Object", "[", "]", "objects", ")", "{", "return", "JKMessage", ".", "get", "(", "string", ",", "objects", ")", ";", "}" ]
Gets the message. @param class1 the class 1 @param string the string @param objects the objects @return the message
[ "Gets", "the", "message", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/validation/builtin/ValidationBundle.java#L49-L51
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java
Log.enableSubsystem
public static void enableSubsystem(ISubsystem subsystem, boolean enable) { if (enable_logging) { if (enable) { mEnabledSubsystems.add(subsystem); } else { mEnabledSubsystems.remove(subsystem); } } }
java
public static void enableSubsystem(ISubsystem subsystem, boolean enable) { if (enable_logging) { if (enable) { mEnabledSubsystems.add(subsystem); } else { mEnabledSubsystems.remove(subsystem); } } }
[ "public", "static", "void", "enableSubsystem", "(", "ISubsystem", "subsystem", ",", "boolean", "enable", ")", "{", "if", "(", "enable_logging", ")", "{", "if", "(", "enable", ")", "{", "mEnabledSubsystems", ".", "add", "(", "subsystem", ")", ";", "}", "els...
Enable/disable the logging component @param subsystem The logging component @param enable true - to enable it, false - to disable it
[ "Enable", "/", "disable", "the", "logging", "component" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/log/Log.java#L136-L144
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F32.java
ImplRectifyImageOps_F32.adjustUncalibrated
private static void adjustUncalibrated(FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight, RectangleLength2D_F32 bound, float scale) { // translation float deltaX = -bound.x0*scale; float deltaY = -bound.y0*scale; // adjustment matrix SimpleMatrix A = new SimpleMatrix(3,3,true,new float[]{scale,0,deltaX,0,scale,deltaY,0,0,1}); SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft); SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight); rectifyLeft.set(A.mult(rL).getFDRM()); rectifyRight.set(A.mult(rR).getFDRM()); }
java
private static void adjustUncalibrated(FMatrixRMaj rectifyLeft, FMatrixRMaj rectifyRight, RectangleLength2D_F32 bound, float scale) { // translation float deltaX = -bound.x0*scale; float deltaY = -bound.y0*scale; // adjustment matrix SimpleMatrix A = new SimpleMatrix(3,3,true,new float[]{scale,0,deltaX,0,scale,deltaY,0,0,1}); SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft); SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight); rectifyLeft.set(A.mult(rL).getFDRM()); rectifyRight.set(A.mult(rR).getFDRM()); }
[ "private", "static", "void", "adjustUncalibrated", "(", "FMatrixRMaj", "rectifyLeft", ",", "FMatrixRMaj", "rectifyRight", ",", "RectangleLength2D_F32", "bound", ",", "float", "scale", ")", "{", "// translation", "float", "deltaX", "=", "-", "bound", ".", "x0", "*"...
Internal function which applies the rectification adjustment to an uncalibrated stereo pair
[ "Internal", "function", "which", "applies", "the", "rectification", "adjustment", "to", "an", "uncalibrated", "stereo", "pair" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F32.java#L156-L169
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readProject
private void readProject(Project project) { Task mpxjTask = m_projectFile.addTask(); //project.getAuthor() mpxjTask.setBaselineCost(project.getBaselineCost()); mpxjTask.setBaselineFinish(project.getBaselineFinishDate()); mpxjTask.setBaselineStart(project.getBaselineStartDate()); //project.getBudget(); //project.getCompany() mpxjTask.setFinish(project.getFinishDate()); //project.getGoal() //project.getHyperlinks() //project.getMarkerID() mpxjTask.setName(project.getName()); mpxjTask.setNotes(project.getNote()); mpxjTask.setPriority(project.getPriority()); // project.getSite() mpxjTask.setStart(project.getStartDate()); // project.getStyleProject() // project.getTask() // project.getTimeScale() // project.getViewProperties() String projectIdentifier = project.getID().toString(); mpxjTask.setGUID(UUID.nameUUIDFromBytes(projectIdentifier.getBytes())); // // Sort the tasks into the correct order // List<Document.Projects.Project.Task> tasks = new ArrayList<Document.Projects.Project.Task>(project.getTask()); final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(tasks, new Comparator<Document.Projects.Project.Task>() { @Override public int compare(Document.Projects.Project.Task o1, Document.Projects.Project.Task o2) { return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber()); } }); Map<String, Task> map = new HashMap<String, Task>(); map.put("", mpxjTask); for (Document.Projects.Project.Task task : tasks) { readTask(projectIdentifier, map, task); } }
java
private void readProject(Project project) { Task mpxjTask = m_projectFile.addTask(); //project.getAuthor() mpxjTask.setBaselineCost(project.getBaselineCost()); mpxjTask.setBaselineFinish(project.getBaselineFinishDate()); mpxjTask.setBaselineStart(project.getBaselineStartDate()); //project.getBudget(); //project.getCompany() mpxjTask.setFinish(project.getFinishDate()); //project.getGoal() //project.getHyperlinks() //project.getMarkerID() mpxjTask.setName(project.getName()); mpxjTask.setNotes(project.getNote()); mpxjTask.setPriority(project.getPriority()); // project.getSite() mpxjTask.setStart(project.getStartDate()); // project.getStyleProject() // project.getTask() // project.getTimeScale() // project.getViewProperties() String projectIdentifier = project.getID().toString(); mpxjTask.setGUID(UUID.nameUUIDFromBytes(projectIdentifier.getBytes())); // // Sort the tasks into the correct order // List<Document.Projects.Project.Task> tasks = new ArrayList<Document.Projects.Project.Task>(project.getTask()); final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(tasks, new Comparator<Document.Projects.Project.Task>() { @Override public int compare(Document.Projects.Project.Task o1, Document.Projects.Project.Task o2) { return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber()); } }); Map<String, Task> map = new HashMap<String, Task>(); map.put("", mpxjTask); for (Document.Projects.Project.Task task : tasks) { readTask(projectIdentifier, map, task); } }
[ "private", "void", "readProject", "(", "Project", "project", ")", "{", "Task", "mpxjTask", "=", "m_projectFile", ".", "addTask", "(", ")", ";", "//project.getAuthor()", "mpxjTask", ".", "setBaselineCost", "(", "project", ".", "getBaselineCost", "(", ")", ")", ...
Read a project from a ConceptDraw PROJECT file. @param project ConceptDraw PROJECT project
[ "Read", "a", "project", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L350-L397
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java
SpaceRepository.createSpace
public <S extends io.sarl.lang.core.Space> S createSpace(SpaceID spaceID, Class<? extends SpaceSpecification<S>> spec, Object... creationParams) { synchronized (getSpaceRepositoryMutex()) { if (!this.spaces.containsKey(spaceID)) { return createSpaceInstance(spec, spaceID, true, creationParams); } } return null; }
java
public <S extends io.sarl.lang.core.Space> S createSpace(SpaceID spaceID, Class<? extends SpaceSpecification<S>> spec, Object... creationParams) { synchronized (getSpaceRepositoryMutex()) { if (!this.spaces.containsKey(spaceID)) { return createSpaceInstance(spec, spaceID, true, creationParams); } } return null; }
[ "public", "<", "S", "extends", "io", ".", "sarl", ".", "lang", ".", "core", ".", "Space", ">", "S", "createSpace", "(", "SpaceID", "spaceID", ",", "Class", "<", "?", "extends", "SpaceSpecification", "<", "S", ">", ">", "spec", ",", "Object", "...", "...
Create a space. @param <S> - the type of the space to reply. @param spaceID ID of the space. @param spec specification of the space. @param creationParams creation parameters. @return the new space, or <code>null</code> if the space already exists.
[ "Create", "a", "space", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L276-L284
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java
Validator.expectIpv4
public void expectIpv4(String name, String message) { String value = Optional.ofNullable(get(name)).orElse(""); if (!InetAddressValidator.getInstance().isValidInet4Address(value)) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.IPV4_KEY.name(), name))); } }
java
public void expectIpv4(String name, String message) { String value = Optional.ofNullable(get(name)).orElse(""); if (!InetAddressValidator.getInstance().isValidInet4Address(value)) { addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.IPV4_KEY.name(), name))); } }
[ "public", "void", "expectIpv4", "(", "String", "name", ",", "String", "message", ")", "{", "String", "value", "=", "Optional", ".", "ofNullable", "(", "get", "(", "name", ")", ")", ".", "orElse", "(", "\"\"", ")", ";", "if", "(", "!", "InetAddressValid...
Validates a field to be a valid IPv4 address @param name The field to check @param message A custom error message instead of the default one
[ "Validates", "a", "field", "to", "be", "a", "valid", "IPv4", "address" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L280-L286
eurekaclinical/javautil
src/main/java/org/arp/javautil/arrays/Arrays.java
Arrays.contains
public static boolean contains(Object[] arr, Object obj) { if (arr != null) { for (int i = 0; i < arr.length; i++) { Object arri = arr[i]; if (arri == obj || (arri != null && arri.equals(obj))) { return true; } } } return false; }
java
public static boolean contains(Object[] arr, Object obj) { if (arr != null) { for (int i = 0; i < arr.length; i++) { Object arri = arr[i]; if (arri == obj || (arri != null && arri.equals(obj))) { return true; } } } return false; }
[ "public", "static", "boolean", "contains", "(", "Object", "[", "]", "arr", ",", "Object", "obj", ")", "{", "if", "(", "arr", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "...
Returns where an object is in a given array. @param arr the <code>Object[]</code> to search. @param obj the <code>Object</code> to search for. @return <code>true</code> of <code>obj</code> is in <code>arr</code>, <code>false</code> otherwise. Returns <code>false</code> if <code>arr</code> is <code>null</code>.
[ "Returns", "where", "an", "object", "is", "in", "a", "given", "array", "." ]
train
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/arrays/Arrays.java#L85-L95
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java
Hdf5Archive.hasAttribute
public boolean hasAttribute(String attributeName, String... groups) { synchronized (Hdf5Archive.LOCK_OBJECT) { if (groups.length == 0) return this.file.attrExists(attributeName); Group[] groupArray = openGroups(groups); boolean b = groupArray[groupArray.length - 1].attrExists(attributeName); closeGroups(groupArray); return b; } }
java
public boolean hasAttribute(String attributeName, String... groups) { synchronized (Hdf5Archive.LOCK_OBJECT) { if (groups.length == 0) return this.file.attrExists(attributeName); Group[] groupArray = openGroups(groups); boolean b = groupArray[groupArray.length - 1].attrExists(attributeName); closeGroups(groupArray); return b; } }
[ "public", "boolean", "hasAttribute", "(", "String", "attributeName", ",", "String", "...", "groups", ")", "{", "synchronized", "(", "Hdf5Archive", ".", "LOCK_OBJECT", ")", "{", "if", "(", "groups", ".", "length", "==", "0", ")", "return", "this", ".", "fil...
Check whether group path contains string attribute. @param attributeName Name of attribute @param groups Array of zero or more ancestor groups from root to parent. @return Boolean indicating whether attribute exists in group path.
[ "Check", "whether", "group", "path", "contains", "string", "attribute", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L177-L186
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java
StreamSegmentReadIndex.getSingleMemoryReadResultEntry
private CacheReadResultEntry getSingleMemoryReadResultEntry(long resultStartOffset, int maxLength) { Exceptions.checkNotClosed(this.closed, this); if (maxLength > 0 && checkReadAvailability(resultStartOffset, false) == ReadAvailability.Available) { // Look up an entry in the index that contains our requested start offset. synchronized (this.lock) { ReadIndexEntry indexEntry = this.indexEntries.get(resultStartOffset); if (indexEntry != null && indexEntry.isDataEntry()) { // We found an entry; return a result for it. return createMemoryRead(indexEntry, resultStartOffset, maxLength, true); } } } // Nothing could be found in the cache at the given offset. return null; }
java
private CacheReadResultEntry getSingleMemoryReadResultEntry(long resultStartOffset, int maxLength) { Exceptions.checkNotClosed(this.closed, this); if (maxLength > 0 && checkReadAvailability(resultStartOffset, false) == ReadAvailability.Available) { // Look up an entry in the index that contains our requested start offset. synchronized (this.lock) { ReadIndexEntry indexEntry = this.indexEntries.get(resultStartOffset); if (indexEntry != null && indexEntry.isDataEntry()) { // We found an entry; return a result for it. return createMemoryRead(indexEntry, resultStartOffset, maxLength, true); } } } // Nothing could be found in the cache at the given offset. return null; }
[ "private", "CacheReadResultEntry", "getSingleMemoryReadResultEntry", "(", "long", "resultStartOffset", ",", "int", "maxLength", ")", "{", "Exceptions", ".", "checkNotClosed", "(", "this", ".", "closed", ",", "this", ")", ";", "if", "(", "maxLength", ">", "0", "&...
Returns a CacheReadResultEntry that matches the specified search parameters, but only if the data is readily available in the cache and if there is an index entry that starts at that location.. As opposed from getSingleReadResultEntry(), this method will return null if the requested data is not available. @param resultStartOffset The Offset within the StreamSegment where to start returning data from. @param maxLength The maximum number of bytes to return. @return A CacheReadResultEntry representing the data to return.
[ "Returns", "a", "CacheReadResultEntry", "that", "matches", "the", "specified", "search", "parameters", "but", "only", "if", "the", "data", "is", "readily", "available", "in", "the", "cache", "and", "if", "there", "is", "an", "index", "entry", "that", "starts",...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L835-L851
diffplug/durian
src/com/diffplug/common/base/FieldsAndGetters.java
FieldsAndGetters.dumpNonNull
public static void dumpNonNull(String name, Object obj) { dumpNonNull(name, obj, StringPrinter.systemOut()); }
java
public static void dumpNonNull(String name, Object obj) { dumpNonNull(name, obj, StringPrinter.systemOut()); }
[ "public", "static", "void", "dumpNonNull", "(", "String", "name", ",", "Object", "obj", ")", "{", "dumpNonNull", "(", "name", ",", "obj", ",", "StringPrinter", ".", "systemOut", "(", ")", ")", ";", "}" ]
Dumps all non-null fields and getters of {@code obj} to {@code System.out}. @see #dumpIf
[ "Dumps", "all", "non", "-", "null", "fields", "and", "getters", "of", "{" ]
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/FieldsAndGetters.java#L177-L179
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.packEntry
public static void packEntry(File fileToPack, File destZipFile) { packEntry(fileToPack, destZipFile, IdentityNameMapper.INSTANCE); }
java
public static void packEntry(File fileToPack, File destZipFile) { packEntry(fileToPack, destZipFile, IdentityNameMapper.INSTANCE); }
[ "public", "static", "void", "packEntry", "(", "File", "fileToPack", ",", "File", "destZipFile", ")", "{", "packEntry", "(", "fileToPack", ",", "destZipFile", ",", "IdentityNameMapper", ".", "INSTANCE", ")", ";", "}" ]
Compresses the given file into a ZIP file. <p> The ZIP file must not be a directory and its parent directory must exist. @param fileToPack file that needs to be zipped. @param destZipFile ZIP file that will be created or overwritten.
[ "Compresses", "the", "given", "file", "into", "a", "ZIP", "file", ".", "<p", ">", "The", "ZIP", "file", "must", "not", "be", "a", "directory", "and", "its", "parent", "directory", "must", "exist", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1443-L1445
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java
CPOptionValuePersistenceImpl.findAll
@Override public List<CPOptionValue> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CPOptionValue> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPOptionValue", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp option values. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp option values @param end the upper bound of the range of cp option values (not inclusive) @return the range of cp option values
[ "Returns", "a", "range", "of", "all", "the", "cp", "option", "values", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L4268-L4271
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/PriorityBlockingQueue.java
PriorityBlockingQueue.siftUpComparable
private static <T> void siftUpComparable(int k, T x, Object[] array) { Comparable<? super T> key = (Comparable<? super T>) x; while (k > 0) { int parent = (k - 1) >>> 1; Object e = array[parent]; if (key.compareTo((T) e) >= 0) break; array[k] = e; k = parent; } array[k] = key; }
java
private static <T> void siftUpComparable(int k, T x, Object[] array) { Comparable<? super T> key = (Comparable<? super T>) x; while (k > 0) { int parent = (k - 1) >>> 1; Object e = array[parent]; if (key.compareTo((T) e) >= 0) break; array[k] = e; k = parent; } array[k] = key; }
[ "private", "static", "<", "T", ">", "void", "siftUpComparable", "(", "int", "k", ",", "T", "x", ",", "Object", "[", "]", "array", ")", "{", "Comparable", "<", "?", "super", "T", ">", "key", "=", "(", "Comparable", "<", "?", "super", "T", ">", ")"...
Inserts item x at position k, maintaining heap invariant by promoting x up the tree until it is greater than or equal to its parent, or is the root. To simplify and speed up coercions and comparisons. the Comparable and Comparator versions are separated into different methods that are otherwise identical. (Similarly for siftDown.) These methods are static, with heap state as arguments, to simplify use in light of possible comparator exceptions. @param k the position to fill @param x the item to insert @param array the heap array
[ "Inserts", "item", "x", "at", "position", "k", "maintaining", "heap", "invariant", "by", "promoting", "x", "up", "the", "tree", "until", "it", "is", "greater", "than", "or", "equal", "to", "its", "parent", "or", "is", "the", "root", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/PriorityBlockingQueue.java#L355-L366
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java
ServerTaskExecutor.executeTask
public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) { try { return execute(listener, task.getServerIdentity(), task.getOperation()); } catch (OperationFailedException e) { // Handle failures operation transformation failures final ServerIdentity identity = task.getServerIdentity(); final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT); final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT)); return 1; // 1 ms timeout since there is no reason to wait for the locally stored result } }
java
public int executeTask(final TransactionalProtocolClient.TransactionalOperationListener<ServerOperation> listener, final ServerUpdateTask task) { try { return execute(listener, task.getServerIdentity(), task.getOperation()); } catch (OperationFailedException e) { // Handle failures operation transformation failures final ServerIdentity identity = task.getServerIdentity(); final ServerOperation serverOperation = new ServerOperation(identity, task.getOperation(), null, null, OperationResultTransformer.ORIGINAL_RESULT); final TransactionalProtocolClient.PreparedOperation<ServerOperation> result = BlockingQueueOperationListener.FailedOperation.create(serverOperation, e); listener.operationPrepared(result); recordExecutedRequest(new ExecutedServerRequest(identity, result.getFinalResult(), OperationResultTransformer.ORIGINAL_RESULT)); return 1; // 1 ms timeout since there is no reason to wait for the locally stored result } }
[ "public", "int", "executeTask", "(", "final", "TransactionalProtocolClient", ".", "TransactionalOperationListener", "<", "ServerOperation", ">", "listener", ",", "final", "ServerUpdateTask", "task", ")", "{", "try", "{", "return", "execute", "(", "listener", ",", "t...
Execute a server task. @param listener the transactional server listener @param task the server task @return time to wait in ms for a response from the server, or {@code -1} if the task execution failed locally
[ "Execute", "a", "server", "task", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/ServerTaskExecutor.java#L81-L94
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
ISPNCacheFactory.createCache
public Cache<K, V> createCache(final String regionId, MappedParametrizedObjectEntry parameterEntry) throws RepositoryConfigurationException { // get Infinispan configuration file path final String configurationPath = parameterEntry.getParameterValue(INFINISPAN_CONFIG); final String jndiUrl = parameterEntry.getParameterValue(STORE_JNDI_URL, null); LOG.info("Infinispan Cache configuration used: " + configurationPath); // avoid dashes in cache name. Some SQL servers doesn't allow dashes in table names final String regionIdEscaped = regionId.replace("-", "_"); // prepare configuration final InputStream configStream; try { // fill template configStream = configurationHelper.fillTemplate(configurationPath, parameterEntry.getParameters()); } catch (IOException e) { throw new RepositoryConfigurationException(e); } // create cache final EmbeddedCacheManager manager; try { // creating new CacheManager using SecurityHelper manager = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<EmbeddedCacheManager>() { public EmbeddedCacheManager run() throws Exception { ParserRegistry parser = new ParserRegistry(Thread.currentThread().getContextClassLoader()); // Loads the configuration from the input stream ConfigurationBuilderHolder holder = parser.parse(configStream); GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder(); Utils.loadJGroupsConfig(configurationManager, configBuilder.build(), configBuilder); return getUniqueInstance(regionIdEscaped, holder, transactionManager, jndiUrl); } }); } catch (PrivilegedActionException pae) { Throwable cause = pae.getCause(); throw new RepositoryConfigurationException(cause); } PrivilegedAction<Cache<K, V>> action = new PrivilegedAction<Cache<K, V>>() { public Cache<K, V> run() { Cache<K, V> cache = manager.getCache(regionIdEscaped); if (cache.getStatus() == ComponentStatus.TERMINATED) { cache.start(); LOG.info("The cache corresponding to the region {} was in state Terminated, so it has been restarted", regionIdEscaped); } return cache; } }; Cache<K, V> cache = SecurityHelper.doPrivilegedAction(action); return cache; }
java
public Cache<K, V> createCache(final String regionId, MappedParametrizedObjectEntry parameterEntry) throws RepositoryConfigurationException { // get Infinispan configuration file path final String configurationPath = parameterEntry.getParameterValue(INFINISPAN_CONFIG); final String jndiUrl = parameterEntry.getParameterValue(STORE_JNDI_URL, null); LOG.info("Infinispan Cache configuration used: " + configurationPath); // avoid dashes in cache name. Some SQL servers doesn't allow dashes in table names final String regionIdEscaped = regionId.replace("-", "_"); // prepare configuration final InputStream configStream; try { // fill template configStream = configurationHelper.fillTemplate(configurationPath, parameterEntry.getParameters()); } catch (IOException e) { throw new RepositoryConfigurationException(e); } // create cache final EmbeddedCacheManager manager; try { // creating new CacheManager using SecurityHelper manager = SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<EmbeddedCacheManager>() { public EmbeddedCacheManager run() throws Exception { ParserRegistry parser = new ParserRegistry(Thread.currentThread().getContextClassLoader()); // Loads the configuration from the input stream ConfigurationBuilderHolder holder = parser.parse(configStream); GlobalConfigurationBuilder configBuilder = holder.getGlobalConfigurationBuilder(); Utils.loadJGroupsConfig(configurationManager, configBuilder.build(), configBuilder); return getUniqueInstance(regionIdEscaped, holder, transactionManager, jndiUrl); } }); } catch (PrivilegedActionException pae) { Throwable cause = pae.getCause(); throw new RepositoryConfigurationException(cause); } PrivilegedAction<Cache<K, V>> action = new PrivilegedAction<Cache<K, V>>() { public Cache<K, V> run() { Cache<K, V> cache = manager.getCache(regionIdEscaped); if (cache.getStatus() == ComponentStatus.TERMINATED) { cache.start(); LOG.info("The cache corresponding to the region {} was in state Terminated, so it has been restarted", regionIdEscaped); } return cache; } }; Cache<K, V> cache = SecurityHelper.doPrivilegedAction(action); return cache; }
[ "public", "Cache", "<", "K", ",", "V", ">", "createCache", "(", "final", "String", "regionId", ",", "MappedParametrizedObjectEntry", "parameterEntry", ")", "throws", "RepositoryConfigurationException", "{", "// get Infinispan configuration file path", "final", "String", "...
Factory that creates and starts pre-configured instances of Infinispan. Path to Infinispan configuration or template should be provided as "infinispan-configuration" property in parameterEntry instance. <br> @param regionId the unique id of the cache region to create @param parameterEntry @return @throws RepositoryConfigurationException
[ "Factory", "that", "creates", "and", "starts", "pre", "-", "configured", "instances", "of", "Infinispan", ".", "Path", "to", "Infinispan", "configuration", "or", "template", "should", "be", "provided", "as", "infinispan", "-", "configuration", "property", "in", ...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java#L139-L203
foundation-runtime/service-directory
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/LookupManagerImpl.java
LookupManagerImpl.addInstanceChangeListener
@Override public void addInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) throws ServiceException { ServiceInstanceUtils.validateManagerIsStarted(isStarted.get()); ServiceInstanceUtils.validateServiceName(serviceName); if (listener == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "ServiceInstanceChangeListener"); } ModelService service = getLookupService().getModelService(serviceName); if (service == null) { throw new ServiceException(ErrorCode.SERVICE_DOES_NOT_EXIST,ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(),serviceName); } getLookupService().addServiceInstanceChangeListener(serviceName, listener); }
java
@Override public void addInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) throws ServiceException { ServiceInstanceUtils.validateManagerIsStarted(isStarted.get()); ServiceInstanceUtils.validateServiceName(serviceName); if (listener == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "ServiceInstanceChangeListener"); } ModelService service = getLookupService().getModelService(serviceName); if (service == null) { throw new ServiceException(ErrorCode.SERVICE_DOES_NOT_EXIST,ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(),serviceName); } getLookupService().addServiceInstanceChangeListener(serviceName, listener); }
[ "@", "Override", "public", "void", "addInstanceChangeListener", "(", "String", "serviceName", ",", "ServiceInstanceChangeListener", "listener", ")", "throws", "ServiceException", "{", "ServiceInstanceUtils", ".", "validateManagerIsStarted", "(", "isStarted", ".", "get", "...
Add a ServiceInstanceChangeListener to the Service. This method will check the duplicated listener for the serviceName, if the listener already exists for the serviceName, do nothing. Throws IllegalArgumentException if serviceName or listener is null. @param serviceName the service name @param listener the ServiceInstanceChangeListener for the service @throws ServiceException
[ "Add", "a", "ServiceInstanceChangeListener", "to", "the", "Service", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/LookupManagerImpl.java#L413-L427
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagImage.java
CmsJspTagImage.getScaler
public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, String scaleParam) { if (scaleParam != null) { CmsImageScaler cropScaler = null; // use cropped image as a base for scaling cropScaler = new CmsImageScaler(scaleParam); if (scaler.getType() == 5) { // must reset height / width parameters in crop scaler for type 5 cropScaler.setWidth(cropScaler.getCropWidth()); cropScaler.setHeight(cropScaler.getCropHeight()); } scaler = cropScaler.getCropScaler(scaler); } // calculate target scale dimensions (if required) if (((scaler.getHeight() <= 0) || (scaler.getWidth() <= 0)) || ((scaler.getType() == 5) && scaler.isValid() && !scaler.isCropping())) { // read the image properties for the selected resource if (original.isValid()) { scaler = original.getReScaler(scaler); } } return scaler; }
java
public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, String scaleParam) { if (scaleParam != null) { CmsImageScaler cropScaler = null; // use cropped image as a base for scaling cropScaler = new CmsImageScaler(scaleParam); if (scaler.getType() == 5) { // must reset height / width parameters in crop scaler for type 5 cropScaler.setWidth(cropScaler.getCropWidth()); cropScaler.setHeight(cropScaler.getCropHeight()); } scaler = cropScaler.getCropScaler(scaler); } // calculate target scale dimensions (if required) if (((scaler.getHeight() <= 0) || (scaler.getWidth() <= 0)) || ((scaler.getType() == 5) && scaler.isValid() && !scaler.isCropping())) { // read the image properties for the selected resource if (original.isValid()) { scaler = original.getReScaler(scaler); } } return scaler; }
[ "public", "static", "CmsImageScaler", "getScaler", "(", "CmsImageScaler", "scaler", ",", "CmsImageScaler", "original", ",", "String", "scaleParam", ")", "{", "if", "(", "scaleParam", "!=", "null", ")", "{", "CmsImageScaler", "cropScaler", "=", "null", ";", "// u...
Creates the images scaler used by this image tag.<p> @param scaler the scaler created from this tags parameters @param original a scaler that contains the original image dimensions @param scaleParam optional scaler parameters for cropping @return the images scaler used by this image tag
[ "Creates", "the", "images", "scaler", "used", "by", "this", "image", "tag", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagImage.java#L161-L183
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/RunUnderUOWCallback.java
RunUnderUOWCallback.contextChange
public void contextChange(int typeOfChange, UOWCoordinator UOW) throws IllegalStateException { EJSDeployedSupport s = EJSContainer.getMethodContext(); // Note: runUnderUOW() may be called outside the scope of an EJB // method ( i.e. no method context ), in which case this // method call should just be ignored. if (s != null) { switch (typeOfChange) { case POST_BEGIN: s.ivRunUnderUOW++; // d601655 break; case POST_END: s.ivRunUnderUOW--; // d601655 break; default: throw new IllegalStateException("Illegal type of change for runUnderUOW callback : " + getTypeString(typeOfChange)); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "contextChange : " + getTypeString(typeOfChange) + " : " + (s == null ? null : "depth=" + s.ivRunUnderUOW + ", " + s)); // d601655 }
java
public void contextChange(int typeOfChange, UOWCoordinator UOW) throws IllegalStateException { EJSDeployedSupport s = EJSContainer.getMethodContext(); // Note: runUnderUOW() may be called outside the scope of an EJB // method ( i.e. no method context ), in which case this // method call should just be ignored. if (s != null) { switch (typeOfChange) { case POST_BEGIN: s.ivRunUnderUOW++; // d601655 break; case POST_END: s.ivRunUnderUOW--; // d601655 break; default: throw new IllegalStateException("Illegal type of change for runUnderUOW callback : " + getTypeString(typeOfChange)); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "contextChange : " + getTypeString(typeOfChange) + " : " + (s == null ? null : "depth=" + s.ivRunUnderUOW + ", " + s)); // d601655 }
[ "public", "void", "contextChange", "(", "int", "typeOfChange", ",", "UOWCoordinator", "UOW", ")", "throws", "IllegalStateException", "{", "EJSDeployedSupport", "s", "=", "EJSContainer", ".", "getMethodContext", "(", ")", ";", "// Note: runUnderUOW() may be called outside ...
This method will be called for POST_BEGIN and POST_END for all UOWs started with com.ibm.wsspi.uow.UOWManager.runUnderUOW(). <p> When called, an indication will be stored in the current EJB method context, recording the fact that a user initiated transaction has been started. This indication will be reset when the user initiated transaction completes and this method is called a second time. <p> The same EJB method context must be in effect for both the POST_BEGIN and POST_END calls for a given UOW, since the runUnderUOW method will start the UOW when called, and complete the UOW on exit. <p> An indication that a user initiated transaction started must be recoreded regardless of whether or not the current EJB method context is configured for Lightweight Local mode. A user initiated transaction does not actually effect the current method context, but rather any future EJB method calls that occur within the scope of the user initiated transaction. <p> @param typeOfChange one of the following values: <PRE> POST_BEGIN POST_END </PRE> @param UOW the Unit of Work that will be affected by the begin/end i.e. <PRE> POST_BEGIN - The UOW that was just begun POST_END - NULL </PRE> @exception IllegalStateException
[ "This", "method", "will", "be", "called", "for", "POST_BEGIN", "and", "POST_END", "for", "all", "UOWs", "started", "with", "com", ".", "ibm", ".", "wsspi", ".", "uow", ".", "UOWManager", ".", "runUnderUOW", "()", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/RunUnderUOWCallback.java#L79-L109
javagl/CommonUI
src/main/java/de/javagl/common/ui/table/renderer/SortOrderTableHeaderCellRenderer.java
SortOrderTableHeaderCellRenderer.createArrowShape
private static Shape createArrowShape(int w, int y0, int y1) { Path2D path = new Path2D.Double(); path.moveTo(0, y0); if ((w & 1) == 0) { path.lineTo(w>>1, y1); } else { int c = w>>1; path.lineTo(c, y1); path.lineTo(c+1, y1); } path.lineTo(w, y0); path.closePath(); return path; }
java
private static Shape createArrowShape(int w, int y0, int y1) { Path2D path = new Path2D.Double(); path.moveTo(0, y0); if ((w & 1) == 0) { path.lineTo(w>>1, y1); } else { int c = w>>1; path.lineTo(c, y1); path.lineTo(c+1, y1); } path.lineTo(w, y0); path.closePath(); return path; }
[ "private", "static", "Shape", "createArrowShape", "(", "int", "w", ",", "int", "y0", ",", "int", "y1", ")", "{", "Path2D", "path", "=", "new", "Path2D", ".", "Double", "(", ")", ";", "path", ".", "moveTo", "(", "0", ",", "y0", ")", ";", "if", "("...
Creates a triangle shape with the given coordinates @param w The width @param y0 The first y-coordinate @param y1 The second y-coordinate @return The shape
[ "Creates", "a", "triangle", "shape", "with", "the", "given", "coordinates" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/renderer/SortOrderTableHeaderCellRenderer.java#L150-L167
XDean/Java-EX
src/main/java/xdean/jex/util/task/TaskUtil.java
TaskUtil.firstSuccess
@SafeVarargs public static <T> T firstSuccess(FuncE0<T, ?>... tasks) throws IllegalStateException { for (FuncE0<T, ?> task : tasks) { Either<T, ?> res = throwToReturn(task); if (res.isLeft()) { return res.getLeft(); } } throw new IllegalStateException("All tasks failed"); }
java
@SafeVarargs public static <T> T firstSuccess(FuncE0<T, ?>... tasks) throws IllegalStateException { for (FuncE0<T, ?> task : tasks) { Either<T, ?> res = throwToReturn(task); if (res.isLeft()) { return res.getLeft(); } } throw new IllegalStateException("All tasks failed"); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "T", "firstSuccess", "(", "FuncE0", "<", "T", ",", "?", ">", "...", "tasks", ")", "throws", "IllegalStateException", "{", "for", "(", "FuncE0", "<", "T", ",", "?", ">", "task", ":", "tasks", ")",...
Return the first result of these tasks<br> IGNORE EXCEPTIONS. @param tasks @return can be null @throws IllegalStateException If all tasks failed.
[ "Return", "the", "first", "result", "of", "these", "tasks<br", ">", "IGNORE", "EXCEPTIONS", "." ]
train
https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/task/TaskUtil.java#L42-L51
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystems.java
JimfsFileSystems.createDefaultView
private static FileSystemView createDefaultView( Configuration config, JimfsFileStore fileStore, PathService pathService) throws IOException { JimfsPath workingDirPath = pathService.parsePath(config.workingDirectory); Directory dir = fileStore.getRoot(workingDirPath.root()); if (dir == null) { throw new IllegalArgumentException("Invalid working dir path: " + workingDirPath); } for (Name name : workingDirPath.names()) { Directory newDir = fileStore.directoryCreator().get(); fileStore.setInitialAttributes(newDir); dir.link(name, newDir); dir = newDir; } return new FileSystemView(fileStore, dir, workingDirPath); }
java
private static FileSystemView createDefaultView( Configuration config, JimfsFileStore fileStore, PathService pathService) throws IOException { JimfsPath workingDirPath = pathService.parsePath(config.workingDirectory); Directory dir = fileStore.getRoot(workingDirPath.root()); if (dir == null) { throw new IllegalArgumentException("Invalid working dir path: " + workingDirPath); } for (Name name : workingDirPath.names()) { Directory newDir = fileStore.directoryCreator().get(); fileStore.setInitialAttributes(newDir); dir.link(name, newDir); dir = newDir; } return new FileSystemView(fileStore, dir, workingDirPath); }
[ "private", "static", "FileSystemView", "createDefaultView", "(", "Configuration", "config", ",", "JimfsFileStore", "fileStore", ",", "PathService", "pathService", ")", "throws", "IOException", "{", "JimfsPath", "workingDirPath", "=", "pathService", ".", "parsePath", "("...
Creates the default view of the file system using the given working directory.
[ "Creates", "the", "default", "view", "of", "the", "file", "system", "using", "the", "given", "working", "directory", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/JimfsFileSystems.java#L114-L132
thinkaurelius/titan
titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/CassandraThriftKeyColumnValueStore.java
CassandraThriftKeyColumnValueStore.getSlice
@Override public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException { Map<StaticBuffer, EntryList> result = getNamesSlice(query.getKey(), query, txh); return Iterables.getOnlyElement(result.values(), EntryList.EMPTY_LIST); }
java
@Override public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException { Map<StaticBuffer, EntryList> result = getNamesSlice(query.getKey(), query, txh); return Iterables.getOnlyElement(result.values(), EntryList.EMPTY_LIST); }
[ "@", "Override", "public", "EntryList", "getSlice", "(", "KeySliceQuery", "query", ",", "StoreTransaction", "txh", ")", "throws", "BackendException", "{", "Map", "<", "StaticBuffer", ",", "EntryList", ">", "result", "=", "getNamesSlice", "(", "query", ".", "getK...
Call Cassandra's Thrift get_slice() method. <p/> When columnEnd equals columnStart and either startInclusive or endInclusive is false (or both are false), then this method returns an empty list without making any Thrift calls. <p/> If columnEnd = columnStart + 1, and both startInclusive and startExclusive are false, then the arguments effectively form an empty interval. In this case, as in the one previous, an empty list is returned. However, it may not necessarily be handled efficiently; a Thrift call might still be made before returning the empty list. @throws com.thinkaurelius.titan.diskstorage.BackendException when columnEnd < columnStart
[ "Call", "Cassandra", "s", "Thrift", "get_slice", "()", "method", ".", "<p", "/", ">", "When", "columnEnd", "equals", "columnStart", "and", "either", "startInclusive", "or", "endInclusive", "is", "false", "(", "or", "both", "are", "false", ")", "then", "this"...
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-cassandra/src/main/java/com/thinkaurelius/titan/diskstorage/cassandra/thrift/CassandraThriftKeyColumnValueStore.java#L78-L82
RestComm/load-balancer
jar/src/main/java/org/mobicents/tools/sip/balancer/SIPBalancerForwarder.java
SIPBalancerForwarder.comesFromInternalNode
protected Boolean comesFromInternalNode(Response externalResponse,InvocationContext ctx,String host,Integer port,String transport,Boolean isIpV6) { boolean found = false; if(host!=null && port!=null) { if(ctx.sipNodeMap(isIpV6).containsKey(new KeySip(host, port,isIpV6))) found = true; // for(Node node : ctx.nodes) { // if(node.getIp().equals(host)) { // if(port.equals(node.getProperties().get(transport+"Port"))) { // found = true; // break; // } // } // } } return found; }
java
protected Boolean comesFromInternalNode(Response externalResponse,InvocationContext ctx,String host,Integer port,String transport,Boolean isIpV6) { boolean found = false; if(host!=null && port!=null) { if(ctx.sipNodeMap(isIpV6).containsKey(new KeySip(host, port,isIpV6))) found = true; // for(Node node : ctx.nodes) { // if(node.getIp().equals(host)) { // if(port.equals(node.getProperties().get(transport+"Port"))) { // found = true; // break; // } // } // } } return found; }
[ "protected", "Boolean", "comesFromInternalNode", "(", "Response", "externalResponse", ",", "InvocationContext", "ctx", ",", "String", "host", ",", "Integer", "port", ",", "String", "transport", ",", "Boolean", "isIpV6", ")", "{", "boolean", "found", "=", "false", ...
need to verify that comes from external in case of single leg
[ "need", "to", "verify", "that", "comes", "from", "external", "in", "case", "of", "single", "leg" ]
train
https://github.com/RestComm/load-balancer/blob/54768d0b81004b2653d429720016ad2617fe754f/jar/src/main/java/org/mobicents/tools/sip/balancer/SIPBalancerForwarder.java#L2283-L2300
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/MethodAttribUtils.java
MethodAttribUtils.methodsEqual
public static final boolean methodsEqual(Method remoteMethod, Method beanMethod) { if ((remoteMethod == null) || (beanMethod == null)) { return false; } //---------------------- // Compare method names //---------------------- if (!remoteMethod.getName().equals(beanMethod.getName())) { return false; } //------------------------- // Compare parameter types //------------------------- Class<?> remoteMethodParamTypes[] = remoteMethod.getParameterTypes(); Class<?> beanMethodParamTypes[] = beanMethod.getParameterTypes(); if (remoteMethodParamTypes.length != beanMethodParamTypes.length) { return false; } for (int i = 0; i < remoteMethodParamTypes.length; i++) { if (!remoteMethodParamTypes[i].equals(beanMethodParamTypes[i])) { return false; } } //----------------------------------------------------------------- // If method names are equal and parameter types match then the // methods are equal for our purposes. Java does not allow methods // with the same name and parameter types that differ only in // return type and/or exception signature. //----------------------------------------------------------------- return true; }
java
public static final boolean methodsEqual(Method remoteMethod, Method beanMethod) { if ((remoteMethod == null) || (beanMethod == null)) { return false; } //---------------------- // Compare method names //---------------------- if (!remoteMethod.getName().equals(beanMethod.getName())) { return false; } //------------------------- // Compare parameter types //------------------------- Class<?> remoteMethodParamTypes[] = remoteMethod.getParameterTypes(); Class<?> beanMethodParamTypes[] = beanMethod.getParameterTypes(); if (remoteMethodParamTypes.length != beanMethodParamTypes.length) { return false; } for (int i = 0; i < remoteMethodParamTypes.length; i++) { if (!remoteMethodParamTypes[i].equals(beanMethodParamTypes[i])) { return false; } } //----------------------------------------------------------------- // If method names are equal and parameter types match then the // methods are equal for our purposes. Java does not allow methods // with the same name and parameter types that differ only in // return type and/or exception signature. //----------------------------------------------------------------- return true; }
[ "public", "static", "final", "boolean", "methodsEqual", "(", "Method", "remoteMethod", ",", "Method", "beanMethod", ")", "{", "if", "(", "(", "remoteMethod", "==", "null", ")", "||", "(", "beanMethod", "==", "null", ")", ")", "{", "return", "false", ";", ...
This utility method compares a method on the bean's remote interface with a method on the bean and returns true iff they are equal for the purpose of determining if the control descriptor associated with the bean method applies to the remote interface method. Equality in this case means the methods are identical except for the abstract modifier on the remote interface method.
[ "This", "utility", "method", "compares", "a", "method", "on", "the", "bean", "s", "remote", "interface", "with", "a", "method", "on", "the", "bean", "and", "returns", "true", "iff", "they", "are", "equal", "for", "the", "purpose", "of", "determining", "if"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/MethodAttribUtils.java#L1691-L1730
guardtime/ksi-java-sdk
ksi-service-client-common-http/src/main/java/com/guardtime/ksi/service/client/http/HttpGetRequestFuture.java
HttpGetRequestFuture.validateHttpResponse
protected void validateHttpResponse(int statusCode, String responseMessage) throws HttpProtocolException { if (statusCode != HttpURLConnection.HTTP_OK) { throw new HttpProtocolException(statusCode, responseMessage); } }
java
protected void validateHttpResponse(int statusCode, String responseMessage) throws HttpProtocolException { if (statusCode != HttpURLConnection.HTTP_OK) { throw new HttpProtocolException(statusCode, responseMessage); } }
[ "protected", "void", "validateHttpResponse", "(", "int", "statusCode", ",", "String", "responseMessage", ")", "throws", "HttpProtocolException", "{", "if", "(", "statusCode", "!=", "HttpURLConnection", ".", "HTTP_OK", ")", "{", "throw", "new", "HttpProtocolException",...
Validates HTTP response message. @param statusCode HTTP status code. @param responseMessage HTTP header response message. @throws HttpProtocolException will be thrown when HTTP status code is not 200 and response doesn't include data, or HTTP status code is not 200 and response content type isn't "application/ksi-response".
[ "Validates", "HTTP", "response", "message", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-common-http/src/main/java/com/guardtime/ksi/service/client/http/HttpGetRequestFuture.java#L44-L48
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.getDateLastVisitedBy
public long getDateLastVisitedBy(CmsDbContext dbc, String poolName, CmsUser user, CmsResource resource) throws CmsException { return m_subscriptionDriver.getDateLastVisitedBy(dbc, poolName, user, resource); }
java
public long getDateLastVisitedBy(CmsDbContext dbc, String poolName, CmsUser user, CmsResource resource) throws CmsException { return m_subscriptionDriver.getDateLastVisitedBy(dbc, poolName, user, resource); }
[ "public", "long", "getDateLastVisitedBy", "(", "CmsDbContext", "dbc", ",", "String", "poolName", ",", "CmsUser", "user", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "return", "m_subscriptionDriver", ".", "getDateLastVisitedBy", "(", "dbc", ",...
Returns the date when the resource was last visited by the user.<p> @param dbc the database context @param poolName the name of the database pool to use @param user the user to check the date @param resource the resource to check the date @return the date when the resource was last visited by the user @throws CmsException if something goes wrong
[ "Returns", "the", "date", "when", "the", "resource", "was", "last", "visited", "by", "the", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L3831-L3835
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanId.java
BeanId.getBeanType
private static byte getBeanType(BeanMetaData bmd, boolean isHome) // d621921 { // 621921 - Always use BeanMetaData to decide which bean type id to use. if (isHome) // d621921 { // Note: EJBFactory (EJBLink) does not support module versioning. if (bmd != null && bmd._moduleMetaData.isVersionedModule()) // F54184 { return HOME_BEAN | MODULE_VERSION_CAPABLE; } return HOME_BEAN; } byte typeId = TYPE_TO_TYPE_ID_MAP[bmd.type]; if (bmd.usesBeanManagedTx) { typeId |= USES_BEAN_MANAGED_TX; } if (bmd._moduleMetaData.isVersionedModule()) // F54184 { typeId |= MODULE_VERSION_CAPABLE; } return typeId; }
java
private static byte getBeanType(BeanMetaData bmd, boolean isHome) // d621921 { // 621921 - Always use BeanMetaData to decide which bean type id to use. if (isHome) // d621921 { // Note: EJBFactory (EJBLink) does not support module versioning. if (bmd != null && bmd._moduleMetaData.isVersionedModule()) // F54184 { return HOME_BEAN | MODULE_VERSION_CAPABLE; } return HOME_BEAN; } byte typeId = TYPE_TO_TYPE_ID_MAP[bmd.type]; if (bmd.usesBeanManagedTx) { typeId |= USES_BEAN_MANAGED_TX; } if (bmd._moduleMetaData.isVersionedModule()) // F54184 { typeId |= MODULE_VERSION_CAPABLE; } return typeId; }
[ "private", "static", "byte", "getBeanType", "(", "BeanMetaData", "bmd", ",", "boolean", "isHome", ")", "// d621921", "{", "// 621921 - Always use BeanMetaData to decide which bean type id to use.", "if", "(", "isHome", ")", "// d621921", "{", "// Note: EJBFactory (EJBLink) do...
Returns the bean type id for serialization. @param bmd the non-null bean metadata @param isHome true if for the home instance @return the type id
[ "Returns", "the", "bean", "type", "id", "for", "serialization", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/BeanId.java#L730-L754
impossibl/stencil
engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java
StencilOperands.lessThan
public boolean lessThan(Object left, Object right) { if ((left == right) || (left == null) || (right == null)) { return false; } else { return compare(left, right, "<") < 0; } }
java
public boolean lessThan(Object left, Object right) { if ((left == right) || (left == null) || (right == null)) { return false; } else { return compare(left, right, "<") < 0; } }
[ "public", "boolean", "lessThan", "(", "Object", "left", ",", "Object", "right", ")", "{", "if", "(", "(", "left", "==", "right", ")", "||", "(", "left", "==", "null", ")", "||", "(", "right", "==", "null", ")", ")", "{", "return", "false", ";", "...
Test if left < right. @param left first value @param right second value @return test result.
[ "Test", "if", "left", "<", "right", "." ]
train
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L814-L822
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayConcat
public static Expression arrayConcat(String expression1, String expression2) { return arrayConcat(x(expression1), x(expression2)); }
java
public static Expression arrayConcat(String expression1, String expression2) { return arrayConcat(x(expression1), x(expression2)); }
[ "public", "static", "Expression", "arrayConcat", "(", "String", "expression1", ",", "String", "expression2", ")", "{", "return", "arrayConcat", "(", "x", "(", "expression1", ")", ",", "x", "(", "expression2", ")", ")", ";", "}" ]
Returned expression results in new array with the concatenation of the input arrays.
[ "Returned", "expression", "results", "in", "new", "array", "with", "the", "concatenation", "of", "the", "input", "arrays", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L97-L99
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/Type1Font.java
Type1Font.getKerning
public int getKerning(int char1, int char2) { String first = GlyphList.unicodeToName(char1); if (first == null) return 0; String second = GlyphList.unicodeToName(char2); if (second == null) return 0; Object obj[] = (Object[])KernPairs.get(first); if (obj == null) return 0; for (int k = 0; k < obj.length; k += 2) { if (second.equals(obj[k])) return ((Integer)obj[k + 1]).intValue(); } return 0; }
java
public int getKerning(int char1, int char2) { String first = GlyphList.unicodeToName(char1); if (first == null) return 0; String second = GlyphList.unicodeToName(char2); if (second == null) return 0; Object obj[] = (Object[])KernPairs.get(first); if (obj == null) return 0; for (int k = 0; k < obj.length; k += 2) { if (second.equals(obj[k])) return ((Integer)obj[k + 1]).intValue(); } return 0; }
[ "public", "int", "getKerning", "(", "int", "char1", ",", "int", "char2", ")", "{", "String", "first", "=", "GlyphList", ".", "unicodeToName", "(", "char1", ")", ";", "if", "(", "first", "==", "null", ")", "return", "0", ";", "String", "second", "=", ...
Gets the kerning between two Unicode characters. The characters are converted to names and this names are used to find the kerning pairs in the <CODE>HashMap</CODE> <CODE>KernPairs</CODE>. @param char1 the first char @param char2 the second char @return the kerning to be applied
[ "Gets", "the", "kerning", "between", "two", "Unicode", "characters", ".", "The", "characters", "are", "converted", "to", "names", "and", "this", "names", "are", "used", "to", "find", "the", "kerning", "pairs", "in", "the", "<CODE", ">", "HashMap<", "/", "C...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/Type1Font.java#L317-L333
Harium/keel
src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java
FourierTransform.FFT
public static void FFT(ComplexNumber[] data, Direction direction) { double[] real = ComplexNumber.getReal(data); double[] img = ComplexNumber.getImaginary(data); if (direction == Direction.Forward) FFT(real, img); else FFT(img, real); if (direction == Direction.Forward) { for (int i = 0; i < real.length; i++) { data[i] = new ComplexNumber(real[i], img[i]); } } else { int n = real.length; for (int i = 0; i < n; i++) { data[i] = new ComplexNumber(real[i] / n, img[i] / n); } } }
java
public static void FFT(ComplexNumber[] data, Direction direction) { double[] real = ComplexNumber.getReal(data); double[] img = ComplexNumber.getImaginary(data); if (direction == Direction.Forward) FFT(real, img); else FFT(img, real); if (direction == Direction.Forward) { for (int i = 0; i < real.length; i++) { data[i] = new ComplexNumber(real[i], img[i]); } } else { int n = real.length; for (int i = 0; i < n; i++) { data[i] = new ComplexNumber(real[i] / n, img[i] / n); } } }
[ "public", "static", "void", "FFT", "(", "ComplexNumber", "[", "]", "data", ",", "Direction", "direction", ")", "{", "double", "[", "]", "real", "=", "ComplexNumber", ".", "getReal", "(", "data", ")", ";", "double", "[", "]", "img", "=", "ComplexNumber", ...
1-D Fast Fourier Transform. @param data Data to transform. @param direction Transformation direction.
[ "1", "-", "D", "Fast", "Fourier", "Transform", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java#L168-L185
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/checkbox/LabeledCheckboxPanel.java
LabeledCheckboxPanel.newCheckBox
protected CheckBox newCheckBox(final String id, final IModel<M> model) { final IModel<Boolean> propertyModel = new PropertyModel<>(model.getObject(), this.getId()); return ComponentFactory.newCheckBox(id, propertyModel); }
java
protected CheckBox newCheckBox(final String id, final IModel<M> model) { final IModel<Boolean> propertyModel = new PropertyModel<>(model.getObject(), this.getId()); return ComponentFactory.newCheckBox(id, propertyModel); }
[ "protected", "CheckBox", "newCheckBox", "(", "final", "String", "id", ",", "final", "IModel", "<", "M", ">", "model", ")", "{", "final", "IModel", "<", "Boolean", ">", "propertyModel", "=", "new", "PropertyModel", "<>", "(", "model", ".", "getObject", "(",...
Factory method for create a new {@link CheckBox}. This method is invoked in the constructor from this class and can be overridden so users can provide their own version of a new {@link CheckBox}. @param id the id @param model the model @return the new {@link CheckBox}.
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "CheckBox", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "this", "class", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own",...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/checkbox/LabeledCheckboxPanel.java#L92-L96
undertow-io/undertow
servlet/src/main/java/io/undertow/servlet/api/DeploymentInfo.java
DeploymentInfo.addLastAuthenticationMechanism
public DeploymentInfo addLastAuthenticationMechanism(final String name, final AuthenticationMechanism mechanism) { authenticationMechanisms.put(name, new ImmediateAuthenticationMechanismFactory(mechanism)); if(loginConfig == null) { loginConfig = new LoginConfig(null); } loginConfig.addLastAuthMethod(new AuthMethodConfig(name)); return this; }
java
public DeploymentInfo addLastAuthenticationMechanism(final String name, final AuthenticationMechanism mechanism) { authenticationMechanisms.put(name, new ImmediateAuthenticationMechanismFactory(mechanism)); if(loginConfig == null) { loginConfig = new LoginConfig(null); } loginConfig.addLastAuthMethod(new AuthMethodConfig(name)); return this; }
[ "public", "DeploymentInfo", "addLastAuthenticationMechanism", "(", "final", "String", "name", ",", "final", "AuthenticationMechanism", "mechanism", ")", "{", "authenticationMechanisms", ".", "put", "(", "name", ",", "new", "ImmediateAuthenticationMechanismFactory", "(", "...
Adds an authentication mechanism directly to the deployment. This mechanism will be last in the list. In general you should just use {@link #addAuthenticationMechanism(String, io.undertow.security.api.AuthenticationMechanismFactory)} and allow the user to configure the methods they want by name. This method is essentially a convenience method, if is the same as registering a factory under the provided name that returns and authentication mechanism, and then adding it to the login config list. If you want your mechanism to be the only one in the deployment you should first invoke {@link #clearLoginMethods()}. @param name The authentication mechanism name @param mechanism The mechanism @return
[ "Adds", "an", "authentication", "mechanism", "directly", "to", "the", "deployment", ".", "This", "mechanism", "will", "be", "last", "in", "the", "list", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/servlet/src/main/java/io/undertow/servlet/api/DeploymentInfo.java#L1031-L1038
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.getOrcAtomicRowColumnId
static private int getOrcAtomicRowColumnId() { try { Field rowField = OrcRecordUpdater.class.getDeclaredField("ROW"); rowField.setAccessible(true); int rowId = (int) rowField.get(null); rowField.setAccessible(false); return rowId; } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Could not obtain OrcRecordUpdater.ROW value.", e); } }
java
static private int getOrcAtomicRowColumnId() { try { Field rowField = OrcRecordUpdater.class.getDeclaredField("ROW"); rowField.setAccessible(true); int rowId = (int) rowField.get(null); rowField.setAccessible(false); return rowId; } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Could not obtain OrcRecordUpdater.ROW value.", e); } }
[ "static", "private", "int", "getOrcAtomicRowColumnId", "(", ")", "{", "try", "{", "Field", "rowField", "=", "OrcRecordUpdater", ".", "class", ".", "getDeclaredField", "(", "\"ROW\"", ")", ";", "rowField", ".", "setAccessible", "(", "true", ")", ";", "int", "...
/* This ugliness can go when the column id can be referenced from a public place.
[ "/", "*", "This", "ugliness", "can", "go", "when", "the", "column", "id", "can", "be", "referenced", "from", "a", "public", "place", "." ]
train
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L293-L304
nutzam/nutzboot
nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java
FastdfsService.getToken
private String getToken(String filename, long timestamp, String secret_key) throws Exception { byte[] bsFilename = filename.getBytes(conf.get(PROP_CHARSET, "UTF-8")); byte[] bsKey = secret_key.getBytes(conf.get(PROP_CHARSET, "UTF-8")); byte[] bsTimestamp = (new Long(timestamp)).toString().getBytes(conf.get(PROP_CHARSET, "UTF-8")); byte[] buff = new byte[bsFilename.length + bsKey.length + bsTimestamp.length]; System.arraycopy(bsFilename, 0, buff, 0, bsFilename.length); System.arraycopy(bsKey, 0, buff, bsFilename.length, bsKey.length); System.arraycopy(bsTimestamp, 0, buff, bsFilename.length + bsKey.length, bsTimestamp.length); return Lang.digest("MD5", buff, null, 1); }
java
private String getToken(String filename, long timestamp, String secret_key) throws Exception { byte[] bsFilename = filename.getBytes(conf.get(PROP_CHARSET, "UTF-8")); byte[] bsKey = secret_key.getBytes(conf.get(PROP_CHARSET, "UTF-8")); byte[] bsTimestamp = (new Long(timestamp)).toString().getBytes(conf.get(PROP_CHARSET, "UTF-8")); byte[] buff = new byte[bsFilename.length + bsKey.length + bsTimestamp.length]; System.arraycopy(bsFilename, 0, buff, 0, bsFilename.length); System.arraycopy(bsKey, 0, buff, bsFilename.length, bsKey.length); System.arraycopy(bsTimestamp, 0, buff, bsFilename.length + bsKey.length, bsTimestamp.length); return Lang.digest("MD5", buff, null, 1); }
[ "private", "String", "getToken", "(", "String", "filename", ",", "long", "timestamp", ",", "String", "secret_key", ")", "throws", "Exception", "{", "byte", "[", "]", "bsFilename", "=", "filename", ".", "getBytes", "(", "conf", ".", "get", "(", "PROP_CHARSET"...
获取Token @param filename 文件名 @param timestamp 时间戳 @param secret_key 密钥 @return @throws Exception
[ "获取Token" ]
train
https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-starter/nutzboot-starter-fastdfs/src/main/java/org/nutz/boot/starter/fastdfs/FastdfsService.java#L156-L165
ragunathjawahar/adapter-kit
library/src/com/mobsandgeeks/adapters/InstantAdapter.java
InstantAdapter.getView
@Override public View getView(final int position, final View convertView, final ViewGroup parent) { View view = convertView; if (view == null) { view = mInstantAdapterCore.createNewView(mContext, parent); } T instance = getItem(position); mInstantAdapterCore.bindToView(parent, view, instance, position); return view; }
java
@Override public View getView(final int position, final View convertView, final ViewGroup parent) { View view = convertView; if (view == null) { view = mInstantAdapterCore.createNewView(mContext, parent); } T instance = getItem(position); mInstantAdapterCore.bindToView(parent, view, instance, position); return view; }
[ "@", "Override", "public", "View", "getView", "(", "final", "int", "position", ",", "final", "View", "convertView", ",", "final", "ViewGroup", "parent", ")", "{", "View", "view", "=", "convertView", ";", "if", "(", "view", "==", "null", ")", "{", "view",...
Returns a {@link View} that has been inflated from the {@code layoutResourceId} argument in the constructor. This method handles recycling as well. Subclasses are recommended to chain upwards by calling {@code super.getView(position, convertView, parent)} and abstain from recycling views unless and until you know what you are doing ;) <p> You are free to use the {@code View.setTag()} and {@code View.getTag()} methods in your subclasses. </p>
[ "Returns", "a", "{" ]
train
https://github.com/ragunathjawahar/adapter-kit/blob/e5c13458c7f6dcc1c61410f9cfb55cd24bd31ca2/library/src/com/mobsandgeeks/adapters/InstantAdapter.java#L65-L77
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginUpdateAsync
public Observable<VirtualMachineInner> beginUpdateAsync(String resourceGroupName, String vmName, VirtualMachineUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineInner> beginUpdateAsync(String resourceGroupName, String vmName, VirtualMachineUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "VirtualMachineUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "...
The operation to update a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Update Virtual Machine operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineInner object
[ "The", "operation", "to", "update", "a", "virtual", "machine", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java#L836-L843
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setEnterpriseDate
public void setEnterpriseDate(int index, Date value) { set(selectField(TaskFieldLists.ENTERPRISE_DATE, index), value); }
java
public void setEnterpriseDate(int index, Date value) { set(selectField(TaskFieldLists.ENTERPRISE_DATE, index), value); }
[ "public", "void", "setEnterpriseDate", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "ENTERPRISE_DATE", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise field value. @param index field index @param value field value
[ "Set", "an", "enterprise", "field", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L3859-L3862
konvergeio/cofoja
src/main/java/com/google/java/contract/core/agent/SpecificationMethodAdapter.java
SpecificationMethodAdapter.allocateOldValues
@Requires({ "kind != null", "kind.isOld()", "list != null" }) protected void allocateOldValues(ContractKind kind, List<Integer> list) { List<MethodContractHandle> olds = contracts.getMethodHandles(kind, methodName, methodDesc, 0); if (olds.isEmpty()) { return; } Integer[] locals = new Integer[olds.size()]; for (MethodContractHandle h : olds) { int k = h.getKey(); locals[k] = newLocal(Type.getReturnType(h.getContractMethod().desc)); push((String) null); storeLocal(locals[k]); } list.addAll(Arrays.asList(locals)); }
java
@Requires({ "kind != null", "kind.isOld()", "list != null" }) protected void allocateOldValues(ContractKind kind, List<Integer> list) { List<MethodContractHandle> olds = contracts.getMethodHandles(kind, methodName, methodDesc, 0); if (olds.isEmpty()) { return; } Integer[] locals = new Integer[olds.size()]; for (MethodContractHandle h : olds) { int k = h.getKey(); locals[k] = newLocal(Type.getReturnType(h.getContractMethod().desc)); push((String) null); storeLocal(locals[k]); } list.addAll(Arrays.asList(locals)); }
[ "@", "Requires", "(", "{", "\"kind != null\"", ",", "\"kind.isOld()\"", ",", "\"list != null\"", "}", ")", "protected", "void", "allocateOldValues", "(", "ContractKind", "kind", ",", "List", "<", "Integer", ">", "list", ")", "{", "List", "<", "MethodContractHand...
Injects code to allocate the local variables needed to hold old values for the postconditions of the method. These variables are initialized to {@code null}. @param kind either OLD or SIGNAL_OLD @param list the list that will hold the allocated indexes
[ "Injects", "code", "to", "allocate", "the", "local", "variables", "needed", "to", "hold", "old", "values", "for", "the", "postconditions", "of", "the", "method", ".", "These", "variables", "are", "initialized", "to", "{", "@code", "null", "}", "." ]
train
https://github.com/konvergeio/cofoja/blob/6ded58fa05eb5bf85f16353c8dd4c70bee59121a/src/main/java/com/google/java/contract/core/agent/SpecificationMethodAdapter.java#L319-L339
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java
CSVParser._anyCharactersAreTheSame
private boolean _anyCharactersAreTheSame () { return _isSameCharacter (m_cSeparatorChar, m_cQuoteChar) || _isSameCharacter (m_cSeparatorChar, m_cEscapeChar) || _isSameCharacter (m_cQuoteChar, m_cEscapeChar); }
java
private boolean _anyCharactersAreTheSame () { return _isSameCharacter (m_cSeparatorChar, m_cQuoteChar) || _isSameCharacter (m_cSeparatorChar, m_cEscapeChar) || _isSameCharacter (m_cQuoteChar, m_cEscapeChar); }
[ "private", "boolean", "_anyCharactersAreTheSame", "(", ")", "{", "return", "_isSameCharacter", "(", "m_cSeparatorChar", ",", "m_cQuoteChar", ")", "||", "_isSameCharacter", "(", "m_cSeparatorChar", ",", "m_cEscapeChar", ")", "||", "_isSameCharacter", "(", "m_cQuoteChar",...
checks to see if any two of the three characters are the same. This is because in openCSV the separator, quote, and escape characters must the different. @return <code>true</code> if any two of the three are the same.
[ "checks", "to", "see", "if", "any", "two", "of", "the", "three", "characters", "are", "the", "same", ".", "This", "is", "because", "in", "openCSV", "the", "separator", "quote", "and", "escape", "characters", "must", "the", "different", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/csv/CSVParser.java#L244-L249
aoindustries/ao-taglib
src/main/java/com/aoindustries/taglib/UrlUtils.java
UrlUtils.writeHref
public static void writeHref( PageContext pageContext, Appendable out, String href, HttpParameters params, boolean hrefAbsolute, LastModifiedServlet.AddLastModifiedWhen addLastModified ) throws JspTagException, IOException { if(href != null) { out.append(" href=\""); encodeTextInXhtmlAttribute( com.aoindustries.net.UrlUtils.buildUrl(pageContext, href, params, hrefAbsolute, addLastModified), out ); out.append('"'); } else { if(params != null) throw new LocalizedJspTagException(ApplicationResources.accessor, "UrlUtils.paramsWithoutHref"); } }
java
public static void writeHref( PageContext pageContext, Appendable out, String href, HttpParameters params, boolean hrefAbsolute, LastModifiedServlet.AddLastModifiedWhen addLastModified ) throws JspTagException, IOException { if(href != null) { out.append(" href=\""); encodeTextInXhtmlAttribute( com.aoindustries.net.UrlUtils.buildUrl(pageContext, href, params, hrefAbsolute, addLastModified), out ); out.append('"'); } else { if(params != null) throw new LocalizedJspTagException(ApplicationResources.accessor, "UrlUtils.paramsWithoutHref"); } }
[ "public", "static", "void", "writeHref", "(", "PageContext", "pageContext", ",", "Appendable", "out", ",", "String", "href", ",", "HttpParameters", "params", ",", "boolean", "hrefAbsolute", ",", "LastModifiedServlet", ".", "AddLastModifiedWhen", "addLastModified", ")"...
Writes an href attribute with parameters. Adds contextPath to URLs that begin with a slash (/). Encodes the URL.
[ "Writes", "an", "href", "attribute", "with", "parameters", ".", "Adds", "contextPath", "to", "URLs", "that", "begin", "with", "a", "slash", "(", "/", ")", ".", "Encodes", "the", "URL", "." ]
train
https://github.com/aoindustries/ao-taglib/blob/5670eba8485196bd42d31d3ff09a42deacb025f8/src/main/java/com/aoindustries/taglib/UrlUtils.java#L46-L64
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.rowMajorIterator
public RowMajorMatrixIterator rowMajorIterator() { return new RowMajorMatrixIterator(rows, columns) { private long limit = (long) rows * columns; private int i = - 1; @Override public int rowIndex() { return i / columns; } @Override public int columnIndex() { return i - rowIndex() * columns; } @Override public double get() { return Matrix.this.get(rowIndex(), columnIndex()); } @Override public void set(double value) { Matrix.this.set(rowIndex(), columnIndex(), value); } @Override public boolean hasNext() { return i + 1 < limit; } @Override public Double next() { if(!hasNext()) { throw new NoSuchElementException(); } i++; return get(); } }; }
java
public RowMajorMatrixIterator rowMajorIterator() { return new RowMajorMatrixIterator(rows, columns) { private long limit = (long) rows * columns; private int i = - 1; @Override public int rowIndex() { return i / columns; } @Override public int columnIndex() { return i - rowIndex() * columns; } @Override public double get() { return Matrix.this.get(rowIndex(), columnIndex()); } @Override public void set(double value) { Matrix.this.set(rowIndex(), columnIndex(), value); } @Override public boolean hasNext() { return i + 1 < limit; } @Override public Double next() { if(!hasNext()) { throw new NoSuchElementException(); } i++; return get(); } }; }
[ "public", "RowMajorMatrixIterator", "rowMajorIterator", "(", ")", "{", "return", "new", "RowMajorMatrixIterator", "(", "rows", ",", "columns", ")", "{", "private", "long", "limit", "=", "(", "long", ")", "rows", "*", "columns", ";", "private", "int", "i", "=...
Returns a row-major matrix iterator. @return a row-major matrix iterator.
[ "Returns", "a", "row", "-", "major", "matrix", "iterator", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1891-L1931
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMFiles.java
JMFiles.appendLine
public static Writer appendLine(Writer writer, String line) { return append(writer, line + JMString.LINE_SEPARATOR); }
java
public static Writer appendLine(Writer writer, String line) { return append(writer, line + JMString.LINE_SEPARATOR); }
[ "public", "static", "Writer", "appendLine", "(", "Writer", "writer", ",", "String", "line", ")", "{", "return", "append", "(", "writer", ",", "line", "+", "JMString", ".", "LINE_SEPARATOR", ")", ";", "}" ]
Append line writer. @param writer the writer @param line the line @return the writer
[ "Append", "line", "writer", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMFiles.java#L51-L53
acromusashi/acromusashi-stream-ml
src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java
LofCalculator.updateKDistance
protected static void updateKDistance(int kn, LofPoint targetPoint, LofDataSet dataSet) { // 対象点のK距離、K距離近傍を算出する。 KDistanceResult kResult = calculateKDistance(kn, targetPoint, dataSet); targetPoint.setkDistance(kResult.getkDistance()); targetPoint.setkDistanceNeighbor(kResult.getkDistanceNeighbor()); }
java
protected static void updateKDistance(int kn, LofPoint targetPoint, LofDataSet dataSet) { // 対象点のK距離、K距離近傍を算出する。 KDistanceResult kResult = calculateKDistance(kn, targetPoint, dataSet); targetPoint.setkDistance(kResult.getkDistance()); targetPoint.setkDistanceNeighbor(kResult.getkDistanceNeighbor()); }
[ "protected", "static", "void", "updateKDistance", "(", "int", "kn", ",", "LofPoint", "targetPoint", ",", "LofDataSet", "dataSet", ")", "{", "// 対象点のK距離、K距離近傍を算出する。", "KDistanceResult", "kResult", "=", "calculateKDistance", "(", "kn", ",", "targetPoint", ",", "dataSe...
対象点のK距離とK距離近傍データのIDを更新する。 @param kn K値 @param targetPoint 判定対象点 @param dataSet 全体データ
[ "対象点のK距離とK距離近傍データのIDを更新する。" ]
train
https://github.com/acromusashi/acromusashi-stream-ml/blob/26d6799a917cacda68e21d506c75cfeb17d832a6/src/main/java/acromusashi/stream/ml/anomaly/lof/LofCalculator.java#L331-L337
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java
OverrideHelper.getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(JvmDeclaredType type) { ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type.eResource().getResourceSet()); LightweightTypeReference contextType = owner.toLightweightTypeReference(type); return getResolvedFeatures(contextType); }
java
public ResolvedFeatures getResolvedFeatures(JvmDeclaredType type) { ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type.eResource().getResourceSet()); LightweightTypeReference contextType = owner.toLightweightTypeReference(type); return getResolvedFeatures(contextType); }
[ "public", "ResolvedFeatures", "getResolvedFeatures", "(", "JvmDeclaredType", "type", ")", "{", "ITypeReferenceOwner", "owner", "=", "new", "StandardTypeReferenceOwner", "(", "services", ",", "type", ".", "eResource", "(", ")", ".", "getResourceSet", "(", ")", ")", ...
Returns the resolved features that are defined in the given <code>type</code> and its supertypes. Considers private methods of super types, too. @param type the type. Has to be contained in a resource. @return the resolved features.
[ "Returns", "the", "resolved", "features", "that", "are", "defined", "in", "the", "given", "<code", ">", "type<", "/", "code", ">", "and", "its", "supertypes", ".", "Considers", "private", "methods", "of", "super", "types", "too", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java#L190-L194
baratine/baratine
web/src/main/java/com/caucho/v5/io/SocketChannelStream.java
SocketChannelStream.readTimeout
@Override public int readTimeout(byte []buf, int offset, int length, long timeout) throws IOException { return read(buf, offset, length); /* Socket s = _s; if (s == null) { return -1; } int oldTimeout = s.getSoTimeout(); s.setSoTimeout((int) timeout); try { int result = read(buf, offset, length); if (result >= 0) { return result; } else if (_is == null || _is.available() < 0) { return -1; } else { return ReadBuffer.READ_TIMEOUT; } } finally { s.setSoTimeout(oldTimeout); } */ }
java
@Override public int readTimeout(byte []buf, int offset, int length, long timeout) throws IOException { return read(buf, offset, length); /* Socket s = _s; if (s == null) { return -1; } int oldTimeout = s.getSoTimeout(); s.setSoTimeout((int) timeout); try { int result = read(buf, offset, length); if (result >= 0) { return result; } else if (_is == null || _is.available() < 0) { return -1; } else { return ReadBuffer.READ_TIMEOUT; } } finally { s.setSoTimeout(oldTimeout); } */ }
[ "@", "Override", "public", "int", "readTimeout", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ",", "long", "timeout", ")", "throws", "IOException", "{", "return", "read", "(", "buf", ",", "offset", ",", "length", ")", ";", ...
Reads bytes from the socket. @param buf byte buffer receiving the bytes @param offset offset into the buffer @param length number of bytes to read @return number of bytes read or -1 @exception throws ClientDisconnectException if the connection is dropped
[ "Reads", "bytes", "from", "the", "socket", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/SocketChannelStream.java#L273-L304
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/CGroupMemoryWatcher.java
CGroupMemoryWatcher.failTasksWithMaxMemory
private void failTasksWithMaxMemory(long memoryToRelease) { List<TaskAttemptID> allTasks = new ArrayList<TaskAttemptID>(); allTasks.addAll(processTreeInfoMap.keySet()); // Sort the tasks descendingly according to RSS memory usage Collections.sort(allTasks, new Comparator<TaskAttemptID>() { @Override public int compare(TaskAttemptID tid1, TaskAttemptID tid2) { return processTreeInfoMap.get(tid2).getMemoryUsed() > processTreeInfoMap.get(tid1).getMemoryUsed() ? 1 : -1; }}); long memoryReleased = 0; // Fail the tasks one by one until the memory requirement is met while (memoryReleased < memoryToRelease && !allTasks.isEmpty()) { TaskAttemptID tid = allTasks.remove(0); if (!isKillable(tid)) { continue; } long memoryUsed = processTreeInfoMap.get(tid).getMemoryUsed(); if (memoryUsed == 0) { break; // Skip tasks without process tree information currently } tasksToKill.add(tid); memoryReleased += memoryUsed; } if (tasksToKill.isEmpty()) { LOG.error("The total memory usage is over CGroup limits. " + "But found no alive task to kill for freeing memory."); } else if (memoryReleased < memoryToRelease) { LOG.error("The total memory usage is over CGroup limits. " + "But uanble to find enough tasks to kill for freeing memory."); } killTasks(); }
java
private void failTasksWithMaxMemory(long memoryToRelease) { List<TaskAttemptID> allTasks = new ArrayList<TaskAttemptID>(); allTasks.addAll(processTreeInfoMap.keySet()); // Sort the tasks descendingly according to RSS memory usage Collections.sort(allTasks, new Comparator<TaskAttemptID>() { @Override public int compare(TaskAttemptID tid1, TaskAttemptID tid2) { return processTreeInfoMap.get(tid2).getMemoryUsed() > processTreeInfoMap.get(tid1).getMemoryUsed() ? 1 : -1; }}); long memoryReleased = 0; // Fail the tasks one by one until the memory requirement is met while (memoryReleased < memoryToRelease && !allTasks.isEmpty()) { TaskAttemptID tid = allTasks.remove(0); if (!isKillable(tid)) { continue; } long memoryUsed = processTreeInfoMap.get(tid).getMemoryUsed(); if (memoryUsed == 0) { break; // Skip tasks without process tree information currently } tasksToKill.add(tid); memoryReleased += memoryUsed; } if (tasksToKill.isEmpty()) { LOG.error("The total memory usage is over CGroup limits. " + "But found no alive task to kill for freeing memory."); } else if (memoryReleased < memoryToRelease) { LOG.error("The total memory usage is over CGroup limits. " + "But uanble to find enough tasks to kill for freeing memory."); } killTasks(); }
[ "private", "void", "failTasksWithMaxMemory", "(", "long", "memoryToRelease", ")", "{", "List", "<", "TaskAttemptID", ">", "allTasks", "=", "new", "ArrayList", "<", "TaskAttemptID", ">", "(", ")", ";", "allTasks", ".", "addAll", "(", "processTreeInfoMap", ".", ...
Starting from the tasks use the highest amount of memory, fail the tasks until the memory released meets the requirement @param memoryToRelease the mix memory to get released
[ "Starting", "from", "the", "tasks", "use", "the", "highest", "amount", "of", "memory", "fail", "the", "tasks", "until", "the", "memory", "released", "meets", "the", "requirement" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/CGroupMemoryWatcher.java#L668-L703
wuman/android-oauth-client
library/src/main/java/com/wuman/android/auth/AuthorizationFlow.java
AuthorizationFlow.newCredential
private Credential newCredential(String userId) { Credential.Builder builder = new Credential.Builder(getMethod()) .setTransport(getTransport()) .setJsonFactory(getJsonFactory()) .setTokenServerEncodedUrl(getTokenServerEncodedUrl()) .setClientAuthentication(getClientAuthentication()) .setRequestInitializer(getRequestInitializer()) .setClock(getClock()); if (getCredentialStore() != null) { builder.addRefreshListener( new CredentialStoreRefreshListener(userId, getCredentialStore())); } builder.getRefreshListeners().addAll(getRefreshListeners()); return builder.build(); }
java
private Credential newCredential(String userId) { Credential.Builder builder = new Credential.Builder(getMethod()) .setTransport(getTransport()) .setJsonFactory(getJsonFactory()) .setTokenServerEncodedUrl(getTokenServerEncodedUrl()) .setClientAuthentication(getClientAuthentication()) .setRequestInitializer(getRequestInitializer()) .setClock(getClock()); if (getCredentialStore() != null) { builder.addRefreshListener( new CredentialStoreRefreshListener(userId, getCredentialStore())); } builder.getRefreshListeners().addAll(getRefreshListeners()); return builder.build(); }
[ "private", "Credential", "newCredential", "(", "String", "userId", ")", "{", "Credential", ".", "Builder", "builder", "=", "new", "Credential", ".", "Builder", "(", "getMethod", "(", ")", ")", ".", "setTransport", "(", "getTransport", "(", ")", ")", ".", "...
Returns a new OAuth 2.0 credential instance based on the given user ID. @param userId user ID or {@code null} if not using a persisted credential store
[ "Returns", "a", "new", "OAuth", "2", ".", "0", "credential", "instance", "based", "on", "the", "given", "user", "ID", "." ]
train
https://github.com/wuman/android-oauth-client/blob/6e01b81b7319a6954a1156e8b93c0b5cbeb61446/library/src/main/java/com/wuman/android/auth/AuthorizationFlow.java#L372-L388
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.whereLessThan
@Nonnull public Query whereLessThan(@Nonnull String field, @Nonnull Object value) { return whereLessThan(FieldPath.fromDotSeparatedString(field), value); }
java
@Nonnull public Query whereLessThan(@Nonnull String field, @Nonnull Object value) { return whereLessThan(FieldPath.fromDotSeparatedString(field), value); }
[ "@", "Nonnull", "public", "Query", "whereLessThan", "(", "@", "Nonnull", "String", "field", ",", "@", "Nonnull", "Object", "value", ")", "{", "return", "whereLessThan", "(", "FieldPath", ".", "fromDotSeparatedString", "(", "field", ")", ",", "value", ")", ";...
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be less than the specified value. @param field The name of the field to compare. @param value The value for comparison. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "with", "the", "additional", "filter", "that", "documents", "must", "contain", "the", "specified", "field", "and", "the", "value", "should", "be", "less", "than", "the", "specified", "value", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L457-L460
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.doIn
private ZealotKhala doIn(String prefix, String field, Collection<?> values, boolean match, boolean positive) { return this.doInByType(prefix, field, values, match, ZealotConst.OBJTYPE_COLLECTION, positive); }
java
private ZealotKhala doIn(String prefix, String field, Collection<?> values, boolean match, boolean positive) { return this.doInByType(prefix, field, values, match, ZealotConst.OBJTYPE_COLLECTION, positive); }
[ "private", "ZealotKhala", "doIn", "(", "String", "prefix", ",", "String", "field", ",", "Collection", "<", "?", ">", "values", ",", "boolean", "match", ",", "boolean", "positive", ")", "{", "return", "this", ".", "doInByType", "(", "prefix", ",", "field", ...
执行生成in范围查询SQL片段的方法. @param prefix 前缀 @param field 数据库字段 @param values 集合的值 @param match 是否匹配 @param positive true则表示是in,否则是not in @return ZealotKhala实例的当前实例
[ "执行生成in范围查询SQL片段的方法", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L493-L495
zhegexiaohuozi/SeimiCrawler
seimicrawler/src/main/java/cn/wanghaomiao/seimi/struct/Response.java
Response.render
public <T> T render(Class<T> bean) throws Exception { if (bodyType.equals(BodyType.TEXT)) { return parse(bean, this.content); } else { throw new SeimiProcessExcepiton("can not parse struct from binary"); } }
java
public <T> T render(Class<T> bean) throws Exception { if (bodyType.equals(BodyType.TEXT)) { return parse(bean, this.content); } else { throw new SeimiProcessExcepiton("can not parse struct from binary"); } }
[ "public", "<", "T", ">", "T", "render", "(", "Class", "<", "T", ">", "bean", ")", "throws", "Exception", "{", "if", "(", "bodyType", ".", "equals", "(", "BodyType", ".", "TEXT", ")", ")", "{", "return", "parse", "(", "bean", ",", "this", ".", "co...
通过bean中定义的Xpath注解进行自动填充 @param bean -- @param <T> -- @return -- @throws Exception --
[ "通过bean中定义的Xpath注解进行自动填充" ]
train
https://github.com/zhegexiaohuozi/SeimiCrawler/blob/c9069490616c38c6de059ddc86b79febd6d17641/seimicrawler/src/main/java/cn/wanghaomiao/seimi/struct/Response.java#L164-L170
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Instant.java
Instant.ofEpochSecond
public static Instant ofEpochSecond(long epochSecond, long nanoAdjustment) { long secs = Math.addExact(epochSecond, Math.floorDiv(nanoAdjustment, NANOS_PER_SECOND)); int nos = (int)Math.floorMod(nanoAdjustment, NANOS_PER_SECOND); return create(secs, nos); }
java
public static Instant ofEpochSecond(long epochSecond, long nanoAdjustment) { long secs = Math.addExact(epochSecond, Math.floorDiv(nanoAdjustment, NANOS_PER_SECOND)); int nos = (int)Math.floorMod(nanoAdjustment, NANOS_PER_SECOND); return create(secs, nos); }
[ "public", "static", "Instant", "ofEpochSecond", "(", "long", "epochSecond", ",", "long", "nanoAdjustment", ")", "{", "long", "secs", "=", "Math", ".", "addExact", "(", "epochSecond", ",", "Math", ".", "floorDiv", "(", "nanoAdjustment", ",", "NANOS_PER_SECOND", ...
Obtains an instance of {@code Instant} using seconds from the epoch of 1970-01-01T00:00:00Z and nanosecond fraction of second. <p> This method allows an arbitrary number of nanoseconds to be passed in. The factory will alter the values of the second and nanosecond in order to ensure that the stored nanosecond is in the range 0 to 999,999,999. For example, the following will result in the exactly the same instant: <pre> Instant.ofEpochSecond(3, 1); Instant.ofEpochSecond(4, -999_999_999); Instant.ofEpochSecond(2, 1000_000_001); </pre> @param epochSecond the number of seconds from 1970-01-01T00:00:00Z @param nanoAdjustment the nanosecond adjustment to the number of seconds, positive or negative @return an instant, not null @throws DateTimeException if the instant exceeds the maximum or minimum instant @throws ArithmeticException if numeric overflow occurs
[ "Obtains", "an", "instance", "of", "{", "@code", "Instant", "}", "using", "seconds", "from", "the", "epoch", "of", "1970", "-", "01", "-", "01T00", ":", "00", ":", "00Z", "and", "nanosecond", "fraction", "of", "second", ".", "<p", ">", "This", "method"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Instant.java#L321-L325
threerings/narya
core/src/main/java/com/threerings/presents/server/PresentsSession.java
PresentsSession.endSession
@EventThread public void endSession () { _clmgr.clientSessionWillEnd(this); // queue up a request for our connection to be closed (if we have a connection, that is) Connection conn = getConnection(); if (conn != null) { // go ahead and clear out our connection now to prevent funniness setConnection(null); // have the connection manager close our connection when it is next convenient _conmgr.closeConnection(conn); } // if we don't have a client object, we failed to resolve in the first place, in which case // we have to cope as best we can if (_clobj != null) { // and clean up after ourselves try { sessionDidEnd(); } catch (Exception e) { log.warning("Choked in sessionDidEnd " + this + ".", e); } // release (and destroy) our client object _clmgr.releaseClientObject(_clobj.username); // we only report that our session started if we managed to resolve our client object, // so we only report that it ended in the same circumstance _clmgr.clientSessionDidEnd(this); } // we always want to clear ourselves out of the client manager _clmgr.clearSession(this); // clear out the client object so that we know the session is over _clobj = null; }
java
@EventThread public void endSession () { _clmgr.clientSessionWillEnd(this); // queue up a request for our connection to be closed (if we have a connection, that is) Connection conn = getConnection(); if (conn != null) { // go ahead and clear out our connection now to prevent funniness setConnection(null); // have the connection manager close our connection when it is next convenient _conmgr.closeConnection(conn); } // if we don't have a client object, we failed to resolve in the first place, in which case // we have to cope as best we can if (_clobj != null) { // and clean up after ourselves try { sessionDidEnd(); } catch (Exception e) { log.warning("Choked in sessionDidEnd " + this + ".", e); } // release (and destroy) our client object _clmgr.releaseClientObject(_clobj.username); // we only report that our session started if we managed to resolve our client object, // so we only report that it ended in the same circumstance _clmgr.clientSessionDidEnd(this); } // we always want to clear ourselves out of the client manager _clmgr.clearSession(this); // clear out the client object so that we know the session is over _clobj = null; }
[ "@", "EventThread", "public", "void", "endSession", "(", ")", "{", "_clmgr", ".", "clientSessionWillEnd", "(", "this", ")", ";", "// queue up a request for our connection to be closed (if we have a connection, that is)", "Connection", "conn", "=", "getConnection", "(", ")",...
Forcibly terminates a client's session. This must be called from the dobjmgr thread.
[ "Forcibly", "terminates", "a", "client", "s", "session", ".", "This", "must", "be", "called", "from", "the", "dobjmgr", "thread", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsSession.java#L341-L378
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.createRelation
private void createRelation(CmsResource resource, CmsResource target, String relationType, boolean importCase) throws CmsException { CmsRelationType type = CmsRelationType.valueOf(relationType); m_securityManager.addRelationToResource(m_context, resource, target, type, importCase); }
java
private void createRelation(CmsResource resource, CmsResource target, String relationType, boolean importCase) throws CmsException { CmsRelationType type = CmsRelationType.valueOf(relationType); m_securityManager.addRelationToResource(m_context, resource, target, type, importCase); }
[ "private", "void", "createRelation", "(", "CmsResource", "resource", ",", "CmsResource", "target", ",", "String", "relationType", ",", "boolean", "importCase", ")", "throws", "CmsException", "{", "CmsRelationType", "type", "=", "CmsRelationType", ".", "valueOf", "("...
Adds a new relation to the given resource.<p> @param resource the source resource @param target the target resource @param relationType the type of the relation @param importCase if importing relations @throws CmsException if something goes wrong
[ "Adds", "a", "new", "relation", "to", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L4222-L4227
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/UIViewParameter.java
UIViewParameter.getConvertedValue
@Override protected Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException { return getInputTextRenderer(context).getConvertedValue(context, this, submittedValue); }
java
@Override protected Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException { return getInputTextRenderer(context).getConvertedValue(context, this, submittedValue); }
[ "@", "Override", "protected", "Object", "getConvertedValue", "(", "FacesContext", "context", ",", "Object", "submittedValue", ")", "throws", "ConverterException", "{", "return", "getInputTextRenderer", "(", "context", ")", ".", "getConvertedValue", "(", "context", ","...
<p class="changed_added_2_0">Because this class has no {@link Renderer}, leverage the one from the standard HTML_BASIC {@link RenderKit} with <code>component-family: javax.faces.Input</code> and <code>renderer-type: javax.faces.Text</code> and call its {@link Renderer#getConvertedValue} method.</p> @since 2.0
[ "<p", "class", "=", "changed_added_2_0", ">", "Because", "this", "class", "has", "no", "{", "@link", "Renderer", "}", "leverage", "the", "one", "from", "the", "standard", "HTML_BASIC", "{", "@link", "RenderKit", "}", "with", "<code", ">", "component", "-", ...
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIViewParameter.java#L433-L440
alkacon/opencms-core
src/org/opencms/loader/CmsJspLoader.java
CmsJspLoader.getJspRfsPath
private String getJspRfsPath(CmsResource resource, boolean online) throws CmsLoaderException { String jspVfsName = resource.getRootPath(); String extension; int loaderId = OpenCms.getResourceManager().getResourceType(resource.getTypeId()).getLoaderId(); if ((loaderId == CmsJspLoader.RESOURCE_LOADER_ID) && (!jspVfsName.endsWith(JSP_EXTENSION))) { // this is a true JSP resource that does not end with ".jsp" extension = JSP_EXTENSION; } else { // not a JSP resource or already ends with ".jsp" extension = ""; } String jspPath = CmsFileUtil.getRepositoryName(m_jspRepository, jspVfsName + extension, online); return jspPath; }
java
private String getJspRfsPath(CmsResource resource, boolean online) throws CmsLoaderException { String jspVfsName = resource.getRootPath(); String extension; int loaderId = OpenCms.getResourceManager().getResourceType(resource.getTypeId()).getLoaderId(); if ((loaderId == CmsJspLoader.RESOURCE_LOADER_ID) && (!jspVfsName.endsWith(JSP_EXTENSION))) { // this is a true JSP resource that does not end with ".jsp" extension = JSP_EXTENSION; } else { // not a JSP resource or already ends with ".jsp" extension = ""; } String jspPath = CmsFileUtil.getRepositoryName(m_jspRepository, jspVfsName + extension, online); return jspPath; }
[ "private", "String", "getJspRfsPath", "(", "CmsResource", "resource", ",", "boolean", "online", ")", "throws", "CmsLoaderException", "{", "String", "jspVfsName", "=", "resource", ".", "getRootPath", "(", ")", ";", "String", "extension", ";", "int", "loaderId", "...
Returns the RFS path for a JSP resource.<p> This does not check whether there actually exists a file at the returned path. @param resource the JSP resource @param online true if the path for the online project should be returned @return the RFS path for the JSP @throws CmsLoaderException if accessing the resource loader fails
[ "Returns", "the", "RFS", "path", "for", "a", "JSP", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1777-L1791
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/extractor/InstrumentedExtractorBase.java
InstrumentedExtractorBase.afterRead
public void afterRead(D record, long startTime) { Instrumented.updateTimer(this.extractorTimer, System.nanoTime() - startTime, TimeUnit.NANOSECONDS); if (record != null) { Instrumented.markMeter(this.readRecordsMeter); } }
java
public void afterRead(D record, long startTime) { Instrumented.updateTimer(this.extractorTimer, System.nanoTime() - startTime, TimeUnit.NANOSECONDS); if (record != null) { Instrumented.markMeter(this.readRecordsMeter); } }
[ "public", "void", "afterRead", "(", "D", "record", ",", "long", "startTime", ")", "{", "Instrumented", ".", "updateTimer", "(", "this", ".", "extractorTimer", ",", "System", ".", "nanoTime", "(", ")", "-", "startTime", ",", "TimeUnit", ".", "NANOSECONDS", ...
Called after each record is read. @param record record read. @param startTime reading start time.
[ "Called", "after", "each", "record", "is", "read", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/extractor/InstrumentedExtractorBase.java#L208-L213
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ComponentUtil.java
ComponentUtil.registerTypeMapping
private static Class registerTypeMapping(Class clazz) throws PageException { PageContext pc = ThreadLocalPageContext.get(); WSServer server = ((ConfigImpl) ThreadLocalPageContext.getConfig(pc)).getWSHandler().getWSServer(pc); return registerTypeMapping(server, clazz); }
java
private static Class registerTypeMapping(Class clazz) throws PageException { PageContext pc = ThreadLocalPageContext.get(); WSServer server = ((ConfigImpl) ThreadLocalPageContext.getConfig(pc)).getWSHandler().getWSServer(pc); return registerTypeMapping(server, clazz); }
[ "private", "static", "Class", "registerTypeMapping", "(", "Class", "clazz", ")", "throws", "PageException", "{", "PageContext", "pc", "=", "ThreadLocalPageContext", ".", "get", "(", ")", ";", "WSServer", "server", "=", "(", "(", "ConfigImpl", ")", "ThreadLocalPa...
search in methods of a class for complex types @param clazz @return @throws PageException
[ "search", "in", "methods", "of", "a", "class", "for", "complex", "types" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ComponentUtil.java#L278-L282
js-lib-com/commons
src/main/java/js/util/Strings.java
Strings.save
public static void save(CharSequence chars, OutputStream outputStream) throws IOException { if(chars != null) { ByteArrayInputStream inputStream = new ByteArrayInputStream(chars.toString().getBytes()); Files.copy(inputStream, outputStream); } }
java
public static void save(CharSequence chars, OutputStream outputStream) throws IOException { if(chars != null) { ByteArrayInputStream inputStream = new ByteArrayInputStream(chars.toString().getBytes()); Files.copy(inputStream, outputStream); } }
[ "public", "static", "void", "save", "(", "CharSequence", "chars", ",", "OutputStream", "outputStream", ")", "throws", "IOException", "{", "if", "(", "chars", "!=", "null", ")", "{", "ByteArrayInputStream", "inputStream", "=", "new", "ByteArrayInputStream", "(", ...
Copy source characters to requested output bytes stream. If given <code>chars</code> parameter is null or empty this method does nothing. @param chars source characters stream, @param outputStream target bytes stream. @throws IOException if copy operation fails.
[ "Copy", "source", "characters", "to", "requested", "output", "bytes", "stream", ".", "If", "given", "<code", ">", "chars<", "/", "code", ">", "parameter", "is", "null", "or", "empty", "this", "method", "does", "nothing", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L1525-L1531
lukas-krecan/JsonUnit
json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java
JsonAssert.withMatcher
public static Configuration withMatcher(String matcherName, Matcher<?> matcher) { return Configuration.empty().withMatcher(matcherName, matcher); }
java
public static Configuration withMatcher(String matcherName, Matcher<?> matcher) { return Configuration.empty().withMatcher(matcherName, matcher); }
[ "public", "static", "Configuration", "withMatcher", "(", "String", "matcherName", ",", "Matcher", "<", "?", ">", "matcher", ")", "{", "return", "Configuration", ".", "empty", "(", ")", ".", "withMatcher", "(", "matcherName", ",", "matcher", ")", ";", "}" ]
Adds a matcher to be used in ${json-unit.matches:matcherName} macro.
[ "Adds", "a", "matcher", "to", "be", "used", "in", "$", "{", "json", "-", "unit", ".", "matches", ":", "matcherName", "}", "macro", "." ]
train
https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L281-L283
alkacon/opencms-core
src/org/opencms/db/generic/CmsVfsDriver.java
CmsVfsDriver.readUrlNameMappingEntries
public List<CmsUrlNameMappingEntry> readUrlNameMappingEntries( CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException { Connection conn = null; ResultSet resultSet = null; PreparedStatement stmt = null; List<CmsUrlNameMappingEntry> result = new ArrayList<CmsUrlNameMappingEntry>(); try { conn = m_sqlManager.getConnection(dbc); String query = m_sqlManager.readQuery("C_READ_URLNAME_MAPPINGS"); query = replaceProject(query, online); stmt = getPreparedStatementForFilter(conn, query, filter); resultSet = stmt.executeQuery(); while (resultSet.next()) { CmsUrlNameMappingEntry entry = internalCreateUrlNameMappingEntry(resultSet); result.add(entry); } return result; } catch (SQLException e) { throw wrapException(stmt, e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, resultSet); } }
java
public List<CmsUrlNameMappingEntry> readUrlNameMappingEntries( CmsDbContext dbc, boolean online, CmsUrlNameMappingFilter filter) throws CmsDataAccessException { Connection conn = null; ResultSet resultSet = null; PreparedStatement stmt = null; List<CmsUrlNameMappingEntry> result = new ArrayList<CmsUrlNameMappingEntry>(); try { conn = m_sqlManager.getConnection(dbc); String query = m_sqlManager.readQuery("C_READ_URLNAME_MAPPINGS"); query = replaceProject(query, online); stmt = getPreparedStatementForFilter(conn, query, filter); resultSet = stmt.executeQuery(); while (resultSet.next()) { CmsUrlNameMappingEntry entry = internalCreateUrlNameMappingEntry(resultSet); result.add(entry); } return result; } catch (SQLException e) { throw wrapException(stmt, e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, resultSet); } }
[ "public", "List", "<", "CmsUrlNameMappingEntry", ">", "readUrlNameMappingEntries", "(", "CmsDbContext", "dbc", ",", "boolean", "online", ",", "CmsUrlNameMappingFilter", "filter", ")", "throws", "CmsDataAccessException", "{", "Connection", "conn", "=", "null", ";", "Re...
Reads the URL name mapping entries which match a given filter.<p> @param dbc the database context @param online if true, reads from the online mapping, else from the offline mapping @param filter the filter which the entries to be read should match @return the mapping entries which match the given filter @throws CmsDataAccessException if something goes wrong
[ "Reads", "the", "URL", "name", "mapping", "entries", "which", "match", "a", "given", "filter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L2751-L2777
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java
PoiUtil.writeCellValue
public static String writeCellValue(Cell cell, Object fv) { if (fv == null) { cell.setCellType(CellType.BLANK); return ""; } if (fv instanceof Number) { val value = ((Number) fv).doubleValue(); cell.setCellValue(value); return "" + value; } if (fv instanceof String) { cell.setCellValue((String) fv); return (String) fv; } val value = "" + fv; cell.setCellValue(value); return value; }
java
public static String writeCellValue(Cell cell, Object fv) { if (fv == null) { cell.setCellType(CellType.BLANK); return ""; } if (fv instanceof Number) { val value = ((Number) fv).doubleValue(); cell.setCellValue(value); return "" + value; } if (fv instanceof String) { cell.setCellValue((String) fv); return (String) fv; } val value = "" + fv; cell.setCellValue(value); return value; }
[ "public", "static", "String", "writeCellValue", "(", "Cell", "cell", ",", "Object", "fv", ")", "{", "if", "(", "fv", "==", "null", ")", "{", "cell", ".", "setCellType", "(", "CellType", ".", "BLANK", ")", ";", "return", "\"\"", ";", "}", "if", "(", ...
向单元格写入值,处理值为整型时的写入情况。 @param cell 单元格。 @param fv 单元格值。 @return 单元格字符串取值。
[ "向单元格写入值,处理值为整型时的写入情况。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L147-L167
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
Task.loadAndInstantiateInvokable
private static AbstractInvokable loadAndInstantiateInvokable( ClassLoader classLoader, String className, Environment environment) throws Throwable { final Class<? extends AbstractInvokable> invokableClass; try { invokableClass = Class.forName(className, true, classLoader) .asSubclass(AbstractInvokable.class); } catch (Throwable t) { throw new Exception("Could not load the task's invokable class.", t); } Constructor<? extends AbstractInvokable> statelessCtor; try { statelessCtor = invokableClass.getConstructor(Environment.class); } catch (NoSuchMethodException ee) { throw new FlinkException("Task misses proper constructor", ee); } // instantiate the class try { //noinspection ConstantConditions --> cannot happen return statelessCtor.newInstance(environment); } catch (InvocationTargetException e) { // directly forward exceptions from the eager initialization throw e.getTargetException(); } catch (Exception e) { throw new FlinkException("Could not instantiate the task's invokable class.", e); } }
java
private static AbstractInvokable loadAndInstantiateInvokable( ClassLoader classLoader, String className, Environment environment) throws Throwable { final Class<? extends AbstractInvokable> invokableClass; try { invokableClass = Class.forName(className, true, classLoader) .asSubclass(AbstractInvokable.class); } catch (Throwable t) { throw new Exception("Could not load the task's invokable class.", t); } Constructor<? extends AbstractInvokable> statelessCtor; try { statelessCtor = invokableClass.getConstructor(Environment.class); } catch (NoSuchMethodException ee) { throw new FlinkException("Task misses proper constructor", ee); } // instantiate the class try { //noinspection ConstantConditions --> cannot happen return statelessCtor.newInstance(environment); } catch (InvocationTargetException e) { // directly forward exceptions from the eager initialization throw e.getTargetException(); } catch (Exception e) { throw new FlinkException("Could not instantiate the task's invokable class.", e); } }
[ "private", "static", "AbstractInvokable", "loadAndInstantiateInvokable", "(", "ClassLoader", "classLoader", ",", "String", "className", ",", "Environment", "environment", ")", "throws", "Throwable", "{", "final", "Class", "<", "?", "extends", "AbstractInvokable", ">", ...
Instantiates the given task invokable class, passing the given environment (and possibly the initial task state) to the task's constructor. <p>The method will first try to instantiate the task via a constructor accepting both the Environment and the TaskStateSnapshot. If no such constructor exists, and there is no initial state, the method will fall back to the stateless convenience constructor that accepts only the Environment. @param classLoader The classloader to load the class through. @param className The name of the class to load. @param environment The task environment. @return The instantiated invokable task object. @throws Throwable Forwards all exceptions that happen during initialization of the task. Also throws an exception if the task class misses the necessary constructor.
[ "Instantiates", "the", "given", "task", "invokable", "class", "passing", "the", "given", "environment", "(", "and", "possibly", "the", "initial", "task", "state", ")", "to", "the", "task", "s", "constructor", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java#L1410-L1441
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/serialization/OBase64Utils.java
OBase64Utils.encodeBytes
public static StringBuilder encodeBytes(final StringBuilder iOutput, final byte[] source) { if (source != null) { // Since we're not going to have the GZIP encoding turned on, // we're not going to have an java.io.IOException thrown, so // we should not force the user to have to catch it. try { iOutput.append(encodeBytes(source, 0, source.length, NO_OPTIONS)); } catch (java.io.IOException ex) { assert false : ex.getMessage(); } } return iOutput; }
java
public static StringBuilder encodeBytes(final StringBuilder iOutput, final byte[] source) { if (source != null) { // Since we're not going to have the GZIP encoding turned on, // we're not going to have an java.io.IOException thrown, so // we should not force the user to have to catch it. try { iOutput.append(encodeBytes(source, 0, source.length, NO_OPTIONS)); } catch (java.io.IOException ex) { assert false : ex.getMessage(); } } return iOutput; }
[ "public", "static", "StringBuilder", "encodeBytes", "(", "final", "StringBuilder", "iOutput", ",", "final", "byte", "[", "]", "source", ")", "{", "if", "(", "source", "!=", "null", ")", "{", "// Since we're not going to have the GZIP encoding turned on,\r", "// we're ...
Encodes a byte array into Base64 notation. Does not GZip-compress data. @param source The data to convert @return The data in Base64-encoded form @throws NullPointerException if source array is null @since 1.4
[ "Encodes", "a", "byte", "array", "into", "Base64", "notation", ".", "Does", "not", "GZip", "-", "compress", "data", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/serialization/OBase64Utils.java#L646-L658
jenkinsci/jenkins
core/src/main/java/hudson/views/ListViewColumn.java
ListViewColumn.createDefaultInitialColumnList
public static List<ListViewColumn> createDefaultInitialColumnList(Class<? extends View> context) { return createDefaultInitialColumnList(DescriptorVisibilityFilter.applyType(context, ListViewColumn.all())); }
java
public static List<ListViewColumn> createDefaultInitialColumnList(Class<? extends View> context) { return createDefaultInitialColumnList(DescriptorVisibilityFilter.applyType(context, ListViewColumn.all())); }
[ "public", "static", "List", "<", "ListViewColumn", ">", "createDefaultInitialColumnList", "(", "Class", "<", "?", "extends", "View", ">", "context", ")", "{", "return", "createDefaultInitialColumnList", "(", "DescriptorVisibilityFilter", ".", "applyType", "(", "contex...
Creates the list of {@link ListViewColumn}s to be used for newly created {@link ListView}s and their likes. @see ListView#initColumns() @since 2.37
[ "Creates", "the", "list", "of", "{", "@link", "ListViewColumn", "}", "s", "to", "be", "used", "for", "newly", "created", "{", "@link", "ListView", "}", "s", "and", "their", "likes", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/views/ListViewColumn.java#L138-L140
SteelBridgeLabs/neo4j-gremlin-bolt
src/main/java/com/steelbridgelabs/oss/neo4j/structure/Neo4JVertex.java
Neo4JVertex.matchPredicate
public String matchPredicate(String alias, String idParameterName) { Objects.requireNonNull(alias, "alias cannot be null"); Objects.requireNonNull(idParameterName, "idParameterName cannot be null"); // get partition Neo4JReadPartition partition = graph.getPartition(); // create match predicate return vertexIdProvider.matchPredicateOperand(alias) + " = {" + idParameterName + "}" + (partition.usesMatchPredicate() ? " AND (" + partition.vertexMatchPredicate(alias) + ")" : ""); }
java
public String matchPredicate(String alias, String idParameterName) { Objects.requireNonNull(alias, "alias cannot be null"); Objects.requireNonNull(idParameterName, "idParameterName cannot be null"); // get partition Neo4JReadPartition partition = graph.getPartition(); // create match predicate return vertexIdProvider.matchPredicateOperand(alias) + " = {" + idParameterName + "}" + (partition.usesMatchPredicate() ? " AND (" + partition.vertexMatchPredicate(alias) + ")" : ""); }
[ "public", "String", "matchPredicate", "(", "String", "alias", ",", "String", "idParameterName", ")", "{", "Objects", ".", "requireNonNull", "(", "alias", ",", "\"alias cannot be null\"", ")", ";", "Objects", ".", "requireNonNull", "(", "idParameterName", ",", "\"i...
Generates a Cypher MATCH predicate for the vertex, example: <p> alias.id = {id} AND (alias:Label1 OR alias:Label2) </p> @param alias The node alias. @param idParameterName The name of the parameter that contains the vertex id. @return the Cypher MATCH predicate or <code>null</code> if not required to MATCH the vertex.
[ "Generates", "a", "Cypher", "MATCH", "predicate", "for", "the", "vertex", "example", ":", "<p", ">", "alias", ".", "id", "=", "{", "id", "}", "AND", "(", "alias", ":", "Label1", "OR", "alias", ":", "Label2", ")", "<", "/", "p", ">" ]
train
https://github.com/SteelBridgeLabs/neo4j-gremlin-bolt/blob/df3ab429e0c83affae6cd43d41edd90de80c032e/src/main/java/com/steelbridgelabs/oss/neo4j/structure/Neo4JVertex.java#L380-L387
cdk/cdk
legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java
GeometryTools.get2DCentreOfMass
public static Point2d get2DCentreOfMass(IAtomContainer ac) { double xsum = 0.0; double ysum = 0.0; double totalmass = 0.0; Iterator<IAtom> atoms = ac.atoms().iterator(); while (atoms.hasNext()) { IAtom a = (IAtom) atoms.next(); Double mass = a.getExactMass(); if (mass == null) return null; totalmass += mass; xsum += mass * a.getPoint2d().x; ysum += mass * a.getPoint2d().y; } return new Point2d(xsum / totalmass, ysum / totalmass); }
java
public static Point2d get2DCentreOfMass(IAtomContainer ac) { double xsum = 0.0; double ysum = 0.0; double totalmass = 0.0; Iterator<IAtom> atoms = ac.atoms().iterator(); while (atoms.hasNext()) { IAtom a = (IAtom) atoms.next(); Double mass = a.getExactMass(); if (mass == null) return null; totalmass += mass; xsum += mass * a.getPoint2d().x; ysum += mass * a.getPoint2d().y; } return new Point2d(xsum / totalmass, ysum / totalmass); }
[ "public", "static", "Point2d", "get2DCentreOfMass", "(", "IAtomContainer", "ac", ")", "{", "double", "xsum", "=", "0.0", ";", "double", "ysum", "=", "0.0", ";", "double", "totalmass", "=", "0.0", ";", "Iterator", "<", "IAtom", ">", "atoms", "=", "ac", "....
Calculates the center of mass for the <code>Atom</code>s in the AtomContainer for the 2D coordinates. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param ac AtomContainer for which the center of mass is calculated @return Null, if any of the atomcontainer {@link IAtom}'s masses are null @cdk.keyword center of mass
[ "Calculates", "the", "center", "of", "mass", "for", "the", "<code", ">", "Atom<", "/", "code", ">", "s", "in", "the", "AtomContainer", "for", "the", "2D", "coordinates", ".", "See", "comment", "for", "center", "(", "IAtomContainer", "atomCon", "Dimension", ...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L455-L472
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java
ThreadSafeJOptionPane.showMessageDialog
public static void showMessageDialog(final Component parentComponent, final Object message) { execute(new VoidOptionPane() { public void show() { JOptionPane.showMessageDialog(parentComponent, message); } }); }
java
public static void showMessageDialog(final Component parentComponent, final Object message) { execute(new VoidOptionPane() { public void show() { JOptionPane.showMessageDialog(parentComponent, message); } }); }
[ "public", "static", "void", "showMessageDialog", "(", "final", "Component", "parentComponent", ",", "final", "Object", "message", ")", "{", "execute", "(", "new", "VoidOptionPane", "(", ")", "{", "public", "void", "show", "(", ")", "{", "JOptionPane", ".", "...
Brings up an information-message dialog titled "Message". @param parentComponent determines the <code>Frame</code> in which the dialog is displayed; if <code>null</code>, or if the <code>parentComponent</code> has no <code>Frame</code>, a default <code>Frame</code> is used @param message the <code>Object</code> to display
[ "Brings", "up", "an", "information", "-", "message", "dialog", "titled", "Message", "." ]
train
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/threadsafe/ThreadSafeJOptionPane.java#L827-L835
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnLRNCrossChannelBackward
public static int cudnnLRNCrossChannelBackward( cudnnHandle handle, cudnnLRNDescriptor normDesc, int lrnMode, Pointer alpha, cudnnTensorDescriptor yDesc, Pointer y, cudnnTensorDescriptor dyDesc, Pointer dy, cudnnTensorDescriptor xDesc, Pointer x, Pointer beta, cudnnTensorDescriptor dxDesc, Pointer dx) { return checkResult(cudnnLRNCrossChannelBackwardNative(handle, normDesc, lrnMode, alpha, yDesc, y, dyDesc, dy, xDesc, x, beta, dxDesc, dx)); }
java
public static int cudnnLRNCrossChannelBackward( cudnnHandle handle, cudnnLRNDescriptor normDesc, int lrnMode, Pointer alpha, cudnnTensorDescriptor yDesc, Pointer y, cudnnTensorDescriptor dyDesc, Pointer dy, cudnnTensorDescriptor xDesc, Pointer x, Pointer beta, cudnnTensorDescriptor dxDesc, Pointer dx) { return checkResult(cudnnLRNCrossChannelBackwardNative(handle, normDesc, lrnMode, alpha, yDesc, y, dyDesc, dy, xDesc, x, beta, dxDesc, dx)); }
[ "public", "static", "int", "cudnnLRNCrossChannelBackward", "(", "cudnnHandle", "handle", ",", "cudnnLRNDescriptor", "normDesc", ",", "int", "lrnMode", ",", "Pointer", "alpha", ",", "cudnnTensorDescriptor", "yDesc", ",", "Pointer", "y", ",", "cudnnTensorDescriptor", "d...
LRN cross-channel backward computation. Double parameters cast to tensor data type
[ "LRN", "cross", "-", "channel", "backward", "computation", ".", "Double", "parameters", "cast", "to", "tensor", "data", "type" ]
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L2080-L2096
Nexmo/nexmo-java
src/main/java/com/nexmo/client/sms/SmsClient.java
SmsClient.searchMessages
public SearchSmsResponse searchMessages(String id, String... ids) throws IOException, NexmoClientException { List<String> idList = new ArrayList<>(ids.length + 1); idList.add(id); idList.addAll(Arrays.asList(ids)); return this.searchMessages(new SmsIdSearchRequest(idList)); }
java
public SearchSmsResponse searchMessages(String id, String... ids) throws IOException, NexmoClientException { List<String> idList = new ArrayList<>(ids.length + 1); idList.add(id); idList.addAll(Arrays.asList(ids)); return this.searchMessages(new SmsIdSearchRequest(idList)); }
[ "public", "SearchSmsResponse", "searchMessages", "(", "String", "id", ",", "String", "...", "ids", ")", "throws", "IOException", ",", "NexmoClientException", "{", "List", "<", "String", ">", "idList", "=", "new", "ArrayList", "<>", "(", "ids", ".", "length", ...
Search for completed SMS transactions by ID @param id the first ID to look up @param ids optional extra IDs to look up @return SMS data matching the provided criteria
[ "Search", "for", "completed", "SMS", "transactions", "by", "ID" ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/sms/SmsClient.java#L99-L104
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/shared/environment/logging/LoggingHandlerEnvironmentFacet.java
LoggingHandlerEnvironmentFacet.setup
@Override public void setup() { // Redirect the JUL Logging statements to the Maven Log. rootLogger.setLevel(MavenLogHandler.getJavaUtilLoggingLevelFor(log)); this.mavenLogHandler = new MavenLogHandler(log, logPrefix, encoding, loggerNamePrefixes); for (Handler current : rootLogger.getHandlers()) { // Stash the original handlers from the RootLogger. originalHandlers.add(current); // Remove the original handler from the RootLogger. rootLogger.removeHandler(current); } // Add the new Maven Log handler. rootLogger.addHandler(this.mavenLogHandler); }
java
@Override public void setup() { // Redirect the JUL Logging statements to the Maven Log. rootLogger.setLevel(MavenLogHandler.getJavaUtilLoggingLevelFor(log)); this.mavenLogHandler = new MavenLogHandler(log, logPrefix, encoding, loggerNamePrefixes); for (Handler current : rootLogger.getHandlers()) { // Stash the original handlers from the RootLogger. originalHandlers.add(current); // Remove the original handler from the RootLogger. rootLogger.removeHandler(current); } // Add the new Maven Log handler. rootLogger.addHandler(this.mavenLogHandler); }
[ "@", "Override", "public", "void", "setup", "(", ")", "{", "// Redirect the JUL Logging statements to the Maven Log.", "rootLogger", ".", "setLevel", "(", "MavenLogHandler", ".", "getJavaUtilLoggingLevelFor", "(", "log", ")", ")", ";", "this", ".", "mavenLogHandler", ...
{@inheritDoc} <p>Redirects JUL logging statements to the Maven Log.</p>
[ "{" ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/shared/environment/logging/LoggingHandlerEnvironmentFacet.java#L93-L111
jamesagnew/hapi-fhir
hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java
AbstractJaxRsResourceProvider.conditionalUpdate
@PUT public Response conditionalUpdate(final String resource) throws IOException { return execute(getResourceRequest(RequestTypeEnum.PUT, RestOperationTypeEnum.UPDATE).resource(resource)); }
java
@PUT public Response conditionalUpdate(final String resource) throws IOException { return execute(getResourceRequest(RequestTypeEnum.PUT, RestOperationTypeEnum.UPDATE).resource(resource)); }
[ "@", "PUT", "public", "Response", "conditionalUpdate", "(", "final", "String", "resource", ")", "throws", "IOException", "{", "return", "execute", "(", "getResourceRequest", "(", "RequestTypeEnum", ".", "PUT", ",", "RestOperationTypeEnum", ".", "UPDATE", ")", ".",...
Update an existing resource based on the given condition @param resource the body contents for the put method @return the response @see <a href="https://www.hl7.org/fhir/http.html#update">https://www.hl7.org/fhir/http.html#update</a>
[ "Update", "an", "existing", "resource", "based", "on", "the", "given", "condition" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L168-L172