repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java
Utils.createNameForHiddenEventHandlerMethod
public static String createNameForHiddenEventHandlerMethod(String eventId, int handlerIndex) { return PREFIX_EVENT_HANDLER + fixHiddenMember(eventId) + HIDDEN_MEMBER_CHARACTER + handlerIndex; }
java
public static String createNameForHiddenEventHandlerMethod(String eventId, int handlerIndex) { return PREFIX_EVENT_HANDLER + fixHiddenMember(eventId) + HIDDEN_MEMBER_CHARACTER + handlerIndex; }
[ "public", "static", "String", "createNameForHiddenEventHandlerMethod", "(", "String", "eventId", ",", "int", "handlerIndex", ")", "{", "return", "PREFIX_EVENT_HANDLER", "+", "fixHiddenMember", "(", "eventId", ")", "+", "HIDDEN_MEMBER_CHARACTER", "+", "handlerIndex", ";"...
Create the name of the hidden method that is containing the event handler code. @param eventId the id of the event. @param handlerIndex the index of the handler in the container type. @return the attribute name.
[ "Create", "the", "name", "of", "the", "hidden", "method", "that", "is", "containing", "the", "event", "handler", "code", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/util/Utils.java#L474-L476
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.sortCategories
public void sortCategories(String sortParams, String filter) { List<CmsCategoryBean> categories; SortParams sort = SortParams.valueOf(sortParams); switch (sort) { case tree: m_handler.onUpdateCategoriesTree(m_dialogBean.getCategories(), m_searchObject.getCategories()); break; case title_asc: categories = getFilteredCategories(filter); Collections.sort(categories, new CmsComparatorTitle(true)); m_handler.onUpdateCategoriesList(categories, m_searchObject.getCategories()); break; case title_desc: categories = getFilteredCategories(filter); Collections.sort(categories, new CmsComparatorTitle(false)); m_handler.onUpdateCategoriesList(categories, m_searchObject.getCategories()); break; case type_asc: case type_desc: case path_asc: case path_desc: case dateLastModified_asc: case dateLastModified_desc: default: } }
java
public void sortCategories(String sortParams, String filter) { List<CmsCategoryBean> categories; SortParams sort = SortParams.valueOf(sortParams); switch (sort) { case tree: m_handler.onUpdateCategoriesTree(m_dialogBean.getCategories(), m_searchObject.getCategories()); break; case title_asc: categories = getFilteredCategories(filter); Collections.sort(categories, new CmsComparatorTitle(true)); m_handler.onUpdateCategoriesList(categories, m_searchObject.getCategories()); break; case title_desc: categories = getFilteredCategories(filter); Collections.sort(categories, new CmsComparatorTitle(false)); m_handler.onUpdateCategoriesList(categories, m_searchObject.getCategories()); break; case type_asc: case type_desc: case path_asc: case path_desc: case dateLastModified_asc: case dateLastModified_desc: default: } }
[ "public", "void", "sortCategories", "(", "String", "sortParams", ",", "String", "filter", ")", "{", "List", "<", "CmsCategoryBean", ">", "categories", ";", "SortParams", "sort", "=", "SortParams", ".", "valueOf", "(", "sortParams", ")", ";", "switch", "(", "...
Sorts the categories according to given parameters and updates the list.<p> @param sortParams the sort parameters @param filter the filter to apply before sorting
[ "Sorts", "the", "categories", "according", "to", "given", "parameters", "and", "updates", "the", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1357-L1384
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateAroundLocal
public Matrix4d rotateAroundLocal(Quaterniondc quat, double ox, double oy, double oz) { return rotateAroundLocal(quat, ox, oy, oz, this); }
java
public Matrix4d rotateAroundLocal(Quaterniondc quat, double ox, double oy, double oz) { return rotateAroundLocal(quat, ox, oy, oz, this); }
[ "public", "Matrix4d", "rotateAroundLocal", "(", "Quaterniondc", "quat", ",", "double", "ox", ",", "double", "oy", ",", "double", "oz", ")", "{", "return", "rotateAroundLocal", "(", "quat", ",", "ox", ",", "oy", ",", "oz", ",", "this", ")", ";", "}" ]
Pre-multiply the rotation - and possibly scaling - transformation of the given {@link Quaterniondc} to this matrix while using <code>(ox, oy, oz)</code> as the rotation origin. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>Q</code> the rotation matrix obtained from the given quaternion, then the new matrix will be <code>Q * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>Q * M * v</code>, the quaternion rotation will be applied last! <p> This method is equivalent to calling: <code>translateLocal(-ox, -oy, -oz).rotateLocal(quat).translateLocal(ox, oy, oz)</code> <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Quaternion">http://en.wikipedia.org</a> @param quat the {@link Quaterniondc} @param ox the x coordinate of the rotation origin @param oy the y coordinate of the rotation origin @param oz the z coordinate of the rotation origin @return this
[ "Pre", "-", "multiply", "the", "rotation", "-", "and", "possibly", "scaling", "-", "transformation", "of", "the", "given", "{", "@link", "Quaterniondc", "}", "to", "this", "matrix", "while", "using", "<code", ">", "(", "ox", "oy", "oz", ")", "<", "/", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L5368-L5370
synchronoss/cpo-api
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
CassandraCpoAdapter.existsObject
@Override public <T> long existsObject(String name, T obj, Collection<CpoWhere> wheres) throws CpoException { Session session = null; long objCount = -1; try { session = getReadSession(); objCount = existsObject(name, obj, session, wheres); } catch (Exception e) { throw new CpoException("existsObjects(String, Object) failed", e); } return objCount; }
java
@Override public <T> long existsObject(String name, T obj, Collection<CpoWhere> wheres) throws CpoException { Session session = null; long objCount = -1; try { session = getReadSession(); objCount = existsObject(name, obj, session, wheres); } catch (Exception e) { throw new CpoException("existsObjects(String, Object) failed", e); } return objCount; }
[ "@", "Override", "public", "<", "T", ">", "long", "existsObject", "(", "String", "name", ",", "T", "obj", ",", "Collection", "<", "CpoWhere", ">", "wheres", ")", "throws", "CpoException", "{", "Session", "session", "=", "null", ";", "long", "objCount", "...
The CpoAdapter will check to see if this object exists in the datasource. <p/> <pre>Example: <code> <p/> class SomeObject so = new SomeObject(); long count = 0; class CpoAdapter cpo = null; <p/> <p/> try { cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p/> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ CpoWhere where = cpo.newCpoWhere(CpoWhere.LOGIC_NONE, id, CpoWhere.COMP_EQ); count = cpo.existsObject("SomeExistCheck",so, where); if (count>0) { // object exists } else { // object does not exist } } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the EXISTS Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param obj This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource. @param wheres A CpoWhere object that passes in run-time constraints to the function that performs the the exist @return The number of objects that exist in the datasource that match the specified object @throws CpoException Thrown if there are errors accessing the datasource
[ "The", "CpoAdapter", "will", "check", "to", "see", "if", "this", "object", "exists", "in", "the", "datasource", ".", "<p", "/", ">", "<pre", ">", "Example", ":", "<code", ">", "<p", "/", ">", "class", "SomeObject", "so", "=", "new", "SomeObject", "()",...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L951-L965
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java
CSTransformer.transformSpecTopicWithoutTypeCheck
private static SpecTopic transformSpecTopicWithoutTypeCheck(final CSNodeWrapper node, final Map<Integer, Node> nodes, final Map<String, SpecTopic> targetTopics, final List<CSNodeWrapper> relationshipFromNodes) { final SpecTopic specTopic = new SpecTopic(node.getEntityId(), node.getTitle()); // Basic data specTopic.setRevision(node.getEntityRevision()); specTopic.setConditionStatement(node.getCondition()); specTopic.setTargetId(node.getTargetId()); specTopic.setUniqueId(node.getId() == null ? null : node.getId().toString()); // Set the fixed url properties applyFixedURLs(node, specTopic); // Collect any relationships for processing after everything is transformed if (node.getRelatedToNodes() != null && node.getRelatedToNodes().getItems() != null && !node.getRelatedToNodes().getItems() .isEmpty()) { relationshipFromNodes.add(node); } // Add the node to the list of processed nodes so that the relationships can be added once everything is processed nodes.put(node.getId(), specTopic); // If there is a target add it to the list if (node.getTargetId() != null) { targetTopics.put(node.getTargetId(), specTopic); } return specTopic; }
java
private static SpecTopic transformSpecTopicWithoutTypeCheck(final CSNodeWrapper node, final Map<Integer, Node> nodes, final Map<String, SpecTopic> targetTopics, final List<CSNodeWrapper> relationshipFromNodes) { final SpecTopic specTopic = new SpecTopic(node.getEntityId(), node.getTitle()); // Basic data specTopic.setRevision(node.getEntityRevision()); specTopic.setConditionStatement(node.getCondition()); specTopic.setTargetId(node.getTargetId()); specTopic.setUniqueId(node.getId() == null ? null : node.getId().toString()); // Set the fixed url properties applyFixedURLs(node, specTopic); // Collect any relationships for processing after everything is transformed if (node.getRelatedToNodes() != null && node.getRelatedToNodes().getItems() != null && !node.getRelatedToNodes().getItems() .isEmpty()) { relationshipFromNodes.add(node); } // Add the node to the list of processed nodes so that the relationships can be added once everything is processed nodes.put(node.getId(), specTopic); // If there is a target add it to the list if (node.getTargetId() != null) { targetTopics.put(node.getTargetId(), specTopic); } return specTopic; }
[ "private", "static", "SpecTopic", "transformSpecTopicWithoutTypeCheck", "(", "final", "CSNodeWrapper", "node", ",", "final", "Map", "<", "Integer", ",", "Node", ">", "nodes", ",", "final", "Map", "<", "String", ",", "SpecTopic", ">", "targetTopics", ",", "final"...
Transform a Topic CSNode entity object into a SpecTopic Object that can be added to a Content Specification. @param node The CSNode entity object to be transformed. @param nodes A mapping of node entity ids to their transformed counterparts. @param targetTopics A mapping of target ids to SpecTopics. @param relationshipFromNodes A list of CSNode entities that have relationships. @return The transformed SpecTopic entity.
[ "Transform", "a", "Topic", "CSNode", "entity", "object", "into", "a", "SpecTopic", "Object", "that", "can", "be", "added", "to", "a", "Content", "Specification", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L482-L510
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.createLocalEnvironment
public static LocalStreamEnvironment createLocalEnvironment(int parallelism, Configuration configuration) { final LocalStreamEnvironment currentEnvironment; currentEnvironment = new LocalStreamEnvironment(configuration); currentEnvironment.setParallelism(parallelism); return currentEnvironment; }
java
public static LocalStreamEnvironment createLocalEnvironment(int parallelism, Configuration configuration) { final LocalStreamEnvironment currentEnvironment; currentEnvironment = new LocalStreamEnvironment(configuration); currentEnvironment.setParallelism(parallelism); return currentEnvironment; }
[ "public", "static", "LocalStreamEnvironment", "createLocalEnvironment", "(", "int", "parallelism", ",", "Configuration", "configuration", ")", "{", "final", "LocalStreamEnvironment", "currentEnvironment", ";", "currentEnvironment", "=", "new", "LocalStreamEnvironment", "(", ...
Creates a {@link LocalStreamEnvironment}. The local execution environment will run the program in a multi-threaded fashion in the same JVM as the environment was created in. It will use the parallelism specified in the parameter. @param parallelism The parallelism for the local environment. @param configuration Pass a custom configuration into the cluster @return A local execution environment with the specified parallelism.
[ "Creates", "a", "{", "@link", "LocalStreamEnvironment", "}", ".", "The", "local", "execution", "environment", "will", "run", "the", "program", "in", "a", "multi", "-", "threaded", "fashion", "in", "the", "same", "JVM", "as", "the", "environment", "was", "cre...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1628-L1635
box/box-java-sdk
src/main/java/com/box/sdk/BoxJSONObject.java
BoxJSONObject.addPendingChange
void addPendingChange(String key, String value) { this.addPendingChange(key, JsonValue.valueOf(value)); }
java
void addPendingChange(String key, String value) { this.addPendingChange(key, JsonValue.valueOf(value)); }
[ "void", "addPendingChange", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "addPendingChange", "(", "key", ",", "JsonValue", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
Adds a pending field change that needs to be sent to the API. It will be included in the JSON string the next time {@link #getPendingChanges} is called. @param key the name of the field. @param value the new String value of the field.
[ "Adds", "a", "pending", "field", "change", "that", "needs", "to", "be", "sent", "to", "the", "API", ".", "It", "will", "be", "included", "in", "the", "JSON", "string", "the", "next", "time", "{" ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxJSONObject.java#L117-L119
GumTreeDiff/gumtree
core/src/main/java/com/github/gumtreediff/matchers/optimal/rted/RtedAlgorithm.java
RtedAlgorithm.spfL
private double spfL(InfoTree it1, InfoTree it2) { int fPostorder = it1.getCurrentNode(); int gPostorder = it2.getCurrentNode(); int minKR = it2.info[POST2_MIN_KR][gPostorder]; int[] kr = it2.info[KR]; if (minKR > -1) { for (int j = minKR; kr[j] < gPostorder; j++) { treeEditDist(it1, it2, fPostorder, kr[j]); } } treeEditDist(it1, it2, fPostorder, gPostorder); return it1.isSwitched() ? delta[gPostorder][fPostorder] + deltaBit[gPostorder][fPostorder] * costMatch : delta[fPostorder][gPostorder] + deltaBit[fPostorder][gPostorder] * costMatch; }
java
private double spfL(InfoTree it1, InfoTree it2) { int fPostorder = it1.getCurrentNode(); int gPostorder = it2.getCurrentNode(); int minKR = it2.info[POST2_MIN_KR][gPostorder]; int[] kr = it2.info[KR]; if (minKR > -1) { for (int j = minKR; kr[j] < gPostorder; j++) { treeEditDist(it1, it2, fPostorder, kr[j]); } } treeEditDist(it1, it2, fPostorder, gPostorder); return it1.isSwitched() ? delta[gPostorder][fPostorder] + deltaBit[gPostorder][fPostorder] * costMatch : delta[fPostorder][gPostorder] + deltaBit[fPostorder][gPostorder] * costMatch; }
[ "private", "double", "spfL", "(", "InfoTree", "it1", ",", "InfoTree", "it2", ")", "{", "int", "fPostorder", "=", "it1", ".", "getCurrentNode", "(", ")", ";", "int", "gPostorder", "=", "it2", ".", "getCurrentNode", "(", ")", ";", "int", "minKR", "=", "i...
Single-path function for the left-most path based on Zhang and Shasha algorithm. @param it1 @param it2 @return distance between subtrees it1 and it2
[ "Single", "-", "path", "function", "for", "the", "left", "-", "most", "path", "based", "on", "Zhang", "and", "Shasha", "algorithm", "." ]
train
https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/matchers/optimal/rted/RtedAlgorithm.java#L432-L450
javalite/activejdbc
activejdbc/src/main/java/org/javalite/activejdbc/Base.java
Base.execInsert
static Object execInsert(String query, String autoIncrementColumnName, Object... params) { return new DB(DB.DEFAULT_NAME).execInsert(query, autoIncrementColumnName, params); }
java
static Object execInsert(String query, String autoIncrementColumnName, Object... params) { return new DB(DB.DEFAULT_NAME).execInsert(query, autoIncrementColumnName, params); }
[ "static", "Object", "execInsert", "(", "String", "query", ",", "String", "autoIncrementColumnName", ",", "Object", "...", "params", ")", "{", "return", "new", "DB", "(", "DB", ".", "DEFAULT_NAME", ")", ".", "execInsert", "(", "query", ",", "autoIncrementColumn...
This method is specific for inserts. @param query SQL for inserts. @param autoIncrementColumnName name of a column that is auto-incremented. @param params list of parameter values. @return new value of auto-incremented column that is uniquely identifying a new record inserted. May return -1 if this functionality is not supported by DB or driver.
[ "This", "method", "is", "specific", "for", "inserts", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L293-L295
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/reader/ServletContextResourceReaderHandler.java
ServletContextResourceReaderHandler.isInstanceOf
private boolean isInstanceOf(Object rd, List<Class<?>> interfaces) { boolean result = false; for (Class<?> class1 : interfaces) { if (class1.isInstance(rd)) { result = true; break; } } return result; }
java
private boolean isInstanceOf(Object rd, List<Class<?>> interfaces) { boolean result = false; for (Class<?> class1 : interfaces) { if (class1.isInstance(rd)) { result = true; break; } } return result; }
[ "private", "boolean", "isInstanceOf", "(", "Object", "rd", ",", "List", "<", "Class", "<", "?", ">", ">", "interfaces", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "Class", "<", "?", ">", "class1", ":", "interfaces", ")", "{", "if",...
Checks if an object is an instance of on interface from a list of interface @param rd the object @param interfacesthe list of interfaces @return true if the object is an instance of on interface from a list of interface
[ "Checks", "if", "an", "object", "is", "an", "instance", "of", "on", "interface", "from", "a", "list", "of", "interface" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/handler/reader/ServletContextResourceReaderHandler.java#L333-L345
VoltDB/voltdb
src/frontend/org/voltdb/iv2/DeterminismHash.java
DeterminismHash.compareHashes
public static int compareHashes(int[] leftHashes, int[] rightHashes) { assert(leftHashes != null); assert(rightHashes != null); assert(leftHashes.length >= 3); assert(rightHashes.length >= 3); // Compare total checksum first if (leftHashes[0] == rightHashes[0]) { return -1; } int includedHashLeft = Math.min(leftHashes[2], MAX_HASHES_COUNT); int includedHashRight = Math.min(rightHashes[2], MAX_HASHES_COUNT); int includedHashMin = Math.min(includedHashLeft, includedHashRight); int pos = 0; for(int i = HEADER_OFFSET ; i < HEADER_OFFSET + includedHashMin; i += 2) { if(leftHashes[i] != rightHashes[i] || leftHashes[i + 1] != rightHashes[i + 1]) { return pos; } pos++; } // If the number of per-statement hashes is more than MAX_HASHES_COUNT and // the mismatched hash isn't included in the per-statement hashes return HASH_NOT_INCLUDE; }
java
public static int compareHashes(int[] leftHashes, int[] rightHashes) { assert(leftHashes != null); assert(rightHashes != null); assert(leftHashes.length >= 3); assert(rightHashes.length >= 3); // Compare total checksum first if (leftHashes[0] == rightHashes[0]) { return -1; } int includedHashLeft = Math.min(leftHashes[2], MAX_HASHES_COUNT); int includedHashRight = Math.min(rightHashes[2], MAX_HASHES_COUNT); int includedHashMin = Math.min(includedHashLeft, includedHashRight); int pos = 0; for(int i = HEADER_OFFSET ; i < HEADER_OFFSET + includedHashMin; i += 2) { if(leftHashes[i] != rightHashes[i] || leftHashes[i + 1] != rightHashes[i + 1]) { return pos; } pos++; } // If the number of per-statement hashes is more than MAX_HASHES_COUNT and // the mismatched hash isn't included in the per-statement hashes return HASH_NOT_INCLUDE; }
[ "public", "static", "int", "compareHashes", "(", "int", "[", "]", "leftHashes", ",", "int", "[", "]", "rightHashes", ")", "{", "assert", "(", "leftHashes", "!=", "null", ")", ";", "assert", "(", "rightHashes", "!=", "null", ")", ";", "assert", "(", "le...
Compare two hash arrays return true if the same. For now, just compares first integer value in array.
[ "Compare", "two", "hash", "arrays", "return", "true", "if", "the", "same", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/DeterminismHash.java#L112-L135
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/utils/Assert.java
Assert.hasLength
public static void hasLength(String input, int length, String message) { notNull(input, message); if (input.trim().length() != length) { throw new IllegalArgumentException(message); } }
java
public static void hasLength(String input, int length, String message) { notNull(input, message); if (input.trim().length() != length) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "hasLength", "(", "String", "input", ",", "int", "length", ",", "String", "message", ")", "{", "notNull", "(", "input", ",", "message", ")", ";", "if", "(", "input", ".", "trim", "(", ")", ".", "length", "(", ")", "!=", ...
Asserts that a String is not null and of a certain length @param input The input under test @param message The message for any exception
[ "Asserts", "that", "a", "String", "is", "not", "null", "and", "of", "a", "certain", "length" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/Assert.java#L46-L52
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java
MsgDestEncodingUtilsImpl.setProperty
private static void setProperty(JmsDestination dest, String longName, int propIntValue, Object value) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setProperty", new Object[]{dest, longName, propIntValue, value}); switch (propIntValue) { case PR_INT: dest.setPriority((Integer)value); break; case DM_INT: dest.setDeliveryMode((String)value); break; case TL_INT: dest.setTimeToLive((Long)value); break; case RA_INT: dest.setReadAhead((String)value); break; case TN_INT: ((JmsTopic)dest).setTopicName((String)value); break; case TS_INT: ((JmsTopic)dest).setTopicSpace((String)value); break; case QN_INT: ((JmsQueue)dest).setQueueName((String)value); break; case QP_INT: ((JmsQueue)dest).setScopeToLocalQP((String)value); break; case PL_INT: ((JmsQueue)dest).setProducerPreferLocal((String)value); break; case PB_INT: ((JmsQueue)dest).setProducerBind((String)value); break; case GM_INT: ((JmsQueue)dest).setGatherMessages((String)value); break; case BN_INT: dest.setBusName((String)value); break; case BD_INT: ((JmsDestInternals)dest).setBlockedDestinationCode((Integer)value); break; case DN_INT: ((JmsDestinationImpl)dest).setDestName((String)value); break; case DD_INT: ((JmsDestinationImpl)dest).setDestDiscrim((String)value); break; default: throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"UNKNOWN_PROPERTY_CWSIA0363" ,new Object[] {longName} ,null ,"MsgDestEncodingUtilsImpl.setProperty#1" ,null ,tc); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setProperty"); }
java
private static void setProperty(JmsDestination dest, String longName, int propIntValue, Object value) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "setProperty", new Object[]{dest, longName, propIntValue, value}); switch (propIntValue) { case PR_INT: dest.setPriority((Integer)value); break; case DM_INT: dest.setDeliveryMode((String)value); break; case TL_INT: dest.setTimeToLive((Long)value); break; case RA_INT: dest.setReadAhead((String)value); break; case TN_INT: ((JmsTopic)dest).setTopicName((String)value); break; case TS_INT: ((JmsTopic)dest).setTopicSpace((String)value); break; case QN_INT: ((JmsQueue)dest).setQueueName((String)value); break; case QP_INT: ((JmsQueue)dest).setScopeToLocalQP((String)value); break; case PL_INT: ((JmsQueue)dest).setProducerPreferLocal((String)value); break; case PB_INT: ((JmsQueue)dest).setProducerBind((String)value); break; case GM_INT: ((JmsQueue)dest).setGatherMessages((String)value); break; case BN_INT: dest.setBusName((String)value); break; case BD_INT: ((JmsDestInternals)dest).setBlockedDestinationCode((Integer)value); break; case DN_INT: ((JmsDestinationImpl)dest).setDestName((String)value); break; case DD_INT: ((JmsDestinationImpl)dest).setDestDiscrim((String)value); break; default: throw (JMSException)JmsErrorUtils.newThrowable(JMSException.class ,"UNKNOWN_PROPERTY_CWSIA0363" ,new Object[] {longName} ,null ,"MsgDestEncodingUtilsImpl.setProperty#1" ,null ,tc); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setProperty"); }
[ "private", "static", "void", "setProperty", "(", "JmsDestination", "dest", ",", "String", "longName", ",", "int", "propIntValue", ",", "Object", "value", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&",...
setProperty Set the given property to the given value on the given JmsDestination. @param dest The JmsDestination whose property is to be set @param longName The name of the property to be set @param propIntValue The name of the property to be set @param value The value to set into the property @exception JMSException Thrown if the case is unexpected, or the JmsDestination objects.
[ "setProperty", "Set", "the", "given", "property", "to", "the", "given", "value", "on", "the", "given", "JmsDestination", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MsgDestEncodingUtilsImpl.java#L801-L861
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java
Postconditions.checkPostconditionI
public static int checkPostconditionI( final int value, final boolean condition, final IntFunction<String> describer) { return innerCheckI(value, condition, describer); }
java
public static int checkPostconditionI( final int value, final boolean condition, final IntFunction<String> describer) { return innerCheckI(value, condition, describer); }
[ "public", "static", "int", "checkPostconditionI", "(", "final", "int", "value", ",", "final", "boolean", "condition", ",", "final", "IntFunction", "<", "String", ">", "describer", ")", "{", "return", "innerCheckI", "(", "value", ",", "condition", ",", "describ...
An {@code int} specialized version of {@link #checkPostcondition(Object, boolean, Function)}. @param value The value @param condition The predicate @param describer The describer for the predicate @return value @throws PostconditionViolationException If the predicate is false
[ "An", "{", "@code", "int", "}", "specialized", "version", "of", "{", "@link", "#checkPostcondition", "(", "Object", "boolean", "Function", ")", "}", "." ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L403-L409
alkacon/opencms-core
src/org/opencms/search/solr/CmsSolrDocumentContainerPage.java
CmsSolrDocumentContainerPage.extractContent
@Override public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException { return extractContent(cms, resource, index, null); }
java
@Override public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException { return extractContent(cms, resource, index, null); }
[ "@", "Override", "public", "I_CmsExtractionResult", "extractContent", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "I_CmsSearchIndex", "index", ")", "throws", "CmsException", "{", "return", "extractContent", "(", "cms", ",", "resource", ",", "index"...
Returns the raw text content of a VFS resource of type <code>CmsResourceTypeContainerPage</code>.<p> @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex)
[ "Returns", "the", "raw", "text", "content", "of", "a", "VFS", "resource", "of", "type", "<code", ">", "CmsResourceTypeContainerPage<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/solr/CmsSolrDocumentContainerPage.java#L86-L91
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbXaResourceImpl.java
WSRdbXaResourceImpl.traceXAException
public final XAException traceXAException(XAException xae, Class<?> callerClass) { String detailedMessage = ivManagedConnection.mcf.helper.getXAExceptionContents(xae); Tr.error(tc, "DISPLAY_XAEX_CONTENT", detailedMessage); Tr.error(tc, "THROW_XAEXCEPTION", new Object[] { AdapterUtil.getXAExceptionCodeString(xae.errorCode), xae.getMessage() }); return xae; }
java
public final XAException traceXAException(XAException xae, Class<?> callerClass) { String detailedMessage = ivManagedConnection.mcf.helper.getXAExceptionContents(xae); Tr.error(tc, "DISPLAY_XAEX_CONTENT", detailedMessage); Tr.error(tc, "THROW_XAEXCEPTION", new Object[] { AdapterUtil.getXAExceptionCodeString(xae.errorCode), xae.getMessage() }); return xae; }
[ "public", "final", "XAException", "traceXAException", "(", "XAException", "xae", ",", "Class", "<", "?", ">", "callerClass", ")", "{", "String", "detailedMessage", "=", "ivManagedConnection", ".", "mcf", ".", "helper", ".", "getXAExceptionContents", "(", "xae", ...
Method to translate the XAResource stuff, including the error code. @param xae @param callerClass @return
[ "Method", "to", "translate", "the", "XAResource", "stuff", "including", "the", "error", "code", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbXaResourceImpl.java#L1153-L1162
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java
ComputeNodesImpl.addUserAsync
public Observable<Void> addUserAsync(String poolId, String nodeId, ComputeNodeUser user) { return addUserWithServiceResponseAsync(poolId, nodeId, user).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeAddUserHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, ComputeNodeAddUserHeaders> response) { return response.body(); } }); }
java
public Observable<Void> addUserAsync(String poolId, String nodeId, ComputeNodeUser user) { return addUserWithServiceResponseAsync(poolId, nodeId, user).map(new Func1<ServiceResponseWithHeaders<Void, ComputeNodeAddUserHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, ComputeNodeAddUserHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addUserAsync", "(", "String", "poolId", ",", "String", "nodeId", ",", "ComputeNodeUser", "user", ")", "{", "return", "addUserWithServiceResponseAsync", "(", "poolId", ",", "nodeId", ",", "user", ")", ".", "map", "(", ...
Adds a user account to the specified compute node. You can add a user account to a node only when it is in the idle or running state. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the machine on which you want to create a user account. @param user The user account to be created. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Adds", "a", "user", "account", "to", "the", "specified", "compute", "node", ".", "You", "can", "add", "a", "user", "account", "to", "a", "node", "only", "when", "it", "is", "in", "the", "idle", "or", "running", "state", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/ComputeNodesImpl.java#L207-L214
ebean-orm/ebean-querybean
src/main/java/io/ebean/typequery/TQRootBean.java
TQRootBean.rawOrEmpty
public R rawOrEmpty(String raw, Collection<?> values) { peekExprList().rawOrEmpty(raw, values); return root; }
java
public R rawOrEmpty(String raw, Collection<?> values) { peekExprList().rawOrEmpty(raw, values); return root; }
[ "public", "R", "rawOrEmpty", "(", "String", "raw", ",", "Collection", "<", "?", ">", "values", ")", "{", "peekExprList", "(", ")", ".", "rawOrEmpty", "(", "raw", ",", "values", ")", ";", "return", "root", ";", "}" ]
Only add the raw expression if the values is not null or empty. <p> This is a pure convenience expression to make it nicer to deal with the pattern where we use raw() expression with a subquery and only want to add the subquery predicate when the collection of values is not empty. </p> <h3>Without inOrEmpty()</h3> <pre>{@code QCustomer query = new QCustomer() // add some predicates .status.equalTo(Status.NEW); // common pattern - we can use rawOrEmpty() instead if (orderIds != null && !orderIds.isEmpty()) { query.raw("t0.customer_id in (select o.customer_id from orders o where o.id in (?1))", orderIds); } query.findList(); }</pre> <h3>Using rawOrEmpty()</h3> Note that in the example below we use the <code>?1</code> bind parameter to get "parameter expansion" for each element in the collection. <pre>{@code new QCustomer() .status.equalTo(Status.NEW) // only add the expression if orderIds is not empty .rawOrEmpty("t0.customer_id in (select o.customer_id from orders o where o.id in (?1))", orderIds); .findList(); }</pre> <h3>Postgres ANY</h3> With Postgres we would often use the SQL <code>ANY</code> expression and array parameter binding rather than <code>IN</code>. <pre>{@code new QCustomer() .status.equalTo(Status.NEW) .rawOrEmpty("t0.customer_id in (select o.customer_id from orders o where o.id = any(?))", orderIds); .findList(); }</pre> <p> Note that we need to cast the Postgres array for UUID types like: </p> <pre>{@code " ... = any(?::uuid[])" }</pre> @param raw The raw expression that is typically a subquery @param values The values which is typically a list or set of id values.
[ "Only", "add", "the", "raw", "expression", "if", "the", "values", "is", "not", "null", "or", "empty", ".", "<p", ">", "This", "is", "a", "pure", "convenience", "expression", "to", "make", "it", "nicer", "to", "deal", "with", "the", "pattern", "where", ...
train
https://github.com/ebean-orm/ebean-querybean/blob/821650cb817c9c0fdcc97f93408dc79170b12423/src/main/java/io/ebean/typequery/TQRootBean.java#L1040-L1043
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.calculateDuration
private static float calculateDuration(int layer, int sampleRate) { int sampleCount = (layer == AudioFrame.LAYER_1) ? SAMPLE_COUNT_L1 : SAMPLE_COUNT_L2; return (1000.0f / sampleRate) * sampleCount; }
java
private static float calculateDuration(int layer, int sampleRate) { int sampleCount = (layer == AudioFrame.LAYER_1) ? SAMPLE_COUNT_L1 : SAMPLE_COUNT_L2; return (1000.0f / sampleRate) * sampleCount; }
[ "private", "static", "float", "calculateDuration", "(", "int", "layer", ",", "int", "sampleRate", ")", "{", "int", "sampleCount", "=", "(", "layer", "==", "AudioFrame", ".", "LAYER_1", ")", "?", "SAMPLE_COUNT_L1", ":", "SAMPLE_COUNT_L2", ";", "return", "(", ...
Calculates the duration of a MPEG frame based on the given parameters. @param layer the layer @param sampleRate the sample rate @return the duration of this frame in milliseconds
[ "Calculates", "the", "duration", "of", "a", "MPEG", "frame", "based", "on", "the", "given", "parameters", "." ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L329-L332
ops4j/org.ops4j.pax.web
pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/PathMatcher.java
PathMatcher.addPrefixPath
public synchronized PathMatcher addPrefixPath(final String path, final T handler) { if (path.isEmpty()) { throw UndertowMessages.MESSAGES.pathMustBeSpecified(); } final String normalizedPath = URLUtils.normalizeSlashes(path); if (PathMatcher.STRING_PATH_SEPARATOR.equals(normalizedPath)) { if (this.defaultHandler == null) { // it was null, so just use new one this.defaultHandler = handler; } else { if (handler instanceof ResourceHandler) { // new one is not a org.ops4j.pax.web.service.undertow.internal.Context, so use it this.defaultHandler = handler; } else { // there are two default handlers which come from different (?) Contexts, so we // have a collision, but let's assume user knows what (s)he's doing if (this.defaultHandler != handler && !(this.defaultHandler instanceof ResourceHandler)) { LOG.warn("Overwriting existing default context {} with a new one {}", this.defaultHandler, handler); this.defaultHandler = handler; } } } return this; } paths.put(normalizedPath, handler); buildLengths(); return this; }
java
public synchronized PathMatcher addPrefixPath(final String path, final T handler) { if (path.isEmpty()) { throw UndertowMessages.MESSAGES.pathMustBeSpecified(); } final String normalizedPath = URLUtils.normalizeSlashes(path); if (PathMatcher.STRING_PATH_SEPARATOR.equals(normalizedPath)) { if (this.defaultHandler == null) { // it was null, so just use new one this.defaultHandler = handler; } else { if (handler instanceof ResourceHandler) { // new one is not a org.ops4j.pax.web.service.undertow.internal.Context, so use it this.defaultHandler = handler; } else { // there are two default handlers which come from different (?) Contexts, so we // have a collision, but let's assume user knows what (s)he's doing if (this.defaultHandler != handler && !(this.defaultHandler instanceof ResourceHandler)) { LOG.warn("Overwriting existing default context {} with a new one {}", this.defaultHandler, handler); this.defaultHandler = handler; } } } return this; } paths.put(normalizedPath, handler); buildLengths(); return this; }
[ "public", "synchronized", "PathMatcher", "addPrefixPath", "(", "final", "String", "path", ",", "final", "T", "handler", ")", "{", "if", "(", "path", ".", "isEmpty", "(", ")", ")", "{", "throw", "UndertowMessages", ".", "MESSAGES", ".", "pathMustBeSpecified", ...
Adds a path prefix and a handler for that path. If the path does not start with a / then one will be prepended. <p> The match is done on a prefix bases, so registering /foo will also match /bar. Exact path matches are taken into account first. <p> If / is specified as the path then it will replace the default handler. @param path The path @param handler The handler
[ "Adds", "a", "path", "prefix", "and", "a", "handler", "for", "that", "path", ".", "If", "the", "path", "does", "not", "start", "with", "a", "/", "then", "one", "will", "be", "prepended", ".", "<p", ">", "The", "match", "is", "done", "on", "a", "pre...
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-undertow/src/main/java/org/ops4j/pax/web/service/undertow/internal/PathMatcher.java#L108-L140
google/closure-compiler
src/com/google/javascript/jscomp/FileInstrumentationData.java
FileInstrumentationData.putBranchNode
void putBranchNode(int lineNumber, int branchNumber, Node block) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNumber); branchNodes.put(BranchIndexPair.of(lineNumber - 1, branchNumber - 1), block); }
java
void putBranchNode(int lineNumber, int branchNumber, Node block) { Preconditions.checkArgument( lineNumber > 0, "Expected non-zero positive integer as line number: %s", lineNumber); Preconditions.checkArgument( branchNumber > 0, "Expected non-zero positive integer as branch number: %s", branchNumber); branchNodes.put(BranchIndexPair.of(lineNumber - 1, branchNumber - 1), block); }
[ "void", "putBranchNode", "(", "int", "lineNumber", ",", "int", "branchNumber", ",", "Node", "block", ")", "{", "Preconditions", ".", "checkArgument", "(", "lineNumber", ">", "0", ",", "\"Expected non-zero positive integer as line number: %s\"", ",", "lineNumber", ")",...
Store a node to be instrumented later for branch coverage. @param lineNumber 1-based line number @param branchNumber 1-based branch number @param block the node of the conditional block.
[ "Store", "a", "node", "to", "be", "instrumented", "later", "for", "branch", "coverage", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FileInstrumentationData.java#L124-L131
jsurfer/JsonSurfer
jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
JsonSurfer.collectOne
public Object collectOne(InputStream inputStream, String... paths) { return collectOne(inputStream, compile(paths)); }
java
public Object collectOne(InputStream inputStream, String... paths) { return collectOne(inputStream, compile(paths)); }
[ "public", "Object", "collectOne", "(", "InputStream", "inputStream", ",", "String", "...", "paths", ")", "{", "return", "collectOne", "(", "inputStream", ",", "compile", "(", "paths", ")", ")", ";", "}" ]
Collect the first matched value and stop parsing immediately @param inputStream Json inpustream @param paths JsonPath @return Value
[ "Collect", "the", "first", "matched", "value", "and", "stop", "parsing", "immediately" ]
train
https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L477-L479
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_store/FSSpecStore.java
FSSpecStore.writeSpecToFile
protected void writeSpecToFile(Path specPath, Spec spec) throws IOException { byte[] serializedSpec = this.specSerDe.serialize(spec); try (FSDataOutputStream os = fs.create(specPath, true)) { os.write(serializedSpec); } }
java
protected void writeSpecToFile(Path specPath, Spec spec) throws IOException { byte[] serializedSpec = this.specSerDe.serialize(spec); try (FSDataOutputStream os = fs.create(specPath, true)) { os.write(serializedSpec); } }
[ "protected", "void", "writeSpecToFile", "(", "Path", "specPath", ",", "Spec", "spec", ")", "throws", "IOException", "{", "byte", "[", "]", "serializedSpec", "=", "this", ".", "specSerDe", ".", "serialize", "(", "spec", ")", ";", "try", "(", "FSDataOutputStre...
* Serialize and write Spec to a file. @param specPath Spec file name. @param spec Spec object to write. @throws IOException
[ "*", "Serialize", "and", "write", "Spec", "to", "a", "file", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/spec_store/FSSpecStore.java#L318-L323
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java
CopySource.serializeCopyEntity
public static void serializeCopyEntity(State state, CopyEntity copyEntity) { state.setProp(SERIALIZED_COPYABLE_FILE, CopyEntity.serialize(copyEntity)); state.setProp(COPY_ENTITY_CLASS, copyEntity.getClass().getName()); }
java
public static void serializeCopyEntity(State state, CopyEntity copyEntity) { state.setProp(SERIALIZED_COPYABLE_FILE, CopyEntity.serialize(copyEntity)); state.setProp(COPY_ENTITY_CLASS, copyEntity.getClass().getName()); }
[ "public", "static", "void", "serializeCopyEntity", "(", "State", "state", ",", "CopyEntity", "copyEntity", ")", "{", "state", ".", "setProp", "(", "SERIALIZED_COPYABLE_FILE", ",", "CopyEntity", ".", "serialize", "(", "copyEntity", ")", ")", ";", "state", ".", ...
Serialize a {@link List} of {@link CopyEntity}s into a {@link State} at {@link #SERIALIZED_COPYABLE_FILE}
[ "Serialize", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopySource.java#L511-L514
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubordinateControlRenderer.java
WSubordinateControlRenderer.paintRule
private void paintRule(final Rule rule, final XmlStringBuilder xml) { if (rule.getCondition() == null) { throw new SystemException("Rule cannot be painted as it has no condition"); } paintCondition(rule.getCondition(), xml); for (Action action : rule.getOnTrue()) { paintAction(action, "ui:onTrue", xml); } for (Action action : rule.getOnFalse()) { paintAction(action, "ui:onFalse", xml); } }
java
private void paintRule(final Rule rule, final XmlStringBuilder xml) { if (rule.getCondition() == null) { throw new SystemException("Rule cannot be painted as it has no condition"); } paintCondition(rule.getCondition(), xml); for (Action action : rule.getOnTrue()) { paintAction(action, "ui:onTrue", xml); } for (Action action : rule.getOnFalse()) { paintAction(action, "ui:onFalse", xml); } }
[ "private", "void", "paintRule", "(", "final", "Rule", "rule", ",", "final", "XmlStringBuilder", "xml", ")", "{", "if", "(", "rule", ".", "getCondition", "(", ")", "==", "null", ")", "{", "throw", "new", "SystemException", "(", "\"Rule cannot be painted as it h...
Paints a single rule. @param rule the rule to paint. @param xml the writer to send the output to
[ "Paints", "a", "single", "rule", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubordinateControlRenderer.java#L59-L73
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java
ModelSerializer.restoreMultiLayerNetwork
public static MultiLayerNetwork restoreMultiLayerNetwork(@NonNull InputStream is, boolean loadUpdater) throws IOException { checkInputStream(is); File tmpFile = null; try{ tmpFile = tempFileFromStream(is); return restoreMultiLayerNetwork(tmpFile, loadUpdater); } finally { if(tmpFile != null){ tmpFile.delete(); } } }
java
public static MultiLayerNetwork restoreMultiLayerNetwork(@NonNull InputStream is, boolean loadUpdater) throws IOException { checkInputStream(is); File tmpFile = null; try{ tmpFile = tempFileFromStream(is); return restoreMultiLayerNetwork(tmpFile, loadUpdater); } finally { if(tmpFile != null){ tmpFile.delete(); } } }
[ "public", "static", "MultiLayerNetwork", "restoreMultiLayerNetwork", "(", "@", "NonNull", "InputStream", "is", ",", "boolean", "loadUpdater", ")", "throws", "IOException", "{", "checkInputStream", "(", "is", ")", ";", "File", "tmpFile", "=", "null", ";", "try", ...
Load a MultiLayerNetwork from InputStream from an input stream<br> Note: the input stream is read fully and closed by this method. Consequently, the input stream cannot be re-used. @param is the inputstream to load from @return the loaded multi layer network @throws IOException @see #restoreMultiLayerNetworkAndNormalizer(InputStream, boolean)
[ "Load", "a", "MultiLayerNetwork", "from", "InputStream", "from", "an", "input", "stream<br", ">", "Note", ":", "the", "input", "stream", "is", "read", "fully", "and", "closed", "by", "this", "method", ".", "Consequently", "the", "input", "stream", "cannot", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ModelSerializer.java#L341-L354
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Timecode.java
Timecode.getInstance
public static final Timecode getInstance(final String smpte, final Timebase timebase) { return TimecodeBuilder.fromSMPTE(smpte).withRate(timebase).build(); }
java
public static final Timecode getInstance(final String smpte, final Timebase timebase) { return TimecodeBuilder.fromSMPTE(smpte).withRate(timebase).build(); }
[ "public", "static", "final", "Timecode", "getInstance", "(", "final", "String", "smpte", ",", "final", "Timebase", "timebase", ")", "{", "return", "TimecodeBuilder", ".", "fromSMPTE", "(", "smpte", ")", ".", "withRate", "(", "timebase", ")", ".", "build", "(...
Part a Timecode encoded in the SMPTE style (<code>[dd:]hh:mm:ss:ff</code> - or <code>[dd:]hh:mm:ss;ff</code> for drop-frame timecode) alongside a timebase. @param smpte the SMPTE-encoded timecode @param timebase the timebase to interpret the SMPTE timecode in @return a parsed timecode object @throws RuntimeException if parsing fails
[ "Part", "a", "Timecode", "encoded", "in", "the", "SMPTE", "style", "(", "<code", ">", "[", "dd", ":", "]", "hh", ":", "mm", ":", "ss", ":", "ff<", "/", "code", ">", "-", "or", "<code", ">", "[", "dd", ":", "]", "hh", ":", "mm", ":", "ss", "...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Timecode.java#L859-L862
coursera/courier
idea-plugin/src/org/coursera/courier/CourierBraceMatcher.java
CourierBraceMatcher.getPairs
@Override public BracePair[] getPairs() { return new BracePair[] { new BracePair(CourierTypes.OPEN_BRACE, CourierTypes.CLOSE_BRACE, true), new BracePair(CourierTypes.OPEN_BRACKET, CourierTypes.CLOSE_BRACKET, false), new BracePair(CourierTypes.OPEN_PAREN, CourierTypes.CLOSE_PAREN, false) //new BracePair(SchemadocTypes.DOC_COMMENT_START, SchemadocTypes.DOC_COMMENT_END, false) }; }
java
@Override public BracePair[] getPairs() { return new BracePair[] { new BracePair(CourierTypes.OPEN_BRACE, CourierTypes.CLOSE_BRACE, true), new BracePair(CourierTypes.OPEN_BRACKET, CourierTypes.CLOSE_BRACKET, false), new BracePair(CourierTypes.OPEN_PAREN, CourierTypes.CLOSE_PAREN, false) //new BracePair(SchemadocTypes.DOC_COMMENT_START, SchemadocTypes.DOC_COMMENT_END, false) }; }
[ "@", "Override", "public", "BracePair", "[", "]", "getPairs", "(", ")", "{", "return", "new", "BracePair", "[", "]", "{", "new", "BracePair", "(", "CourierTypes", ".", "OPEN_BRACE", ",", "CourierTypes", ".", "CLOSE_BRACE", ",", "true", ")", ",", "new", "...
Returns the array of definitions for brace pairs that need to be matched when editing code in the language. @return the array of brace pair definitions.
[ "Returns", "the", "array", "of", "definitions", "for", "brace", "pairs", "that", "need", "to", "be", "matched", "when", "editing", "code", "in", "the", "language", "." ]
train
https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/idea-plugin/src/org/coursera/courier/CourierBraceMatcher.java#L20-L28
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanResult.java
ScanResult.setItems
public void setItems(java.util.Collection<java.util.Map<String, AttributeValue>> items) { if (items == null) { this.items = null; return; } this.items = new java.util.ArrayList<java.util.Map<String, AttributeValue>>(items); }
java
public void setItems(java.util.Collection<java.util.Map<String, AttributeValue>> items) { if (items == null) { this.items = null; return; } this.items = new java.util.ArrayList<java.util.Map<String, AttributeValue>>(items); }
[ "public", "void", "setItems", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", ">", "items", ")", "{", "if", "(", "items", "==", "null", ")", "{", "this", ".", "items", "=...
<p> An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute. </p> @param items An array of item attributes that match the scan criteria. Each element in this array consists of an attribute name and the value for that attribute.
[ "<p", ">", "An", "array", "of", "item", "attributes", "that", "match", "the", "scan", "criteria", ".", "Each", "element", "in", "this", "array", "consists", "of", "an", "attribute", "name", "and", "the", "value", "for", "that", "attribute", ".", "<", "/"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanResult.java#L116-L123
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java
ConfusionMatrix.add
public synchronized void add(T actual, T predicted, int count) { if (matrix.containsKey(actual)) { matrix.get(actual).add(predicted, count); } else { Multiset<T> counts = HashMultiset.create(); counts.add(predicted, count); matrix.put(actual, counts); } }
java
public synchronized void add(T actual, T predicted, int count) { if (matrix.containsKey(actual)) { matrix.get(actual).add(predicted, count); } else { Multiset<T> counts = HashMultiset.create(); counts.add(predicted, count); matrix.put(actual, counts); } }
[ "public", "synchronized", "void", "add", "(", "T", "actual", ",", "T", "predicted", ",", "int", "count", ")", "{", "if", "(", "matrix", ".", "containsKey", "(", "actual", ")", ")", "{", "matrix", ".", "get", "(", "actual", ")", ".", "add", "(", "pr...
Increments the entry specified by actual and predicted by count.
[ "Increments", "the", "entry", "specified", "by", "actual", "and", "predicted", "by", "count", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ConfusionMatrix.java#L64-L72
dynjs/dynjs
src/main/java/org/dynjs/ir/Scope.java
Scope.findVariable
public LocalVariable findVariable(String name, int depth) { LocalVariable variable = localVariables.get(name); if (variable != null) { // Destined scope need adjusted variable since it need to know how deep to look for it. if (depth != 0) { return new LocalVariable(name, variable.getOffset(), depth); } return variable; } if (parent != null) { return parent.findVariable(name, depth + 1); } return null; }
java
public LocalVariable findVariable(String name, int depth) { LocalVariable variable = localVariables.get(name); if (variable != null) { // Destined scope need adjusted variable since it need to know how deep to look for it. if (depth != 0) { return new LocalVariable(name, variable.getOffset(), depth); } return variable; } if (parent != null) { return parent.findVariable(name, depth + 1); } return null; }
[ "public", "LocalVariable", "findVariable", "(", "String", "name", ",", "int", "depth", ")", "{", "LocalVariable", "variable", "=", "localVariables", ".", "get", "(", "name", ")", ";", "if", "(", "variable", "!=", "null", ")", "{", "// Destined scope need adjus...
Tries to find a variable or returns null if it cannot. This will walk all scopes to find a captured variable.
[ "Tries", "to", "find", "a", "variable", "or", "returns", "null", "if", "it", "cannot", ".", "This", "will", "walk", "all", "scopes", "to", "find", "a", "captured", "variable", "." ]
train
https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/Scope.java#L89-L106
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_protocol_PUT
public void organizationName_service_exchangeService_protocol_PUT(String organizationName, String exchangeService, OvhExchangeServiceProtocol body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/protocol"; StringBuilder sb = path(qPath, organizationName, exchangeService); exec(qPath, "PUT", sb.toString(), body); }
java
public void organizationName_service_exchangeService_protocol_PUT(String organizationName, String exchangeService, OvhExchangeServiceProtocol body) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/protocol"; StringBuilder sb = path(qPath, organizationName, exchangeService); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "organizationName_service_exchangeService_protocol_PUT", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "OvhExchangeServiceProtocol", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organization...
Alter this object properties REST: PUT /email/exchange/{organizationName}/service/{exchangeService}/protocol @param body [required] New object properties @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2297-L2301
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addAnnotationInfo
public void addAnnotationInfo(PackageElement packageElement, Content htmltree) { addAnnotationInfo(packageElement, packageElement.getAnnotationMirrors(), htmltree); }
java
public void addAnnotationInfo(PackageElement packageElement, Content htmltree) { addAnnotationInfo(packageElement, packageElement.getAnnotationMirrors(), htmltree); }
[ "public", "void", "addAnnotationInfo", "(", "PackageElement", "packageElement", ",", "Content", "htmltree", ")", "{", "addAnnotationInfo", "(", "packageElement", ",", "packageElement", ".", "getAnnotationMirrors", "(", ")", ",", "htmltree", ")", ";", "}" ]
Adds the annotation types for the given packageElement. @param packageElement the package to write annotations for. @param htmltree the documentation tree to which the annotation info will be added
[ "Adds", "the", "annotation", "types", "for", "the", "given", "packageElement", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2209-L2211
prestodb/presto
presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationFromAnnotationsParser.java
AggregationFromAnnotationsParser.parseFunctionDefinitionWithTypesConstraint
@VisibleForTesting public static ParametricAggregation parseFunctionDefinitionWithTypesConstraint(Class<?> clazz, TypeSignature returnType, List<TypeSignature> argumentTypes) { requireNonNull(returnType, "returnType is null"); requireNonNull(argumentTypes, "argumentTypes is null"); for (ParametricAggregation aggregation : parseFunctionDefinitions(clazz)) { if (aggregation.getSignature().getReturnType().equals(returnType) && aggregation.getSignature().getArgumentTypes().equals(argumentTypes)) { return aggregation; } } throw new IllegalArgumentException(String.format("No method with return type %s and arguments %s", returnType, argumentTypes)); }
java
@VisibleForTesting public static ParametricAggregation parseFunctionDefinitionWithTypesConstraint(Class<?> clazz, TypeSignature returnType, List<TypeSignature> argumentTypes) { requireNonNull(returnType, "returnType is null"); requireNonNull(argumentTypes, "argumentTypes is null"); for (ParametricAggregation aggregation : parseFunctionDefinitions(clazz)) { if (aggregation.getSignature().getReturnType().equals(returnType) && aggregation.getSignature().getArgumentTypes().equals(argumentTypes)) { return aggregation; } } throw new IllegalArgumentException(String.format("No method with return type %s and arguments %s", returnType, argumentTypes)); }
[ "@", "VisibleForTesting", "public", "static", "ParametricAggregation", "parseFunctionDefinitionWithTypesConstraint", "(", "Class", "<", "?", ">", "clazz", ",", "TypeSignature", "returnType", ",", "List", "<", "TypeSignature", ">", "argumentTypes", ")", "{", "requireNonN...
General purpose function matching is done through FunctionRegistry.
[ "General", "purpose", "function", "matching", "is", "done", "through", "FunctionRegistry", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/operator/aggregation/AggregationFromAnnotationsParser.java#L53-L65
mbrade/prefixedproperties
pp-core/src/main/java/net/sf/prefixedproperties/PrefixedProperties.java
PrefixedProperties.getBoolean
public boolean getBoolean(final String key, final boolean def) { final String value = getProperty(key); return value != null ? Boolean.valueOf(value).booleanValue() : def; }
java
public boolean getBoolean(final String key, final boolean def) { final String value = getProperty(key); return value != null ? Boolean.valueOf(value).booleanValue() : def; }
[ "public", "boolean", "getBoolean", "(", "final", "String", "key", ",", "final", "boolean", "def", ")", "{", "final", "String", "value", "=", "getProperty", "(", "key", ")", ";", "return", "value", "!=", "null", "?", "Boolean", ".", "valueOf", "(", "value...
Gets the prefixed key and parse it to an boolean-value. @param key key value @param def default value @return boolean-representation of value
[ "Gets", "the", "prefixed", "key", "and", "parse", "it", "to", "an", "boolean", "-", "value", "." ]
train
https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-core/src/main/java/net/sf/prefixedproperties/PrefixedProperties.java#L781-L784
craigwblake/redline
src/main/java/org/redline_rpm/Builder.java
Builder.addDependencyMore
public void addDependencyMore( final CharSequence name, final CharSequence version) { addDependency( name, version, GREATER | EQUAL); }
java
public void addDependencyMore( final CharSequence name, final CharSequence version) { addDependency( name, version, GREATER | EQUAL); }
[ "public", "void", "addDependencyMore", "(", "final", "CharSequence", "name", ",", "final", "CharSequence", "version", ")", "{", "addDependency", "(", "name", ",", "version", ",", "GREATER", "|", "EQUAL", ")", ";", "}" ]
Adds a dependency to the RPM package. This dependency version will be marked as the minimum allowed, and the package will require the named dependency with this version or higher at install time. @param name the name of the dependency. @param version the version identifier.
[ "Adds", "a", "dependency", "to", "the", "RPM", "package", ".", "This", "dependency", "version", "will", "be", "marked", "as", "the", "minimum", "allowed", "and", "the", "package", "will", "require", "the", "named", "dependency", "with", "this", "version", "o...
train
https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L197-L199
authorjapps/zerocode
core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java
BasicHttpClient.createFormUrlEncodedRequestBuilder
public RequestBuilder createFormUrlEncodedRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) throws IOException { RequestBuilder requestBuilder = RequestBuilder .create(methodName) .setUri(httpUrl); if (reqBodyAsString != null) { Map<String, Object> reqBodyMap = HelperJsonUtils.readObjectAsMap(reqBodyAsString); List<NameValuePair> reqBody = new ArrayList<>(); for(String key : reqBodyMap.keySet()) { reqBody.add(new BasicNameValuePair(key, reqBodyMap.get(key).toString())); } HttpEntity httpEntity = new UrlEncodedFormEntity(reqBody); requestBuilder.setEntity(httpEntity); requestBuilder.setHeader(CONTENT_TYPE, APPLICATION_FORM_URL_ENCODED); } return requestBuilder; }
java
public RequestBuilder createFormUrlEncodedRequestBuilder(String httpUrl, String methodName, String reqBodyAsString) throws IOException { RequestBuilder requestBuilder = RequestBuilder .create(methodName) .setUri(httpUrl); if (reqBodyAsString != null) { Map<String, Object> reqBodyMap = HelperJsonUtils.readObjectAsMap(reqBodyAsString); List<NameValuePair> reqBody = new ArrayList<>(); for(String key : reqBodyMap.keySet()) { reqBody.add(new BasicNameValuePair(key, reqBodyMap.get(key).toString())); } HttpEntity httpEntity = new UrlEncodedFormEntity(reqBody); requestBuilder.setEntity(httpEntity); requestBuilder.setHeader(CONTENT_TYPE, APPLICATION_FORM_URL_ENCODED); } return requestBuilder; }
[ "public", "RequestBuilder", "createFormUrlEncodedRequestBuilder", "(", "String", "httpUrl", ",", "String", "methodName", ",", "String", "reqBodyAsString", ")", "throws", "IOException", "{", "RequestBuilder", "requestBuilder", "=", "RequestBuilder", ".", "create", "(", "...
This is how framework makes the KeyValue pair when "application/x-www-form-urlencoded" headers is passed in the request. In case you want to build or prepare the requests differently, you can override this method via @UseHttpClient(YourCustomHttpClient.class). @param httpUrl @param methodName @param reqBodyAsString @return @throws IOException
[ "This", "is", "how", "framework", "makes", "the", "KeyValue", "pair", "when", "application", "/", "x", "-", "www", "-", "form", "-", "urlencoded", "headers", "is", "passed", "in", "the", "request", ".", "In", "case", "you", "want", "to", "build", "or", ...
train
https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L305-L320
graknlabs/grakn
server/src/graql/gremlin/TraversalPlanner.java
TraversalPlanner.updateFixedCostSubsReachableByIndex
private static void updateFixedCostSubsReachableByIndex(ImmutableMap<NodeId, Node> allNodes, Map<Node, Double> nodesWithFixedCost, Set<Fragment> fragments) { Set<Fragment> validSubFragments = fragments.stream().filter(fragment -> { if (fragment instanceof InSubFragment) { Node superType = allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.start())); if (nodesWithFixedCost.containsKey(superType) && nodesWithFixedCost.get(superType) > 0D) { Node subType = allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.end())); return !nodesWithFixedCost.containsKey(subType); } } return false; }).collect(Collectors.toSet()); if (!validSubFragments.isEmpty()) { validSubFragments.forEach(fragment -> { // TODO: should decrease the weight of sub type after each level nodesWithFixedCost.put(allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.end())), nodesWithFixedCost.get(allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.start())))); }); // recursively process all the sub fragments updateFixedCostSubsReachableByIndex(allNodes, nodesWithFixedCost, fragments); } }
java
private static void updateFixedCostSubsReachableByIndex(ImmutableMap<NodeId, Node> allNodes, Map<Node, Double> nodesWithFixedCost, Set<Fragment> fragments) { Set<Fragment> validSubFragments = fragments.stream().filter(fragment -> { if (fragment instanceof InSubFragment) { Node superType = allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.start())); if (nodesWithFixedCost.containsKey(superType) && nodesWithFixedCost.get(superType) > 0D) { Node subType = allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.end())); return !nodesWithFixedCost.containsKey(subType); } } return false; }).collect(Collectors.toSet()); if (!validSubFragments.isEmpty()) { validSubFragments.forEach(fragment -> { // TODO: should decrease the weight of sub type after each level nodesWithFixedCost.put(allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.end())), nodesWithFixedCost.get(allNodes.get(NodeId.of(NodeId.NodeType.VAR, fragment.start())))); }); // recursively process all the sub fragments updateFixedCostSubsReachableByIndex(allNodes, nodesWithFixedCost, fragments); } }
[ "private", "static", "void", "updateFixedCostSubsReachableByIndex", "(", "ImmutableMap", "<", "NodeId", ",", "Node", ">", "allNodes", ",", "Map", "<", "Node", ",", "Double", ">", "nodesWithFixedCost", ",", "Set", "<", "Fragment", ">", "fragments", ")", "{", "S...
if in-sub starts from an indexed supertype, update the fragment cost of in-isa starting from the subtypes
[ "if", "in", "-", "sub", "starts", "from", "an", "indexed", "supertype", "update", "the", "fragment", "cost", "of", "in", "-", "isa", "starting", "from", "the", "subtypes" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/gremlin/TraversalPlanner.java#L301-L325
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/FileTransferHelper.java
FileTransferHelper.deleteInternal
public void deleteInternal(String filePath, boolean recursive) { //Process and validate path final String processedPath = processAndValidateFilePath(filePath, false); boolean deleted; if (recursive) { File fileToDelete = new File(processedPath); if (FileUtils.fileIsDirectory(fileToDelete)) { recursiveDelete(fileToDelete); } else { FileUtils.fileDelete(fileToDelete); } deleted = FileUtils.fileExists(fileToDelete) == false; } else { deleted = deleteLocalFile(processedPath); } if (!deleted) { IOException ioe = new IOException(TraceNLS.getFormattedMessage(this.getClass(), APIConstants.TRACE_BUNDLE_FILE_TRANSFER, "DELETE_REQUEST_ERROR", null, "CWWKX0126E: Delete request for file " + processedPath + " could not be completed.")); throw ErrorHelper.createRESTHandlerJsonException(ioe, null, APIConstants.STATUS_BAD_REQUEST); } if (TraceComponent.isAnyTracingEnabled() && tc.isInfoEnabled()) { Tr.info(tc, "DELETE_REQUEST_COMPLETE_INFO", processedPath); } }
java
public void deleteInternal(String filePath, boolean recursive) { //Process and validate path final String processedPath = processAndValidateFilePath(filePath, false); boolean deleted; if (recursive) { File fileToDelete = new File(processedPath); if (FileUtils.fileIsDirectory(fileToDelete)) { recursiveDelete(fileToDelete); } else { FileUtils.fileDelete(fileToDelete); } deleted = FileUtils.fileExists(fileToDelete) == false; } else { deleted = deleteLocalFile(processedPath); } if (!deleted) { IOException ioe = new IOException(TraceNLS.getFormattedMessage(this.getClass(), APIConstants.TRACE_BUNDLE_FILE_TRANSFER, "DELETE_REQUEST_ERROR", null, "CWWKX0126E: Delete request for file " + processedPath + " could not be completed.")); throw ErrorHelper.createRESTHandlerJsonException(ioe, null, APIConstants.STATUS_BAD_REQUEST); } if (TraceComponent.isAnyTracingEnabled() && tc.isInfoEnabled()) { Tr.info(tc, "DELETE_REQUEST_COMPLETE_INFO", processedPath); } }
[ "public", "void", "deleteInternal", "(", "String", "filePath", ",", "boolean", "recursive", ")", "{", "//Process and validate path", "final", "String", "processedPath", "=", "processAndValidateFilePath", "(", "filePath", ",", "false", ")", ";", "boolean", "deleted", ...
Note: for delete operation we don't need to know if it's from legacy file transfer (V2) or not, because gzip is not involved here
[ "Note", ":", "for", "delete", "operation", "we", "don", "t", "need", "to", "know", "if", "it", "s", "from", "legacy", "file", "transfer", "(", "V2", ")", "or", "not", "because", "gzip", "is", "not", "involved", "here" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/helpers/FileTransferHelper.java#L621-L650
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.getTextureFile
public String getTextureFile(AiTextureType type, int index) { checkTexRange(type, index); return getTyped(PropertyKey.TEX_FILE, type, index, String.class); }
java
public String getTextureFile(AiTextureType type, int index) { checkTexRange(type, index); return getTyped(PropertyKey.TEX_FILE, type, index, String.class); }
[ "public", "String", "getTextureFile", "(", "AiTextureType", "type", ",", "int", "index", ")", "{", "checkTexRange", "(", "type", ",", "index", ")", ";", "return", "getTyped", "(", "PropertyKey", ".", "TEX_FILE", ",", "type", ",", "index", ",", "String", "....
Returns the texture file.<p> If missing, defaults to empty string @param type the texture type @param index the index in the texture stack @return the file @throws IndexOutOfBoundsException if index is invalid
[ "Returns", "the", "texture", "file", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L906-L910
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java
SphereUtil.sphericalVincentyFormulaDeg
public static double sphericalVincentyFormulaDeg(double lat1, double lon1, double lat2, double lon2) { return sphericalVincentyFormulaRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2)); }
java
public static double sphericalVincentyFormulaDeg(double lat1, double lon1, double lat2, double lon2) { return sphericalVincentyFormulaRad(deg2rad(lat1), deg2rad(lon1), deg2rad(lat2), deg2rad(lon2)); }
[ "public", "static", "double", "sphericalVincentyFormulaDeg", "(", "double", "lat1", ",", "double", "lon1", ",", "double", "lat2", ",", "double", "lon2", ")", "{", "return", "sphericalVincentyFormulaRad", "(", "deg2rad", "(", "lat1", ")", ",", "deg2rad", "(", "...
Compute the approximate great-circle distance of two points. Uses Vincenty's Formula for the spherical case, which does not require iterations. <p> Complexity: 7 trigonometric functions, 1 sqrt. <p> Reference: <p> T. Vincenty<br> Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations<br> Survey Review 23:176, 1975 @param lat1 Latitude of first point in degree @param lon1 Longitude of first point in degree @param lat2 Latitude of second point in degree @param lon2 Longitude of second point in degree @return Distance in radians / on unit sphere.
[ "Compute", "the", "approximate", "great", "-", "circle", "distance", "of", "two", "points", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L254-L256
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java
COSAPIClient.getMergedPath
private String getMergedPath(String hostName, Path p, String objectKey) { if ((p.getParent() != null) && (p.getName() != null) && (p.getParent().toString().equals(hostName))) { if (objectKey.equals(p.getName())) { return p.toString(); } return hostName + objectKey; } return hostName + objectKey; }
java
private String getMergedPath(String hostName, Path p, String objectKey) { if ((p.getParent() != null) && (p.getName() != null) && (p.getParent().toString().equals(hostName))) { if (objectKey.equals(p.getName())) { return p.toString(); } return hostName + objectKey; } return hostName + objectKey; }
[ "private", "String", "getMergedPath", "(", "String", "hostName", ",", "Path", "p", ",", "String", "objectKey", ")", "{", "if", "(", "(", "p", ".", "getParent", "(", ")", "!=", "null", ")", "&&", "(", "p", ".", "getName", "(", ")", "!=", "null", ")"...
Merge between two paths @param hostName @param p path @param objectKey @return merged path
[ "Merge", "between", "two", "paths" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java#L1018-L1027
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
AbstractCachedGenerator.getTempFilePath
protected String getTempFilePath(GeneratorContext context, CacheMode cacheMode) { return getTempDirectory() + cacheMode + URL_SEPARATOR + getResourceCacheKey(context.getPath(), context); }
java
protected String getTempFilePath(GeneratorContext context, CacheMode cacheMode) { return getTempDirectory() + cacheMode + URL_SEPARATOR + getResourceCacheKey(context.getPath(), context); }
[ "protected", "String", "getTempFilePath", "(", "GeneratorContext", "context", ",", "CacheMode", "cacheMode", ")", "{", "return", "getTempDirectory", "(", ")", "+", "cacheMode", "+", "URL_SEPARATOR", "+", "getResourceCacheKey", "(", "context", ".", "getPath", "(", ...
Returns the file path of the temporary resource @param context the generator context @param cacheMode the cache mode @return the file path of the temporary resource
[ "Returns", "the", "file", "path", "of", "the", "temporary", "resource" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L216-L219
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetTime.java
OffsetTime.withOffsetSameInstant
public OffsetTime withOffsetSameInstant(ZoneOffset offset) { if (offset.equals(this.offset)) { return this; } int difference = offset.getTotalSeconds() - this.offset.getTotalSeconds(); LocalTime adjusted = time.plusSeconds(difference); return new OffsetTime(adjusted, offset); }
java
public OffsetTime withOffsetSameInstant(ZoneOffset offset) { if (offset.equals(this.offset)) { return this; } int difference = offset.getTotalSeconds() - this.offset.getTotalSeconds(); LocalTime adjusted = time.plusSeconds(difference); return new OffsetTime(adjusted, offset); }
[ "public", "OffsetTime", "withOffsetSameInstant", "(", "ZoneOffset", "offset", ")", "{", "if", "(", "offset", ".", "equals", "(", "this", ".", "offset", ")", ")", "{", "return", "this", ";", "}", "int", "difference", "=", "offset", ".", "getTotalSeconds", "...
Returns a copy of this {@code OffsetTime} with the specified offset ensuring that the result is at the same instant on an implied day. <p> This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime} adjusted by the difference between the two offsets. This will result in the old and new objects representing the same instant on an implied day. This is useful for finding the local time in a different offset. For example, if this time represents {@code 10:30+02:00} and the offset specified is {@code +03:00}, then this method will return {@code 11:30+03:00}. <p> To change the offset without adjusting the local time use {@link #withOffsetSameLocal}. <p> This instance is immutable and unaffected by this method call. @param offset the zone offset to change to, not null @return an {@code OffsetTime} based on this time with the requested offset, not null
[ "Returns", "a", "copy", "of", "this", "{", "@code", "OffsetTime", "}", "with", "the", "specified", "offset", "ensuring", "that", "the", "result", "is", "at", "the", "same", "instant", "on", "an", "implied", "day", ".", "<p", ">", "This", "method", "retur...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetTime.java#L584-L591
adobe/htl-tck
src/main/java/io/sightly/tck/http/Client.java
Client.getStringContent
public String getStringContent(String url, int expectedStatusCode) { GetMethod method = new GetMethod(url); try { int statusCode = client.executeMethod(method); if (statusCode == expectedStatusCode) { InputStream is = method.getResponseBodyAsStream(); return IOUtils.toString(is, "UTF-8"); } else { throw new ClientException(String.format("Received status code %d, expected %d - url %s", statusCode, expectedStatusCode, url)); } } catch (IOException e) { throw new ClientException("Unable to complete request to " + url, e); } }
java
public String getStringContent(String url, int expectedStatusCode) { GetMethod method = new GetMethod(url); try { int statusCode = client.executeMethod(method); if (statusCode == expectedStatusCode) { InputStream is = method.getResponseBodyAsStream(); return IOUtils.toString(is, "UTF-8"); } else { throw new ClientException(String.format("Received status code %d, expected %d - url %s", statusCode, expectedStatusCode, url)); } } catch (IOException e) { throw new ClientException("Unable to complete request to " + url, e); } }
[ "public", "String", "getStringContent", "(", "String", "url", ",", "int", "expectedStatusCode", ")", "{", "GetMethod", "method", "=", "new", "GetMethod", "(", "url", ")", ";", "try", "{", "int", "statusCode", "=", "client", ".", "executeMethod", "(", "method...
Retrieves the content available at {@code url} as a {@link String}. The server must respond with a status code equal to {@code expectedStatusCode}, otherwise this method will throw a {@link ClientException}; @param url the URL from which to retrieve the content @param expectedStatusCode the expected status code from the server @return the content, as a {@link String} @throws ClientException if the server's status code differs from the {@code expectedStatusCode} or if any other error is encountered
[ "Retrieves", "the", "content", "available", "at", "{", "@code", "url", "}", "as", "a", "{", "@link", "String", "}", ".", "The", "server", "must", "respond", "with", "a", "status", "code", "equal", "to", "{", "@code", "expectedStatusCode", "}", "otherwise",...
train
https://github.com/adobe/htl-tck/blob/2043a9616083c06cefbd685798c9a2b2ac2ea98e/src/main/java/io/sightly/tck/http/Client.java#L74-L88
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationUtil.java
SerializationUtil.writeList
public static <T> void writeList(List<T> items, ObjectDataOutput out) throws IOException { writeCollection(items, out); }
java
public static <T> void writeList(List<T> items, ObjectDataOutput out) throws IOException { writeCollection(items, out); }
[ "public", "static", "<", "T", ">", "void", "writeList", "(", "List", "<", "T", ">", "items", ",", "ObjectDataOutput", "out", ")", "throws", "IOException", "{", "writeCollection", "(", "items", ",", "out", ")", ";", "}" ]
Writes a list to an {@link ObjectDataOutput}. The list's size is written to the data output, then each object in the list is serialized. @param items list of items to be serialized @param out data output to write to @param <T> type of items @throws NullPointerException if {@code items} or {@code out} is {@code null} @throws IOException when an error occurs while writing to the output
[ "Writes", "a", "list", "to", "an", "{", "@link", "ObjectDataOutput", "}", ".", "The", "list", "s", "size", "is", "written", "to", "the", "data", "output", "then", "each", "object", "in", "the", "list", "is", "serialized", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/SerializationUtil.java#L265-L267
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java
JsHdrsImpl.getReverseRoutingPath
public final List<SIDestinationAddress> getReverseRoutingPath() { List<String> fNames = (List<String>) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATH_DESTINATIONNAME); List<byte[]> fMEs = (List<byte[]>) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATH_MEID); byte[] fLos = (byte[]) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATHLOCALONLY); List<String> fBuses = (List<String>) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATH_BUSNAME); return new RoutingPathList(fNames, fLos, fMEs, fBuses); }
java
public final List<SIDestinationAddress> getReverseRoutingPath() { List<String> fNames = (List<String>) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATH_DESTINATIONNAME); List<byte[]> fMEs = (List<byte[]>) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATH_MEID); byte[] fLos = (byte[]) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATHLOCALONLY); List<String> fBuses = (List<String>) getHdr2().getField(JsHdr2Access.REVERSEROUTINGPATH_BUSNAME); return new RoutingPathList(fNames, fLos, fMEs, fBuses); }
[ "public", "final", "List", "<", "SIDestinationAddress", ">", "getReverseRoutingPath", "(", ")", "{", "List", "<", "String", ">", "fNames", "=", "(", "List", "<", "String", ">", ")", "getHdr2", "(", ")", ".", "getField", "(", "JsHdr2Access", ".", "REVERSERO...
/* Get the contents of the ReverseRoutingPath field from the message header The List returned is a copy of the header field, so no updates to it affect the Message header itself. Javadoc description supplied by SIBusMessage interface.
[ "/", "*", "Get", "the", "contents", "of", "the", "ReverseRoutingPath", "field", "from", "the", "message", "header", "The", "List", "returned", "is", "a", "copy", "of", "the", "header", "field", "so", "no", "updates", "to", "it", "affect", "the", "Message",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsHdrsImpl.java#L433-L439
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.queryParam
public HttpMessage queryParam(final String name, final String value) { if (!StringUtils.hasText(name)) { throw new CitrusRuntimeException("Invalid query param name - must not be empty!"); } this.addQueryParam(name, value); final String queryParamString = queryParams.entrySet() .stream() .map(this::outputQueryParam) .collect(Collectors.joining(",")); header(HttpMessageHeaders.HTTP_QUERY_PARAMS, queryParamString); header(DynamicEndpointUriResolver.QUERY_PARAM_HEADER_NAME, queryParamString); return this; }
java
public HttpMessage queryParam(final String name, final String value) { if (!StringUtils.hasText(name)) { throw new CitrusRuntimeException("Invalid query param name - must not be empty!"); } this.addQueryParam(name, value); final String queryParamString = queryParams.entrySet() .stream() .map(this::outputQueryParam) .collect(Collectors.joining(",")); header(HttpMessageHeaders.HTTP_QUERY_PARAMS, queryParamString); header(DynamicEndpointUriResolver.QUERY_PARAM_HEADER_NAME, queryParamString); return this; }
[ "public", "HttpMessage", "queryParam", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "name", ")", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Invalid query param n...
Sets a new Http request query param. @param name The name of the request query parameter @param value The value of the request query parameter @return The altered HttpMessage
[ "Sets", "a", "new", "Http", "request", "query", "param", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L243-L259
fuinorg/event-store-commons
eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java
ESHttpUtils.findNode
@Nullable public static Node findNode(@NotNull final Node rootNode, @NotNull final XPath xPath, @NotNull final String expression) { Contract.requireArgNotNull("rootNode", rootNode); Contract.requireArgNotNull("xPath", xPath); Contract.requireArgNotNull("expression", expression); try { return (Node) xPath.compile(expression).evaluate(rootNode, XPathConstants.NODE); } catch (final XPathExpressionException ex) { throw new RuntimeException("Failed to read node: " + expression, ex); } }
java
@Nullable public static Node findNode(@NotNull final Node rootNode, @NotNull final XPath xPath, @NotNull final String expression) { Contract.requireArgNotNull("rootNode", rootNode); Contract.requireArgNotNull("xPath", xPath); Contract.requireArgNotNull("expression", expression); try { return (Node) xPath.compile(expression).evaluate(rootNode, XPathConstants.NODE); } catch (final XPathExpressionException ex) { throw new RuntimeException("Failed to read node: " + expression, ex); } }
[ "@", "Nullable", "public", "static", "Node", "findNode", "(", "@", "NotNull", "final", "Node", "rootNode", ",", "@", "NotNull", "final", "XPath", "xPath", ",", "@", "NotNull", "final", "String", "expression", ")", "{", "Contract", ".", "requireArgNotNull", "...
Returns a single node from a given document using xpath. @param rootNode Node to search. @param xPath XPath to use. @param expression XPath expression. @return Node or <code>null</code> if no match was found.
[ "Returns", "a", "single", "node", "from", "a", "given", "document", "using", "xpath", "." ]
train
https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java#L105-L116
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java
AttributeValidator.validateOrderBy
private static void validateOrderBy(Attribute attr, Sort orderBy) { if (orderBy != null) { EntityType refEntity = attr.getRefEntity(); if (refEntity != null) { for (Sort.Order orderClause : orderBy) { String refAttrName = orderClause.getAttr(); if (refEntity.getAttribute(refAttrName) == null) { throw new MolgenisDataException( format( "Unknown entity [%s] attribute [%s] referred to by entity [%s] attribute [%s] sortBy [%s]", refEntity.getId(), refAttrName, attr.getEntityType().getId(), attr.getName(), orderBy.toSortString())); } } } } }
java
private static void validateOrderBy(Attribute attr, Sort orderBy) { if (orderBy != null) { EntityType refEntity = attr.getRefEntity(); if (refEntity != null) { for (Sort.Order orderClause : orderBy) { String refAttrName = orderClause.getAttr(); if (refEntity.getAttribute(refAttrName) == null) { throw new MolgenisDataException( format( "Unknown entity [%s] attribute [%s] referred to by entity [%s] attribute [%s] sortBy [%s]", refEntity.getId(), refAttrName, attr.getEntityType().getId(), attr.getName(), orderBy.toSortString())); } } } } }
[ "private", "static", "void", "validateOrderBy", "(", "Attribute", "attr", ",", "Sort", "orderBy", ")", "{", "if", "(", "orderBy", "!=", "null", ")", "{", "EntityType", "refEntity", "=", "attr", ".", "getRefEntity", "(", ")", ";", "if", "(", "refEntity", ...
Validate whether the attribute names defined by the orderBy attribute point to existing attributes in the referenced entity. @param attr attribute @param orderBy orderBy of attribute @throws MolgenisDataException if orderBy contains attribute names that do not exist in the referenced entity.
[ "Validate", "whether", "the", "attribute", "names", "defined", "by", "the", "orderBy", "attribute", "point", "to", "existing", "attributes", "in", "the", "referenced", "entity", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/AttributeValidator.java#L324-L343
GCRC/nunaliit
nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java
Searches.findHoverMedia
public JSONObject findHoverMedia(String place_id) throws Exception { String featuresTable = new String(getFeaturesTableName()); List<SelectedColumn> selectFields = new Vector<SelectedColumn>(); selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "hover_audio") ); PreparedStatement stmt = connection.prepareStatement("SELECT place_id,hover_audio FROM " + featuresTable + " WHERE place_id = ?;"); stmt.setInt(1, Integer.parseInt(place_id)); JSONArray array = executeStatementToJson(stmt, selectFields); JSONObject result = new JSONObject(); result.put("media", array); return result; }
java
public JSONObject findHoverMedia(String place_id) throws Exception { String featuresTable = new String(getFeaturesTableName()); List<SelectedColumn> selectFields = new Vector<SelectedColumn>(); selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") ); selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "hover_audio") ); PreparedStatement stmt = connection.prepareStatement("SELECT place_id,hover_audio FROM " + featuresTable + " WHERE place_id = ?;"); stmt.setInt(1, Integer.parseInt(place_id)); JSONArray array = executeStatementToJson(stmt, selectFields); JSONObject result = new JSONObject(); result.put("media", array); return result; }
[ "public", "JSONObject", "findHoverMedia", "(", "String", "place_id", ")", "throws", "Exception", "{", "String", "featuresTable", "=", "new", "String", "(", "getFeaturesTableName", "(", ")", ")", ";", "List", "<", "SelectedColumn", ">", "selectFields", "=", "new"...
Finds and returns the media to be played/displayed when a name is visited. This information is fetched from the contributions table, where the file use is marked as 'hover'. @param place_id Place id of visited feature @return @throws Exception
[ "Finds", "and", "returns", "the", "media", "to", "be", "played", "/", "displayed", "when", "a", "name", "is", "visited", ".", "This", "information", "is", "fetched", "from", "the", "contributions", "table", "where", "the", "file", "use", "is", "marked", "a...
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java#L584-L601
craterdog/java-primitive-types
src/main/java/craterdog/primitives/Probability.java
Probability.xor
static public Probability xor(Probability probability1, Probability probability2) { double p1 = probability1.value; double p2 = probability2.value; return new Probability(p1 * (1.0d - p2) + p2 * (1.0d - p1)); }
java
static public Probability xor(Probability probability1, Probability probability2) { double p1 = probability1.value; double p2 = probability2.value; return new Probability(p1 * (1.0d - p2) + p2 * (1.0d - p1)); }
[ "static", "public", "Probability", "xor", "(", "Probability", "probability1", ",", "Probability", "probability2", ")", "{", "double", "p1", "=", "probability1", ".", "value", ";", "double", "p2", "=", "probability2", ".", "value", ";", "return", "new", "Probab...
This function returns the logical exclusive disjunction of the specified probabilities. The value of the logical exclusive disjunction of two probabilities is sans(P, Q) + sans(Q, P). @param probability1 The first probability. @param probability2 The second probability. @return The logical exclusive disjunction of the two probabilities.
[ "This", "function", "returns", "the", "logical", "exclusive", "disjunction", "of", "the", "specified", "probabilities", ".", "The", "value", "of", "the", "logical", "exclusive", "disjunction", "of", "two", "probabilities", "is", "sans", "(", "P", "Q", ")", "+"...
train
https://github.com/craterdog/java-primitive-types/blob/730f9bceacfac69f99b094464a7da5747c07a59e/src/main/java/craterdog/primitives/Probability.java#L193-L197
groovyfx-project/groovyfx
src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java
FXBindableASTTransformation.createSetterStatement
protected Statement createSetterStatement(PropertyNode fxProperty) { String fxPropertyGetter = getFXPropertyGetterName(fxProperty); VariableExpression thisExpression = VariableExpression.THIS_EXPRESSION; ArgumentListExpression emptyArgs = ArgumentListExpression.EMPTY_ARGUMENTS; MethodCallExpression getProperty = new MethodCallExpression(thisExpression, fxPropertyGetter, emptyArgs); ArgumentListExpression valueArg = new ArgumentListExpression(new Expression[]{new VariableExpression("value")}); MethodCallExpression setValue = new MethodCallExpression(getProperty, "setValue", valueArg); return new ExpressionStatement(setValue); }
java
protected Statement createSetterStatement(PropertyNode fxProperty) { String fxPropertyGetter = getFXPropertyGetterName(fxProperty); VariableExpression thisExpression = VariableExpression.THIS_EXPRESSION; ArgumentListExpression emptyArgs = ArgumentListExpression.EMPTY_ARGUMENTS; MethodCallExpression getProperty = new MethodCallExpression(thisExpression, fxPropertyGetter, emptyArgs); ArgumentListExpression valueArg = new ArgumentListExpression(new Expression[]{new VariableExpression("value")}); MethodCallExpression setValue = new MethodCallExpression(getProperty, "setValue", valueArg); return new ExpressionStatement(setValue); }
[ "protected", "Statement", "createSetterStatement", "(", "PropertyNode", "fxProperty", ")", "{", "String", "fxPropertyGetter", "=", "getFXPropertyGetterName", "(", "fxProperty", ")", ";", "VariableExpression", "thisExpression", "=", "VariableExpression", ".", "THIS_EXPRESSIO...
Creates the body of a setter method for the original property that is actually backed by a JavaFX *Property instance: <p> Object $property = this.someProperty() $property.setValue(value) @param fxProperty The original Groovy property that we're creating a setter for. @return A Statement that is the body of the new setter.
[ "Creates", "the", "body", "of", "a", "setter", "method", "for", "the", "original", "property", "that", "is", "actually", "backed", "by", "a", "JavaFX", "*", "Property", "instance", ":", "<p", ">", "Object", "$property", "=", "this", ".", "someProperty", "(...
train
https://github.com/groovyfx-project/groovyfx/blob/7067d76793601ce4de9c642d4c0c0e11db7907cb/src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java#L598-L609
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.purgeJspRepository
public void purgeJspRepository() throws Exception { OpenCms.fireCmsEvent( new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, new HashMap<String, Object>())); }
java
public void purgeJspRepository() throws Exception { OpenCms.fireCmsEvent( new CmsEvent(I_CmsEventListener.EVENT_FLEX_PURGE_JSP_REPOSITORY, new HashMap<String, Object>())); }
[ "public", "void", "purgeJspRepository", "(", ")", "throws", "Exception", "{", "OpenCms", ".", "fireCmsEvent", "(", "new", "CmsEvent", "(", "I_CmsEventListener", ".", "EVENT_FLEX_PURGE_JSP_REPOSITORY", ",", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ...
Purges the jsp repository.<p> @throws Exception if something goes wrong @see org.opencms.flex.CmsFlexCache#cmsEvent(org.opencms.main.CmsEvent)
[ "Purges", "the", "jsp", "repository", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1175-L1179
alkacon/opencms-core
src/org/opencms/configuration/CmsParameterConfiguration.java
CmsParameterConfiguration.putAll
@Override public void putAll(Map<? extends String, ? extends String> other) { for (String key : other.keySet()) { boolean tokenize = false; if (other instanceof CmsParameterConfiguration) { Object o = ((CmsParameterConfiguration)other).getObject(key); if (o instanceof List) { tokenize = true; } } add(key, other.get(key), tokenize); } }
java
@Override public void putAll(Map<? extends String, ? extends String> other) { for (String key : other.keySet()) { boolean tokenize = false; if (other instanceof CmsParameterConfiguration) { Object o = ((CmsParameterConfiguration)other).getObject(key); if (o instanceof List) { tokenize = true; } } add(key, other.get(key), tokenize); } }
[ "@", "Override", "public", "void", "putAll", "(", "Map", "<", "?", "extends", "String", ",", "?", "extends", "String", ">", "other", ")", "{", "for", "(", "String", "key", ":", "other", ".", "keySet", "(", ")", ")", "{", "boolean", "tokenize", "=", ...
Merges this parameter configuration with the provided other parameter configuration.<p> The difference form a simple <code>Map&lt;String, String&gt;</code> is that for the parameter configuration, the values of the keys in both maps are merged and kept in the Object store as a List.<p> As result, <code>this</code> configuration will be altered, the other configuration will stay unchanged.<p> @param other the other parameter configuration to merge this configuration with
[ "Merges", "this", "parameter", "configuration", "with", "the", "provided", "other", "parameter", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L779-L792
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/property/CmsPropertySubmitHandler.java
CmsPropertySubmitHandler.checkContains
private boolean checkContains(String fieldName, String... propNames) { for (String propName : propNames) { if (fieldName.contains("/" + propName + "/")) { return true; } } return false; }
java
private boolean checkContains(String fieldName, String... propNames) { for (String propName : propNames) { if (fieldName.contains("/" + propName + "/")) { return true; } } return false; }
[ "private", "boolean", "checkContains", "(", "String", "fieldName", ",", "String", "...", "propNames", ")", "{", "for", "(", "String", "propName", ":", "propNames", ")", "{", "if", "(", "fieldName", ".", "contains", "(", "\"/\"", "+", "propName", "+", "\"/\...
Check if a field name belongs to one of a given list of properties.<p> @param fieldName the field name @param propNames the property names @return true if the field name matches one of the property names
[ "Check", "if", "a", "field", "name", "belongs", "to", "one", "of", "a", "given", "list", "of", "properties", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/property/CmsPropertySubmitHandler.java#L182-L190
gitblit/fathom
fathom-security/src/main/java/fathom/realm/Account.java
Account.checkRoles
public void checkRoles(Collection<String> roleIdentifiers) throws AuthorizationException { if (!hasRoles(roleIdentifiers)) { throw new AuthorizationException("'{}' does not have the roles {}", toString(), roleIdentifiers); } }
java
public void checkRoles(Collection<String> roleIdentifiers) throws AuthorizationException { if (!hasRoles(roleIdentifiers)) { throw new AuthorizationException("'{}' does not have the roles {}", toString(), roleIdentifiers); } }
[ "public", "void", "checkRoles", "(", "Collection", "<", "String", ">", "roleIdentifiers", ")", "throws", "AuthorizationException", "{", "if", "(", "!", "hasRoles", "(", "roleIdentifiers", ")", ")", "{", "throw", "new", "AuthorizationException", "(", "\"'{}' does n...
Asserts this Account has all of the specified roles by returning quietly if they do or throwing an {@link fathom.authz.AuthorizationException} if they do not. @param roleIdentifiers roleIdentifiers the application-specific role identifiers to check (usually role ids or role names). @throws AuthorizationException fathom.authz.AuthorizationException if this Account does not have all of the specified roles.
[ "Asserts", "this", "Account", "has", "all", "of", "the", "specified", "roles", "by", "returning", "quietly", "if", "they", "do", "or", "throwing", "an", "{", "@link", "fathom", ".", "authz", ".", "AuthorizationException", "}", "if", "they", "do", "not", "....
train
https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-security/src/main/java/fathom/realm/Account.java#L421-L425
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsModelPageTreeItem.java
CmsModelPageTreeItem.handleEdit
void handleEdit(CmsClientSitemapEntry editEntry, final String newTitle) { if (CmsStringUtil.isEmpty(newTitle)) { String dialogTitle = Messages.get().key(Messages.GUI_EDIT_TITLE_ERROR_DIALOG_TITLE_0); String dialogText = Messages.get().key(Messages.GUI_TITLE_CANT_BE_EMPTY_0); CmsAlertDialog alert = new CmsAlertDialog(dialogTitle, dialogText); alert.center(); return; } String oldTitle = editEntry.getPropertyValue(CmsClientProperty.PROPERTY_TITLE); if (!oldTitle.equals(newTitle)) { CmsPropertyModification propMod = new CmsPropertyModification( getEntryId(), CmsClientProperty.PROPERTY_TITLE, newTitle, true); final List<CmsPropertyModification> propChanges = new ArrayList<CmsPropertyModification>(); propChanges.add(propMod); CmsSitemapController controller = CmsSitemapView.getInstance().getController(); controller.edit(editEntry, propChanges, CmsReloadMode.reloadEntry); } }
java
void handleEdit(CmsClientSitemapEntry editEntry, final String newTitle) { if (CmsStringUtil.isEmpty(newTitle)) { String dialogTitle = Messages.get().key(Messages.GUI_EDIT_TITLE_ERROR_DIALOG_TITLE_0); String dialogText = Messages.get().key(Messages.GUI_TITLE_CANT_BE_EMPTY_0); CmsAlertDialog alert = new CmsAlertDialog(dialogTitle, dialogText); alert.center(); return; } String oldTitle = editEntry.getPropertyValue(CmsClientProperty.PROPERTY_TITLE); if (!oldTitle.equals(newTitle)) { CmsPropertyModification propMod = new CmsPropertyModification( getEntryId(), CmsClientProperty.PROPERTY_TITLE, newTitle, true); final List<CmsPropertyModification> propChanges = new ArrayList<CmsPropertyModification>(); propChanges.add(propMod); CmsSitemapController controller = CmsSitemapView.getInstance().getController(); controller.edit(editEntry, propChanges, CmsReloadMode.reloadEntry); } }
[ "void", "handleEdit", "(", "CmsClientSitemapEntry", "editEntry", ",", "final", "String", "newTitle", ")", "{", "if", "(", "CmsStringUtil", ".", "isEmpty", "(", "newTitle", ")", ")", "{", "String", "dialogTitle", "=", "Messages", ".", "get", "(", ")", ".", ...
Handles direct editing of the gallery title.<p> @param editEntry the edit entry @param newTitle the new title
[ "Handles", "direct", "editing", "of", "the", "gallery", "title", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsModelPageTreeItem.java#L219-L240
czyzby/gdx-lml
lml/src/main/java/com/github/czyzby/lml/util/LmlApplicationListener.java
LmlApplicationListener.createDtdSchema
protected void createDtdSchema(final LmlParser parser, final Appendable appendable) throws Exception { Dtd.saveSchema(parser, appendable); }
java
protected void createDtdSchema(final LmlParser parser, final Appendable appendable) throws Exception { Dtd.saveSchema(parser, appendable); }
[ "protected", "void", "createDtdSchema", "(", "final", "LmlParser", "parser", ",", "final", "Appendable", "appendable", ")", "throws", "Exception", "{", "Dtd", ".", "saveSchema", "(", "parser", ",", "appendable", ")", ";", "}" ]
This is a utility method that allows you to hook up into DTD generation process or even modify it completely. This method is called by {@link #saveDtdSchema(FileHandle)} after the parser was already set to non-strict. By default, this method calls standard DTD utility method: {@link Dtd#saveSchema(LmlParser, Appendable)}. By overriding this method, you can generate minified schema with {@link Dtd#saveMinifiedSchema(LmlParser, Appendable)} or manually append some customized tags and attributes using {@link Appendable} API. <p> If you want to generate DTD schema file for your LML parser, use {@link #saveDtdSchema(FileHandle)} method instead. @param parser its schema will be generated. @param appendable a reference to target file. @see #saveDtdSchema(FileHandle) @throws Exception if your saving method throws any exception, it will wrapped with {@link GdxRuntimeException} and rethrown.
[ "This", "is", "a", "utility", "method", "that", "allows", "you", "to", "hook", "up", "into", "DTD", "generation", "process", "or", "even", "modify", "it", "completely", ".", "This", "method", "is", "called", "by", "{", "@link", "#saveDtdSchema", "(", "File...
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/util/LmlApplicationListener.java#L154-L156
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java
ModelConstraints.checkReferenceForeignkeys
private void checkReferenceForeignkeys(ModelDef modelDef, String checkLevel) throws ConstraintException { if (CHECKLEVEL_NONE.equals(checkLevel)) { return; } ClassDescriptorDef classDef; ReferenceDescriptorDef refDef; for (Iterator it = modelDef.getClasses(); it.hasNext();) { classDef = (ClassDescriptorDef)it.next(); for (Iterator refIt = classDef.getReferences(); refIt.hasNext();) { refDef = (ReferenceDescriptorDef)refIt.next(); if (!refDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false)) { checkReferenceForeignkeys(modelDef, refDef); } } } }
java
private void checkReferenceForeignkeys(ModelDef modelDef, String checkLevel) throws ConstraintException { if (CHECKLEVEL_NONE.equals(checkLevel)) { return; } ClassDescriptorDef classDef; ReferenceDescriptorDef refDef; for (Iterator it = modelDef.getClasses(); it.hasNext();) { classDef = (ClassDescriptorDef)it.next(); for (Iterator refIt = classDef.getReferences(); refIt.hasNext();) { refDef = (ReferenceDescriptorDef)refIt.next(); if (!refDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false)) { checkReferenceForeignkeys(modelDef, refDef); } } } }
[ "private", "void", "checkReferenceForeignkeys", "(", "ModelDef", "modelDef", ",", "String", "checkLevel", ")", "throws", "ConstraintException", "{", "if", "(", "CHECKLEVEL_NONE", ".", "equals", "(", "checkLevel", ")", ")", "{", "return", ";", "}", "ClassDescriptor...
Checks the foreignkeys of all references in the model. @param modelDef The model @param checkLevel The current check level (this constraint is checked in basic and strict) @exception ConstraintException If the value for foreignkey is invalid
[ "Checks", "the", "foreignkeys", "of", "all", "references", "in", "the", "model", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java#L600-L622
apache/groovy
src/main/java/org/codehaus/groovy/runtime/powerassert/AssertionRenderer.java
AssertionRenderer.render
public static String render(String text, ValueRecorder recorder) { return new AssertionRenderer(text, recorder).render(); }
java
public static String render(String text, ValueRecorder recorder) { return new AssertionRenderer(text, recorder).render(); }
[ "public", "static", "String", "render", "(", "String", "text", ",", "ValueRecorder", "recorder", ")", "{", "return", "new", "AssertionRenderer", "(", "text", ",", "recorder", ")", ".", "render", "(", ")", ";", "}" ]
Creates a string representation of an assertion and its recorded values. @param text the assertion's source text @param recorder a recorder holding the values recorded during evaluation of the assertion @return a string representation of the assertion and its recorded values
[ "Creates", "a", "string", "representation", "of", "an", "assertion", "and", "its", "recorded", "values", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/powerassert/AssertionRenderer.java#L54-L56
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Constraints.java
Constraints.toEntityPredicate
public <E> Predicate<E> toEntityPredicate(StorageKey key, EntityAccessor<E> accessor) { if (key != null) { Map<String, Predicate> predicates = minimizeFor(key); if (predicates.isEmpty()) { return alwaysTrue(); } return entityPredicate(predicates, schema, accessor, strategy); } return toEntityPredicate(accessor); }
java
public <E> Predicate<E> toEntityPredicate(StorageKey key, EntityAccessor<E> accessor) { if (key != null) { Map<String, Predicate> predicates = minimizeFor(key); if (predicates.isEmpty()) { return alwaysTrue(); } return entityPredicate(predicates, schema, accessor, strategy); } return toEntityPredicate(accessor); }
[ "public", "<", "E", ">", "Predicate", "<", "E", ">", "toEntityPredicate", "(", "StorageKey", "key", ",", "EntityAccessor", "<", "E", ">", "accessor", ")", "{", "if", "(", "key", "!=", "null", ")", "{", "Map", "<", "String", ",", "Predicate", ">", "pr...
Get a {@link Predicate} for testing entity objects that match the given {@link StorageKey}. @param <E> The type of entities to be matched @param key a StorageKey for entities tested with the Predicate @return a Predicate to test if entity objects satisfy this constraint set
[ "Get", "a", "{", "@link", "Predicate", "}", "for", "testing", "entity", "objects", "that", "match", "the", "given", "{", "@link", "StorageKey", "}", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/Constraints.java#L128-L137
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.deleteSubscription
public PubsubFuture<Void> deleteSubscription(final String canonicalSubscriptionName) { validateCanonicalSubscription(canonicalSubscriptionName); return delete("delete subscription", canonicalSubscriptionName, VOID); }
java
public PubsubFuture<Void> deleteSubscription(final String canonicalSubscriptionName) { validateCanonicalSubscription(canonicalSubscriptionName); return delete("delete subscription", canonicalSubscriptionName, VOID); }
[ "public", "PubsubFuture", "<", "Void", ">", "deleteSubscription", "(", "final", "String", "canonicalSubscriptionName", ")", "{", "validateCanonicalSubscription", "(", "canonicalSubscriptionName", ")", ";", "return", "delete", "(", "\"delete subscription\"", ",", "canonica...
Delete a Pub/Sub subscription. @param canonicalSubscriptionName The canonical (including project) name of the subscription to delete. @return A future that is completed when this request is completed. The future will be completed with {@code null} if the response is 404.
[ "Delete", "a", "Pub", "/", "Sub", "subscription", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L468-L471
theHilikus/JRoboCom
jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java
BoardPanel.moveItem
public void moveItem(Point oldCoordinates, Point newCoordinates) { assertEDT(); if (oldCoordinates == null || newCoordinates == null) { throw new IllegalArgumentException("Coordinates cannot be null"); } if (getPanelAt(newCoordinates).hasModel()) { throw new IllegalStateException( "New position contains a model in the UI already. New position = " + newCoordinates); } if (!getPanelAt(oldCoordinates).hasModel()) { throw new IllegalStateException("Old position doesn't contain a model in the UI. Old position = " + oldCoordinates); } // all good Drawable item = getPanelAt(oldCoordinates).getModel(); removeItem(oldCoordinates); addItem(newCoordinates, item); }
java
public void moveItem(Point oldCoordinates, Point newCoordinates) { assertEDT(); if (oldCoordinates == null || newCoordinates == null) { throw new IllegalArgumentException("Coordinates cannot be null"); } if (getPanelAt(newCoordinates).hasModel()) { throw new IllegalStateException( "New position contains a model in the UI already. New position = " + newCoordinates); } if (!getPanelAt(oldCoordinates).hasModel()) { throw new IllegalStateException("Old position doesn't contain a model in the UI. Old position = " + oldCoordinates); } // all good Drawable item = getPanelAt(oldCoordinates).getModel(); removeItem(oldCoordinates); addItem(newCoordinates, item); }
[ "public", "void", "moveItem", "(", "Point", "oldCoordinates", ",", "Point", "newCoordinates", ")", "{", "assertEDT", "(", ")", ";", "if", "(", "oldCoordinates", "==", "null", "||", "newCoordinates", "==", "null", ")", "{", "throw", "new", "IllegalArgumentExcep...
Changes the position of the item in the specified location @param oldCoordinates position of the item to move @param newCoordinates position to move the item to
[ "Changes", "the", "position", "of", "the", "item", "in", "the", "specified", "location" ]
train
https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-simple-gui/src/main/java/com/github/thehilikus/jrobocom/gui/panels/BoardPanel.java#L102-L120
aol/cyclops
cyclops/src/main/java/cyclops/companion/Functions.java
Functions.filterLongs
public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> filterLongs(DoublePredicate b){ return a->a.doubles(i->i,s->s.filter(b)); }
java
public static Function<? super ReactiveSeq<Double>, ? extends ReactiveSeq<Double>> filterLongs(DoublePredicate b){ return a->a.doubles(i->i,s->s.filter(b)); }
[ "public", "static", "Function", "<", "?", "super", "ReactiveSeq", "<", "Double", ">", ",", "?", "extends", "ReactiveSeq", "<", "Double", ">", ">", "filterLongs", "(", "DoublePredicate", "b", ")", "{", "return", "a", "->", "a", ".", "doubles", "(", "i", ...
/* Fluent filter operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.filterDoubles; ReactiveSeq.ofDoubles(1d,2d,3d) .to(filterDoubles(i->i>2)); //[3d] } </pre>
[ "/", "*", "Fluent", "filter", "operation", "using", "primitive", "types", "e", ".", "g", ".", "<pre", ">", "{", "@code", "import", "static", "cyclops", ".", "ReactiveSeq", ".", "filterDoubles", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L518-L521
CodeNarc/CodeNarc
src/main/java/org/codenarc/util/AstUtil.java
AstUtil.isMethodCall
public static boolean isMethodCall(Expression expression, String methodObjectPattern, String methodNamePattern) { return isMethodCallOnObject(expression, methodObjectPattern) && isMethodNamed((MethodCallExpression) expression, methodNamePattern); }
java
public static boolean isMethodCall(Expression expression, String methodObjectPattern, String methodNamePattern) { return isMethodCallOnObject(expression, methodObjectPattern) && isMethodNamed((MethodCallExpression) expression, methodNamePattern); }
[ "public", "static", "boolean", "isMethodCall", "(", "Expression", "expression", ",", "String", "methodObjectPattern", ",", "String", "methodNamePattern", ")", "{", "return", "isMethodCallOnObject", "(", "expression", ",", "methodObjectPattern", ")", "&&", "isMethodNamed...
Return true only if the expression represents a method call (MethodCallExpression) for the specified method object (receiver) and method name. @param expression - the AST expression to be checked @param methodObjectPattern - the name of the method object (receiver) @param methodNamePattern - the name of the method being called @return true only if the expression is a method call that matches the specified criteria
[ "Return", "true", "only", "if", "the", "expression", "represents", "a", "method", "call", "(", "MethodCallExpression", ")", "for", "the", "specified", "method", "object", "(", "receiver", ")", "and", "method", "name", "." ]
train
https://github.com/CodeNarc/CodeNarc/blob/9a7cec02cb8cbaf845030f2434309e8968f5d7a7/src/main/java/org/codenarc/util/AstUtil.java#L337-L339
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java
SpiderTransaction.deleteScalarValueColumn
public void deleteScalarValueColumn(TableDefinition tableDef, String objID, String fieldName) { deleteColumn(SpiderService.objectsStoreName(tableDef), objID, fieldName); }
java
public void deleteScalarValueColumn(TableDefinition tableDef, String objID, String fieldName) { deleteColumn(SpiderService.objectsStoreName(tableDef), objID, fieldName); }
[ "public", "void", "deleteScalarValueColumn", "(", "TableDefinition", "tableDef", ",", "String", "objID", ",", "String", "fieldName", ")", "{", "deleteColumn", "(", "SpiderService", ".", "objectsStoreName", "(", "tableDef", ")", ",", "objID", ",", "fieldName", ")",...
Delete a scalar value column with the given field name for the given object ID from the given table. @param tableDef {@link TableDefinition} of scalar field. @param objID ID of object. @param fieldName Scalar field name.
[ "Delete", "a", "scalar", "value", "column", "with", "the", "given", "field", "name", "for", "the", "given", "object", "ID", "from", "the", "given", "table", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L408-L410
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.feedForward
public Map<String, INDArray> feedForward(INDArray[] input, int layerTillIndex,boolean train) { setInputs(input); return feedForward(train, layerTillIndex); }
java
public Map<String, INDArray> feedForward(INDArray[] input, int layerTillIndex,boolean train) { setInputs(input); return feedForward(train, layerTillIndex); }
[ "public", "Map", "<", "String", ",", "INDArray", ">", "feedForward", "(", "INDArray", "[", "]", "input", ",", "int", "layerTillIndex", ",", "boolean", "train", ")", "{", "setInputs", "(", "input", ")", ";", "return", "feedForward", "(", "train", ",", "la...
Conduct forward pass using an array of inputs @param input An array of ComputationGraph inputs @param layerTillIndex the index of the layer to feed forward to @param train If true: do forward pass at training time; false: do forward pass at test time @return A map of activations for each layer (not each GraphVertex). Keys = layer name, values = layer activations
[ "Conduct", "forward", "pass", "using", "an", "array", "of", "inputs" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L1481-L1484
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.torsionAngle
public static final double torsionAngle(Atom a, Atom b, Atom c, Atom d) { Atom ab = subtract(a,b); Atom cb = subtract(c,b); Atom bc = subtract(b,c); Atom dc = subtract(d,c); Atom abc = vectorProduct(ab,cb); Atom bcd = vectorProduct(bc,dc); double angl = angle(abc,bcd) ; /* calc the sign: */ Atom vecprod = vectorProduct(abc,bcd); double val = scalarProduct(cb,vecprod); if (val < 0.0) angl = -angl; return angl; }
java
public static final double torsionAngle(Atom a, Atom b, Atom c, Atom d) { Atom ab = subtract(a,b); Atom cb = subtract(c,b); Atom bc = subtract(b,c); Atom dc = subtract(d,c); Atom abc = vectorProduct(ab,cb); Atom bcd = vectorProduct(bc,dc); double angl = angle(abc,bcd) ; /* calc the sign: */ Atom vecprod = vectorProduct(abc,bcd); double val = scalarProduct(cb,vecprod); if (val < 0.0) angl = -angl; return angl; }
[ "public", "static", "final", "double", "torsionAngle", "(", "Atom", "a", ",", "Atom", "b", ",", "Atom", "c", ",", "Atom", "d", ")", "{", "Atom", "ab", "=", "subtract", "(", "a", ",", "b", ")", ";", "Atom", "cb", "=", "subtract", "(", "c", ",", ...
Calculate the torsion angle, i.e. the angle between the normal vectors of the two plains a-b-c and b-c-d. See http://en.wikipedia.org/wiki/Dihedral_angle @param a an Atom object @param b an Atom object @param c an Atom object @param d an Atom object @return the torsion angle in degrees, in range +-[0,180]. If either first 3 or last 3 atoms are colinear then torsion angle is not defined and NaN is returned
[ "Calculate", "the", "torsion", "angle", "i", ".", "e", ".", "the", "angle", "between", "the", "normal", "vectors", "of", "the", "two", "plains", "a", "-", "b", "-", "c", "and", "b", "-", "c", "-", "d", ".", "See", "http", ":", "//", "en", ".", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L242-L261
EXIficient/exificient-grammars
src/main/java/com/siemens/ct/exi/grammars/regex/Match.java
Match.getCapturedText
public String getCapturedText(int index) { if (this.beginpos == null) throw new IllegalStateException("match() has never been called."); if (index < 0 || this.nofgroups <= index) throw new IllegalArgumentException( "The parameter must be less than " + this.nofgroups + ": " + index); String ret; int begin = this.beginpos[index], end = this.endpos[index]; if (begin < 0 || end < 0) return null; if (this.ciSource != null) { ret = REUtil.substring(this.ciSource, begin, end); } else if (this.strSource != null) { ret = this.strSource.substring(begin, end); } else { ret = new String(this.charSource, begin, end - begin); } return ret; }
java
public String getCapturedText(int index) { if (this.beginpos == null) throw new IllegalStateException("match() has never been called."); if (index < 0 || this.nofgroups <= index) throw new IllegalArgumentException( "The parameter must be less than " + this.nofgroups + ": " + index); String ret; int begin = this.beginpos[index], end = this.endpos[index]; if (begin < 0 || end < 0) return null; if (this.ciSource != null) { ret = REUtil.substring(this.ciSource, begin, end); } else if (this.strSource != null) { ret = this.strSource.substring(begin, end); } else { ret = new String(this.charSource, begin, end - begin); } return ret; }
[ "public", "String", "getCapturedText", "(", "int", "index", ")", "{", "if", "(", "this", ".", "beginpos", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "\"match() has never been called.\"", ")", ";", "if", "(", "index", "<", "0", "||", "th...
Return an substring of the target text matched to specified regular expression group. @param index Less than <code>getNumberOfGroups()</code>.
[ "Return", "an", "substring", "of", "the", "target", "text", "matched", "to", "specified", "regular", "expression", "group", "." ]
train
https://github.com/EXIficient/exificient-grammars/blob/d96477062ebdd4245920e44cc1995259699fc7fb/src/main/java/com/siemens/ct/exi/grammars/regex/Match.java#L179-L198
prestodb/presto
presto-orc/src/main/java/com/facebook/presto/orc/DiskRange.java
DiskRange.span
public DiskRange span(DiskRange otherDiskRange) { requireNonNull(otherDiskRange, "otherDiskRange is null"); long start = Math.min(this.offset, otherDiskRange.getOffset()); long end = Math.max(getEnd(), otherDiskRange.getEnd()); return new DiskRange(start, toIntExact(end - start)); }
java
public DiskRange span(DiskRange otherDiskRange) { requireNonNull(otherDiskRange, "otherDiskRange is null"); long start = Math.min(this.offset, otherDiskRange.getOffset()); long end = Math.max(getEnd(), otherDiskRange.getEnd()); return new DiskRange(start, toIntExact(end - start)); }
[ "public", "DiskRange", "span", "(", "DiskRange", "otherDiskRange", ")", "{", "requireNonNull", "(", "otherDiskRange", ",", "\"otherDiskRange is null\"", ")", ";", "long", "start", "=", "Math", ".", "min", "(", "this", ".", "offset", ",", "otherDiskRange", ".", ...
Returns the minimal DiskRange that encloses both this DiskRange and otherDiskRange. If there was a gap between the ranges the new range will cover that gap.
[ "Returns", "the", "minimal", "DiskRange", "that", "encloses", "both", "this", "DiskRange", "and", "otherDiskRange", ".", "If", "there", "was", "a", "gap", "between", "the", "ranges", "the", "new", "range", "will", "cover", "that", "gap", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-orc/src/main/java/com/facebook/presto/orc/DiskRange.java#L62-L68
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java
ToXMLStream.getXMLVersion
private String getXMLVersion() { String xmlVersion = getVersion(); if(xmlVersion == null || xmlVersion.equals(XMLVERSION10)) { xmlVersion = XMLVERSION10; } else if(xmlVersion.equals(XMLVERSION11)) { xmlVersion = XMLVERSION11; } else { String msg = Utils.messages.createMessage( MsgKey.ER_XML_VERSION_NOT_SUPPORTED,new Object[]{ xmlVersion }); try { // Prepare to issue the warning message Transformer tran = super.getTransformer(); ErrorListener errHandler = tran.getErrorListener(); // Issue the warning message if (null != errHandler && m_sourceLocator != null) errHandler.warning(new TransformerException(msg, m_sourceLocator)); else System.out.println(msg); } catch (Exception e){} xmlVersion = XMLVERSION10; } return xmlVersion; }
java
private String getXMLVersion() { String xmlVersion = getVersion(); if(xmlVersion == null || xmlVersion.equals(XMLVERSION10)) { xmlVersion = XMLVERSION10; } else if(xmlVersion.equals(XMLVERSION11)) { xmlVersion = XMLVERSION11; } else { String msg = Utils.messages.createMessage( MsgKey.ER_XML_VERSION_NOT_SUPPORTED,new Object[]{ xmlVersion }); try { // Prepare to issue the warning message Transformer tran = super.getTransformer(); ErrorListener errHandler = tran.getErrorListener(); // Issue the warning message if (null != errHandler && m_sourceLocator != null) errHandler.warning(new TransformerException(msg, m_sourceLocator)); else System.out.println(msg); } catch (Exception e){} xmlVersion = XMLVERSION10; } return xmlVersion; }
[ "private", "String", "getXMLVersion", "(", ")", "{", "String", "xmlVersion", "=", "getVersion", "(", ")", ";", "if", "(", "xmlVersion", "==", "null", "||", "xmlVersion", ".", "equals", "(", "XMLVERSION10", ")", ")", "{", "xmlVersion", "=", "XMLVERSION10", ...
This method checks for the XML version of output document. If XML version of output document is not specified, then output document is of version XML 1.0. If XML version of output doucment is specified, but it is not either XML 1.0 or XML 1.1, a warning message is generated, the XML Version of output document is set to XML 1.0 and processing continues. @return string (XML version)
[ "This", "method", "checks", "for", "the", "XML", "version", "of", "output", "document", ".", "If", "XML", "version", "of", "output", "document", "is", "not", "specified", "then", "output", "document", "is", "of", "version", "XML", "1", ".", "0", ".", "If...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L615-L645
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.getElementsByAttributeValueContaining
public Elements getElementsByAttributeValueContaining(String key, String match) { return Collector.collect(new Evaluator.AttributeWithValueContaining(key, match), this); }
java
public Elements getElementsByAttributeValueContaining(String key, String match) { return Collector.collect(new Evaluator.AttributeWithValueContaining(key, match), this); }
[ "public", "Elements", "getElementsByAttributeValueContaining", "(", "String", "key", ",", "String", "match", ")", "{", "return", "Collector", ".", "collect", "(", "new", "Evaluator", ".", "AttributeWithValueContaining", "(", "key", ",", "match", ")", ",", "this", ...
Find elements that have attributes whose value contains the match string. Case insensitive. @param key name of the attribute @param match substring of value to search for @return elements that have attributes containing this text
[ "Find", "elements", "that", "have", "attributes", "whose", "value", "contains", "the", "match", "string", ".", "Case", "insensitive", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L907-L909
box/box-java-sdk
src/main/java/com/box/sdk/BoxWebHook.java
BoxWebHook.validateTriggers
public static void validateTriggers(String targetType, Collection<BoxWebHook.Trigger> triggers) { for (BoxWebHook.Trigger trigger : triggers) { validateTrigger(targetType, trigger); } }
java
public static void validateTriggers(String targetType, Collection<BoxWebHook.Trigger> triggers) { for (BoxWebHook.Trigger trigger : triggers) { validateTrigger(targetType, trigger); } }
[ "public", "static", "void", "validateTriggers", "(", "String", "targetType", ",", "Collection", "<", "BoxWebHook", ".", "Trigger", ">", "triggers", ")", "{", "for", "(", "BoxWebHook", ".", "Trigger", "trigger", ":", "triggers", ")", "{", "validateTrigger", "("...
Validates that provided {@link BoxWebHook.Trigger}-s can be applied on the provided {@link BoxResourceType}. @param targetType on which target the triggers should be applied to @param triggers for check @see #validateTrigger(String, Trigger)
[ "Validates", "that", "provided", "{", "@link", "BoxWebHook", ".", "Trigger", "}", "-", "s", "can", "be", "applied", "on", "the", "provided", "{", "@link", "BoxResourceType", "}", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxWebHook.java#L234-L238
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java
ConfigValidator.checkCacheConfig
public static void checkCacheConfig(CacheConfig cacheConfig, CacheMergePolicyProvider mergePolicyProvider) { checkCacheConfig(cacheConfig.getInMemoryFormat(), cacheConfig.getEvictionConfig(), cacheConfig.getMergePolicy(), cacheConfig, mergePolicyProvider); }
java
public static void checkCacheConfig(CacheConfig cacheConfig, CacheMergePolicyProvider mergePolicyProvider) { checkCacheConfig(cacheConfig.getInMemoryFormat(), cacheConfig.getEvictionConfig(), cacheConfig.getMergePolicy(), cacheConfig, mergePolicyProvider); }
[ "public", "static", "void", "checkCacheConfig", "(", "CacheConfig", "cacheConfig", ",", "CacheMergePolicyProvider", "mergePolicyProvider", ")", "{", "checkCacheConfig", "(", "cacheConfig", ".", "getInMemoryFormat", "(", ")", ",", "cacheConfig", ".", "getEvictionConfig", ...
Validates the given {@link CacheConfig}. @param cacheConfig the {@link CacheConfig} to check @param mergePolicyProvider the {@link CacheMergePolicyProvider} to resolve merge policy classes
[ "Validates", "the", "given", "{", "@link", "CacheConfig", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L330-L333
deeplearning4j/deeplearning4j
datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java
ArrowConverter.toArrowColumnsStringSingle
public static List<FieldVector> toArrowColumnsStringSingle(final BufferAllocator bufferAllocator, final Schema schema, List<String> dataVecRecord) { return toArrowColumnsString(bufferAllocator,schema, Arrays.asList(dataVecRecord)); }
java
public static List<FieldVector> toArrowColumnsStringSingle(final BufferAllocator bufferAllocator, final Schema schema, List<String> dataVecRecord) { return toArrowColumnsString(bufferAllocator,schema, Arrays.asList(dataVecRecord)); }
[ "public", "static", "List", "<", "FieldVector", ">", "toArrowColumnsStringSingle", "(", "final", "BufferAllocator", "bufferAllocator", ",", "final", "Schema", "schema", ",", "List", "<", "String", ">", "dataVecRecord", ")", "{", "return", "toArrowColumnsString", "("...
Convert a set of input strings to arrow columns @param bufferAllocator the buffer allocator to use @param schema the schema to use @param dataVecRecord the collection of input strings to process @return the created vectors
[ "Convert", "a", "set", "of", "input", "strings", "to", "arrow", "columns" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L663-L665
google/closure-compiler
src/com/google/javascript/jscomp/PureFunctionIdentifier.java
FunctionBodyAnalyzer.checkIteratesImpureIterable
private void checkIteratesImpureIterable(Node node, AmbiguatedFunctionSummary encloserSummary) { if (!NodeUtil.iteratesImpureIterable(node)) { return; } // Treat the (possibly implicit) call to `iterator.next()` as having the same effects as any // other unknown function call. encloserSummary.setFunctionThrows(); encloserSummary.setMutatesGlobalState(); // The iterable may be stateful and a param. encloserSummary.setMutatesArguments(); }
java
private void checkIteratesImpureIterable(Node node, AmbiguatedFunctionSummary encloserSummary) { if (!NodeUtil.iteratesImpureIterable(node)) { return; } // Treat the (possibly implicit) call to `iterator.next()` as having the same effects as any // other unknown function call. encloserSummary.setFunctionThrows(); encloserSummary.setMutatesGlobalState(); // The iterable may be stateful and a param. encloserSummary.setMutatesArguments(); }
[ "private", "void", "checkIteratesImpureIterable", "(", "Node", "node", ",", "AmbiguatedFunctionSummary", "encloserSummary", ")", "{", "if", "(", "!", "NodeUtil", ".", "iteratesImpureIterable", "(", "node", ")", ")", "{", "return", ";", "}", "// Treat the (possibly i...
Inspect {@code node} for impure iteration and assign the appropriate side-effects to {@code encloserSummary} if so.
[ "Inspect", "{" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PureFunctionIdentifier.java#L826-L838
infinispan/infinispan
jcache/embedded/src/main/java/org/infinispan/jcache/annotation/CacheLookupHelper.java
CacheLookupHelper.getCacheName
public static String getCacheName(Method method, String methodCacheName, CacheDefaults cacheDefaultsAnnotation, boolean generate) { assertNotNull(method, "method parameter must not be null"); assertNotNull(methodCacheName, "methodCacheName parameter must not be null"); String cacheName = methodCacheName.trim(); if (cacheName.isEmpty() && cacheDefaultsAnnotation != null) { cacheName = cacheDefaultsAnnotation.cacheName().trim(); } if (cacheName.isEmpty() && generate) { cacheName = getDefaultMethodCacheName(method); } return cacheName; }
java
public static String getCacheName(Method method, String methodCacheName, CacheDefaults cacheDefaultsAnnotation, boolean generate) { assertNotNull(method, "method parameter must not be null"); assertNotNull(methodCacheName, "methodCacheName parameter must not be null"); String cacheName = methodCacheName.trim(); if (cacheName.isEmpty() && cacheDefaultsAnnotation != null) { cacheName = cacheDefaultsAnnotation.cacheName().trim(); } if (cacheName.isEmpty() && generate) { cacheName = getDefaultMethodCacheName(method); } return cacheName; }
[ "public", "static", "String", "getCacheName", "(", "Method", "method", ",", "String", "methodCacheName", ",", "CacheDefaults", "cacheDefaultsAnnotation", ",", "boolean", "generate", ")", "{", "assertNotNull", "(", "method", ",", "\"method parameter must not be null\"", ...
Resolves the cache name of a method annotated with a JCACHE annotation. @param method the annotated method. @param methodCacheName the cache name defined on the JCACHE annotation. @param cacheDefaultsAnnotation the {@link javax.cache.annotation.CacheDefaults} annotation instance. @param generate {@code true} if the default cache name has to be returned if none is specified. @return the resolved cache name. @throws NullPointerException if method or methodCacheName parameter is {@code null}.
[ "Resolves", "the", "cache", "name", "of", "a", "method", "annotated", "with", "a", "JCACHE", "annotation", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/jcache/embedded/src/main/java/org/infinispan/jcache/annotation/CacheLookupHelper.java#L42-L57
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.registerGooglePush
@ObjectiveCName("registerGooglePushWithProjectId:withToken:") public void registerGooglePush(long projectId, String token) { modules.getPushesModule().registerGooglePush(projectId, token); }
java
@ObjectiveCName("registerGooglePushWithProjectId:withToken:") public void registerGooglePush(long projectId, String token) { modules.getPushesModule().registerGooglePush(projectId, token); }
[ "@", "ObjectiveCName", "(", "\"registerGooglePushWithProjectId:withToken:\"", ")", "public", "void", "registerGooglePush", "(", "long", "projectId", ",", "String", "token", ")", "{", "modules", ".", "getPushesModule", "(", ")", ".", "registerGooglePush", "(", "project...
Register google push @param projectId GCM project id @param token GCM token
[ "Register", "google", "push" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2677-L2680
aws/aws-sdk-java
aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/UpdateInputSecurityGroupRequest.java
UpdateInputSecurityGroupRequest.withTags
public UpdateInputSecurityGroupRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public UpdateInputSecurityGroupRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "UpdateInputSecurityGroupRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
A collection of key-value pairs. @param tags A collection of key-value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "collection", "of", "key", "-", "value", "pairs", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/UpdateInputSecurityGroupRequest.java#L100-L103
alkacon/opencms-core
src/org/opencms/gwt/CmsCoreService.java
CmsCoreService.getVaadinWorkplaceLink
public static String getVaadinWorkplaceLink(CmsObject cms, String resourceRootFolder) { CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(resourceRootFolder); String siteRoot = site != null ? site.getSiteRoot() : OpenCms.getSiteManager().startsWithShared(resourceRootFolder) ? OpenCms.getSiteManager().getSharedFolder() : ""; String sitePath = resourceRootFolder.substring(siteRoot.length()); String link = getFileExplorerLink(cms, siteRoot) + sitePath; return link; }
java
public static String getVaadinWorkplaceLink(CmsObject cms, String resourceRootFolder) { CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(resourceRootFolder); String siteRoot = site != null ? site.getSiteRoot() : OpenCms.getSiteManager().startsWithShared(resourceRootFolder) ? OpenCms.getSiteManager().getSharedFolder() : ""; String sitePath = resourceRootFolder.substring(siteRoot.length()); String link = getFileExplorerLink(cms, siteRoot) + sitePath; return link; }
[ "public", "static", "String", "getVaadinWorkplaceLink", "(", "CmsObject", "cms", ",", "String", "resourceRootFolder", ")", "{", "CmsSite", "site", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getSiteForRootPath", "(", "resourceRootFolder", ")", ";", "Str...
Returns the workplace link.<p> @param cms the cms context @param resourceRootFolder the resource folder root path @return the workplace link
[ "Returns", "the", "workplace", "link", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsCoreService.java#L479-L490
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/aggregation/Histogram.java
Histogram.asVisual
public HistogramVisual asVisual() { float[] visualCounts = new float[bins.length - 2]; for (int i = 0; i < visualCounts.length; ++i) { visualCounts[i] = (float) bins[i + 1]; } return new HistogramVisual(breaks, visualCounts, new float[]{min, max}); }
java
public HistogramVisual asVisual() { float[] visualCounts = new float[bins.length - 2]; for (int i = 0; i < visualCounts.length; ++i) { visualCounts[i] = (float) bins[i + 1]; } return new HistogramVisual(breaks, visualCounts, new float[]{min, max}); }
[ "public", "HistogramVisual", "asVisual", "(", ")", "{", "float", "[", "]", "visualCounts", "=", "new", "float", "[", "bins", ".", "length", "-", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "visualCounts", ".", "length", ";", "++...
Returns a visual representation of a histogram object. Initially returns an array of just the min. and max. values but can also support the addition of quantiles. @return a visual representation of this histogram
[ "Returns", "a", "visual", "representation", "of", "a", "histogram", "object", ".", "Initially", "returns", "an", "array", "of", "just", "the", "min", ".", "and", "max", ".", "values", "but", "can", "also", "support", "the", "addition", "of", "quantiles", "...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/aggregation/Histogram.java#L181-L188
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java
BioAssemblyTools.getBiologicalMoleculeMaximumExtend
public static double getBiologicalMoleculeMaximumExtend( final Structure structure,List<BiologicalAssemblyTransformation> transformations ) { double[][] bounds = getBiologicalMoleculeBounds(structure, transformations); double xMax = Math.abs(bounds[0][0] - bounds[1][0]); double yMax = Math.abs(bounds[0][1] - bounds[1][1]); double zMax = Math.abs(bounds[0][2] - bounds[1][2]); return Math.max(xMax, Math.max(yMax, zMax)); }
java
public static double getBiologicalMoleculeMaximumExtend( final Structure structure,List<BiologicalAssemblyTransformation> transformations ) { double[][] bounds = getBiologicalMoleculeBounds(structure, transformations); double xMax = Math.abs(bounds[0][0] - bounds[1][0]); double yMax = Math.abs(bounds[0][1] - bounds[1][1]); double zMax = Math.abs(bounds[0][2] - bounds[1][2]); return Math.max(xMax, Math.max(yMax, zMax)); }
[ "public", "static", "double", "getBiologicalMoleculeMaximumExtend", "(", "final", "Structure", "structure", ",", "List", "<", "BiologicalAssemblyTransformation", ">", "transformations", ")", "{", "double", "[", "]", "[", "]", "bounds", "=", "getBiologicalMoleculeBounds"...
Returns the maximum extend of the biological molecule in the x, y, or z direction. @param structure @return maximum extend
[ "Returns", "the", "maximum", "extend", "of", "the", "biological", "molecule", "in", "the", "x", "y", "or", "z", "direction", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java#L255-L261
grpc/grpc-java
stub/src/main/java/io/grpc/stub/ClientCalls.java
ClientCalls.asyncClientStreamingCall
public static <ReqT, RespT> StreamObserver<ReqT> asyncClientStreamingCall( ClientCall<ReqT, RespT> call, StreamObserver<RespT> responseObserver) { return asyncStreamingRequestCall(call, responseObserver, false); }
java
public static <ReqT, RespT> StreamObserver<ReqT> asyncClientStreamingCall( ClientCall<ReqT, RespT> call, StreamObserver<RespT> responseObserver) { return asyncStreamingRequestCall(call, responseObserver, false); }
[ "public", "static", "<", "ReqT", ",", "RespT", ">", "StreamObserver", "<", "ReqT", ">", "asyncClientStreamingCall", "(", "ClientCall", "<", "ReqT", ",", "RespT", ">", "call", ",", "StreamObserver", "<", "RespT", ">", "responseObserver", ")", "{", "return", "...
Executes a client-streaming call returning a {@link StreamObserver} for the request messages. The {@code call} should not be already started. After calling this method, {@code call} should no longer be used. @return request stream observer.
[ "Executes", "a", "client", "-", "streaming", "call", "returning", "a", "{", "@link", "StreamObserver", "}", "for", "the", "request", "messages", ".", "The", "{", "@code", "call", "}", "should", "not", "be", "already", "started", ".", "After", "calling", "t...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/stub/src/main/java/io/grpc/stub/ClientCalls.java#L84-L88
app55/app55-java
src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java
DefaultPersistenceDelegate.getPropertyValue
private Object getPropertyValue(HashMap<String, PropertyDescriptor> proDscMap, Object oldInstance, String propName) throws Exception { // Try to get the read method for the property Method getter = null; if (null != proDscMap) { PropertyDescriptor pd = proDscMap.get(Introspector.decapitalize(propName)); if (null != pd) { getter = pd.getReadMethod(); } } // Invoke read method to get the value if found if (null != getter) { return getter.invoke(oldInstance, (Object[]) null); } // Otherwise, try to access the field directly try { return getFieldValue(oldInstance, propName); } catch (Exception ex) { // Fail, throw an exception throw new NoSuchMethodException("The getter method for the property " //$NON-NLS-1$ + propName + " can't be found."); //$NON-NLS-1$ } }
java
private Object getPropertyValue(HashMap<String, PropertyDescriptor> proDscMap, Object oldInstance, String propName) throws Exception { // Try to get the read method for the property Method getter = null; if (null != proDscMap) { PropertyDescriptor pd = proDscMap.get(Introspector.decapitalize(propName)); if (null != pd) { getter = pd.getReadMethod(); } } // Invoke read method to get the value if found if (null != getter) { return getter.invoke(oldInstance, (Object[]) null); } // Otherwise, try to access the field directly try { return getFieldValue(oldInstance, propName); } catch (Exception ex) { // Fail, throw an exception throw new NoSuchMethodException("The getter method for the property " //$NON-NLS-1$ + propName + " can't be found."); //$NON-NLS-1$ } }
[ "private", "Object", "getPropertyValue", "(", "HashMap", "<", "String", ",", "PropertyDescriptor", ">", "proDscMap", ",", "Object", "oldInstance", ",", "String", "propName", ")", "throws", "Exception", "{", "// Try to get the read method for the property", "Method", "ge...
/* Get the value for the specified property of the given bean instance.
[ "/", "*", "Get", "the", "value", "for", "the", "specified", "property", "of", "the", "given", "bean", "instance", "." ]
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java#L171-L201
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/util/zookeeper/ClientNode.java
ClientNode.calculateAllNodesResult
public ClientsResult calculateAllNodesResult() { final List<String> childNodePaths = getChildren(electionRootPath, false); _logger.info("Total peers = {} ", childNodePaths.size()); Collections.sort(childNodePaths); int index = childNodePaths.indexOf(clientNodePath.substring(clientNodePath.lastIndexOf('/') + 1)); return new ClientsResult(index, childNodePaths.size()); }
java
public ClientsResult calculateAllNodesResult() { final List<String> childNodePaths = getChildren(electionRootPath, false); _logger.info("Total peers = {} ", childNodePaths.size()); Collections.sort(childNodePaths); int index = childNodePaths.indexOf(clientNodePath.substring(clientNodePath.lastIndexOf('/') + 1)); return new ClientsResult(index, childNodePaths.size()); }
[ "public", "ClientsResult", "calculateAllNodesResult", "(", ")", "{", "final", "List", "<", "String", ">", "childNodePaths", "=", "getChildren", "(", "electionRootPath", ",", "false", ")", ";", "_logger", ".", "info", "(", "\"Total peers = {} \"", ",", "childNodePa...
Gets node index and its peer count @return ClientsResult object with info
[ "Gets", "node", "index", "and", "its", "peer", "count" ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/util/zookeeper/ClientNode.java#L124-L131
michel-kraemer/gradle-download-task
src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java
DownloadAction.streamAndMove
private void streamAndMove(InputStream is, File destFile) throws IOException { if (!tempAndMove) { stream(is, destFile); } else { //create parent directory downloadTaskDir.mkdirs(); //create name of temporary file File tempFile = File.createTempFile(destFile.getName(), ".part", this.downloadTaskDir); //stream and move stream(is, tempFile); if (destFile.exists()) { //Delete destFile if it exists before renaming tempFile. //Otherwise renaming might fail. if (!destFile.delete()) { throw new IOException("Could not delete old destination file '" + destFile.getAbsolutePath() + "'."); } } if (!tempFile.renameTo(destFile)) { throw new IOException("Failed to move temporary file '" + tempFile.getAbsolutePath() + "' to destination file '" + destFile.getAbsolutePath() + "'."); } } }
java
private void streamAndMove(InputStream is, File destFile) throws IOException { if (!tempAndMove) { stream(is, destFile); } else { //create parent directory downloadTaskDir.mkdirs(); //create name of temporary file File tempFile = File.createTempFile(destFile.getName(), ".part", this.downloadTaskDir); //stream and move stream(is, tempFile); if (destFile.exists()) { //Delete destFile if it exists before renaming tempFile. //Otherwise renaming might fail. if (!destFile.delete()) { throw new IOException("Could not delete old destination file '" + destFile.getAbsolutePath() + "'."); } } if (!tempFile.renameTo(destFile)) { throw new IOException("Failed to move temporary file '" + tempFile.getAbsolutePath() + "' to destination file '" + destFile.getAbsolutePath() + "'."); } } }
[ "private", "void", "streamAndMove", "(", "InputStream", "is", ",", "File", "destFile", ")", "throws", "IOException", "{", "if", "(", "!", "tempAndMove", ")", "{", "stream", "(", "is", ",", "destFile", ")", ";", "}", "else", "{", "//create parent directory", ...
If {@link #tempAndMove} is <code>true</code>, copy bytes from an input stream to a temporary file and log progress. Upon successful completion, move the temporary file to the given destination. If {@link #tempAndMove} is <code>false</code>, just forward to {@link #stream(InputStream, File)}. @param is the input stream to read @param destFile the destination file @throws IOException if an I/O error occurs
[ "If", "{" ]
train
https://github.com/michel-kraemer/gradle-download-task/blob/a20c7f29c15ccb699700518f860373692148e3fc/src/main/java/de/undercouch/gradle/tasks/download/DownloadAction.java#L328-L355
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/DfPattern.java
DfPattern.matchRoot
Mappings matchRoot(IAtom root) { checkCompatibleAPI(root); IAtomContainer mol = root.getContainer(); if (query.getAtomCount() > 0 && ((IQueryAtom) query.getAtom(0)).matches(root)) { DfState local = new DfState(state); local.setRoot(root); return filter(new Mappings(query, mol, local), query, mol); } else { return new Mappings(query, mol, Collections.<int[]>emptySet()); } }
java
Mappings matchRoot(IAtom root) { checkCompatibleAPI(root); IAtomContainer mol = root.getContainer(); if (query.getAtomCount() > 0 && ((IQueryAtom) query.getAtom(0)).matches(root)) { DfState local = new DfState(state); local.setRoot(root); return filter(new Mappings(query, mol, local), query, mol); } else { return new Mappings(query, mol, Collections.<int[]>emptySet()); } }
[ "Mappings", "matchRoot", "(", "IAtom", "root", ")", "{", "checkCompatibleAPI", "(", "root", ")", ";", "IAtomContainer", "mol", "=", "root", ".", "getContainer", "(", ")", ";", "if", "(", "query", ".", "getAtomCount", "(", ")", ">", "0", "&&", "(", "(",...
Match the pattern at the provided root. @param root the root atom of the molecule @return mappings @see Mappings
[ "Match", "the", "pattern", "at", "the", "provided", "root", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/DfPattern.java#L141-L151
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerTableOverride
@Deprecated public String registerTableOverride(String oldTable, String newTable) { return internalNameMapping.registerTableOverride(oldTable, newTable); }
java
@Deprecated public String registerTableOverride(String oldTable, String newTable) { return internalNameMapping.registerTableOverride(oldTable, newTable); }
[ "@", "Deprecated", "public", "String", "registerTableOverride", "(", "String", "oldTable", ",", "String", "newTable", ")", "{", "return", "internalNameMapping", ".", "registerTableOverride", "(", "oldTable", ",", "newTable", ")", ";", "}" ]
Register a table override @param oldTable table to override @param newTable override @return previous override value @deprecated Use {@link #setDynamicNameMapping(NameMapping)} instead.
[ "Register", "a", "table", "override" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L336-L339
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java
DatatypeConverter.parseUUID
public static final UUID parseUUID(String value) { UUID result = null; if (value != null && !value.isEmpty()) { if (value.charAt(0) == '{') { // PMXML representation: <GUID>{0AB9133E-A09A-9648-B98A-B2384894AC44}</GUID> result = UUID.fromString(value.substring(1, value.length() - 1)); } else { // XER representation: CrkTPqCalki5irI4SJSsRA byte[] data = javax.xml.bind.DatatypeConverter.parseBase64Binary(value + "=="); long msb = 0; long lsb = 0; for (int i = 0; i < 8; i++) { msb = (msb << 8) | (data[i] & 0xff); } for (int i = 8; i < 16; i++) { lsb = (lsb << 8) | (data[i] & 0xff); } result = new UUID(msb, lsb); } } return result; }
java
public static final UUID parseUUID(String value) { UUID result = null; if (value != null && !value.isEmpty()) { if (value.charAt(0) == '{') { // PMXML representation: <GUID>{0AB9133E-A09A-9648-B98A-B2384894AC44}</GUID> result = UUID.fromString(value.substring(1, value.length() - 1)); } else { // XER representation: CrkTPqCalki5irI4SJSsRA byte[] data = javax.xml.bind.DatatypeConverter.parseBase64Binary(value + "=="); long msb = 0; long lsb = 0; for (int i = 0; i < 8; i++) { msb = (msb << 8) | (data[i] & 0xff); } for (int i = 8; i < 16; i++) { lsb = (lsb << 8) | (data[i] & 0xff); } result = new UUID(msb, lsb); } } return result; }
[ "public", "static", "final", "UUID", "parseUUID", "(", "String", "value", ")", "{", "UUID", "result", "=", "null", ";", "if", "(", "value", "!=", "null", "&&", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "value", ".", "charAt", "("...
Convert the Primavera string representation of a UUID into a Java UUID instance. @param value Primavera UUID @return Java UUID instance
[ "Convert", "the", "Primavera", "string", "representation", "of", "a", "UUID", "into", "a", "Java", "UUID", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java#L44-L75
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassScrollBarUI.java
SeaGlassScrollBarUI.getPreferredSize
public Dimension getPreferredSize(JComponent c) { Insets insets = c.getInsets(); return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth + insets.left + insets.right, 48) : new Dimension(48, scrollBarWidth + insets.top + insets.bottom); }
java
public Dimension getPreferredSize(JComponent c) { Insets insets = c.getInsets(); return (scrollbar.getOrientation() == JScrollBar.VERTICAL) ? new Dimension(scrollBarWidth + insets.left + insets.right, 48) : new Dimension(48, scrollBarWidth + insets.top + insets.bottom); }
[ "public", "Dimension", "getPreferredSize", "(", "JComponent", "c", ")", "{", "Insets", "insets", "=", "c", ".", "getInsets", "(", ")", ";", "return", "(", "scrollbar", ".", "getOrientation", "(", ")", "==", "JScrollBar", ".", "VERTICAL", ")", "?", "new", ...
A vertical scrollbar's preferred width is the maximum of preferred widths of the (non <code>null</code>) increment/decrement buttons, and the minimum width of the thumb. The preferred height is the sum of the preferred heights of the same parts. The basis for the preferred size of a horizontal scrollbar is similar. <p> The <code>preferredSize</code> is only computed once, subsequent calls to this method just return a cached size. @param c the <code>JScrollBar</code> that's delegating this method to us @return the preferred size of a Basic JScrollBar @see #getMaximumSize @see #getMinimumSize
[ "A", "vertical", "scrollbar", "s", "preferred", "width", "is", "the", "maximum", "of", "preferred", "widths", "of", "the", "(", "non", "<code", ">", "null<", "/", "code", ">", ")", "increment", "/", "decrement", "buttons", "and", "the", "minimum", "width",...
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassScrollBarUI.java#L351-L355
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Streams.java
Streams.copyWriterCount
public static int copyWriterCount(final Reader in, final Writer out) throws IOException { final char[] buffer = new char[10240]; int tot=0; int c; c = in.read(buffer); while (c >= 0) { if (c > 0) { out.write(buffer, 0, c); tot += c; } c = in.read(buffer); } return tot; }
java
public static int copyWriterCount(final Reader in, final Writer out) throws IOException { final char[] buffer = new char[10240]; int tot=0; int c; c = in.read(buffer); while (c >= 0) { if (c > 0) { out.write(buffer, 0, c); tot += c; } c = in.read(buffer); } return tot; }
[ "public", "static", "int", "copyWriterCount", "(", "final", "Reader", "in", ",", "final", "Writer", "out", ")", "throws", "IOException", "{", "final", "char", "[", "]", "buffer", "=", "new", "char", "[", "10240", "]", ";", "int", "tot", "=", "0", ";", ...
Read the data from the reader and copy to the writer. @param in inputstream @param out outpustream @return number of bytes copied @throws java.io.IOException if thrown by underlying io operations
[ "Read", "the", "data", "from", "the", "reader", "and", "copy", "to", "the", "writer", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Streams.java#L83-L96
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java
WriterUtils.getWriterStagingDir
public static Path getWriterStagingDir(State state, int numBranches, int branchId) { String writerStagingDirKey = ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_STAGING_DIR, numBranches, branchId); Preconditions.checkArgument(state.contains(writerStagingDirKey), "Missing required property " + writerStagingDirKey); return new Path( state.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_STAGING_DIR, numBranches, branchId)), WriterUtils.getWriterFilePath(state, numBranches, branchId)); }
java
public static Path getWriterStagingDir(State state, int numBranches, int branchId) { String writerStagingDirKey = ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_STAGING_DIR, numBranches, branchId); Preconditions.checkArgument(state.contains(writerStagingDirKey), "Missing required property " + writerStagingDirKey); return new Path( state.getProp( ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_STAGING_DIR, numBranches, branchId)), WriterUtils.getWriterFilePath(state, numBranches, branchId)); }
[ "public", "static", "Path", "getWriterStagingDir", "(", "State", "state", ",", "int", "numBranches", ",", "int", "branchId", ")", "{", "String", "writerStagingDirKey", "=", "ForkOperatorUtils", ".", "getPropertyNameForBranch", "(", "ConfigurationKeys", ".", "WRITER_ST...
Get the {@link Path} corresponding the to the directory a given {@link org.apache.gobblin.writer.DataWriter} should be writing its staging data. The staging data directory is determined by combining the {@link ConfigurationKeys#WRITER_STAGING_DIR} and the {@link ConfigurationKeys#WRITER_FILE_PATH}. @param state is the {@link State} corresponding to a specific {@link org.apache.gobblin.writer.DataWriter}. @param numBranches is the total number of branches for the given {@link State}. @param branchId is the id for the specific branch that the {@link org.apache.gobblin.writer.DataWriter} will write to. @return a {@link Path} specifying the directory where the {@link org.apache.gobblin.writer.DataWriter} will write to.
[ "Get", "the", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/WriterUtils.java#L82-L92
jayantk/jklol
src/com/jayantkrish/jklol/ccg/lambda2/StaticAnalysis.java
StaticAnalysis.getFreeVariable
private static String getFreeVariable(Expression2 expression, int index, Scope scope) { Expression2 sub = expression.getSubexpression(index); if (sub.isConstant()) { String constant = sub.getConstant(); if (!constant.equals(LAMBDA) && !scope.isBound(constant)) { return sub.getConstant(); } } return null; }
java
private static String getFreeVariable(Expression2 expression, int index, Scope scope) { Expression2 sub = expression.getSubexpression(index); if (sub.isConstant()) { String constant = sub.getConstant(); if (!constant.equals(LAMBDA) && !scope.isBound(constant)) { return sub.getConstant(); } } return null; }
[ "private", "static", "String", "getFreeVariable", "(", "Expression2", "expression", ",", "int", "index", ",", "Scope", "scope", ")", "{", "Expression2", "sub", "=", "expression", ".", "getSubexpression", "(", "index", ")", ";", "if", "(", "sub", ".", "isCons...
If {@code index} points to a free variable in {@code expression}, return its name. Otherwise, returns null. @param expression @param index @param scope @return
[ "If", "{", "@code", "index", "}", "points", "to", "a", "free", "variable", "in", "{", "@code", "expression", "}", "return", "its", "name", ".", "Otherwise", "returns", "null", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lambda2/StaticAnalysis.java#L63-L72
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/Criteria.java
Criteria.addNotEqualTo
public void addNotEqualTo(Object attribute, Object value) { // PAW // addSelectionCriteria(ValueCriteria.buildNotEqualToCriteria(attribute, value, getAlias())); addSelectionCriteria(ValueCriteria.buildNotEqualToCriteria(attribute, value, getUserAlias(attribute))); }
java
public void addNotEqualTo(Object attribute, Object value) { // PAW // addSelectionCriteria(ValueCriteria.buildNotEqualToCriteria(attribute, value, getAlias())); addSelectionCriteria(ValueCriteria.buildNotEqualToCriteria(attribute, value, getUserAlias(attribute))); }
[ "public", "void", "addNotEqualTo", "(", "Object", "attribute", ",", "Object", "value", ")", "{", "// PAW\r", "// addSelectionCriteria(ValueCriteria.buildNotEqualToCriteria(attribute, value, getAlias()));\r", "addSelectionCriteria", "(", "ValueCriteria", ".", "buildNotEqualToCriteri...
Adds NotEqualTo (<>) criteria, customer_id <> 10034 @param attribute The field name to be used @param value An object representing the value of the field
[ "Adds", "NotEqualTo", "(", "<", ">", ")", "criteria", "customer_id", "<", ">", "10034" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L493-L498
h2oai/h2o-3
h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcParserProvider.java
OrcParserProvider.createParserSetup
@Override public ParseSetup createParserSetup(Key[] inputs, ParseSetup requiredSetup) { FileVec f; Object frameOrVec = DKV.getGet(inputs[0]); if (frameOrVec instanceof water.fvec.Frame) f = (FileVec) ((Frame) frameOrVec).vec(0); else f = (FileVec) frameOrVec; return readSetup(f, requiredSetup.getColumnNames(), requiredSetup.getColumnTypes()); }
java
@Override public ParseSetup createParserSetup(Key[] inputs, ParseSetup requiredSetup) { FileVec f; Object frameOrVec = DKV.getGet(inputs[0]); if (frameOrVec instanceof water.fvec.Frame) f = (FileVec) ((Frame) frameOrVec).vec(0); else f = (FileVec) frameOrVec; return readSetup(f, requiredSetup.getColumnNames(), requiredSetup.getColumnTypes()); }
[ "@", "Override", "public", "ParseSetup", "createParserSetup", "(", "Key", "[", "]", "inputs", ",", "ParseSetup", "requiredSetup", ")", "{", "FileVec", "f", ";", "Object", "frameOrVec", "=", "DKV", ".", "getGet", "(", "inputs", "[", "0", "]", ")", ";", "i...
Use only the first file to setup everything. @param inputs input keys @param requiredSetup user given parser setup @return
[ "Use", "only", "the", "first", "file", "to", "setup", "everything", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-parsers/h2o-orc-parser/src/main/java/water/parser/orc/OrcParserProvider.java#L68-L79
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java
JobCredentialsInner.getAsync
public Observable<JobCredentialInner> getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1<ServiceResponse<JobCredentialInner>, JobCredentialInner>() { @Override public JobCredentialInner call(ServiceResponse<JobCredentialInner> response) { return response.body(); } }); }
java
public Observable<JobCredentialInner> getAsync(String resourceGroupName, String serverName, String jobAgentName, String credentialName) { return getWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, credentialName).map(new Func1<ServiceResponse<JobCredentialInner>, JobCredentialInner>() { @Override public JobCredentialInner call(ServiceResponse<JobCredentialInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobCredentialInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "jobAgentName", ",", "String", "credentialName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupNam...
Gets a jobs credential. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param jobAgentName The name of the job agent. @param credentialName The name of the credential. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobCredentialInner object
[ "Gets", "a", "jobs", "credential", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobCredentialsInner.java#L258-L265
centic9/commons-dost
src/main/java/org/dstadler/commons/graphviz/DotUtils.java
DotUtils.renderGraph
public static void renderGraph(File dotfile, File resultfile) throws IOException { // call graphviz-dot via commons-exec CommandLine cmdLine = new CommandLine(DOT_EXE); cmdLine.addArgument("-T" + StringUtils.substringAfterLast(resultfile.getAbsolutePath(), ".")); cmdLine.addArgument(dotfile.getAbsolutePath()); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(0); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); try { try (FileOutputStream out2 = new FileOutputStream(resultfile)) { executor.setStreamHandler(new PumpStreamHandler(out2, System.err)); int exitValue = executor.execute(cmdLine); if(exitValue != 0) { throw new IOException("Could not convert graph to dot, had exit value: " + exitValue + "!"); } } } catch (IOException e) { // if something went wrong the file should not be left behind... if(!resultfile.delete()) { System.out.println("Could not delete file " + resultfile); } throw e; } }
java
public static void renderGraph(File dotfile, File resultfile) throws IOException { // call graphviz-dot via commons-exec CommandLine cmdLine = new CommandLine(DOT_EXE); cmdLine.addArgument("-T" + StringUtils.substringAfterLast(resultfile.getAbsolutePath(), ".")); cmdLine.addArgument(dotfile.getAbsolutePath()); DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(0); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); try { try (FileOutputStream out2 = new FileOutputStream(resultfile)) { executor.setStreamHandler(new PumpStreamHandler(out2, System.err)); int exitValue = executor.execute(cmdLine); if(exitValue != 0) { throw new IOException("Could not convert graph to dot, had exit value: " + exitValue + "!"); } } } catch (IOException e) { // if something went wrong the file should not be left behind... if(!resultfile.delete()) { System.out.println("Could not delete file " + resultfile); } throw e; } }
[ "public", "static", "void", "renderGraph", "(", "File", "dotfile", ",", "File", "resultfile", ")", "throws", "IOException", "{", "// call graphviz-dot via commons-exec", "CommandLine", "cmdLine", "=", "new", "CommandLine", "(", "DOT_EXE", ")", ";", "cmdLine", ".", ...
Call graphviz-dot to convert the .dot-file to a rendered graph. The file extension of the specified result file is being used as the filetype of the rendering. @param dotfile The dot {@code File} used for the graph generation @param resultfile The {@code File} to which should be written @throws IOException if writing the resulting graph fails or other I/O problems occur
[ "Call", "graphviz", "-", "dot", "to", "convert", "the", ".", "dot", "-", "file", "to", "a", "rendered", "graph", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/graphviz/DotUtils.java#L109-L134
xwiki/xwiki-rendering
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/XHTMLParser.java
XHTMLParser.getPushBackReader
private Reader getPushBackReader(Reader source) throws ParseException { PushbackReader pushbackReader = new PushbackReader(source); int c; try { c = pushbackReader.read(); if (c == -1) { return null; } pushbackReader.unread(c); } catch (IOException e) { throw new ParseException("Failed to find out if the source to parse is empty or not", e); } return pushbackReader; }
java
private Reader getPushBackReader(Reader source) throws ParseException { PushbackReader pushbackReader = new PushbackReader(source); int c; try { c = pushbackReader.read(); if (c == -1) { return null; } pushbackReader.unread(c); } catch (IOException e) { throw new ParseException("Failed to find out if the source to parse is empty or not", e); } return pushbackReader; }
[ "private", "Reader", "getPushBackReader", "(", "Reader", "source", ")", "throws", "ParseException", "{", "PushbackReader", "pushbackReader", "=", "new", "PushbackReader", "(", "source", ")", ";", "int", "c", ";", "try", "{", "c", "=", "pushbackReader", ".", "r...
In order to handle empty content we use a {@link PushbackReader} to try to read one character from the stream and if we get -1 it means that the stream is empty and in this case we return an empty XDOM.
[ "In", "order", "to", "handle", "empty", "content", "we", "use", "a", "{" ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/XHTMLParser.java#L225-L239
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java
ServletUtil.fillBean
public static <T> T fillBean(ServletRequest request, T bean, boolean isIgnoreError) { return fillBean(request, bean, CopyOptions.create().setIgnoreError(isIgnoreError)); }
java
public static <T> T fillBean(ServletRequest request, T bean, boolean isIgnoreError) { return fillBean(request, bean, CopyOptions.create().setIgnoreError(isIgnoreError)); }
[ "public", "static", "<", "T", ">", "T", "fillBean", "(", "ServletRequest", "request", ",", "T", "bean", ",", "boolean", "isIgnoreError", ")", "{", "return", "fillBean", "(", "request", ",", "bean", ",", "CopyOptions", ".", "create", "(", ")", ".", "setIg...
ServletRequest 参数转Bean @param <T> Bean类型 @param request {@link ServletRequest} @param bean Bean @param isIgnoreError 是否忽略注入错误 @return Bean
[ "ServletRequest", "参数转Bean" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L159-L161