repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
gotev/android-upload-service
uploadservice/src/main/java/net/gotev/uploadservice/UploadTask.java
UploadTask.broadcastProgress
protected final void broadcastProgress(final long uploadedBytes, final long totalBytes) { """ Broadcasts a progress update. @param uploadedBytes number of bytes which has been uploaded to the server @param totalBytes total bytes of the request """ long currentTime = System.currentTimeMillis(); if (uploadedBytes < totalBytes && currentTime < lastProgressNotificationTime + UploadService.PROGRESS_REPORT_INTERVAL) { return; } setLastProgressNotificationTime(currentTime); Logger.debug(LOG_TAG, "Broadcasting upload progress for " + params.id + ": " + uploadedBytes + " bytes of " + totalBytes); final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes, totalBytes, (attempts - 1), successfullyUploadedFiles, pathStringListFrom(params.files)); BroadcastData data = new BroadcastData() .setStatus(BroadcastData.Status.IN_PROGRESS) .setUploadInfo(uploadInfo); final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id); if (delegate != null) { mainThreadHandler.post(new Runnable() { @Override public void run() { delegate.onProgress(service, uploadInfo); } }); } else { service.sendBroadcast(data.getIntent()); } updateNotificationProgress(uploadInfo); }
java
protected final void broadcastProgress(final long uploadedBytes, final long totalBytes) { long currentTime = System.currentTimeMillis(); if (uploadedBytes < totalBytes && currentTime < lastProgressNotificationTime + UploadService.PROGRESS_REPORT_INTERVAL) { return; } setLastProgressNotificationTime(currentTime); Logger.debug(LOG_TAG, "Broadcasting upload progress for " + params.id + ": " + uploadedBytes + " bytes of " + totalBytes); final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes, totalBytes, (attempts - 1), successfullyUploadedFiles, pathStringListFrom(params.files)); BroadcastData data = new BroadcastData() .setStatus(BroadcastData.Status.IN_PROGRESS) .setUploadInfo(uploadInfo); final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id); if (delegate != null) { mainThreadHandler.post(new Runnable() { @Override public void run() { delegate.onProgress(service, uploadInfo); } }); } else { service.sendBroadcast(data.getIntent()); } updateNotificationProgress(uploadInfo); }
[ "protected", "final", "void", "broadcastProgress", "(", "final", "long", "uploadedBytes", ",", "final", "long", "totalBytes", ")", "{", "long", "currentTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "if", "(", "uploadedBytes", "<", "totalBytes", "&&", "currentTime", "<", "lastProgressNotificationTime", "+", "UploadService", ".", "PROGRESS_REPORT_INTERVAL", ")", "{", "return", ";", "}", "setLastProgressNotificationTime", "(", "currentTime", ")", ";", "Logger", ".", "debug", "(", "LOG_TAG", ",", "\"Broadcasting upload progress for \"", "+", "params", ".", "id", "+", "\": \"", "+", "uploadedBytes", "+", "\" bytes of \"", "+", "totalBytes", ")", ";", "final", "UploadInfo", "uploadInfo", "=", "new", "UploadInfo", "(", "params", ".", "id", ",", "startTime", ",", "uploadedBytes", ",", "totalBytes", ",", "(", "attempts", "-", "1", ")", ",", "successfullyUploadedFiles", ",", "pathStringListFrom", "(", "params", ".", "files", ")", ")", ";", "BroadcastData", "data", "=", "new", "BroadcastData", "(", ")", ".", "setStatus", "(", "BroadcastData", ".", "Status", ".", "IN_PROGRESS", ")", ".", "setUploadInfo", "(", "uploadInfo", ")", ";", "final", "UploadStatusDelegate", "delegate", "=", "UploadService", ".", "getUploadStatusDelegate", "(", "params", ".", "id", ")", ";", "if", "(", "delegate", "!=", "null", ")", "{", "mainThreadHandler", ".", "post", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "delegate", ".", "onProgress", "(", "service", ",", "uploadInfo", ")", ";", "}", "}", ")", ";", "}", "else", "{", "service", ".", "sendBroadcast", "(", "data", ".", "getIntent", "(", ")", ")", ";", "}", "updateNotificationProgress", "(", "uploadInfo", ")", ";", "}" ]
Broadcasts a progress update. @param uploadedBytes number of bytes which has been uploaded to the server @param totalBytes total bytes of the request
[ "Broadcasts", "a", "progress", "update", "." ]
train
https://github.com/gotev/android-upload-service/blob/0952fcbe4b32c100150ffd0a237de3be4942e0a8/uploadservice/src/main/java/net/gotev/uploadservice/UploadTask.java#L228-L262
nispok/snackbar
lib/src/main/java/com/nispok/snackbar/Snackbar.java
Snackbar.attachToAbsListView
public Snackbar attachToAbsListView(AbsListView absListView) { """ Attaches this {@link Snackbar} to an AbsListView (ListView, GridView, ExpandableListView) so it dismisses when the list is scrolled @param absListView @return """ absListView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { dismiss(); } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); return this; }
java
public Snackbar attachToAbsListView(AbsListView absListView) { absListView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { dismiss(); } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } }); return this; }
[ "public", "Snackbar", "attachToAbsListView", "(", "AbsListView", "absListView", ")", "{", "absListView", ".", "setOnScrollListener", "(", "new", "AbsListView", ".", "OnScrollListener", "(", ")", "{", "@", "Override", "public", "void", "onScrollStateChanged", "(", "AbsListView", "view", ",", "int", "scrollState", ")", "{", "dismiss", "(", ")", ";", "}", "@", "Override", "public", "void", "onScroll", "(", "AbsListView", "view", ",", "int", "firstVisibleItem", ",", "int", "visibleItemCount", ",", "int", "totalItemCount", ")", "{", "}", "}", ")", ";", "return", "this", ";", "}" ]
Attaches this {@link Snackbar} to an AbsListView (ListView, GridView, ExpandableListView) so it dismisses when the list is scrolled @param absListView @return
[ "Attaches", "this", "{", "@link", "Snackbar", "}", "to", "an", "AbsListView", "(", "ListView", "GridView", "ExpandableListView", ")", "so", "it", "dismisses", "when", "the", "list", "is", "scrolled" ]
train
https://github.com/nispok/snackbar/blob/a4e0449874423031107f6aaa7e97d0f1714a1d3b/lib/src/main/java/com/nispok/snackbar/Snackbar.java#L504-L518
spring-projects/spring-ldap
core/src/main/java/org/springframework/ldap/control/AbstractFallbackRequestAndResponseControlDirContextProcessor.java
AbstractFallbackRequestAndResponseControlDirContextProcessor.createRequestControl
public Control createRequestControl(Class<?>[] paramTypes, Object[] params) { """ Creates a request control using the constructor parameters given in <code>params</code>. @param paramTypes Types of the constructor parameters @param params Actual constructor parameters @return Control to be used by the DirContextProcessor """ Constructor<?> constructor = ClassUtils.getConstructorIfAvailable(requestControlClass, paramTypes); if (constructor == null) { throw new IllegalArgumentException("Failed to find an appropriate RequestControl constructor"); } Control result = null; try { result = (Control) constructor.newInstance(params); } catch (Exception e) { ReflectionUtils.handleReflectionException(e); } return result; }
java
public Control createRequestControl(Class<?>[] paramTypes, Object[] params) { Constructor<?> constructor = ClassUtils.getConstructorIfAvailable(requestControlClass, paramTypes); if (constructor == null) { throw new IllegalArgumentException("Failed to find an appropriate RequestControl constructor"); } Control result = null; try { result = (Control) constructor.newInstance(params); } catch (Exception e) { ReflectionUtils.handleReflectionException(e); } return result; }
[ "public", "Control", "createRequestControl", "(", "Class", "<", "?", ">", "[", "]", "paramTypes", ",", "Object", "[", "]", "params", ")", "{", "Constructor", "<", "?", ">", "constructor", "=", "ClassUtils", ".", "getConstructorIfAvailable", "(", "requestControlClass", ",", "paramTypes", ")", ";", "if", "(", "constructor", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Failed to find an appropriate RequestControl constructor\"", ")", ";", "}", "Control", "result", "=", "null", ";", "try", "{", "result", "=", "(", "Control", ")", "constructor", ".", "newInstance", "(", "params", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "ReflectionUtils", ".", "handleReflectionException", "(", "e", ")", ";", "}", "return", "result", ";", "}" ]
Creates a request control using the constructor parameters given in <code>params</code>. @param paramTypes Types of the constructor parameters @param params Actual constructor parameters @return Control to be used by the DirContextProcessor
[ "Creates", "a", "request", "control", "using", "the", "constructor", "parameters", "given", "in", "<code", ">", "params<", "/", "code", ">", "." ]
train
https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/control/AbstractFallbackRequestAndResponseControlDirContextProcessor.java#L159-L174
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsPreferences.java
CmsPreferences.buildSelectCopyFileMode
public String buildSelectCopyFileMode(String htmlAttributes) { """ Builds the html for the default copy file mode select box.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the default copy file mode select box """ List<String> options = new ArrayList<String>(2); options.add(key(Messages.GUI_PREF_COPY_AS_SIBLING_0)); options.add(key(Messages.GUI_COPY_AS_NEW_0)); List<String> values = new ArrayList<String>(2); values.add(CmsResource.COPY_AS_SIBLING.toString()); values.add(CmsResource.COPY_AS_NEW.toString()); int selectedIndex = values.indexOf(getParamTabDiCopyFileMode()); return buildSelect(htmlAttributes, options, values, selectedIndex); }
java
public String buildSelectCopyFileMode(String htmlAttributes) { List<String> options = new ArrayList<String>(2); options.add(key(Messages.GUI_PREF_COPY_AS_SIBLING_0)); options.add(key(Messages.GUI_COPY_AS_NEW_0)); List<String> values = new ArrayList<String>(2); values.add(CmsResource.COPY_AS_SIBLING.toString()); values.add(CmsResource.COPY_AS_NEW.toString()); int selectedIndex = values.indexOf(getParamTabDiCopyFileMode()); return buildSelect(htmlAttributes, options, values, selectedIndex); }
[ "public", "String", "buildSelectCopyFileMode", "(", "String", "htmlAttributes", ")", "{", "List", "<", "String", ">", "options", "=", "new", "ArrayList", "<", "String", ">", "(", "2", ")", ";", "options", ".", "add", "(", "key", "(", "Messages", ".", "GUI_PREF_COPY_AS_SIBLING_0", ")", ")", ";", "options", ".", "add", "(", "key", "(", "Messages", ".", "GUI_COPY_AS_NEW_0", ")", ")", ";", "List", "<", "String", ">", "values", "=", "new", "ArrayList", "<", "String", ">", "(", "2", ")", ";", "values", ".", "add", "(", "CmsResource", ".", "COPY_AS_SIBLING", ".", "toString", "(", ")", ")", ";", "values", ".", "add", "(", "CmsResource", ".", "COPY_AS_NEW", ".", "toString", "(", ")", ")", ";", "int", "selectedIndex", "=", "values", ".", "indexOf", "(", "getParamTabDiCopyFileMode", "(", ")", ")", ";", "return", "buildSelect", "(", "htmlAttributes", ",", "options", ",", "values", ",", "selectedIndex", ")", ";", "}" ]
Builds the html for the default copy file mode select box.<p> @param htmlAttributes optional html attributes for the &lgt;select&gt; tag @return the html for the default copy file mode select box
[ "Builds", "the", "html", "for", "the", "default", "copy", "file", "mode", "select", "box", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsPreferences.java#L589-L599
UrielCh/ovh-java-sdk
ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java
ApiOvhMetrics.serviceName_token_tokenId_PUT
public OvhToken serviceName_token_tokenId_PUT(String serviceName, String tokenId, String description) throws IOException { """ Modify a token REST: PUT /metrics/{serviceName}/token/{tokenId} @param description [required] New description for your token @param serviceName [required] Name of your service @param tokenId [required] ID of the desired token API beta """ String qPath = "/metrics/{serviceName}/token/{tokenId}"; StringBuilder sb = path(qPath, serviceName, tokenId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhToken.class); }
java
public OvhToken serviceName_token_tokenId_PUT(String serviceName, String tokenId, String description) throws IOException { String qPath = "/metrics/{serviceName}/token/{tokenId}"; StringBuilder sb = path(qPath, serviceName, tokenId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhToken.class); }
[ "public", "OvhToken", "serviceName_token_tokenId_PUT", "(", "String", "serviceName", ",", "String", "tokenId", ",", "String", "description", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/metrics/{serviceName}/token/{tokenId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "tokenId", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"description\"", ",", "description", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhToken", ".", "class", ")", ";", "}" ]
Modify a token REST: PUT /metrics/{serviceName}/token/{tokenId} @param description [required] New description for your token @param serviceName [required] Name of your service @param tokenId [required] ID of the desired token API beta
[ "Modify", "a", "token" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java#L266-L273
mcxiaoke/Android-Next
recycler/src/main/java/com/mcxiaoke/next/recycler/AdvancedRecyclerArrayAdapter.java
AdvancedRecyclerArrayAdapter.isItemTheSame
public boolean isItemTheSame(@Nullable final T oldItem, @Nullable final T newItem) { """ Called by the DiffUtil to decide whether two object represent the same Item. <p> For example, if your items have unique ids, this method should check their id equality. @param oldItem The position of the item in the old list @param newItem The position of the item in the new list @return True if the two items represent the same object or false if they are different. @see #getItemId(Object) """ if (oldItem == null && newItem == null) { return true; } if (oldItem == null || newItem == null) { return false; } final Object oldId = getItemId(oldItem); final Object newId = getItemId(newItem); return (oldId == newId) || (oldId != null && oldId.equals(newId)); }
java
public boolean isItemTheSame(@Nullable final T oldItem, @Nullable final T newItem) { if (oldItem == null && newItem == null) { return true; } if (oldItem == null || newItem == null) { return false; } final Object oldId = getItemId(oldItem); final Object newId = getItemId(newItem); return (oldId == newId) || (oldId != null && oldId.equals(newId)); }
[ "public", "boolean", "isItemTheSame", "(", "@", "Nullable", "final", "T", "oldItem", ",", "@", "Nullable", "final", "T", "newItem", ")", "{", "if", "(", "oldItem", "==", "null", "&&", "newItem", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "oldItem", "==", "null", "||", "newItem", "==", "null", ")", "{", "return", "false", ";", "}", "final", "Object", "oldId", "=", "getItemId", "(", "oldItem", ")", ";", "final", "Object", "newId", "=", "getItemId", "(", "newItem", ")", ";", "return", "(", "oldId", "==", "newId", ")", "||", "(", "oldId", "!=", "null", "&&", "oldId", ".", "equals", "(", "newId", ")", ")", ";", "}" ]
Called by the DiffUtil to decide whether two object represent the same Item. <p> For example, if your items have unique ids, this method should check their id equality. @param oldItem The position of the item in the old list @param newItem The position of the item in the new list @return True if the two items represent the same object or false if they are different. @see #getItemId(Object)
[ "Called", "by", "the", "DiffUtil", "to", "decide", "whether", "two", "object", "represent", "the", "same", "Item", ".", "<p", ">", "For", "example", "if", "your", "items", "have", "unique", "ids", "this", "method", "should", "check", "their", "id", "equality", "." ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/AdvancedRecyclerArrayAdapter.java#L245-L258
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/util/BitVector.java
BitVector.createBitVector
public static BitVector createBitVector(byte[] data, int size) { """ Factory method for creating a <tt>BitVector</tt> instance wrapping the given byte data. @param data a byte[] containing packed bits. @param size Size to set the bit vector to @return the newly created <tt>BitVector</tt> instance. """ BitVector bv = new BitVector(data.length * 8); bv.setBytes(data); bv.size = size; return bv; }
java
public static BitVector createBitVector(byte[] data, int size) { BitVector bv = new BitVector(data.length * 8); bv.setBytes(data); bv.size = size; return bv; }
[ "public", "static", "BitVector", "createBitVector", "(", "byte", "[", "]", "data", ",", "int", "size", ")", "{", "BitVector", "bv", "=", "new", "BitVector", "(", "data", ".", "length", "*", "8", ")", ";", "bv", ".", "setBytes", "(", "data", ")", ";", "bv", ".", "size", "=", "size", ";", "return", "bv", ";", "}" ]
Factory method for creating a <tt>BitVector</tt> instance wrapping the given byte data. @param data a byte[] containing packed bits. @param size Size to set the bit vector to @return the newly created <tt>BitVector</tt> instance.
[ "Factory", "method", "for", "creating", "a", "<tt", ">", "BitVector<", "/", "tt", ">", "instance", "wrapping", "the", "given", "byte", "data", "." ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/util/BitVector.java#L72-L77
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java
GraphHelper.addProperty
public static void addProperty(AtlasVertex vertex, String propertyName, Object value) { """ Adds an additional value to a multi-property. @param vertex @param propertyName @param value """ String actualPropertyName = GraphHelper.encodePropertyKey(propertyName); if (LOG.isDebugEnabled()) { LOG.debug("Adding property {} = \"{}\" to vertex {}", actualPropertyName, value, string(vertex)); } vertex.addProperty(actualPropertyName, value); }
java
public static void addProperty(AtlasVertex vertex, String propertyName, Object value) { String actualPropertyName = GraphHelper.encodePropertyKey(propertyName); if (LOG.isDebugEnabled()) { LOG.debug("Adding property {} = \"{}\" to vertex {}", actualPropertyName, value, string(vertex)); } vertex.addProperty(actualPropertyName, value); }
[ "public", "static", "void", "addProperty", "(", "AtlasVertex", "vertex", ",", "String", "propertyName", ",", "Object", "value", ")", "{", "String", "actualPropertyName", "=", "GraphHelper", ".", "encodePropertyKey", "(", "propertyName", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Adding property {} = \\\"{}\\\" to vertex {}\"", ",", "actualPropertyName", ",", "value", ",", "string", "(", "vertex", ")", ")", ";", "}", "vertex", ".", "addProperty", "(", "actualPropertyName", ",", "value", ")", ";", "}" ]
Adds an additional value to a multi-property. @param vertex @param propertyName @param value
[ "Adds", "an", "additional", "value", "to", "a", "multi", "-", "property", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/repository/graph/GraphHelper.java#L542-L550
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
ContentSpecProcessor.doesRelationshipMatch
protected boolean doesRelationshipMatch(final TopicRelationship relationship, final CSRelatedNodeWrapper relatedNode) { """ Checks to see if a ContentSpec topic relationship matches a Content Spec Entity topic. @param relationship The ContentSpec topic relationship object. @param relatedNode The related Content Spec Entity topic. @return True if the topic is determined to match otherwise false. """ // If the relationship is a TopicRelationship, then the related node must be a topic or its not a match if (!EntityUtilities.isNodeATopic(relatedNode)) return false; // Check if the type matches first if (!RelationshipType.getRelationshipTypeId(relationship.getType()).equals(relatedNode.getRelationshipType())) return false; // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare if (relationship.getSecondaryRelationship().getUniqueId() != null && relationship.getSecondaryRelationship().getUniqueId().matches( "^\\d.*")) { return relationship.getSecondaryRelationship().getUniqueId().equals(Integer.toString(relatedNode.getId())); } else { return relationship.getSecondaryRelationship().getDBId().equals(relatedNode.getEntityId()); } }
java
protected boolean doesRelationshipMatch(final TopicRelationship relationship, final CSRelatedNodeWrapper relatedNode) { // If the relationship is a TopicRelationship, then the related node must be a topic or its not a match if (!EntityUtilities.isNodeATopic(relatedNode)) return false; // Check if the type matches first if (!RelationshipType.getRelationshipTypeId(relationship.getType()).equals(relatedNode.getRelationshipType())) return false; // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare if (relationship.getSecondaryRelationship().getUniqueId() != null && relationship.getSecondaryRelationship().getUniqueId().matches( "^\\d.*")) { return relationship.getSecondaryRelationship().getUniqueId().equals(Integer.toString(relatedNode.getId())); } else { return relationship.getSecondaryRelationship().getDBId().equals(relatedNode.getEntityId()); } }
[ "protected", "boolean", "doesRelationshipMatch", "(", "final", "TopicRelationship", "relationship", ",", "final", "CSRelatedNodeWrapper", "relatedNode", ")", "{", "// If the relationship is a TopicRelationship, then the related node must be a topic or its not a match", "if", "(", "!", "EntityUtilities", ".", "isNodeATopic", "(", "relatedNode", ")", ")", "return", "false", ";", "// Check if the type matches first", "if", "(", "!", "RelationshipType", ".", "getRelationshipTypeId", "(", "relationship", ".", "getType", "(", ")", ")", ".", "equals", "(", "relatedNode", ".", "getRelationshipType", "(", ")", ")", ")", "return", "false", ";", "// If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare", "if", "(", "relationship", ".", "getSecondaryRelationship", "(", ")", ".", "getUniqueId", "(", ")", "!=", "null", "&&", "relationship", ".", "getSecondaryRelationship", "(", ")", ".", "getUniqueId", "(", ")", ".", "matches", "(", "\"^\\\\d.*\"", ")", ")", "{", "return", "relationship", ".", "getSecondaryRelationship", "(", ")", ".", "getUniqueId", "(", ")", ".", "equals", "(", "Integer", ".", "toString", "(", "relatedNode", ".", "getId", "(", ")", ")", ")", ";", "}", "else", "{", "return", "relationship", ".", "getSecondaryRelationship", "(", ")", ".", "getDBId", "(", ")", ".", "equals", "(", "relatedNode", ".", "getEntityId", "(", ")", ")", ";", "}", "}" ]
Checks to see if a ContentSpec topic relationship matches a Content Spec Entity topic. @param relationship The ContentSpec topic relationship object. @param relatedNode The related Content Spec Entity topic. @return True if the topic is determined to match otherwise false.
[ "Checks", "to", "see", "if", "a", "ContentSpec", "topic", "relationship", "matches", "a", "Content", "Spec", "Entity", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L2193-L2207
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java
RandomMatrices_DDRM.fillUniform
public static void fillUniform(DMatrixD1 mat , double min , double max , Random rand ) { """ <p> Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive. </p> @param min The minimum value each element can be. @param max The maximum value each element can be. @param mat The matrix who is to be randomized. Modified. @param rand Random number generator used to fill the matrix. """ double d[] = mat.getData(); int size = mat.getNumElements(); double r = max-min; for( int i = 0; i < size; i++ ) { d[i] = r*rand.nextDouble()+min; } }
java
public static void fillUniform(DMatrixD1 mat , double min , double max , Random rand ) { double d[] = mat.getData(); int size = mat.getNumElements(); double r = max-min; for( int i = 0; i < size; i++ ) { d[i] = r*rand.nextDouble()+min; } }
[ "public", "static", "void", "fillUniform", "(", "DMatrixD1", "mat", ",", "double", "min", ",", "double", "max", ",", "Random", "rand", ")", "{", "double", "d", "[", "]", "=", "mat", ".", "getData", "(", ")", ";", "int", "size", "=", "mat", ".", "getNumElements", "(", ")", ";", "double", "r", "=", "max", "-", "min", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "d", "[", "i", "]", "=", "r", "*", "rand", ".", "nextDouble", "(", ")", "+", "min", ";", "}", "}" ]
<p> Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive. </p> @param min The minimum value each element can be. @param max The maximum value each element can be. @param mat The matrix who is to be randomized. Modified. @param rand Random number generator used to fill the matrix.
[ "<p", ">", "Sets", "each", "element", "in", "the", "matrix", "to", "a", "value", "drawn", "from", "an", "uniform", "distribution", "from", "min", "to", "max", "inclusive", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L359-L369
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java
CommerceOrderPersistenceImpl.removeByG_U_O
@Override public void removeByG_U_O(long groupId, long userId, int orderStatus) { """ Removes all the commerce orders where groupId = &#63; and userId = &#63; and orderStatus = &#63; from the database. @param groupId the group ID @param userId the user ID @param orderStatus the order status """ for (CommerceOrder commerceOrder : findByG_U_O(groupId, userId, orderStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceOrder); } }
java
@Override public void removeByG_U_O(long groupId, long userId, int orderStatus) { for (CommerceOrder commerceOrder : findByG_U_O(groupId, userId, orderStatus, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceOrder); } }
[ "@", "Override", "public", "void", "removeByG_U_O", "(", "long", "groupId", ",", "long", "userId", ",", "int", "orderStatus", ")", "{", "for", "(", "CommerceOrder", "commerceOrder", ":", "findByG_U_O", "(", "groupId", ",", "userId", ",", "orderStatus", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceOrder", ")", ";", "}", "}" ]
Removes all the commerce orders where groupId = &#63; and userId = &#63; and orderStatus = &#63; from the database. @param groupId the group ID @param userId the user ID @param orderStatus the order status
[ "Removes", "all", "the", "commerce", "orders", "where", "groupId", "=", "&#63", ";", "and", "userId", "=", "&#63", ";", "and", "orderStatus", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L4583-L4589
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObject.java
SceneObject.refreshObjectTile
public void refreshObjectTile (MisoSceneMetrics metrics, TileManager mgr, Colorizer colorizer) { """ Reloads and recolorizes our object tile. It is not intended for the actual object tile used by a scene object to change in its lifetime, only attributes of that object like its colorizations. So don't do anything crazy like change our {@link ObjectInfo}'s <code>tileId</code> and call this method or things might break. """ int tsid = TileUtil.getTileSetId(info.tileId); int tidx = TileUtil.getTileIndex(info.tileId); try { tile = (ObjectTile)mgr.getTile(tsid, tidx, colorizer); computeInfo(metrics); } catch (NoSuchTileSetException te) { log.warning("Scene contains non-existent object tileset [info=" + info + "]."); } }
java
public void refreshObjectTile (MisoSceneMetrics metrics, TileManager mgr, Colorizer colorizer) { int tsid = TileUtil.getTileSetId(info.tileId); int tidx = TileUtil.getTileIndex(info.tileId); try { tile = (ObjectTile)mgr.getTile(tsid, tidx, colorizer); computeInfo(metrics); } catch (NoSuchTileSetException te) { log.warning("Scene contains non-existent object tileset [info=" + info + "]."); } }
[ "public", "void", "refreshObjectTile", "(", "MisoSceneMetrics", "metrics", ",", "TileManager", "mgr", ",", "Colorizer", "colorizer", ")", "{", "int", "tsid", "=", "TileUtil", ".", "getTileSetId", "(", "info", ".", "tileId", ")", ";", "int", "tidx", "=", "TileUtil", ".", "getTileIndex", "(", "info", ".", "tileId", ")", ";", "try", "{", "tile", "=", "(", "ObjectTile", ")", "mgr", ".", "getTile", "(", "tsid", ",", "tidx", ",", "colorizer", ")", ";", "computeInfo", "(", "metrics", ")", ";", "}", "catch", "(", "NoSuchTileSetException", "te", ")", "{", "log", ".", "warning", "(", "\"Scene contains non-existent object tileset [info=\"", "+", "info", "+", "\"].\"", ")", ";", "}", "}" ]
Reloads and recolorizes our object tile. It is not intended for the actual object tile used by a scene object to change in its lifetime, only attributes of that object like its colorizations. So don't do anything crazy like change our {@link ObjectInfo}'s <code>tileId</code> and call this method or things might break.
[ "Reloads", "and", "recolorizes", "our", "object", "tile", ".", "It", "is", "not", "intended", "for", "the", "actual", "object", "tile", "used", "by", "a", "scene", "object", "to", "change", "in", "its", "lifetime", "only", "attributes", "of", "that", "object", "like", "its", "colorizations", ".", "So", "don", "t", "do", "anything", "crazy", "like", "change", "our", "{" ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObject.java#L275-L286
cdk/cdk
tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java
MmffAromaticTypeMapping.normaliseCycle
static boolean normaliseCycle(int[] cycle, int[] contribution) { """ Normalises a 5-member 'cycle' such that the hetroatom contributing the lone-pair is in position 1 (index 0). The alpha atoms are then in index 1 and 4 whilst the beta atoms are in index 2 and 3. If the ring contains more than one hetroatom the cycle is not normalised (return=false). @param cycle aromatic cycle to normalise, |C| = 5 @param contribution vector of p electron contributions from each vertex (size |V|) @return whether the cycle was normalised """ int offset = indexOfHetro(cycle, contribution); if (offset < 0) return false; if (offset == 0) return true; int[] cpy = Arrays.copyOf(cycle, cycle.length); int len = cycle.length - 1; for (int j = 0; j < len; j++) { cycle[j] = cpy[(offset + j) % len]; } cycle[len] = cycle[0]; // make closed walk return true; }
java
static boolean normaliseCycle(int[] cycle, int[] contribution) { int offset = indexOfHetro(cycle, contribution); if (offset < 0) return false; if (offset == 0) return true; int[] cpy = Arrays.copyOf(cycle, cycle.length); int len = cycle.length - 1; for (int j = 0; j < len; j++) { cycle[j] = cpy[(offset + j) % len]; } cycle[len] = cycle[0]; // make closed walk return true; }
[ "static", "boolean", "normaliseCycle", "(", "int", "[", "]", "cycle", ",", "int", "[", "]", "contribution", ")", "{", "int", "offset", "=", "indexOfHetro", "(", "cycle", ",", "contribution", ")", ";", "if", "(", "offset", "<", "0", ")", "return", "false", ";", "if", "(", "offset", "==", "0", ")", "return", "true", ";", "int", "[", "]", "cpy", "=", "Arrays", ".", "copyOf", "(", "cycle", ",", "cycle", ".", "length", ")", ";", "int", "len", "=", "cycle", ".", "length", "-", "1", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "len", ";", "j", "++", ")", "{", "cycle", "[", "j", "]", "=", "cpy", "[", "(", "offset", "+", "j", ")", "%", "len", "]", ";", "}", "cycle", "[", "len", "]", "=", "cycle", "[", "0", "]", ";", "// make closed walk", "return", "true", ";", "}" ]
Normalises a 5-member 'cycle' such that the hetroatom contributing the lone-pair is in position 1 (index 0). The alpha atoms are then in index 1 and 4 whilst the beta atoms are in index 2 and 3. If the ring contains more than one hetroatom the cycle is not normalised (return=false). @param cycle aromatic cycle to normalise, |C| = 5 @param contribution vector of p electron contributions from each vertex (size |V|) @return whether the cycle was normalised
[ "Normalises", "a", "5", "-", "member", "cycle", "such", "that", "the", "hetroatom", "contributing", "the", "lone", "-", "pair", "is", "in", "position", "1", "(", "index", "0", ")", ".", "The", "alpha", "atoms", "are", "then", "in", "index", "1", "and", "4", "whilst", "the", "beta", "atoms", "are", "in", "index", "2", "and", "3", ".", "If", "the", "ring", "contains", "more", "than", "one", "hetroatom", "the", "cycle", "is", "not", "normalised", "(", "return", "=", "false", ")", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAromaticTypeMapping.java#L341-L352
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java
PoiUtil.searchRow
public static Cell searchRow(Row row, String searchKey) { """ 在行中查找。 @param row 行 @param searchKey 单元格中包含的关键字 @return 单元格,没有找到时返回null """ if (row == null) return null; for (int j = row.getFirstCellNum(), jj = row.getLastCellNum(); j < jj; ++j) { Cell cell = matchCell(row, j, searchKey); if (cell != null) return cell; } return null; }
java
public static Cell searchRow(Row row, String searchKey) { if (row == null) return null; for (int j = row.getFirstCellNum(), jj = row.getLastCellNum(); j < jj; ++j) { Cell cell = matchCell(row, j, searchKey); if (cell != null) return cell; } return null; }
[ "public", "static", "Cell", "searchRow", "(", "Row", "row", ",", "String", "searchKey", ")", "{", "if", "(", "row", "==", "null", ")", "return", "null", ";", "for", "(", "int", "j", "=", "row", ".", "getFirstCellNum", "(", ")", ",", "jj", "=", "row", ".", "getLastCellNum", "(", ")", ";", "j", "<", "jj", ";", "++", "j", ")", "{", "Cell", "cell", "=", "matchCell", "(", "row", ",", "j", ",", "searchKey", ")", ";", "if", "(", "cell", "!=", "null", ")", "return", "cell", ";", "}", "return", "null", ";", "}" ]
在行中查找。 @param row 行 @param searchKey 单元格中包含的关键字 @return 单元格,没有找到时返回null
[ "在行中查找。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L379-L387
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optCharSequenceArrayList
@TargetApi(Build.VERSION_CODES.FROYO) @Nullable public static ArrayList<CharSequence> optCharSequenceArrayList(@Nullable Bundle bundle, @Nullable String key) { """ Since Bundle#getCharSequenceArrayList returns concrete ArrayList type, so this method follows that implementation. """ return optCharSequenceArrayList(bundle, key, new ArrayList<CharSequence>()); }
java
@TargetApi(Build.VERSION_CODES.FROYO) @Nullable public static ArrayList<CharSequence> optCharSequenceArrayList(@Nullable Bundle bundle, @Nullable String key) { return optCharSequenceArrayList(bundle, key, new ArrayList<CharSequence>()); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "FROYO", ")", "@", "Nullable", "public", "static", "ArrayList", "<", "CharSequence", ">", "optCharSequenceArrayList", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")", "{", "return", "optCharSequenceArrayList", "(", "bundle", ",", "key", ",", "new", "ArrayList", "<", "CharSequence", ">", "(", ")", ")", ";", "}" ]
Since Bundle#getCharSequenceArrayList returns concrete ArrayList type, so this method follows that implementation.
[ "Since", "Bundle#getCharSequenceArrayList", "returns", "concrete", "ArrayList", "type", "so", "this", "method", "follows", "that", "implementation", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L392-L396
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java
BatchKernelImpl.publishEvent
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo, String correlationId) { """ Publish jms topic if batch jms event is available @param objectToPublish WSJobInstance @param eventToPublish """ if (eventsPublisher != null) { eventsPublisher.publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId); } }
java
private void publishEvent(WSJobExecution objectToPublish, String eventToPublishTo, String correlationId) { if (eventsPublisher != null) { eventsPublisher.publishJobExecutionEvent(objectToPublish, eventToPublishTo, correlationId); } }
[ "private", "void", "publishEvent", "(", "WSJobExecution", "objectToPublish", ",", "String", "eventToPublishTo", ",", "String", "correlationId", ")", "{", "if", "(", "eventsPublisher", "!=", "null", ")", "{", "eventsPublisher", ".", "publishJobExecutionEvent", "(", "objectToPublish", ",", "eventToPublishTo", ",", "correlationId", ")", ";", "}", "}" ]
Publish jms topic if batch jms event is available @param objectToPublish WSJobInstance @param eventToPublish
[ "Publish", "jms", "topic", "if", "batch", "jms", "event", "is", "available" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/impl/BatchKernelImpl.java#L294-L298
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newImmutableObjectException
public static ImmutableObjectException newImmutableObjectException(String message, Object... args) { """ Constructs and initializes a new {@link ImmutableObjectException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link ImmutableObjectException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link ImmutableObjectException} with the given {@link String message}. @see #newImmutableObjectException(Throwable, String, Object...) @see org.cp.elements.lang.ImmutableObjectException """ return newImmutableObjectException(null, message, args); }
java
public static ImmutableObjectException newImmutableObjectException(String message, Object... args) { return newImmutableObjectException(null, message, args); }
[ "public", "static", "ImmutableObjectException", "newImmutableObjectException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newImmutableObjectException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link ImmutableObjectException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link ImmutableObjectException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link ImmutableObjectException} with the given {@link String message}. @see #newImmutableObjectException(Throwable, String, Object...) @see org.cp.elements.lang.ImmutableObjectException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "ImmutableObjectException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L411-L413
ggrandes/packer
src/main/java/org/javastack/packer/Packer.java
Packer.putStringMap
public Packer putStringMap(final Map<String, String> map) { """ Put a Map<String, String> in UTF-8 format @param value @return @see #getStringMap(Map) """ putVInt(map.size()); for (final Entry<String, String> e : map.entrySet()) { final String key = e.getKey(); final String value = e.getValue(); putString(key); putString(value); } return this; }
java
public Packer putStringMap(final Map<String, String> map) { putVInt(map.size()); for (final Entry<String, String> e : map.entrySet()) { final String key = e.getKey(); final String value = e.getValue(); putString(key); putString(value); } return this; }
[ "public", "Packer", "putStringMap", "(", "final", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "putVInt", "(", "map", ".", "size", "(", ")", ")", ";", "for", "(", "final", "Entry", "<", "String", ",", "String", ">", "e", ":", "map", ".", "entrySet", "(", ")", ")", "{", "final", "String", "key", "=", "e", ".", "getKey", "(", ")", ";", "final", "String", "value", "=", "e", ".", "getValue", "(", ")", ";", "putString", "(", "key", ")", ";", "putString", "(", "value", ")", ";", "}", "return", "this", ";", "}" ]
Put a Map<String, String> in UTF-8 format @param value @return @see #getStringMap(Map)
[ "Put", "a", "Map<String", "String", ">", "in", "UTF", "-", "8", "format" ]
train
https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L774-L783
code4everything/util
src/main/java/com/zhazhapan/util/Checker.java
Checker.getNotNullWithException
public static <T> T getNotNullWithException(T... ts) throws Exception { """ 从集合中获取第一个不为Null的值 @param ts 集合 @param <T> 值类型 @return 值 @throws Exception 当集合中所有值都为null,抛出异常 @since 1.0.8 """ if (isNotNull(ts)) { for (T t : ts) { if (isNotNull(t)) { return t; } } } throw new Exception("ops, no value found while value is not null."); }
java
public static <T> T getNotNullWithException(T... ts) throws Exception { if (isNotNull(ts)) { for (T t : ts) { if (isNotNull(t)) { return t; } } } throw new Exception("ops, no value found while value is not null."); }
[ "public", "static", "<", "T", ">", "T", "getNotNullWithException", "(", "T", "...", "ts", ")", "throws", "Exception", "{", "if", "(", "isNotNull", "(", "ts", ")", ")", "{", "for", "(", "T", "t", ":", "ts", ")", "{", "if", "(", "isNotNull", "(", "t", ")", ")", "{", "return", "t", ";", "}", "}", "}", "throw", "new", "Exception", "(", "\"ops, no value found while value is not null.\"", ")", ";", "}" ]
从集合中获取第一个不为Null的值 @param ts 集合 @param <T> 值类型 @return 值 @throws Exception 当集合中所有值都为null,抛出异常 @since 1.0.8
[ "从集合中获取第一个不为Null的值" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L619-L628
molgenis/molgenis
molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java
IndexJobService.performIndexActions
private void performIndexActions(Progress progress, String transactionId) { """ Performs the IndexActions. @param progress {@link Progress} instance to log progress information to """ List<IndexAction> indexActions = dataService .findAll(INDEX_ACTION, createQueryGetAllIndexActions(transactionId), IndexAction.class) .collect(toList()); try { boolean success = true; int count = 0; for (IndexAction indexAction : indexActions) { success &= performAction(progress, count++, indexAction); } if (success) { progress.progress(count, "Executed all index actions, cleaning up the actions..."); dataService.delete(INDEX_ACTION, indexActions.stream()); dataService.deleteById(INDEX_ACTION_GROUP, transactionId); progress.progress(count, "Cleaned up the actions."); } } catch (Exception ex) { LOG.error("Error performing index actions", ex); throw ex; } finally { progress.status("Refresh index start"); indexService.refreshIndex(); progress.status("Refresh index done"); } }
java
private void performIndexActions(Progress progress, String transactionId) { List<IndexAction> indexActions = dataService .findAll(INDEX_ACTION, createQueryGetAllIndexActions(transactionId), IndexAction.class) .collect(toList()); try { boolean success = true; int count = 0; for (IndexAction indexAction : indexActions) { success &= performAction(progress, count++, indexAction); } if (success) { progress.progress(count, "Executed all index actions, cleaning up the actions..."); dataService.delete(INDEX_ACTION, indexActions.stream()); dataService.deleteById(INDEX_ACTION_GROUP, transactionId); progress.progress(count, "Cleaned up the actions."); } } catch (Exception ex) { LOG.error("Error performing index actions", ex); throw ex; } finally { progress.status("Refresh index start"); indexService.refreshIndex(); progress.status("Refresh index done"); } }
[ "private", "void", "performIndexActions", "(", "Progress", "progress", ",", "String", "transactionId", ")", "{", "List", "<", "IndexAction", ">", "indexActions", "=", "dataService", ".", "findAll", "(", "INDEX_ACTION", ",", "createQueryGetAllIndexActions", "(", "transactionId", ")", ",", "IndexAction", ".", "class", ")", ".", "collect", "(", "toList", "(", ")", ")", ";", "try", "{", "boolean", "success", "=", "true", ";", "int", "count", "=", "0", ";", "for", "(", "IndexAction", "indexAction", ":", "indexActions", ")", "{", "success", "&=", "performAction", "(", "progress", ",", "count", "++", ",", "indexAction", ")", ";", "}", "if", "(", "success", ")", "{", "progress", ".", "progress", "(", "count", ",", "\"Executed all index actions, cleaning up the actions...\"", ")", ";", "dataService", ".", "delete", "(", "INDEX_ACTION", ",", "indexActions", ".", "stream", "(", ")", ")", ";", "dataService", ".", "deleteById", "(", "INDEX_ACTION_GROUP", ",", "transactionId", ")", ";", "progress", ".", "progress", "(", "count", ",", "\"Cleaned up the actions.\"", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "LOG", ".", "error", "(", "\"Error performing index actions\"", ",", "ex", ")", ";", "throw", "ex", ";", "}", "finally", "{", "progress", ".", "status", "(", "\"Refresh index start\"", ")", ";", "indexService", ".", "refreshIndex", "(", ")", ";", "progress", ".", "status", "(", "\"Refresh index done\"", ")", ";", "}", "}" ]
Performs the IndexActions. @param progress {@link Progress} instance to log progress information to
[ "Performs", "the", "IndexActions", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java#L72-L97
FasterXML/woodstox
src/main/java/com/ctc/wstx/sr/AttributeCollector.java
AttributeCollector.decodeValue
public final void decodeValue(int index, TypedValueDecoder tvd) throws IllegalArgumentException { """ Method called to decode the whole attribute value as a single typed value. Decoding is done using the decoder provided. """ if (index < 0 || index >= mAttrCount) { throwIndex(index); } /* Should be faster to pass the char array even if we might * have a String */ // Either way, need to trim before passing: char[] buf = mValueBuilder.getCharBuffer(); int start = mAttributes[index].mValueStartOffset; int end = getValueStartOffset(index+1); while (true) { if (start >= end) { tvd.handleEmptyValue(); return; } if (!StringUtil.isSpace(buf[start])) { break; } ++start; } // Trailing space? while (--end > start && StringUtil.isSpace(buf[end])) { } tvd.decode(buf, start, end+1); }
java
public final void decodeValue(int index, TypedValueDecoder tvd) throws IllegalArgumentException { if (index < 0 || index >= mAttrCount) { throwIndex(index); } /* Should be faster to pass the char array even if we might * have a String */ // Either way, need to trim before passing: char[] buf = mValueBuilder.getCharBuffer(); int start = mAttributes[index].mValueStartOffset; int end = getValueStartOffset(index+1); while (true) { if (start >= end) { tvd.handleEmptyValue(); return; } if (!StringUtil.isSpace(buf[start])) { break; } ++start; } // Trailing space? while (--end > start && StringUtil.isSpace(buf[end])) { } tvd.decode(buf, start, end+1); }
[ "public", "final", "void", "decodeValue", "(", "int", "index", ",", "TypedValueDecoder", "tvd", ")", "throws", "IllegalArgumentException", "{", "if", "(", "index", "<", "0", "||", "index", ">=", "mAttrCount", ")", "{", "throwIndex", "(", "index", ")", ";", "}", "/* Should be faster to pass the char array even if we might\n * have a String\n */", "// Either way, need to trim before passing:", "char", "[", "]", "buf", "=", "mValueBuilder", ".", "getCharBuffer", "(", ")", ";", "int", "start", "=", "mAttributes", "[", "index", "]", ".", "mValueStartOffset", ";", "int", "end", "=", "getValueStartOffset", "(", "index", "+", "1", ")", ";", "while", "(", "true", ")", "{", "if", "(", "start", ">=", "end", ")", "{", "tvd", ".", "handleEmptyValue", "(", ")", ";", "return", ";", "}", "if", "(", "!", "StringUtil", ".", "isSpace", "(", "buf", "[", "start", "]", ")", ")", "{", "break", ";", "}", "++", "start", ";", "}", "// Trailing space?", "while", "(", "--", "end", ">", "start", "&&", "StringUtil", ".", "isSpace", "(", "buf", "[", "end", "]", ")", ")", "{", "}", "tvd", ".", "decode", "(", "buf", ",", "start", ",", "end", "+", "1", ")", ";", "}" ]
Method called to decode the whole attribute value as a single typed value. Decoding is done using the decoder provided.
[ "Method", "called", "to", "decode", "the", "whole", "attribute", "value", "as", "a", "single", "typed", "value", ".", "Decoding", "is", "done", "using", "the", "decoder", "provided", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/AttributeCollector.java#L537-L564
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java
WSJdbcCallableStatement.invokeOperation
Object invokeOperation(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { """ Invokes a method on the specified object. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method. """ if (args != null && args.length == 1 && method.getName().equals("getCursor")) return getCursor(implObject, method, args); return super.invokeOperation(implObject, method, args); }
java
Object invokeOperation(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { if (args != null && args.length == 1 && method.getName().equals("getCursor")) return getCursor(implObject, method, args); return super.invokeOperation(implObject, method, args); }
[ "Object", "invokeOperation", "(", "Object", "implObject", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", ",", "SQLException", "{", "if", "(", "args", "!=", "null", "&&", "args", ".", "length", "==", "1", "&&", "method", ".", "getName", "(", ")", ".", "equals", "(", "\"getCursor\"", ")", ")", "return", "getCursor", "(", "implObject", ",", "method", ",", "args", ")", ";", "return", "super", ".", "invokeOperation", "(", "implObject", ",", "method", ",", "args", ")", ";", "}" ]
Invokes a method on the specified object. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method.
[ "Invokes", "a", "method", "on", "the", "specified", "object", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcCallableStatement.java#L833-L839
JOML-CI/JOML
src/org/joml/Vector3f.java
Vector3f.fma
public Vector3f fma(Vector3fc a, Vector3fc b) { """ Add the component-wise multiplication of <code>a * b</code> to this vector. @param a the first multiplicand @param b the second multiplicand @return a vector holding the result """ return fma(a, b, thisOrNew()); }
java
public Vector3f fma(Vector3fc a, Vector3fc b) { return fma(a, b, thisOrNew()); }
[ "public", "Vector3f", "fma", "(", "Vector3fc", "a", ",", "Vector3fc", "b", ")", "{", "return", "fma", "(", "a", ",", "b", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Add the component-wise multiplication of <code>a * b</code> to this vector. @param a the first multiplicand @param b the second multiplicand @return a vector holding the result
[ "Add", "the", "component", "-", "wise", "multiplication", "of", "<code", ">", "a", "*", "b<", "/", "code", ">", "to", "this", "vector", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3f.java#L590-L592
codeprimate-software/cp-elements
src/main/java/org/cp/elements/data/conversion/converters/DateConverter.java
DateConverter.canConvert
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { """ Determines whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @param fromType {@link Class type} to convert from. @param toType {@link Class type} to convert to. @return a boolean indicating whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) @see #canConvert(Object, Class) """ return isAssignableTo(fromType, Calendar.class, Date.class, Number.class, String.class) && Date.class.equals(toType); }
java
@Override public boolean canConvert(Class<?> fromType, Class<?> toType) { return isAssignableTo(fromType, Calendar.class, Date.class, Number.class, String.class) && Date.class.equals(toType); }
[ "@", "Override", "public", "boolean", "canConvert", "(", "Class", "<", "?", ">", "fromType", ",", "Class", "<", "?", ">", "toType", ")", "{", "return", "isAssignableTo", "(", "fromType", ",", "Calendar", ".", "class", ",", "Date", ".", "class", ",", "Number", ".", "class", ",", "String", ".", "class", ")", "&&", "Date", ".", "class", ".", "equals", "(", "toType", ")", ";", "}" ]
Determines whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @param fromType {@link Class type} to convert from. @param toType {@link Class type} to convert to. @return a boolean indicating whether this {@link Converter} can convert {@link Object Objects} {@link Class from type} {@link Class to type}. @see org.cp.elements.data.conversion.ConversionService#canConvert(Class, Class) @see #canConvert(Object, Class)
[ "Determines", "whether", "this", "{", "@link", "Converter", "}", "can", "convert", "{", "@link", "Object", "Objects", "}", "{", "@link", "Class", "from", "type", "}", "{", "@link", "Class", "to", "type", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/data/conversion/converters/DateConverter.java#L71-L75
zaproxy/zaproxy
src/org/zaproxy/zap/utils/HirshbergMatcher.java
HirshbergMatcher.getMatchRatio
public double getMatchRatio(String strA, String strB) { """ Calculate the ratio of similarity between 2 strings using LCS @param strA the first String @param strB the second String @return the percentage double number """ if (strA == null && strB == null) { return MAX_RATIO; } else if (strA == null || strB == null) { return MIN_RATIO; } if (strA.isEmpty() && strB.isEmpty()) { return MAX_RATIO; } else if (strA.isEmpty() || strB.isEmpty()) { return MIN_RATIO; } //get the percentage match against the longer of the 2 strings return (double)getLCS(strA, strB).length() / Math.max(strA.length(), strB.length()); }
java
public double getMatchRatio(String strA, String strB) { if (strA == null && strB == null) { return MAX_RATIO; } else if (strA == null || strB == null) { return MIN_RATIO; } if (strA.isEmpty() && strB.isEmpty()) { return MAX_RATIO; } else if (strA.isEmpty() || strB.isEmpty()) { return MIN_RATIO; } //get the percentage match against the longer of the 2 strings return (double)getLCS(strA, strB).length() / Math.max(strA.length(), strB.length()); }
[ "public", "double", "getMatchRatio", "(", "String", "strA", ",", "String", "strB", ")", "{", "if", "(", "strA", "==", "null", "&&", "strB", "==", "null", ")", "{", "return", "MAX_RATIO", ";", "}", "else", "if", "(", "strA", "==", "null", "||", "strB", "==", "null", ")", "{", "return", "MIN_RATIO", ";", "}", "if", "(", "strA", ".", "isEmpty", "(", ")", "&&", "strB", ".", "isEmpty", "(", ")", ")", "{", "return", "MAX_RATIO", ";", "}", "else", "if", "(", "strA", ".", "isEmpty", "(", ")", "||", "strB", ".", "isEmpty", "(", ")", ")", "{", "return", "MIN_RATIO", ";", "}", "//get the percentage match against the longer of the 2 strings", "return", "(", "double", ")", "getLCS", "(", "strA", ",", "strB", ")", ".", "length", "(", ")", "/", "Math", ".", "max", "(", "strA", ".", "length", "(", ")", ",", "strB", ".", "length", "(", ")", ")", ";", "}" ]
Calculate the ratio of similarity between 2 strings using LCS @param strA the first String @param strB the second String @return the percentage double number
[ "Calculate", "the", "ratio", "of", "similarity", "between", "2", "strings", "using", "LCS" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/HirshbergMatcher.java#L154-L171
kohsuke/com4j
runtime/src/main/java/com4j/Variant.java
Variant.toDate
static Date toDate(double d) { """ Called from the native code to assist VT_DATE -> Date conversion. """ GregorianCalendar ret = new GregorianCalendar(1899,11,30); int days = (int)d; d -= days; ret.add(Calendar.DATE,days); d *= 24; int hours = (int)d; ret.add(Calendar.HOUR,hours); d -= hours; d *= 60; // d += 0.5; // round int min = (int)d; ret.add(Calendar.MINUTE,min); d -= min; d *= 60; int secs = (int) d; ret.add(Calendar.SECOND, secs); return ret.getTime(); }
java
static Date toDate(double d) { GregorianCalendar ret = new GregorianCalendar(1899,11,30); int days = (int)d; d -= days; ret.add(Calendar.DATE,days); d *= 24; int hours = (int)d; ret.add(Calendar.HOUR,hours); d -= hours; d *= 60; // d += 0.5; // round int min = (int)d; ret.add(Calendar.MINUTE,min); d -= min; d *= 60; int secs = (int) d; ret.add(Calendar.SECOND, secs); return ret.getTime(); }
[ "static", "Date", "toDate", "(", "double", "d", ")", "{", "GregorianCalendar", "ret", "=", "new", "GregorianCalendar", "(", "1899", ",", "11", ",", "30", ")", ";", "int", "days", "=", "(", "int", ")", "d", ";", "d", "-=", "days", ";", "ret", ".", "add", "(", "Calendar", ".", "DATE", ",", "days", ")", ";", "d", "*=", "24", ";", "int", "hours", "=", "(", "int", ")", "d", ";", "ret", ".", "add", "(", "Calendar", ".", "HOUR", ",", "hours", ")", ";", "d", "-=", "hours", ";", "d", "*=", "60", ";", "// d += 0.5; // round", "int", "min", "=", "(", "int", ")", "d", ";", "ret", ".", "add", "(", "Calendar", ".", "MINUTE", ",", "min", ")", ";", "d", "-=", "min", ";", "d", "*=", "60", ";", "int", "secs", "=", "(", "int", ")", "d", ";", "ret", ".", "add", "(", "Calendar", ".", "SECOND", ",", "secs", ")", ";", "return", "ret", ".", "getTime", "(", ")", ";", "}" ]
Called from the native code to assist VT_DATE -> Date conversion.
[ "Called", "from", "the", "native", "code", "to", "assist", "VT_DATE", "-", ">", "Date", "conversion", "." ]
train
https://github.com/kohsuke/com4j/blob/1e690b805fb0e4e9ef61560e20a56335aecb0b24/runtime/src/main/java/com4j/Variant.java#L800-L820
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java
ExtendedSwidProcessor.setDataSource
public ExtendedSwidProcessor setDataSource(final String dataSource) { """ Defines product data source (tag: data_source). @param dataSource product data source @return a reference to this object. """ swidTag.setDataSource(new Token(dataSource, idGenerator.nextId())); return this; }
java
public ExtendedSwidProcessor setDataSource(final String dataSource) { swidTag.setDataSource(new Token(dataSource, idGenerator.nextId())); return this; }
[ "public", "ExtendedSwidProcessor", "setDataSource", "(", "final", "String", "dataSource", ")", "{", "swidTag", ".", "setDataSource", "(", "new", "Token", "(", "dataSource", ",", "idGenerator", ".", "nextId", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
Defines product data source (tag: data_source). @param dataSource product data source @return a reference to this object.
[ "Defines", "product", "data", "source", "(", "tag", ":", "data_source", ")", "." ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L89-L92
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java
Camera.checkVerticalLimit
private void checkVerticalLimit(double extrp, double vy) { """ Check vertical limit on move. @param extrp The extrapolation value. @param vy The vertical movement. """ // Inside interval if (mover.getY() >= limitBottom && mover.getY() <= limitTop && limitBottom != Integer.MIN_VALUE && limitTop != Integer.MAX_VALUE) { offset.moveLocation(extrp, 0, vy); // Block offset on its limits if (offset.getY() < -intervalVertical) { offset.teleportY(-intervalVertical); } else if (offset.getY() > intervalVertical) { offset.teleportY(intervalVertical); } } // Outside interval if ((int) offset.getY() == -intervalVertical || (int) offset.getY() == intervalVertical) { mover.moveLocationY(extrp, vy); } applyVerticalLimit(); }
java
private void checkVerticalLimit(double extrp, double vy) { // Inside interval if (mover.getY() >= limitBottom && mover.getY() <= limitTop && limitBottom != Integer.MIN_VALUE && limitTop != Integer.MAX_VALUE) { offset.moveLocation(extrp, 0, vy); // Block offset on its limits if (offset.getY() < -intervalVertical) { offset.teleportY(-intervalVertical); } else if (offset.getY() > intervalVertical) { offset.teleportY(intervalVertical); } } // Outside interval if ((int) offset.getY() == -intervalVertical || (int) offset.getY() == intervalVertical) { mover.moveLocationY(extrp, vy); } applyVerticalLimit(); }
[ "private", "void", "checkVerticalLimit", "(", "double", "extrp", ",", "double", "vy", ")", "{", "// Inside interval", "if", "(", "mover", ".", "getY", "(", ")", ">=", "limitBottom", "&&", "mover", ".", "getY", "(", ")", "<=", "limitTop", "&&", "limitBottom", "!=", "Integer", ".", "MIN_VALUE", "&&", "limitTop", "!=", "Integer", ".", "MAX_VALUE", ")", "{", "offset", ".", "moveLocation", "(", "extrp", ",", "0", ",", "vy", ")", ";", "// Block offset on its limits", "if", "(", "offset", ".", "getY", "(", ")", "<", "-", "intervalVertical", ")", "{", "offset", ".", "teleportY", "(", "-", "intervalVertical", ")", ";", "}", "else", "if", "(", "offset", ".", "getY", "(", ")", ">", "intervalVertical", ")", "{", "offset", ".", "teleportY", "(", "intervalVertical", ")", ";", "}", "}", "// Outside interval", "if", "(", "(", "int", ")", "offset", ".", "getY", "(", ")", "==", "-", "intervalVertical", "||", "(", "int", ")", "offset", ".", "getY", "(", ")", "==", "intervalVertical", ")", "{", "mover", ".", "moveLocationY", "(", "extrp", ",", "vy", ")", ";", "}", "applyVerticalLimit", "(", ")", ";", "}" ]
Check vertical limit on move. @param extrp The extrapolation value. @param vy The vertical movement.
[ "Check", "vertical", "limit", "on", "move", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Camera.java#L349-L375
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.groupReduceOnEdges
public <T> DataSet<T> groupReduceOnEdges(EdgesFunction<K, EV, T> edgesFunction, EdgeDirection direction) throws IllegalArgumentException { """ Groups by vertex and computes a GroupReduce transformation over the edge values of each vertex. The edgesFunction applied on the edges only has access to the vertex id (not the vertex value) of the grouping vertex. <p>For each vertex, the edgesFunction can iterate over all edges of this vertex with the specified direction, and emit any number of output elements, including none. @param edgesFunction the group reduce function to apply to the neighboring edges of each vertex. @param direction the edge direction (in-, out-, all-). @param <T> the output type @return a DataSet containing elements of type T @throws IllegalArgumentException """ TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0); TypeInformation<EV> edgeValueType = ((TupleTypeInfo<?>) edges.getType()).getTypeAt(2); TypeInformation<T> returnType = TypeExtractor.createTypeInfo(EdgesFunction.class, edgesFunction.getClass(), 2, keyType, edgeValueType); return groupReduceOnEdges(edgesFunction, direction, returnType); }
java
public <T> DataSet<T> groupReduceOnEdges(EdgesFunction<K, EV, T> edgesFunction, EdgeDirection direction) throws IllegalArgumentException { TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0); TypeInformation<EV> edgeValueType = ((TupleTypeInfo<?>) edges.getType()).getTypeAt(2); TypeInformation<T> returnType = TypeExtractor.createTypeInfo(EdgesFunction.class, edgesFunction.getClass(), 2, keyType, edgeValueType); return groupReduceOnEdges(edgesFunction, direction, returnType); }
[ "public", "<", "T", ">", "DataSet", "<", "T", ">", "groupReduceOnEdges", "(", "EdgesFunction", "<", "K", ",", "EV", ",", "T", ">", "edgesFunction", ",", "EdgeDirection", "direction", ")", "throws", "IllegalArgumentException", "{", "TypeInformation", "<", "K", ">", "keyType", "=", "(", "(", "TupleTypeInfo", "<", "?", ">", ")", "vertices", ".", "getType", "(", ")", ")", ".", "getTypeAt", "(", "0", ")", ";", "TypeInformation", "<", "EV", ">", "edgeValueType", "=", "(", "(", "TupleTypeInfo", "<", "?", ">", ")", "edges", ".", "getType", "(", ")", ")", ".", "getTypeAt", "(", "2", ")", ";", "TypeInformation", "<", "T", ">", "returnType", "=", "TypeExtractor", ".", "createTypeInfo", "(", "EdgesFunction", ".", "class", ",", "edgesFunction", ".", "getClass", "(", ")", ",", "2", ",", "keyType", ",", "edgeValueType", ")", ";", "return", "groupReduceOnEdges", "(", "edgesFunction", ",", "direction", ",", "returnType", ")", ";", "}" ]
Groups by vertex and computes a GroupReduce transformation over the edge values of each vertex. The edgesFunction applied on the edges only has access to the vertex id (not the vertex value) of the grouping vertex. <p>For each vertex, the edgesFunction can iterate over all edges of this vertex with the specified direction, and emit any number of output elements, including none. @param edgesFunction the group reduce function to apply to the neighboring edges of each vertex. @param direction the edge direction (in-, out-, all-). @param <T> the output type @return a DataSet containing elements of type T @throws IllegalArgumentException
[ "Groups", "by", "vertex", "and", "computes", "a", "GroupReduce", "transformation", "over", "the", "edge", "values", "of", "each", "vertex", ".", "The", "edgesFunction", "applied", "on", "the", "edges", "only", "has", "access", "to", "the", "vertex", "id", "(", "not", "the", "vertex", "value", ")", "of", "the", "grouping", "vertex", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L1077-L1086
JRebirth/JRebirth
org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java
AbstractSlideModel.buildScaleAnimation
private Animation buildScaleAnimation(final double from, final double to, final boolean show) { """ Build a scaling animation. @param from scale ratio used as from value @param to scale ratio used as to value @param show if true a fade in transition will be performed, otherwise fade out @return a scale animation """ return ParallelTransitionBuilder.create() .children( ScaleTransitionBuilder.create() .node(node()) .fromX(from) .toX(to) .fromY(from) .toY(to) .duration(Duration.seconds(1)) .build(), FadeTransitionBuilder.create() .node(node()) .fromValue(show ? 0.0 : 1.0) .toValue(show ? 1.0 : 0.0) .duration(Duration.seconds(1)) .build()) .build(); }
java
private Animation buildScaleAnimation(final double from, final double to, final boolean show) { return ParallelTransitionBuilder.create() .children( ScaleTransitionBuilder.create() .node(node()) .fromX(from) .toX(to) .fromY(from) .toY(to) .duration(Duration.seconds(1)) .build(), FadeTransitionBuilder.create() .node(node()) .fromValue(show ? 0.0 : 1.0) .toValue(show ? 1.0 : 0.0) .duration(Duration.seconds(1)) .build()) .build(); }
[ "private", "Animation", "buildScaleAnimation", "(", "final", "double", "from", ",", "final", "double", "to", ",", "final", "boolean", "show", ")", "{", "return", "ParallelTransitionBuilder", ".", "create", "(", ")", ".", "children", "(", "ScaleTransitionBuilder", ".", "create", "(", ")", ".", "node", "(", "node", "(", ")", ")", ".", "fromX", "(", "from", ")", ".", "toX", "(", "to", ")", ".", "fromY", "(", "from", ")", ".", "toY", "(", "to", ")", ".", "duration", "(", "Duration", ".", "seconds", "(", "1", ")", ")", ".", "build", "(", ")", ",", "FadeTransitionBuilder", ".", "create", "(", ")", ".", "node", "(", "node", "(", ")", ")", ".", "fromValue", "(", "show", "?", "0.0", ":", "1.0", ")", ".", "toValue", "(", "show", "?", "1.0", ":", "0.0", ")", ".", "duration", "(", "Duration", ".", "seconds", "(", "1", ")", ")", ".", "build", "(", ")", ")", ".", "build", "(", ")", ";", "}" ]
Build a scaling animation. @param from scale ratio used as from value @param to scale ratio used as to value @param show if true a fade in transition will be performed, otherwise fade out @return a scale animation
[ "Build", "a", "scaling", "animation", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/presentation/src/main/java/org/jrebirth/af/presentation/ui/base/AbstractSlideModel.java#L463-L483
telly/groundy
library/src/main/java/com/telly/groundy/Groundy.java
Groundy.arg
public Groundy arg(String key, Serializable value) { """ Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Serializable object, or null """ mArgs.putSerializable(key, value); return this; }
java
public Groundy arg(String key, Serializable value) { mArgs.putSerializable(key, value); return this; }
[ "public", "Groundy", "arg", "(", "String", "key", ",", "Serializable", "value", ")", "{", "mArgs", ".", "putSerializable", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a Serializable value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a Serializable object, or null
[ "Inserts", "a", "Serializable", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/Groundy.java#L596-L599
infinispan/infinispan
counter/src/main/java/org/infinispan/counter/impl/listener/CounterManagerNotificationManager.java
CounterManagerNotificationManager.listenOn
public synchronized void listenOn(Cache<CounterKey, CounterValue> cache) throws InterruptedException { """ It registers the cache listeners if they aren't already registered. @param cache The {@link Cache} to register the listener. """ if (!topologyListener.registered) { this.cache = cache; topologyListener.register(cache); } if (!listenersRegistered) { this.cache.addListener(valueListener, CounterKeyFilter.getInstance()); listenersRegistered = true; } }
java
public synchronized void listenOn(Cache<CounterKey, CounterValue> cache) throws InterruptedException { if (!topologyListener.registered) { this.cache = cache; topologyListener.register(cache); } if (!listenersRegistered) { this.cache.addListener(valueListener, CounterKeyFilter.getInstance()); listenersRegistered = true; } }
[ "public", "synchronized", "void", "listenOn", "(", "Cache", "<", "CounterKey", ",", "CounterValue", ">", "cache", ")", "throws", "InterruptedException", "{", "if", "(", "!", "topologyListener", ".", "registered", ")", "{", "this", ".", "cache", "=", "cache", ";", "topologyListener", ".", "register", "(", "cache", ")", ";", "}", "if", "(", "!", "listenersRegistered", ")", "{", "this", ".", "cache", ".", "addListener", "(", "valueListener", ",", "CounterKeyFilter", ".", "getInstance", "(", ")", ")", ";", "listenersRegistered", "=", "true", ";", "}", "}" ]
It registers the cache listeners if they aren't already registered. @param cache The {@link Cache} to register the listener.
[ "It", "registers", "the", "cache", "listeners", "if", "they", "aren", "t", "already", "registered", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/listener/CounterManagerNotificationManager.java#L114-L123
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java
KnowledgeExchangeHandler.getLong
protected Long getLong(Exchange exchange, Message message, String name) { """ Gets a Long context property. @param exchange the exchange @param message the message @param name the name @return the property """ Object value = getObject(exchange, message, name); if (value instanceof Long) { return (Long)value; } else if (value instanceof Number) { return Long.valueOf(((Number)value).longValue()); } else if (value instanceof String) { return Long.valueOf(((String)value).trim()); } return null; }
java
protected Long getLong(Exchange exchange, Message message, String name) { Object value = getObject(exchange, message, name); if (value instanceof Long) { return (Long)value; } else if (value instanceof Number) { return Long.valueOf(((Number)value).longValue()); } else if (value instanceof String) { return Long.valueOf(((String)value).trim()); } return null; }
[ "protected", "Long", "getLong", "(", "Exchange", "exchange", ",", "Message", "message", ",", "String", "name", ")", "{", "Object", "value", "=", "getObject", "(", "exchange", ",", "message", ",", "name", ")", ";", "if", "(", "value", "instanceof", "Long", ")", "{", "return", "(", "Long", ")", "value", ";", "}", "else", "if", "(", "value", "instanceof", "Number", ")", "{", "return", "Long", ".", "valueOf", "(", "(", "(", "Number", ")", "value", ")", ".", "longValue", "(", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "String", ")", "{", "return", "Long", ".", "valueOf", "(", "(", "(", "String", ")", "value", ")", ".", "trim", "(", ")", ")", ";", "}", "return", "null", ";", "}" ]
Gets a Long context property. @param exchange the exchange @param message the message @param name the name @return the property
[ "Gets", "a", "Long", "context", "property", "." ]
train
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java#L220-L230
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java
JavaUtils.getAnnotation
public static <A extends Annotation> A getAnnotation(final AnnotatedElement annotatedElement, final Class<A> annotationClass) { """ Returns the annotation or {@code null} if the element is not annotated with that type. <b>Note:</b> This step is necessary due to issues with external class loaders (e.g. Maven). The classes may not be identical and are therefore compared by FQ class name. """ final Optional<Annotation> annotation = Stream.of(annotatedElement.getAnnotations()) .filter(a -> a.annotationType().getName().equals(annotationClass.getName())) .findAny(); return (A) annotation.orElse(null); }
java
public static <A extends Annotation> A getAnnotation(final AnnotatedElement annotatedElement, final Class<A> annotationClass) { final Optional<Annotation> annotation = Stream.of(annotatedElement.getAnnotations()) .filter(a -> a.annotationType().getName().equals(annotationClass.getName())) .findAny(); return (A) annotation.orElse(null); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getAnnotation", "(", "final", "AnnotatedElement", "annotatedElement", ",", "final", "Class", "<", "A", ">", "annotationClass", ")", "{", "final", "Optional", "<", "Annotation", ">", "annotation", "=", "Stream", ".", "of", "(", "annotatedElement", ".", "getAnnotations", "(", ")", ")", ".", "filter", "(", "a", "->", "a", ".", "annotationType", "(", ")", ".", "getName", "(", ")", ".", "equals", "(", "annotationClass", ".", "getName", "(", ")", ")", ")", ".", "findAny", "(", ")", ";", "return", "(", "A", ")", "annotation", ".", "orElse", "(", "null", ")", ";", "}" ]
Returns the annotation or {@code null} if the element is not annotated with that type. <b>Note:</b> This step is necessary due to issues with external class loaders (e.g. Maven). The classes may not be identical and are therefore compared by FQ class name.
[ "Returns", "the", "annotation", "or", "{" ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/model/JavaUtils.java#L66-L71
ologolo/streamline-api
src/org/daisy/streamline/api/tasks/TaskGroupInformation.java
TaskGroupInformation.newConvertBuilder
public static Builder newConvertBuilder(String input, String output) { """ Creates a new builder of convert type with the specified parameters. @param input the input format @param output the output format @return returns a new builder """ return new Builder(input, output, TaskGroupActivity.CONVERT); }
java
public static Builder newConvertBuilder(String input, String output) { return new Builder(input, output, TaskGroupActivity.CONVERT); }
[ "public", "static", "Builder", "newConvertBuilder", "(", "String", "input", ",", "String", "output", ")", "{", "return", "new", "Builder", "(", "input", ",", "output", ",", "TaskGroupActivity", ".", "CONVERT", ")", ";", "}" ]
Creates a new builder of convert type with the specified parameters. @param input the input format @param output the output format @return returns a new builder
[ "Creates", "a", "new", "builder", "of", "convert", "type", "with", "the", "specified", "parameters", "." ]
train
https://github.com/ologolo/streamline-api/blob/4934b6da1de06e364ae90d6ea9b0929500da9cdb/src/org/daisy/streamline/api/tasks/TaskGroupInformation.java#L123-L125
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.putShapeForVarName
@Deprecated public void putShapeForVarName(String varName, long[] shape) { """ Associate a vertex id with the given shape. @param varName the vertex id to associate @param shape the shape to associate with @see #putShapeForVarName(String, long[]) @see #putOrUpdateShapeForVarName(String, long[], boolean) """ if (shape == null) { throw new ND4JIllegalStateException("Shape must not be null!"); } if (variableNameToShape.containsKey(varName)) { throw new ND4JIllegalStateException("Shape for " + varName + " already exists!"); } variableNameToShape.put(varName, shape); }
java
@Deprecated public void putShapeForVarName(String varName, long[] shape) { if (shape == null) { throw new ND4JIllegalStateException("Shape must not be null!"); } if (variableNameToShape.containsKey(varName)) { throw new ND4JIllegalStateException("Shape for " + varName + " already exists!"); } variableNameToShape.put(varName, shape); }
[ "@", "Deprecated", "public", "void", "putShapeForVarName", "(", "String", "varName", ",", "long", "[", "]", "shape", ")", "{", "if", "(", "shape", "==", "null", ")", "{", "throw", "new", "ND4JIllegalStateException", "(", "\"Shape must not be null!\"", ")", ";", "}", "if", "(", "variableNameToShape", ".", "containsKey", "(", "varName", ")", ")", "{", "throw", "new", "ND4JIllegalStateException", "(", "\"Shape for \"", "+", "varName", "+", "\" already exists!\"", ")", ";", "}", "variableNameToShape", ".", "put", "(", "varName", ",", "shape", ")", ";", "}" ]
Associate a vertex id with the given shape. @param varName the vertex id to associate @param shape the shape to associate with @see #putShapeForVarName(String, long[]) @see #putOrUpdateShapeForVarName(String, long[], boolean)
[ "Associate", "a", "vertex", "id", "with", "the", "given", "shape", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L661-L672
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/ExceptionUtils.java
ExceptionUtils.stackTrace
public static String stackTrace( Throwable t, String separator ) { """ <p>stackTrace.</p> @param t a {@link java.lang.Throwable} object. @param separator a {@link java.lang.String} object. @return a {@link java.lang.String} object. """ return stackTrace( t, separator, FULL); }
java
public static String stackTrace( Throwable t, String separator ) { return stackTrace( t, separator, FULL); }
[ "public", "static", "String", "stackTrace", "(", "Throwable", "t", ",", "String", "separator", ")", "{", "return", "stackTrace", "(", "t", ",", "separator", ",", "FULL", ")", ";", "}" ]
<p>stackTrace.</p> @param t a {@link java.lang.Throwable} object. @param separator a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "stackTrace", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/ExceptionUtils.java#L47-L50
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orNotIn
public ZealotKhala orNotIn(String field, Collection<?> values) { """ 生成带" OR "前缀的" NOT IN "范围查询的SQL片段. @param field 数据库字段 @param values 集合的值 @return ZealotKhala实例 """ return this.doIn(ZealotConst.OR_PREFIX, field, values, true, false); }
java
public ZealotKhala orNotIn(String field, Collection<?> values) { return this.doIn(ZealotConst.OR_PREFIX, field, values, true, false); }
[ "public", "ZealotKhala", "orNotIn", "(", "String", "field", ",", "Collection", "<", "?", ">", "values", ")", "{", "return", "this", ".", "doIn", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "values", ",", "true", ",", "false", ")", ";", "}" ]
生成带" OR "前缀的" NOT IN "范围查询的SQL片段. @param field 数据库字段 @param values 集合的值 @return ZealotKhala实例
[ "生成带", "OR", "前缀的", "NOT", "IN", "范围查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1494-L1496
Axway/Grapes
server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java
ArtifactResource.updateProvider
@POST @Path("/ { """ Update an artifact download url. This method is call via GET <grapes_url>/artifact/<gavc>/downloadurl?url=<targetUrl> """gavc}" + ServerAPI.GET_PROVIDER) public Response updateProvider(@Auth final DbCredential credential, @PathParam("gavc") final String gavc, @QueryParam(ServerAPI.PROVIDER_PARAM) final String provider){ if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } if(LOG.isInfoEnabled()) { LOG.info(String.format("Got an update downloadUrl request [%s] [%s]", gavc, provider)); } if(gavc == null || provider == null){ return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build(); } getArtifactHandler().updateProvider(gavc, provider); return Response.ok("done").build(); }
java
@POST @Path("/{gavc}" + ServerAPI.GET_PROVIDER) public Response updateProvider(@Auth final DbCredential credential, @PathParam("gavc") final String gavc, @QueryParam(ServerAPI.PROVIDER_PARAM) final String provider){ if(!credential.getRoles().contains(AvailableRoles.DATA_UPDATER)){ throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build()); } if(LOG.isInfoEnabled()) { LOG.info(String.format("Got an update downloadUrl request [%s] [%s]", gavc, provider)); } if(gavc == null || provider == null){ return Response.serverError().status(HttpStatus.NOT_ACCEPTABLE_406).build(); } getArtifactHandler().updateProvider(gavc, provider); return Response.ok("done").build(); }
[ "@", "POST", "@", "Path", "(", "\"/{gavc}\"", "+", "ServerAPI", ".", "GET_PROVIDER", ")", "public", "Response", "updateProvider", "(", "@", "Auth", "final", "DbCredential", "credential", ",", "@", "PathParam", "(", "\"gavc\"", ")", "final", "String", "gavc", ",", "@", "QueryParam", "(", "ServerAPI", ".", "PROVIDER_PARAM", ")", "final", "String", "provider", ")", "{", "if", "(", "!", "credential", ".", "getRoles", "(", ")", ".", "contains", "(", "AvailableRoles", ".", "DATA_UPDATER", ")", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "status", "(", "Response", ".", "Status", ".", "UNAUTHORIZED", ")", ".", "build", "(", ")", ")", ";", "}", "if", "(", "LOG", ".", "isInfoEnabled", "(", ")", ")", "{", "LOG", ".", "info", "(", "String", ".", "format", "(", "\"Got an update downloadUrl request [%s] [%s]\"", ",", "gavc", ",", "provider", ")", ")", ";", "}", "if", "(", "gavc", "==", "null", "||", "provider", "==", "null", ")", "{", "return", "Response", ".", "serverError", "(", ")", ".", "status", "(", "HttpStatus", ".", "NOT_ACCEPTABLE_406", ")", ".", "build", "(", ")", ";", "}", "getArtifactHandler", "(", ")", ".", "updateProvider", "(", "gavc", ",", "provider", ")", ";", "return", "Response", ".", "ok", "(", "\"done\"", ")", ".", "build", "(", ")", ";", "}" ]
Update an artifact download url. This method is call via GET <grapes_url>/artifact/<gavc>/downloadurl?url=<targetUrl>
[ "Update", "an", "artifact", "download", "url", ".", "This", "method", "is", "call", "via", "GET", "<grapes_url", ">", "/", "artifact", "/", "<gavc", ">", "/", "downloadurl?url", "=", "<targetUrl", ">" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java#L354-L372
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/cdn/CdnClient.java
CdnClient.disableDomain
public DisableDomainResponse disableDomain(DisableDomainRequest request) { """ Disable an existing domain acceleration. @param request The request containing user-defined domain information. @return Result of the disableDomain operation returned by the service. """ checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(request, HttpMethodName.POST, DOMAIN, request.getDomain()); internalRequest.addParameter("disable", ""); return invokeHttpClient(internalRequest, DisableDomainResponse.class); }
java
public DisableDomainResponse disableDomain(DisableDomainRequest request) { checkNotNull(request, "The parameter request should NOT be null."); InternalRequest internalRequest = createRequest(request, HttpMethodName.POST, DOMAIN, request.getDomain()); internalRequest.addParameter("disable", ""); return invokeHttpClient(internalRequest, DisableDomainResponse.class); }
[ "public", "DisableDomainResponse", "disableDomain", "(", "DisableDomainRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "request", ",", "HttpMethodName", ".", "POST", ",", "DOMAIN", ",", "request", ".", "getDomain", "(", ")", ")", ";", "internalRequest", ".", "addParameter", "(", "\"disable\"", ",", "\"\"", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "DisableDomainResponse", ".", "class", ")", ";", "}" ]
Disable an existing domain acceleration. @param request The request containing user-defined domain information. @return Result of the disableDomain operation returned by the service.
[ "Disable", "an", "existing", "domain", "acceleration", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L226-L231
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQueryInterpreter.java
CouchDBQueryInterpreter.setKeyValues
public void setKeyValues(String keyName, Object obj) { """ Sets the key values. @param keyName the key name @param obj the obj """ if (this.keyValues == null) { this.keyValues = new HashMap<String, Object>(); } this.keyValues.put(keyName, obj); }
java
public void setKeyValues(String keyName, Object obj) { if (this.keyValues == null) { this.keyValues = new HashMap<String, Object>(); } this.keyValues.put(keyName, obj); }
[ "public", "void", "setKeyValues", "(", "String", "keyName", ",", "Object", "obj", ")", "{", "if", "(", "this", ".", "keyValues", "==", "null", ")", "{", "this", ".", "keyValues", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "}", "this", ".", "keyValues", ".", "put", "(", "keyName", ",", "obj", ")", ";", "}" ]
Sets the key values. @param keyName the key name @param obj the obj
[ "Sets", "the", "key", "values", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQueryInterpreter.java#L290-L297
eFaps/eFaps-Kernel
src/main/java/org/efaps/jaas/LoginHandler.java
LoginHandler.checkLogin
public Person checkLogin(final String _name, final String _passwd) { """ The instance method checks if for the given user the password is correct. The test itself is done with the JAAS module from Java.<br/> If a person is found and successfully logged in, the last login information from the person is updated to current time stamp. @param _name name of the person name to check @param _passwd password of the person to check @return found person @see #getPerson(LoginContext) @see #createPerson(LoginContext) @see #updatePerson(LoginContext, Person) @see #updateRoles(LoginContext, Person) @see #updateGroups(LoginContext, Person) """ Person person = null; try { final LoginCallbackHandler callback = new LoginCallbackHandler(ActionCallback.Mode.LOGIN, _name, _passwd); final LoginContext login = new LoginContext(getApplicationName(), callback); login.login(); person = getPerson(login); if (person == null) { person = createPerson(login); } if (person != null) { updatePerson(login, person); person.cleanUp(); updateRoles(login, person); updateGroups(login, person); updateCompanies(login, person); person.updateLastLogin(); } } catch (final EFapsException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } catch (final LoginException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } return person; }
java
public Person checkLogin(final String _name, final String _passwd) { Person person = null; try { final LoginCallbackHandler callback = new LoginCallbackHandler(ActionCallback.Mode.LOGIN, _name, _passwd); final LoginContext login = new LoginContext(getApplicationName(), callback); login.login(); person = getPerson(login); if (person == null) { person = createPerson(login); } if (person != null) { updatePerson(login, person); person.cleanUp(); updateRoles(login, person); updateGroups(login, person); updateCompanies(login, person); person.updateLastLogin(); } } catch (final EFapsException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } catch (final LoginException e) { LoginHandler.LOG.error("login failed for '" + _name + "'", e); } return person; }
[ "public", "Person", "checkLogin", "(", "final", "String", "_name", ",", "final", "String", "_passwd", ")", "{", "Person", "person", "=", "null", ";", "try", "{", "final", "LoginCallbackHandler", "callback", "=", "new", "LoginCallbackHandler", "(", "ActionCallback", ".", "Mode", ".", "LOGIN", ",", "_name", ",", "_passwd", ")", ";", "final", "LoginContext", "login", "=", "new", "LoginContext", "(", "getApplicationName", "(", ")", ",", "callback", ")", ";", "login", ".", "login", "(", ")", ";", "person", "=", "getPerson", "(", "login", ")", ";", "if", "(", "person", "==", "null", ")", "{", "person", "=", "createPerson", "(", "login", ")", ";", "}", "if", "(", "person", "!=", "null", ")", "{", "updatePerson", "(", "login", ",", "person", ")", ";", "person", ".", "cleanUp", "(", ")", ";", "updateRoles", "(", "login", ",", "person", ")", ";", "updateGroups", "(", "login", ",", "person", ")", ";", "updateCompanies", "(", "login", ",", "person", ")", ";", "person", ".", "updateLastLogin", "(", ")", ";", "}", "}", "catch", "(", "final", "EFapsException", "e", ")", "{", "LoginHandler", ".", "LOG", ".", "error", "(", "\"login failed for '\"", "+", "_name", "+", "\"'\"", ",", "e", ")", ";", "}", "catch", "(", "final", "LoginException", "e", ")", "{", "LoginHandler", ".", "LOG", ".", "error", "(", "\"login failed for '\"", "+", "_name", "+", "\"'\"", ",", "e", ")", ";", "}", "return", "person", ";", "}" ]
The instance method checks if for the given user the password is correct. The test itself is done with the JAAS module from Java.<br/> If a person is found and successfully logged in, the last login information from the person is updated to current time stamp. @param _name name of the person name to check @param _passwd password of the person to check @return found person @see #getPerson(LoginContext) @see #createPerson(LoginContext) @see #updatePerson(LoginContext, Person) @see #updateRoles(LoginContext, Person) @see #updateGroups(LoginContext, Person)
[ "The", "instance", "method", "checks", "if", "for", "the", "given", "user", "the", "password", "is", "correct", ".", "The", "test", "itself", "is", "done", "with", "the", "JAAS", "module", "from", "Java", ".", "<br", "/", ">", "If", "a", "person", "is", "found", "and", "successfully", "logged", "in", "the", "last", "login", "information", "from", "the", "person", "is", "updated", "to", "current", "time", "stamp", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/jaas/LoginHandler.java#L97-L129
apache/groovy
src/main/groovy/groovy/util/FactoryBuilderSupport.java
FactoryBuilderSupport.handleNodeAttributes
protected void handleNodeAttributes(Object node, Map attributes) { """ Assigns any existing properties to the node.<br> It will call attributeDelegates before passing control to the factory that built the node. @param node the object returned by tne node factory @param attributes the attributes for the node """ // first, short circuit if (node == null) { return; } for (Closure attrDelegate : getProxyBuilder().getAttributeDelegates()) { FactoryBuilderSupport builder = this; if (attrDelegate.getOwner() instanceof FactoryBuilderSupport) { builder = (FactoryBuilderSupport) attrDelegate.getOwner(); } else if (attrDelegate.getDelegate() instanceof FactoryBuilderSupport) { builder = (FactoryBuilderSupport) attrDelegate.getDelegate(); } attrDelegate.call(builder, node, attributes); } if (getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(), node, attributes)) { getProxyBuilder().setNodeAttributes(node, attributes); } }
java
protected void handleNodeAttributes(Object node, Map attributes) { // first, short circuit if (node == null) { return; } for (Closure attrDelegate : getProxyBuilder().getAttributeDelegates()) { FactoryBuilderSupport builder = this; if (attrDelegate.getOwner() instanceof FactoryBuilderSupport) { builder = (FactoryBuilderSupport) attrDelegate.getOwner(); } else if (attrDelegate.getDelegate() instanceof FactoryBuilderSupport) { builder = (FactoryBuilderSupport) attrDelegate.getDelegate(); } attrDelegate.call(builder, node, attributes); } if (getProxyBuilder().getCurrentFactory().onHandleNodeAttributes(getProxyBuilder().getChildBuilder(), node, attributes)) { getProxyBuilder().setNodeAttributes(node, attributes); } }
[ "protected", "void", "handleNodeAttributes", "(", "Object", "node", ",", "Map", "attributes", ")", "{", "// first, short circuit", "if", "(", "node", "==", "null", ")", "{", "return", ";", "}", "for", "(", "Closure", "attrDelegate", ":", "getProxyBuilder", "(", ")", ".", "getAttributeDelegates", "(", ")", ")", "{", "FactoryBuilderSupport", "builder", "=", "this", ";", "if", "(", "attrDelegate", ".", "getOwner", "(", ")", "instanceof", "FactoryBuilderSupport", ")", "{", "builder", "=", "(", "FactoryBuilderSupport", ")", "attrDelegate", ".", "getOwner", "(", ")", ";", "}", "else", "if", "(", "attrDelegate", ".", "getDelegate", "(", ")", "instanceof", "FactoryBuilderSupport", ")", "{", "builder", "=", "(", "FactoryBuilderSupport", ")", "attrDelegate", ".", "getDelegate", "(", ")", ";", "}", "attrDelegate", ".", "call", "(", "builder", ",", "node", ",", "attributes", ")", ";", "}", "if", "(", "getProxyBuilder", "(", ")", ".", "getCurrentFactory", "(", ")", ".", "onHandleNodeAttributes", "(", "getProxyBuilder", "(", ")", ".", "getChildBuilder", "(", ")", ",", "node", ",", "attributes", ")", ")", "{", "getProxyBuilder", "(", ")", ".", "setNodeAttributes", "(", "node", ",", "attributes", ")", ";", "}", "}" ]
Assigns any existing properties to the node.<br> It will call attributeDelegates before passing control to the factory that built the node. @param node the object returned by tne node factory @param attributes the attributes for the node
[ "Assigns", "any", "existing", "properties", "to", "the", "node", ".", "<br", ">", "It", "will", "call", "attributeDelegates", "before", "passing", "control", "to", "the", "factory", "that", "built", "the", "node", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L968-L988
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/restore/CmsRestoreDialog.java
CmsRestoreDialog.loadAndShow
public void loadAndShow() { """ Loads the necessary data for the dialog from the server and shows the dialog.<p> """ CmsRpcAction<CmsRestoreInfoBean> action = new CmsRpcAction<CmsRestoreInfoBean>() { @Override public void execute() { start(0, true); CmsCoreProvider.getVfsService().getRestoreInfo(m_structureId, this); } @Override protected void onResponse(CmsRestoreInfoBean result) { stop(false); m_restoreView = new CmsRestoreView(result, m_afterRestoreAction); m_restoreView.setPopup(CmsRestoreDialog.this); setMainContent(m_restoreView); List<CmsPushButton> buttons = m_restoreView.getDialogButtons(); for (CmsPushButton button : buttons) { addButton(button); } center(); } }; action.execute(); }
java
public void loadAndShow() { CmsRpcAction<CmsRestoreInfoBean> action = new CmsRpcAction<CmsRestoreInfoBean>() { @Override public void execute() { start(0, true); CmsCoreProvider.getVfsService().getRestoreInfo(m_structureId, this); } @Override protected void onResponse(CmsRestoreInfoBean result) { stop(false); m_restoreView = new CmsRestoreView(result, m_afterRestoreAction); m_restoreView.setPopup(CmsRestoreDialog.this); setMainContent(m_restoreView); List<CmsPushButton> buttons = m_restoreView.getDialogButtons(); for (CmsPushButton button : buttons) { addButton(button); } center(); } }; action.execute(); }
[ "public", "void", "loadAndShow", "(", ")", "{", "CmsRpcAction", "<", "CmsRestoreInfoBean", ">", "action", "=", "new", "CmsRpcAction", "<", "CmsRestoreInfoBean", ">", "(", ")", "{", "@", "Override", "public", "void", "execute", "(", ")", "{", "start", "(", "0", ",", "true", ")", ";", "CmsCoreProvider", ".", "getVfsService", "(", ")", ".", "getRestoreInfo", "(", "m_structureId", ",", "this", ")", ";", "}", "@", "Override", "protected", "void", "onResponse", "(", "CmsRestoreInfoBean", "result", ")", "{", "stop", "(", "false", ")", ";", "m_restoreView", "=", "new", "CmsRestoreView", "(", "result", ",", "m_afterRestoreAction", ")", ";", "m_restoreView", ".", "setPopup", "(", "CmsRestoreDialog", ".", "this", ")", ";", "setMainContent", "(", "m_restoreView", ")", ";", "List", "<", "CmsPushButton", ">", "buttons", "=", "m_restoreView", ".", "getDialogButtons", "(", ")", ";", "for", "(", "CmsPushButton", "button", ":", "buttons", ")", "{", "addButton", "(", "button", ")", ";", "}", "center", "(", ")", ";", "}", "}", ";", "action", ".", "execute", "(", ")", ";", "}" ]
Loads the necessary data for the dialog from the server and shows the dialog.<p>
[ "Loads", "the", "necessary", "data", "for", "the", "dialog", "from", "the", "server", "and", "shows", "the", "dialog", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/restore/CmsRestoreDialog.java#L71-L97
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.cascadeDeleteFor
private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared) { """ Walk through the object graph of the specified delete object. Was used for recursive object graph walk. """ // avoid endless recursion if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeDeleteSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared); }
java
private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeDeleteSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared); }
[ "private", "void", "cascadeDeleteFor", "(", "ObjectEnvelope", "mod", ",", "List", "alreadyPrepared", ")", "{", "// avoid endless recursion\r", "if", "(", "alreadyPrepared", ".", "contains", "(", "mod", ".", "getIdentity", "(", ")", ")", ")", "return", ";", "alreadyPrepared", ".", "add", "(", "mod", ".", "getIdentity", "(", ")", ")", ";", "ClassDescriptor", "cld", "=", "getTransaction", "(", ")", ".", "getBroker", "(", ")", ".", "getClassDescriptor", "(", "mod", ".", "getObject", "(", ")", ".", "getClass", "(", ")", ")", ";", "List", "refs", "=", "cld", ".", "getObjectReferenceDescriptors", "(", "true", ")", ";", "cascadeDeleteSingleReferences", "(", "mod", ",", "refs", ",", "alreadyPrepared", ")", ";", "List", "colls", "=", "cld", ".", "getCollectionDescriptors", "(", "true", ")", ";", "cascadeDeleteCollectionReferences", "(", "mod", ",", "colls", ",", "alreadyPrepared", ")", ";", "}" ]
Walk through the object graph of the specified delete object. Was used for recursive object graph walk.
[ "Walk", "through", "the", "object", "graph", "of", "the", "specified", "delete", "object", ".", "Was", "used", "for", "recursive", "object", "graph", "walk", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L698-L712
jayantk/jklol
src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java
HeadedSyntacticCategory.getCanonicalForm
public HeadedSyntacticCategory getCanonicalForm(Map<Integer, Integer> relabeling) { """ Gets a canonical representation of this category that treats each variable number as an equivalence class. The canonical form relabels variables in the category such that all categories with the same variable equivalence relations have the same canonical form. @param relabeling the relabeling applied to variables in this to produce the relabeled category. @return """ Preconditions.checkArgument(relabeling.size() == 0); int[] relabeledVariables = canonicalizeVariableArray(semanticVariables, relabeling); return new HeadedSyntacticCategory(syntacticCategory.getCanonicalForm(), relabeledVariables, rootIndex); }
java
public HeadedSyntacticCategory getCanonicalForm(Map<Integer, Integer> relabeling) { Preconditions.checkArgument(relabeling.size() == 0); int[] relabeledVariables = canonicalizeVariableArray(semanticVariables, relabeling); return new HeadedSyntacticCategory(syntacticCategory.getCanonicalForm(), relabeledVariables, rootIndex); }
[ "public", "HeadedSyntacticCategory", "getCanonicalForm", "(", "Map", "<", "Integer", ",", "Integer", ">", "relabeling", ")", "{", "Preconditions", ".", "checkArgument", "(", "relabeling", ".", "size", "(", ")", "==", "0", ")", ";", "int", "[", "]", "relabeledVariables", "=", "canonicalizeVariableArray", "(", "semanticVariables", ",", "relabeling", ")", ";", "return", "new", "HeadedSyntacticCategory", "(", "syntacticCategory", ".", "getCanonicalForm", "(", ")", ",", "relabeledVariables", ",", "rootIndex", ")", ";", "}" ]
Gets a canonical representation of this category that treats each variable number as an equivalence class. The canonical form relabels variables in the category such that all categories with the same variable equivalence relations have the same canonical form. @param relabeling the relabeling applied to variables in this to produce the relabeled category. @return
[ "Gets", "a", "canonical", "representation", "of", "this", "category", "that", "treats", "each", "variable", "number", "as", "an", "equivalence", "class", ".", "The", "canonical", "form", "relabels", "variables", "in", "the", "category", "such", "that", "all", "categories", "with", "the", "same", "variable", "equivalence", "relations", "have", "the", "same", "canonical", "form", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/HeadedSyntacticCategory.java#L217-L221
alkacon/opencms-core
src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java
CmsDefaultPublishResourceFormatter.createPublishResource
protected CmsPublishResource createPublishResource(CmsResource resource) throws CmsException { """ Creates a publish resource bean from a resource.<p> @param resource the resource @return the publish resource bean @throws CmsException if something goes wrong """ CmsResourceUtil resUtil = new CmsResourceUtil(m_cms, resource); CmsPermissionInfo permissionInfo = OpenCms.getADEManager().getPermissionInfo(m_cms, resource, null); String typeName = CmsIconUtil.getDisplayType(m_cms, resource); String detailTypeName = CmsResourceIcon.getDefaultFileOrDetailType(m_cms, resource); CmsPublishResource pubResource = new CmsPublishResource( resource.getStructureId(), resUtil.getFullPath(), resUtil.getTitle(), typeName, resource.getState(), permissionInfo, resource.getDateLastModified(), resUtil.getUserLastModified(), CmsVfsService.formatDateTime(m_cms, resource.getDateLastModified()), false, null, new ArrayList<CmsPublishResource>()); pubResource.setBigIconClasses(CmsIconUtil.getIconClasses(typeName, resource.getName(), false)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(detailTypeName)) { pubResource.setSmallIconClasses(CmsIconUtil.getIconClasses(detailTypeName, null, true)); } return pubResource; }
java
protected CmsPublishResource createPublishResource(CmsResource resource) throws CmsException { CmsResourceUtil resUtil = new CmsResourceUtil(m_cms, resource); CmsPermissionInfo permissionInfo = OpenCms.getADEManager().getPermissionInfo(m_cms, resource, null); String typeName = CmsIconUtil.getDisplayType(m_cms, resource); String detailTypeName = CmsResourceIcon.getDefaultFileOrDetailType(m_cms, resource); CmsPublishResource pubResource = new CmsPublishResource( resource.getStructureId(), resUtil.getFullPath(), resUtil.getTitle(), typeName, resource.getState(), permissionInfo, resource.getDateLastModified(), resUtil.getUserLastModified(), CmsVfsService.formatDateTime(m_cms, resource.getDateLastModified()), false, null, new ArrayList<CmsPublishResource>()); pubResource.setBigIconClasses(CmsIconUtil.getIconClasses(typeName, resource.getName(), false)); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(detailTypeName)) { pubResource.setSmallIconClasses(CmsIconUtil.getIconClasses(detailTypeName, null, true)); } return pubResource; }
[ "protected", "CmsPublishResource", "createPublishResource", "(", "CmsResource", "resource", ")", "throws", "CmsException", "{", "CmsResourceUtil", "resUtil", "=", "new", "CmsResourceUtil", "(", "m_cms", ",", "resource", ")", ";", "CmsPermissionInfo", "permissionInfo", "=", "OpenCms", ".", "getADEManager", "(", ")", ".", "getPermissionInfo", "(", "m_cms", ",", "resource", ",", "null", ")", ";", "String", "typeName", "=", "CmsIconUtil", ".", "getDisplayType", "(", "m_cms", ",", "resource", ")", ";", "String", "detailTypeName", "=", "CmsResourceIcon", ".", "getDefaultFileOrDetailType", "(", "m_cms", ",", "resource", ")", ";", "CmsPublishResource", "pubResource", "=", "new", "CmsPublishResource", "(", "resource", ".", "getStructureId", "(", ")", ",", "resUtil", ".", "getFullPath", "(", ")", ",", "resUtil", ".", "getTitle", "(", ")", ",", "typeName", ",", "resource", ".", "getState", "(", ")", ",", "permissionInfo", ",", "resource", ".", "getDateLastModified", "(", ")", ",", "resUtil", ".", "getUserLastModified", "(", ")", ",", "CmsVfsService", ".", "formatDateTime", "(", "m_cms", ",", "resource", ".", "getDateLastModified", "(", ")", ")", ",", "false", ",", "null", ",", "new", "ArrayList", "<", "CmsPublishResource", ">", "(", ")", ")", ";", "pubResource", ".", "setBigIconClasses", "(", "CmsIconUtil", ".", "getIconClasses", "(", "typeName", ",", "resource", ".", "getName", "(", ")", ",", "false", ")", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "detailTypeName", ")", ")", "{", "pubResource", ".", "setSmallIconClasses", "(", "CmsIconUtil", ".", "getIconClasses", "(", "detailTypeName", ",", "null", ",", "true", ")", ")", ";", "}", "return", "pubResource", ";", "}" ]
Creates a publish resource bean from a resource.<p> @param resource the resource @return the publish resource bean @throws CmsException if something goes wrong
[ "Creates", "a", "publish", "resource", "bean", "from", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsDefaultPublishResourceFormatter.java#L418-L443
molgenis/molgenis
molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java
RestService.toEntityValue
public Object toEntityValue(Attribute attr, Object paramValue, Object id) { """ Converts a HTTP request parameter to a entity value of which the type is defined by the attribute. For file attributes persists the file in the file store and persist a file meta data entity. @param attr attribute @param paramValue HTTP parameter value @return Object """ // Treat empty strings as null if ((paramValue instanceof String) && ((String) paramValue).isEmpty()) { paramValue = null; } Object value; AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: value = convertBool(attr, paramValue); break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: value = convertString(attr, paramValue); break; case CATEGORICAL: case XREF: value = convertRef(attr, paramValue); break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: value = convertMref(attr, paramValue); break; case DATE: value = convertDate(attr, paramValue); break; case DATE_TIME: value = convertDateTime(attr, paramValue); break; case DECIMAL: value = convertDecimal(attr, paramValue); break; case FILE: value = convertFile(attr, paramValue, id); break; case INT: value = convertInt(attr, paramValue); break; case LONG: value = convertLong(attr, paramValue); break; case COMPOUND: throw new IllegalAttributeTypeException(attrType); default: throw new UnexpectedEnumException(attrType); } return value; }
java
public Object toEntityValue(Attribute attr, Object paramValue, Object id) { // Treat empty strings as null if ((paramValue instanceof String) && ((String) paramValue).isEmpty()) { paramValue = null; } Object value; AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: value = convertBool(attr, paramValue); break; case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: value = convertString(attr, paramValue); break; case CATEGORICAL: case XREF: value = convertRef(attr, paramValue); break; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: value = convertMref(attr, paramValue); break; case DATE: value = convertDate(attr, paramValue); break; case DATE_TIME: value = convertDateTime(attr, paramValue); break; case DECIMAL: value = convertDecimal(attr, paramValue); break; case FILE: value = convertFile(attr, paramValue, id); break; case INT: value = convertInt(attr, paramValue); break; case LONG: value = convertLong(attr, paramValue); break; case COMPOUND: throw new IllegalAttributeTypeException(attrType); default: throw new UnexpectedEnumException(attrType); } return value; }
[ "public", "Object", "toEntityValue", "(", "Attribute", "attr", ",", "Object", "paramValue", ",", "Object", "id", ")", "{", "// Treat empty strings as null", "if", "(", "(", "paramValue", "instanceof", "String", ")", "&&", "(", "(", "String", ")", "paramValue", ")", ".", "isEmpty", "(", ")", ")", "{", "paramValue", "=", "null", ";", "}", "Object", "value", ";", "AttributeType", "attrType", "=", "attr", ".", "getDataType", "(", ")", ";", "switch", "(", "attrType", ")", "{", "case", "BOOL", ":", "value", "=", "convertBool", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "EMAIL", ":", "case", "ENUM", ":", "case", "HTML", ":", "case", "HYPERLINK", ":", "case", "SCRIPT", ":", "case", "STRING", ":", "case", "TEXT", ":", "value", "=", "convertString", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "CATEGORICAL", ":", "case", "XREF", ":", "value", "=", "convertRef", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "CATEGORICAL_MREF", ":", "case", "MREF", ":", "case", "ONE_TO_MANY", ":", "value", "=", "convertMref", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "DATE", ":", "value", "=", "convertDate", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "DATE_TIME", ":", "value", "=", "convertDateTime", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "DECIMAL", ":", "value", "=", "convertDecimal", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "FILE", ":", "value", "=", "convertFile", "(", "attr", ",", "paramValue", ",", "id", ")", ";", "break", ";", "case", "INT", ":", "value", "=", "convertInt", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "LONG", ":", "value", "=", "convertLong", "(", "attr", ",", "paramValue", ")", ";", "break", ";", "case", "COMPOUND", ":", "throw", "new", "IllegalAttributeTypeException", "(", "attrType", ")", ";", "default", ":", "throw", "new", "UnexpectedEnumException", "(", "attrType", ")", ";", "}", "return", "value", ";", "}" ]
Converts a HTTP request parameter to a entity value of which the type is defined by the attribute. For file attributes persists the file in the file store and persist a file meta data entity. @param attr attribute @param paramValue HTTP parameter value @return Object
[ "Converts", "a", "HTTP", "request", "parameter", "to", "a", "entity", "value", "of", "which", "the", "type", "is", "defined", "by", "the", "attribute", ".", "For", "file", "attributes", "persists", "the", "file", "in", "the", "file", "store", "and", "persist", "a", "file", "meta", "data", "entity", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/RestService.java#L113-L167
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseCookieUpdate
private void parseCookieUpdate(Map<Object, Object> props) { """ Check the configuration map for the Set-Cookie updating no-cache value. @param props """ //This property needed to be documented using a new name because //the original property contains a banned word for metatype: 'config' //This change will verify if either (or both) original/documented properties //are set. The instance variable they reference will be set to false if //either property is set to false. Object value = props.get(HttpConfigConstants.PROPNAME_NO_CACHE_COOKIES_CONTROL); Object value2 = props.get(HttpConfigConstants.PROPNAME_COOKIES_CONFIGURE_NOCACHE); boolean documentedProperty = true; boolean originalProperty = true; if (null != value) { documentedProperty = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: set no-cache cookie control is " + documentedProperty); } } if (null != value2) { originalProperty = convertBoolean(value2); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: set-cookie configures no-cache is " + originalProperty); } } this.bCookiesConfigureNoCache = originalProperty && documentedProperty; }
java
private void parseCookieUpdate(Map<Object, Object> props) { //This property needed to be documented using a new name because //the original property contains a banned word for metatype: 'config' //This change will verify if either (or both) original/documented properties //are set. The instance variable they reference will be set to false if //either property is set to false. Object value = props.get(HttpConfigConstants.PROPNAME_NO_CACHE_COOKIES_CONTROL); Object value2 = props.get(HttpConfigConstants.PROPNAME_COOKIES_CONFIGURE_NOCACHE); boolean documentedProperty = true; boolean originalProperty = true; if (null != value) { documentedProperty = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: set no-cache cookie control is " + documentedProperty); } } if (null != value2) { originalProperty = convertBoolean(value2); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: set-cookie configures no-cache is " + originalProperty); } } this.bCookiesConfigureNoCache = originalProperty && documentedProperty; }
[ "private", "void", "parseCookieUpdate", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "//This property needed to be documented using a new name because", "//the original property contains a banned word for metatype: 'config'", "//This change will verify if either (or both) original/documented properties", "//are set. The instance variable they reference will be set to false if", "//either property is set to false.", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_NO_CACHE_COOKIES_CONTROL", ")", ";", "Object", "value2", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_COOKIES_CONFIGURE_NOCACHE", ")", ";", "boolean", "documentedProperty", "=", "true", ";", "boolean", "originalProperty", "=", "true", ";", "if", "(", "null", "!=", "value", ")", "{", "documentedProperty", "=", "convertBoolean", "(", "value", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Config: set no-cache cookie control is \"", "+", "documentedProperty", ")", ";", "}", "}", "if", "(", "null", "!=", "value2", ")", "{", "originalProperty", "=", "convertBoolean", "(", "value2", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Config: set-cookie configures no-cache is \"", "+", "originalProperty", ")", ";", "}", "}", "this", ".", "bCookiesConfigureNoCache", "=", "originalProperty", "&&", "documentedProperty", ";", "}" ]
Check the configuration map for the Set-Cookie updating no-cache value. @param props
[ "Check", "the", "configuration", "map", "for", "the", "Set", "-", "Cookie", "updating", "no", "-", "cache", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1114-L1140
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsContainerpageService.java
CmsContainerpageService.overrideSettings
CmsContainerElementBean overrideSettings(CmsContainerElementBean element, Map<String, String> settingsToOverride) { """ Creates a new container element bean from an existing one, but changes some of the individual settings in the copy.<p> @param element the original container element @param settingsToOverride the map of settings to change @return the new container element bean with the changed settings """ Map<String, String> settings = Maps.newHashMap(element.getIndividualSettings()); settings.putAll(settingsToOverride); CmsContainerElementBean result = new CmsContainerElementBean( element.getId(), element.getFormatterId(), settings, element.isCreateNew()); return result; }
java
CmsContainerElementBean overrideSettings(CmsContainerElementBean element, Map<String, String> settingsToOverride) { Map<String, String> settings = Maps.newHashMap(element.getIndividualSettings()); settings.putAll(settingsToOverride); CmsContainerElementBean result = new CmsContainerElementBean( element.getId(), element.getFormatterId(), settings, element.isCreateNew()); return result; }
[ "CmsContainerElementBean", "overrideSettings", "(", "CmsContainerElementBean", "element", ",", "Map", "<", "String", ",", "String", ">", "settingsToOverride", ")", "{", "Map", "<", "String", ",", "String", ">", "settings", "=", "Maps", ".", "newHashMap", "(", "element", ".", "getIndividualSettings", "(", ")", ")", ";", "settings", ".", "putAll", "(", "settingsToOverride", ")", ";", "CmsContainerElementBean", "result", "=", "new", "CmsContainerElementBean", "(", "element", ".", "getId", "(", ")", ",", "element", ".", "getFormatterId", "(", ")", ",", "settings", ",", "element", ".", "isCreateNew", "(", ")", ")", ";", "return", "result", ";", "}" ]
Creates a new container element bean from an existing one, but changes some of the individual settings in the copy.<p> @param element the original container element @param settingsToOverride the map of settings to change @return the new container element bean with the changed settings
[ "Creates", "a", "new", "container", "element", "bean", "from", "an", "existing", "one", "but", "changes", "some", "of", "the", "individual", "settings", "in", "the", "copy", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsContainerpageService.java#L1906-L1916
rampatra/jbot
jbot-example/src/main/java/example/jbot/facebook/FbBot.java
FbBot.setupMeeting
@Controller(pattern = "(?i)(setup meeting)", next = "confirmTiming") public void setupMeeting(Event event) { """ Type "setup meeting" to start a conversation with the bot. Provide the name of the next method to be invoked in {@code next}. This method is the starting point of the conversation (as it calls {@link Bot#startConversation(Event, String)} within it. You can chain methods which will be invoked one after the other leading to a conversation. @param event """ startConversation(event, "confirmTiming"); // start conversation reply(event, "Cool! At what time (ex. 15:30) do you want me to set up the meeting?"); }
java
@Controller(pattern = "(?i)(setup meeting)", next = "confirmTiming") public void setupMeeting(Event event) { startConversation(event, "confirmTiming"); // start conversation reply(event, "Cool! At what time (ex. 15:30) do you want me to set up the meeting?"); }
[ "@", "Controller", "(", "pattern", "=", "\"(?i)(setup meeting)\"", ",", "next", "=", "\"confirmTiming\"", ")", "public", "void", "setupMeeting", "(", "Event", "event", ")", "{", "startConversation", "(", "event", ",", "\"confirmTiming\"", ")", ";", "// start conversation", "reply", "(", "event", ",", "\"Cool! At what time (ex. 15:30) do you want me to set up the meeting?\"", ")", ";", "}" ]
Type "setup meeting" to start a conversation with the bot. Provide the name of the next method to be invoked in {@code next}. This method is the starting point of the conversation (as it calls {@link Bot#startConversation(Event, String)} within it. You can chain methods which will be invoked one after the other leading to a conversation. @param event
[ "Type", "setup", "meeting", "to", "start", "a", "conversation", "with", "the", "bot", ".", "Provide", "the", "name", "of", "the", "next", "method", "to", "be", "invoked", "in", "{", "@code", "next", "}", ".", "This", "method", "is", "the", "starting", "point", "of", "the", "conversation", "(", "as", "it", "calls", "{", "@link", "Bot#startConversation", "(", "Event", "String", ")", "}", "within", "it", ".", "You", "can", "chain", "methods", "which", "will", "be", "invoked", "one", "after", "the", "other", "leading", "to", "a", "conversation", "." ]
train
https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/facebook/FbBot.java#L154-L158
Berico-Technologies/CLAVIN
src/main/java/com/bericotech/clavin/gazetteer/BasicGeoName.java
BasicGeoName.buildAncestryKey
private String buildAncestryKey(final FeatureCode level, final boolean includeSelf) { """ Recursively builds the ancestry key for this GeoName, optionally including the key for this GeoName's administrative division if requested and applicable. See {@link BasicGeoName#getAncestryKey()} for a description of the ancestry key. Only divisions that have a non-empty code set in this GeoName will be included in the key. @param level the administrative division at the end of the key (e.g. ADM2 to build the key COUNTRY.ADM1.ADM2) @param includeSelf <code>true</code> to include this GeoName's code in the key @return the generated ancestry key """ // if we have reached the root level, stop if (level == null) { return ""; } String keyPart; FeatureCode nextLevel; switch (level) { case ADM4: keyPart = admin4Code; nextLevel = FeatureCode.ADM3; break; case ADM3: keyPart = admin3Code; nextLevel = FeatureCode.ADM2; break; case ADM2: keyPart = admin2Code; nextLevel = FeatureCode.ADM1; break; case ADM1: // territories will be considered level 1 if they have the same country code as their // parent but cannot contain descendants so there should be no keypart for this level; // all parishes are considered to be direct descendants of their containing country with // no descendants; they should not have a key part at this level keyPart = featureCode != FeatureCode.TERR && featureCode != FeatureCode.PRSH ? admin1Code : ""; nextLevel = FeatureCode.PCL; break; case PCL: keyPart = primaryCountryCode != null && primaryCountryCode != CountryCode.NULL ? primaryCountryCode.name() : ""; nextLevel = null; break; default: throw new IllegalArgumentException("Level must be one of [PCL, ADM1, ADM2, ADM3, ADM4]"); } keyPart = keyPart.trim(); if (nextLevel != null && !keyPart.isEmpty()) { keyPart = String.format(".%s", keyPart); } int keyLevel = getAdminLevel(FeatureClass.A, level); int nameLevel = getAdminLevel(featureClass, featureCode, name, alternateNames, primaryCountryCode.name); // if the requested key part is a larger administrative division than the level of the // geoname or, if we are including the geoname's key part and it is the requested part, // include it in the ancestry key (if not blank); otherwise, move to the next level String qualifiedKey = (nameLevel > keyLevel || (includeSelf && keyLevel == nameLevel)) && !keyPart.isEmpty() ? String.format("%s%s", buildAncestryKey(nextLevel, includeSelf), keyPart) : buildAncestryKey(nextLevel, includeSelf); // if any part of the key is missing once a lower-level component has been specified, we cannot // resolve the ancestry path and an empty string should be returned. if (qualifiedKey.startsWith(".") || qualifiedKey.contains("..") || qualifiedKey.endsWith(".")) { qualifiedKey = ""; } return qualifiedKey; }
java
private String buildAncestryKey(final FeatureCode level, final boolean includeSelf) { // if we have reached the root level, stop if (level == null) { return ""; } String keyPart; FeatureCode nextLevel; switch (level) { case ADM4: keyPart = admin4Code; nextLevel = FeatureCode.ADM3; break; case ADM3: keyPart = admin3Code; nextLevel = FeatureCode.ADM2; break; case ADM2: keyPart = admin2Code; nextLevel = FeatureCode.ADM1; break; case ADM1: // territories will be considered level 1 if they have the same country code as their // parent but cannot contain descendants so there should be no keypart for this level; // all parishes are considered to be direct descendants of their containing country with // no descendants; they should not have a key part at this level keyPart = featureCode != FeatureCode.TERR && featureCode != FeatureCode.PRSH ? admin1Code : ""; nextLevel = FeatureCode.PCL; break; case PCL: keyPart = primaryCountryCode != null && primaryCountryCode != CountryCode.NULL ? primaryCountryCode.name() : ""; nextLevel = null; break; default: throw new IllegalArgumentException("Level must be one of [PCL, ADM1, ADM2, ADM3, ADM4]"); } keyPart = keyPart.trim(); if (nextLevel != null && !keyPart.isEmpty()) { keyPart = String.format(".%s", keyPart); } int keyLevel = getAdminLevel(FeatureClass.A, level); int nameLevel = getAdminLevel(featureClass, featureCode, name, alternateNames, primaryCountryCode.name); // if the requested key part is a larger administrative division than the level of the // geoname or, if we are including the geoname's key part and it is the requested part, // include it in the ancestry key (if not blank); otherwise, move to the next level String qualifiedKey = (nameLevel > keyLevel || (includeSelf && keyLevel == nameLevel)) && !keyPart.isEmpty() ? String.format("%s%s", buildAncestryKey(nextLevel, includeSelf), keyPart) : buildAncestryKey(nextLevel, includeSelf); // if any part of the key is missing once a lower-level component has been specified, we cannot // resolve the ancestry path and an empty string should be returned. if (qualifiedKey.startsWith(".") || qualifiedKey.contains("..") || qualifiedKey.endsWith(".")) { qualifiedKey = ""; } return qualifiedKey; }
[ "private", "String", "buildAncestryKey", "(", "final", "FeatureCode", "level", ",", "final", "boolean", "includeSelf", ")", "{", "// if we have reached the root level, stop", "if", "(", "level", "==", "null", ")", "{", "return", "\"\"", ";", "}", "String", "keyPart", ";", "FeatureCode", "nextLevel", ";", "switch", "(", "level", ")", "{", "case", "ADM4", ":", "keyPart", "=", "admin4Code", ";", "nextLevel", "=", "FeatureCode", ".", "ADM3", ";", "break", ";", "case", "ADM3", ":", "keyPart", "=", "admin3Code", ";", "nextLevel", "=", "FeatureCode", ".", "ADM2", ";", "break", ";", "case", "ADM2", ":", "keyPart", "=", "admin2Code", ";", "nextLevel", "=", "FeatureCode", ".", "ADM1", ";", "break", ";", "case", "ADM1", ":", "// territories will be considered level 1 if they have the same country code as their", "// parent but cannot contain descendants so there should be no keypart for this level;", "// all parishes are considered to be direct descendants of their containing country with", "// no descendants; they should not have a key part at this level", "keyPart", "=", "featureCode", "!=", "FeatureCode", ".", "TERR", "&&", "featureCode", "!=", "FeatureCode", ".", "PRSH", "?", "admin1Code", ":", "\"\"", ";", "nextLevel", "=", "FeatureCode", ".", "PCL", ";", "break", ";", "case", "PCL", ":", "keyPart", "=", "primaryCountryCode", "!=", "null", "&&", "primaryCountryCode", "!=", "CountryCode", ".", "NULL", "?", "primaryCountryCode", ".", "name", "(", ")", ":", "\"\"", ";", "nextLevel", "=", "null", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Level must be one of [PCL, ADM1, ADM2, ADM3, ADM4]\"", ")", ";", "}", "keyPart", "=", "keyPart", ".", "trim", "(", ")", ";", "if", "(", "nextLevel", "!=", "null", "&&", "!", "keyPart", ".", "isEmpty", "(", ")", ")", "{", "keyPart", "=", "String", ".", "format", "(", "\".%s\"", ",", "keyPart", ")", ";", "}", "int", "keyLevel", "=", "getAdminLevel", "(", "FeatureClass", ".", "A", ",", "level", ")", ";", "int", "nameLevel", "=", "getAdminLevel", "(", "featureClass", ",", "featureCode", ",", "name", ",", "alternateNames", ",", "primaryCountryCode", ".", "name", ")", ";", "// if the requested key part is a larger administrative division than the level of the", "// geoname or, if we are including the geoname's key part and it is the requested part,", "// include it in the ancestry key (if not blank); otherwise, move to the next level", "String", "qualifiedKey", "=", "(", "nameLevel", ">", "keyLevel", "||", "(", "includeSelf", "&&", "keyLevel", "==", "nameLevel", ")", ")", "&&", "!", "keyPart", ".", "isEmpty", "(", ")", "?", "String", ".", "format", "(", "\"%s%s\"", ",", "buildAncestryKey", "(", "nextLevel", ",", "includeSelf", ")", ",", "keyPart", ")", ":", "buildAncestryKey", "(", "nextLevel", ",", "includeSelf", ")", ";", "// if any part of the key is missing once a lower-level component has been specified, we cannot", "// resolve the ancestry path and an empty string should be returned.", "if", "(", "qualifiedKey", ".", "startsWith", "(", "\".\"", ")", "||", "qualifiedKey", ".", "contains", "(", "\"..\"", ")", "||", "qualifiedKey", ".", "endsWith", "(", "\".\"", ")", ")", "{", "qualifiedKey", "=", "\"\"", ";", "}", "return", "qualifiedKey", ";", "}" ]
Recursively builds the ancestry key for this GeoName, optionally including the key for this GeoName's administrative division if requested and applicable. See {@link BasicGeoName#getAncestryKey()} for a description of the ancestry key. Only divisions that have a non-empty code set in this GeoName will be included in the key. @param level the administrative division at the end of the key (e.g. ADM2 to build the key COUNTRY.ADM1.ADM2) @param includeSelf <code>true</code> to include this GeoName's code in the key @return the generated ancestry key
[ "Recursively", "builds", "the", "ancestry", "key", "for", "this", "GeoName", "optionally", "including", "the", "key", "for", "this", "GeoName", "s", "administrative", "division", "if", "requested", "and", "applicable", ".", "See", "{" ]
train
https://github.com/Berico-Technologies/CLAVIN/blob/f73c741f33a01b91aa5b06e71860bc354ef3010d/src/main/java/com/bericotech/clavin/gazetteer/BasicGeoName.java#L530-L585
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelFormatter.java
HpelFormatter.formatRecord
public String formatRecord(RepositoryLogRecord record) { """ Formats a RepositoryLogRecord using the formatter's locale @param record log record to be formatted @return the resulting formatted string output. """ if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return formatRecord(record, (Locale) null); }
java
public String formatRecord(RepositoryLogRecord record) { if (null == record) { throw new IllegalArgumentException("Record cannot be null"); } return formatRecord(record, (Locale) null); }
[ "public", "String", "formatRecord", "(", "RepositoryLogRecord", "record", ")", "{", "if", "(", "null", "==", "record", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Record cannot be null\"", ")", ";", "}", "return", "formatRecord", "(", "record", ",", "(", "Locale", ")", "null", ")", ";", "}" ]
Formats a RepositoryLogRecord using the formatter's locale @param record log record to be formatted @return the resulting formatted string output.
[ "Formats", "a", "RepositoryLogRecord", "using", "the", "formatter", "s", "locale" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelFormatter.java#L498-L503
bozaro/git-lfs-java
gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java
Client.getMeta
@Nullable public ObjectRes getMeta(@NotNull final String hash) throws IOException { """ Get metadata for object by hash. @param hash Object hash. @return Object metadata or null, if object not found. @throws IOException """ return doWork(auth -> doRequest(auth, new MetaGet(), AuthHelper.join(auth.getHref(), PATH_OBJECTS + "/" + hash)), Operation.Download); }
java
@Nullable public ObjectRes getMeta(@NotNull final String hash) throws IOException { return doWork(auth -> doRequest(auth, new MetaGet(), AuthHelper.join(auth.getHref(), PATH_OBJECTS + "/" + hash)), Operation.Download); }
[ "@", "Nullable", "public", "ObjectRes", "getMeta", "(", "@", "NotNull", "final", "String", "hash", ")", "throws", "IOException", "{", "return", "doWork", "(", "auth", "->", "doRequest", "(", "auth", ",", "new", "MetaGet", "(", ")", ",", "AuthHelper", ".", "join", "(", "auth", ".", "getHref", "(", ")", ",", "PATH_OBJECTS", "+", "\"/\"", "+", "hash", ")", ")", ",", "Operation", ".", "Download", ")", ";", "}" ]
Get metadata for object by hash. @param hash Object hash. @return Object metadata or null, if object not found. @throws IOException
[ "Get", "metadata", "for", "object", "by", "hash", "." ]
train
https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L79-L82
ralscha/extdirectspring
src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java
JsonHandler.writeValueAsString
public String writeValueAsString(Object obj, boolean indent) { """ Converts an object into a JSON string. In case of an exceptions returns null and logs the exception. @param obj the source object @param indent if true JSON is written in a human readable format, if false JSON is written on one line @return obj JSON string, <code>null</code> if an exception occurred """ try { if (indent) { return this.mapper.writer().withDefaultPrettyPrinter() .writeValueAsString(obj); } return this.mapper.writeValueAsString(obj); } catch (Exception e) { LogFactory.getLog(JsonHandler.class).info("serialize object to json", e); return null; } }
java
public String writeValueAsString(Object obj, boolean indent) { try { if (indent) { return this.mapper.writer().withDefaultPrettyPrinter() .writeValueAsString(obj); } return this.mapper.writeValueAsString(obj); } catch (Exception e) { LogFactory.getLog(JsonHandler.class).info("serialize object to json", e); return null; } }
[ "public", "String", "writeValueAsString", "(", "Object", "obj", ",", "boolean", "indent", ")", "{", "try", "{", "if", "(", "indent", ")", "{", "return", "this", ".", "mapper", ".", "writer", "(", ")", ".", "withDefaultPrettyPrinter", "(", ")", ".", "writeValueAsString", "(", "obj", ")", ";", "}", "return", "this", ".", "mapper", ".", "writeValueAsString", "(", "obj", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LogFactory", ".", "getLog", "(", "JsonHandler", ".", "class", ")", ".", "info", "(", "\"serialize object to json\"", ",", "e", ")", ";", "return", "null", ";", "}", "}" ]
Converts an object into a JSON string. In case of an exceptions returns null and logs the exception. @param obj the source object @param indent if true JSON is written in a human readable format, if false JSON is written on one line @return obj JSON string, <code>null</code> if an exception occurred
[ "Converts", "an", "object", "into", "a", "JSON", "string", ".", "In", "case", "of", "an", "exceptions", "returns", "null", "and", "logs", "the", "exception", "." ]
train
https://github.com/ralscha/extdirectspring/blob/4b018497c4e7503033f91d0491b4e74bf8291d2c/src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java#L80-L92
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java
GarbageCollector.onAddedToList
public synchronized void onAddedToList(ObservableList list, Object value) { """ This method must be called for each item that is added to a {@link ObservableList} that is part of a Dolphin bean (see {@link RemotingBean}) @param list the list @param value the added item """ if (!configuration.isUseGc()) { return; } if (value != null && DolphinUtils.isDolphinBean(value.getClass())) { Instance instance = getInstance(value); Reference reference = new ListReference(listToParent.get(list), list, instance); if (reference.hasCircularReference()) { throw new CircularDependencyException("Circular dependency detected!"); } instance.getReferences().add(reference); removeFromGC(instance); } }
java
public synchronized void onAddedToList(ObservableList list, Object value) { if (!configuration.isUseGc()) { return; } if (value != null && DolphinUtils.isDolphinBean(value.getClass())) { Instance instance = getInstance(value); Reference reference = new ListReference(listToParent.get(list), list, instance); if (reference.hasCircularReference()) { throw new CircularDependencyException("Circular dependency detected!"); } instance.getReferences().add(reference); removeFromGC(instance); } }
[ "public", "synchronized", "void", "onAddedToList", "(", "ObservableList", "list", ",", "Object", "value", ")", "{", "if", "(", "!", "configuration", ".", "isUseGc", "(", ")", ")", "{", "return", ";", "}", "if", "(", "value", "!=", "null", "&&", "DolphinUtils", ".", "isDolphinBean", "(", "value", ".", "getClass", "(", ")", ")", ")", "{", "Instance", "instance", "=", "getInstance", "(", "value", ")", ";", "Reference", "reference", "=", "new", "ListReference", "(", "listToParent", ".", "get", "(", "list", ")", ",", "list", ",", "instance", ")", ";", "if", "(", "reference", ".", "hasCircularReference", "(", ")", ")", "{", "throw", "new", "CircularDependencyException", "(", "\"Circular dependency detected!\"", ")", ";", "}", "instance", ".", "getReferences", "(", ")", ".", "add", "(", "reference", ")", ";", "removeFromGC", "(", "instance", ")", ";", "}", "}" ]
This method must be called for each item that is added to a {@link ObservableList} that is part of a Dolphin bean (see {@link RemotingBean}) @param list the list @param value the added item
[ "This", "method", "must", "be", "called", "for", "each", "item", "that", "is", "added", "to", "a", "{", "@link", "ObservableList", "}", "that", "is", "part", "of", "a", "Dolphin", "bean", "(", "see", "{", "@link", "RemotingBean", "}", ")" ]
train
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/gc/GarbageCollector.java#L172-L185
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java
NodeServiceImpl.moveObject
@Override public void moveObject(final FedoraSession session, final String source, final String destination) { """ Move an existing object from the source path to the destination path @param session the session @param source the source path @param destination the destination path """ final Session jcrSession = getJcrSession(session); try { final FedoraResource srcResource = find(session, source); final Node sourceNode = getJcrNode(srcResource); final String name = sourceNode.getName(); final Node parent = sourceNode.getDepth() > 0 ? sourceNode.getParent() : null; jcrSession.getWorkspace().move(source, destination); if (parent != null) { createTombstone(parent, name); } touchLdpMembershipResource(getJcrNode(find(session, source))); touchLdpMembershipResource(getJcrNode(find(session, destination))); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
java
@Override public void moveObject(final FedoraSession session, final String source, final String destination) { final Session jcrSession = getJcrSession(session); try { final FedoraResource srcResource = find(session, source); final Node sourceNode = getJcrNode(srcResource); final String name = sourceNode.getName(); final Node parent = sourceNode.getDepth() > 0 ? sourceNode.getParent() : null; jcrSession.getWorkspace().move(source, destination); if (parent != null) { createTombstone(parent, name); } touchLdpMembershipResource(getJcrNode(find(session, source))); touchLdpMembershipResource(getJcrNode(find(session, destination))); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
[ "@", "Override", "public", "void", "moveObject", "(", "final", "FedoraSession", "session", ",", "final", "String", "source", ",", "final", "String", "destination", ")", "{", "final", "Session", "jcrSession", "=", "getJcrSession", "(", "session", ")", ";", "try", "{", "final", "FedoraResource", "srcResource", "=", "find", "(", "session", ",", "source", ")", ";", "final", "Node", "sourceNode", "=", "getJcrNode", "(", "srcResource", ")", ";", "final", "String", "name", "=", "sourceNode", ".", "getName", "(", ")", ";", "final", "Node", "parent", "=", "sourceNode", ".", "getDepth", "(", ")", ">", "0", "?", "sourceNode", ".", "getParent", "(", ")", ":", "null", ";", "jcrSession", ".", "getWorkspace", "(", ")", ".", "move", "(", "source", ",", "destination", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "createTombstone", "(", "parent", ",", "name", ")", ";", "}", "touchLdpMembershipResource", "(", "getJcrNode", "(", "find", "(", "session", ",", "source", ")", ")", ")", ";", "touchLdpMembershipResource", "(", "getJcrNode", "(", "find", "(", "session", ",", "destination", ")", ")", ")", ";", "}", "catch", "(", "final", "RepositoryException", "e", ")", "{", "throw", "new", "RepositoryRuntimeException", "(", "e", ")", ";", "}", "}" ]
Move an existing object from the source path to the destination path @param session the session @param source the source path @param destination the destination path
[ "Move", "an", "existing", "object", "from", "the", "source", "path", "to", "the", "destination", "path" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java#L110-L131
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/Branch.java
Branch.initSessionWithData
public boolean initSessionWithData(Uri data, Activity activity) { """ <p>Initialises a session with the Branch API, with associated data from the supplied {@link Uri}.</p> @param data A {@link Uri} variable containing the details of the source link that led to this initialisation action. @param activity The calling {@link Activity} for context. @return A {@link Boolean} value that returns <i>false</i> if unsuccessful. """ readAndStripParam(data, activity); return initSession((BranchReferralInitListener) null, activity); }
java
public boolean initSessionWithData(Uri data, Activity activity) { readAndStripParam(data, activity); return initSession((BranchReferralInitListener) null, activity); }
[ "public", "boolean", "initSessionWithData", "(", "Uri", "data", ",", "Activity", "activity", ")", "{", "readAndStripParam", "(", "data", ",", "activity", ")", ";", "return", "initSession", "(", "(", "BranchReferralInitListener", ")", "null", ",", "activity", ")", ";", "}" ]
<p>Initialises a session with the Branch API, with associated data from the supplied {@link Uri}.</p> @param data A {@link Uri} variable containing the details of the source link that led to this initialisation action. @param activity The calling {@link Activity} for context. @return A {@link Boolean} value that returns <i>false</i> if unsuccessful.
[ "<p", ">", "Initialises", "a", "session", "with", "the", "Branch", "API", "with", "associated", "data", "from", "the", "supplied", "{", "@link", "Uri", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1156-L1159
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTree.java
MkAppTree.leafEntryIDs
private void leafEntryIDs(MkAppTreeNode<O> node, ModifiableDBIDs result) { """ Determines the ids of the leaf entries stored in the specified subtree. @param node the root of the subtree @param result the result list containing the ids of the leaf entries stored in the specified subtree """ if(node.isLeaf()) { for(int i = 0; i < node.getNumEntries(); i++) { MkAppEntry entry = node.getEntry(i); result.add(((LeafEntry) entry).getDBID()); } } else { for(int i = 0; i < node.getNumEntries(); i++) { MkAppTreeNode<O> childNode = getNode(node.getEntry(i)); leafEntryIDs(childNode, result); } } }
java
private void leafEntryIDs(MkAppTreeNode<O> node, ModifiableDBIDs result) { if(node.isLeaf()) { for(int i = 0; i < node.getNumEntries(); i++) { MkAppEntry entry = node.getEntry(i); result.add(((LeafEntry) entry).getDBID()); } } else { for(int i = 0; i < node.getNumEntries(); i++) { MkAppTreeNode<O> childNode = getNode(node.getEntry(i)); leafEntryIDs(childNode, result); } } }
[ "private", "void", "leafEntryIDs", "(", "MkAppTreeNode", "<", "O", ">", "node", ",", "ModifiableDBIDs", "result", ")", "{", "if", "(", "node", ".", "isLeaf", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkAppEntry", "entry", "=", "node", ".", "getEntry", "(", "i", ")", ";", "result", ".", "add", "(", "(", "(", "LeafEntry", ")", "entry", ")", ".", "getDBID", "(", ")", ")", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "MkAppTreeNode", "<", "O", ">", "childNode", "=", "getNode", "(", "node", ".", "getEntry", "(", "i", ")", ")", ";", "leafEntryIDs", "(", "childNode", ",", "result", ")", ";", "}", "}", "}" ]
Determines the ids of the leaf entries stored in the specified subtree. @param node the root of the subtree @param result the result list containing the ids of the leaf entries stored in the specified subtree
[ "Determines", "the", "ids", "of", "the", "leaf", "entries", "stored", "in", "the", "specified", "subtree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/mktrees/mkapp/MkAppTree.java#L304-L317
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/ErrorPageWriter.java
ErrorPageWriter.debugHtml
public static void debugHtml(Writer writer, FacesContext faces, Throwable e) throws IOException { """ Generates the HTML error page for the given Throwable and writes it to the given writer. @param writer @param faces @param e @throws IOException """ debugHtml(writer, faces, faces.getViewRoot(), null, e); }
java
public static void debugHtml(Writer writer, FacesContext faces, Throwable e) throws IOException { debugHtml(writer, faces, faces.getViewRoot(), null, e); }
[ "public", "static", "void", "debugHtml", "(", "Writer", "writer", ",", "FacesContext", "faces", ",", "Throwable", "e", ")", "throws", "IOException", "{", "debugHtml", "(", "writer", ",", "faces", ",", "faces", ".", "getViewRoot", "(", ")", ",", "null", ",", "e", ")", ";", "}" ]
Generates the HTML error page for the given Throwable and writes it to the given writer. @param writer @param faces @param e @throws IOException
[ "Generates", "the", "HTML", "error", "page", "for", "the", "given", "Throwable", "and", "writes", "it", "to", "the", "given", "writer", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/ErrorPageWriter.java#L264-L267
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml10Attribute
public static void escapeXml10Attribute(final Reader reader, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level) throws IOException { """ <p> Perform a (configurable) XML 1.0 <strong>escape</strong> operation on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.xml.XmlEscapeType} and {@link org.unbescape.xml.XmlEscapeLevel} argument values. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> All other <tt>Reader</tt>/<tt>Writer</tt>-based <tt>escapeXml10*(...)</tt> methods call this one with preconfigured <tt>type</tt> and <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param type the type of escape operation to be performed, see {@link org.unbescape.xml.XmlEscapeType}. @param level the escape level to be applied, see {@link org.unbescape.xml.XmlEscapeLevel}. @throws IOException if an input/output exception occurs @since 1.1.5 """ escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, type, level); }
java
public static void escapeXml10Attribute(final Reader reader, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level) throws IOException { escapeXml(reader, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, type, level); }
[ "public", "static", "void", "escapeXml10Attribute", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "XmlEscapeType", "type", ",", "final", "XmlEscapeLevel", "level", ")", "throws", "IOException", "{", "escapeXml", "(", "reader", ",", "writer", ",", "XmlEscapeSymbols", ".", "XML10_ATTRIBUTE_SYMBOLS", ",", "type", ",", "level", ")", ";", "}" ]
<p> Perform a (configurable) XML 1.0 <strong>escape</strong> operation on a <tt>Reader</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>. </p> <p> This method will perform an escape operation according to the specified {@link org.unbescape.xml.XmlEscapeType} and {@link org.unbescape.xml.XmlEscapeLevel} argument values. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> All other <tt>Reader</tt>/<tt>Writer</tt>-based <tt>escapeXml10*(...)</tt> methods call this one with preconfigured <tt>type</tt> and <tt>level</tt> values. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param type the type of escape operation to be performed, see {@link org.unbescape.xml.XmlEscapeType}. @param level the escape level to be applied, see {@link org.unbescape.xml.XmlEscapeLevel}. @throws IOException if an input/output exception occurs @since 1.1.5
[ "<p", ">", "Perform", "a", "(", "configurable", ")", "XML", "1", ".", "0", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "meant", "to", "be", "an", "XML", "attribute", "value", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "will", "perform", "an", "escape", "operation", "according", "to", "the", "specified", "{", "@link", "org", ".", "unbescape", ".", "xml", ".", "XmlEscapeType", "}", "and", "{", "@link", "org", ".", "unbescape", ".", "xml", ".", "XmlEscapeLevel", "}", "argument", "values", ".", "<", "/", "p", ">", "<p", ">", "Besides", "being", "an", "attribute", "value", "also", "<tt", ">", "&#92", ";", "t<", "/", "tt", ">", "<tt", ">", "&#92", ";", "n<", "/", "tt", ">", "and", "<tt", ">", "&#92", ";", "r<", "/", "tt", ">", "will", "be", "escaped", "to", "avoid", "white", "-", "space", "normalization", "from", "removing", "line", "feeds", "(", "turning", "them", "into", "white", "spaces", ")", "during", "future", "parsing", "operations", ".", "<", "/", "p", ">", "<p", ">", "All", "other", "<tt", ">", "Reader<", "/", "tt", ">", "/", "<tt", ">", "Writer<", "/", "tt", ">", "-", "based", "<tt", ">", "escapeXml10", "*", "(", "...", ")", "<", "/", "tt", ">", "methods", "call", "this", "one", "with", "preconfigured", "<tt", ">", "type<", "/", "tt", ">", "and", "<tt", ">", "level<", "/", "tt", ">", "values", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1660-L1663
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.getSeasonAccountState
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException { """ This method lets users get the status of whether or not the TV episodes of a season have been rated. A valid session id is required. @param tvID tvID @param sessionID sessionID @return @throws MovieDbException exception """ return tmdbSeasons.getSeasonAccountState(tvID, sessionID); }
java
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException { return tmdbSeasons.getSeasonAccountState(tvID, sessionID); }
[ "public", "MediaState", "getSeasonAccountState", "(", "int", "tvID", ",", "String", "sessionID", ")", "throws", "MovieDbException", "{", "return", "tmdbSeasons", ".", "getSeasonAccountState", "(", "tvID", ",", "sessionID", ")", ";", "}" ]
This method lets users get the status of whether or not the TV episodes of a season have been rated. A valid session id is required. @param tvID tvID @param sessionID sessionID @return @throws MovieDbException exception
[ "This", "method", "lets", "users", "get", "the", "status", "of", "whether", "or", "not", "the", "TV", "episodes", "of", "a", "season", "have", "been", "rated", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1700-L1702
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.appendHexString
static public void appendHexString(StringBuilder buffer, int value) { """ Appends 8 characters to a StringBuilder with the int in a "Big Endian" hexidecimal format. For example, a int 0xFFAA1234 will be appended as a String in format "FFAA1234". A int of value 0 will be appended as "00000000". @param buffer The StringBuilder the int value in hexidecimal format will be appended to. If the buffer is null, this method will throw a NullPointerException. @param value The int value that will be converted to a hexidecimal String. """ assertNotNull(buffer); int nibble = (value & 0xF0000000) >>> 28; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F000000) >>> 24; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00F00000) >>> 20; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x000F0000) >>> 16; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0000F000) >>> 12; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00000F00) >>> 8; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x000000F0) >>> 4; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0000000F); buffer.append(HEX_TABLE[nibble]); }
java
static public void appendHexString(StringBuilder buffer, int value) { assertNotNull(buffer); int nibble = (value & 0xF0000000) >>> 28; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0F000000) >>> 24; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00F00000) >>> 20; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x000F0000) >>> 16; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0000F000) >>> 12; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x00000F00) >>> 8; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x000000F0) >>> 4; buffer.append(HEX_TABLE[nibble]); nibble = (value & 0x0000000F); buffer.append(HEX_TABLE[nibble]); }
[ "static", "public", "void", "appendHexString", "(", "StringBuilder", "buffer", ",", "int", "value", ")", "{", "assertNotNull", "(", "buffer", ")", ";", "int", "nibble", "=", "(", "value", "&", "0xF0000000", ")", ">>>", "28", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "nibble", "=", "(", "value", "&", "0x0F000000", ")", ">>>", "24", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "nibble", "=", "(", "value", "&", "0x00F00000", ")", ">>>", "20", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "nibble", "=", "(", "value", "&", "0x000F0000", ")", ">>>", "16", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "nibble", "=", "(", "value", "&", "0x0000F000", ")", ">>>", "12", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "nibble", "=", "(", "value", "&", "0x00000F00", ")", ">>>", "8", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "nibble", "=", "(", "value", "&", "0x000000F0", ")", ">>>", "4", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "nibble", "=", "(", "value", "&", "0x0000000F", ")", ";", "buffer", ".", "append", "(", "HEX_TABLE", "[", "nibble", "]", ")", ";", "}" ]
Appends 8 characters to a StringBuilder with the int in a "Big Endian" hexidecimal format. For example, a int 0xFFAA1234 will be appended as a String in format "FFAA1234". A int of value 0 will be appended as "00000000". @param buffer The StringBuilder the int value in hexidecimal format will be appended to. If the buffer is null, this method will throw a NullPointerException. @param value The int value that will be converted to a hexidecimal String.
[ "Appends", "8", "characters", "to", "a", "StringBuilder", "with", "the", "int", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "int", "0xFFAA1234", "will", "be", "appended", "as", "a", "String", "in", "format", "FFAA1234", ".", "A", "int", "of", "value", "0", "will", "be", "appended", "as", "00000000", "." ]
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L206-L224
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java
JspFunctions.isSortedAscending
public static boolean isSortedAscending(SortModel sortModel, String sortExpression) { """ Given a sort expression, check to see if the sort expression is sorted ascending in a data grid's {@link SortModel}. @param sortModel a grid's sort model @param sortExpression the sort expression @return return <code>true</code> if a {@link Sort} is found whose sort expression matches the sort expression given here and whose direction is {@link SortDirection#ASCENDING}. @netui:jspfunction name="isSortedAscending" signature="boolean isSortedAscending(org.apache.beehive.netui.databinding.datagrid.api.sort.SortModel,java.lang.String)" """ if(sortModel == null || sortExpression == null) return false; Sort sort = sortModel.lookupSort(sortExpression); if(sort != null && sort.getDirection() == SortDirection.ASCENDING) return true; else return false; }
java
public static boolean isSortedAscending(SortModel sortModel, String sortExpression) { if(sortModel == null || sortExpression == null) return false; Sort sort = sortModel.lookupSort(sortExpression); if(sort != null && sort.getDirection() == SortDirection.ASCENDING) return true; else return false; }
[ "public", "static", "boolean", "isSortedAscending", "(", "SortModel", "sortModel", ",", "String", "sortExpression", ")", "{", "if", "(", "sortModel", "==", "null", "||", "sortExpression", "==", "null", ")", "return", "false", ";", "Sort", "sort", "=", "sortModel", ".", "lookupSort", "(", "sortExpression", ")", ";", "if", "(", "sort", "!=", "null", "&&", "sort", ".", "getDirection", "(", ")", "==", "SortDirection", ".", "ASCENDING", ")", "return", "true", ";", "else", "return", "false", ";", "}" ]
Given a sort expression, check to see if the sort expression is sorted ascending in a data grid's {@link SortModel}. @param sortModel a grid's sort model @param sortExpression the sort expression @return return <code>true</code> if a {@link Sort} is found whose sort expression matches the sort expression given here and whose direction is {@link SortDirection#ASCENDING}. @netui:jspfunction name="isSortedAscending" signature="boolean isSortedAscending(org.apache.beehive.netui.databinding.datagrid.api.sort.SortModel,java.lang.String)"
[ "Given", "a", "sort", "expression", "check", "to", "see", "if", "the", "sort", "expression", "is", "sorted", "ascending", "in", "a", "data", "grid", "s", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspFunctions.java#L55-L63
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/TypedProperties.java
TypedProperties.getProperty
public synchronized String getProperty(String key, String defaultValue, boolean doStringReplace) { """ Get the property associated with the key, optionally applying string property replacement as defined in {@link StringPropertyReplacer#replaceProperties} to the result. @param key the hashtable key. @param defaultValue a default value. @param doStringReplace boolean indicating whether to apply string property replacement @return the value in this property list with the specified key valu after optionally being inspected for String property replacement """ if (doStringReplace) return StringPropertyReplacer.replaceProperties(getProperty(key, defaultValue)); else return getProperty(key, defaultValue); }
java
public synchronized String getProperty(String key, String defaultValue, boolean doStringReplace) { if (doStringReplace) return StringPropertyReplacer.replaceProperties(getProperty(key, defaultValue)); else return getProperty(key, defaultValue); }
[ "public", "synchronized", "String", "getProperty", "(", "String", "key", ",", "String", "defaultValue", ",", "boolean", "doStringReplace", ")", "{", "if", "(", "doStringReplace", ")", "return", "StringPropertyReplacer", ".", "replaceProperties", "(", "getProperty", "(", "key", ",", "defaultValue", ")", ")", ";", "else", "return", "getProperty", "(", "key", ",", "defaultValue", ")", ";", "}" ]
Get the property associated with the key, optionally applying string property replacement as defined in {@link StringPropertyReplacer#replaceProperties} to the result. @param key the hashtable key. @param defaultValue a default value. @param doStringReplace boolean indicating whether to apply string property replacement @return the value in this property list with the specified key valu after optionally being inspected for String property replacement
[ "Get", "the", "property", "associated", "with", "the", "key", "optionally", "applying", "string", "property", "replacement", "as", "defined", "in", "{", "@link", "StringPropertyReplacer#replaceProperties", "}", "to", "the", "result", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/TypedProperties.java#L148-L153
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageLoadable.java
ResourceStorageLoadable.loadEntries
protected void loadEntries(final StorageAwareResource resource, final ZipInputStream zipIn) throws IOException { """ Load entries from the storage. Overriding methods should first delegate to super before adding their own entries. """ zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream = new BufferedInputStream(zipIn); this.readContents(resource, _bufferedInputStream); zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_1 = new BufferedInputStream(zipIn); this.readResourceDescription(resource, _bufferedInputStream_1); if (this.storeNodeModel) { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_2 = new BufferedInputStream(zipIn); this.readNodeModel(resource, _bufferedInputStream_2); } }
java
protected void loadEntries(final StorageAwareResource resource, final ZipInputStream zipIn) throws IOException { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream = new BufferedInputStream(zipIn); this.readContents(resource, _bufferedInputStream); zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_1 = new BufferedInputStream(zipIn); this.readResourceDescription(resource, _bufferedInputStream_1); if (this.storeNodeModel) { zipIn.getNextEntry(); BufferedInputStream _bufferedInputStream_2 = new BufferedInputStream(zipIn); this.readNodeModel(resource, _bufferedInputStream_2); } }
[ "protected", "void", "loadEntries", "(", "final", "StorageAwareResource", "resource", ",", "final", "ZipInputStream", "zipIn", ")", "throws", "IOException", "{", "zipIn", ".", "getNextEntry", "(", ")", ";", "BufferedInputStream", "_bufferedInputStream", "=", "new", "BufferedInputStream", "(", "zipIn", ")", ";", "this", ".", "readContents", "(", "resource", ",", "_bufferedInputStream", ")", ";", "zipIn", ".", "getNextEntry", "(", ")", ";", "BufferedInputStream", "_bufferedInputStream_1", "=", "new", "BufferedInputStream", "(", "zipIn", ")", ";", "this", ".", "readResourceDescription", "(", "resource", ",", "_bufferedInputStream_1", ")", ";", "if", "(", "this", ".", "storeNodeModel", ")", "{", "zipIn", ".", "getNextEntry", "(", ")", ";", "BufferedInputStream", "_bufferedInputStream_2", "=", "new", "BufferedInputStream", "(", "zipIn", ")", ";", "this", ".", "readNodeModel", "(", "resource", ",", "_bufferedInputStream_2", ")", ";", "}", "}" ]
Load entries from the storage. Overriding methods should first delegate to super before adding their own entries.
[ "Load", "entries", "from", "the", "storage", ".", "Overriding", "methods", "should", "first", "delegate", "to", "super", "before", "adding", "their", "own", "entries", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/resource/persistence/ResourceStorageLoadable.java#L64-L76
PureWriter/ToastCompat
library/src/main/java/me/drakeet/support/toast/ToastCompat.java
ToastCompat.makeText
public static ToastCompat makeText(Context context, CharSequence text, int duration) { """ Make a standard toast that just contains a text view. @param context The context to use. Usually your {@link android.app.Application} or {@link android.app.Activity} object. @param text The text to show. Can be formatted text. @param duration How long to display the message. Either {@link #LENGTH_SHORT} or {@link #LENGTH_LONG} """ // We cannot pass the SafeToastContext to Toast.makeText() because // the View will unwrap the base context and we are in vain. @SuppressLint("ShowToast") Toast toast = Toast.makeText(context, text, duration); setContextCompat(toast.getView(), new SafeToastContext(context, toast)); return new ToastCompat(context, toast); }
java
public static ToastCompat makeText(Context context, CharSequence text, int duration) { // We cannot pass the SafeToastContext to Toast.makeText() because // the View will unwrap the base context and we are in vain. @SuppressLint("ShowToast") Toast toast = Toast.makeText(context, text, duration); setContextCompat(toast.getView(), new SafeToastContext(context, toast)); return new ToastCompat(context, toast); }
[ "public", "static", "ToastCompat", "makeText", "(", "Context", "context", ",", "CharSequence", "text", ",", "int", "duration", ")", "{", "// We cannot pass the SafeToastContext to Toast.makeText() because", "// the View will unwrap the base context and we are in vain.", "@", "SuppressLint", "(", "\"ShowToast\"", ")", "Toast", "toast", "=", "Toast", ".", "makeText", "(", "context", ",", "text", ",", "duration", ")", ";", "setContextCompat", "(", "toast", ".", "getView", "(", ")", ",", "new", "SafeToastContext", "(", "context", ",", "toast", ")", ")", ";", "return", "new", "ToastCompat", "(", "context", ",", "toast", ")", ";", "}" ]
Make a standard toast that just contains a text view. @param context The context to use. Usually your {@link android.app.Application} or {@link android.app.Activity} object. @param text The text to show. Can be formatted text. @param duration How long to display the message. Either {@link #LENGTH_SHORT} or {@link #LENGTH_LONG}
[ "Make", "a", "standard", "toast", "that", "just", "contains", "a", "text", "view", "." ]
train
https://github.com/PureWriter/ToastCompat/blob/79c629c2ca8b2d7803f6dc4a458971b5fa19e7f7/library/src/main/java/me/drakeet/support/toast/ToastCompat.java#L46-L53
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQuery.java
CouchDBQuery.setAggregationColInInterpreter
private void setAggregationColInInterpreter(EntityMetadata m, CouchDBQueryInterpreter interpreter, Expression exp) { """ Sets the aggregation col in interpreter. @param m the m @param interpreter the interpreter @param exp the exp """ if (StateFieldPathExpression.class.isAssignableFrom(exp.getClass())) { Map<String, Object> map = KunderaQueryUtils.setFieldClazzAndColumnFamily(exp, m, kunderaMetadata); interpreter.setAggregationColumn((String) map.get(Constants.COL_NAME)); } }
java
private void setAggregationColInInterpreter(EntityMetadata m, CouchDBQueryInterpreter interpreter, Expression exp) { if (StateFieldPathExpression.class.isAssignableFrom(exp.getClass())) { Map<String, Object> map = KunderaQueryUtils.setFieldClazzAndColumnFamily(exp, m, kunderaMetadata); interpreter.setAggregationColumn((String) map.get(Constants.COL_NAME)); } }
[ "private", "void", "setAggregationColInInterpreter", "(", "EntityMetadata", "m", ",", "CouchDBQueryInterpreter", "interpreter", ",", "Expression", "exp", ")", "{", "if", "(", "StateFieldPathExpression", ".", "class", ".", "isAssignableFrom", "(", "exp", ".", "getClass", "(", ")", ")", ")", "{", "Map", "<", "String", ",", "Object", ">", "map", "=", "KunderaQueryUtils", ".", "setFieldClazzAndColumnFamily", "(", "exp", ",", "m", ",", "kunderaMetadata", ")", ";", "interpreter", ".", "setAggregationColumn", "(", "(", "String", ")", "map", ".", "get", "(", "Constants", ".", "COL_NAME", ")", ")", ";", "}", "}" ]
Sets the aggregation col in interpreter. @param m the m @param interpreter the interpreter @param exp the exp
[ "Sets", "the", "aggregation", "col", "in", "interpreter", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBQuery.java#L405-L412
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java
CPDefinitionOptionValueRelPersistenceImpl.findByGroupId
@Override public List<CPDefinitionOptionValueRel> findByGroupId(long groupId, int start, int end) { """ Returns a range of all the cp definition option value rels where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionValueRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of cp definition option value rels @param end the upper bound of the range of cp definition option value rels (not inclusive) @return the range of matching cp definition option value rels """ return findByGroupId(groupId, start, end, null); }
java
@Override public List<CPDefinitionOptionValueRel> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionOptionValueRel", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp definition option value rels where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionValueRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of cp definition option value rels @param end the upper bound of the range of cp definition option value rels (not inclusive) @return the range of matching cp definition option value rels
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "option", "value", "rels", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L1554-L1558
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java
EsMarshalling.unmarshallApiEntry
public static ApiEntryBean unmarshallApiEntry(Map<String, Object> source) { """ Unmarshals the given map source into a bean. @param source the source @return the api entry """ if (source == null) { return null; } ApiEntryBean bean = new ApiEntryBean(); bean.setApiOrgId(asString(source.get("apiOrganizationId"))); bean.setApiOrgName(asString(source.get("apiOrganizationName"))); bean.setApiId(asString(source.get("apiId"))); bean.setApiName(asString(source.get("apiName"))); bean.setApiVersion(asString(source.get("apiVersion"))); bean.setPlanName(asString(source.get("planName"))); bean.setPlanId(asString(source.get("planId"))); bean.setPlanVersion(asString(source.get("planVersion"))); postMarshall(bean); return bean; }
java
public static ApiEntryBean unmarshallApiEntry(Map<String, Object> source) { if (source == null) { return null; } ApiEntryBean bean = new ApiEntryBean(); bean.setApiOrgId(asString(source.get("apiOrganizationId"))); bean.setApiOrgName(asString(source.get("apiOrganizationName"))); bean.setApiId(asString(source.get("apiId"))); bean.setApiName(asString(source.get("apiName"))); bean.setApiVersion(asString(source.get("apiVersion"))); bean.setPlanName(asString(source.get("planName"))); bean.setPlanId(asString(source.get("planId"))); bean.setPlanVersion(asString(source.get("planVersion"))); postMarshall(bean); return bean; }
[ "public", "static", "ApiEntryBean", "unmarshallApiEntry", "(", "Map", "<", "String", ",", "Object", ">", "source", ")", "{", "if", "(", "source", "==", "null", ")", "{", "return", "null", ";", "}", "ApiEntryBean", "bean", "=", "new", "ApiEntryBean", "(", ")", ";", "bean", ".", "setApiOrgId", "(", "asString", "(", "source", ".", "get", "(", "\"apiOrganizationId\"", ")", ")", ")", ";", "bean", ".", "setApiOrgName", "(", "asString", "(", "source", ".", "get", "(", "\"apiOrganizationName\"", ")", ")", ")", ";", "bean", ".", "setApiId", "(", "asString", "(", "source", ".", "get", "(", "\"apiId\"", ")", ")", ")", ";", "bean", ".", "setApiName", "(", "asString", "(", "source", ".", "get", "(", "\"apiName\"", ")", ")", ")", ";", "bean", ".", "setApiVersion", "(", "asString", "(", "source", ".", "get", "(", "\"apiVersion\"", ")", ")", ")", ";", "bean", ".", "setPlanName", "(", "asString", "(", "source", ".", "get", "(", "\"planName\"", ")", ")", ")", ";", "bean", ".", "setPlanId", "(", "asString", "(", "source", ".", "get", "(", "\"planId\"", ")", ")", ")", ";", "bean", ".", "setPlanVersion", "(", "asString", "(", "source", ".", "get", "(", "\"planVersion\"", ")", ")", ")", ";", "postMarshall", "(", "bean", ")", ";", "return", "bean", ";", "}" ]
Unmarshals the given map source into a bean. @param source the source @return the api entry
[ "Unmarshals", "the", "given", "map", "source", "into", "a", "bean", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L804-L819
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.listSkusAsync
public Observable<Page<VirtualMachineScaleSetSkuInner>> listSkusAsync(final String resourceGroupName, final String vmScaleSetName) { """ Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualMachineScaleSetSkuInner&gt; object """ return listSkusWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetSkuInner>>, Page<VirtualMachineScaleSetSkuInner>>() { @Override public Page<VirtualMachineScaleSetSkuInner> call(ServiceResponse<Page<VirtualMachineScaleSetSkuInner>> response) { return response.body(); } }); }
java
public Observable<Page<VirtualMachineScaleSetSkuInner>> listSkusAsync(final String resourceGroupName, final String vmScaleSetName) { return listSkusWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetSkuInner>>, Page<VirtualMachineScaleSetSkuInner>>() { @Override public Page<VirtualMachineScaleSetSkuInner> call(ServiceResponse<Page<VirtualMachineScaleSetSkuInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VirtualMachineScaleSetSkuInner", ">", ">", "listSkusAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "vmScaleSetName", ")", "{", "return", "listSkusWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "VirtualMachineScaleSetSkuInner", ">", ">", ",", "Page", "<", "VirtualMachineScaleSetSkuInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "VirtualMachineScaleSetSkuInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "VirtualMachineScaleSetSkuInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM instances allowed for each SKU. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualMachineScaleSetSkuInner&gt; object
[ "Gets", "a", "list", "of", "SKUs", "available", "for", "your", "VM", "scale", "set", "including", "the", "minimum", "and", "maximum", "VM", "instances", "allowed", "for", "each", "SKU", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L1642-L1650
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.processConditions
protected void processConditions(final BuildData buildData, final SpecTopic specTopic, final Document doc) { """ Checks if the conditional pass should be performed. @param buildData Information and data structures for the build. @param specTopic The spec topic the conditions should be processed for, @param doc The DOM Document to process the conditions against. """ final String condition = specTopic.getConditionStatement(true); DocBookUtilities.processConditions(condition, doc, BuilderConstants.DEFAULT_CONDITION); }
java
protected void processConditions(final BuildData buildData, final SpecTopic specTopic, final Document doc) { final String condition = specTopic.getConditionStatement(true); DocBookUtilities.processConditions(condition, doc, BuilderConstants.DEFAULT_CONDITION); }
[ "protected", "void", "processConditions", "(", "final", "BuildData", "buildData", ",", "final", "SpecTopic", "specTopic", ",", "final", "Document", "doc", ")", "{", "final", "String", "condition", "=", "specTopic", ".", "getConditionStatement", "(", "true", ")", ";", "DocBookUtilities", ".", "processConditions", "(", "condition", ",", "doc", ",", "BuilderConstants", ".", "DEFAULT_CONDITION", ")", ";", "}" ]
Checks if the conditional pass should be performed. @param buildData Information and data structures for the build. @param specTopic The spec topic the conditions should be processed for, @param doc The DOM Document to process the conditions against.
[ "Checks", "if", "the", "conditional", "pass", "should", "be", "performed", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L1368-L1371
javagl/CommonUI
src/main/java/de/javagl/common/ui/tree/filtered/TreeModelFilters.java
TreeModelFilters.containsLeafContainingStringIgnoreCase
public static TreeModelFilter containsLeafContainingStringIgnoreCase( final String string) { """ Returns a {@link TreeModelFilter} that is accepting all leaf nodes whose string representation contains the given string (ignoring upper/lower case), and all ancestors of these nodes @param string The string that must be contained in the node string @return The new {@link TreeModelFilter} """ return new TreeModelFilter() { @Override public boolean acceptNode(TreeModel treeModel, TreeNode node) { if (node.isLeaf()) { if (String.valueOf(node).toLowerCase().contains( string.toLowerCase())) { return true; } } for (int i=0; i<node.getChildCount(); i++) { if (acceptNode(treeModel, node.getChildAt(i))) { return true; } } return false; } @Override public String toString() { return "TreeModelFilter[" + "containsLeafContainingStringIgnoreCase("+string+")]"; } }; }
java
public static TreeModelFilter containsLeafContainingStringIgnoreCase( final String string) { return new TreeModelFilter() { @Override public boolean acceptNode(TreeModel treeModel, TreeNode node) { if (node.isLeaf()) { if (String.valueOf(node).toLowerCase().contains( string.toLowerCase())) { return true; } } for (int i=0; i<node.getChildCount(); i++) { if (acceptNode(treeModel, node.getChildAt(i))) { return true; } } return false; } @Override public String toString() { return "TreeModelFilter[" + "containsLeafContainingStringIgnoreCase("+string+")]"; } }; }
[ "public", "static", "TreeModelFilter", "containsLeafContainingStringIgnoreCase", "(", "final", "String", "string", ")", "{", "return", "new", "TreeModelFilter", "(", ")", "{", "@", "Override", "public", "boolean", "acceptNode", "(", "TreeModel", "treeModel", ",", "TreeNode", "node", ")", "{", "if", "(", "node", ".", "isLeaf", "(", ")", ")", "{", "if", "(", "String", ".", "valueOf", "(", "node", ")", ".", "toLowerCase", "(", ")", ".", "contains", "(", "string", ".", "toLowerCase", "(", ")", ")", ")", "{", "return", "true", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "node", ".", "getChildCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "acceptNode", "(", "treeModel", ",", "node", ".", "getChildAt", "(", "i", ")", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"TreeModelFilter[\"", "+", "\"containsLeafContainingStringIgnoreCase(\"", "+", "string", "+", "\")]\"", ";", "}", "}", ";", "}" ]
Returns a {@link TreeModelFilter} that is accepting all leaf nodes whose string representation contains the given string (ignoring upper/lower case), and all ancestors of these nodes @param string The string that must be contained in the node string @return The new {@link TreeModelFilter}
[ "Returns", "a", "{", "@link", "TreeModelFilter", "}", "that", "is", "accepting", "all", "leaf", "nodes", "whose", "string", "representation", "contains", "the", "given", "string", "(", "ignoring", "upper", "/", "lower", "case", ")", "and", "all", "ancestors", "of", "these", "nodes" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/filtered/TreeModelFilters.java#L70-L103
agmip/agmip-common-functions
src/main/java/org/agmip/functions/ExperimentHelper.java
ExperimentHelper.isValidDate
private static boolean isValidDate(String date, Calendar out, String separator) { """ To check if the input date string is valid and match with the required format @param date The input date string, which should comes with the format of yyyy-mm-dd, the separator should be same with the third parameter @param out The Calendar instance which will be assigned with input year, month and day @param separator The separator string used in date format @return check result """ try { String[] dates = date.split(separator); out.set(Calendar.DATE, Integer.parseInt(dates[dates.length - 1])); out.set(Calendar.MONTH, Integer.parseInt(dates[dates.length - 2])); if (dates.length > 2) { out.set(Calendar.YEAR, Integer.parseInt(dates[dates.length - 3])); } } catch (Exception e) { try { out.set(Calendar.DATE, Integer.parseInt(date.substring(date.length() - 2, date.length()))); out.set(Calendar.MONTH, Integer.parseInt(date.substring(date.length() - 4, date.length() - 2)) - 1); if (date.length() > 4) { out.set(Calendar.YEAR, Integer.parseInt(date.substring(date.length() - 8, date.length() - 4)) - 1); } } catch (Exception e2) { return false; } } return true; }
java
private static boolean isValidDate(String date, Calendar out, String separator) { try { String[] dates = date.split(separator); out.set(Calendar.DATE, Integer.parseInt(dates[dates.length - 1])); out.set(Calendar.MONTH, Integer.parseInt(dates[dates.length - 2])); if (dates.length > 2) { out.set(Calendar.YEAR, Integer.parseInt(dates[dates.length - 3])); } } catch (Exception e) { try { out.set(Calendar.DATE, Integer.parseInt(date.substring(date.length() - 2, date.length()))); out.set(Calendar.MONTH, Integer.parseInt(date.substring(date.length() - 4, date.length() - 2)) - 1); if (date.length() > 4) { out.set(Calendar.YEAR, Integer.parseInt(date.substring(date.length() - 8, date.length() - 4)) - 1); } } catch (Exception e2) { return false; } } return true; }
[ "private", "static", "boolean", "isValidDate", "(", "String", "date", ",", "Calendar", "out", ",", "String", "separator", ")", "{", "try", "{", "String", "[", "]", "dates", "=", "date", ".", "split", "(", "separator", ")", ";", "out", ".", "set", "(", "Calendar", ".", "DATE", ",", "Integer", ".", "parseInt", "(", "dates", "[", "dates", ".", "length", "-", "1", "]", ")", ")", ";", "out", ".", "set", "(", "Calendar", ".", "MONTH", ",", "Integer", ".", "parseInt", "(", "dates", "[", "dates", ".", "length", "-", "2", "]", ")", ")", ";", "if", "(", "dates", ".", "length", ">", "2", ")", "{", "out", ".", "set", "(", "Calendar", ".", "YEAR", ",", "Integer", ".", "parseInt", "(", "dates", "[", "dates", ".", "length", "-", "3", "]", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "try", "{", "out", ".", "set", "(", "Calendar", ".", "DATE", ",", "Integer", ".", "parseInt", "(", "date", ".", "substring", "(", "date", ".", "length", "(", ")", "-", "2", ",", "date", ".", "length", "(", ")", ")", ")", ")", ";", "out", ".", "set", "(", "Calendar", ".", "MONTH", ",", "Integer", ".", "parseInt", "(", "date", ".", "substring", "(", "date", ".", "length", "(", ")", "-", "4", ",", "date", ".", "length", "(", ")", "-", "2", ")", ")", "-", "1", ")", ";", "if", "(", "date", ".", "length", "(", ")", ">", "4", ")", "{", "out", ".", "set", "(", "Calendar", ".", "YEAR", ",", "Integer", ".", "parseInt", "(", "date", ".", "substring", "(", "date", ".", "length", "(", ")", "-", "8", ",", "date", ".", "length", "(", ")", "-", "4", ")", ")", "-", "1", ")", ";", "}", "}", "catch", "(", "Exception", "e2", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
To check if the input date string is valid and match with the required format @param date The input date string, which should comes with the format of yyyy-mm-dd, the separator should be same with the third parameter @param out The Calendar instance which will be assigned with input year, month and day @param separator The separator string used in date format @return check result
[ "To", "check", "if", "the", "input", "date", "string", "is", "valid", "and", "match", "with", "the", "required", "format" ]
train
https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/ExperimentHelper.java#L466-L487
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.writeUrlNameMapping
public String writeUrlNameMapping(String name, CmsUUID structureId, String locale, boolean replaceOnPublish) throws CmsException { """ Writes a new URL name mapping for a given resource.<p> This method uses {@link CmsNumberSuffixNameSequence} to generate a sequence of name candidates from the given base name.<p> @param name the base name for the mapping @param structureId the structure id to which the name should be mapped @param locale the locale of the mapping @param replaceOnPublish mappings for which this is set will replace older mappings on publish @return the URL name that was actually used for the mapping @throws CmsException if something goes wrong """ return writeUrlNameMapping(new CmsNumberSuffixNameSequence(name), structureId, locale, replaceOnPublish); }
java
public String writeUrlNameMapping(String name, CmsUUID structureId, String locale, boolean replaceOnPublish) throws CmsException { return writeUrlNameMapping(new CmsNumberSuffixNameSequence(name), structureId, locale, replaceOnPublish); }
[ "public", "String", "writeUrlNameMapping", "(", "String", "name", ",", "CmsUUID", "structureId", ",", "String", "locale", ",", "boolean", "replaceOnPublish", ")", "throws", "CmsException", "{", "return", "writeUrlNameMapping", "(", "new", "CmsNumberSuffixNameSequence", "(", "name", ")", ",", "structureId", ",", "locale", ",", "replaceOnPublish", ")", ";", "}" ]
Writes a new URL name mapping for a given resource.<p> This method uses {@link CmsNumberSuffixNameSequence} to generate a sequence of name candidates from the given base name.<p> @param name the base name for the mapping @param structureId the structure id to which the name should be mapped @param locale the locale of the mapping @param replaceOnPublish mappings for which this is set will replace older mappings on publish @return the URL name that was actually used for the mapping @throws CmsException if something goes wrong
[ "Writes", "a", "new", "URL", "name", "mapping", "for", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L4189-L4193
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/ProxiedTrash.java
ProxiedTrash.moveToTrashAsUser
@Override public boolean moveToTrashAsUser(Path path, final String user) throws IOException { """ Move the path to trash as specified user. @param path {@link org.apache.hadoop.fs.Path} to move. @param user User to move the path as. @return true if the move succeeded. @throws IOException """ return getUserTrash(user).moveToTrash(path); }
java
@Override public boolean moveToTrashAsUser(Path path, final String user) throws IOException { return getUserTrash(user).moveToTrash(path); }
[ "@", "Override", "public", "boolean", "moveToTrashAsUser", "(", "Path", "path", ",", "final", "String", "user", ")", "throws", "IOException", "{", "return", "getUserTrash", "(", "user", ")", ".", "moveToTrash", "(", "path", ")", ";", "}" ]
Move the path to trash as specified user. @param path {@link org.apache.hadoop.fs.Path} to move. @param user User to move the path as. @return true if the move succeeded. @throws IOException
[ "Move", "the", "path", "to", "trash", "as", "specified", "user", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/trash/ProxiedTrash.java#L61-L64
taimos/RESTUtils
src/main/java/de/taimos/restutils/RESTAssert.java
RESTAssert.assertEquals
public static void assertEquals(final Object one, final Object two) { """ assert that objects are equal.<br> This means they are both <i>null</i> or <code>one.equals(two)</code> returns <i>true</i> @param one the first object @param two the second object @throws WebApplicationException with status code 422 (Unprocessable Entity) """ RESTAssert.assertEquals(one, two, RESTAssert.DEFAULT_STATUS_CODE); }
java
public static void assertEquals(final Object one, final Object two) { RESTAssert.assertEquals(one, two, RESTAssert.DEFAULT_STATUS_CODE); }
[ "public", "static", "void", "assertEquals", "(", "final", "Object", "one", ",", "final", "Object", "two", ")", "{", "RESTAssert", ".", "assertEquals", "(", "one", ",", "two", ",", "RESTAssert", ".", "DEFAULT_STATUS_CODE", ")", ";", "}" ]
assert that objects are equal.<br> This means they are both <i>null</i> or <code>one.equals(two)</code> returns <i>true</i> @param one the first object @param two the second object @throws WebApplicationException with status code 422 (Unprocessable Entity)
[ "assert", "that", "objects", "are", "equal", ".", "<br", ">", "This", "means", "they", "are", "both", "<i", ">", "null<", "/", "i", ">", "or", "<code", ">", "one", ".", "equals", "(", "two", ")", "<", "/", "code", ">", "returns", "<i", ">", "true<", "/", "i", ">" ]
train
https://github.com/taimos/RESTUtils/blob/bdb1bf9a2eb13ede0eec6f071c10cb2698313501/src/main/java/de/taimos/restutils/RESTAssert.java#L238-L240
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/PathWrapper.java
PathWrapper.createTempFile
public PathImpl createTempFile(String prefix, String suffix) throws IOException { """ Creates a unique temporary file as a child of this directory. @param prefix filename prefix @param suffix filename suffix, defaults to .tmp @return Path to the new file. """ return getWrappedPath().createTempFile(prefix, suffix); }
java
public PathImpl createTempFile(String prefix, String suffix) throws IOException { return getWrappedPath().createTempFile(prefix, suffix); }
[ "public", "PathImpl", "createTempFile", "(", "String", "prefix", ",", "String", "suffix", ")", "throws", "IOException", "{", "return", "getWrappedPath", "(", ")", ".", "createTempFile", "(", "prefix", ",", "suffix", ")", ";", "}" ]
Creates a unique temporary file as a child of this directory. @param prefix filename prefix @param suffix filename suffix, defaults to .tmp @return Path to the new file.
[ "Creates", "a", "unique", "temporary", "file", "as", "a", "child", "of", "this", "directory", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathWrapper.java#L585-L588
entrusc/xdata
src/main/java/com/moebiusgames/xdata/DataNode.java
DataNode.setObject
public <T> void setObject(DataKey<T> key, T object) { """ stores an object for the given key @param <T> @param key @param object """ if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (object == null && !key.allowNull()) { throw new IllegalArgumentException("key \"" + key.getName() + "\" disallows null values but object was null"); } data.put(key.getName(), object); }
java
public <T> void setObject(DataKey<T> key, T object) { if (key == null) { throw new IllegalArgumentException("key must not be null"); } if (object == null && !key.allowNull()) { throw new IllegalArgumentException("key \"" + key.getName() + "\" disallows null values but object was null"); } data.put(key.getName(), object); }
[ "public", "<", "T", ">", "void", "setObject", "(", "DataKey", "<", "T", ">", "key", ",", "T", "object", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"key must not be null\"", ")", ";", "}", "if", "(", "object", "==", "null", "&&", "!", "key", ".", "allowNull", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"key \\\"\"", "+", "key", ".", "getName", "(", ")", "+", "\"\\\" disallows null values but object was null\"", ")", ";", "}", "data", ".", "put", "(", "key", ".", "getName", "(", ")", ",", "object", ")", ";", "}" ]
stores an object for the given key @param <T> @param key @param object
[ "stores", "an", "object", "for", "the", "given", "key" ]
train
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/DataNode.java#L113-L121
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java
RedisClusterStorage.resumeJobs
@Override public Collection<String> resumeJobs(GroupMatcher<JobKey> matcher, JedisCluster jedis) throws JobPersistenceException { """ Resume (un-pause) all of the <code>{@link Job}s</code> in the given group. @param matcher the matcher with which to compare job group names @param jedis a thread-safe Redis connection @return the set of job groups which were matched and resumed """ Set<String> resumedJobGroups = new HashSet<>(); if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String jobGroupSetKey = redisSchema.jobGroupSetKey(new JobKey("", matcher.getCompareToValue())); Long unpauseResponse = jedis.srem(redisSchema.pausedJobGroupsSet(), jobGroupSetKey); Set<String> jobsResponse = jedis.smembers(jobGroupSetKey); if (unpauseResponse > 0) { resumedJobGroups.add(redisSchema.jobGroup(jobGroupSetKey)); } for (String job : jobsResponse) { resumeJob(redisSchema.jobKey(job), jedis); } } else { for (final String jobGroupSetKey : jedis.smembers(redisSchema.jobGroupsSet())) { if (matcher.getCompareWithOperator().evaluate(redisSchema.jobGroup(jobGroupSetKey), matcher.getCompareToValue())) { resumedJobGroups.addAll(resumeJobs(GroupMatcher.jobGroupEquals(redisSchema.jobGroup(jobGroupSetKey)), jedis)); } } } return resumedJobGroups; }
java
@Override public Collection<String> resumeJobs(GroupMatcher<JobKey> matcher, JedisCluster jedis) throws JobPersistenceException { Set<String> resumedJobGroups = new HashSet<>(); if (matcher.getCompareWithOperator() == StringMatcher.StringOperatorName.EQUALS) { final String jobGroupSetKey = redisSchema.jobGroupSetKey(new JobKey("", matcher.getCompareToValue())); Long unpauseResponse = jedis.srem(redisSchema.pausedJobGroupsSet(), jobGroupSetKey); Set<String> jobsResponse = jedis.smembers(jobGroupSetKey); if (unpauseResponse > 0) { resumedJobGroups.add(redisSchema.jobGroup(jobGroupSetKey)); } for (String job : jobsResponse) { resumeJob(redisSchema.jobKey(job), jedis); } } else { for (final String jobGroupSetKey : jedis.smembers(redisSchema.jobGroupsSet())) { if (matcher.getCompareWithOperator().evaluate(redisSchema.jobGroup(jobGroupSetKey), matcher.getCompareToValue())) { resumedJobGroups.addAll(resumeJobs(GroupMatcher.jobGroupEquals(redisSchema.jobGroup(jobGroupSetKey)), jedis)); } } } return resumedJobGroups; }
[ "@", "Override", "public", "Collection", "<", "String", ">", "resumeJobs", "(", "GroupMatcher", "<", "JobKey", ">", "matcher", ",", "JedisCluster", "jedis", ")", "throws", "JobPersistenceException", "{", "Set", "<", "String", ">", "resumedJobGroups", "=", "new", "HashSet", "<>", "(", ")", ";", "if", "(", "matcher", ".", "getCompareWithOperator", "(", ")", "==", "StringMatcher", ".", "StringOperatorName", ".", "EQUALS", ")", "{", "final", "String", "jobGroupSetKey", "=", "redisSchema", ".", "jobGroupSetKey", "(", "new", "JobKey", "(", "\"\"", ",", "matcher", ".", "getCompareToValue", "(", ")", ")", ")", ";", "Long", "unpauseResponse", "=", "jedis", ".", "srem", "(", "redisSchema", ".", "pausedJobGroupsSet", "(", ")", ",", "jobGroupSetKey", ")", ";", "Set", "<", "String", ">", "jobsResponse", "=", "jedis", ".", "smembers", "(", "jobGroupSetKey", ")", ";", "if", "(", "unpauseResponse", ">", "0", ")", "{", "resumedJobGroups", ".", "add", "(", "redisSchema", ".", "jobGroup", "(", "jobGroupSetKey", ")", ")", ";", "}", "for", "(", "String", "job", ":", "jobsResponse", ")", "{", "resumeJob", "(", "redisSchema", ".", "jobKey", "(", "job", ")", ",", "jedis", ")", ";", "}", "}", "else", "{", "for", "(", "final", "String", "jobGroupSetKey", ":", "jedis", ".", "smembers", "(", "redisSchema", ".", "jobGroupsSet", "(", ")", ")", ")", "{", "if", "(", "matcher", ".", "getCompareWithOperator", "(", ")", ".", "evaluate", "(", "redisSchema", ".", "jobGroup", "(", "jobGroupSetKey", ")", ",", "matcher", ".", "getCompareToValue", "(", ")", ")", ")", "{", "resumedJobGroups", ".", "addAll", "(", "resumeJobs", "(", "GroupMatcher", ".", "jobGroupEquals", "(", "redisSchema", ".", "jobGroup", "(", "jobGroupSetKey", ")", ")", ",", "jedis", ")", ")", ";", "}", "}", "}", "return", "resumedJobGroups", ";", "}" ]
Resume (un-pause) all of the <code>{@link Job}s</code> in the given group. @param matcher the matcher with which to compare job group names @param jedis a thread-safe Redis connection @return the set of job groups which were matched and resumed
[ "Resume", "(", "un", "-", "pause", ")", "all", "of", "the", "<code", ">", "{", "@link", "Job", "}", "s<", "/", "code", ">", "in", "the", "given", "group", "." ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisClusterStorage.java#L597-L618
zeroturnaround/maven-jrebel-plugin
src/main/java/org/zeroturnaround/javarebel/maven/GenerateRebelMojo.java
GenerateRebelMojo.getPluginConfigurationDom
private static Xpp3Dom getPluginConfigurationDom(MavenProject project, String pluginId) { """ Taken from eclipse plugin. Search for the configuration Xpp3 dom of an other plugin. @param project the current maven project to get the configuration from. @param pluginId the group id and artifact id of the plugin to search for @return the value of the plugin configuration """ Plugin plugin = project.getBuild().getPluginsAsMap().get(pluginId); if (plugin != null) { return (Xpp3Dom) plugin.getConfiguration(); } return null; }
java
private static Xpp3Dom getPluginConfigurationDom(MavenProject project, String pluginId) { Plugin plugin = project.getBuild().getPluginsAsMap().get(pluginId); if (plugin != null) { return (Xpp3Dom) plugin.getConfiguration(); } return null; }
[ "private", "static", "Xpp3Dom", "getPluginConfigurationDom", "(", "MavenProject", "project", ",", "String", "pluginId", ")", "{", "Plugin", "plugin", "=", "project", ".", "getBuild", "(", ")", ".", "getPluginsAsMap", "(", ")", ".", "get", "(", "pluginId", ")", ";", "if", "(", "plugin", "!=", "null", ")", "{", "return", "(", "Xpp3Dom", ")", "plugin", ".", "getConfiguration", "(", ")", ";", "}", "return", "null", ";", "}" ]
Taken from eclipse plugin. Search for the configuration Xpp3 dom of an other plugin. @param project the current maven project to get the configuration from. @param pluginId the group id and artifact id of the plugin to search for @return the value of the plugin configuration
[ "Taken", "from", "eclipse", "plugin", ".", "Search", "for", "the", "configuration", "Xpp3", "dom", "of", "an", "other", "plugin", "." ]
train
https://github.com/zeroturnaround/maven-jrebel-plugin/blob/6a0d12529a13ae6b2b772658a714398147c091ca/src/main/java/org/zeroturnaround/javarebel/maven/GenerateRebelMojo.java#L742-L749
apache/flink
flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java
MemorySegment.putChar
@SuppressWarnings("restriction") public final void putChar(int index, char value) { """ Writes a char value to the given position, in the system's native byte order. @param index The position at which the memory will be written. @param value The char value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2. """ final long pos = address + index; if (index >= 0 && pos <= addressLimit - 2) { UNSAFE.putChar(heapMemory, pos, value); } else if (address > addressLimit) { throw new IllegalStateException("segment has been freed"); } else { // index is in fact invalid throw new IndexOutOfBoundsException(); } }
java
@SuppressWarnings("restriction") public final void putChar(int index, char value) { final long pos = address + index; if (index >= 0 && pos <= addressLimit - 2) { UNSAFE.putChar(heapMemory, pos, value); } else if (address > addressLimit) { throw new IllegalStateException("segment has been freed"); } else { // index is in fact invalid throw new IndexOutOfBoundsException(); } }
[ "@", "SuppressWarnings", "(", "\"restriction\"", ")", "public", "final", "void", "putChar", "(", "int", "index", ",", "char", "value", ")", "{", "final", "long", "pos", "=", "address", "+", "index", ";", "if", "(", "index", ">=", "0", "&&", "pos", "<=", "addressLimit", "-", "2", ")", "{", "UNSAFE", ".", "putChar", "(", "heapMemory", ",", "pos", ",", "value", ")", ";", "}", "else", "if", "(", "address", ">", "addressLimit", ")", "{", "throw", "new", "IllegalStateException", "(", "\"segment has been freed\"", ")", ";", "}", "else", "{", "// index is in fact invalid", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "}" ]
Writes a char value to the given position, in the system's native byte order. @param index The position at which the memory will be written. @param value The char value to be written. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2.
[ "Writes", "a", "char", "value", "to", "the", "given", "position", "in", "the", "system", "s", "native", "byte", "order", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L487-L500
javagl/Common
src/main/java/de/javagl/common/beans/XmlBeanUtil.java
XmlBeanUtil.createFullBeanXmlString
public static String createFullBeanXmlString(Object object) { """ Create the XML string describing the given bean, as created by an <code>XMLEncoder</code>, but including all properties, even if they still have their default values. @param object The bean object @return The string @throws XmlException If there is an error while encoding the object """ ByteArrayOutputStream stream = null; try { stream = new ByteArrayOutputStream(); writeFullBeanXml(object, stream); return stream.toString(); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { throw new XmlException("Could not close the stream", e); } } } }
java
public static String createFullBeanXmlString(Object object) { ByteArrayOutputStream stream = null; try { stream = new ByteArrayOutputStream(); writeFullBeanXml(object, stream); return stream.toString(); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { throw new XmlException("Could not close the stream", e); } } } }
[ "public", "static", "String", "createFullBeanXmlString", "(", "Object", "object", ")", "{", "ByteArrayOutputStream", "stream", "=", "null", ";", "try", "{", "stream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "writeFullBeanXml", "(", "object", ",", "stream", ")", ";", "return", "stream", ".", "toString", "(", ")", ";", "}", "finally", "{", "if", "(", "stream", "!=", "null", ")", "{", "try", "{", "stream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "XmlException", "(", "\"Could not close the stream\"", ",", "e", ")", ";", "}", "}", "}", "}" ]
Create the XML string describing the given bean, as created by an <code>XMLEncoder</code>, but including all properties, even if they still have their default values. @param object The bean object @return The string @throws XmlException If there is an error while encoding the object
[ "Create", "the", "XML", "string", "describing", "the", "given", "bean", "as", "created", "by", "an", "<code", ">", "XMLEncoder<", "/", "code", ">", "but", "including", "all", "properties", "even", "if", "they", "still", "have", "their", "default", "values", "." ]
train
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/XmlBeanUtil.java#L78-L101
Sciss/abc4j
abc/src/main/java/abc/ui/swing/JStaffLine.java
JStaffLine.setTablature
protected void setTablature(Tablature tablature) { """ attaches a tablature to this staff line @param tablature null to remove tablature """ if (tablature != null) m_tablature = new JTablature(tablature, getBase(), getMetrics()); else m_tablature = null; }
java
protected void setTablature(Tablature tablature) { if (tablature != null) m_tablature = new JTablature(tablature, getBase(), getMetrics()); else m_tablature = null; }
[ "protected", "void", "setTablature", "(", "Tablature", "tablature", ")", "{", "if", "(", "tablature", "!=", "null", ")", "m_tablature", "=", "new", "JTablature", "(", "tablature", ",", "getBase", "(", ")", ",", "getMetrics", "(", ")", ")", ";", "else", "m_tablature", "=", "null", ";", "}" ]
attaches a tablature to this staff line @param tablature null to remove tablature
[ "attaches", "a", "tablature", "to", "this", "staff", "line" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/JStaffLine.java#L106-L111
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java
ScriptingUtils.executeGroovyScriptEngine
public static <T> T executeGroovyScriptEngine(final String script, final Map<String, Object> variables, final Class<T> clazz) { """ Execute inline groovy script engine. @param <T> the type parameter @param script the script @param variables the variables @param clazz the clazz @return the t """ try { val engine = new ScriptEngineManager().getEngineByName("groovy"); if (engine == null) { LOGGER.warn("Script engine is not available for Groovy"); return null; } val binding = new SimpleBindings(); if (variables != null && !variables.isEmpty()) { binding.putAll(variables); } if (!binding.containsKey("logger")) { binding.put("logger", LOGGER); } val result = engine.eval(script, binding); return getGroovyScriptExecutionResultOrThrow(clazz, result); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
java
public static <T> T executeGroovyScriptEngine(final String script, final Map<String, Object> variables, final Class<T> clazz) { try { val engine = new ScriptEngineManager().getEngineByName("groovy"); if (engine == null) { LOGGER.warn("Script engine is not available for Groovy"); return null; } val binding = new SimpleBindings(); if (variables != null && !variables.isEmpty()) { binding.putAll(variables); } if (!binding.containsKey("logger")) { binding.put("logger", LOGGER); } val result = engine.eval(script, binding); return getGroovyScriptExecutionResultOrThrow(clazz, result); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
[ "public", "static", "<", "T", ">", "T", "executeGroovyScriptEngine", "(", "final", "String", "script", ",", "final", "Map", "<", "String", ",", "Object", ">", "variables", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "val", "engine", "=", "new", "ScriptEngineManager", "(", ")", ".", "getEngineByName", "(", "\"groovy\"", ")", ";", "if", "(", "engine", "==", "null", ")", "{", "LOGGER", ".", "warn", "(", "\"Script engine is not available for Groovy\"", ")", ";", "return", "null", ";", "}", "val", "binding", "=", "new", "SimpleBindings", "(", ")", ";", "if", "(", "variables", "!=", "null", "&&", "!", "variables", ".", "isEmpty", "(", ")", ")", "{", "binding", ".", "putAll", "(", "variables", ")", ";", "}", "if", "(", "!", "binding", ".", "containsKey", "(", "\"logger\"", ")", ")", "{", "binding", ".", "put", "(", "\"logger\"", ",", "LOGGER", ")", ";", "}", "val", "result", "=", "engine", ".", "eval", "(", "script", ",", "binding", ")", ";", "return", "getGroovyScriptExecutionResultOrThrow", "(", "clazz", ",", "result", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "LOGGER", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "return", "null", ";", "}" ]
Execute inline groovy script engine. @param <T> the type parameter @param script the script @param variables the variables @param clazz the clazz @return the t
[ "Execute", "inline", "groovy", "script", "engine", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java#L376-L398
vst/commons-math-extensions
src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java
EMatrixUtils.colSubtract
public static RealMatrix colSubtract (RealMatrix matrix, double[] vector) { """ Returns a new matrix by subtracting elements column by column. @param matrix The input matrix @param vector The vector to be subtracted from columns @return A new matrix of which the vector is subtracted column by column """ // Declare and initialize the new matrix: double[][] retval = new double[matrix.getRowDimension()][matrix.getColumnDimension()]; // Iterate over rows: for (int col = 0; col < retval.length; col++) { // Iterate over columns: for (int row = 0; row < retval[0].length; row++) { retval[row][col] = matrix.getEntry(row, col) - vector[row]; } } // Done, return a new matrix: return MatrixUtils.createRealMatrix(retval); }
java
public static RealMatrix colSubtract (RealMatrix matrix, double[] vector) { // Declare and initialize the new matrix: double[][] retval = new double[matrix.getRowDimension()][matrix.getColumnDimension()]; // Iterate over rows: for (int col = 0; col < retval.length; col++) { // Iterate over columns: for (int row = 0; row < retval[0].length; row++) { retval[row][col] = matrix.getEntry(row, col) - vector[row]; } } // Done, return a new matrix: return MatrixUtils.createRealMatrix(retval); }
[ "public", "static", "RealMatrix", "colSubtract", "(", "RealMatrix", "matrix", ",", "double", "[", "]", "vector", ")", "{", "// Declare and initialize the new matrix:", "double", "[", "]", "[", "]", "retval", "=", "new", "double", "[", "matrix", ".", "getRowDimension", "(", ")", "]", "[", "matrix", ".", "getColumnDimension", "(", ")", "]", ";", "// Iterate over rows:", "for", "(", "int", "col", "=", "0", ";", "col", "<", "retval", ".", "length", ";", "col", "++", ")", "{", "// Iterate over columns:", "for", "(", "int", "row", "=", "0", ";", "row", "<", "retval", "[", "0", "]", ".", "length", ";", "row", "++", ")", "{", "retval", "[", "row", "]", "[", "col", "]", "=", "matrix", ".", "getEntry", "(", "row", ",", "col", ")", "-", "vector", "[", "row", "]", ";", "}", "}", "// Done, return a new matrix:", "return", "MatrixUtils", ".", "createRealMatrix", "(", "retval", ")", ";", "}" ]
Returns a new matrix by subtracting elements column by column. @param matrix The input matrix @param vector The vector to be subtracted from columns @return A new matrix of which the vector is subtracted column by column
[ "Returns", "a", "new", "matrix", "by", "subtracting", "elements", "column", "by", "column", "." ]
train
https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java#L145-L159
ops4j/org.ops4j.base
ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java
PropertiesUtils.readListFile
public static String[] readListFile( URL listFile ) throws IOException { """ Read a file and return the list of lines in an array of strings. @param listFile the url to read from @return the lines @throws IOException if a read error occurs """ ArrayList<String> list = new ArrayList<String>(); InputStream stream = listFile.openStream(); try { InputStreamReader isr = new InputStreamReader( stream, "UTF-8" ); BufferedReader reader = new BufferedReader( isr ); String line = reader.readLine(); while( line != null ) { list.add( line ); line = reader.readLine(); } String[] items = new String[list.size()]; list.toArray( items ); return items; } finally { stream.close(); } }
java
public static String[] readListFile( URL listFile ) throws IOException { ArrayList<String> list = new ArrayList<String>(); InputStream stream = listFile.openStream(); try { InputStreamReader isr = new InputStreamReader( stream, "UTF-8" ); BufferedReader reader = new BufferedReader( isr ); String line = reader.readLine(); while( line != null ) { list.add( line ); line = reader.readLine(); } String[] items = new String[list.size()]; list.toArray( items ); return items; } finally { stream.close(); } }
[ "public", "static", "String", "[", "]", "readListFile", "(", "URL", "listFile", ")", "throws", "IOException", "{", "ArrayList", "<", "String", ">", "list", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "InputStream", "stream", "=", "listFile", ".", "openStream", "(", ")", ";", "try", "{", "InputStreamReader", "isr", "=", "new", "InputStreamReader", "(", "stream", ",", "\"UTF-8\"", ")", ";", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "isr", ")", ";", "String", "line", "=", "reader", ".", "readLine", "(", ")", ";", "while", "(", "line", "!=", "null", ")", "{", "list", ".", "add", "(", "line", ")", ";", "line", "=", "reader", ".", "readLine", "(", ")", ";", "}", "String", "[", "]", "items", "=", "new", "String", "[", "list", ".", "size", "(", ")", "]", ";", "list", ".", "toArray", "(", "items", ")", ";", "return", "items", ";", "}", "finally", "{", "stream", ".", "close", "(", ")", ";", "}", "}" ]
Read a file and return the list of lines in an array of strings. @param listFile the url to read from @return the lines @throws IOException if a read error occurs
[ "Read", "a", "file", "and", "return", "the", "list", "of", "lines", "in", "an", "array", "of", "strings", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-collections/src/main/java/org/ops4j/util/collections/PropertiesUtils.java#L177-L200
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/generator/DataDictionaryGenerator.java
DataDictionaryGenerator.genCell
protected void genCell(int columnMaxLen, String preChar, String value, String fillChar, String postChar, StringBuilder ret) { """ /* -----------+---------+------+-----+---------+---------------- Field | Type | Null | Key | Default | Remarks -----------+---------+------+-----+---------+---------------- id | int(11) | NO | PRI | NULL | remarks here """ ret.append(preChar); ret.append(value); for (int i=0, n=columnMaxLen-value.length() + 1; i<n; i++) { ret.append(fillChar); // 值后的填充字符,值为 " "、"-" } ret.append(postChar); }
java
protected void genCell(int columnMaxLen, String preChar, String value, String fillChar, String postChar, StringBuilder ret) { ret.append(preChar); ret.append(value); for (int i=0, n=columnMaxLen-value.length() + 1; i<n; i++) { ret.append(fillChar); // 值后的填充字符,值为 " "、"-" } ret.append(postChar); }
[ "protected", "void", "genCell", "(", "int", "columnMaxLen", ",", "String", "preChar", ",", "String", "value", ",", "String", "fillChar", ",", "String", "postChar", ",", "StringBuilder", "ret", ")", "{", "ret", ".", "append", "(", "preChar", ")", ";", "ret", ".", "append", "(", "value", ")", ";", "for", "(", "int", "i", "=", "0", ",", "n", "=", "columnMaxLen", "-", "value", ".", "length", "(", ")", "+", "1", ";", "i", "<", "n", ";", "i", "++", ")", "{", "ret", ".", "append", "(", "fillChar", ")", ";", "// 值后的填充字符,值为 \" \"、\"-\"\r", "}", "ret", ".", "append", "(", "postChar", ")", ";", "}" ]
/* -----------+---------+------+-----+---------+---------------- Field | Type | Null | Key | Default | Remarks -----------+---------+------+-----+---------+---------------- id | int(11) | NO | PRI | NULL | remarks here
[ "/", "*", "-----------", "+", "---------", "+", "------", "+", "-----", "+", "---------", "+", "----------------", "Field", "|", "Type", "|", "Null", "|", "Key", "|", "Default", "|", "Remarks", "-----------", "+", "---------", "+", "------", "+", "-----", "+", "---------", "+", "----------------", "id", "|", "int", "(", "11", ")", "|", "NO", "|", "PRI", "|", "NULL", "|", "remarks", "here" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/generator/DataDictionaryGenerator.java#L104-L111
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java
VpnSitesInner.beginCreateOrUpdateAsync
public Observable<VpnSiteInner> beginCreateOrUpdateAsync(String resourceGroupName, String vpnSiteName, VpnSiteInner vpnSiteParameters) { """ Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being created or updated. @param vpnSiteParameters Parameters supplied to create or update VpnSite. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnSiteInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteParameters).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
java
public Observable<VpnSiteInner> beginCreateOrUpdateAsync(String resourceGroupName, String vpnSiteName, VpnSiteInner vpnSiteParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteParameters).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnSiteInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vpnSiteName", ",", "VpnSiteInner", "vpnSiteParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vpnSiteName", ",", "vpnSiteParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VpnSiteInner", ">", ",", "VpnSiteInner", ">", "(", ")", "{", "@", "Override", "public", "VpnSiteInner", "call", "(", "ServiceResponse", "<", "VpnSiteInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being created or updated. @param vpnSiteParameters Parameters supplied to create or update VpnSite. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VpnSiteInner object
[ "Creates", "a", "VpnSite", "resource", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "VpnSite", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java#L313-L320
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/css/CssImageUrlRewriter.java
CssImageUrlRewriter.rewriteUrl
public StringBuffer rewriteUrl(String originalCssPath, String newCssPath, String originalCssContent) throws IOException { """ Rewrites the image URL @param originalCssPath the original CSS path @param newCssPath the new CSS path @param originalCssContent the original CSS content @return the new CSS content with image path rewritten @throws IOException if an IO exception occurs """ // Rewrite each css image url path Matcher matcher = URL_PATTERN.matcher(originalCssContent); StringBuffer sb = new StringBuffer(); while (matcher.find()) { String url = getUrlPath(matcher.group(), originalCssPath, newCssPath); matcher.appendReplacement(sb, RegexUtil.adaptReplacementToMatcher(url)); } matcher.appendTail(sb); return sb; }
java
public StringBuffer rewriteUrl(String originalCssPath, String newCssPath, String originalCssContent) throws IOException { // Rewrite each css image url path Matcher matcher = URL_PATTERN.matcher(originalCssContent); StringBuffer sb = new StringBuffer(); while (matcher.find()) { String url = getUrlPath(matcher.group(), originalCssPath, newCssPath); matcher.appendReplacement(sb, RegexUtil.adaptReplacementToMatcher(url)); } matcher.appendTail(sb); return sb; }
[ "public", "StringBuffer", "rewriteUrl", "(", "String", "originalCssPath", ",", "String", "newCssPath", ",", "String", "originalCssContent", ")", "throws", "IOException", "{", "// Rewrite each css image url path", "Matcher", "matcher", "=", "URL_PATTERN", ".", "matcher", "(", "originalCssContent", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "while", "(", "matcher", ".", "find", "(", ")", ")", "{", "String", "url", "=", "getUrlPath", "(", "matcher", ".", "group", "(", ")", ",", "originalCssPath", ",", "newCssPath", ")", ";", "matcher", ".", "appendReplacement", "(", "sb", ",", "RegexUtil", ".", "adaptReplacementToMatcher", "(", "url", ")", ")", ";", "}", "matcher", ".", "appendTail", "(", "sb", ")", ";", "return", "sb", ";", "}" ]
Rewrites the image URL @param originalCssPath the original CSS path @param newCssPath the new CSS path @param originalCssContent the original CSS content @return the new CSS content with image path rewritten @throws IOException if an IO exception occurs
[ "Rewrites", "the", "image", "URL" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/css/CssImageUrlRewriter.java#L157-L170
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java
ExtensionsInner.getMonitoringStatusAsync
public Observable<ClusterMonitoringResponseInner> getMonitoringStatusAsync(String resourceGroupName, String clusterName) { """ Gets the status of Operations Management Suite (OMS) on the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterMonitoringResponseInner object """ return getMonitoringStatusWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterMonitoringResponseInner>, ClusterMonitoringResponseInner>() { @Override public ClusterMonitoringResponseInner call(ServiceResponse<ClusterMonitoringResponseInner> response) { return response.body(); } }); }
java
public Observable<ClusterMonitoringResponseInner> getMonitoringStatusAsync(String resourceGroupName, String clusterName) { return getMonitoringStatusWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<ClusterMonitoringResponseInner>, ClusterMonitoringResponseInner>() { @Override public ClusterMonitoringResponseInner call(ServiceResponse<ClusterMonitoringResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ClusterMonitoringResponseInner", ">", "getMonitoringStatusAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ")", "{", "return", "getMonitoringStatusWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ClusterMonitoringResponseInner", ">", ",", "ClusterMonitoringResponseInner", ">", "(", ")", "{", "@", "Override", "public", "ClusterMonitoringResponseInner", "call", "(", "ServiceResponse", "<", "ClusterMonitoringResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the status of Operations Management Suite (OMS) on the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ClusterMonitoringResponseInner object
[ "Gets", "the", "status", "of", "Operations", "Management", "Suite", "(", "OMS", ")", "on", "the", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L306-L313
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
ScopedServletUtils.getScopedRequest
public static ScopedRequest getScopedRequest( HttpServletRequest realRequest, String overrideURI, ServletContext servletContext, Object scopeKey ) { """ Get the cached ScopedRequest wrapper. If none exists, creates one and caches it. @deprecated Use {@link #getScopedRequest(HttpServletRequest, String, ServletContext, Object, boolean)}. @param realRequest the "real" (outer) HttpServletRequest, which will be wrapped. @param overrideURI the request-URI for the wrapped object. This URI must begin with the context path. @param servletContext the current ServletContext. @param scopeKey the scope-key associated with the new (or looked-up) scoped request. @return the cached (or newly-created) ScopedRequest. """ return getScopedRequest( realRequest, overrideURI, servletContext, scopeKey, false ); }
java
public static ScopedRequest getScopedRequest( HttpServletRequest realRequest, String overrideURI, ServletContext servletContext, Object scopeKey ) { return getScopedRequest( realRequest, overrideURI, servletContext, scopeKey, false ); }
[ "public", "static", "ScopedRequest", "getScopedRequest", "(", "HttpServletRequest", "realRequest", ",", "String", "overrideURI", ",", "ServletContext", "servletContext", ",", "Object", "scopeKey", ")", "{", "return", "getScopedRequest", "(", "realRequest", ",", "overrideURI", ",", "servletContext", ",", "scopeKey", ",", "false", ")", ";", "}" ]
Get the cached ScopedRequest wrapper. If none exists, creates one and caches it. @deprecated Use {@link #getScopedRequest(HttpServletRequest, String, ServletContext, Object, boolean)}. @param realRequest the "real" (outer) HttpServletRequest, which will be wrapped. @param overrideURI the request-URI for the wrapped object. This URI must begin with the context path. @param servletContext the current ServletContext. @param scopeKey the scope-key associated with the new (or looked-up) scoped request. @return the cached (or newly-created) ScopedRequest.
[ "Get", "the", "cached", "ScopedRequest", "wrapper", ".", "If", "none", "exists", "creates", "one", "and", "caches", "it", ".", "@deprecated", "Use", "{", "@link", "#getScopedRequest", "(", "HttpServletRequest", "String", "ServletContext", "Object", "boolean", ")", "}", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L65-L69
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-diff/xwiki-commons-diff-api/src/main/java/org/xwiki/diff/internal/DefaultDiffManager.java
DefaultDiffManager.isFullyModified
private <E> boolean isFullyModified(List commonAncestor, Patch<E> patchCurrent) { """ Check if the content is completely different between the ancestor and the current version @param <E> the type of compared elements @param commonAncestor previous version @param patchCurrent patch to the current version @return either or not the user has changed everything """ return patchCurrent.size() == 1 && commonAncestor.size() == patchCurrent.get(0).getPrevious().size(); }
java
private <E> boolean isFullyModified(List commonAncestor, Patch<E> patchCurrent) { return patchCurrent.size() == 1 && commonAncestor.size() == patchCurrent.get(0).getPrevious().size(); }
[ "private", "<", "E", ">", "boolean", "isFullyModified", "(", "List", "commonAncestor", ",", "Patch", "<", "E", ">", "patchCurrent", ")", "{", "return", "patchCurrent", ".", "size", "(", ")", "==", "1", "&&", "commonAncestor", ".", "size", "(", ")", "==", "patchCurrent", ".", "get", "(", "0", ")", ".", "getPrevious", "(", ")", ".", "size", "(", ")", ";", "}" ]
Check if the content is completely different between the ancestor and the current version @param <E> the type of compared elements @param commonAncestor previous version @param patchCurrent patch to the current version @return either or not the user has changed everything
[ "Check", "if", "the", "content", "is", "completely", "different", "between", "the", "ancestor", "and", "the", "current", "version" ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-diff/xwiki-commons-diff-api/src/main/java/org/xwiki/diff/internal/DefaultDiffManager.java#L399-L401
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Float> getAt(float[] array, ObjectRange range) { """ Support the subscript operator with an ObjectRange for a float array @param array a float array @param range an ObjectRange indicating the indices for the items to retrieve @return list of the retrieved floats @since 1.0 """ return primitiveArrayGet(array, range); }
java
@SuppressWarnings("unchecked") public static List<Float> getAt(float[] array, ObjectRange range) { return primitiveArrayGet(array, range); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Float", ">", "getAt", "(", "float", "[", "]", "array", ",", "ObjectRange", "range", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "range", ")", ";", "}" ]
Support the subscript operator with an ObjectRange for a float array @param array a float array @param range an ObjectRange indicating the indices for the items to retrieve @return list of the retrieved floats @since 1.0
[ "Support", "the", "subscript", "operator", "with", "an", "ObjectRange", "for", "a", "float", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13899-L13902
fommil/matrix-toolkits-java
src/main/java/no/uib/cipr/matrix/sparse/GMRES.java
GMRES.setRestart
public void setRestart(int restart) { """ Sets the restart parameter @param restart GMRES iteration is restarted after this number of iterations """ this.restart = restart; if (restart <= 0) throw new IllegalArgumentException( "restart must be a positive integer"); s = new DenseVector(restart + 1); H = new DenseMatrix(restart + 1, restart); rotation = new GivensRotation[restart + 1]; v = new Vector[restart + 1]; for (int i = 0; i < v.length; ++i) v[i] = r.copy().zero(); }
java
public void setRestart(int restart) { this.restart = restart; if (restart <= 0) throw new IllegalArgumentException( "restart must be a positive integer"); s = new DenseVector(restart + 1); H = new DenseMatrix(restart + 1, restart); rotation = new GivensRotation[restart + 1]; v = new Vector[restart + 1]; for (int i = 0; i < v.length; ++i) v[i] = r.copy().zero(); }
[ "public", "void", "setRestart", "(", "int", "restart", ")", "{", "this", ".", "restart", "=", "restart", ";", "if", "(", "restart", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"restart must be a positive integer\"", ")", ";", "s", "=", "new", "DenseVector", "(", "restart", "+", "1", ")", ";", "H", "=", "new", "DenseMatrix", "(", "restart", "+", "1", ",", "restart", ")", ";", "rotation", "=", "new", "GivensRotation", "[", "restart", "+", "1", "]", ";", "v", "=", "new", "Vector", "[", "restart", "+", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "v", ".", "length", ";", "++", "i", ")", "v", "[", "i", "]", "=", "r", ".", "copy", "(", ")", ".", "zero", "(", ")", ";", "}" ]
Sets the restart parameter @param restart GMRES iteration is restarted after this number of iterations
[ "Sets", "the", "restart", "parameter" ]
train
https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/sparse/GMRES.java#L112-L125
jenkinsci/jenkins
core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java
HudsonPrivateSecurityRealm.createAccount
public User createAccount(String userName, String password) throws IOException { """ Creates a new user account by registering a password to the user. """ User user = User.getById(userName, true); user.addProperty(Details.fromPlainPassword(password)); SecurityListener.fireUserCreated(user.getId()); return user; }
java
public User createAccount(String userName, String password) throws IOException { User user = User.getById(userName, true); user.addProperty(Details.fromPlainPassword(password)); SecurityListener.fireUserCreated(user.getId()); return user; }
[ "public", "User", "createAccount", "(", "String", "userName", ",", "String", "password", ")", "throws", "IOException", "{", "User", "user", "=", "User", ".", "getById", "(", "userName", ",", "true", ")", ";", "user", ".", "addProperty", "(", "Details", ".", "fromPlainPassword", "(", "password", ")", ")", ";", "SecurityListener", ".", "fireUserCreated", "(", "user", ".", "getId", "(", ")", ")", ";", "return", "user", ";", "}" ]
Creates a new user account by registering a password to the user.
[ "Creates", "a", "new", "user", "account", "by", "registering", "a", "password", "to", "the", "user", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/HudsonPrivateSecurityRealm.java#L507-L512
jhg023/SimpleNet
src/main/java/simplenet/packet/Packet.java
Packet.putShort
public Packet putShort(int s, ByteOrder order) { """ Writes a single {@code short} with the specified {@link ByteOrder} to this {@link Packet}'s payload. @param s An {@code int} for ease-of-use, but internally down-casted to a {@code short}. @param order The internal byte order of the {@code short}. @return The {@link Packet} to allow for chained writes. """ var buffer = HEAP_BUFFER_POOL.take(Short.BYTES); var value = (short) s; var array = buffer.putShort(order == ByteOrder.LITTLE_ENDIAN ? Short.reverseBytes(value) : value).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Short.BYTES)); } finally { HEAP_BUFFER_POOL.give(buffer); } }
java
public Packet putShort(int s, ByteOrder order) { var buffer = HEAP_BUFFER_POOL.take(Short.BYTES); var value = (short) s; var array = buffer.putShort(order == ByteOrder.LITTLE_ENDIAN ? Short.reverseBytes(value) : value).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Short.BYTES)); } finally { HEAP_BUFFER_POOL.give(buffer); } }
[ "public", "Packet", "putShort", "(", "int", "s", ",", "ByteOrder", "order", ")", "{", "var", "buffer", "=", "HEAP_BUFFER_POOL", ".", "take", "(", "Short", ".", "BYTES", ")", ";", "var", "value", "=", "(", "short", ")", "s", ";", "var", "array", "=", "buffer", ".", "putShort", "(", "order", "==", "ByteOrder", ".", "LITTLE_ENDIAN", "?", "Short", ".", "reverseBytes", "(", "value", ")", ":", "value", ")", ".", "array", "(", ")", ";", "try", "{", "return", "enqueue", "(", "Arrays", ".", "copyOfRange", "(", "array", ",", "0", ",", "Short", ".", "BYTES", ")", ")", ";", "}", "finally", "{", "HEAP_BUFFER_POOL", ".", "give", "(", "buffer", ")", ";", "}", "}" ]
Writes a single {@code short} with the specified {@link ByteOrder} to this {@link Packet}'s payload. @param s An {@code int} for ease-of-use, but internally down-casted to a {@code short}. @param order The internal byte order of the {@code short}. @return The {@link Packet} to allow for chained writes.
[ "Writes", "a", "single", "{", "@code", "short", "}", "with", "the", "specified", "{", "@link", "ByteOrder", "}", "to", "this", "{", "@link", "Packet", "}", "s", "payload", "." ]
train
https://github.com/jhg023/SimpleNet/blob/a5b55cbfe1768c6a28874f12adac3c748f2b509a/src/main/java/simplenet/packet/Packet.java#L288-L298
mqlight/java-mqlight
mqlight/src/main/java/com/ibm/mqlight/api/impl/logging/logback/LogbackLoggingImpl.java
LogbackLoggingImpl.getMQLightOutput
private static LoggerOutput getMQLightOutput(String defaultOutput, String type) { """ Obtains the required logger output information, for the required log type, based on environment settings. <p> Environment variable: {@code MQLIGHT_JAVA_LOG_STREAM} can be defined to specify the logger output destination path. A value of {@code stdout} or {@code stderr} can be specified to define stdout or stderr, respectively. <p> Environment variable: {@code MQLIGHT_JAVA_LOG_FILE_COUNT} can be defined to specify the maximum number of archive log files to keep. If not specified then a default of 5 is used. <p> Environment variable: {@code MQLIGHT_JAVA_LOG_FILE_LIMIT} can be defined to specify the maximum size of the log file before it is renamed to a archive log file. If not specified then a default of 20MB is used. <p> When {@code MQLIGHT_JAVA_LOG_STREAM} specifies a file path the output log file path will be in the format: {@code MQLIGHT_JAVA_LOG_STREAM%i.type} where {@code %i} is blank for the active log file and ranging from 1 to the defined {@code MQLIGHT_JAVA_LOG_FILE_COUNT} for the archive log files. @param defaultOutput The default output for the logger information. @param type The type of log output. This is used as the extension, when logging to file. @return A {@link LoggerOutput} containing the required logger information. """ String requiredOutput = System.getenv("MQLIGHT_JAVA_LOG_STREAM"); if (requiredOutput == null || requiredOutput.trim().length() == 0) requiredOutput = defaultOutput; final LoggerOutput result; if (requiredOutput.equals("stdout")) { result = new LoggerOutput(requiredOutput, "", System.out); } else if (requiredOutput.equals("stderr")) { result = new LoggerOutput(requiredOutput, "", System.err); } else { final String logFileCount = System.getenv("MQLIGHT_JAVA_LOG_FILE_COUNT"); final String logFileLimit = System.getenv("MQLIGHT_JAVA_LOG_FILE_LIMIT"); PrintStream outputStream = null; try { outputStream = new PrintStream(new File(requiredOutput+"."+type), outputEncoding); } catch (FileNotFoundException | UnsupportedEncodingException e) { final ClientRuntimeException exception = new ClientRuntimeException("Unable to log to file: \'" + requiredOutput+"."+type + "\': " + e.getLocalizedMessage()); throw exception; } result = new LoggerOutput(requiredOutput, type, outputStream, logFileCount, logFileLimit); } return result; }
java
private static LoggerOutput getMQLightOutput(String defaultOutput, String type) { String requiredOutput = System.getenv("MQLIGHT_JAVA_LOG_STREAM"); if (requiredOutput == null || requiredOutput.trim().length() == 0) requiredOutput = defaultOutput; final LoggerOutput result; if (requiredOutput.equals("stdout")) { result = new LoggerOutput(requiredOutput, "", System.out); } else if (requiredOutput.equals("stderr")) { result = new LoggerOutput(requiredOutput, "", System.err); } else { final String logFileCount = System.getenv("MQLIGHT_JAVA_LOG_FILE_COUNT"); final String logFileLimit = System.getenv("MQLIGHT_JAVA_LOG_FILE_LIMIT"); PrintStream outputStream = null; try { outputStream = new PrintStream(new File(requiredOutput+"."+type), outputEncoding); } catch (FileNotFoundException | UnsupportedEncodingException e) { final ClientRuntimeException exception = new ClientRuntimeException("Unable to log to file: \'" + requiredOutput+"."+type + "\': " + e.getLocalizedMessage()); throw exception; } result = new LoggerOutput(requiredOutput, type, outputStream, logFileCount, logFileLimit); } return result; }
[ "private", "static", "LoggerOutput", "getMQLightOutput", "(", "String", "defaultOutput", ",", "String", "type", ")", "{", "String", "requiredOutput", "=", "System", ".", "getenv", "(", "\"MQLIGHT_JAVA_LOG_STREAM\"", ")", ";", "if", "(", "requiredOutput", "==", "null", "||", "requiredOutput", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "requiredOutput", "=", "defaultOutput", ";", "final", "LoggerOutput", "result", ";", "if", "(", "requiredOutput", ".", "equals", "(", "\"stdout\"", ")", ")", "{", "result", "=", "new", "LoggerOutput", "(", "requiredOutput", ",", "\"\"", ",", "System", ".", "out", ")", ";", "}", "else", "if", "(", "requiredOutput", ".", "equals", "(", "\"stderr\"", ")", ")", "{", "result", "=", "new", "LoggerOutput", "(", "requiredOutput", ",", "\"\"", ",", "System", ".", "err", ")", ";", "}", "else", "{", "final", "String", "logFileCount", "=", "System", ".", "getenv", "(", "\"MQLIGHT_JAVA_LOG_FILE_COUNT\"", ")", ";", "final", "String", "logFileLimit", "=", "System", ".", "getenv", "(", "\"MQLIGHT_JAVA_LOG_FILE_LIMIT\"", ")", ";", "PrintStream", "outputStream", "=", "null", ";", "try", "{", "outputStream", "=", "new", "PrintStream", "(", "new", "File", "(", "requiredOutput", "+", "\".\"", "+", "type", ")", ",", "outputEncoding", ")", ";", "}", "catch", "(", "FileNotFoundException", "|", "UnsupportedEncodingException", "e", ")", "{", "final", "ClientRuntimeException", "exception", "=", "new", "ClientRuntimeException", "(", "\"Unable to log to file: \\'\"", "+", "requiredOutput", "+", "\".\"", "+", "type", "+", "\"\\': \"", "+", "e", ".", "getLocalizedMessage", "(", ")", ")", ";", "throw", "exception", ";", "}", "result", "=", "new", "LoggerOutput", "(", "requiredOutput", ",", "type", ",", "outputStream", ",", "logFileCount", ",", "logFileLimit", ")", ";", "}", "return", "result", ";", "}" ]
Obtains the required logger output information, for the required log type, based on environment settings. <p> Environment variable: {@code MQLIGHT_JAVA_LOG_STREAM} can be defined to specify the logger output destination path. A value of {@code stdout} or {@code stderr} can be specified to define stdout or stderr, respectively. <p> Environment variable: {@code MQLIGHT_JAVA_LOG_FILE_COUNT} can be defined to specify the maximum number of archive log files to keep. If not specified then a default of 5 is used. <p> Environment variable: {@code MQLIGHT_JAVA_LOG_FILE_LIMIT} can be defined to specify the maximum size of the log file before it is renamed to a archive log file. If not specified then a default of 20MB is used. <p> When {@code MQLIGHT_JAVA_LOG_STREAM} specifies a file path the output log file path will be in the format: {@code MQLIGHT_JAVA_LOG_STREAM%i.type} where {@code %i} is blank for the active log file and ranging from 1 to the defined {@code MQLIGHT_JAVA_LOG_FILE_COUNT} for the archive log files. @param defaultOutput The default output for the logger information. @param type The type of log output. This is used as the extension, when logging to file. @return A {@link LoggerOutput} containing the required logger information.
[ "Obtains", "the", "required", "logger", "output", "information", "for", "the", "required", "log", "type", "based", "on", "environment", "settings", ".", "<p", ">", "Environment", "variable", ":", "{", "@code", "MQLIGHT_JAVA_LOG_STREAM", "}", "can", "be", "defined", "to", "specify", "the", "logger", "output", "destination", "path", ".", "A", "value", "of", "{", "@code", "stdout", "}", "or", "{", "@code", "stderr", "}", "can", "be", "specified", "to", "define", "stdout", "or", "stderr", "respectively", ".", "<p", ">", "Environment", "variable", ":", "{", "@code", "MQLIGHT_JAVA_LOG_FILE_COUNT", "}", "can", "be", "defined", "to", "specify", "the", "maximum", "number", "of", "archive", "log", "files", "to", "keep", ".", "If", "not", "specified", "then", "a", "default", "of", "5", "is", "used", ".", "<p", ">", "Environment", "variable", ":", "{", "@code", "MQLIGHT_JAVA_LOG_FILE_LIMIT", "}", "can", "be", "defined", "to", "specify", "the", "maximum", "size", "of", "the", "log", "file", "before", "it", "is", "renamed", "to", "a", "archive", "log", "file", ".", "If", "not", "specified", "then", "a", "default", "of", "20MB", "is", "used", ".", "<p", ">", "When", "{", "@code", "MQLIGHT_JAVA_LOG_STREAM", "}", "specifies", "a", "file", "path", "the", "output", "log", "file", "path", "will", "be", "in", "the", "format", ":", "{", "@code", "MQLIGHT_JAVA_LOG_STREAM%i", ".", "type", "}", "where", "{", "@code", "%i", "}", "is", "blank", "for", "the", "active", "log", "file", "and", "ranging", "from", "1", "to", "the", "defined", "{", "@code", "MQLIGHT_JAVA_LOG_FILE_COUNT", "}", "for", "the", "archive", "log", "files", "." ]
train
https://github.com/mqlight/java-mqlight/blob/a565dfa6044050826d1221697da9e3268b557aeb/mqlight/src/main/java/com/ibm/mqlight/api/impl/logging/logback/LogbackLoggingImpl.java#L360-L383
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java
TopicsInner.listEventTypesAsync
public Observable<List<EventTypeInner>> listEventTypesAsync(String resourceGroupName, String providerNamespace, String resourceTypeName, String resourceName) { """ List topic event types. List event types for a topic. @param resourceGroupName The name of the resource group within the user's subscription. @param providerNamespace Namespace of the provider of the topic @param resourceTypeName Name of the topic type @param resourceName Name of the topic @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EventTypeInner&gt; object """ return listEventTypesWithServiceResponseAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName).map(new Func1<ServiceResponse<List<EventTypeInner>>, List<EventTypeInner>>() { @Override public List<EventTypeInner> call(ServiceResponse<List<EventTypeInner>> response) { return response.body(); } }); }
java
public Observable<List<EventTypeInner>> listEventTypesAsync(String resourceGroupName, String providerNamespace, String resourceTypeName, String resourceName) { return listEventTypesWithServiceResponseAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName).map(new Func1<ServiceResponse<List<EventTypeInner>>, List<EventTypeInner>>() { @Override public List<EventTypeInner> call(ServiceResponse<List<EventTypeInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EventTypeInner", ">", ">", "listEventTypesAsync", "(", "String", "resourceGroupName", ",", "String", "providerNamespace", ",", "String", "resourceTypeName", ",", "String", "resourceName", ")", "{", "return", "listEventTypesWithServiceResponseAsync", "(", "resourceGroupName", ",", "providerNamespace", ",", "resourceTypeName", ",", "resourceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "EventTypeInner", ">", ">", ",", "List", "<", "EventTypeInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "EventTypeInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "EventTypeInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List topic event types. List event types for a topic. @param resourceGroupName The name of the resource group within the user's subscription. @param providerNamespace Namespace of the provider of the topic @param resourceTypeName Name of the topic type @param resourceName Name of the topic @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EventTypeInner&gt; object
[ "List", "topic", "event", "types", ".", "List", "event", "types", "for", "a", "topic", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L1298-L1305
klarna/HiveRunner
src/main/java/com/klarna/hiverunner/data/InsertIntoTable.java
InsertIntoTable.addRowsFromDelimited
public InsertIntoTable addRowsFromDelimited(File file, String delimiter, Object nullValue) { """ Adds all rows from the TSV file specified, using the provided delimiter and null value. @param file The file to read the data from. @param delimiter A column delimiter. @param nullValue Value to be treated as null in the source data. @return {@code this} """ builder.addRowsFromDelimited(file, delimiter, nullValue); return this; }
java
public InsertIntoTable addRowsFromDelimited(File file, String delimiter, Object nullValue) { builder.addRowsFromDelimited(file, delimiter, nullValue); return this; }
[ "public", "InsertIntoTable", "addRowsFromDelimited", "(", "File", "file", ",", "String", "delimiter", ",", "Object", "nullValue", ")", "{", "builder", ".", "addRowsFromDelimited", "(", "file", ",", "delimiter", ",", "nullValue", ")", ";", "return", "this", ";", "}" ]
Adds all rows from the TSV file specified, using the provided delimiter and null value. @param file The file to read the data from. @param delimiter A column delimiter. @param nullValue Value to be treated as null in the source data. @return {@code this}
[ "Adds", "all", "rows", "from", "the", "TSV", "file", "specified", "using", "the", "provided", "delimiter", "and", "null", "value", "." ]
train
https://github.com/klarna/HiveRunner/blob/c8899237db6122127f16e3d8a740c1f8657c2ae3/src/main/java/com/klarna/hiverunner/data/InsertIntoTable.java#L160-L163