repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
samskivert/samskivert
src/main/java/com/samskivert/swing/util/MenuUtil.java
MenuUtil.addMenuItem
public static JMenuItem addMenuItem ( ActionListener l, JMenu menu, String name, int mnem, KeyStroke accel) { return addMenuItem(l, menu, name, Integer.valueOf(mnem), accel); }
java
public static JMenuItem addMenuItem ( ActionListener l, JMenu menu, String name, int mnem, KeyStroke accel) { return addMenuItem(l, menu, name, Integer.valueOf(mnem), accel); }
[ "public", "static", "JMenuItem", "addMenuItem", "(", "ActionListener", "l", ",", "JMenu", "menu", ",", "String", "name", ",", "int", "mnem", ",", "KeyStroke", "accel", ")", "{", "return", "addMenuItem", "(", "l", ",", "menu", ",", "name", ",", "Integer", ...
Adds a new menu item to the menu with the specified name and attributes. @param l the action listener. @param menu the menu to add the item to. @param name the item name. @param mnem the mnemonic key for the item. @param accel the keystroke for the item or null if none. @return the new menu item.
[ "Adds", "a", "new", "menu", "item", "to", "the", "menu", "with", "the", "specified", "name", "and", "attributes", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/MenuUtil.java#L67-L71
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYLineChartBuilder.java
DJXYLineChartBuilder.addSerie
public DJXYLineChartBuilder addSerie(AbstractColumn column, String label) { getDataset().addSerie(column, label); return this; }
java
public DJXYLineChartBuilder addSerie(AbstractColumn column, String label) { getDataset().addSerie(column, label); return this; }
[ "public", "DJXYLineChartBuilder", "addSerie", "(", "AbstractColumn", "column", ",", "String", "label", ")", "{", "getDataset", "(", ")", ".", "addSerie", "(", "column", ",", "label", ")", ";", "return", "this", ";", "}" ]
Adds the specified serie column to the dataset with custom label. @param column the serie column @param label column the custom label
[ "Adds", "the", "specified", "serie", "column", "to", "the", "dataset", "with", "custom", "label", "." ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/chart/builder/DJXYLineChartBuilder.java#L374-L377
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.updateEmailsOnPush
public boolean updateEmailsOnPush(Integer projectId, String emailAddress) throws IOException { GitlabServiceEmailOnPush emailOnPush = this.getEmailsOnPush(projectId); GitlabEmailonPushProperties properties = emailOnPush.getProperties(); String appendedRecipients = properties.getRecipients(); if (appendedRecipients != "") { if (appendedRecipients.contains(emailAddress)) return true; appendedRecipients = appendedRecipients + " " + emailAddress; } else appendedRecipients = emailAddress; Query query = new Query() .appendIf("active", true) .appendIf("recipients", appendedRecipients); String tailUrl = GitlabProject.URL + "/" + projectId + GitlabServiceEmailOnPush.URL + query.toString(); return retrieve().method(PUT).to(tailUrl, Boolean.class); }
java
public boolean updateEmailsOnPush(Integer projectId, String emailAddress) throws IOException { GitlabServiceEmailOnPush emailOnPush = this.getEmailsOnPush(projectId); GitlabEmailonPushProperties properties = emailOnPush.getProperties(); String appendedRecipients = properties.getRecipients(); if (appendedRecipients != "") { if (appendedRecipients.contains(emailAddress)) return true; appendedRecipients = appendedRecipients + " " + emailAddress; } else appendedRecipients = emailAddress; Query query = new Query() .appendIf("active", true) .appendIf("recipients", appendedRecipients); String tailUrl = GitlabProject.URL + "/" + projectId + GitlabServiceEmailOnPush.URL + query.toString(); return retrieve().method(PUT).to(tailUrl, Boolean.class); }
[ "public", "boolean", "updateEmailsOnPush", "(", "Integer", "projectId", ",", "String", "emailAddress", ")", "throws", "IOException", "{", "GitlabServiceEmailOnPush", "emailOnPush", "=", "this", ".", "getEmailsOnPush", "(", "projectId", ")", ";", "GitlabEmailonPushProper...
Update recipients for email-on-push service for a projectId. @param projectId The ID of the project containing the variable. @param emailAddress The emailaddress of the recipent who is going to receive push notification. @return @throws IOException on gitlab api call error
[ "Update", "recipients", "for", "email", "-", "on", "-", "push", "service", "for", "a", "projectId", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3786-L3803
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.addToInvalidatesNoLog
void addToInvalidatesNoLog(Block b, DatanodeInfo n, boolean ackRequired) { // We are the standby avatar and we don't want to add blocks to the // invalidates list. if (this.getNameNode().shouldRetryAbsentBlocks()) { return; } LightWeightHashSet<Block> invalidateSet = recentInvalidateSets.get(n .getStorageID()); if (invalidateSet == null) { invalidateSet = new LightWeightHashSet<Block>(); recentInvalidateSets.put(n.getStorageID(), invalidateSet); } if(!ackRequired){ b.setNumBytes(BlockFlags.NO_ACK); } if (invalidateSet.add(b)) { pendingDeletionBlocksCount++; } }
java
void addToInvalidatesNoLog(Block b, DatanodeInfo n, boolean ackRequired) { // We are the standby avatar and we don't want to add blocks to the // invalidates list. if (this.getNameNode().shouldRetryAbsentBlocks()) { return; } LightWeightHashSet<Block> invalidateSet = recentInvalidateSets.get(n .getStorageID()); if (invalidateSet == null) { invalidateSet = new LightWeightHashSet<Block>(); recentInvalidateSets.put(n.getStorageID(), invalidateSet); } if(!ackRequired){ b.setNumBytes(BlockFlags.NO_ACK); } if (invalidateSet.add(b)) { pendingDeletionBlocksCount++; } }
[ "void", "addToInvalidatesNoLog", "(", "Block", "b", ",", "DatanodeInfo", "n", ",", "boolean", "ackRequired", ")", "{", "// We are the standby avatar and we don't want to add blocks to the", "// invalidates list.", "if", "(", "this", ".", "getNameNode", "(", ")", ".", "s...
Adds block to list of blocks which will be invalidated on specified datanode @param b block @param n datanode
[ "Adds", "block", "to", "list", "of", "blocks", "which", "will", "be", "invalidated", "on", "specified", "datanode" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L3416-L3435
apache/incubator-atlas
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
HiveMetaStoreBridge.getDBQualifiedName
public static String getDBQualifiedName(String clusterName, String dbName) { return String.format("%s@%s", dbName.toLowerCase(), clusterName); }
java
public static String getDBQualifiedName(String clusterName, String dbName) { return String.format("%s@%s", dbName.toLowerCase(), clusterName); }
[ "public", "static", "String", "getDBQualifiedName", "(", "String", "clusterName", ",", "String", "dbName", ")", "{", "return", "String", ".", "format", "(", "\"%s@%s\"", ",", "dbName", ".", "toLowerCase", "(", ")", ",", "clusterName", ")", ";", "}" ]
Construct the qualified name used to uniquely identify a Database instance in Atlas. @param clusterName Name of the cluster to which the Hive component belongs @param dbName Name of the Hive database @return Unique qualified name to identify the Database instance in Atlas.
[ "Construct", "the", "qualified", "name", "used", "to", "uniquely", "identify", "a", "Database", "instance", "in", "Atlas", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java#L239-L241
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.setDateLastModified
public void setDateLastModified(String resourcename, long dateLastModified, boolean recursive) throws CmsException { CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).setDateLastModified(this, m_securityManager, resource, dateLastModified, recursive); }
java
public void setDateLastModified(String resourcename, long dateLastModified, boolean recursive) throws CmsException { CmsResource resource = readResource(resourcename, CmsResourceFilter.IGNORE_EXPIRATION); getResourceType(resource).setDateLastModified(this, m_securityManager, resource, dateLastModified, recursive); }
[ "public", "void", "setDateLastModified", "(", "String", "resourcename", ",", "long", "dateLastModified", ",", "boolean", "recursive", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "resourcename", ",", "CmsResourceFilter", "."...
Changes the "last modified" time stamp of a resource.<p> @param resourcename the name of the resource to change (full current site relative path) @param dateLastModified time stamp the new time stamp of the changed resource @param recursive if this operation is to be applied recursively to all resources in a folder @throws CmsException if something goes wrong
[ "Changes", "the", "last", "modified", "time", "stamp", "of", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3782-L3786
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/builder/FieldAccessor.java
FieldAccessor.getAnnotation
public <A extends Annotation> Optional<A> getAnnotation(final Class<A> annoClass) { Objects.requireNonNull(annoClass, "annoClass should not be null."); return getAnnotationsByType(expandedAnnos, annoClass).stream() .findFirst(); }
java
public <A extends Annotation> Optional<A> getAnnotation(final Class<A> annoClass) { Objects.requireNonNull(annoClass, "annoClass should not be null."); return getAnnotationsByType(expandedAnnos, annoClass).stream() .findFirst(); }
[ "public", "<", "A", "extends", "Annotation", ">", "Optional", "<", "A", ">", "getAnnotation", "(", "final", "Class", "<", "A", ">", "annoClass", ")", "{", "Objects", ".", "requireNonNull", "(", "annoClass", ",", "\"annoClass should not be null.\"", ")", ";", ...
アノテーションのタイプを指定してアノテーションを取得します。 <p>繰り返しのアノテーションの場合、初めに見つかったものを返します。</p> @param <A> 取得対象のアノテーションのタイプ @param annoClass 取得対象のアノテーションのタイプ。 @return 指定したアノテーションが見つからない場合は、空を返します。 @throws NullPointerException {@literal annoClass is null.}
[ "アノテーションのタイプを指定してアノテーションを取得します。", "<p", ">", "繰り返しのアノテーションの場合、初めに見つかったものを返します。<", "/", "p", ">" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/builder/FieldAccessor.java#L75-L81
ironjacamar/ironjacamar
common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java
AbstractParser.rawAttributeText
private String rawAttributeText(XMLStreamReader reader, String attributeName) { String attributeString = reader.getAttributeValue("", attributeName); if (attributeString == null) return null; return attributeString.trim(); }
java
private String rawAttributeText(XMLStreamReader reader, String attributeName) { String attributeString = reader.getAttributeValue("", attributeName); if (attributeString == null) return null; return attributeString.trim(); }
[ "private", "String", "rawAttributeText", "(", "XMLStreamReader", "reader", ",", "String", "attributeName", ")", "{", "String", "attributeString", "=", "reader", ".", "getAttributeValue", "(", "\"\"", ",", "attributeName", ")", ";", "if", "(", "attributeString", "=...
Read the raw attribute @param reader @param attributeName @return the string representing raw attribute textx
[ "Read", "the", "raw", "attribute" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/AbstractParser.java#L236-L244
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java
NetworkWatchersInner.beginGetVMSecurityRulesAsync
public Observable<SecurityGroupViewResultInner> beginGetVMSecurityRulesAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) { return beginGetVMSecurityRulesWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).map(new Func1<ServiceResponse<SecurityGroupViewResultInner>, SecurityGroupViewResultInner>() { @Override public SecurityGroupViewResultInner call(ServiceResponse<SecurityGroupViewResultInner> response) { return response.body(); } }); }
java
public Observable<SecurityGroupViewResultInner> beginGetVMSecurityRulesAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) { return beginGetVMSecurityRulesWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).map(new Func1<ServiceResponse<SecurityGroupViewResultInner>, SecurityGroupViewResultInner>() { @Override public SecurityGroupViewResultInner call(ServiceResponse<SecurityGroupViewResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SecurityGroupViewResultInner", ">", "beginGetVMSecurityRulesAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "targetResourceId", ")", "{", "return", "beginGetVMSecurityRulesWithServiceResponseAsync", "...
Gets the configured and effective security group rules on the specified VM. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param targetResourceId ID of the target VM. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SecurityGroupViewResultInner object
[ "Gets", "the", "configured", "and", "effective", "security", "group", "rules", "on", "the", "specified", "VM", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1397-L1404
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_lusol.java
DZcs_lusol.cs_lusol
public static boolean cs_lusol(int order, DZcs A, DZcsa b, double tol) { DZcsa x ; DZcss S ; DZcsn N ; int n ; boolean ok ; if (!CS_CSC (A) || b == null) return (false); /* check inputs */ n = A.n ; S = cs_sqr (order, A, false) ; /* ordering and symbolic analysis */ N = cs_lu (A, S, tol) ; /* numeric LU factorization */ x = new DZcsa(n) ; /* get workspace */ ok = (S != null && N != null) ; if (ok) { cs_ipvec (N.pinv, b, x, n) ; /* x = b(p) */ cs_lsolve (N.L, x) ; /* x = L\x */ cs_usolve (N.U, x) ; /* x = U\x */ cs_ipvec (S.q, x, b, n) ; /* b(q) = x */ } x = null ; S = null ; N = null ; return (ok) ; }
java
public static boolean cs_lusol(int order, DZcs A, DZcsa b, double tol) { DZcsa x ; DZcss S ; DZcsn N ; int n ; boolean ok ; if (!CS_CSC (A) || b == null) return (false); /* check inputs */ n = A.n ; S = cs_sqr (order, A, false) ; /* ordering and symbolic analysis */ N = cs_lu (A, S, tol) ; /* numeric LU factorization */ x = new DZcsa(n) ; /* get workspace */ ok = (S != null && N != null) ; if (ok) { cs_ipvec (N.pinv, b, x, n) ; /* x = b(p) */ cs_lsolve (N.L, x) ; /* x = L\x */ cs_usolve (N.U, x) ; /* x = U\x */ cs_ipvec (S.q, x, b, n) ; /* b(q) = x */ } x = null ; S = null ; N = null ; return (ok) ; }
[ "public", "static", "boolean", "cs_lusol", "(", "int", "order", ",", "DZcs", "A", ",", "DZcsa", "b", ",", "double", "tol", ")", "{", "DZcsa", "x", ";", "DZcss", "S", ";", "DZcsn", "N", ";", "int", "n", ";", "boolean", "ok", ";", "if", "(", "!", ...
Solves Ax=b, where A is square and nonsingular. b overwritten with solution. Partial pivoting if tol = 1. @param order ordering method to use (0 to 3) @param A column-compressed matrix @param b size n, b on input, x on output @param tol partial pivoting tolerance @return true if successful, false on error
[ "Solves", "Ax", "=", "b", "where", "A", "is", "square", "and", "nonsingular", ".", "b", "overwritten", "with", "solution", ".", "Partial", "pivoting", "if", "tol", "=", "1", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_lusol.java#L62-L86
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.buildPendingIntentFromPushNotification
public static void buildPendingIntentFromPushNotification(@NonNull final PendingIntentCallback callback, @NonNull final Intent intent) { if (callback == null) { throw new IllegalArgumentException("Callback is null"); } dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { String apptentivePushData = ApptentiveInternal.getApptentivePushNotificationData(intent); final PendingIntent intent = ApptentiveInternal.generatePendingIntentFromApptentivePushData(conversation, apptentivePushData); DispatchQueue.mainQueue().dispatchAsync(new DispatchTask() { @Override protected void execute() { callback.onPendingIntent(intent); } }); return true; } }, "build pending intent"); }
java
public static void buildPendingIntentFromPushNotification(@NonNull final PendingIntentCallback callback, @NonNull final Intent intent) { if (callback == null) { throw new IllegalArgumentException("Callback is null"); } dispatchConversationTask(new ConversationDispatchTask() { @Override protected boolean execute(Conversation conversation) { String apptentivePushData = ApptentiveInternal.getApptentivePushNotificationData(intent); final PendingIntent intent = ApptentiveInternal.generatePendingIntentFromApptentivePushData(conversation, apptentivePushData); DispatchQueue.mainQueue().dispatchAsync(new DispatchTask() { @Override protected void execute() { callback.onPendingIntent(intent); } }); return true; } }, "build pending intent"); }
[ "public", "static", "void", "buildPendingIntentFromPushNotification", "(", "@", "NonNull", "final", "PendingIntentCallback", "callback", ",", "@", "NonNull", "final", "Intent", "intent", ")", "{", "if", "(", "callback", "==", "null", ")", "{", "throw", "new", "I...
<p>Use this method in your push receiver to build a pending Intent when an Apptentive push notification is received. Pass the generated PendingIntent to {@link android.support.v4.app.NotificationCompat.Builder#setContentIntent} to allow Apptentive to display Interactions such as Message Center. Calling this method for a push {@link Intent} that did not come from Apptentive will return a null object. If you receive a null object, your app will need to handle this notification itself.</p> <p>This task is performed asynchronously.</p> <p>This is the method you will likely need if you integrated using:</p> <ul> <li>GCM</li> <li>AWS SNS</li> <li>Parse</li> </ul> @param callback Called after we check to see Apptentive can launch an Interaction from this push. Called with a {@link PendingIntent} to launch an Apptentive Interaction if the push data came from Apptentive, and an Interaction can be shown, or null. @param intent An {@link Intent} containing the Apptentive Push data. Pass in what you receive in the Service or BroadcastReceiver that is used by your chosen push provider.
[ "<p", ">", "Use", "this", "method", "in", "your", "push", "receiver", "to", "build", "a", "pending", "Intent", "when", "an", "Apptentive", "push", "notification", "is", "received", ".", "Pass", "the", "generated", "PendingIntent", "to", "{", "@link", "androi...
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L570-L589
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/DocumentListTypeUrl.java
DocumentListTypeUrl.getDocumentListTypeUrl
public static MozuUrl getDocumentListTypeUrl(String documentListTypeFQN, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlistTypes/{documentListTypeFQN}?responseFields={responseFields}"); formatter.formatUrl("documentListTypeFQN", documentListTypeFQN); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getDocumentListTypeUrl(String documentListTypeFQN, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlistTypes/{documentListTypeFQN}?responseFields={responseFields}"); formatter.formatUrl("documentListTypeFQN", documentListTypeFQN); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getDocumentListTypeUrl", "(", "String", "documentListTypeFQN", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/content/documentlistTypes/{documentListTypeFQN}?responseFields={response...
Get Resource Url for GetDocumentListType @param documentListTypeFQN @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetDocumentListType" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/DocumentListTypeUrl.java#L38-L44
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java
FedoraResourceImpl.dateTimeDifference
private static long dateTimeDifference(final Temporal d1, final Temporal d2) { return ChronoUnit.SECONDS.between(d1, d2); }
java
private static long dateTimeDifference(final Temporal d1, final Temporal d2) { return ChronoUnit.SECONDS.between(d1, d2); }
[ "private", "static", "long", "dateTimeDifference", "(", "final", "Temporal", "d1", ",", "final", "Temporal", "d2", ")", "{", "return", "ChronoUnit", ".", "SECONDS", ".", "between", "(", "d1", ",", "d2", ")", ";", "}" ]
Calculate the difference between two datetime to the unit. @param d1 first datetime @param d2 second datetime @return the difference
[ "Calculate", "the", "difference", "between", "two", "datetime", "to", "the", "unit", "." ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/FedoraResourceImpl.java#L1339-L1341
bramp/unsafe
unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java
UnsafeHelper.copyMemoryFieldByField
public static void copyMemoryFieldByField(long srcAddress, Object dest) { Class clazz = dest.getClass(); while (clazz != Object.class) { for (Field f : clazz.getDeclaredFields()) { if ((f.getModifiers() & Modifier.STATIC) == 0) { final Class type = f.getType(); // TODO maybe support Wrapper classes Preconditions.checkArgument(type.isPrimitive(), "Only primitives are supported"); final long offset = unsafe.objectFieldOffset(f); final long src = srcAddress + offset; if (type == int.class) { unsafe.putInt(dest, offset, unsafe.getInt(src)); } else if (type == long.class) { unsafe.putLong(dest, offset, unsafe.getLong(src)); } else { throw new IllegalArgumentException("Type not supported yet: " + type); } } } clazz = clazz.getSuperclass(); } }
java
public static void copyMemoryFieldByField(long srcAddress, Object dest) { Class clazz = dest.getClass(); while (clazz != Object.class) { for (Field f : clazz.getDeclaredFields()) { if ((f.getModifiers() & Modifier.STATIC) == 0) { final Class type = f.getType(); // TODO maybe support Wrapper classes Preconditions.checkArgument(type.isPrimitive(), "Only primitives are supported"); final long offset = unsafe.objectFieldOffset(f); final long src = srcAddress + offset; if (type == int.class) { unsafe.putInt(dest, offset, unsafe.getInt(src)); } else if (type == long.class) { unsafe.putLong(dest, offset, unsafe.getLong(src)); } else { throw new IllegalArgumentException("Type not supported yet: " + type); } } } clazz = clazz.getSuperclass(); } }
[ "public", "static", "void", "copyMemoryFieldByField", "(", "long", "srcAddress", ",", "Object", "dest", ")", "{", "Class", "clazz", "=", "dest", ".", "getClass", "(", ")", ";", "while", "(", "clazz", "!=", "Object", ".", "class", ")", "{", "for", "(", ...
Copies from srcAddress to dest one field at a time. @param srcAddress @param dest
[ "Copies", "from", "srcAddress", "to", "dest", "one", "field", "at", "a", "time", "." ]
train
https://github.com/bramp/unsafe/blob/805f54e2a8aee905003329556135b6c4059b4418/unsafe-helper/src/main/java/net/bramp/unsafe/UnsafeHelper.java#L109-L136
ZuInnoTe/hadoopcryptoledger
inputformat/src/main/java/org/zuinnote/hadoop/bitcoin/format/common/BitcoinBlockReader.java
BitcoinBlockReader.parseTransactionInputs
public List<BitcoinTransactionInput> parseTransactionInputs(ByteBuffer rawByteBuffer, long noOfTransactionInputs) { ArrayList<BitcoinTransactionInput> currentTransactionInput = new ArrayList<>((int)noOfTransactionInputs); for (int i=0;i<noOfTransactionInputs;i++) { // read previous Hash of Transaction byte[] currentTransactionInputPrevTransactionHash=new byte[32]; rawByteBuffer.get(currentTransactionInputPrevTransactionHash,0,32); // read previousTxOutIndex long currentTransactionInputPrevTxOutIdx=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // read InScript length (Potential Internal Exceed Java Type) byte[] currentTransactionTxInScriptLengthVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer); long currentTransactionTxInScriptSize=BitcoinUtil.getVarInt(currentTransactionTxInScriptLengthVarInt); // read inScript int currentTransactionTxInScriptSizeInt=(int)currentTransactionTxInScriptSize; byte[] currentTransactionInScript=new byte[currentTransactionTxInScriptSizeInt]; rawByteBuffer.get(currentTransactionInScript,0,currentTransactionTxInScriptSizeInt); // read sequence no long currentTransactionInputSeqNo=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // add input currentTransactionInput.add(new BitcoinTransactionInput(currentTransactionInputPrevTransactionHash,currentTransactionInputPrevTxOutIdx,currentTransactionTxInScriptLengthVarInt,currentTransactionInScript,currentTransactionInputSeqNo)); } return currentTransactionInput; }
java
public List<BitcoinTransactionInput> parseTransactionInputs(ByteBuffer rawByteBuffer, long noOfTransactionInputs) { ArrayList<BitcoinTransactionInput> currentTransactionInput = new ArrayList<>((int)noOfTransactionInputs); for (int i=0;i<noOfTransactionInputs;i++) { // read previous Hash of Transaction byte[] currentTransactionInputPrevTransactionHash=new byte[32]; rawByteBuffer.get(currentTransactionInputPrevTransactionHash,0,32); // read previousTxOutIndex long currentTransactionInputPrevTxOutIdx=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // read InScript length (Potential Internal Exceed Java Type) byte[] currentTransactionTxInScriptLengthVarInt=BitcoinUtil.convertVarIntByteBufferToByteArray(rawByteBuffer); long currentTransactionTxInScriptSize=BitcoinUtil.getVarInt(currentTransactionTxInScriptLengthVarInt); // read inScript int currentTransactionTxInScriptSizeInt=(int)currentTransactionTxInScriptSize; byte[] currentTransactionInScript=new byte[currentTransactionTxInScriptSizeInt]; rawByteBuffer.get(currentTransactionInScript,0,currentTransactionTxInScriptSizeInt); // read sequence no long currentTransactionInputSeqNo=BitcoinUtil.convertSignedIntToUnsigned(rawByteBuffer.getInt()); // add input currentTransactionInput.add(new BitcoinTransactionInput(currentTransactionInputPrevTransactionHash,currentTransactionInputPrevTxOutIdx,currentTransactionTxInScriptLengthVarInt,currentTransactionInScript,currentTransactionInputSeqNo)); } return currentTransactionInput; }
[ "public", "List", "<", "BitcoinTransactionInput", ">", "parseTransactionInputs", "(", "ByteBuffer", "rawByteBuffer", ",", "long", "noOfTransactionInputs", ")", "{", "ArrayList", "<", "BitcoinTransactionInput", ">", "currentTransactionInput", "=", "new", "ArrayList", "<>",...
/* Parses the Bitcoin transaction inputs in a byte buffer. @param rawByteBuffer ByteBuffer from which the transaction inputs have to be parsed @param noOfTransactionInputs Number of expected transaction inputs @return Array of transactions
[ "/", "*", "Parses", "the", "Bitcoin", "transaction", "inputs", "in", "a", "byte", "buffer", "." ]
train
https://github.com/ZuInnoTe/hadoopcryptoledger/blob/5c9bfb61dd1a82374cd0de8413a7c66391ee4414/inputformat/src/main/java/org/zuinnote/hadoop/bitcoin/format/common/BitcoinBlockReader.java#L373-L395
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java
MurmurHash3Adaptor.hashToBytes
public static byte[] hashToBytes(final char[] data, final long seed) { if ((data == null) || (data.length == 0)) { return null; } return toByteArray(hash(data, seed)); }
java
public static byte[] hashToBytes(final char[] data, final long seed) { if ((data == null) || (data.length == 0)) { return null; } return toByteArray(hash(data, seed)); }
[ "public", "static", "byte", "[", "]", "hashToBytes", "(", "final", "char", "[", "]", "data", ",", "final", "long", "seed", ")", "{", "if", "(", "(", "data", "==", "null", ")", "||", "(", "data", ".", "length", "==", "0", ")", ")", "{", "return", ...
Hash a char[] and long seed. @param data the input char array @param seed A long valued seed. @return The 128-bit hash as a byte[16] in Big Endian order from 2 64-bit longs.
[ "Hash", "a", "char", "[]", "and", "long", "seed", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java#L84-L89
LevelFourAB/commons
commons-types/src/main/java/se/l4/commons/types/Types.java
Types.resolveMembers
@NonNull public static ResolvedTypeWithMembers resolveMembers(@NonNull Type type, @NonNull Type... typeParameters) { ResolvedType rt = typeResolver.resolve(type, typeParameters); return memberResolver.resolve(rt, null, null); }
java
@NonNull public static ResolvedTypeWithMembers resolveMembers(@NonNull Type type, @NonNull Type... typeParameters) { ResolvedType rt = typeResolver.resolve(type, typeParameters); return memberResolver.resolve(rt, null, null); }
[ "@", "NonNull", "public", "static", "ResolvedTypeWithMembers", "resolveMembers", "(", "@", "NonNull", "Type", "type", ",", "@", "NonNull", "Type", "...", "typeParameters", ")", "{", "ResolvedType", "rt", "=", "typeResolver", ".", "resolve", "(", "type", ",", "...
Resolve the given base type and its members. @param type the base type to resolve @param typeParameters the type parameters @return resolve type instance
[ "Resolve", "the", "given", "base", "type", "and", "its", "members", "." ]
train
https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-types/src/main/java/se/l4/commons/types/Types.java#L88-L93
netty/netty
handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java
CipherSuiteConverter.isO2JCached
static boolean isO2JCached(String key, String protocol, String value) { Map<String, String> p2j = o2j.get(key); if (p2j == null) { return false; } else { return value.equals(p2j.get(protocol)); } }
java
static boolean isO2JCached(String key, String protocol, String value) { Map<String, String> p2j = o2j.get(key); if (p2j == null) { return false; } else { return value.equals(p2j.get(protocol)); } }
[ "static", "boolean", "isO2JCached", "(", "String", "key", ",", "String", "protocol", ",", "String", "value", ")", "{", "Map", "<", "String", ",", "String", ">", "p2j", "=", "o2j", ".", "get", "(", "key", ")", ";", "if", "(", "p2j", "==", "null", ")...
Tests if the specified key-value pair has been cached in OpenSSL-to-Java cache.
[ "Tests", "if", "the", "specified", "key", "-", "value", "pair", "has", "been", "cached", "in", "OpenSSL", "-", "to", "-", "Java", "cache", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java#L139-L146
twotoasters/RecyclerViewLib
library/src/main/java/com/twotoasters/android/support/v7/widget/LinearSmoothScroller.java
LinearSmoothScroller.calculateDyToMakeVisible
public int calculateDyToMakeVisible(View view, int snapPreference) { final RecyclerView.LayoutManager layoutManager = getLayoutManager(); if (!layoutManager.canScrollVertically()) { return 0; } final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); final int top = layoutManager.getDecoratedTop(view) - params.topMargin; final int bottom = layoutManager.getDecoratedBottom(view) + params.bottomMargin; final int start = layoutManager.getPaddingTop(); final int end = layoutManager.getHeight() - layoutManager.getPaddingBottom(); return calculateDtToFit(top, bottom, start, end, snapPreference); }
java
public int calculateDyToMakeVisible(View view, int snapPreference) { final RecyclerView.LayoutManager layoutManager = getLayoutManager(); if (!layoutManager.canScrollVertically()) { return 0; } final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) view.getLayoutParams(); final int top = layoutManager.getDecoratedTop(view) - params.topMargin; final int bottom = layoutManager.getDecoratedBottom(view) + params.bottomMargin; final int start = layoutManager.getPaddingTop(); final int end = layoutManager.getHeight() - layoutManager.getPaddingBottom(); return calculateDtToFit(top, bottom, start, end, snapPreference); }
[ "public", "int", "calculateDyToMakeVisible", "(", "View", "view", ",", "int", "snapPreference", ")", "{", "final", "RecyclerView", ".", "LayoutManager", "layoutManager", "=", "getLayoutManager", "(", ")", ";", "if", "(", "!", "layoutManager", ".", "canScrollVertic...
Calculates the vertical scroll amount necessary to make the given view fully visible inside the RecyclerView. @param view The view which we want to make fully visible @param snapPreference The edge which the view should snap to when entering the visible area. One of {@link #SNAP_TO_START}, {@link #SNAP_TO_END} or {@link #SNAP_TO_END}. @return The vertical scroll amount necessary to make the view visible with the given snap preference.
[ "Calculates", "the", "vertical", "scroll", "amount", "necessary", "to", "make", "the", "given", "view", "fully", "visible", "inside", "the", "RecyclerView", "." ]
train
https://github.com/twotoasters/RecyclerViewLib/blob/2379fd5bbf57d4dfc8b28046b7ace950905c75f0/library/src/main/java/com/twotoasters/android/support/v7/widget/LinearSmoothScroller.java#L298-L310
dbracewell/mango
src/main/java/com/davidbracewell/config/Config.java
Config.hasProperty
public static boolean hasProperty(String propertyPrefix, Language language, String... propertyComponents) { return findKey(propertyPrefix, language, propertyComponents) != null; }
java
public static boolean hasProperty(String propertyPrefix, Language language, String... propertyComponents) { return findKey(propertyPrefix, language, propertyComponents) != null; }
[ "public", "static", "boolean", "hasProperty", "(", "String", "propertyPrefix", ",", "Language", "language", ",", "String", "...", "propertyComponents", ")", "{", "return", "findKey", "(", "propertyPrefix", ",", "language", ",", "propertyComponents", ")", "!=", "nu...
<p>Checks if a property is in the config or or set on the system. The property name is constructed as <code>propertyPrefix+ . + propertyComponent[0] + . + propertyComponent[1] + ... + (language.toString()|language.getCode().toLowerCase())</code> This will return true if the language specific config option is set or a default (i.e. no-language specified) version is set. </p> @param propertyPrefix The prefix @param language The language we would like the config for @param propertyComponents The components. @return True if the property is known, false if not.
[ "<p", ">", "Checks", "if", "a", "property", "is", "in", "the", "config", "or", "or", "set", "on", "the", "system", ".", "The", "property", "name", "is", "constructed", "as", "<code", ">", "propertyPrefix", "+", ".", "+", "propertyComponent", "[", "0", ...
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/config/Config.java#L227-L229
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java
Utils.findMethod
public MethodDoc findMethod(ClassDoc cd, MethodDoc method) { MethodDoc[] methods = cd.methods(); for (MethodDoc m : methods) { if (executableMembersEqual(method, m)) { return m; } } return null; }
java
public MethodDoc findMethod(ClassDoc cd, MethodDoc method) { MethodDoc[] methods = cd.methods(); for (MethodDoc m : methods) { if (executableMembersEqual(method, m)) { return m; } } return null; }
[ "public", "MethodDoc", "findMethod", "(", "ClassDoc", "cd", ",", "MethodDoc", "method", ")", "{", "MethodDoc", "[", "]", "methods", "=", "cd", ".", "methods", "(", ")", ";", "for", "(", "MethodDoc", "m", ":", "methods", ")", "{", "if", "(", "executable...
Search for the given method in the given class. @param cd Class to search into. @param method Method to be searched. @return MethodDoc Method found, null otherwise.
[ "Search", "for", "the", "given", "method", "in", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/Utils.java#L123-L132
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/GenericsResolutionUtils.java
GenericsResolutionUtils.resolveRawGenerics
public static LinkedHashMap<String, Type> resolveRawGenerics(final Class<?> type) { // inner class can use outer class generics return fillOuterGenerics(type, resolveDirectRawGenerics(type), null); }
java
public static LinkedHashMap<String, Type> resolveRawGenerics(final Class<?> type) { // inner class can use outer class generics return fillOuterGenerics(type, resolveDirectRawGenerics(type), null); }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "Type", ">", "resolveRawGenerics", "(", "final", "Class", "<", "?", ">", "type", ")", "{", "// inner class can use outer class generics", "return", "fillOuterGenerics", "(", "type", ",", "resolveDirectRawGeneric...
Resolve type generics by declaration (as upper bound). Used for cases when actual generic definition is not available (so actual generics are unknown). In most cases such generics resolved as Object (for example, {@code Some<T>}). <p> If class is inner class, resolve outer class generics (which may be used in class) @param type class to analyze generics for @return resolved generics (including outer class generics) or empty map if not generics used @see #resolveDirectRawGenerics(Class) to resolve without outer type
[ "Resolve", "type", "generics", "by", "declaration", "(", "as", "upper", "bound", ")", ".", "Used", "for", "cases", "when", "actual", "generic", "definition", "is", "not", "available", "(", "so", "actual", "generics", "are", "unknown", ")", ".", "In", "most...
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/GenericsResolutionUtils.java#L179-L182
leadware/jpersistence-tools
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java
JPAGenericDAORulesBasedImpl.validateEntityReferentialConstraint
protected void validateEntityReferentialConstraint(Object entity, DAOMode mode, DAOValidatorEvaluationTime validationTime) { // Obtention de la liste des annotations DAO qui sont sur la classe List<Annotation> daoAnnotations = DAOValidatorHelper.loadDAOValidatorAnnotations(entity); // Si la liste est vide if(daoAnnotations == null || daoAnnotations.size() == 0) return; // On parcours cette liste for (Annotation daoAnnotation : daoAnnotations) { // Obtention de la classe du Validateur Class<?> validatorClass = DAOValidatorHelper.getValidationLogicClass(daoAnnotation); // Le validateur IDAOValidator<Annotation> validator = null; try { // On instancie le validateur validator = (IDAOValidator<Annotation>) validatorClass.newInstance(); // Initialisation du Validateur validator.initialize(daoAnnotation, getEntityManager(), mode, validationTime); } catch (Throwable e) { // On relance l'exception throw new JPersistenceToolsException("ValidatorInstanciationException.message", e); } // Validation des contraintes d'integrites validator.processValidation(entity); } }
java
protected void validateEntityReferentialConstraint(Object entity, DAOMode mode, DAOValidatorEvaluationTime validationTime) { // Obtention de la liste des annotations DAO qui sont sur la classe List<Annotation> daoAnnotations = DAOValidatorHelper.loadDAOValidatorAnnotations(entity); // Si la liste est vide if(daoAnnotations == null || daoAnnotations.size() == 0) return; // On parcours cette liste for (Annotation daoAnnotation : daoAnnotations) { // Obtention de la classe du Validateur Class<?> validatorClass = DAOValidatorHelper.getValidationLogicClass(daoAnnotation); // Le validateur IDAOValidator<Annotation> validator = null; try { // On instancie le validateur validator = (IDAOValidator<Annotation>) validatorClass.newInstance(); // Initialisation du Validateur validator.initialize(daoAnnotation, getEntityManager(), mode, validationTime); } catch (Throwable e) { // On relance l'exception throw new JPersistenceToolsException("ValidatorInstanciationException.message", e); } // Validation des contraintes d'integrites validator.processValidation(entity); } }
[ "protected", "void", "validateEntityReferentialConstraint", "(", "Object", "entity", ",", "DAOMode", "mode", ",", "DAOValidatorEvaluationTime", "validationTime", ")", "{", "// Obtention de la liste des annotations DAO qui sont sur la classe\r", "List", "<", "Annotation", ">", "...
Méthode de validation des contraintes referentielles @param entity Entité à valider @param mode Mode DAO @param validationTime Moment d'évaluation
[ "Méthode", "de", "validation", "des", "contraintes", "referentielles" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java#L803-L837
facebookarchive/hive-dwrf
hive-dwrf/src/main/java/com/facebook/hive/orc/OrcFile.java
OrcFile.createReader
public static Reader createReader(FileSystem fs, Path path, Configuration conf ) throws IOException { return new ReaderImpl(fs, path, conf); }
java
public static Reader createReader(FileSystem fs, Path path, Configuration conf ) throws IOException { return new ReaderImpl(fs, path, conf); }
[ "public", "static", "Reader", "createReader", "(", "FileSystem", "fs", ",", "Path", "path", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "return", "new", "ReaderImpl", "(", "fs", ",", "path", ",", "conf", ")", ";", "}" ]
Create an ORC file reader. @param fs file system @param path file name to read from @return a new ORC file reader. @throws IOException
[ "Create", "an", "ORC", "file", "reader", "." ]
train
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/OrcFile.java#L104-L107
leancloud/java-sdk-all
android-sdk/realtime-android/src/main/java/cn/leancloud/push/PushService.java
PushService.setDefaultChannelId
@TargetApi(Build.VERSION_CODES.O) public static void setDefaultChannelId(Context context, String channelId) { DefaultChannelId = channelId; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1) { // do nothing for Android versions before Ore return; } try { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); CharSequence name = context.getPackageName(); String description = "PushNotification"; int importance = NotificationManager.IMPORTANCE_DEFAULT; android.app.NotificationChannel channel = new android.app.NotificationChannel(channelId, name, importance); channel.setDescription(description); notificationManager.createNotificationChannel(channel); } catch (Exception ex) { LOGGER.w("failed to create NotificationChannel, then perhaps PushNotification doesn't work well on Android O and newer version."); } }
java
@TargetApi(Build.VERSION_CODES.O) public static void setDefaultChannelId(Context context, String channelId) { DefaultChannelId = channelId; if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N_MR1) { // do nothing for Android versions before Ore return; } try { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); CharSequence name = context.getPackageName(); String description = "PushNotification"; int importance = NotificationManager.IMPORTANCE_DEFAULT; android.app.NotificationChannel channel = new android.app.NotificationChannel(channelId, name, importance); channel.setDescription(description); notificationManager.createNotificationChannel(channel); } catch (Exception ex) { LOGGER.w("failed to create NotificationChannel, then perhaps PushNotification doesn't work well on Android O and newer version."); } }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "O", ")", "public", "static", "void", "setDefaultChannelId", "(", "Context", "context", ",", "String", "channelId", ")", "{", "DefaultChannelId", "=", "channelId", ";", "if", "(", "Build", ".", "VERS...
Set default channel for Android Oreo or newer version Notice: it isn"t necessary to invoke this method for any Android version before Oreo. @param context context @param channelId default channel id.
[ "Set", "default", "channel", "for", "Android", "Oreo", "or", "newer", "version", "Notice", ":", "it", "isn", "t", "necessary", "to", "invoke", "this", "method", "for", "any", "Android", "version", "before", "Oreo", "." ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/realtime-android/src/main/java/cn/leancloud/push/PushService.java#L334-L353
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java
CmsDomUtil.ensureVisible
public static void ensureVisible(final Element containerElement, Element element, int animationTime) { Element item = element; int realOffset = 0; while ((item != null) && (item != containerElement)) { realOffset += element.getOffsetTop(); item = item.getOffsetParent(); } final int endScrollTop = realOffset - (containerElement.getOffsetHeight() / 2); if (animationTime <= 0) { // no animation containerElement.setScrollTop(endScrollTop); return; } final int startScrollTop = containerElement.getScrollTop(); (new Animation() { /** * @see com.google.gwt.animation.client.Animation#onUpdate(double) */ @Override protected void onUpdate(double progress) { containerElement.setScrollTop(startScrollTop + (int)((endScrollTop - startScrollTop) * progress)); } }).run(animationTime); }
java
public static void ensureVisible(final Element containerElement, Element element, int animationTime) { Element item = element; int realOffset = 0; while ((item != null) && (item != containerElement)) { realOffset += element.getOffsetTop(); item = item.getOffsetParent(); } final int endScrollTop = realOffset - (containerElement.getOffsetHeight() / 2); if (animationTime <= 0) { // no animation containerElement.setScrollTop(endScrollTop); return; } final int startScrollTop = containerElement.getScrollTop(); (new Animation() { /** * @see com.google.gwt.animation.client.Animation#onUpdate(double) */ @Override protected void onUpdate(double progress) { containerElement.setScrollTop(startScrollTop + (int)((endScrollTop - startScrollTop) * progress)); } }).run(animationTime); }
[ "public", "static", "void", "ensureVisible", "(", "final", "Element", "containerElement", ",", "Element", "element", ",", "int", "animationTime", ")", "{", "Element", "item", "=", "element", ";", "int", "realOffset", "=", "0", ";", "while", "(", "(", "item",...
Ensures that the given element is visible.<p> Assuming the scrollbars are on the container element, and that the element is a child of the container element.<p> @param containerElement the container element, has to be parent of the element @param element the element to be seen @param animationTime the animation time for scrolling, use zero for no animation
[ "Ensures", "that", "the", "given", "element", "is", "visible", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsDomUtil.java#L881-L908
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java
DiagnosticsInner.listSiteDetectorResponsesWithServiceResponseAsync
public Observable<ServiceResponse<Page<DetectorResponseInner>>> listSiteDetectorResponsesWithServiceResponseAsync(final String resourceGroupName, final String siteName) { return listSiteDetectorResponsesSinglePageAsync(resourceGroupName, siteName) .concatMap(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Observable<ServiceResponse<Page<DetectorResponseInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorResponseInner>>> call(ServiceResponse<Page<DetectorResponseInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSiteDetectorResponsesNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DetectorResponseInner>>> listSiteDetectorResponsesWithServiceResponseAsync(final String resourceGroupName, final String siteName) { return listSiteDetectorResponsesSinglePageAsync(resourceGroupName, siteName) .concatMap(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Observable<ServiceResponse<Page<DetectorResponseInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorResponseInner>>> call(ServiceResponse<Page<DetectorResponseInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSiteDetectorResponsesNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DetectorResponseInner", ">", ">", ">", "listSiteDetectorResponsesWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ")", "{", "return", "listSiteD...
List Site Detector Responses. List Site Detector Responses. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorResponseInner&gt; object
[ "List", "Site", "Detector", "Responses", ".", "List", "Site", "Detector", "Responses", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L597-L609
unic/neba
spring/src/main/java/io/neba/spring/mvc/MvcServlet.java
MvcServlet.enableMvc
public void enableMvc(ConfigurableListableBeanFactory factory, BundleContext context) { if (factory == null) { throw new IllegalArgumentException("Method argument factory must not be null."); } if (context == null) { throw new IllegalArgumentException("Method argument context must not be null."); } BundleAwareServletConfig servletConfig = new BundleAwareServletConfig(context); factory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, servletConfig)); factory.ignoreDependencyInterface(ServletContextAware.class); factory.ignoreDependencyInterface(ServletConfigAware.class); final BundleSpecificDispatcherServlet dispatcherServlet = createBundleSpecificDispatcherServlet(factory, servletConfig); factory.registerSingleton(generateNameFor(BundleSpecificDispatcherServlet.class), dispatcherServlet); this.mvcCapableBundles.put(context.getBundle(), dispatcherServlet); }
java
public void enableMvc(ConfigurableListableBeanFactory factory, BundleContext context) { if (factory == null) { throw new IllegalArgumentException("Method argument factory must not be null."); } if (context == null) { throw new IllegalArgumentException("Method argument context must not be null."); } BundleAwareServletConfig servletConfig = new BundleAwareServletConfig(context); factory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, servletConfig)); factory.ignoreDependencyInterface(ServletContextAware.class); factory.ignoreDependencyInterface(ServletConfigAware.class); final BundleSpecificDispatcherServlet dispatcherServlet = createBundleSpecificDispatcherServlet(factory, servletConfig); factory.registerSingleton(generateNameFor(BundleSpecificDispatcherServlet.class), dispatcherServlet); this.mvcCapableBundles.put(context.getBundle(), dispatcherServlet); }
[ "public", "void", "enableMvc", "(", "ConfigurableListableBeanFactory", "factory", ",", "BundleContext", "context", ")", "{", "if", "(", "factory", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Method argument factory must not be null.\"", "...
Enables MVC capabilities in the given factory by injecting a {@link BundleSpecificDispatcherServlet}. @param factory must not be <code>null</code>. @param context must not be <code>null</code>.
[ "Enables", "MVC", "capabilities", "in", "the", "given", "factory", "by", "injecting", "a", "{", "@link", "BundleSpecificDispatcherServlet", "}", "." ]
train
https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/spring/src/main/java/io/neba/spring/mvc/MvcServlet.java#L75-L92
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java
UfsJournal.catchUp
private synchronized long catchUp(long nextSequenceNumber) { JournalReader journalReader = new UfsJournalReader(this, nextSequenceNumber, true); try { return catchUp(journalReader); } finally { try { journalReader.close(); } catch (IOException e) { LOG.warn("Failed to close journal reader: {}", e.toString()); } } }
java
private synchronized long catchUp(long nextSequenceNumber) { JournalReader journalReader = new UfsJournalReader(this, nextSequenceNumber, true); try { return catchUp(journalReader); } finally { try { journalReader.close(); } catch (IOException e) { LOG.warn("Failed to close journal reader: {}", e.toString()); } } }
[ "private", "synchronized", "long", "catchUp", "(", "long", "nextSequenceNumber", ")", "{", "JournalReader", "journalReader", "=", "new", "UfsJournalReader", "(", "this", ",", "nextSequenceNumber", ",", "true", ")", ";", "try", "{", "return", "catchUp", "(", "jou...
Reads and applies all journal entries starting from the specified sequence number. @param nextSequenceNumber the sequence number to continue catching up from @return the next sequence number after the final sequence number read
[ "Reads", "and", "applies", "all", "journal", "entries", "starting", "from", "the", "specified", "sequence", "number", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournal.java#L349-L360
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.parseEmptyOrCommentLine
protected boolean parseEmptyOrCommentLine(final ParserData parserData, final String line) { if (isBlankLine(line)) { if (parserData.getCurrentLevel().getLevelType() == LevelType.BASE) { parserData.getContentSpec().appendChild(new TextNode("\n")); } else { parserData.getCurrentLevel().appendChild(new TextNode("\n")); } return true; } else { if (parserData.getCurrentLevel().getLevelType() == LevelType.BASE) { parserData.getContentSpec().appendComment(line); } else { parserData.getCurrentLevel().appendComment(line); } return true; } }
java
protected boolean parseEmptyOrCommentLine(final ParserData parserData, final String line) { if (isBlankLine(line)) { if (parserData.getCurrentLevel().getLevelType() == LevelType.BASE) { parserData.getContentSpec().appendChild(new TextNode("\n")); } else { parserData.getCurrentLevel().appendChild(new TextNode("\n")); } return true; } else { if (parserData.getCurrentLevel().getLevelType() == LevelType.BASE) { parserData.getContentSpec().appendComment(line); } else { parserData.getCurrentLevel().appendComment(line); } return true; } }
[ "protected", "boolean", "parseEmptyOrCommentLine", "(", "final", "ParserData", "parserData", ",", "final", "String", "line", ")", "{", "if", "(", "isBlankLine", "(", "line", ")", ")", "{", "if", "(", "parserData", ".", "getCurrentLevel", "(", ")", ".", "getL...
Processes a line that represents a comment or an empty line in a Content Specification. @param parserData @param line The line to be processed. @return True if the line was processed without errors, otherwise false.
[ "Processes", "a", "line", "that", "represents", "a", "comment", "or", "an", "empty", "line", "in", "a", "Content", "Specification", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L582-L598
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java
CacheProxyUtil.validateNotNull
public static <K, V> void validateNotNull(K key, V value1, V value2) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(value1, NULL_VALUE_IS_NOT_ALLOWED); checkNotNull(value2, NULL_VALUE_IS_NOT_ALLOWED); }
java
public static <K, V> void validateNotNull(K key, V value1, V value2) { checkNotNull(key, NULL_KEY_IS_NOT_ALLOWED); checkNotNull(value1, NULL_VALUE_IS_NOT_ALLOWED); checkNotNull(value2, NULL_VALUE_IS_NOT_ALLOWED); }
[ "public", "static", "<", "K", ",", "V", ">", "void", "validateNotNull", "(", "K", "key", ",", "V", "value1", ",", "V", "value2", ")", "{", "checkNotNull", "(", "key", ",", "NULL_KEY_IS_NOT_ALLOWED", ")", ";", "checkNotNull", "(", "value1", ",", "NULL_VAL...
Validates that key and multi values are not null. @param key the key to be validated. @param value1 first value to be validated. @param value2 second value to be validated. @param <K> the type of key. @param <V> the type of value. @throws java.lang.NullPointerException if key or any value is null.
[ "Validates", "that", "key", "and", "multi", "values", "are", "not", "null", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java#L102-L106
Netflix/Nicobar
nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java
ClassPathUtils.findRootPathForResource
@Nullable public static Path findRootPathForResource(String resourceName, ClassLoader classLoader) { Objects.requireNonNull(resourceName, "resourceName"); Objects.requireNonNull(classLoader, "classLoader"); URL resource = classLoader.getResource(resourceName); if (resource != null) { String protocol = resource.getProtocol(); if (protocol.equals("jar")) { return getJarPathFromUrl(resource); } else if (protocol.equals("file")) { return getRootPathFromDirectory(resourceName, resource); } else { throw new IllegalStateException("Unsupported URL protocol: " + protocol); } } return null; }
java
@Nullable public static Path findRootPathForResource(String resourceName, ClassLoader classLoader) { Objects.requireNonNull(resourceName, "resourceName"); Objects.requireNonNull(classLoader, "classLoader"); URL resource = classLoader.getResource(resourceName); if (resource != null) { String protocol = resource.getProtocol(); if (protocol.equals("jar")) { return getJarPathFromUrl(resource); } else if (protocol.equals("file")) { return getRootPathFromDirectory(resourceName, resource); } else { throw new IllegalStateException("Unsupported URL protocol: " + protocol); } } return null; }
[ "@", "Nullable", "public", "static", "Path", "findRootPathForResource", "(", "String", "resourceName", ",", "ClassLoader", "classLoader", ")", "{", "Objects", ".", "requireNonNull", "(", "resourceName", ",", "\"resourceName\"", ")", ";", "Objects", ".", "requireNonN...
Find the root path for the given resource. If the resource is found in a Jar file, then the result will be an absolute path to the jar file. If the resource is found in a directory, then the result will be the parent path of the given resource. For example, if the resourceName is given as "scripts/myscript.groovy", and the path to the file is "/root/sub1/script/myscript.groovy", then this method will return "/root/sub1" @param resourceName relative path of the resource to search for. E.G. "scripts/myscript.groovy" @param classLoader the {@link ClassLoader} to search @return absolute path of the root of the resource.
[ "Find", "the", "root", "path", "for", "the", "given", "resource", ".", "If", "the", "resource", "is", "found", "in", "a", "Jar", "file", "then", "the", "result", "will", "be", "an", "absolute", "path", "to", "the", "jar", "file", ".", "If", "the", "r...
train
https://github.com/Netflix/Nicobar/blob/507173dcae4a86a955afc3df222a855862fab8d7/nicobar-core/src/main/java/com/netflix/nicobar/core/utils/ClassPathUtils.java#L66-L83
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/ext/HCExtHelper.java
HCExtHelper.nl2divList
public static void nl2divList (@Nullable final String sText, @Nonnull final Consumer <? super HCDiv> aTarget) { forEachLine (sText, (sLine, bLast) -> aTarget.accept (new HCDiv ().addChild (sLine))); }
java
public static void nl2divList (@Nullable final String sText, @Nonnull final Consumer <? super HCDiv> aTarget) { forEachLine (sText, (sLine, bLast) -> aTarget.accept (new HCDiv ().addChild (sLine))); }
[ "public", "static", "void", "nl2divList", "(", "@", "Nullable", "final", "String", "sText", ",", "@", "Nonnull", "final", "Consumer", "<", "?", "super", "HCDiv", ">", "aTarget", ")", "{", "forEachLine", "(", "sText", ",", "(", "sLine", ",", "bLast", ")",...
Convert the passed text to a list of &lt;div&gt; elements. Each \n is used to split the text into separate lines. \r characters are removed from the string! Empty lines are preserved except for the last line. E.g. <code>Hello\nworld</code> results in 2 &lt;div&gt;s: &lt;div&gt;Hello&lt;/div&gt; and &lt;div&gt;world&lt;/div&gt; @param sText The text to be split. May be <code>null</code>. @param aTarget The consumer to be invoked with every {@link HCDiv}. May not be <code>null</code>.
[ "Convert", "the", "passed", "text", "to", "a", "list", "of", "&lt", ";", "div&gt", ";", "elements", ".", "Each", "\\", "n", "is", "used", "to", "split", "the", "text", "into", "separate", "lines", ".", "\\", "r", "characters", "are", "removed", "from",...
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/ext/HCExtHelper.java#L516-L519
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/ExtractHandler.java
ExtractHandler.openTag
private void openTag(String qName, Attributes atts) { this.result.append('<').append(qName); for (int i = 0; i < atts.getLength(); i++) { this.result.append(' ').append(atts.getQName(i)).append("=\"").append(atts.getValue(i)).append('\"'); } this.result.append('>'); }
java
private void openTag(String qName, Attributes atts) { this.result.append('<').append(qName); for (int i = 0; i < atts.getLength(); i++) { this.result.append(' ').append(atts.getQName(i)).append("=\"").append(atts.getValue(i)).append('\"'); } this.result.append('>'); }
[ "private", "void", "openTag", "(", "String", "qName", ",", "Attributes", "atts", ")", "{", "this", ".", "result", ".", "append", "(", "'", "'", ")", ".", "append", "(", "qName", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "atts", ...
Append an open tag with the given specification to the result buffer. @param qName Tag's qualified name. @param atts Tag's attributes.
[ "Append", "an", "open", "tag", "with", "the", "given", "specification", "to", "the", "result", "buffer", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/ExtractHandler.java#L169-L176
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java
FlowPath.setActiveBranch
public void setActiveBranch(@NonNull String nodeName, int branchIdx) { states.get(nodeName).setActiveBranch(branchIdx); }
java
public void setActiveBranch(@NonNull String nodeName, int branchIdx) { states.get(nodeName).setActiveBranch(branchIdx); }
[ "public", "void", "setActiveBranch", "(", "@", "NonNull", "String", "nodeName", ",", "int", "branchIdx", ")", "{", "states", ".", "get", "(", "nodeName", ")", ".", "setActiveBranch", "(", "branchIdx", ")", ";", "}" ]
This method sets active/inactive branch for divergent nodes (aka Switch) @param nodeName @param branchIdx
[ "This", "method", "sets", "active", "/", "inactive", "branch", "for", "divergent", "nodes", "(", "aka", "Switch", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/flow/FlowPath.java#L74-L76
Whiley/WhileyCompiler
src/main/java/wyil/check/FlowTypeCheck.java
FlowTypeCheck.checkReturnValue
private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) { if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) { // In this case, code reaches the end of the function or method and, // furthermore, that this requires a return value. To get here means // that there was no explicit return statement given on at least one // execution path. syntaxError(d, MISSING_RETURN_STATEMENT); } }
java
private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) { if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) { // In this case, code reaches the end of the function or method and, // furthermore, that this requires a return value. To get here means // that there was no explicit return statement given on at least one // execution path. syntaxError(d, MISSING_RETURN_STATEMENT); } }
[ "private", "void", "checkReturnValue", "(", "Decl", ".", "FunctionOrMethod", "d", ",", "Environment", "last", ")", "{", "if", "(", "d", ".", "match", "(", "Modifier", ".", "Native", ".", "class", ")", "==", "null", "&&", "last", "!=", "FlowTypeUtils", "....
Check that a return value is provided when it is needed. For example, a return value is not required for a method that has no return type. Likewise, we don't expect one from a native method since there was no body to analyse. @param d @param last
[ "Check", "that", "a", "return", "value", "is", "provided", "when", "it", "is", "needed", ".", "For", "example", "a", "return", "value", "is", "not", "required", "for", "a", "method", "that", "has", "no", "return", "type", ".", "Likewise", "we", "don", ...
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L230-L238
korpling/ANNIS
annis-service/src/main/java/annis/administration/AdministrationDao.java
AdministrationDao.analyzeAutoGeneratedQueries
private void analyzeAutoGeneratedQueries(long corpusID) { // read the example queries from the staging area List<ExampleQuery> exampleQueries = getJdbcTemplate().query( "SELECT * FROM _" + EXAMPLE_QUERIES_TAB, new RowMapper<ExampleQuery>() { @Override public ExampleQuery mapRow(ResultSet rs, int i) throws SQLException { ExampleQuery eQ = new ExampleQuery(); eQ.setExampleQuery(rs.getString("example_query")); return eQ; } }); // count the nodes of the aql Query countExampleQueryNodes(exampleQueries); // fetch the operators getOperators(exampleQueries, "\\.(\\*)?|\\>|\\>\\*|_i_"); writeAmountOfNodesBack(exampleQueries); }
java
private void analyzeAutoGeneratedQueries(long corpusID) { // read the example queries from the staging area List<ExampleQuery> exampleQueries = getJdbcTemplate().query( "SELECT * FROM _" + EXAMPLE_QUERIES_TAB, new RowMapper<ExampleQuery>() { @Override public ExampleQuery mapRow(ResultSet rs, int i) throws SQLException { ExampleQuery eQ = new ExampleQuery(); eQ.setExampleQuery(rs.getString("example_query")); return eQ; } }); // count the nodes of the aql Query countExampleQueryNodes(exampleQueries); // fetch the operators getOperators(exampleQueries, "\\.(\\*)?|\\>|\\>\\*|_i_"); writeAmountOfNodesBack(exampleQueries); }
[ "private", "void", "analyzeAutoGeneratedQueries", "(", "long", "corpusID", ")", "{", "// read the example queries from the staging area", "List", "<", "ExampleQuery", ">", "exampleQueries", "=", "getJdbcTemplate", "(", ")", ".", "query", "(", "\"SELECT * FROM _\"", "+", ...
Counts nodes and operators of the AQL example query and writes it back to the staging area. @param corpusID specifies the corpus, the analyze things.
[ "Counts", "nodes", "and", "operators", "of", "the", "AQL", "example", "query", "and", "writes", "it", "back", "to", "the", "staging", "area", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/administration/AdministrationDao.java#L2122-L2144
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.getText
public static String getText(URL url) throws IOException { return getText(url, CharsetToolkit.getDefaultSystemCharset().name()); }
java
public static String getText(URL url) throws IOException { return getText(url, CharsetToolkit.getDefaultSystemCharset().name()); }
[ "public", "static", "String", "getText", "(", "URL", "url", ")", "throws", "IOException", "{", "return", "getText", "(", "url", ",", "CharsetToolkit", ".", "getDefaultSystemCharset", "(", ")", ".", "name", "(", ")", ")", ";", "}" ]
Read the content of this URL and returns it as a String. @param url URL to read content from @return the text from that URL @throws IOException if an IOException occurs. @since 1.0
[ "Read", "the", "content", "of", "this", "URL", "and", "returns", "it", "as", "a", "String", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L603-L605
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/StringUtil.java
StringUtil.replaceByMap
public static String replaceByMap(String _searchStr, Map<String, String> _replacements) { if (_searchStr == null) { return null; } if (_replacements == null || _replacements.isEmpty()) { return _searchStr; } String str = _searchStr; for (Entry<String, String> entry : _replacements.entrySet()) { str = str.replace(entry.getKey(), entry.getValue()); } return str; }
java
public static String replaceByMap(String _searchStr, Map<String, String> _replacements) { if (_searchStr == null) { return null; } if (_replacements == null || _replacements.isEmpty()) { return _searchStr; } String str = _searchStr; for (Entry<String, String> entry : _replacements.entrySet()) { str = str.replace(entry.getKey(), entry.getValue()); } return str; }
[ "public", "static", "String", "replaceByMap", "(", "String", "_searchStr", ",", "Map", "<", "String", ",", "String", ">", "_replacements", ")", "{", "if", "(", "_searchStr", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "_replacements", ...
Replace all placeholders in given string by value of the corresponding key in given Map. @param _searchStr search string @param _replacements replacement @return String or null if _searchStr was null
[ "Replace", "all", "placeholders", "in", "given", "string", "by", "value", "of", "the", "corresponding", "key", "in", "given", "Map", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/StringUtil.java#L168-L183
line/armeria
zipkin/src/main/java/com/linecorp/armeria/server/tracing/HttpTracingService.java
HttpTracingService.newDecorator
public static Function<Service<HttpRequest, HttpResponse>, HttpTracingService> newDecorator(Tracing tracing) { ensureScopeUsesRequestContext(tracing); return service -> new HttpTracingService(service, tracing); }
java
public static Function<Service<HttpRequest, HttpResponse>, HttpTracingService> newDecorator(Tracing tracing) { ensureScopeUsesRequestContext(tracing); return service -> new HttpTracingService(service, tracing); }
[ "public", "static", "Function", "<", "Service", "<", "HttpRequest", ",", "HttpResponse", ">", ",", "HttpTracingService", ">", "newDecorator", "(", "Tracing", "tracing", ")", "{", "ensureScopeUsesRequestContext", "(", "tracing", ")", ";", "return", "service", "->",...
Creates a new tracing {@link Service} decorator using the specified {@link Tracing} instance.
[ "Creates", "a", "new", "tracing", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/zipkin/src/main/java/com/linecorp/armeria/server/tracing/HttpTracingService.java#L55-L59
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.domainName
public static Validator<CharSequence> domainName(@NonNull final Context context) { return new DomainNameValidator(context, R.string.default_error_message); }
java
public static Validator<CharSequence> domainName(@NonNull final Context context) { return new DomainNameValidator(context, R.string.default_error_message); }
[ "public", "static", "Validator", "<", "CharSequence", ">", "domainName", "(", "@", "NonNull", "final", "Context", "context", ")", "{", "return", "new", "DomainNameValidator", "(", "context", ",", "R", ".", "string", ".", "default_error_message", ")", ";", "}" ...
Creates and returns a validator, which allows to validate texts to ensure, that they represent valid domain names. Empty texts are also accepted. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "validate", "texts", "to", "ensure", "that", "they", "represent", "valid", "domain", "names", ".", "Empty", "texts", "are", "also", "accepted", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L1012-L1014
cycorp/api-suite
core-api/src/main/java/com/cyc/query/exception/QueryException.java
QueryException.fromThrowable
public static QueryException fromThrowable(String message, Throwable cause) { return (cause instanceof QueryException && Objects.equals(message, cause.getMessage())) ? (QueryException) cause : new QueryException(message, cause); }
java
public static QueryException fromThrowable(String message, Throwable cause) { return (cause instanceof QueryException && Objects.equals(message, cause.getMessage())) ? (QueryException) cause : new QueryException(message, cause); }
[ "public", "static", "QueryException", "fromThrowable", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "return", "(", "cause", "instanceof", "QueryException", "&&", "Objects", ".", "equals", "(", "message", ",", "cause", ".", "getMessage", "(", ...
Converts a Throwable to a QueryException with the specified detail message. If the Throwable is a QueryException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new QueryException with the detail message. @param cause the Throwable to convert @param message the specified detail message @return a QueryException
[ "Converts", "a", "Throwable", "to", "a", "QueryException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "QueryException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", "s...
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryException.java#L59-L63
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addIdNotInArrayCondition
protected void addIdNotInArrayCondition(final String propertyName, final String[] values) throws NumberFormatException { final Set<Integer> idValues = new HashSet<Integer>(); for (final String value : values) { idValues.add(Integer.parseInt(value.trim())); } addIdNotInCollectionCondition(propertyName, idValues); }
java
protected void addIdNotInArrayCondition(final String propertyName, final String[] values) throws NumberFormatException { final Set<Integer> idValues = new HashSet<Integer>(); for (final String value : values) { idValues.add(Integer.parseInt(value.trim())); } addIdNotInCollectionCondition(propertyName, idValues); }
[ "protected", "void", "addIdNotInArrayCondition", "(", "final", "String", "propertyName", ",", "final", "String", "[", "]", "values", ")", "throws", "NumberFormatException", "{", "final", "Set", "<", "Integer", ">", "idValues", "=", "new", "HashSet", "<", "Intege...
Add a Field Search Condition that will check if the id field does not exist in an array of id values that are represented as a String. eg. {@code field NOT IN (values)} @param propertyName The name of the field id as defined in the Entity mapping class. @param values The array of Ids to be compared to. @throws NumberFormatException Thrown if one of the Strings cannot be converted to an Integer.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "check", "if", "the", "id", "field", "does", "not", "exist", "in", "an", "array", "of", "id", "values", "that", "are", "represented", "as", "a", "String", ".", "eg", ".", "{", "@code", "field"...
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L396-L402
cycorp/api-suite
core-api/src/main/java/com/cyc/kb/wrapper/BinaryPredicateWrapper.java
BinaryPredicateWrapper.addFact
@Override public Fact addFact(Context ctx, Object arg1, Object arg2) throws KbTypeException, CreateException { return wrapped().addFact(ctx, arg1, arg2); }
java
@Override public Fact addFact(Context ctx, Object arg1, Object arg2) throws KbTypeException, CreateException { return wrapped().addFact(ctx, arg1, arg2); }
[ "@", "Override", "public", "Fact", "addFact", "(", "Context", "ctx", ",", "Object", "arg1", ",", "Object", "arg2", ")", "throws", "KbTypeException", ",", "CreateException", "{", "return", "wrapped", "(", ")", ".", "addFact", "(", "ctx", ",", "arg1", ",", ...
====| Public methods |==================================================================//
[ "====", "|", "Public", "methods", "|", "==================================================================", "//" ]
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/wrapper/BinaryPredicateWrapper.java#L45-L49
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.contains
@Pure public static <E> boolean contains(List<E> list, Comparator<? super E> comparator, E data) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0) { return true; } else if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } return false; }
java
@Pure public static <E> boolean contains(List<E> list, Comparator<? super E> comparator, E data) { assert list != null; assert comparator != null; assert data != null; int first = 0; int last = list.size() - 1; while (last >= first) { final int center = (first + last) / 2; final E dt = list.get(center); final int cmpR = comparator.compare(data, dt); if (cmpR == 0) { return true; } else if (cmpR < 0) { last = center - 1; } else { first = center + 1; } } return false; }
[ "@", "Pure", "public", "static", "<", "E", ">", "boolean", "contains", "(", "List", "<", "E", ">", "list", ",", "Comparator", "<", "?", "super", "E", ">", "comparator", ",", "E", "data", ")", "{", "assert", "list", "!=", "null", ";", "assert", "com...
Replies if the given element is inside the list, using a dichotomic algorithm. <p>This function ensure that the comparator is invoked as: <code>comparator(data, dataAlreadyInList)</code>. @param <E> is the type of the elements in the list. @param list is the list to explore. @param comparator is the comparator of elements. @param data is the data to search for. @return <code>true</code> if the data is inside the list, otherwise <code>false</code>
[ "Replies", "if", "the", "given", "element", "is", "inside", "the", "list", "using", "a", "dichotomic", "algorithm", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L150-L170
tvesalainen/util
util/src/main/java/org/vesalainen/ui/Scaler.java
Scaler.getLevelFor
public ScaleLevel getLevelFor(Font font, FontRenderContext frc, DoubleTransform transformer, boolean horizontal, double xy, Rectangle2D bounds) { return getXYLevel(font, frc, horizontal ? transformer : DoubleTransform.swap().andThen(transformer), xy, bounds); }
java
public ScaleLevel getLevelFor(Font font, FontRenderContext frc, DoubleTransform transformer, boolean horizontal, double xy, Rectangle2D bounds) { return getXYLevel(font, frc, horizontal ? transformer : DoubleTransform.swap().andThen(transformer), xy, bounds); }
[ "public", "ScaleLevel", "getLevelFor", "(", "Font", "font", ",", "FontRenderContext", "frc", ",", "DoubleTransform", "transformer", ",", "boolean", "horizontal", ",", "double", "xy", ",", "Rectangle2D", "bounds", ")", "{", "return", "getXYLevel", "(", "font", ",...
Returns highest level where drawn labels don't overlap @param font @param frc @param transformer @param horizontal @param xy Lines x/y constant value @param bounds Accumulates label bounds here if not null. @return
[ "Returns", "highest", "level", "where", "drawn", "labels", "don", "t", "overlap" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Scaler.java#L174-L177
cdapio/tigon
tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowletProgramRunner.java
FlowletProgramRunner.createServiceHook
private Service createServiceHook(String flowletName, Iterable<ConsumerSupplier<?>> consumerSuppliers, AtomicReference<FlowletProgramController> controller) { final List<String> streams = Lists.newArrayList(); for (ConsumerSupplier<?> consumerSupplier : consumerSuppliers) { QueueName queueName = consumerSupplier.getQueueName(); if (queueName.isStream()) { streams.add(queueName.getSimpleName()); } } // If no stream, returns a no-op Service if (streams.isEmpty()) { return new AbstractService() { @Override protected void doStart() { notifyStarted(); } @Override protected void doStop() { notifyStopped(); } }; } return new FlowletServiceHook(flowletName, streams, controller); }
java
private Service createServiceHook(String flowletName, Iterable<ConsumerSupplier<?>> consumerSuppliers, AtomicReference<FlowletProgramController> controller) { final List<String> streams = Lists.newArrayList(); for (ConsumerSupplier<?> consumerSupplier : consumerSuppliers) { QueueName queueName = consumerSupplier.getQueueName(); if (queueName.isStream()) { streams.add(queueName.getSimpleName()); } } // If no stream, returns a no-op Service if (streams.isEmpty()) { return new AbstractService() { @Override protected void doStart() { notifyStarted(); } @Override protected void doStop() { notifyStopped(); } }; } return new FlowletServiceHook(flowletName, streams, controller); }
[ "private", "Service", "createServiceHook", "(", "String", "flowletName", ",", "Iterable", "<", "ConsumerSupplier", "<", "?", ">", ">", "consumerSuppliers", ",", "AtomicReference", "<", "FlowletProgramController", ">", "controller", ")", "{", "final", "List", "<", ...
Create a initializer to be executed during the flowlet driver initialization.
[ "Create", "a", "initializer", "to", "be", "executed", "during", "the", "flowlet", "driver", "initialization", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/flow/FlowletProgramRunner.java#L569-L594
apache/flink
flink-mesos/src/main/java/org/apache/flink/mesos/util/MesosConfiguration.java
MesosConfiguration.createDriver
public SchedulerDriver createDriver(Scheduler scheduler, boolean implicitAcknowledgements) { MesosSchedulerDriver schedulerDriver; if (this.credential().isDefined()) { schedulerDriver = new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(), implicitAcknowledgements, this.credential().get().build()); } else { schedulerDriver = new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(), implicitAcknowledgements); } return schedulerDriver; }
java
public SchedulerDriver createDriver(Scheduler scheduler, boolean implicitAcknowledgements) { MesosSchedulerDriver schedulerDriver; if (this.credential().isDefined()) { schedulerDriver = new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(), implicitAcknowledgements, this.credential().get().build()); } else { schedulerDriver = new MesosSchedulerDriver(scheduler, frameworkInfo.build(), this.masterUrl(), implicitAcknowledgements); } return schedulerDriver; }
[ "public", "SchedulerDriver", "createDriver", "(", "Scheduler", "scheduler", ",", "boolean", "implicitAcknowledgements", ")", "{", "MesosSchedulerDriver", "schedulerDriver", ";", "if", "(", "this", ".", "credential", "(", ")", ".", "isDefined", "(", ")", ")", "{", ...
Create the Mesos scheduler driver based on this configuration. @param scheduler the scheduler to use. @param implicitAcknowledgements whether to configure the driver for implicit acknowledgements. @return a scheduler driver.
[ "Create", "the", "Mesos", "scheduler", "driver", "based", "on", "this", "configuration", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-mesos/src/main/java/org/apache/flink/mesos/util/MesosConfiguration.java#L108-L121
arxanchain/java-common
src/main/java/com/arxanfintech/common/util/ByteUtil.java
ByteUtil.encodeDataList
public static byte[] encodeDataList(Object... args) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (Object arg : args) { byte[] val = encodeValFor32Bits(arg); try { baos.write(val); } catch (IOException e) { throw new Error("Happen something that should never happen ", e); } } return baos.toByteArray(); }
java
public static byte[] encodeDataList(Object... args) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (Object arg : args) { byte[] val = encodeValFor32Bits(arg); try { baos.write(val); } catch (IOException e) { throw new Error("Happen something that should never happen ", e); } } return baos.toByteArray(); }
[ "public", "static", "byte", "[", "]", "encodeDataList", "(", "Object", "...", "args", ")", "{", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "for", "(", "Object", "arg", ":", "args", ")", "{", "byte", "[", "]", "va...
encode the values and concatenate together @param args Object @return byte[]
[ "encode", "the", "values", "and", "concatenate", "together" ]
train
https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/util/ByteUtil.java#L362-L373
baratine/baratine
framework/src/main/java/com/caucho/v5/util/ThreadDump.java
ThreadDump.getThreadDump
public String getThreadDump(int depth, boolean onlyActive) { ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); long []ids = threadBean.getAllThreadIds(); ThreadInfo []info = threadBean.getThreadInfo(ids, depth); StringBuilder sb = new StringBuilder(); sb.append("Thread Dump generated " + new Date(CurrentTime.currentTime())); Arrays.sort(info, new ThreadCompare()); buildThreads(sb, info, Thread.State.RUNNABLE, false); buildThreads(sb, info, Thread.State.RUNNABLE, true); if (! onlyActive) { buildThreads(sb, info, Thread.State.BLOCKED, false); buildThreads(sb, info, Thread.State.WAITING, false); buildThreads(sb, info, Thread.State.TIMED_WAITING, false); buildThreads(sb, info, null, false); } return sb.toString(); }
java
public String getThreadDump(int depth, boolean onlyActive) { ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); long []ids = threadBean.getAllThreadIds(); ThreadInfo []info = threadBean.getThreadInfo(ids, depth); StringBuilder sb = new StringBuilder(); sb.append("Thread Dump generated " + new Date(CurrentTime.currentTime())); Arrays.sort(info, new ThreadCompare()); buildThreads(sb, info, Thread.State.RUNNABLE, false); buildThreads(sb, info, Thread.State.RUNNABLE, true); if (! onlyActive) { buildThreads(sb, info, Thread.State.BLOCKED, false); buildThreads(sb, info, Thread.State.WAITING, false); buildThreads(sb, info, Thread.State.TIMED_WAITING, false); buildThreads(sb, info, null, false); } return sb.toString(); }
[ "public", "String", "getThreadDump", "(", "int", "depth", ",", "boolean", "onlyActive", ")", "{", "ThreadMXBean", "threadBean", "=", "ManagementFactory", ".", "getThreadMXBean", "(", ")", ";", "long", "[", "]", "ids", "=", "threadBean", ".", "getAllThreadIds", ...
Returns dump of threads. Optionally uses cached dump. @param onlyActive if true only running threads are logged
[ "Returns", "dump", "of", "threads", ".", "Optionally", "uses", "cached", "dump", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/ThreadDump.java#L105-L128
dvdme/forecastio-lib-java
src/com/github/dvdme/ForecastIOLib/ForecastIO.java
ForecastIO.getForecast
public boolean getForecast(String LATITUDE, String LONGITUDE) { try { String reply = httpGET( urlBuilder(LATITUDE, LONGITUDE) ); if(reply == null) return false; this.forecast = Json.parse(reply).asObject(); //this.forecast = JsonObject.readFrom(reply); } catch (NullPointerException e) { System.err.println("Unable to connect to the API: "+e.getMessage()); return false; } return getForecast(this.forecast); }
java
public boolean getForecast(String LATITUDE, String LONGITUDE) { try { String reply = httpGET( urlBuilder(LATITUDE, LONGITUDE) ); if(reply == null) return false; this.forecast = Json.parse(reply).asObject(); //this.forecast = JsonObject.readFrom(reply); } catch (NullPointerException e) { System.err.println("Unable to connect to the API: "+e.getMessage()); return false; } return getForecast(this.forecast); }
[ "public", "boolean", "getForecast", "(", "String", "LATITUDE", ",", "String", "LONGITUDE", ")", "{", "try", "{", "String", "reply", "=", "httpGET", "(", "urlBuilder", "(", "LATITUDE", ",", "LONGITUDE", ")", ")", ";", "if", "(", "reply", "==", "null", ")"...
Gets the forecast reports for the given coordinates with the set options @param LATITUDE the geographical latitude @param LONGITUDE the geographical longitude @return True if successful
[ "Gets", "the", "forecast", "reports", "for", "the", "given", "coordinates", "with", "the", "set", "options" ]
train
https://github.com/dvdme/forecastio-lib-java/blob/63c0ff17446eb7eb4e9f8bef4e19272f14c74e85/src/com/github/dvdme/ForecastIOLib/ForecastIO.java#L555-L572
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java
Text.implode
public static String implode(String[] arr, String delim) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < arr.length; i++) { if (i > 0) { buf.append(delim); } buf.append(arr[i]); } return buf.toString(); }
java
public static String implode(String[] arr, String delim) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < arr.length; i++) { if (i > 0) { buf.append(delim); } buf.append(arr[i]); } return buf.toString(); }
[ "public", "static", "String", "implode", "(", "String", "[", "]", "arr", ",", "String", "delim", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";...
Concatenates all strings in the string array using the specified delimiter. @param arr @param delim @return the concatenated string
[ "Concatenates", "all", "strings", "in", "the", "string", "array", "using", "the", "specified", "delimiter", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/Text.java#L206-L218
gwtplus/google-gin
src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java
ReflectUtil.getBoundedSourceName
private static String getBoundedSourceName(String token, Type[] bounds, String direction) throws NoSourceNameException { List<String> boundNames = new ArrayList<String>(); for (Type boundary : bounds) { boundNames.add(getSourceName(boundary)); } return String.format("%s %s %s", token, direction, join(" & ", boundNames)); }
java
private static String getBoundedSourceName(String token, Type[] bounds, String direction) throws NoSourceNameException { List<String> boundNames = new ArrayList<String>(); for (Type boundary : bounds) { boundNames.add(getSourceName(boundary)); } return String.format("%s %s %s", token, direction, join(" & ", boundNames)); }
[ "private", "static", "String", "getBoundedSourceName", "(", "String", "token", ",", "Type", "[", "]", "bounds", ",", "String", "direction", ")", "throws", "NoSourceNameException", "{", "List", "<", "String", ">", "boundNames", "=", "new", "ArrayList", "<", "St...
Creates a bounded source name of the form {@code T extends Foo & Bar}, {@code ? super Baz} or {@code ?} as appropriate.
[ "Creates", "a", "bounded", "source", "name", "of", "the", "form", "{" ]
train
https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/reflect/ReflectUtil.java#L310-L317
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.webcontainer/src/com/ibm/ws/jaxws/webcontainer/LibertyJaxWsServlet.java
LibertyJaxWsServlet.service
@Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { HttpServletRequest request; HttpServletResponse response; try { request = (HttpServletRequest) req; if (collaborator != null) { ComponentMetaData componentMetaData = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); request = new JaxWsHttpServletRequestAdapter(request, collaborator, componentMetaData); } response = (HttpServletResponse) res; } catch (ClassCastException e) { throw new ServletException("Unrecognized HTTP request or response object", e); } String method = request.getMethod(); if (KNOWN_HTTP_VERBS.contains(method)) { super.service(request, response); } else { handleRequest(request, response); } }
java
@Override public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { HttpServletRequest request; HttpServletResponse response; try { request = (HttpServletRequest) req; if (collaborator != null) { ComponentMetaData componentMetaData = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData(); request = new JaxWsHttpServletRequestAdapter(request, collaborator, componentMetaData); } response = (HttpServletResponse) res; } catch (ClassCastException e) { throw new ServletException("Unrecognized HTTP request or response object", e); } String method = request.getMethod(); if (KNOWN_HTTP_VERBS.contains(method)) { super.service(request, response); } else { handleRequest(request, response); } }
[ "@", "Override", "public", "void", "service", "(", "ServletRequest", "req", ",", "ServletResponse", "res", ")", "throws", "ServletException", ",", "IOException", "{", "HttpServletRequest", "request", ";", "HttpServletResponse", "response", ";", "try", "{", "request"...
As AbstractHTTPServlet in CXF, with this, it will make sure that, all the request methods will be routed to handleRequest method.
[ "As", "AbstractHTTPServlet", "in", "CXF", "with", "this", "it", "will", "make", "sure", "that", "all", "the", "request", "methods", "will", "be", "routed", "to", "handleRequest", "method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.webcontainer/src/com/ibm/ws/jaxws/webcontainer/LibertyJaxWsServlet.java#L65-L89
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/extras/Poi.java
Poi.setLon
public void setLon(final int LON_DEG, final int LON_MIN, final int LON_SEC) { this.lon = convert(LON_DEG, LON_MIN, LON_SEC); this.LOCATION.setLocation(this.lat, this.lon); adjustDirection(); }
java
public void setLon(final int LON_DEG, final int LON_MIN, final int LON_SEC) { this.lon = convert(LON_DEG, LON_MIN, LON_SEC); this.LOCATION.setLocation(this.lat, this.lon); adjustDirection(); }
[ "public", "void", "setLon", "(", "final", "int", "LON_DEG", ",", "final", "int", "LON_MIN", ",", "final", "int", "LON_SEC", ")", "{", "this", ".", "lon", "=", "convert", "(", "LON_DEG", ",", "LON_MIN", ",", "LON_SEC", ")", ";", "this", ".", "LOCATION",...
Sets the longitude of the poi in the format 51° 20' 10" @param LON_DEG @param LON_MIN @param LON_SEC
[ "Sets", "the", "longitude", "of", "the", "poi", "in", "the", "format", "51°", "20", "10" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/extras/Poi.java#L228-L232
lessthanoptimal/ejml
examples/src/org/ejml/example/PrincipalComponentAnalysis.java
PrincipalComponentAnalysis.sampleToEigenSpace
public double[] sampleToEigenSpace( double[] sampleData ) { if( sampleData.length != A.getNumCols() ) throw new IllegalArgumentException("Unexpected sample length"); DMatrixRMaj mean = DMatrixRMaj.wrap(A.getNumCols(),1,this.mean); DMatrixRMaj s = new DMatrixRMaj(A.getNumCols(),1,true,sampleData); DMatrixRMaj r = new DMatrixRMaj(numComponents,1); CommonOps_DDRM.subtract(s, mean, s); CommonOps_DDRM.mult(V_t,s,r); return r.data; }
java
public double[] sampleToEigenSpace( double[] sampleData ) { if( sampleData.length != A.getNumCols() ) throw new IllegalArgumentException("Unexpected sample length"); DMatrixRMaj mean = DMatrixRMaj.wrap(A.getNumCols(),1,this.mean); DMatrixRMaj s = new DMatrixRMaj(A.getNumCols(),1,true,sampleData); DMatrixRMaj r = new DMatrixRMaj(numComponents,1); CommonOps_DDRM.subtract(s, mean, s); CommonOps_DDRM.mult(V_t,s,r); return r.data; }
[ "public", "double", "[", "]", "sampleToEigenSpace", "(", "double", "[", "]", "sampleData", ")", "{", "if", "(", "sampleData", ".", "length", "!=", "A", ".", "getNumCols", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected sample leng...
Converts a vector from sample space into eigen space. @param sampleData Sample space data. @return Eigen space projection.
[ "Converts", "a", "vector", "from", "sample", "space", "into", "eigen", "space", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/examples/src/org/ejml/example/PrincipalComponentAnalysis.java#L176-L189
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/Util.java
Util.pwr2LawPrev
public static final int pwr2LawPrev(final int ppo, final int curPoint) { if (curPoint <= 1) { return 0; } int gi = (int)round(log2(curPoint) * ppo); //current generating index int prev; do { prev = (int)round(pow(2.0, (double) --gi / ppo)); } while (prev >= curPoint); return prev; }
java
public static final int pwr2LawPrev(final int ppo, final int curPoint) { if (curPoint <= 1) { return 0; } int gi = (int)round(log2(curPoint) * ppo); //current generating index int prev; do { prev = (int)round(pow(2.0, (double) --gi / ppo)); } while (prev >= curPoint); return prev; }
[ "public", "static", "final", "int", "pwr2LawPrev", "(", "final", "int", "ppo", ",", "final", "int", "curPoint", ")", "{", "if", "(", "curPoint", "<=", "1", ")", "{", "return", "0", ";", "}", "int", "gi", "=", "(", "int", ")", "round", "(", "log2", ...
Computes the previous, smaller integer point in the power series <i>point = 2<sup>( i / ppo )</sup></i> given the current point in the series. For illustration, this can be used in a loop as follows: <pre>{@code int maxP = 1024; int minP = 1; int ppo = 2; for (int p = maxP; p >= minP; p = pwr2LawPrev(ppo, p)) { System.out.print(p + " "); } //generates the following series: //1024 724 512 362 256 181 128 91 64 45 32 23 16 11 8 6 4 3 2 1 }</pre> @param ppo Points-Per-Octave, or the number of points per integer powers of 2 in the series. @param curPoint the current point of the series. Must be &ge; 1. @return the previous, smaller point in the power series. A returned value of zero terminates the series.
[ "Computes", "the", "previous", "smaller", "integer", "point", "in", "the", "power", "series", "<i", ">", "point", "=", "2<sup", ">", "(", "i", "/", "ppo", ")", "<", "/", "sup", ">", "<", "/", "i", ">", "given", "the", "current", "point", "in", "the...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L518-L526
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/datasource/HdfsStatsService.java
HdfsStatsService.getOlderRunId
public static long getOlderRunId(int i, long runId) { /** * try to pick a randomized hour around that old date instead of picking * exactly the same hour */ int randomizedHourInSeconds = (int) (Math.random() * 23) * 3600; /** * consider the day before old date and add randomizedHour for example, for * retryCount = 0 pick a day which is 2 days before ageMult[0], that is 2 * days before the current date in consideration and add the randomized hour * say 13 hours, so that gives an hour belonging to one day before current * date in consideration */ if (i >= HdfsConstants.ageMult.length) { throw new ProcessingException("Can't look back in time that far " + i + ", only upto " + HdfsConstants.ageMult.length); } long newTs = runId - (HdfsConstants.ageMult[i] * HdfsConstants.NUM_SECONDS_IN_A_DAY + randomizedHourInSeconds); LOG.info(" Getting older runId for " + runId + ", returning " + newTs + " since ageMult[" + i + "]=" + HdfsConstants.ageMult[i] + " randomizedHourInSeconds=" + randomizedHourInSeconds); return newTs; }
java
public static long getOlderRunId(int i, long runId) { /** * try to pick a randomized hour around that old date instead of picking * exactly the same hour */ int randomizedHourInSeconds = (int) (Math.random() * 23) * 3600; /** * consider the day before old date and add randomizedHour for example, for * retryCount = 0 pick a day which is 2 days before ageMult[0], that is 2 * days before the current date in consideration and add the randomized hour * say 13 hours, so that gives an hour belonging to one day before current * date in consideration */ if (i >= HdfsConstants.ageMult.length) { throw new ProcessingException("Can't look back in time that far " + i + ", only upto " + HdfsConstants.ageMult.length); } long newTs = runId - (HdfsConstants.ageMult[i] * HdfsConstants.NUM_SECONDS_IN_A_DAY + randomizedHourInSeconds); LOG.info(" Getting older runId for " + runId + ", returning " + newTs + " since ageMult[" + i + "]=" + HdfsConstants.ageMult[i] + " randomizedHourInSeconds=" + randomizedHourInSeconds); return newTs; }
[ "public", "static", "long", "getOlderRunId", "(", "int", "i", ",", "long", "runId", ")", "{", "/**\n * try to pick a randomized hour around that old date instead of picking\n * exactly the same hour\n */", "int", "randomizedHourInSeconds", "=", "(", "int", ")", "(",...
this function returns an older timestamp ideally we would be using the daily aggregation table and be simply looking for last run of the aggregation, but right now, in the hourly table, we try to look for certain timestamps in the past instead of scanning the entire table for the last run. @param i (i should always be less than ageMult.size) @param runId @return older runId @throws ProcessingException
[ "this", "function", "returns", "an", "older", "timestamp", "ideally", "we", "would", "be", "using", "the", "daily", "aggregation", "table", "and", "be", "simply", "looking", "for", "last", "run", "of", "the", "aggregation", "but", "right", "now", "in", "the"...
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/HdfsStatsService.java#L283-L309
couchbase/CouchbaseMock
src/main/java/com/couchbase/mock/DocumentLoader.java
DocumentLoader.loadFromSerializedXZ
public static void loadFromSerializedXZ(InputStream is, String bucketName, CouchbaseMock mock) throws IOException { XZInputStream xzi = new XZInputStream(is); ObjectInputStream ois = new ObjectInputStream(xzi); StoredInfo si; try { si = (StoredInfo) ois.readObject(); } catch (ClassNotFoundException ex) { throw new IOException(ex); } DocumentLoader loader = new DocumentLoader(mock, bucketName); for (Map.Entry<String,String> ent : si.documents.entrySet()) { loader.handleDocument(ent.getKey(), ent.getValue()); } for (Map.Entry<String,String> ent: si.designs.entrySet()) { loader.handleDesign(ent.getKey(), ent.getValue()); } System.err.printf("Finished loading %d documents and %d designs into %s%n", si.documents.size(), si.designs.size(), bucketName); }
java
public static void loadFromSerializedXZ(InputStream is, String bucketName, CouchbaseMock mock) throws IOException { XZInputStream xzi = new XZInputStream(is); ObjectInputStream ois = new ObjectInputStream(xzi); StoredInfo si; try { si = (StoredInfo) ois.readObject(); } catch (ClassNotFoundException ex) { throw new IOException(ex); } DocumentLoader loader = new DocumentLoader(mock, bucketName); for (Map.Entry<String,String> ent : si.documents.entrySet()) { loader.handleDocument(ent.getKey(), ent.getValue()); } for (Map.Entry<String,String> ent: si.designs.entrySet()) { loader.handleDesign(ent.getKey(), ent.getValue()); } System.err.printf("Finished loading %d documents and %d designs into %s%n", si.documents.size(), si.designs.size(), bucketName); }
[ "public", "static", "void", "loadFromSerializedXZ", "(", "InputStream", "is", ",", "String", "bucketName", ",", "CouchbaseMock", "mock", ")", "throws", "IOException", "{", "XZInputStream", "xzi", "=", "new", "XZInputStream", "(", "is", ")", ";", "ObjectInputStream...
Loads the {@code beer-sample} documents from the built-in serialized compressed resource. @param is The input stream @param bucketName The target bucket into which the docs should be loaded @param mock The cluster @throws IOException if an I/O error occurs
[ "Loads", "the", "{", "@code", "beer", "-", "sample", "}", "documents", "from", "the", "built", "-", "in", "serialized", "compressed", "resource", "." ]
train
https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/DocumentLoader.java#L151-L169
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.userInGroup
public boolean userInGroup(String username, String groupname) throws CmsException { return (m_securityManager.userInGroup(m_context, username, groupname)); }
java
public boolean userInGroup(String username, String groupname) throws CmsException { return (m_securityManager.userInGroup(m_context, username, groupname)); }
[ "public", "boolean", "userInGroup", "(", "String", "username", ",", "String", "groupname", ")", "throws", "CmsException", "{", "return", "(", "m_securityManager", ".", "userInGroup", "(", "m_context", ",", "username", ",", "groupname", ")", ")", ";", "}" ]
Tests if a user is member of the given group.<p> @param username the name of the user to test @param groupname the name of the group to test @return <code>true</code>, if the user is in the group; or <code>false</code> otherwise @throws CmsException if operation was not successful
[ "Tests", "if", "a", "user", "is", "member", "of", "the", "given", "group", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3958-L3961
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java
GVRTransform.translate
public void translate(float x, float y, float z) { NativeTransform.translate(getNative(), x, y, z); }
java
public void translate(float x, float y, float z) { NativeTransform.translate(getNative(), x, y, z); }
[ "public", "void", "translate", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "NativeTransform", ".", "translate", "(", "getNative", "(", ")", ",", "x", ",", "y", ",", "z", ")", ";", "}" ]
Move the object, relative to its current position. Modify the tranform's current translation by applying translations on all 3 axes. @param x 'X' delta @param y 'Y' delta @param z 'Z' delta
[ "Move", "the", "object", "relative", "to", "its", "current", "position", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java#L387-L389
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java
CPAttachmentFileEntryPersistenceImpl.removeByUUID_G
@Override public CPAttachmentFileEntry removeByUUID_G(String uuid, long groupId) throws NoSuchCPAttachmentFileEntryException { CPAttachmentFileEntry cpAttachmentFileEntry = findByUUID_G(uuid, groupId); return remove(cpAttachmentFileEntry); }
java
@Override public CPAttachmentFileEntry removeByUUID_G(String uuid, long groupId) throws NoSuchCPAttachmentFileEntryException { CPAttachmentFileEntry cpAttachmentFileEntry = findByUUID_G(uuid, groupId); return remove(cpAttachmentFileEntry); }
[ "@", "Override", "public", "CPAttachmentFileEntry", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCPAttachmentFileEntryException", "{", "CPAttachmentFileEntry", "cpAttachmentFileEntry", "=", "findByUUID_G", "(", "uuid", ",", "group...
Removes the cp attachment file entry where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the cp attachment file entry that was removed
[ "Removes", "the", "cp", "attachment", "file", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java#L820-L826
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java
TitlePaneIconifyButtonPainter.paintBackgroundHover
private void paintBackgroundHover(Graphics2D g, JComponent c, int width, int height) { paintBackground(g, c, width, height, hover); }
java
private void paintBackgroundHover(Graphics2D g, JComponent c, int width, int height) { paintBackground(g, c, width, height, hover); }
[ "private", "void", "paintBackgroundHover", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "paintBackground", "(", "g", ",", "c", ",", "width", ",", "height", ",", "hover", ")", ";", "}" ]
Paint the background mouse-over state. @param g the Graphics2D context to paint with. @param c the component. @param width the width of the component. @param height the height of the component.
[ "Paint", "the", "background", "mouse", "-", "over", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L147-L149
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setStorageAccount
public StorageBundle setStorageAccount(String vaultBaseUrl, String storageAccountName, String resourceId, String activeKeyName, boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags) { return setStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags).toBlocking().single().body(); }
java
public StorageBundle setStorageAccount(String vaultBaseUrl, String storageAccountName, String resourceId, String activeKeyName, boolean autoRegenerateKey, String regenerationPeriod, StorageAccountAttributes storageAccountAttributes, Map<String, String> tags) { return setStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName, resourceId, activeKeyName, autoRegenerateKey, regenerationPeriod, storageAccountAttributes, tags).toBlocking().single().body(); }
[ "public", "StorageBundle", "setStorageAccount", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "resourceId", ",", "String", "activeKeyName", ",", "boolean", "autoRegenerateKey", ",", "String", "regenerationPeriod", ",", "StorageAccountA...
Creates or updates a new storage account. This operation requires the storage/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param resourceId Storage account resource id. @param activeKeyName Current active storage account key name. @param autoRegenerateKey whether keyvault should manage the storage account for the user. @param regenerationPeriod The key regeneration time duration specified in ISO-8601 format. @param storageAccountAttributes The attributes of the storage account. @param tags Application specific metadata in the form of key-value pairs. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StorageBundle object if successful.
[ "Creates", "or", "updates", "a", "new", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "set", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9976-L9978
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceCreator.java
V1InstanceCreator.regressionSuite
public RegressionSuite regressionSuite(String name, RegressionPlan regressionPlan) { return regressionSuite(name, regressionPlan, null); }
java
public RegressionSuite regressionSuite(String name, RegressionPlan regressionPlan) { return regressionSuite(name, regressionPlan, null); }
[ "public", "RegressionSuite", "regressionSuite", "(", "String", "name", ",", "RegressionPlan", "regressionPlan", ")", "{", "return", "regressionSuite", "(", "name", ",", "regressionPlan", ",", "null", ")", ";", "}" ]
Creates a new Regression Suite with title assigned with this Regression Plan. @param name Title of the suite. @param regressionPlan Regression Plan to assign. @return A newly minted Regression Suite that exists in the VersionOne system.
[ "Creates", "a", "new", "Regression", "Suite", "with", "title", "assigned", "with", "this", "Regression", "Plan", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceCreator.java#L1112-L1114
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toInt
public int toInt(Element el, String attributeName, int defaultValue) { String value = el.getAttribute(attributeName); if (value == null) return defaultValue; int intValue = Caster.toIntValue(value, Integer.MIN_VALUE); if (intValue == Integer.MIN_VALUE) return defaultValue; return intValue; }
java
public int toInt(Element el, String attributeName, int defaultValue) { String value = el.getAttribute(attributeName); if (value == null) return defaultValue; int intValue = Caster.toIntValue(value, Integer.MIN_VALUE); if (intValue == Integer.MIN_VALUE) return defaultValue; return intValue; }
[ "public", "int", "toInt", "(", "Element", "el", ",", "String", "attributeName", ",", "int", "defaultValue", ")", "{", "String", "value", "=", "el", ".", "getAttribute", "(", "attributeName", ")", ";", "if", "(", "value", "==", "null", ")", "return", "def...
reads a XML Element Attribute ans cast it to a int value @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @param defaultValue if attribute doesn't exist return default value @return Attribute Value
[ "reads", "a", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "int", "value" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L227-L233
hdbeukel/james-extensions
src/main/java/org/jamesframework/ext/problems/objectives/evaluations/WeightedIndexEvaluation.java
WeightedIndexEvaluation.addEvaluation
public void addEvaluation(Objective obj, Evaluation eval, double weight){ evaluations.put(obj, eval); // update weighted sum weightedSum += weight * eval.getValue(); }
java
public void addEvaluation(Objective obj, Evaluation eval, double weight){ evaluations.put(obj, eval); // update weighted sum weightedSum += weight * eval.getValue(); }
[ "public", "void", "addEvaluation", "(", "Objective", "obj", ",", "Evaluation", "eval", ",", "double", "weight", ")", "{", "evaluations", ".", "put", "(", "obj", ",", "eval", ")", ";", "// update weighted sum", "weightedSum", "+=", "weight", "*", "eval", ".",...
Add an evaluation produced by an objective, specifying its weight. @param obj objective @param eval produced evaluation @param weight assigned weight
[ "Add", "an", "evaluation", "produced", "by", "an", "objective", "specifying", "its", "weight", "." ]
train
https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/problems/objectives/evaluations/WeightedIndexEvaluation.java#L54-L58
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/servicefactory/ServiceFactory.java
ServiceFactory.createForNames
public <T> void createForNames(String[] names, T[] objectOutput) { if(objectOutput == null || objectOutput.length == 0) throw new IllegalArgumentException("Non empty objectOutput"); if(names ==null || names.length == 0) { return; } String name = null; Object obj = null; try { for(int i=0; i < names.length;i++) { name = names[i]; obj = this.create(name); objectOutput[i] = this.create(name); } } catch (ArrayStoreException e) { if(obj == null) throw e; throw new SystemException("Cannot assign bean \""+name+"\" class:"+obj.getClass().getName() +" to array of objectOutput arrray class:"+Arrays.asList(objectOutput),e); } }
java
public <T> void createForNames(String[] names, T[] objectOutput) { if(objectOutput == null || objectOutput.length == 0) throw new IllegalArgumentException("Non empty objectOutput"); if(names ==null || names.length == 0) { return; } String name = null; Object obj = null; try { for(int i=0; i < names.length;i++) { name = names[i]; obj = this.create(name); objectOutput[i] = this.create(name); } } catch (ArrayStoreException e) { if(obj == null) throw e; throw new SystemException("Cannot assign bean \""+name+"\" class:"+obj.getClass().getName() +" to array of objectOutput arrray class:"+Arrays.asList(objectOutput),e); } }
[ "public", "<", "T", ">", "void", "createForNames", "(", "String", "[", "]", "names", ",", "T", "[", "]", "objectOutput", ")", "{", "if", "(", "objectOutput", "==", "null", "||", "objectOutput", ".", "length", "==", "0", ")", "throw", "new", "IllegalArg...
Example USage: <code> StructureFinder[] finders = new StructureFinder[sources.length]; ServiceFactory.getInstance().createForNames(sources,finders); </code> @param names the object/service names @param objectOutput array to place results @param <T> the type class
[ "Example", "USage", ":", "<code", ">", "StructureFinder", "[]", "finders", "=", "new", "StructureFinder", "[", "sources", ".", "length", "]", ";", "ServiceFactory", ".", "getInstance", "()", ".", "createForNames", "(", "sources", "finders", ")", ";", "<", "/...
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/servicefactory/ServiceFactory.java#L198-L228
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/GenericUrl.java
GenericUrl.toURL
public final URL toURL(String relativeUrl) { try { URL url = toURL(); return new URL(url, relativeUrl); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } }
java
public final URL toURL(String relativeUrl) { try { URL url = toURL(); return new URL(url, relativeUrl); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } }
[ "public", "final", "URL", "toURL", "(", "String", "relativeUrl", ")", "{", "try", "{", "URL", "url", "=", "toURL", "(", ")", ";", "return", "new", "URL", "(", "url", ",", "relativeUrl", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", ...
Constructs the URL based on {@link URL#URL(URL, String)} with this URL representation from {@link #toURL()} and a relative url. <p>Any {@link MalformedURLException} is wrapped in an {@link IllegalArgumentException}. @return new URL instance @since 1.14
[ "Constructs", "the", "URL", "based", "on", "{", "@link", "URL#URL", "(", "URL", "String", ")", "}", "with", "this", "URL", "representation", "from", "{", "@link", "#toURL", "()", "}", "and", "a", "relative", "url", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/GenericUrl.java#L403-L410
Stratio/deep-spark
deep-aerospike/src/main/java/com/stratio/deep/aerospike/utils/UtilAerospike.java
UtilAerospike.getAerospikeRecordFromObject
public static <T> Pair<Object, AerospikeRecord> getAerospikeRecordFromObject(T t) throws IllegalAccessException, InstantiationException, InvocationTargetException { Field[] fields = AnnotationUtils.filterDeepFields(t.getClass()); Pair<Field[], Field[]> keysAndFields = AnnotationUtils.filterKeyFields(t.getClass()); Field[] keys = keysAndFields.left; Object key; Map<String, Object> bins = new HashMap<>(); if(keys.length == 0) { throw new InvocationTargetException(new Exception("One key field must be defined.")); } else if(keys.length > 1) { throw new InvocationTargetException(new Exception("Aerospike only supports one key field")); } else { Field keyField = keys[0]; Method method = Utils.findGetter(keyField.getName(), t.getClass()); key = method.invoke(t); } for (Field field : fields) { Method method = Utils.findGetter(field.getName(), t.getClass()); Object object = method.invoke(t); if (object != null) { bins.put(AnnotationUtils.deepFieldName(field), object); } } Record record = new Record(bins, 0, 0); AerospikeRecord aerospikeRecord = new AerospikeRecord(record); Pair<Object, AerospikeRecord> result = Pair.create(key, aerospikeRecord); return result; }
java
public static <T> Pair<Object, AerospikeRecord> getAerospikeRecordFromObject(T t) throws IllegalAccessException, InstantiationException, InvocationTargetException { Field[] fields = AnnotationUtils.filterDeepFields(t.getClass()); Pair<Field[], Field[]> keysAndFields = AnnotationUtils.filterKeyFields(t.getClass()); Field[] keys = keysAndFields.left; Object key; Map<String, Object> bins = new HashMap<>(); if(keys.length == 0) { throw new InvocationTargetException(new Exception("One key field must be defined.")); } else if(keys.length > 1) { throw new InvocationTargetException(new Exception("Aerospike only supports one key field")); } else { Field keyField = keys[0]; Method method = Utils.findGetter(keyField.getName(), t.getClass()); key = method.invoke(t); } for (Field field : fields) { Method method = Utils.findGetter(field.getName(), t.getClass()); Object object = method.invoke(t); if (object != null) { bins.put(AnnotationUtils.deepFieldName(field), object); } } Record record = new Record(bins, 0, 0); AerospikeRecord aerospikeRecord = new AerospikeRecord(record); Pair<Object, AerospikeRecord> result = Pair.create(key, aerospikeRecord); return result; }
[ "public", "static", "<", "T", ">", "Pair", "<", "Object", ",", "AerospikeRecord", ">", "getAerospikeRecordFromObject", "(", "T", "t", ")", "throws", "IllegalAccessException", ",", "InstantiationException", ",", "InvocationTargetException", "{", "Field", "[", "]", ...
Converts from an entity class with deep's anotations to AerospikeRecord. @param t an instance of an object of type T to convert to AerospikeRecord. @param <T> the type of the object to convert. @return A pair with the Record key and the Record itself. @throws IllegalAccessException @throws InstantiationException @throws InvocationTargetException
[ "Converts", "from", "an", "entity", "class", "with", "deep", "s", "anotations", "to", "AerospikeRecord", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-aerospike/src/main/java/com/stratio/deep/aerospike/utils/UtilAerospike.java#L133-L163
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java
KnowledgeBaseManagerSparql.checkFetchingTasks
private boolean checkFetchingTasks(Map<URI, Future<Boolean>> concurrentTasks) { boolean result = true; Boolean fetched; for (URI modelUri : concurrentTasks.keySet()) { Future<Boolean> f = concurrentTasks.get(modelUri); try { fetched = f.get(); result = result && fetched; // Track unreachability if (fetched && this.unreachableModels.containsKey(modelUri)) { this.unreachableModels.remove(modelUri); log.info("A previously unreachable model has finally been obtained - {}", modelUri); } if (!fetched) { this.unreachableModels.put(modelUri, new Date()); log.error("Cannot load " + modelUri + ". Marked as invalid"); } } catch (Exception e) { // Mark as invalid log.error("There was an error while trying to fetch a remote model", e); this.unreachableModels.put(modelUri, new Date()); log.info("Added {} to the unreachable models list.", modelUri); result = false; } } return result; }
java
private boolean checkFetchingTasks(Map<URI, Future<Boolean>> concurrentTasks) { boolean result = true; Boolean fetched; for (URI modelUri : concurrentTasks.keySet()) { Future<Boolean> f = concurrentTasks.get(modelUri); try { fetched = f.get(); result = result && fetched; // Track unreachability if (fetched && this.unreachableModels.containsKey(modelUri)) { this.unreachableModels.remove(modelUri); log.info("A previously unreachable model has finally been obtained - {}", modelUri); } if (!fetched) { this.unreachableModels.put(modelUri, new Date()); log.error("Cannot load " + modelUri + ". Marked as invalid"); } } catch (Exception e) { // Mark as invalid log.error("There was an error while trying to fetch a remote model", e); this.unreachableModels.put(modelUri, new Date()); log.info("Added {} to the unreachable models list.", modelUri); result = false; } } return result; }
[ "private", "boolean", "checkFetchingTasks", "(", "Map", "<", "URI", ",", "Future", "<", "Boolean", ">", ">", "concurrentTasks", ")", "{", "boolean", "result", "=", "true", ";", "Boolean", "fetched", ";", "for", "(", "URI", "modelUri", ":", "concurrentTasks",...
This method checks a set of fetching tasks that are pending to validate their adequate conclusion. For each of the fetching tasks launched we will track the models that were not adequately loaded for ulterior uploading. @param concurrentTasks the Map with the models to fetch and the Future providing the state of the uploading @return True if all the models were adequately uploaded. False otherwise.
[ "This", "method", "checks", "a", "set", "of", "fetching", "tasks", "that", "are", "pending", "to", "validate", "their", "adequate", "conclusion", ".", "For", "each", "of", "the", "fetching", "tasks", "launched", "we", "will", "track", "the", "models", "that"...
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java#L241-L269
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResponseRequest.java
UpdateRouteResponseRequest.withResponseModels
public UpdateRouteResponseRequest withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
java
public UpdateRouteResponseRequest withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
[ "public", "UpdateRouteResponseRequest", "withResponseModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseModels", ")", "{", "setResponseModels", "(", "responseModels", ")", ";", "return", "this", ";", "}" ]
<p> The response models for the route response. </p> @param responseModels The response models for the route response. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "response", "models", "for", "the", "route", "response", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResponseRequest.java#L181-L184
JOML-CI/JOML
src/org/joml/Matrix3x2f.java
Matrix3x2f.get3x3
public FloatBuffer get3x3(int index, FloatBuffer buffer) { MemUtil.INSTANCE.put3x3(this, index, buffer); return buffer; }
java
public FloatBuffer get3x3(int index, FloatBuffer buffer) { MemUtil.INSTANCE.put3x3(this, index, buffer); return buffer; }
[ "public", "FloatBuffer", "get3x3", "(", "int", "index", ",", "FloatBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "put3x3", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "buffer", ";", "}" ]
Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied {@link FloatBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given FloatBuffer. @param index the absolute position into the FloatBuffer @param buffer will receive the values of this matrix in column-major order @return the passed in buffer
[ "Store", "this", "matrix", "as", "an", "equivalent", "3x3", "matrix", "in", "column", "-", "major", "order", "into", "the", "supplied", "{", "@link", "FloatBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", "....
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2f.java#L912-L915
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/TemplatesApi.java
TemplatesApi.listTemplates
public EnvelopeTemplateResults listTemplates(String accountId, TemplatesApi.ListTemplatesOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listTemplates"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/templates".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "folder", options.folder)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "folder_ids", options.folderIds)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_date", options.fromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", options.include)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "modified_from_date", options.modifiedFromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "modified_to_date", options.modifiedToDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", options.order)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "order_by", options.orderBy)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "search_text", options.searchText)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "shared_by_me", options.sharedByMe)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to_date", options.toDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "used_from_date", options.usedFromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "used_to_date", options.usedToDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_filter", options.userFilter)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_id", options.userId)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<EnvelopeTemplateResults> localVarReturnType = new GenericType<EnvelopeTemplateResults>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public EnvelopeTemplateResults listTemplates(String accountId, TemplatesApi.ListTemplatesOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listTemplates"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/templates".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "count", options.count)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "folder", options.folder)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "folder_ids", options.folderIds)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_date", options.fromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", options.include)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "modified_from_date", options.modifiedFromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "modified_to_date", options.modifiedToDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", options.order)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "order_by", options.orderBy)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "search_text", options.searchText)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "shared_by_me", options.sharedByMe)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to_date", options.toDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "used_from_date", options.usedFromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "used_to_date", options.usedToDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_filter", options.userFilter)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "user_id", options.userId)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<EnvelopeTemplateResults> localVarReturnType = new GenericType<EnvelopeTemplateResults>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "EnvelopeTemplateResults", "listTemplates", "(", "String", "accountId", ",", "TemplatesApi", ".", "ListTemplatesOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "\"{}\"", ";", "// verify the required parameter 'accountId' i...
Gets the definition of a template. Retrieves the list of templates for the specified account. The request can be limited to a specific folder. @param accountId The external account number (int) or account ID Guid. (required) @param options for modifying the method behavior. @return EnvelopeTemplateResults @throws ApiException if fails to make API call
[ "Gets", "the", "definition", "of", "a", "template", ".", "Retrieves", "the", "list", "of", "templates", "for", "the", "specified", "account", ".", "The", "request", "can", "be", "limited", "to", "a", "specific", "folder", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2639-L2691
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java
Hierarchy.findExactMethod
public static JavaClassAndMethod findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser chooser) throws ClassNotFoundException { String className = inv.getClassName(cpg); String methodName = inv.getName(cpg); String methodSig = inv.getSignature(cpg); JavaClass jclass = Repository.lookupClass(className); return findMethod(jclass, methodName, methodSig, chooser); }
java
public static JavaClassAndMethod findExactMethod(InvokeInstruction inv, ConstantPoolGen cpg, JavaClassAndMethodChooser chooser) throws ClassNotFoundException { String className = inv.getClassName(cpg); String methodName = inv.getName(cpg); String methodSig = inv.getSignature(cpg); JavaClass jclass = Repository.lookupClass(className); return findMethod(jclass, methodName, methodSig, chooser); }
[ "public", "static", "JavaClassAndMethod", "findExactMethod", "(", "InvokeInstruction", "inv", ",", "ConstantPoolGen", "cpg", ",", "JavaClassAndMethodChooser", "chooser", ")", "throws", "ClassNotFoundException", "{", "String", "className", "=", "inv", ".", "getClassName", ...
Look up the method referenced by given InvokeInstruction. This method does <em>not</em> look for implementations in super or subclasses according to the virtual dispatch rules. @param inv the InvokeInstruction @param cpg the ConstantPoolGen used by the class the InvokeInstruction belongs to @param chooser JavaClassAndMethodChooser to use to pick the method from among the candidates @return the JavaClassAndMethod, or null if no such method is defined in the class
[ "Look", "up", "the", "method", "referenced", "by", "given", "InvokeInstruction", ".", "This", "method", "does", "<em", ">", "not<", "/", "em", ">", "look", "for", "implementations", "in", "super", "or", "subclasses", "according", "to", "the", "virtual", "dis...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L252-L260
intellimate/Izou
src/main/java/org/intellimate/izou/security/PermissionManager.java
PermissionManager.checkPermission
public void checkPermission(Permission perm, AddOnModel addOnModel) throws IzouPermissionException { try { rootPermission.checkPermission(perm, addOnModel); //its root return; } catch (IzouPermissionException ignored) { //its just not root } standardCheck.stream() .filter(permissionModule -> permissionModule.canCheckPermission(perm)) .forEach(permissionModule -> permissionModule.checkPermission(perm, addOnModel)); }
java
public void checkPermission(Permission perm, AddOnModel addOnModel) throws IzouPermissionException { try { rootPermission.checkPermission(perm, addOnModel); //its root return; } catch (IzouPermissionException ignored) { //its just not root } standardCheck.stream() .filter(permissionModule -> permissionModule.canCheckPermission(perm)) .forEach(permissionModule -> permissionModule.checkPermission(perm, addOnModel)); }
[ "public", "void", "checkPermission", "(", "Permission", "perm", ",", "AddOnModel", "addOnModel", ")", "throws", "IzouPermissionException", "{", "try", "{", "rootPermission", ".", "checkPermission", "(", "perm", ",", "addOnModel", ")", ";", "//its root", "return", ...
checks the permission @param perm the permission @param addOnModel the associated AddOnModel @throws IzouPermissionException if the permission was not granted
[ "checks", "the", "permission" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/PermissionManager.java#L51-L62
Jasig/uPortal
uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java
PropertiesManager.getPropertyAsShort
public static short getPropertyAsShort(String name) throws MissingPropertyException, BadPropertyException { if (PropertiesManager.props == null) loadProps(); try { return Short.parseShort(getProperty(name)); } catch (NumberFormatException nfe) { throw new BadPropertyException(name, getProperty(name), "short"); } }
java
public static short getPropertyAsShort(String name) throws MissingPropertyException, BadPropertyException { if (PropertiesManager.props == null) loadProps(); try { return Short.parseShort(getProperty(name)); } catch (NumberFormatException nfe) { throw new BadPropertyException(name, getProperty(name), "short"); } }
[ "public", "static", "short", "getPropertyAsShort", "(", "String", "name", ")", "throws", "MissingPropertyException", ",", "BadPropertyException", "{", "if", "(", "PropertiesManager", ".", "props", "==", "null", ")", "loadProps", "(", ")", ";", "try", "{", "retur...
Returns the value of a property for a given name as a <code>short</code> @param name the name of the requested property @return value the property's value as a <code>short</code> @throws MissingPropertyException - if the property is not set @throws BadPropertyException - if the property cannot be parsed as a short or is not set.
[ "Returns", "the", "value", "of", "a", "property", "for", "a", "given", "name", "as", "a", "<code", ">", "short<", "/", "code", ">" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L219-L227
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java
JdbcCpoAdapter.processUpdateGroup
protected <T> long processUpdateGroup(T obj, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con) throws CpoException { Logger localLogger = obj == null ? logger : LoggerFactory.getLogger(obj.getClass()); CpoClass cpoClass; PreparedStatement ps = null; JdbcPreparedStatementFactory jpsf = null; long updateCount = 0; if (obj == null) { throw new CpoException("NULL Object passed into insertObject, deleteObject, updateObject, or persistObject"); } try { cpoClass = metaDescriptor.getMetaClass(obj); List<CpoFunction> cpoFunctions = cpoClass.getFunctionGroup(getGroupType(obj, groupType, groupName, con), groupName).getFunctions(); localLogger.info("=================== Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); int numRows = 0; for (CpoFunction cpoFunction : cpoFunctions) { jpsf = new JdbcPreparedStatementFactory(con, this, cpoClass, cpoFunction, obj, wheres, orderBy, nativeExpressions); ps = jpsf.getPreparedStatement(); numRows += ps.executeUpdate(); jpsf.release(); ps.close(); } localLogger.info("=================== " + numRows + " Updates - Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); if (numRows > 0) { updateCount++; } } catch (Throwable t) { String msg = "ProcessUpdateGroup failed:" + groupType + "," + groupName + "," + obj.getClass().getName(); // TODO FIX THIS // localLogger.error("bound values:" + this.parameterToString(jq)); localLogger.error(msg, t); throw new CpoException(msg, t); } finally { statementClose(ps); if (jpsf != null) { jpsf.release(); } } return updateCount; }
java
protected <T> long processUpdateGroup(T obj, String groupType, String groupName, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions, Connection con) throws CpoException { Logger localLogger = obj == null ? logger : LoggerFactory.getLogger(obj.getClass()); CpoClass cpoClass; PreparedStatement ps = null; JdbcPreparedStatementFactory jpsf = null; long updateCount = 0; if (obj == null) { throw new CpoException("NULL Object passed into insertObject, deleteObject, updateObject, or persistObject"); } try { cpoClass = metaDescriptor.getMetaClass(obj); List<CpoFunction> cpoFunctions = cpoClass.getFunctionGroup(getGroupType(obj, groupType, groupName, con), groupName).getFunctions(); localLogger.info("=================== Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); int numRows = 0; for (CpoFunction cpoFunction : cpoFunctions) { jpsf = new JdbcPreparedStatementFactory(con, this, cpoClass, cpoFunction, obj, wheres, orderBy, nativeExpressions); ps = jpsf.getPreparedStatement(); numRows += ps.executeUpdate(); jpsf.release(); ps.close(); } localLogger.info("=================== " + numRows + " Updates - Class=<" + obj.getClass() + "> Type=<" + groupType + "> Name=<" + groupName + "> ========================="); if (numRows > 0) { updateCount++; } } catch (Throwable t) { String msg = "ProcessUpdateGroup failed:" + groupType + "," + groupName + "," + obj.getClass().getName(); // TODO FIX THIS // localLogger.error("bound values:" + this.parameterToString(jq)); localLogger.error(msg, t); throw new CpoException(msg, t); } finally { statementClose(ps); if (jpsf != null) { jpsf.release(); } } return updateCount; }
[ "protected", "<", "T", ">", "long", "processUpdateGroup", "(", "T", "obj", ",", "String", "groupType", ",", "String", "groupName", ",", "Collection", "<", "CpoWhere", ">", "wheres", ",", "Collection", "<", "CpoOrderBy", ">", "orderBy", ",", "Collection", "<"...
DOCUMENT ME! @param obj DOCUMENT ME! @param groupType DOCUMENT ME! @param groupName DOCUMENT ME! @param con DOCUMENT ME! @return DOCUMENT ME! @throws CpoException DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2605-L2650
abel533/EasyXls
src/main/java/com/github/abel533/easyxls/common/XlsUtil.java
XlsUtil.list2Xls
public static boolean list2Xls(ExcelConfig config, List<?> list, String filePath, String fileName) throws Exception { //创建目录 File file = new File(filePath); if (!(file.exists())) { if (!file.mkdirs()) { throw new RuntimeException("创建导出目录失败!"); } } OutputStream outputStream = null; try { if (!fileName.toLowerCase().endsWith(EXCEL)) { fileName += EXCEL; } File excelFile = new File(filePath + "/" + fileName); outputStream = new FileOutputStream(excelFile); return list2Xls(config, list, outputStream); } catch (Exception e1) { return false; } finally { if(outputStream != null){ outputStream.close(); } } }
java
public static boolean list2Xls(ExcelConfig config, List<?> list, String filePath, String fileName) throws Exception { //创建目录 File file = new File(filePath); if (!(file.exists())) { if (!file.mkdirs()) { throw new RuntimeException("创建导出目录失败!"); } } OutputStream outputStream = null; try { if (!fileName.toLowerCase().endsWith(EXCEL)) { fileName += EXCEL; } File excelFile = new File(filePath + "/" + fileName); outputStream = new FileOutputStream(excelFile); return list2Xls(config, list, outputStream); } catch (Exception e1) { return false; } finally { if(outputStream != null){ outputStream.close(); } } }
[ "public", "static", "boolean", "list2Xls", "(", "ExcelConfig", "config", ",", "List", "<", "?", ">", "list", ",", "String", "filePath", ",", "String", "fileName", ")", "throws", "Exception", "{", "//创建目录", "File", "file", "=", "new", "File", "(", "filePath...
导出list对象到excel @param config 配置 @param list 导出的list @param filePath 保存xls路径 @param fileName 保存xls文件名 @return 处理结果,true成功,false失败 @throws Exception
[ "导出list对象到excel" ]
train
https://github.com/abel533/EasyXls/blob/f73be23745c2180d7c0b8f0a510e72e61cc37d5d/src/main/java/com/github/abel533/easyxls/common/XlsUtil.java#L357-L380
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/SqsManager.java
SqsManager.parseMessage
public List<CloudTrailSource> parseMessage(List<Message> sqsMessages) { List<CloudTrailSource> sources = new ArrayList<>(); for (Message sqsMessage : sqsMessages) { boolean parseMessageSuccess = false; ProgressStatus parseMessageStatus = new ProgressStatus(ProgressState.parseMessage, new BasicParseMessageInfo(sqsMessage, parseMessageSuccess)); final Object reportObject = progressReporter.reportStart(parseMessageStatus); CloudTrailSource ctSource = null; try { ctSource = sourceSerializer.getSource(sqsMessage); if (containsCloudTrailLogs(ctSource)) { sources.add(ctSource); parseMessageSuccess = true; } } catch (Exception e) { LibraryUtils.handleException(exceptionHandler, parseMessageStatus, e, "Failed to parse sqs message."); } finally { if (containsCloudTrailValidationMessage(ctSource) || shouldDeleteMessageUponFailure(parseMessageSuccess)) { deleteMessageFromQueue(sqsMessage, new ProgressStatus(ProgressState.deleteMessage, new BasicParseMessageInfo(sqsMessage, false))); } LibraryUtils.endToProcess(progressReporter, parseMessageSuccess, parseMessageStatus, reportObject); } } return sources; }
java
public List<CloudTrailSource> parseMessage(List<Message> sqsMessages) { List<CloudTrailSource> sources = new ArrayList<>(); for (Message sqsMessage : sqsMessages) { boolean parseMessageSuccess = false; ProgressStatus parseMessageStatus = new ProgressStatus(ProgressState.parseMessage, new BasicParseMessageInfo(sqsMessage, parseMessageSuccess)); final Object reportObject = progressReporter.reportStart(parseMessageStatus); CloudTrailSource ctSource = null; try { ctSource = sourceSerializer.getSource(sqsMessage); if (containsCloudTrailLogs(ctSource)) { sources.add(ctSource); parseMessageSuccess = true; } } catch (Exception e) { LibraryUtils.handleException(exceptionHandler, parseMessageStatus, e, "Failed to parse sqs message."); } finally { if (containsCloudTrailValidationMessage(ctSource) || shouldDeleteMessageUponFailure(parseMessageSuccess)) { deleteMessageFromQueue(sqsMessage, new ProgressStatus(ProgressState.deleteMessage, new BasicParseMessageInfo(sqsMessage, false))); } LibraryUtils.endToProcess(progressReporter, parseMessageSuccess, parseMessageStatus, reportObject); } } return sources; }
[ "public", "List", "<", "CloudTrailSource", ">", "parseMessage", "(", "List", "<", "Message", ">", "sqsMessages", ")", "{", "List", "<", "CloudTrailSource", ">", "sources", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Message", "sqsMessage", "...
Given a list of raw SQS message parse each of them, and return a list of CloudTrailSource. @param sqsMessages list of SQS messages. @return list of CloudTrailSource.
[ "Given", "a", "list", "of", "raw", "SQS", "message", "parse", "each", "of", "them", "and", "return", "a", "list", "of", "CloudTrailSource", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/manager/SqsManager.java#L148-L176
hal/core
gui/src/main/java/org/jboss/as/console/client/v3/deployment/Deployment.java
Deployment.parseSubsystems
static void parseSubsystems(ModelNode node, List<Subsystem> subsystems) { List<Property> properties = node.get("subsystem").asPropertyList(); for (Property property : properties) { Subsystem subsystem = new Subsystem(property.getName(), property.getValue()); subsystems.add(subsystem); } }
java
static void parseSubsystems(ModelNode node, List<Subsystem> subsystems) { List<Property> properties = node.get("subsystem").asPropertyList(); for (Property property : properties) { Subsystem subsystem = new Subsystem(property.getName(), property.getValue()); subsystems.add(subsystem); } }
[ "static", "void", "parseSubsystems", "(", "ModelNode", "node", ",", "List", "<", "Subsystem", ">", "subsystems", ")", "{", "List", "<", "Property", ">", "properties", "=", "node", ".", "get", "(", "\"subsystem\"", ")", ".", "asPropertyList", "(", ")", ";",...
Expects a "subsystem" child resource. Modeled as a static helper method to make it usable from both deployments and subdeployments.
[ "Expects", "a", "subsystem", "child", "resource", ".", "Modeled", "as", "a", "static", "helper", "method", "to", "make", "it", "usable", "from", "both", "deployments", "and", "subdeployments", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/deployment/Deployment.java#L46-L52
Alluxio/alluxio
core/common/src/main/java/alluxio/conf/InstancedConfiguration.java
InstancedConfiguration.lookupRecursively
private String lookupRecursively(String base, Set<String> seen) throws UnresolvablePropertyException { // check argument if (base == null) { throw new UnresolvablePropertyException("Can't resolve property with null value"); } String resolved = base; // Lets find pattern match to ${key}. // TODO(hsaputra): Consider using Apache Commons StrSubstitutor. Matcher matcher = CONF_REGEX.matcher(base); while (matcher.find()) { String match = matcher.group(2).trim(); if (!seen.add(match)) { throw new RuntimeException(ExceptionMessage.KEY_CIRCULAR_DEPENDENCY.getMessage(match)); } if (!PropertyKey.isValid(match)) { throw new RuntimeException(ExceptionMessage.INVALID_CONFIGURATION_KEY.getMessage(match)); } String value = lookupRecursively(mProperties.get(PropertyKey.fromString(match)), seen); seen.remove(match); if (value == null) { throw new UnresolvablePropertyException(ExceptionMessage .UNDEFINED_CONFIGURATION_KEY.getMessage(match)); } LOG.debug("Replacing {} with {}", matcher.group(1), value); resolved = resolved.replaceFirst(REGEX_STRING, Matcher.quoteReplacement(value)); } return resolved; }
java
private String lookupRecursively(String base, Set<String> seen) throws UnresolvablePropertyException { // check argument if (base == null) { throw new UnresolvablePropertyException("Can't resolve property with null value"); } String resolved = base; // Lets find pattern match to ${key}. // TODO(hsaputra): Consider using Apache Commons StrSubstitutor. Matcher matcher = CONF_REGEX.matcher(base); while (matcher.find()) { String match = matcher.group(2).trim(); if (!seen.add(match)) { throw new RuntimeException(ExceptionMessage.KEY_CIRCULAR_DEPENDENCY.getMessage(match)); } if (!PropertyKey.isValid(match)) { throw new RuntimeException(ExceptionMessage.INVALID_CONFIGURATION_KEY.getMessage(match)); } String value = lookupRecursively(mProperties.get(PropertyKey.fromString(match)), seen); seen.remove(match); if (value == null) { throw new UnresolvablePropertyException(ExceptionMessage .UNDEFINED_CONFIGURATION_KEY.getMessage(match)); } LOG.debug("Replacing {} with {}", matcher.group(1), value); resolved = resolved.replaceFirst(REGEX_STRING, Matcher.quoteReplacement(value)); } return resolved; }
[ "private", "String", "lookupRecursively", "(", "String", "base", ",", "Set", "<", "String", ">", "seen", ")", "throws", "UnresolvablePropertyException", "{", "// check argument", "if", "(", "base", "==", "null", ")", "{", "throw", "new", "UnresolvablePropertyExcep...
Actual recursive lookup replacement. @param base the string to resolve @param seen strings already seen during this lookup, used to prevent unbound recursion @return the resolved string
[ "Actual", "recursive", "lookup", "replacement", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/conf/InstancedConfiguration.java#L387-L416
apache/incubator-druid
extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java
BloomKFilter.computeSizeBytes
public static int computeSizeBytes(long maxNumEntries) { // copied from constructor checkArgument(maxNumEntries > 0, "expectedEntries should be > 0"); long numBits = optimalNumOfBits(maxNumEntries, DEFAULT_FPP); int nLongs = (int) Math.ceil((double) numBits / (double) Long.SIZE); int padLongs = DEFAULT_BLOCK_SIZE - nLongs % DEFAULT_BLOCK_SIZE; return START_OF_SERIALIZED_LONGS + ((nLongs + padLongs) * Long.BYTES); }
java
public static int computeSizeBytes(long maxNumEntries) { // copied from constructor checkArgument(maxNumEntries > 0, "expectedEntries should be > 0"); long numBits = optimalNumOfBits(maxNumEntries, DEFAULT_FPP); int nLongs = (int) Math.ceil((double) numBits / (double) Long.SIZE); int padLongs = DEFAULT_BLOCK_SIZE - nLongs % DEFAULT_BLOCK_SIZE; return START_OF_SERIALIZED_LONGS + ((nLongs + padLongs) * Long.BYTES); }
[ "public", "static", "int", "computeSizeBytes", "(", "long", "maxNumEntries", ")", "{", "// copied from constructor", "checkArgument", "(", "maxNumEntries", ">", "0", ",", "\"expectedEntries should be > 0\"", ")", ";", "long", "numBits", "=", "optimalNumOfBits", "(", "...
Calculate size in bytes of a BloomKFilter for a given number of entries
[ "Calculate", "size", "in", "bytes", "of", "a", "BloomKFilter", "for", "a", "given", "number", "of", "entries" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L351-L360
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java
AVAKeyword.getKeyword
static String getKeyword(ObjectIdentifier oid, int standard) { return getKeyword (oid, standard, Collections.<String, String>emptyMap()); }
java
static String getKeyword(ObjectIdentifier oid, int standard) { return getKeyword (oid, standard, Collections.<String, String>emptyMap()); }
[ "static", "String", "getKeyword", "(", "ObjectIdentifier", "oid", ",", "int", "standard", ")", "{", "return", "getKeyword", "(", "oid", ",", "standard", ",", "Collections", ".", "<", "String", ",", "String", ">", "emptyMap", "(", ")", ")", ";", "}" ]
Get a keyword for the given ObjectIdentifier according to standard. If no keyword is available, the ObjectIdentifier is encoded as a String.
[ "Get", "a", "keyword", "for", "the", "given", "ObjectIdentifier", "according", "to", "standard", ".", "If", "no", "keyword", "is", "available", "the", "ObjectIdentifier", "is", "encoded", "as", "a", "String", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java#L1305-L1308
bazaarvoice/emodb
sor/src/main/java/com/bazaarvoice/emodb/sor/audit/s3/AthenaAuditWriter.java
AthenaAuditWriter.transferLogFilesToS3
private void transferLogFilesToS3() { if (_fileTransfersEnabled) { // Find all closed log files in the staging directory and move them to S3 for (final File logFile : _stagingDir.listFiles((dir, name) -> name.startsWith(_logFilePrefix) && name.endsWith(COMPRESSED_FILE_SUFFIX))) { // Extract the date portion of the file name and is it to partition the file in S3 String auditDate = logFile.getName().substring(_logFilePrefix.length() + 1, _logFilePrefix.length() + 9); String dest = String.format("%s/date=%s/%s", _s3AuditRoot, auditDate, logFile.getName()); _fileTransferService.submit(() -> { // Since file transfers are done in a single thread, there shouldn't be any concurrency issues, // but verify the same file wasn't submitted previously and is already transferred. if (logFile.exists()) { try { PutObjectResult result = _s3.putObject(_s3Bucket, dest, logFile); _log.debug("Audit log copied: {}, ETag={}", logFile, result.getETag()); if (!logFile.delete()) { _log.warn("Failed to delete file after copying to s3: {}", logFile); } } catch (Exception e) { // Log the error, try again on the next iteration _rateLimitedLog.error(e, "Failed to copy log file {}", logFile); } } }); } } }
java
private void transferLogFilesToS3() { if (_fileTransfersEnabled) { // Find all closed log files in the staging directory and move them to S3 for (final File logFile : _stagingDir.listFiles((dir, name) -> name.startsWith(_logFilePrefix) && name.endsWith(COMPRESSED_FILE_SUFFIX))) { // Extract the date portion of the file name and is it to partition the file in S3 String auditDate = logFile.getName().substring(_logFilePrefix.length() + 1, _logFilePrefix.length() + 9); String dest = String.format("%s/date=%s/%s", _s3AuditRoot, auditDate, logFile.getName()); _fileTransferService.submit(() -> { // Since file transfers are done in a single thread, there shouldn't be any concurrency issues, // but verify the same file wasn't submitted previously and is already transferred. if (logFile.exists()) { try { PutObjectResult result = _s3.putObject(_s3Bucket, dest, logFile); _log.debug("Audit log copied: {}, ETag={}", logFile, result.getETag()); if (!logFile.delete()) { _log.warn("Failed to delete file after copying to s3: {}", logFile); } } catch (Exception e) { // Log the error, try again on the next iteration _rateLimitedLog.error(e, "Failed to copy log file {}", logFile); } } }); } } }
[ "private", "void", "transferLogFilesToS3", "(", ")", "{", "if", "(", "_fileTransfersEnabled", ")", "{", "// Find all closed log files in the staging directory and move them to S3", "for", "(", "final", "File", "logFile", ":", "_stagingDir", ".", "listFiles", "(", "(", "...
This method takes all log files prepared by {@link #prepareClosedLogFilesForTransfer()} and initiates their transfer to S3. The transfer itself is performed asynchronously.
[ "This", "method", "takes", "all", "log", "files", "prepared", "by", "{" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor/src/main/java/com/bazaarvoice/emodb/sor/audit/s3/AthenaAuditWriter.java#L307-L336
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.purgeDeletedSecretAsync
public ServiceFuture<Void> purgeDeletedSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(purgeDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback); }
java
public ServiceFuture<Void> purgeDeletedSecretAsync(String vaultBaseUrl, String secretName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(purgeDeletedSecretWithServiceResponseAsync(vaultBaseUrl, secretName), serviceCallback); }
[ "public", "ServiceFuture", "<", "Void", ">", "purgeDeletedSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "final", "ServiceCallback", "<", "Void", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", ...
Permanently deletes the specified secret. The purge deleted secret operation removes the secret permanently, without the possibility of recovery. This operation can only be enabled on a soft-delete enabled vault. This operation requires the secrets/purge permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Permanently", "deletes", "the", "specified", "secret", ".", "The", "purge", "deleted", "secret", "operation", "removes", "the", "secret", "permanently", "without", "the", "possibility", "of", "recovery", ".", "This", "operation", "can", "only", "be", "enabled", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4744-L4746
dnsjava/dnsjava
org/xbill/DNS/Record.java
Record.fromString
public static Record fromString(Name name, int type, int dclass, long ttl, String s, Name origin) throws IOException { return fromString(name, type, dclass, ttl, new Tokenizer(s), origin); }
java
public static Record fromString(Name name, int type, int dclass, long ttl, String s, Name origin) throws IOException { return fromString(name, type, dclass, ttl, new Tokenizer(s), origin); }
[ "public", "static", "Record", "fromString", "(", "Name", "name", ",", "int", "type", ",", "int", "dclass", ",", "long", "ttl", ",", "String", "s", ",", "Name", "origin", ")", "throws", "IOException", "{", "return", "fromString", "(", "name", ",", "type",...
Builds a new Record from its textual representation @param name The owner name of the record. @param type The record's type. @param dclass The record's class. @param ttl The record's time to live. @param s The textual representation of the rdata. @param origin The default origin to be appended to relative domain names. @return The new record @throws IOException The text format was invalid.
[ "Builds", "a", "new", "Record", "from", "its", "textual", "representation" ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Record.java#L491-L496
getsentry/sentry-java
sentry/src/main/java/io/sentry/DefaultSentryClientFactory.java
DefaultSentryClientFactory.createAsyncConnection
protected Connection createAsyncConnection(Dsn dsn, Connection connection) { int maxThreads = getAsyncThreads(dsn); int priority = getAsyncPriority(dsn); BlockingDeque<Runnable> queue; int queueSize = getAsyncQueueSize(dsn); if (queueSize == -1) { queue = new LinkedBlockingDeque<>(); } else { queue = new LinkedBlockingDeque<>(queueSize); } ExecutorService executorService = new ThreadPoolExecutor( maxThreads, maxThreads, 0L, TimeUnit.MILLISECONDS, queue, new DaemonThreadFactory(priority), getRejectedExecutionHandler(dsn)); boolean gracefulShutdown = getAsyncGracefulShutdownEnabled(dsn); long shutdownTimeout = getAsyncShutdownTimeout(dsn); return new AsyncConnection(connection, executorService, gracefulShutdown, shutdownTimeout); }
java
protected Connection createAsyncConnection(Dsn dsn, Connection connection) { int maxThreads = getAsyncThreads(dsn); int priority = getAsyncPriority(dsn); BlockingDeque<Runnable> queue; int queueSize = getAsyncQueueSize(dsn); if (queueSize == -1) { queue = new LinkedBlockingDeque<>(); } else { queue = new LinkedBlockingDeque<>(queueSize); } ExecutorService executorService = new ThreadPoolExecutor( maxThreads, maxThreads, 0L, TimeUnit.MILLISECONDS, queue, new DaemonThreadFactory(priority), getRejectedExecutionHandler(dsn)); boolean gracefulShutdown = getAsyncGracefulShutdownEnabled(dsn); long shutdownTimeout = getAsyncShutdownTimeout(dsn); return new AsyncConnection(connection, executorService, gracefulShutdown, shutdownTimeout); }
[ "protected", "Connection", "createAsyncConnection", "(", "Dsn", "dsn", ",", "Connection", "connection", ")", "{", "int", "maxThreads", "=", "getAsyncThreads", "(", "dsn", ")", ";", "int", "priority", "=", "getAsyncPriority", "(", "dsn", ")", ";", "BlockingDeque"...
Encapsulates an already existing connection in an {@link AsyncConnection} and get the async options from the Sentry DSN. @param dsn Data Source Name of the Sentry server. @param connection Connection to encapsulate in an {@link AsyncConnection}. @return the asynchronous connection.
[ "Encapsulates", "an", "already", "existing", "connection", "in", "an", "{", "@link", "AsyncConnection", "}", "and", "get", "the", "async", "options", "from", "the", "Sentry", "DSN", "." ]
train
https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/DefaultSentryClientFactory.java#L372-L393
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/S3SelectRecordCursor.java
S3SelectRecordCursor.updateSplitSchema
static Properties updateSplitSchema(Properties splitSchema, List<HiveColumnHandle> columns) { requireNonNull(splitSchema, "splitSchema is null"); requireNonNull(columns, "columns is null"); // clone split properties for update so as not to affect the original one Properties updatedSchema = new Properties(); updatedSchema.putAll(splitSchema); updatedSchema.setProperty(LIST_COLUMNS, buildColumns(columns)); updatedSchema.setProperty(LIST_COLUMN_TYPES, buildColumnTypes(columns)); ThriftTable thriftTable = parseThriftDdl(splitSchema.getProperty(SERIALIZATION_DDL)); updatedSchema.setProperty(SERIALIZATION_DDL, thriftTableToDdl(pruneThriftTable(thriftTable, columns))); return updatedSchema; }
java
static Properties updateSplitSchema(Properties splitSchema, List<HiveColumnHandle> columns) { requireNonNull(splitSchema, "splitSchema is null"); requireNonNull(columns, "columns is null"); // clone split properties for update so as not to affect the original one Properties updatedSchema = new Properties(); updatedSchema.putAll(splitSchema); updatedSchema.setProperty(LIST_COLUMNS, buildColumns(columns)); updatedSchema.setProperty(LIST_COLUMN_TYPES, buildColumnTypes(columns)); ThriftTable thriftTable = parseThriftDdl(splitSchema.getProperty(SERIALIZATION_DDL)); updatedSchema.setProperty(SERIALIZATION_DDL, thriftTableToDdl(pruneThriftTable(thriftTable, columns))); return updatedSchema; }
[ "static", "Properties", "updateSplitSchema", "(", "Properties", "splitSchema", ",", "List", "<", "HiveColumnHandle", ">", "columns", ")", "{", "requireNonNull", "(", "splitSchema", ",", "\"splitSchema is null\"", ")", ";", "requireNonNull", "(", "columns", ",", "\"c...
otherwise, Serde could not deserialize output from s3select to row data correctly
[ "otherwise", "Serde", "could", "not", "deserialize", "output", "from", "s3select", "to", "row", "data", "correctly" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/S3SelectRecordCursor.java#L62-L75
PawelAdamski/HttpClientMock
src/main/java/com/github/paweladamski/httpclientmock/HttpClientVerifyBuilder.java
HttpClientVerifyBuilder.withParameter
public HttpClientVerifyBuilder withParameter(String name, String value) { return withParameter(name, equalTo(value)); }
java
public HttpClientVerifyBuilder withParameter(String name, String value) { return withParameter(name, equalTo(value)); }
[ "public", "HttpClientVerifyBuilder", "withParameter", "(", "String", "name", ",", "String", "value", ")", "{", "return", "withParameter", "(", "name", ",", "equalTo", "(", "value", ")", ")", ";", "}" ]
Adds parameter condition. Parameter must be equal to provided value. @param name parameter name @param value expected parameter value @return verification builder
[ "Adds", "parameter", "condition", ".", "Parameter", "must", "be", "equal", "to", "provided", "value", "." ]
train
https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientVerifyBuilder.java#L73-L75
f2prateek/dart
henson/src/main/java/dart/henson/Bundler.java
Bundler.put
public Bundler put(String key, CharSequence value) { delegate.putCharSequence(key, value); return this; }
java
public Bundler put(String key, CharSequence value) { delegate.putCharSequence(key, value); return this; }
[ "public", "Bundler", "put", "(", "String", "key", ",", "CharSequence", "value", ")", "{", "delegate", ".", "putCharSequence", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a CharSequence value into the mapping of the underlying 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 CharSequence, or null @return this bundler instance to chain method calls
[ "Inserts", "a", "CharSequence", "value", "into", "the", "mapping", "of", "the", "underlying", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/f2prateek/dart/blob/7163b1b148e5141817975ae7dad99d58a8589aeb/henson/src/main/java/dart/henson/Bundler.java#L283-L286
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.removeOutVertexLabel
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedOutVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END); } }
java
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedOutVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END); } }
[ "void", "removeOutVertexLabel", "(", "VertexLabel", "lbl", ",", "boolean", "preserveData", ")", "{", "this", ".", "uncommittedRemovedOutVertexLabels", ".", "add", "(", "lbl", ")", ";", "if", "(", "!", "preserveData", ")", "{", "deleteColumn", "(", "lbl", ".", ...
remove a vertex label from the out collection @param lbl the vertex label @param preserveData should we keep the sql data?
[ "remove", "a", "vertex", "label", "from", "the", "out", "collection" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1232-L1237
Tirasa/ADSDDL
src/main/java/net/tirasa/adsddl/ntsd/ACL.java
ACL.parse
int parse(final IntBuffer buff, final int start) { int pos = start; // read for Dacl byte[] bytes = NumberFacility.getBytes(buff.get(pos)); revision = AclRevision.parseValue(bytes[0]); pos++; bytes = NumberFacility.getBytes(buff.get(pos)); final int aceCount = NumberFacility.getInt(bytes[1], bytes[0]); for (int i = 0; i < aceCount; i++) { pos++; final ACE ace = new ACE(); aces.add(ace); pos = ace.parse(buff, pos); } return pos; }
java
int parse(final IntBuffer buff, final int start) { int pos = start; // read for Dacl byte[] bytes = NumberFacility.getBytes(buff.get(pos)); revision = AclRevision.parseValue(bytes[0]); pos++; bytes = NumberFacility.getBytes(buff.get(pos)); final int aceCount = NumberFacility.getInt(bytes[1], bytes[0]); for (int i = 0; i < aceCount; i++) { pos++; final ACE ace = new ACE(); aces.add(ace); pos = ace.parse(buff, pos); } return pos; }
[ "int", "parse", "(", "final", "IntBuffer", "buff", ",", "final", "int", "start", ")", "{", "int", "pos", "=", "start", ";", "// read for Dacl", "byte", "[", "]", "bytes", "=", "NumberFacility", ".", "getBytes", "(", "buff", ".", "get", "(", "pos", ")",...
Load the ACL from the buffer returning the last ACL segment position into the buffer. @param buff source buffer. @param start start loading position. @return last loading position.
[ "Load", "the", "ACL", "from", "the", "buffer", "returning", "the", "last", "ACL", "segment", "position", "into", "the", "buffer", "." ]
train
https://github.com/Tirasa/ADSDDL/blob/16dad53e1222c7faa904c64394af94ba18f6d09c/src/main/java/net/tirasa/adsddl/ntsd/ACL.java#L90-L110
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsTargetFileDoesNotExist
public FessMessages addErrorsTargetFileDoesNotExist(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_target_file_does_not_exist, arg0)); return this; }
java
public FessMessages addErrorsTargetFileDoesNotExist(String property, String arg0) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_target_file_does_not_exist, arg0)); return this; }
[ "public", "FessMessages", "addErrorsTargetFileDoesNotExist", "(", "String", "property", ",", "String", "arg0", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_target_file_does_not_exist", ",...
Add the created action message for the key 'errors.target_file_does_not_exist' with parameters. <pre> message: {0} file does not exist. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "target_file_does_not_exist", "with", "parameters", ".", "<pre", ">", "message", ":", "{", "0", "}", "file", "does", "not", "exist", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1447-L1451
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaStringGenerator.java
SibRaStringGenerator.addField
void addField(final String name, final boolean value) throws IllegalStateException { addField(name, Boolean.toString(value)); }
java
void addField(final String name, final boolean value) throws IllegalStateException { addField(name, Boolean.toString(value)); }
[ "void", "addField", "(", "final", "String", "name", ",", "final", "boolean", "value", ")", "throws", "IllegalStateException", "{", "addField", "(", "name", ",", "Boolean", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Adds a string representation of the given boolean field. @param name the name of the field @param value the value of the field @throws IllegalStateException if the string representation has already been completed
[ "Adds", "a", "string", "representation", "of", "the", "given", "boolean", "field", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaStringGenerator.java#L97-L102
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java
AbstractRedisStorage.lockTrigger
protected boolean lockTrigger(TriggerKey triggerKey, T jedis){ return jedis.set(redisSchema.triggerLockKey(triggerKey), schedulerInstanceId, "NX", "PX", TRIGGER_LOCK_TIMEOUT).equals("OK"); }
java
protected boolean lockTrigger(TriggerKey triggerKey, T jedis){ return jedis.set(redisSchema.triggerLockKey(triggerKey), schedulerInstanceId, "NX", "PX", TRIGGER_LOCK_TIMEOUT).equals("OK"); }
[ "protected", "boolean", "lockTrigger", "(", "TriggerKey", "triggerKey", ",", "T", "jedis", ")", "{", "return", "jedis", ".", "set", "(", "redisSchema", ".", "triggerLockKey", "(", "triggerKey", ")", ",", "schedulerInstanceId", ",", "\"NX\"", ",", "\"PX\"", ","...
Lock the trigger with the given key to the current jobstore instance @param triggerKey the key of the desired trigger @param jedis a thread-safe Redis connection @return true if lock was acquired successfully; false otherwise
[ "Lock", "the", "trigger", "with", "the", "given", "key", "to", "the", "current", "jobstore", "instance" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L789-L791
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/impl/universal/UniversalIdStrQueueMessage.java
UniversalIdStrQueueMessage.newInstance
public static UniversalIdStrQueueMessage newInstance(String id, String content) { UniversalIdStrQueueMessage msg = newInstance(content); msg.setId(id); return msg; }
java
public static UniversalIdStrQueueMessage newInstance(String id, String content) { UniversalIdStrQueueMessage msg = newInstance(content); msg.setId(id); return msg; }
[ "public", "static", "UniversalIdStrQueueMessage", "newInstance", "(", "String", "id", ",", "String", "content", ")", "{", "UniversalIdStrQueueMessage", "msg", "=", "newInstance", "(", "content", ")", ";", "msg", ".", "setId", "(", "id", ")", ";", "return", "ms...
Create a new {@link UniversalIdStrQueueMessage} object with specified id and content. @param id @param content @return @since 0.7.0
[ "Create", "a", "new", "{", "@link", "UniversalIdStrQueueMessage", "}", "object", "with", "specified", "id", "and", "content", "." ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/impl/universal/UniversalIdStrQueueMessage.java#L54-L58
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/tools/Model.java
Model.setTrackStart
public void setTrackStart(final double TRACK_START) { // check values if (Double.compare(TRACK_START, trackStop) == 0) { throw new IllegalArgumentException("Track start value cannot equal track stop value"); } trackStart = TRACK_START; validate(); fireStateChanged(); }
java
public void setTrackStart(final double TRACK_START) { // check values if (Double.compare(TRACK_START, trackStop) == 0) { throw new IllegalArgumentException("Track start value cannot equal track stop value"); } trackStart = TRACK_START; validate(); fireStateChanged(); }
[ "public", "void", "setTrackStart", "(", "final", "double", "TRACK_START", ")", "{", "// check values", "if", "(", "Double", ".", "compare", "(", "TRACK_START", ",", "trackStop", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Trac...
Sets the track start value of the gauge to the given value @param TRACK_START
[ "Sets", "the", "track", "start", "value", "of", "the", "gauge", "to", "the", "given", "value" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/tools/Model.java#L1408-L1416
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java
SSOCookieHelperImpl.updateCookieCache
protected synchronized void updateCookieCache(ByteArray cookieBytes, String cookieByteString) { if (cookieByteStringCache.size() > MAX_COOKIE_STRING_ENTRIES) cookieByteStringCache.clear(); if (cookieByteString != null) cookieByteStringCache.put(cookieBytes, cookieByteString); }
java
protected synchronized void updateCookieCache(ByteArray cookieBytes, String cookieByteString) { if (cookieByteStringCache.size() > MAX_COOKIE_STRING_ENTRIES) cookieByteStringCache.clear(); if (cookieByteString != null) cookieByteStringCache.put(cookieBytes, cookieByteString); }
[ "protected", "synchronized", "void", "updateCookieCache", "(", "ByteArray", "cookieBytes", ",", "String", "cookieByteString", ")", "{", "if", "(", "cookieByteStringCache", ".", "size", "(", ")", ">", "MAX_COOKIE_STRING_ENTRIES", ")", "cookieByteStringCache", ".", "cle...
Perform some cookie cache maintenance. If the cookie cache has grown too large, clear it. Otherwise, store the cookieByteString into the cache based on the cookieBytes. @param cookieBytes @param cookieByteString
[ "Perform", "some", "cookie", "cache", "maintenance", ".", "If", "the", "cookie", "cache", "has", "grown", "too", "large", "clear", "it", ".", "Otherwise", "store", "the", "cookieByteString", "into", "the", "cache", "based", "on", "the", "cookieBytes", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/SSOCookieHelperImpl.java#L252-L257
facebookarchive/hadoop-20
src/examples/org/apache/hadoop/examples/dancing/DistributedPentomino.java
DistributedPentomino.createInputDirectory
private static void createInputDirectory(FileSystem fs, Path dir, Pentomino pent, int depth ) throws IOException { fs.mkdirs(dir); List<int[]> splits = pent.getSplits(depth); PrintStream file = new PrintStream(new BufferedOutputStream (fs.create(new Path(dir, "part1")), 64*1024)); for(int[] prefix: splits) { for(int i=0; i < prefix.length; ++i) { if (i != 0) { file.print(','); } file.print(prefix[i]); } file.print('\n'); } file.close(); }
java
private static void createInputDirectory(FileSystem fs, Path dir, Pentomino pent, int depth ) throws IOException { fs.mkdirs(dir); List<int[]> splits = pent.getSplits(depth); PrintStream file = new PrintStream(new BufferedOutputStream (fs.create(new Path(dir, "part1")), 64*1024)); for(int[] prefix: splits) { for(int i=0; i < prefix.length; ++i) { if (i != 0) { file.print(','); } file.print(prefix[i]); } file.print('\n'); } file.close(); }
[ "private", "static", "void", "createInputDirectory", "(", "FileSystem", "fs", ",", "Path", "dir", ",", "Pentomino", "pent", ",", "int", "depth", ")", "throws", "IOException", "{", "fs", ".", "mkdirs", "(", "dir", ")", ";", "List", "<", "int", "[", "]", ...
Create the input file with all of the possible combinations of the given depth. @param fs the filesystem to write into @param dir the directory to write the input file into @param pent the puzzle @param depth the depth to explore when generating prefixes
[ "Create", "the", "input", "file", "with", "all", "of", "the", "possible", "combinations", "of", "the", "given", "depth", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/dancing/DistributedPentomino.java#L126-L146