method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void runShellCommand(String cmd) { try { String logText = cmd; if (! cmd.startsWith("RegressionTester")) { realStdOut.println(logText); } Process process = runtime.exec(cmd); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), logEncoding)); String line = null; while ((line = reader.readLine()) != null) { thisStream.println(line); } // while readLine reader.close(); reader = new BufferedReader(new InputStreamReader(process.getErrorStream(), logEncoding)); while ((line = reader.readLine()) != null) { thisStream.println(line); } // while readLine reader.close(); } catch (Exception exc) { try { log.error(exc.getMessage(), exc); } catch (Exception exc2) { System.setOut(realStdOut); System.setErr(realStdErr); log.error(exc.getMessage(), exc2); } } // try } // runShellCommand
void function(String cmd) { try { String logText = cmd; if (! cmd.startsWith(STR)) { realStdOut.println(logText); } Process process = runtime.exec(cmd); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), logEncoding)); String line = null; while ((line = reader.readLine()) != null) { thisStream.println(line); } reader.close(); reader = new BufferedReader(new InputStreamReader(process.getErrorStream(), logEncoding)); while ((line = reader.readLine()) != null) { thisStream.println(line); } reader.close(); } catch (Exception exc) { try { log.error(exc.getMessage(), exc); } catch (Exception exc2) { System.setOut(realStdOut); System.setErr(realStdErr); log.error(exc.getMessage(), exc2); } } }
/** Runs a shell command * @param cmd command line to be executed */
Runs a shell command
runShellCommand
{ "repo_name": "gfis/dbat", "path": "src/main/java/org/teherba/common/RegressionTester.java", "license": "apache-2.0", "size": 38413 }
[ "java.io.BufferedReader", "java.io.InputStreamReader", "java.lang.Process" ]
import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.Process;
import java.io.*; import java.lang.*;
[ "java.io", "java.lang" ]
java.io; java.lang;
877,477
public IDataRecord getRecord(final int recordId) { return recordIndex.get(recordId); }
IDataRecord function(final int recordId) { return recordIndex.get(recordId); }
/** * Gets the record of the specified {@code recordId}. * * @param recordId * the identifier of the record to retrieve the values for * * @return the values of the record, {@code null} if the identifier is * invalid */
Gets the record of the specified recordId
getRecord
{ "repo_name": "pmeisen/dis-timeintervaldataanalyzer", "path": "src/net/meisen/dissertation/model/indexes/datarecord/TidaIndex.java", "license": "bsd-3-clause", "size": 16962 }
[ "net.meisen.dissertation.model.datasets.IDataRecord" ]
import net.meisen.dissertation.model.datasets.IDataRecord;
import net.meisen.dissertation.model.datasets.*;
[ "net.meisen.dissertation" ]
net.meisen.dissertation;
421,975
protected void addDefaultApps(ContextHandlerCollection parent, final String appDir, Configuration conf) throws IOException { // set up the context for "/logs/" if "hadoop.log.dir" property is defined // and it's enabled. String logDir = System.getProperty("hadoop.log.dir"); boolean logsEnabled = conf.getBoolean( CommonConfigurationKeys.HADOOP_HTTP_LOGS_ENABLED, CommonConfigurationKeys.HADOOP_HTTP_LOGS_ENABLED_DEFAULT); if (logDir != null && logsEnabled) { ServletContextHandler logContext = new ServletContextHandler(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( CommonConfigurationKeys.HADOOP_JETTY_LOGS_SERVE_ALIASES, CommonConfigurationKeys.DEFAULT_HADOOP_JETTY_LOGS_SERVE_ALIASES)) { @SuppressWarnings("unchecked") Map<String, String> params = logContext.getInitParams(); params.put("org.eclipse.jetty.servlet.Default.aliases", "true"); } logContext.setDisplayName("logs"); SessionHandler handler = new SessionHandler(); SessionManager sm = handler.getSessionManager(); if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager) sm; asm.setHttpOnly(true); asm.getSessionCookieConfig().setSecure(true); } logContext.setSessionHandler(handler); setContextAttributes(logContext, conf); addNoCacheFilter(logContext); defaultContexts.put(logContext, true); } // set up the context for "/static/*" ServletContextHandler staticContext = new ServletContextHandler(parent, "/static"); staticContext.setResourceBase(appDir + "/static"); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName("static"); @SuppressWarnings("unchecked") Map<String, String> params = staticContext.getInitParams(); params.put("org.eclipse.jetty.servlet.Default.dirAllowed", "false"); params.put("org.eclipse.jetty.servlet.Default.gzip", "true"); SessionHandler handler = new SessionHandler(); SessionManager sm = handler.getSessionManager(); if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager) sm; asm.setHttpOnly(true); asm.getSessionCookieConfig().setSecure(true); } staticContext.setSessionHandler(handler); setContextAttributes(staticContext, conf); defaultContexts.put(staticContext, true); }
void function(ContextHandlerCollection parent, final String appDir, Configuration conf) throws IOException { String logDir = System.getProperty(STR); boolean logsEnabled = conf.getBoolean( CommonConfigurationKeys.HADOOP_HTTP_LOGS_ENABLED, CommonConfigurationKeys.HADOOP_HTTP_LOGS_ENABLED_DEFAULT); if (logDir != null && logsEnabled) { ServletContextHandler logContext = new ServletContextHandler(parent, "/logs"); logContext.setResourceBase(logDir); logContext.addServlet(AdminAuthorizedServlet.class, "/*"); if (conf.getBoolean( CommonConfigurationKeys.HADOOP_JETTY_LOGS_SERVE_ALIASES, CommonConfigurationKeys.DEFAULT_HADOOP_JETTY_LOGS_SERVE_ALIASES)) { @SuppressWarnings(STR) Map<String, String> params = logContext.getInitParams(); params.put(STR, "true"); } logContext.setDisplayName("logs"); SessionHandler handler = new SessionHandler(); SessionManager sm = handler.getSessionManager(); if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager) sm; asm.setHttpOnly(true); asm.getSessionCookieConfig().setSecure(true); } logContext.setSessionHandler(handler); setContextAttributes(logContext, conf); addNoCacheFilter(logContext); defaultContexts.put(logContext, true); } ServletContextHandler staticContext = new ServletContextHandler(parent, STR); staticContext.setResourceBase(appDir + STR); staticContext.addServlet(DefaultServlet.class, "/*"); staticContext.setDisplayName(STR); @SuppressWarnings(STR) Map<String, String> params = staticContext.getInitParams(); params.put(STR, "false"); params.put(STR, "true"); SessionHandler handler = new SessionHandler(); SessionManager sm = handler.getSessionManager(); if (sm instanceof AbstractSessionManager) { AbstractSessionManager asm = (AbstractSessionManager) sm; asm.setHttpOnly(true); asm.getSessionCookieConfig().setSecure(true); } staticContext.setSessionHandler(handler); setContextAttributes(staticContext, conf); defaultContexts.put(staticContext, true); }
/** * Add default apps. * @param appDir The application directory * @throws IOException */
Add default apps
addDefaultApps
{ "repo_name": "bitmybytes/hadoop", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/http/HttpServer2.java", "license": "apache-2.0", "size": 57487 }
[ "java.io.IOException", "java.util.Map", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.CommonConfigurationKeys", "org.eclipse.jetty.server.SessionManager", "org.eclipse.jetty.server.handler.ContextHandlerCollection", "org.eclipse.jetty.server.session.AbstractSessionManager", "org.eclipse.jetty.server.session.SessionHandler", "org.eclipse.jetty.servlet.DefaultServlet", "org.eclipse.jetty.servlet.ServletContextHandler" ]
import java.io.IOException; import java.util.Map; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CommonConfigurationKeys; import org.eclipse.jetty.server.SessionManager; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.server.session.AbstractSessionManager; import org.eclipse.jetty.server.session.SessionHandler; import org.eclipse.jetty.servlet.DefaultServlet; import org.eclipse.jetty.servlet.ServletContextHandler;
import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.eclipse.jetty.server.*; import org.eclipse.jetty.server.handler.*; import org.eclipse.jetty.server.session.*; import org.eclipse.jetty.servlet.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.eclipse.jetty" ]
java.io; java.util; org.apache.hadoop; org.eclipse.jetty;
503,741
@Override public final Bitmap get(String key) { if (key == null) { throw new NullPointerException("key == null"); } synchronized (this) { return map.get(key); } }
final Bitmap function(String key) { if (key == null) { throw new NullPointerException(STR); } synchronized (this) { return map.get(key); } }
/** * Returns the Bitmap for {@code key} if it exists in the cache. If a Bitmap was returned, it is moved to the head * of the queue. This returns null if a Bitmap is not cached. */
Returns the Bitmap for key if it exists in the cache. If a Bitmap was returned, it is moved to the head of the queue. This returns null if a Bitmap is not cached
get
{ "repo_name": "imoblife/Android-Universal-Image-Loader", "path": "library/src/com/nostra13/universalimageloader/cache/memory/impl/LruMemoryCache.java", "license": "apache-2.0", "size": 3755 }
[ "android.graphics.Bitmap" ]
import android.graphics.Bitmap;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,204,647
boolean addTestElementOnce(TestElement child);
boolean addTestElementOnce(TestElement child);
/** * Add child test element only if it has not already been added. * <p> * Only for use by TestCompiler. * * @param child * @return true if the child was added */
Add child test element only if it has not already been added. Only for use by TestCompiler
addTestElementOnce
{ "repo_name": "llllewicki/jmeter-diff", "path": "src/core/org/apache/jmeter/threads/TestCompilerHelper.java", "license": "apache-2.0", "size": 1636 }
[ "org.apache.jmeter.testelement.TestElement" ]
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.*;
[ "org.apache.jmeter" ]
org.apache.jmeter;
1,232,570
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<Response<SearchServiceStatistics>> getServiceStatisticsWithResponseAsync( RequestOptions requestOptions, Context context) { final String accept = "application/json; odata.metadata=minimal"; UUID xMsClientRequestIdInternal = null; if (requestOptions != null) { xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.getServiceStatistics( this.getEndpoint(), xMsClientRequestId, this.getApiVersion(), accept, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<SearchServiceStatistics>> function( RequestOptions requestOptions, Context context) { final String accept = STR; UUID xMsClientRequestIdInternal = null; if (requestOptions != null) { xMsClientRequestIdInternal = requestOptions.getXMsClientRequestId(); } UUID xMsClientRequestId = xMsClientRequestIdInternal; return service.getServiceStatistics( this.getEndpoint(), xMsClientRequestId, this.getApiVersion(), accept, context); }
/** * Gets service level statistics for a search service. * * @param requestOptions Parameter group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws SearchErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return service level statistics for a search service along with {@link Response} on successful completion of * {@link Mono}. */
Gets service level statistics for a search service
getServiceStatisticsWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/search/azure-search-documents/src/main/java/com/azure/search/documents/indexes/implementation/SearchServiceClientImpl.java", "license": "mit", "size": 8962 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context", "com.azure.search.documents.indexes.implementation.models.RequestOptions", "com.azure.search.documents.indexes.models.SearchServiceStatistics" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.search.documents.indexes.implementation.models.RequestOptions; import com.azure.search.documents.indexes.models.SearchServiceStatistics;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.search.documents.indexes.implementation.models.*; import com.azure.search.documents.indexes.models.*;
[ "com.azure.core", "com.azure.search" ]
com.azure.core; com.azure.search;
2,591,116
public final void recover(final Sheet sheet) { if (rowIndex >= 0) { this.setRow(sheet.getRow(rowIndex)); this.setRowIndex(-1); } }
final void function(final Sheet sheet) { if (rowIndex >= 0) { this.setRow(sheet.getRow(rowIndex)); this.setRowIndex(-1); } }
/** * recover row by using it's address. * * @param sheet * sheet. */
recover row by using it's address
recover
{ "repo_name": "tiefaces/TieFaces", "path": "src/org/tiefaces/components/websheet/serializable/SerialRow.java", "license": "mit", "size": 3318 }
[ "org.apache.poi.ss.usermodel.Sheet" ]
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.*;
[ "org.apache.poi" ]
org.apache.poi;
1,186,147
@Uninterruptible public static int offsetAsSlot(Offset offset) { if (VM.VerifyAssertions) VM._assert((offset.toInt() & 3) == 0); return middleOfTable + (offset.toInt() >> LOG_BYTES_IN_INT); }
static int function(Offset offset) { if (VM.VerifyAssertions) VM._assert((offset.toInt() & 3) == 0); return middleOfTable + (offset.toInt() >> LOG_BYTES_IN_INT); }
/** * Conversion from JTOC offset to JTOC slot index. */
Conversion from JTOC offset to JTOC slot index
offsetAsSlot
{ "repo_name": "ut-osa/laminar", "path": "jikesrvm-3.0.0/rvm/src/org/jikesrvm/runtime/Statics.java", "license": "bsd-3-clause", "size": 20804 }
[ "org.vmmagic.unboxed.Offset" ]
import org.vmmagic.unboxed.Offset;
import org.vmmagic.unboxed.*;
[ "org.vmmagic.unboxed" ]
org.vmmagic.unboxed;
1,979,482
public Drawable getOrbIcon() { return mIconDrawable; }
Drawable function() { return mIconDrawable; }
/** * Returns the orb icon * @return the drawable used as the icon */
Returns the orb icon
getOrbIcon
{ "repo_name": "kingargyle/adt-leanback-support", "path": "leanback-v17/src/main/java/android/support/v17/leanback/widget/SearchOrbView.java", "license": "apache-2.0", "size": 12425 }
[ "android.graphics.drawable.Drawable" ]
import android.graphics.drawable.Drawable;
import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
1,548,099
@Nullable public Closeable getIOStream(String name) throws IOException { return null; } /** * Collect stat data to be combined by a subsequent reducer. * * @param output * @param name file name * @param execTime IO execution time * @param doIOReturnValue value returned by * {@link #doIO(Reporter, String,long)}
Closeable function(String name) throws IOException { return null; } /** * Collect stat data to be combined by a subsequent reducer. * * @param output * @param name file name * @param execTime IO execution time * @param doIOReturnValue value returned by * {@link #doIO(Reporter, String,long)}
/** * Create an input or output stream based on the specified file. Subclasses should override this * method to provide an actual stream. * * @param name file name * @return the stream */
Create an input or output stream based on the specified file. Subclasses should override this method to provide an actual stream
getIOStream
{ "repo_name": "wwjiang007/alluxio", "path": "tests/src/test/java/alluxio/client/hadoop/AbstractIOMapper.java", "license": "apache-2.0", "size": 4463 }
[ "java.io.Closeable", "java.io.IOException", "org.apache.hadoop.mapred.Reporter" ]
import java.io.Closeable; import java.io.IOException; import org.apache.hadoop.mapred.Reporter;
import java.io.*; import org.apache.hadoop.mapred.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
772,567
private Map<OWLClassExpression,Set<OWLClass>> getWitnessMap(Map<OWLClass,Set<OWLClassExpression>> map) { Map<OWLClassExpression,Set<OWLClass>> output = new HashMap<OWLClassExpression,Set<OWLClass>>(); for(OWLClass c : map.keySet()) { Set<OWLClassExpression> wits = map.get(c); for(OWLClassExpression wit : wits) { if(output.containsKey(wit)) { Set<OWLClass> classes = output.get(wit); classes.add(c); output.put(wit, classes); } else output.put(wit, new HashSet<OWLClass>(Collections.singleton(c))); } } return output; } class Classifier implements Runnable { private OWLOntology ont; private OWLReasoner reasoner; public Classifier(OWLOntology ont) { this.ont = ont; }
Map<OWLClassExpression,Set<OWLClass>> function(Map<OWLClass,Set<OWLClassExpression>> map) { Map<OWLClassExpression,Set<OWLClass>> output = new HashMap<OWLClassExpression,Set<OWLClass>>(); for(OWLClass c : map.keySet()) { Set<OWLClassExpression> wits = map.get(c); for(OWLClassExpression wit : wits) { if(output.containsKey(wit)) { Set<OWLClass> classes = output.get(wit); classes.add(c); output.put(wit, classes); } else output.put(wit, new HashSet<OWLClass>(Collections.singleton(c))); } } return output; } class Classifier implements Runnable { private OWLOntology ont; private OWLReasoner reasoner; public Classifier(OWLOntology ont) { this.ont = ont; }
/** * Given a map of concepts to witnesses, get a reversed map of witnesses to concepts whose change they witness * @param map Map of concepts to witnesses * @return Map of witnesses to concepts whose change they witness */
Given a map of concepts to witnesses, get a reversed map of witnesses to concepts whose change they witness
getWitnessMap
{ "repo_name": "rsgoncalves/ecco", "path": "src/main/java/uk/ac/manchester/cs/diff/test/Diff.java", "license": "lgpl-3.0", "size": 19501 }
[ "java.util.Collections", "java.util.HashMap", "java.util.HashSet", "java.util.Map", "java.util.Set", "org.semanticweb.owlapi.model.OWLClass", "org.semanticweb.owlapi.model.OWLClassExpression", "org.semanticweb.owlapi.model.OWLOntology", "org.semanticweb.owlapi.reasoner.OWLReasoner" ]
import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.semanticweb.owlapi.model.OWLClass; import org.semanticweb.owlapi.model.OWLClassExpression; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.reasoner.OWLReasoner;
import java.util.*; import org.semanticweb.owlapi.model.*; import org.semanticweb.owlapi.reasoner.*;
[ "java.util", "org.semanticweb.owlapi" ]
java.util; org.semanticweb.owlapi;
219,372
public Observable<Transaction> sendTransaction(String pin, String address, TransactionWizardData data);
Observable<Transaction> function(String pin, String address, TransactionWizardData data);
/** * Create a Transaction and mark the transaction to be ready to sync * * @param address The sender address * @param data The data about the transaction * @return Transaction or exception will be thrown */
Create a Transaction and mark the transaction to be ready to sync
sendTransaction
{ "repo_name": "sockeqwe/SecureBitcoinWallet", "path": "app/src/main/java/de/tum/in/securebitcoinwallet/model/WalletManager.java", "license": "apache-2.0", "size": 2257 }
[ "de.tum.in.securebitcoinwallet.transactions.create.TransactionWizardData" ]
import de.tum.in.securebitcoinwallet.transactions.create.TransactionWizardData;
import de.tum.in.securebitcoinwallet.transactions.create.*;
[ "de.tum.in" ]
de.tum.in;
24,137
@NotNull PsiCodeBlock createCodeBlockFromText(@NotNull @NonNls String text, PsiElement context) throws IncorrectOperationException;
PsiCodeBlock createCodeBlockFromText(@NotNull @NonNls String text, PsiElement context) throws IncorrectOperationException;
/** * Creates a Java code block from the specified text. * * @param text the text of the code block to create. * @param context the PSI element used as context for resolving references from the block. * @return the created code block instance. * @throws com.intellij.util.IncorrectOperationException if the text does not specify a valid code block. */
Creates a Java code block from the specified text
createCodeBlockFromText
{ "repo_name": "jexp/idea2", "path": "java/openapi/src/com/intellij/psi/PsiJavaParserFacade.java", "license": "apache-2.0", "size": 9079 }
[ "com.intellij.util.IncorrectOperationException", "org.jetbrains.annotations.NonNls", "org.jetbrains.annotations.NotNull" ]
import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull;
import com.intellij.util.*; import org.jetbrains.annotations.*;
[ "com.intellij.util", "org.jetbrains.annotations" ]
com.intellij.util; org.jetbrains.annotations;
2,566,848
return opt1.getKey().compareToIgnoreCase(opt2.getKey()); } } public static final int DEFAULT_WIDTH = 74; public static final int DEFAULT_LEFT_PAD = 1; public static final int DEFAULT_DESC_PAD = 3; public static final String DEFAULT_SYNTAX_PREFIX = "usage: "; public static final String DEFAULT_OPT_PREFIX = "-"; public static final String DEFAULT_LONG_OPT_PREFIX = "--"; public static final String DEFAULT_LONG_OPT_SEPARATOR = " "; public static final String DEFAULT_ARG_NAME = "arg"; @Deprecated public int defaultWidth = DEFAULT_WIDTH; @Deprecated public int defaultLeftPad = DEFAULT_LEFT_PAD; @Deprecated public int defaultDescPad = DEFAULT_DESC_PAD; @Deprecated public String defaultSyntaxPrefix = DEFAULT_SYNTAX_PREFIX; @Deprecated public String defaultNewLine = System.getProperty("line.separator"); @Deprecated public String defaultOptPrefix = DEFAULT_OPT_PREFIX; @Deprecated public String defaultLongOptPrefix = DEFAULT_LONG_OPT_PREFIX; @Deprecated public String defaultArgName = DEFAULT_ARG_NAME; protected Comparator<Option> optionComparator = new OptionComparator(); private String longOptSeparator = DEFAULT_LONG_OPT_SEPARATOR;
return opt1.getKey().compareToIgnoreCase(opt2.getKey()); } } public static final int DEFAULT_WIDTH = 74; public static final int DEFAULT_LEFT_PAD = 1; public static final int DEFAULT_DESC_PAD = 3; public static final String DEFAULT_SYNTAX_PREFIX = STR; public static final String DEFAULT_OPT_PREFIX = "-"; public static final String DEFAULT_LONG_OPT_PREFIX = "--"; public static final String DEFAULT_LONG_OPT_SEPARATOR = " "; public static final String DEFAULT_ARG_NAME = "arg"; public int defaultWidth = DEFAULT_WIDTH; public int defaultLeftPad = DEFAULT_LEFT_PAD; public int defaultDescPad = DEFAULT_DESC_PAD; public String defaultSyntaxPrefix = DEFAULT_SYNTAX_PREFIX; public String defaultNewLine = System.getProperty(STR); public String defaultOptPrefix = DEFAULT_OPT_PREFIX; public String defaultLongOptPrefix = DEFAULT_LONG_OPT_PREFIX; public String defaultArgName = DEFAULT_ARG_NAME; protected Comparator<Option> optionComparator = new OptionComparator(); private String longOptSeparator = DEFAULT_LONG_OPT_SEPARATOR;
/** * Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument * is less than, equal to, or greater than the second. * * @param opt1 The first Option to be compared. * @param opt2 The second Option to be compared. * @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than * the second. */
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
compare
{ "repo_name": "apache/commons-cli", "path": "src/main/java/org/apache/commons/cli/HelpFormatter.java", "license": "apache-2.0", "size": 32661 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
246,863
@SuppressWarnings("unused") protected void onReleaseResources(ArrayList<Conversation> conversations) { // For a simple List<> there is nothing to do. For something // like a Cursor, we would close it here. } public static class ConversationsContentObserver extends ContentObserver { private AsyncTaskLoader<ArrayList<Conversation>> conversationLoader; public ConversationsContentObserver(AsyncTaskLoader<ArrayList<Conversation>> conversationLoader) { super(null); this.conversationLoader = conversationLoader; final Uri uri = Uri.parse("content://mms-sms/conversations?simple=true"); conversationLoader.getContext().getContentResolver().registerContentObserver(uri, true, this); }
@SuppressWarnings(STR) void function(ArrayList<Conversation> conversations) { } public static class ConversationsContentObserver extends ContentObserver { private AsyncTaskLoader<ArrayList<Conversation>> conversationLoader; public ConversationsContentObserver(AsyncTaskLoader<ArrayList<Conversation>> conversationLoader) { super(null); this.conversationLoader = conversationLoader; final Uri uri = Uri.parse("content: conversationLoader.getContext().getContentResolver().registerContentObserver(uri, true, this); }
/** * Helper function to take care of releasing resources associated * with an actively loaded data set. */
Helper function to take care of releasing resources associated with an actively loaded data set
onReleaseResources
{ "repo_name": "Ioane5/GeoSMS-Release", "path": "app/src/main/java/com/steps/geosms/conversationsList/ConversationListLoader.java", "license": "apache-2.0", "size": 5959 }
[ "android.content.AsyncTaskLoader", "android.database.ContentObserver", "android.net.Uri", "com.steps.geosms.objects.Conversation", "java.util.ArrayList" ]
import android.content.AsyncTaskLoader; import android.database.ContentObserver; import android.net.Uri; import com.steps.geosms.objects.Conversation; import java.util.ArrayList;
import android.content.*; import android.database.*; import android.net.*; import com.steps.geosms.objects.*; import java.util.*;
[ "android.content", "android.database", "android.net", "com.steps.geosms", "java.util" ]
android.content; android.database; android.net; com.steps.geosms; java.util;
2,785,741
Map<String, String> listThreadsHoldingLock();
Map<String, String> listThreadsHoldingLock();
/** * Returns a map of the names of the objects being locked on and the names of the threads holding * the locks. */
Returns a map of the names of the objects being locked on and the names of the threads holding the locks
listThreadsHoldingLock
{ "repo_name": "pivotal-amurmann/geode", "path": "geode-core/src/main/java/org/apache/geode/management/LockServiceMXBean.java", "license": "apache-2.0", "size": 2688 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,265,604
public static Map<String, Long> getSegmentToLoadStartTimeMapping(LoadMetadataDetails[] details) { Map<String, Long> segmentToLoadStartTimeMap = new HashMap<>(details.length); for (LoadMetadataDetails oneLoad : details) { // valid segments will only have Success status if (SegmentStatus.SUCCESS.equals(oneLoad.getSegmentStatus()) || SegmentStatus.LOAD_PARTIAL_SUCCESS.equals(oneLoad.getSegmentStatus())) { segmentToLoadStartTimeMap.put(oneLoad.getLoadName(), oneLoad.getLoadStartTime()); } } return segmentToLoadStartTimeMap; }
static Map<String, Long> function(LoadMetadataDetails[] details) { Map<String, Long> segmentToLoadStartTimeMap = new HashMap<>(details.length); for (LoadMetadataDetails oneLoad : details) { if (SegmentStatus.SUCCESS.equals(oneLoad.getSegmentStatus()) SegmentStatus.LOAD_PARTIAL_SUCCESS.equals(oneLoad.getSegmentStatus())) { segmentToLoadStartTimeMap.put(oneLoad.getLoadName(), oneLoad.getLoadStartTime()); } } return segmentToLoadStartTimeMap; }
/** * This method will return the mapping of valid segments to segment laod start time * */
This method will return the mapping of valid segments to segment laod start time
getSegmentToLoadStartTimeMapping
{ "repo_name": "jackylk/incubator-carbondata", "path": "integration/spark/src/main/scala/org/apache/spark/sql/secondaryindex/load/CarbonInternalLoaderUtil.java", "license": "apache-2.0", "size": 14927 }
[ "java.util.HashMap", "java.util.Map", "org.apache.carbondata.core.statusmanager.LoadMetadataDetails", "org.apache.carbondata.core.statusmanager.SegmentStatus" ]
import java.util.HashMap; import java.util.Map; import org.apache.carbondata.core.statusmanager.LoadMetadataDetails; import org.apache.carbondata.core.statusmanager.SegmentStatus;
import java.util.*; import org.apache.carbondata.core.statusmanager.*;
[ "java.util", "org.apache.carbondata" ]
java.util; org.apache.carbondata;
2,259,668
public void setGroupCollection(final List<Group> groups) { m_groups = groups; }
void function(final List<Group> groups) { m_groups = groups; }
/** * Sets the value of '_groupList' by setting it to the given * Vector. No type checking is performed. * @deprecated * * @param groups the Vector to set. */
Sets the value of '_groupList' by setting it to the given Vector. No type checking is performed
setGroupCollection
{ "repo_name": "tharindum/opennms_dashboard", "path": "opennms-config/src/main/java/org/opennms/netmgt/config/datacollection/DatacollectionGroup.java", "license": "gpl-2.0", "size": 22786 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,293,604
public boolean setPlayerPermission(UserIdent ident, String permissionNode, boolean value) { return setPlayerPermissionProperty(ident, permissionNode, value ? PERMISSION_TRUE : PERMISSION_FALSE); }
boolean function(UserIdent ident, String permissionNode, boolean value) { return setPlayerPermissionProperty(ident, permissionNode, value ? PERMISSION_TRUE : PERMISSION_FALSE); }
/** * Set a player permission * * @param ident * @param permissionNode * @param value */
Set a player permission
setPlayerPermission
{ "repo_name": "aschmois/ForgeEssentialsMain", "path": "src/main/java/com/forgeessentials/api/permissions/Zone.java", "license": "epl-1.0", "size": 19258 }
[ "com.forgeessentials.api.UserIdent" ]
import com.forgeessentials.api.UserIdent;
import com.forgeessentials.api.*;
[ "com.forgeessentials.api" ]
com.forgeessentials.api;
1,387,662
private WALFactory setupWALAndReplication() throws IOException { // TODO Replication make assumptions here based on the default filesystem impl final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME); final String logName = DefaultWALProvider.getWALDirectoryName(this.serverName.toString()); Path logdir = new Path(rootDir, logName); if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir); if (this.fs.exists(logdir)) { throw new RegionServerRunningException("Region server has already " + "created directory at " + this.serverName.toString()); } // Instantiate replication manager if replication enabled. Pass it the // log directories. createNewReplicationInstance(conf, this, this.fs, logdir, oldLogDir); // listeners the wal factory will add to wals it creates. final List<WALActionsListener> listeners = new ArrayList<WALActionsListener>(); listeners.add(new MetricsWAL()); if (this.replicationSourceHandler != null && this.replicationSourceHandler.getWALActionsListener() != null) { // Replication handler is an implementation of WALActionsListener. listeners.add(this.replicationSourceHandler.getWALActionsListener()); } return new WALFactory(conf, listeners, serverName.toString()); }
WALFactory function() throws IOException { final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME); final String logName = DefaultWALProvider.getWALDirectoryName(this.serverName.toString()); Path logdir = new Path(rootDir, logName); if (LOG.isDebugEnabled()) LOG.debug(STR + logdir); if (this.fs.exists(logdir)) { throw new RegionServerRunningException(STR + STR + this.serverName.toString()); } createNewReplicationInstance(conf, this, this.fs, logdir, oldLogDir); final List<WALActionsListener> listeners = new ArrayList<WALActionsListener>(); listeners.add(new MetricsWAL()); if (this.replicationSourceHandler != null && this.replicationSourceHandler.getWALActionsListener() != null) { listeners.add(this.replicationSourceHandler.getWALActionsListener()); } return new WALFactory(conf, listeners, serverName.toString()); }
/** * Setup WAL log and replication if enabled. * Replication setup is done in here because it wants to be hooked up to WAL. * * @return A WAL instance. * @throws IOException */
Setup WAL log and replication if enabled. Replication setup is done in here because it wants to be hooked up to WAL
setupWALAndReplication
{ "repo_name": "grokcoder/pbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java", "license": "apache-2.0", "size": 131698 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.regionserver.wal.MetricsWAL", "org.apache.hadoop.hbase.regionserver.wal.WALActionsListener", "org.apache.hadoop.hbase.wal.DefaultWALProvider", "org.apache.hadoop.hbase.wal.WALFactory" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.regionserver.wal.MetricsWAL; import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; import org.apache.hadoop.hbase.wal.DefaultWALProvider; import org.apache.hadoop.hbase.wal.WALFactory;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.wal.*; import org.apache.hadoop.hbase.wal.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,525,420
If an XSL document exists in the server cache under an ID equal to the XSL ID of this object, that document is returned. (Deprecated) If the XSL string of this object is not null, a new document is created by parsing this string. (Deprecated) If the XSL URL of this object is not null, a new document is created by parsing the file at the location specified by the URL resolved against the server owning this object. Otherwise, the default stylesheet (Cacheable.DEFAULTSTYLESHEET) is returned. * @return the XSL source document. */ public jsx3.xml.CdfDocument getXSL() { String extension = "getXSL()."; try { java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class.getConstructor(Context.class, String.class); return ctor.newInstance(this, extension); } catch (Exception ex) { throw new IllegalArgumentException("Unsupported type: " + jsx3.xml.CdfDocument.class.getName()); } } /** * Returns the XSL source document of this object. The XSL document is determined by the following steps:
If an XSL document exists in the server cache under an ID equal to the XSL ID of this object, that document is returned. (Deprecated) If the XSL string of this object is not null, a new document is created by parsing this string. (Deprecated) If the XSL URL of this object is not null, a new document is created by parsing the file at the location specified by the URL resolved against the server owning this object. Otherwise, the default stylesheet (Cacheable.DEFAULTSTYLESHEET) is returned. * @return the XSL source document. */ jsx3.xml.CdfDocument function() { String extension = STR; try { java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class.getConstructor(Context.class, String.class); return ctor.newInstance(this, extension); } catch (Exception ex) { throw new IllegalArgumentException(STR + jsx3.xml.CdfDocument.class.getName()); } } /** * Returns the XSL source document of this object. The XSL document is determined by the following steps:
/** * Returns the XSL source document of this object. The XSL document is determined by the following steps: If an XSL document exists in the server cache under an ID equal to the XSL ID of this object, that document is returned. (Deprecated) If the XSL string of this object is not null, a new document is created by parsing this string. (Deprecated) If the XSL URL of this object is not null, a new document is created by parsing the file at the location specified by the URL resolved against the server owning this object. Otherwise, the default stylesheet (Cacheable.DEFAULTSTYLESHEET) is returned. * @return the XSL source document. */
Returns the XSL source document of this object. The XSL document is determined by the following steps:
getXSL
{ "repo_name": "burris/dwr", "path": "ui/gi/generated/java/jsx3/xml/Cacheable.java", "license": "apache-2.0", "size": 28290 }
[ "org.directwebremoting.io.Context" ]
import org.directwebremoting.io.Context;
import org.directwebremoting.io.*;
[ "org.directwebremoting.io" ]
org.directwebremoting.io;
1,655,379
public Properties getHttpEquivTags() { return httpEquivTags; }
Properties function() { return httpEquivTags; }
/** * Returns all collected values of the "http-equiv" meta tags. Property names * are tag names, property values are "content" values. */
Returns all collected values of the "http-equiv" meta tags. Property names are tag names, property values are "content" values
getHttpEquivTags
{ "repo_name": "wangxin39/yuqing", "path": "src/cn/ideasoft/yuqing/parse/HTMLMetaTags.java", "license": "bsd-3-clause", "size": 5207 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
805,519
boolean checkTable(String tableName) throws SQLException;
boolean checkTable(String tableName) throws SQLException;
/** * The method checks whether a table for the given name exists in the * database. * * @param tableName * is a <code>String</code> value of the table name to check * @return <code>true</code> <code>boolean</code> value if the table exist in * the database and <code>false</code> if the table was not found. * @throws SQLException * if there was a problem accessing database. */
The method checks whether a table for the given name exists in the database
checkTable
{ "repo_name": "DanielYao/tigase-server", "path": "src/main/java/tigase/db/DataRepository.java", "license": "agpl-3.0", "size": 8941 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,736,018
private Object invokeGlobalFunction(Environment env) throws EvalException, InterruptedException { Object funcValue = func.eval(env); ImmutableList.Builder<Object> posargs = new ImmutableList.Builder<>(); // We copy this into an ImmutableMap in the end, but we can't use an ImmutableMap.Builder, or // we'd still have to have a HashMap on the side for the sake of properly handling duplicates. Map<String, Object> kwargs = new HashMap<>(); BaseFunction function = checkCallable(funcValue, getLocation()); evalArguments(posargs, kwargs, env); return function.call(posargs.build(), ImmutableMap.<String, Object>copyOf(kwargs), this, env); }
Object function(Environment env) throws EvalException, InterruptedException { Object funcValue = func.eval(env); ImmutableList.Builder<Object> posargs = new ImmutableList.Builder<>(); Map<String, Object> kwargs = new HashMap<>(); BaseFunction function = checkCallable(funcValue, getLocation()); evalArguments(posargs, kwargs, env); return function.call(posargs.build(), ImmutableMap.<String, Object>copyOf(kwargs), this, env); }
/** * Invokes func() and returns the result. */
Invokes func() and returns the result
invokeGlobalFunction
{ "repo_name": "hhclam/bazel", "path": "src/main/java/com/google/devtools/build/lib/syntax/FuncallExpression.java", "license": "apache-2.0", "size": 31511 }
[ "com.google.common.collect.ImmutableList", "com.google.common.collect.ImmutableMap", "java.util.HashMap", "java.util.Map" ]
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import java.util.HashMap; import java.util.Map;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,497,155
// TODO - CHEAT SIMPLY BY WRITING OUT DATA AS XML TO PASS BACK. // We will incorporate all of the LAPDFText system directly into the // PDFBox low level code at some point. protected void writeString(String text, List<TextPosition> textPositions) throws IOException { TextPosition p1 = textPositions.get(0); TextPosition p2 = textPositions.get(textPositions.size()-1); // detects and removes 'control' characters. Matcher cntrlRegexMatcher = cntrlRegex.matcher(text); if( cntrlRegexMatcher.find() ) { text = text.replaceAll("\\p{Cntrl}", ""); if( text.length() == 0 ) return; } writeString("<wd i=\"" + (this.globalCount++) + "\" " + "x=\"" + Math.round(p1.getX()) + "\" " + "y=\"" + Math.round(p1.getY()) +"\" "+ "h=\"" + Math.round(p1.getHeight()) + "\" " + "w=\"" + Math.round(p2.getX() - p1.getX() + p2.getWidth()) + "\" " + "t=\"" + text + "\" " + "font=\"" + p1.getFont().getBaseFont() + "\"/>\n"); //writeString(text); }
void function(String text, List<TextPosition> textPositions) throws IOException { TextPosition p1 = textPositions.get(0); TextPosition p2 = textPositions.get(textPositions.size()-1); Matcher cntrlRegexMatcher = cntrlRegex.matcher(text); if( cntrlRegexMatcher.find() ) { text = text.replaceAll(STR, STR<wd i=\STR\" " + "x=\"STR\" " + "y=\"STR\" "+ "h=\"STR\" " + "w=\"STR\" " + "t=\"STR\" " + STRSTR\"/>\n"); }
/** * Write a Java string to the output stream. The default implementation will ignore the <code>textPositions</code> * and just calls {@link #writeString(String)}. * * @param text The text to write to the stream. * @param textPositions The TextPositions belonging to the text. * @throws IOException If there is an error when writing the text. */
Write a Java string to the output stream. The default implementation will ignore the <code>textPositions</code> and just calls <code>#writeString(String)</code>
writeString
{ "repo_name": "phatn/lapdftext", "path": "src/main/java/edu/isi/bmkeg/lapdf/extraction/LAPDFTextStripper.java", "license": "gpl-3.0", "size": 74251 }
[ "java.io.IOException", "java.util.List", "java.util.regex.Matcher", "org.apache.pdfbox.util.TextPosition" ]
import java.io.IOException; import java.util.List; import java.util.regex.Matcher; import org.apache.pdfbox.util.TextPosition;
import java.io.*; import java.util.*; import java.util.regex.*; import org.apache.pdfbox.util.*;
[ "java.io", "java.util", "org.apache.pdfbox" ]
java.io; java.util; org.apache.pdfbox;
1,492,837
@Override protected Bitmap doInBackground(String... params) { try { return BitmapFactory .decodeStream((InputStream) new URL(mGroundOverlayUrl).getContent()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
Bitmap function(String... params) { try { return BitmapFactory .decodeStream((InputStream) new URL(mGroundOverlayUrl).getContent()); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
/** * Downloads the ground overlay image in another thread * * @param params String varargs not used * @return Bitmap object downloaded */
Downloads the ground overlay image in another thread
doInBackground
{ "repo_name": "DEVPAR/wigle-wifi-wardriving", "path": "android-maps-utils/src/com/google/maps/android/kml/KmlRenderer.java", "license": "bsd-3-clause", "size": 35734 }
[ "android.graphics.Bitmap", "android.graphics.BitmapFactory", "java.io.IOException", "java.io.InputStream", "java.net.MalformedURLException" ]
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException;
import android.graphics.*; import java.io.*; import java.net.*;
[ "android.graphics", "java.io", "java.net" ]
android.graphics; java.io; java.net;
1,630,028
protected IgniteEx startGrid(String igniteInstanceName, UnaryOperator<IgniteConfiguration> cfgOp) throws Exception { return (IgniteEx)startGrid(igniteInstanceName, cfgOp, null); }
IgniteEx function(String igniteInstanceName, UnaryOperator<IgniteConfiguration> cfgOp) throws Exception { return (IgniteEx)startGrid(igniteInstanceName, cfgOp, null); }
/** * Starts new grid with given name. * * @param igniteInstanceName Ignite instance name. * @param cfgOp Configuration mutator. Can be used to avoid overcomplification of {@link #getConfiguration()}. * @return Started grid. * @throws Exception If anything failed. */
Starts new grid with given name
startGrid
{ "repo_name": "nizhikov/ignite", "path": "modules/core/src/test/java/org/apache/ignite/testframework/junits/GridAbstractTest.java", "license": "apache-2.0", "size": 99617 }
[ "java.util.function.UnaryOperator", "org.apache.ignite.configuration.IgniteConfiguration", "org.apache.ignite.internal.IgniteEx" ]
import java.util.function.UnaryOperator; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.IgniteEx;
import java.util.function.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,267,880
public void setPrefilteredMap(TextureCubeMap prefileteredEnvMap) { this.prefilteredEnvMap = prefileteredEnvMap; }
void function(TextureCubeMap prefileteredEnvMap) { this.prefilteredEnvMap = prefileteredEnvMap; }
/** * Sets the prefiltered environment map * @param prefileteredEnvMap the prefiltered environment map */
Sets the prefiltered environment map
setPrefilteredMap
{ "repo_name": "PlanetWaves/clockworkengine", "path": "trunk/jme3-core/src/main/java/com/jme3/light/LightProbe.java", "license": "apache-2.0", "size": 9836 }
[ "com.jme3.texture.TextureCubeMap" ]
import com.jme3.texture.TextureCubeMap;
import com.jme3.texture.*;
[ "com.jme3.texture" ]
com.jme3.texture;
1,821,648
private LinkedList<Diff> diff_compute(String text1, String text2, boolean checklines, long deadline) { LinkedList<Diff> diffs = new LinkedList<Diff>(); if (text1.length() == 0) { // Just add some text (speedup). diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } if (text2.length() == 0) { // Just delete some text (speedup). diffs.add(new Diff(Operation.DELETE, text1)); return diffs; } String longtext = text1.length() > text2.length() ? text1 : text2; String shorttext = text1.length() > text2.length() ? text2 : text1; int i = longtext.indexOf(shorttext); if (i != -1) { // Shorter text is inside the longer text (speedup). Operation op = (text1.length() > text2.length()) ? Operation.DELETE : Operation.INSERT; diffs.add(new Diff(op, longtext.substring(0, i))); diffs.add(new Diff(Operation.EQUAL, shorttext)); diffs.add(new Diff(op, longtext.substring(i + shorttext.length()))); return diffs; } if (shorttext.length() == 1) { // Single character string. // After the previous speedup, the character can't be an equality. diffs.add(new Diff(Operation.DELETE, text1)); diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } longtext = shorttext = null; // Garbage collect. // Check to see if the problem can be split in two. String[] hm = diff_halfMatch(text1, text2); if (hm != null) { // A half-match was found, sort out the return data. String text1_a = hm[0]; String text1_b = hm[1]; String text2_a = hm[2]; String text2_b = hm[3]; String mid_common = hm[4]; // Send both pairs off for separate processing. LinkedList<Diff> diffs_a = diff_main(text1_a, text2_a, checklines, deadline); LinkedList<Diff> diffs_b = diff_main(text1_b, text2_b, checklines, deadline); // Merge the results. diffs = diffs_a; diffs.add(new Diff(Operation.EQUAL, mid_common)); diffs.addAll(diffs_b); return diffs; } if (checklines && text1.length() > 100 && text2.length() > 100) { return diff_lineMode(text1, text2, deadline); } return diff_bisect(text1, text2, deadline); }
LinkedList<Diff> function(String text1, String text2, boolean checklines, long deadline) { LinkedList<Diff> diffs = new LinkedList<Diff>(); if (text1.length() == 0) { diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } if (text2.length() == 0) { diffs.add(new Diff(Operation.DELETE, text1)); return diffs; } String longtext = text1.length() > text2.length() ? text1 : text2; String shorttext = text1.length() > text2.length() ? text2 : text1; int i = longtext.indexOf(shorttext); if (i != -1) { Operation op = (text1.length() > text2.length()) ? Operation.DELETE : Operation.INSERT; diffs.add(new Diff(op, longtext.substring(0, i))); diffs.add(new Diff(Operation.EQUAL, shorttext)); diffs.add(new Diff(op, longtext.substring(i + shorttext.length()))); return diffs; } if (shorttext.length() == 1) { diffs.add(new Diff(Operation.DELETE, text1)); diffs.add(new Diff(Operation.INSERT, text2)); return diffs; } longtext = shorttext = null; String[] hm = diff_halfMatch(text1, text2); if (hm != null) { String text1_a = hm[0]; String text1_b = hm[1]; String text2_a = hm[2]; String text2_b = hm[3]; String mid_common = hm[4]; LinkedList<Diff> diffs_a = diff_main(text1_a, text2_a, checklines, deadline); LinkedList<Diff> diffs_b = diff_main(text1_b, text2_b, checklines, deadline); diffs = diffs_a; diffs.add(new Diff(Operation.EQUAL, mid_common)); diffs.addAll(diffs_b); return diffs; } if (checklines && text1.length() > 100 && text2.length() > 100) { return diff_lineMode(text1, text2, deadline); } return diff_bisect(text1, text2, deadline); }
/** * Find the differences between two texts. Assumes that the texts do not * have any common prefix or suffix. * @param text1 Old string to be diffed. * @param text2 New string to be diffed. * @param checklines Speedup flag. If false, then don't run a * line-level diff first to identify the changed areas. * If true, then run a faster slightly less optimal diff. * @param deadline Time when the diff should be complete by. * @return Linked List of Diff objects. */
Find the differences between two texts. Assumes that the texts do not have any common prefix or suffix
diff_compute
{ "repo_name": "SeekingFor/jfniki", "path": "alien/src/name/fraser/neil/plaintext/diff_match_patch.java", "license": "gpl-2.0", "size": 88387 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
930,038
public static void initialize(final Application application, final Activity mainActivity, final String apiKey, final String secret, final long backgroundInterval) { BreinifyManager.getInstance().initialize(application, mainActivity, apiKey, secret, backgroundInterval); }
static void function(final Application application, final Activity mainActivity, final String apiKey, final String secret, final long backgroundInterval) { BreinifyManager.getInstance().initialize(application, mainActivity, apiKey, secret, backgroundInterval); }
/** * Initializes the instance * * @param application Application contains the application context * @param mainActivity Activity contains the main activity * @param apiKey String contains the apiKey * @param secret String contains the secret * @param backgroundInterval long sets a background interval */
Initializes the instance
initialize
{ "repo_name": "Breinify/brein-api-library-android", "path": "brein-api-library-android/src/main/java/com/brein/api/Breinify.java", "license": "mit", "size": 15661 }
[ "android.app.Activity", "android.app.Application" ]
import android.app.Activity; import android.app.Application;
import android.app.*;
[ "android.app" ]
android.app;
5,226
public static String qualifyTable(TableMetadata<?> tableMetadata, Character identifierQuotation, Character schemaSeparator) { final String name = identifierQuotation + tableMetadata.getName() + identifierQuotation; return tableMetadata.getSchema() == null || tableMetadata.getSchema().isEmpty() ? name : identifierQuotation + tableMetadata.getSchema() + identifierQuotation + schemaSeparator + name; }
static String function(TableMetadata<?> tableMetadata, Character identifierQuotation, Character schemaSeparator) { final String name = identifierQuotation + tableMetadata.getName() + identifierQuotation; return tableMetadata.getSchema() == null tableMetadata.getSchema().isEmpty() ? name : identifierQuotation + tableMetadata.getSchema() + identifierQuotation + schemaSeparator + name; }
/** * Creates the qualified name of the table * @param tableMetadata table metadata * @param identifierQuotation the quotation around each identifier * @param schemaSeparator the schema separator used by the dialect * @return the qualified name */
Creates the qualified name of the table
qualifyTable
{ "repo_name": "agileapes/dragonfly", "path": "dragonfly-core/src/main/java/com/mmnaseri/dragonfly/tools/DatabaseUtils.java", "license": "mit", "size": 7758 }
[ "com.mmnaseri.dragonfly.metadata.TableMetadata" ]
import com.mmnaseri.dragonfly.metadata.TableMetadata;
import com.mmnaseri.dragonfly.metadata.*;
[ "com.mmnaseri.dragonfly" ]
com.mmnaseri.dragonfly;
2,016,721
public static Criterion endedBy(String begin, String end, Time value) throws UnsupportedTimeException { return filter(new EndedByRestriction(), begin, end, value); }
static Criterion function(String begin, String end, Time value) throws UnsupportedTimeException { return filter(new EndedByRestriction(), begin, end, value); }
/** * Creates a temporal restriction for the specified time and property. * * @param begin * the begin property name * @param end * the end property name * @param value * the value * * @return the <tt>Criterion</tt> * * @see EndedByRestriction * @throws UnsupportedTimeException * if the value and property combination is not applicable for * this restriction */
Creates a temporal restriction for the specified time and property
endedBy
{ "repo_name": "sauloperez/sos", "path": "src/hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/TemporalRestrictions.java", "license": "apache-2.0", "size": 37464 }
[ "org.hibernate.criterion.Criterion", "org.n52.sos.ds.hibernate.util.TemporalRestriction", "org.n52.sos.exception.ows.concrete.UnsupportedTimeException", "org.n52.sos.ogc.gml.time.Time" ]
import org.hibernate.criterion.Criterion; import org.n52.sos.ds.hibernate.util.TemporalRestriction; import org.n52.sos.exception.ows.concrete.UnsupportedTimeException; import org.n52.sos.ogc.gml.time.Time;
import org.hibernate.criterion.*; import org.n52.sos.ds.hibernate.util.*; import org.n52.sos.exception.ows.concrete.*; import org.n52.sos.ogc.gml.time.*;
[ "org.hibernate.criterion", "org.n52.sos" ]
org.hibernate.criterion; org.n52.sos;
127,025
public final void setMerger(final IAttributeMerger merger) { Validate.notNull(merger, "The IAttributeMerger cannot be null"); this.attrMerger = merger; }
final void function(final IAttributeMerger merger) { Validate.notNull(merger, STR); this.attrMerger = merger; }
/** * Set the strategy whereby we accumulate attributes from the results of * polling our delegates. * * @param merger The attrMerger to set. * @throws IllegalArgumentException If merger is <code>null</code>. */
Set the strategy whereby we accumulate attributes from the results of polling our delegates
setMerger
{ "repo_name": "Jasig/person-directory", "path": "person-directory-impl/src/main/java/org/apereo/services/persondir/support/AbstractAggregatingDefaultQueryPersonAttributeDao.java", "license": "apache-2.0", "size": 16853 }
[ "org.apache.commons.lang3.Validate", "org.apereo.services.persondir.support.merger.IAttributeMerger" ]
import org.apache.commons.lang3.Validate; import org.apereo.services.persondir.support.merger.IAttributeMerger;
import org.apache.commons.lang3.*; import org.apereo.services.persondir.support.merger.*;
[ "org.apache.commons", "org.apereo.services" ]
org.apache.commons; org.apereo.services;
1,557,556
public void selectNone(View view) { mSFLAdapter.deselectAll(); }
void function(View view) { mSFLAdapter.deselectAll(); }
/** * Deselect all the items in the list * * @param view */
Deselect all the items in the list
selectNone
{ "repo_name": "sanyaade-g2g-repos/posit-mobile.haiti", "path": "src/org/hfoss/posit/android/bluetooth/BluetoothExplicitSync.java", "license": "lgpl-2.1", "size": 13537 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
438,822
private Iterator<Option> getOptions() { synchronized (options) { return Collections.unmodifiableList(new ArrayList<Option>(options)).iterator(); } }
Iterator<Option> function() { synchronized (options) { return Collections.unmodifiableList(new ArrayList<Option>(options)).iterator(); } }
/** * Returns an Iterator for the available options that the user has in order to answer * the question. * * @return Iterator for the available options. */
Returns an Iterator for the available options that the user has in order to answer the question
getOptions
{ "repo_name": "elphinkuo/Androidpn", "path": "androidpn-code/androidpn-server/tags/androidpn-server-0.4.0/server/src/main/java/org/jivesoftware/openfire/forms/spi/XFormFieldImpl.java", "license": "gpl-3.0", "size": 7235 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.Iterator" ]
import java.util.ArrayList; import java.util.Collections; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,472,329
protected void printHost(Host host) { if (shortOnly) { print(FMT_SHORT, host.id(), host.mac(), host.locations(), host.vlan(), host.ipAddresses()); } else { print(FMT, host.id(), host.mac(), host.locations(), host.vlan(), host.ipAddresses(), annotations(host.annotations()), host.innerVlan(), host.tpid().toString(), host.providerId().scheme(), host.providerId().id(), host.configured()); } }
void function(Host host) { if (shortOnly) { print(FMT_SHORT, host.id(), host.mac(), host.locations(), host.vlan(), host.ipAddresses()); } else { print(FMT, host.id(), host.mac(), host.locations(), host.vlan(), host.ipAddresses(), annotations(host.annotations()), host.innerVlan(), host.tpid().toString(), host.providerId().scheme(), host.providerId().id(), host.configured()); } }
/** * Prints information about a host. * * @param host end-station host */
Prints information about a host
printHost
{ "repo_name": "kuujo/onos", "path": "cli/src/main/java/org/onosproject/cli/net/HostsListCommand.java", "license": "apache-2.0", "size": 3605 }
[ "org.onosproject.net.Host" ]
import org.onosproject.net.Host;
import org.onosproject.net.*;
[ "org.onosproject.net" ]
org.onosproject.net;
1,711,923
public void setAppearanceValue(String apValue) throws IOException { // MulitLine check and set if ( parent.isMultiline() && apValue.indexOf('\n') != -1 ) { apValue = convertToMultiLine( apValue ); } value = apValue; Iterator<COSObjectable> widgetIter = widgets.iterator(); while( widgetIter.hasNext() ) { COSObjectable next = widgetIter.next(); PDField field = null; PDAnnotationWidget widget = null; if( next instanceof PDField ) { field = (PDField)next; widget = field.getWidget(); } else { widget = (PDAnnotationWidget)next; } PDFormFieldAdditionalActions actions = null; if( field != null ) { actions = field.getActions(); } if( actions != null && actions.getF() != null && widget.getDictionary().getDictionaryObject( COSName.AP ) ==null) { //do nothing because the field will be formatted by acrobat //when it is opened. See FreedomExpressions.pdf for an example of this. } else { PDAppearanceDictionary appearance = widget.getAppearance(); if( appearance == null ) { appearance = new PDAppearanceDictionary(); widget.setAppearance( appearance ); } Map normalAppearance = appearance.getNormalAppearance(); PDAppearanceStream appearanceStream = (PDAppearanceStream)normalAppearance.get( "default" ); if( appearanceStream == null ) { COSStream cosStream = acroForm.getDocument().getDocument().createCOSStream(); appearanceStream = new PDAppearanceStream( cosStream ); appearanceStream.setBoundingBox( widget.getRectangle().createRetranslatedRectangle() ); appearance.setNormalAppearance( appearanceStream ); } List tokens = getStreamTokens( appearanceStream ); List daTokens = getStreamTokens( getDefaultAppearance() ); PDFont pdFont = getFontAndUpdateResources( tokens, appearanceStream ); if (!containsMarkedContent( tokens )) { ByteArrayOutputStream output = new ByteArrayOutputStream(); //BJL 9/25/2004 Must prepend existing stream //because it might have operators to draw things like //rectangles and such ContentStreamWriter writer = new ContentStreamWriter( output ); writer.writeTokens( tokens ); output.write( " /Tx BMC\n".getBytes("ISO-8859-1") ); insertGeneratedAppearance( widget, output, pdFont, tokens, appearanceStream ); output.write( " EMC".getBytes("ISO-8859-1") ); writeToStream( output.toByteArray(), appearanceStream ); } else { if( tokens != null ) { if( daTokens != null ) { int bmcIndex = tokens.indexOf( PDFOperator.getOperator( "BMC" )); int emcIndex = tokens.indexOf( PDFOperator.getOperator( "EMC" )); if( bmcIndex != -1 && emcIndex != -1 && emcIndex == bmcIndex+1 ) { //if the EMC immediately follows the BMC index then should //insert the daTokens inbetween the two markers. tokens.addAll( emcIndex, daTokens ); } } ByteArrayOutputStream output = new ByteArrayOutputStream(); ContentStreamWriter writer = new ContentStreamWriter( output ); float fontSize = calculateFontSize( pdFont, appearanceStream.getBoundingBox(), tokens, null ); boolean foundString = false; for( int i=0; i<tokens.size(); i++ ) { if( tokens.get( i ) instanceof COSString ) { foundString = true; COSString drawnString =((COSString)tokens.get(i)); drawnString.reset(); drawnString.append( apValue.getBytes("ISO-8859-1") ); } } int setFontIndex = tokens.indexOf( PDFOperator.getOperator( "Tf" )); tokens.set( setFontIndex-1, new COSFloat( fontSize ) ); if( foundString ) { writer.writeTokens( tokens ); } else { int bmcIndex = tokens.indexOf( PDFOperator.getOperator( "BMC" ) ); int emcIndex = tokens.indexOf( PDFOperator.getOperator( "EMC" ) ); if( bmcIndex != -1 ) { writer.writeTokens( tokens, 0, bmcIndex+1 ); } else { writer.writeTokens( tokens ); } output.write( "\n".getBytes("ISO-8859-1") ); insertGeneratedAppearance( widget, output, pdFont, tokens, appearanceStream ); if( emcIndex != -1 ) { writer.writeTokens( tokens, emcIndex, tokens.size() ); } } writeToStream( output.toByteArray(), appearanceStream ); } else { //hmm? } } } } }
void function(String apValue) throws IOException { if ( parent.isMultiline() && apValue.indexOf('\n') != -1 ) { apValue = convertToMultiLine( apValue ); } value = apValue; Iterator<COSObjectable> widgetIter = widgets.iterator(); while( widgetIter.hasNext() ) { COSObjectable next = widgetIter.next(); PDField field = null; PDAnnotationWidget widget = null; if( next instanceof PDField ) { field = (PDField)next; widget = field.getWidget(); } else { widget = (PDAnnotationWidget)next; } PDFormFieldAdditionalActions actions = null; if( field != null ) { actions = field.getActions(); } if( actions != null && actions.getF() != null && widget.getDictionary().getDictionaryObject( COSName.AP ) ==null) { } else { PDAppearanceDictionary appearance = widget.getAppearance(); if( appearance == null ) { appearance = new PDAppearanceDictionary(); widget.setAppearance( appearance ); } Map normalAppearance = appearance.getNormalAppearance(); PDAppearanceStream appearanceStream = (PDAppearanceStream)normalAppearance.get( STR ); if( appearanceStream == null ) { COSStream cosStream = acroForm.getDocument().getDocument().createCOSStream(); appearanceStream = new PDAppearanceStream( cosStream ); appearanceStream.setBoundingBox( widget.getRectangle().createRetranslatedRectangle() ); appearance.setNormalAppearance( appearanceStream ); } List tokens = getStreamTokens( appearanceStream ); List daTokens = getStreamTokens( getDefaultAppearance() ); PDFont pdFont = getFontAndUpdateResources( tokens, appearanceStream ); if (!containsMarkedContent( tokens )) { ByteArrayOutputStream output = new ByteArrayOutputStream(); ContentStreamWriter writer = new ContentStreamWriter( output ); writer.writeTokens( tokens ); output.write( STR.getBytes(STR) ); insertGeneratedAppearance( widget, output, pdFont, tokens, appearanceStream ); output.write( STR.getBytes(STR) ); writeToStream( output.toByteArray(), appearanceStream ); } else { if( tokens != null ) { if( daTokens != null ) { int bmcIndex = tokens.indexOf( PDFOperator.getOperator( "BMC" )); int emcIndex = tokens.indexOf( PDFOperator.getOperator( "EMC" )); if( bmcIndex != -1 && emcIndex != -1 && emcIndex == bmcIndex+1 ) { tokens.addAll( emcIndex, daTokens ); } } ByteArrayOutputStream output = new ByteArrayOutputStream(); ContentStreamWriter writer = new ContentStreamWriter( output ); float fontSize = calculateFontSize( pdFont, appearanceStream.getBoundingBox(), tokens, null ); boolean foundString = false; for( int i=0; i<tokens.size(); i++ ) { if( tokens.get( i ) instanceof COSString ) { foundString = true; COSString drawnString =((COSString)tokens.get(i)); drawnString.reset(); drawnString.append( apValue.getBytes(STR) ); } } int setFontIndex = tokens.indexOf( PDFOperator.getOperator( "Tf" )); tokens.set( setFontIndex-1, new COSFloat( fontSize ) ); if( foundString ) { writer.writeTokens( tokens ); } else { int bmcIndex = tokens.indexOf( PDFOperator.getOperator( "BMC" ) ); int emcIndex = tokens.indexOf( PDFOperator.getOperator( "EMC" ) ); if( bmcIndex != -1 ) { writer.writeTokens( tokens, 0, bmcIndex+1 ); } else { writer.writeTokens( tokens ); } output.write( "\n".getBytes(STR) ); insertGeneratedAppearance( widget, output, pdFont, tokens, appearanceStream ); if( emcIndex != -1 ) { writer.writeTokens( tokens, emcIndex, tokens.size() ); } } writeToStream( output.toByteArray(), appearanceStream ); } else { } } } } }
/** * This is the public method for setting the appearance stream. * * @param apValue the String value which the apperance shoud represent * * @throws IOException If there is an error creating the stream. */
This is the public method for setting the appearance stream
setAppearanceValue
{ "repo_name": "myrridin/qz-print", "path": "pdfbox_1.8.4_qz/src/org/apache/pdfbox/pdmodel/interactive/form/PDAppearance.java", "license": "lgpl-2.1", "size": 24576 }
[ "java.io.ByteArrayOutputStream", "java.io.IOException", "java.util.Iterator", "java.util.List", "java.util.Map", "org.apache.pdfbox.cos.COSFloat", "org.apache.pdfbox.cos.COSName", "org.apache.pdfbox.cos.COSStream", "org.apache.pdfbox.cos.COSString", "org.apache.pdfbox.pdfwriter.ContentStreamWriter", "org.apache.pdfbox.pdmodel.common.COSObjectable", "org.apache.pdfbox.pdmodel.font.PDFont", "org.apache.pdfbox.pdmodel.interactive.action.PDFormFieldAdditionalActions", "org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget", "org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary", "org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream", "org.apache.pdfbox.util.PDFOperator" ]
import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.pdfbox.cos.COSFloat; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.cos.COSString; import org.apache.pdfbox.pdfwriter.ContentStreamWriter; import org.apache.pdfbox.pdmodel.common.COSObjectable; import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.interactive.action.PDFormFieldAdditionalActions; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream; import org.apache.pdfbox.util.PDFOperator;
import java.io.*; import java.util.*; import org.apache.pdfbox.cos.*; import org.apache.pdfbox.pdfwriter.*; import org.apache.pdfbox.pdmodel.common.*; import org.apache.pdfbox.pdmodel.font.*; import org.apache.pdfbox.pdmodel.interactive.action.*; import org.apache.pdfbox.pdmodel.interactive.annotation.*; import org.apache.pdfbox.util.*;
[ "java.io", "java.util", "org.apache.pdfbox" ]
java.io; java.util; org.apache.pdfbox;
2,688,374
public void setCiteKeyPattern(AbstractBibtexKeyPattern bibtexKeyPattern) { Objects.requireNonNull(bibtexKeyPattern); List<String> defaultValue = bibtexKeyPattern.getDefaultValue(); Map<String, List<String>> nonDefaultPatterns = bibtexKeyPattern.getPatterns(); setCiteKeyPattern(defaultValue, nonDefaultPatterns); }
void function(AbstractBibtexKeyPattern bibtexKeyPattern) { Objects.requireNonNull(bibtexKeyPattern); List<String> defaultValue = bibtexKeyPattern.getDefaultValue(); Map<String, List<String>> nonDefaultPatterns = bibtexKeyPattern.getPatterns(); setCiteKeyPattern(defaultValue, nonDefaultPatterns); }
/** * Updates the stored key patterns to the given key patterns. * * @param bibtexKeyPattern the key patterns to update to. <br /> * A reference to this object is stored internally and is returned at getCiteKeyPattern(); */
Updates the stored key patterns to the given key patterns
setCiteKeyPattern
{ "repo_name": "mredaelli/jabref", "path": "src/main/java/net/sf/jabref/model/metadata/MetaData.java", "license": "mit", "size": 9680 }
[ "java.util.List", "java.util.Map", "java.util.Objects", "net.sf.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern" ]
import java.util.List; import java.util.Map; import java.util.Objects; import net.sf.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern;
import java.util.*; import net.sf.jabref.model.bibtexkeypattern.*;
[ "java.util", "net.sf.jabref" ]
java.util; net.sf.jabref;
2,606,830
private void doOpenWave(int entry) { if (isConnected()) { List<IndexEntry> index = IndexWave.getIndexEntries(backend.getIndexWave()); if (entry >= index.size()) { out.print("Error: entry is out of range, "); if (index.isEmpty()) { out.println("there are no available waves (try \"/new\")"); } else { out.println("expecting [0.." + (index.size() - 1) + "] (for example, \"/open 0\")"); } } else { setOpenWave(backend.getWave(index.get(entry).getWaveId())); } } else { errorNotConnected(); } }
void function(int entry) { if (isConnected()) { List<IndexEntry> index = IndexWave.getIndexEntries(backend.getIndexWave()); if (entry >= index.size()) { out.print(STR); if (index.isEmpty()) { out.println(STR/new\")"); } else { out.println(STR + (index.size() - 1) + STR/open 0\")"); } } else { setOpenWave(backend.getWave(index.get(entry).getWaveId())); } } else { errorNotConnected(); } }
/** * Open a wave with a given entry (index in the inbox). * * @param entry into the inbox */
Open a wave with a given entry (index in the inbox)
doOpenWave
{ "repo_name": "jkatzer/jkatzer-wave", "path": "src/org/waveprotocol/wave/examples/client/console/ConsoleClient.java", "license": "apache-2.0", "size": 28156 }
[ "java.util.List", "org.waveprotocol.wave.examples.client.common.IndexEntry", "org.waveprotocol.wave.examples.fedone.frontend.IndexWave" ]
import java.util.List; import org.waveprotocol.wave.examples.client.common.IndexEntry; import org.waveprotocol.wave.examples.fedone.frontend.IndexWave;
import java.util.*; import org.waveprotocol.wave.examples.client.common.*; import org.waveprotocol.wave.examples.fedone.frontend.*;
[ "java.util", "org.waveprotocol.wave" ]
java.util; org.waveprotocol.wave;
2,492,463
Set<IpLink> getIpDeviceIngressLinks(DeviceId deviceId);
Set<IpLink> getIpDeviceIngressLinks(DeviceId deviceId);
/** * Returns all ip links ingressing from the specified device. * * @param deviceId device identifier * @return set of ip device links */
Returns all ip links ingressing from the specified device
getIpDeviceIngressLinks
{ "repo_name": "sonu283304/onos", "path": "apps/iptopology-api/src/main/java/org/onosproject/iptopology/api/link/IpLinkStore.java", "license": "apache-2.0", "size": 3684 }
[ "java.util.Set", "org.onosproject.iptopology.api.IpLink", "org.onosproject.net.DeviceId" ]
import java.util.Set; import org.onosproject.iptopology.api.IpLink; import org.onosproject.net.DeviceId;
import java.util.*; import org.onosproject.iptopology.api.*; import org.onosproject.net.*;
[ "java.util", "org.onosproject.iptopology", "org.onosproject.net" ]
java.util; org.onosproject.iptopology; org.onosproject.net;
929,106
protected int getIntParameter(HttpServletRequest request, String name, int defValue) { String value = getStringParameter(request, name); if (value == null) { return defValue; } try { return Integer.parseInt(value); } catch (NumberFormatException nfe) { return defValue; } }
int function(HttpServletRequest request, String name, int defValue) { String value = getStringParameter(request, name); if (value == null) { return defValue; } try { return Integer.parseInt(value); } catch (NumberFormatException nfe) { return defValue; } }
/** * Gets an integer parameter. If it is not set or invalid (not a * number), it returns the given default value. */
Gets an integer parameter. If it is not set or invalid (not a number), it returns the given default value
getIntParameter
{ "repo_name": "fmui/ApacheChemistryInAction", "path": "the-blend/src/main/java/com/manning/cmis/theblend/servlets/AbstractTheBlendServlet.java", "license": "apache-2.0", "size": 9450 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,283,127
public final Column<Integer> getIdColumn() { return col_id; }
final Column<Integer> function() { return col_id; }
/** * Retrieves the <code>Id</code> <code>Column</code> for this * <code>setting</code> <code>Table</code>. * * see org.melati.poem.prepro.FieldDef#generateColAccessor * @return the id <code>Column</code> */
Retrieves the <code>Id</code> <code>Column</code> for this <code>setting</code> <code>Table</code>. see org.melati.poem.prepro.FieldDef#generateColAccessor
getIdColumn
{ "repo_name": "timp21337/Melati", "path": "poem/src/main/java/org/melati/poem/generated/SettingTableBase.java", "license": "gpl-2.0", "size": 9130 }
[ "org.melati.poem.Column" ]
import org.melati.poem.Column;
import org.melati.poem.*;
[ "org.melati.poem" ]
org.melati.poem;
1,658,987
public Object findEarliestActiveOrder(Integer userId) { // I need to access an association, so I can't use the parent helper class Criteria criteria = getSession().createCriteria(OrderDTO.class) .createAlias("orderStatus", "s") .add(Restrictions.eq("s.id", Constants.ORDER_STATUS_ACTIVE)) .add(Restrictions.eq("deleted", 0)) .createAlias("baseUserByUserId", "u") .add(Restrictions.eq("u.id", userId)) .addOrder(Order.asc("nextBillableDay")); return findFirst(criteria); }
Object function(Integer userId) { Criteria criteria = getSession().createCriteria(OrderDTO.class) .createAlias(STR, "s") .add(Restrictions.eq("s.id", Constants.ORDER_STATUS_ACTIVE)) .add(Restrictions.eq(STR, 0)) .createAlias(STR, "u") .add(Restrictions.eq("u.id", userId)) .addOrder(Order.asc(STR)); return findFirst(criteria); }
/** * Finds all active orders for a given user * @param userId * @return */
Finds all active orders for a given user
findEarliestActiveOrder
{ "repo_name": "psalaberria002/jbilling3", "path": "src/java/com/sapienter/jbilling/server/order/db/OrderDAS.java", "license": "agpl-3.0", "size": 17282 }
[ "com.sapienter.jbilling.server.util.Constants", "org.hibernate.Criteria", "org.hibernate.criterion.Order", "org.hibernate.criterion.Restrictions" ]
import com.sapienter.jbilling.server.util.Constants; import org.hibernate.Criteria; import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions;
import com.sapienter.jbilling.server.util.*; import org.hibernate.*; import org.hibernate.criterion.*;
[ "com.sapienter.jbilling", "org.hibernate", "org.hibernate.criterion" ]
com.sapienter.jbilling; org.hibernate; org.hibernate.criterion;
87,802
protected void loadLayout(Reader in) throws IOException { PropertiesReader reader = new PropertiesReader(in); while (reader.nextProperty()) { storage.put(reader.getPropertyName(), reader.getPropertyValue()); int idx = checkHeaderComment(reader.getCommentLines()); layout.put(reader.getPropertyName(), new Layout(idx < reader.getCommentLines().size() ? new ArrayList<String>(reader.getCommentLines().subList(idx, reader.getCommentLines().size())) : null, new ArrayList<String>(reader.getValueLines()))); } footer = new ArrayList<String>(reader.getCommentLines()); InterpolationHelper.performSubstitution(storage); }
void function(Reader in) throws IOException { PropertiesReader reader = new PropertiesReader(in); while (reader.nextProperty()) { storage.put(reader.getPropertyName(), reader.getPropertyValue()); int idx = checkHeaderComment(reader.getCommentLines()); layout.put(reader.getPropertyName(), new Layout(idx < reader.getCommentLines().size() ? new ArrayList<String>(reader.getCommentLines().subList(idx, reader.getCommentLines().size())) : null, new ArrayList<String>(reader.getValueLines()))); } footer = new ArrayList<String>(reader.getCommentLines()); InterpolationHelper.performSubstitution(storage); }
/** * Reads a properties file and stores its internal structure. The found * properties will be added to the associated configuration object. * * @param in the reader to the properties file * @throws java.io.IOException if an error occurs */
Reads a properties file and stores its internal structure. The found properties will be added to the associated configuration object
loadLayout
{ "repo_name": "boneman1231/org.apache.felix", "path": "trunk/utils/src/main/java/org/apache/felix/utils/properties/Properties.java", "license": "apache-2.0", "size": 33267 }
[ "java.io.IOException", "java.io.Reader", "java.util.ArrayList" ]
import java.io.IOException; import java.io.Reader; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
749,438
private void deleteOldBooks() throws InterruptedException { final String TAG = BookAdder.TAG + "#deleteOldBooks()"; L.d(TAG, "started"); List<File> singleBookFiles = getSingleBookFiles(); List<File> collectionBookFolders = getCollectionBookFiles(); //getting books to remove List<Book> booksToRemove = new ArrayList<>(); for (Book book : db.getActiveBooks()) { boolean bookExists = false; switch (book.getType()) { case COLLECTION_FILE: for (File f : collectionBookFolders) { if (f.isFile()) { List<Chapter> chapters = book.getChapters(); String singleBookChapterPath = chapters.get(0).getPath(); if (singleBookChapterPath.equals(f.getAbsolutePath())) { bookExists = true; } } } break; case COLLECTION_FOLDER: for (File f : collectionBookFolders) { if (f.isDirectory()) { // multi file book if (book.getRoot().equals(f.getAbsolutePath())) { bookExists = true; } } } break; case SINGLE_FILE: for (File f : singleBookFiles) { if (f.isFile()) { List<Chapter> chapters = book.getChapters(); String singleBookChapterPath = chapters.get(0).getPath(); if (singleBookChapterPath.equals(f.getAbsolutePath())) { bookExists = true; } } } break; case SINGLE_FOLDER: for (File f : singleBookFiles) { if (f.isDirectory()) { // multi file book if (book.getRoot().equals(f.getAbsolutePath())) { bookExists = true; } } } break; default: throw new AssertionError("We added somewhere a non valid type=" + book.getType()); } if (!bookExists) { booksToRemove.add(book); } } if (!BaseActivity.storageMounted()) { throw new InterruptedException("Storage is not mounted"); } for (Book b : booksToRemove) { L.d(TAG, "deleting book=" + b); db.hideBook(b); } L.d(TAG, "finished"); }
void function() throws InterruptedException { final String TAG = BookAdder.TAG + STR; L.d(TAG, STR); List<File> singleBookFiles = getSingleBookFiles(); List<File> collectionBookFolders = getCollectionBookFiles(); List<Book> booksToRemove = new ArrayList<>(); for (Book book : db.getActiveBooks()) { boolean bookExists = false; switch (book.getType()) { case COLLECTION_FILE: for (File f : collectionBookFolders) { if (f.isFile()) { List<Chapter> chapters = book.getChapters(); String singleBookChapterPath = chapters.get(0).getPath(); if (singleBookChapterPath.equals(f.getAbsolutePath())) { bookExists = true; } } } break; case COLLECTION_FOLDER: for (File f : collectionBookFolders) { if (f.isDirectory()) { if (book.getRoot().equals(f.getAbsolutePath())) { bookExists = true; } } } break; case SINGLE_FILE: for (File f : singleBookFiles) { if (f.isFile()) { List<Chapter> chapters = book.getChapters(); String singleBookChapterPath = chapters.get(0).getPath(); if (singleBookChapterPath.equals(f.getAbsolutePath())) { bookExists = true; } } } break; case SINGLE_FOLDER: for (File f : singleBookFiles) { if (f.isDirectory()) { if (book.getRoot().equals(f.getAbsolutePath())) { bookExists = true; } } } break; default: throw new AssertionError(STR + book.getType()); } if (!bookExists) { booksToRemove.add(book); } } if (!BaseActivity.storageMounted()) { throw new InterruptedException(STR); } for (Book b : booksToRemove) { L.d(TAG, STR + b); db.hideBook(b); } L.d(TAG, STR); }
/** * Deletes all the books that exist on the database but not on the hard drive or on the saved * audio book paths. */
Deletes all the books that exist on the database but not on the hard drive or on the saved audio book paths
deleteOldBooks
{ "repo_name": "intrications/MaterialAudiobookPlayer", "path": "audiobook/src/main/java/de/ph1b/audiobook/model/BookAdder.java", "license": "lgpl-3.0", "size": 27085 }
[ "de.ph1b.audiobook.activity.BaseActivity", "de.ph1b.audiobook.utils.L", "java.io.File", "java.util.ArrayList", "java.util.List" ]
import de.ph1b.audiobook.activity.BaseActivity; import de.ph1b.audiobook.utils.L; import java.io.File; import java.util.ArrayList; import java.util.List;
import de.ph1b.audiobook.activity.*; import de.ph1b.audiobook.utils.*; import java.io.*; import java.util.*;
[ "de.ph1b.audiobook", "java.io", "java.util" ]
de.ph1b.audiobook; java.io; java.util;
1,110,831
private String exportCoord(Coordinate coord) { return coord.x + " " + coord.y; }
String function(Coordinate coord) { return coord.x + " " + coord.y; }
/** * Renders a single coordinate * * @param coord The Coordinate object * * @return The coordinate as string */
Renders a single coordinate
exportCoord
{ "repo_name": "pgiraud/georchestra", "path": "gt-mif/src/main/java/org/geotools/data/mif/MIFFile.java", "license": "gpl-3.0", "size": 71802 }
[ "com.vividsolutions.jts.geom.Coordinate" ]
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.*;
[ "com.vividsolutions.jts" ]
com.vividsolutions.jts;
793,774
private boolean isSourcePackage(IPackageFragment packageFragment) throws JavaModelException { return packageFragment.getKind() == IPackageFragmentRoot.K_SOURCE; }
boolean function(IPackageFragment packageFragment) throws JavaModelException { return packageFragment.getKind() == IPackageFragmentRoot.K_SOURCE; }
/** * Checks if a {@link IPackageFragment} is a source package. */
Checks if a <code>IPackageFragment</code> is a source package
isSourcePackage
{ "repo_name": "tsaglam/EcoreMetamodelExtraction", "path": "src/main/java/eme/extractor/JavaProjectExtractor.java", "license": "epl-1.0", "size": 5027 }
[ "org.eclipse.jdt.core.IPackageFragment", "org.eclipse.jdt.core.IPackageFragmentRoot", "org.eclipse.jdt.core.JavaModelException" ]
import org.eclipse.jdt.core.IPackageFragment; import org.eclipse.jdt.core.IPackageFragmentRoot; import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
763,735
private Control getParent(final Widget widget) { Object o = ObjectUtil.invokeMethod(widget, "getParent"); if (o == null){ return null; } if (o instanceof Control) { return (Control) o; } throw new RedDeerException( "Return value of method getObject() on class " + o.getClass() + " should be Control, but was " + o.getClass()); }
Control function(final Widget widget) { Object o = ObjectUtil.invokeMethod(widget, STR); if (o == null){ return null; } if (o instanceof Control) { return (Control) o; } throw new RedDeerException( STR + o.getClass() + STR + o.getClass()); }
/** * Gets parent of specified widget. * * @param widget widget to find parent * @return parent widget of specified widget */
Gets parent of specified widget
getParent
{ "repo_name": "djelinek/reddeer", "path": "plugins/org.eclipse.reddeer.core/src/org/eclipse/reddeer/core/lookup/WidgetLookup.java", "license": "epl-1.0", "size": 22265 }
[ "org.eclipse.reddeer.common.exception.RedDeerException", "org.eclipse.reddeer.common.util.ObjectUtil", "org.eclipse.swt.widgets.Control", "org.eclipse.swt.widgets.Widget" ]
import org.eclipse.reddeer.common.exception.RedDeerException; import org.eclipse.reddeer.common.util.ObjectUtil; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Widget;
import org.eclipse.reddeer.common.exception.*; import org.eclipse.reddeer.common.util.*; import org.eclipse.swt.widgets.*;
[ "org.eclipse.reddeer", "org.eclipse.swt" ]
org.eclipse.reddeer; org.eclipse.swt;
416,464
@Override public void drawScreen(int x, int y, float dunno) { int i = 0; this.drawGradientRect(0, 0, this.width, this.height, this.color, this.color - 200000000); this.drawCenteredString(this.fontRendererObj, this.classe + ChatColor.RESET, this.width / 2, 14, Integer.MAX_VALUE); drawEntity(this.width / 2, this.height / 2, 28, 0, 0, this.mc.thePlayer); for (String str : this.description) { this.drawCenteredString(this.fontRendererObj, str + ChatColor.RESET, this.width / 2, this.height / 2 + (i + 1) * 16, Integer.MAX_VALUE); i++; } this.drawString(this.fontRendererObj, ChatColor.UNDERLINE + "Advices:", this.width / 4 * 3 + 10, 28, Integer.MAX_VALUE); i = 0; for (String str : this.advices) { this.drawString(this.fontRendererObj, str + ChatColor.RESET, this.width / 4 * 3 + 10, 46 + i * 14, Integer.MAX_VALUE); i++; } this.mc.renderEngine.bindTexture(GuiSelectClass.CLASSES); GuiUtils.drawTexturedModalRect(20, 14, this.x * 52, this.y * 52, 52, 52, 0); super.drawScreen(x, y, dunno); }
void function(int x, int y, float dunno) { int i = 0; this.drawGradientRect(0, 0, this.width, this.height, this.color, this.color - 200000000); this.drawCenteredString(this.fontRendererObj, this.classe + ChatColor.RESET, this.width / 2, 14, Integer.MAX_VALUE); drawEntity(this.width / 2, this.height / 2, 28, 0, 0, this.mc.thePlayer); for (String str : this.description) { this.drawCenteredString(this.fontRendererObj, str + ChatColor.RESET, this.width / 2, this.height / 2 + (i + 1) * 16, Integer.MAX_VALUE); i++; } this.drawString(this.fontRendererObj, ChatColor.UNDERLINE + STR, this.width / 4 * 3 + 10, 28, Integer.MAX_VALUE); i = 0; for (String str : this.advices) { this.drawString(this.fontRendererObj, str + ChatColor.RESET, this.width / 4 * 3 + 10, 46 + i * 14, Integer.MAX_VALUE); i++; } this.mc.renderEngine.bindTexture(GuiSelectClass.CLASSES); GuiUtils.drawTexturedModalRect(20, 14, this.x * 52, this.y * 52, 52, 52, 0); super.drawScreen(x, y, dunno); }
/** * Draws the screen and all the components in it. */
Draws the screen and all the components in it
drawScreen
{ "repo_name": "GhostMonk3408/MidgarCrusade", "path": "src/main/java/fr/toss/client/gui/GuiRaceInformation.java", "license": "lgpl-2.1", "size": 5640 }
[ "fr.toss.common.command.ChatColor" ]
import fr.toss.common.command.ChatColor;
import fr.toss.common.command.*;
[ "fr.toss.common" ]
fr.toss.common;
2,677,554
protected void emit_AttributeDefinition___ReferentialKeyword_4_0_LeftParenthesisKeyword_4_1_RightParenthesisKeyword_4_3__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
void function(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
/** * Ambiguous syntax: * ('referential' '(' ')')? * * This ambiguous syntax occurs at: * name=ID ':' (ambiguity) type=AbstractTypeReference * preferred?='preferred' (ambiguity) type=AbstractTypeReference * unique?='unique' (ambiguity) type=AbstractTypeReference */
Ambiguous syntax: ('referential' '(' ')')? This ambiguous syntax occurs at: name=ID ':' (ambiguity) type=AbstractTypeReference preferred?='preferred' (ambiguity) type=AbstractTypeReference unique?='unique' (ambiguity) type=AbstractTypeReference
emit_AttributeDefinition___ReferentialKeyword_4_0_LeftParenthesisKeyword_4_1_RightParenthesisKeyword_4_3__q
{ "repo_name": "TypeFox/bridgepoint", "path": "src/org.xtuml.bp.xtext.masl.parent/org.xtuml.bp.xtext.masl/src-gen/org/xtuml/bp/xtext/masl/serializer/MASLSyntacticSequencer.java", "license": "apache-2.0", "size": 52664 }
[ "java.util.List", "org.eclipse.emf.ecore.EObject", "org.eclipse.xtext.nodemodel.INode", "org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider" ]
import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider;
import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.serializer.analysis.*;
[ "java.util", "org.eclipse.emf", "org.eclipse.xtext" ]
java.util; org.eclipse.emf; org.eclipse.xtext;
2,302,842
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (EsbPackage.Literals.SWITCH_CASE_PARENT_CONTAINER__SWITCH_CASE_CONTAINER, EsbFactory.eINSTANCE.createSwitchCaseContainer())); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (EsbPackage.Literals.SWITCH_CASE_PARENT_CONTAINER__SWITCH_CASE_CONTAINER, EsbFactory.eINSTANCE.createSwitchCaseContainer())); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "thiliniish/developer-studio", "path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/SwitchCaseParentContainerItemProvider.java", "license": "apache-2.0", "size": 5381 }
[ "java.util.Collection", "org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory", "org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage" ]
import java.util.Collection; import org.wso2.developerstudio.eclipse.gmf.esb.EsbFactory; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import java.util.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "java.util", "org.wso2.developerstudio" ]
java.util; org.wso2.developerstudio;
2,878,105
private void sendEmailToUsers(List<User> toAddress, RenderedTemplate rt, String fromEmail, String fromName){ StringBuilder message = new StringBuilder(); message.append(MIME_ADVISORY); if (rt.getRenderedMessage() != null) { message.append(BOUNDARY_LINE); message.append("Content-Type: text/plain; charset=iso-8859-1\n"); message.append(rt.getRenderedMessage()); } if (rt.getRenderedHtmlMessage() != null) { //append the HMTL part message.append(BOUNDARY_LINE); message.append("Content-Type: text/html; charset=iso-8859-1\n"); message.append(rt.getRenderedHtmlMessage()); } message.append(TERMINATION_LINE); // we need to manually construct the headers List<String> headers = new ArrayList<>(); //the template may specify a from address if (StringUtils.isNotBlank(rt.getFrom())) { headers.add("From: \"" + rt.getFrom() ); } else { headers.add("From: \"" + fromName + "\" <" + fromEmail + ">" ); } // Add a To: header of either the recipient (if only 1), or the sender (if multiple) String toName = fromName; String toEmail = fromEmail; if (toAddress.size() == 1) { User u = toAddress.get(0); toName = u.getDisplayName(); toEmail = u.getEmail(); } headers.add("To: \"" + toName + "\" <" + toEmail + ">" ); //SAK-21742 we need the rendered subject headers.add("Subject: " + rt.getRenderedSubject()); headers.add("Content-Type: multipart/alternative; boundary=\"" + MULTIPART_BOUNDARY + "\""); headers.add("Mime-Version: 1.0"); headers.add("Precedence: bulk"); String body = message.toString(); LOG.debug("message body " + body); emailService.sendToUsers(toAddress, headers, body); }
void function(List<User> toAddress, RenderedTemplate rt, String fromEmail, String fromName){ StringBuilder message = new StringBuilder(); message.append(MIME_ADVISORY); if (rt.getRenderedMessage() != null) { message.append(BOUNDARY_LINE); message.append(STR); message.append(rt.getRenderedMessage()); } if (rt.getRenderedHtmlMessage() != null) { message.append(BOUNDARY_LINE); message.append(STR); message.append(rt.getRenderedHtmlMessage()); } message.append(TERMINATION_LINE); List<String> headers = new ArrayList<>(); if (StringUtils.isNotBlank(rt.getFrom())) { headers.add(STR" + rt.getFrom() ); } else { headers.add(STR" + fromName + "\STR + fromEmail + ">" ); } String toName = fromName; String toEmail = fromEmail; if (toAddress.size() == 1) { User u = toAddress.get(0); toName = u.getDisplayName(); toEmail = u.getEmail(); } headers.add(STRSTR\STR + toEmail + ">" ); headers.add(STR + rt.getRenderedSubject()); headers.add(STRSTR\STRMime-Version: 1.0STRPrecedence: bulkSTRmessage body " + body); emailService.sendToUsers(toAddress, headers, body); }
/** * method to send email to Users. * @param toAddress * @param rt * @param fromEmail * @param fromName */
method to send email to Users
sendEmailToUsers
{ "repo_name": "ouit0408/sakai", "path": "emailtemplateservice/impl/logic/src/java/org/sakaiproject/emailtemplateservice/service/impl/EmailTemplateServiceImpl.java", "license": "apache-2.0", "size": 25869 }
[ "java.util.ArrayList", "java.util.List", "org.apache.commons.lang.StringUtils", "org.sakaiproject.emailtemplateservice.model.RenderedTemplate", "org.sakaiproject.user.api.User" ]
import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.StringUtils; import org.sakaiproject.emailtemplateservice.model.RenderedTemplate; import org.sakaiproject.user.api.User;
import java.util.*; import org.apache.commons.lang.*; import org.sakaiproject.emailtemplateservice.model.*; import org.sakaiproject.user.api.*;
[ "java.util", "org.apache.commons", "org.sakaiproject.emailtemplateservice", "org.sakaiproject.user" ]
java.util; org.apache.commons; org.sakaiproject.emailtemplateservice; org.sakaiproject.user;
2,096,289
public static MozuClient<com.mozu.api.contracts.productadmin.FacetSet> getFacetCategoryListClient(Integer categoryId, Boolean includeAvailable, Boolean validate, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.FacetUrl.getFacetCategoryListUrl(categoryId, includeAvailable, responseFields, validate); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productadmin.FacetSet.class; MozuClient<com.mozu.api.contracts.productadmin.FacetSet> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.FacetSet>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; }
static MozuClient<com.mozu.api.contracts.productadmin.FacetSet> function(Integer categoryId, Boolean includeAvailable, Boolean validate, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.FacetUrl.getFacetCategoryListUrl(categoryId, includeAvailable, responseFields, validate); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productadmin.FacetSet.class; MozuClient<com.mozu.api.contracts.productadmin.FacetSet> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.FacetSet>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; }
/** * Retrieves a list of the facets defined for the specified category. * <p><pre><code> * MozuClient<com.mozu.api.contracts.productadmin.FacetSet> mozuClient=GetFacetCategoryListClient( categoryId, includeAvailable, validate, responseFields); * client.setBaseAddress(url); * client.executeRequest(); * FacetSet facetSet = client.Result(); * </code></pre></p> * @param categoryId Unique identifier of the category to modify. * @param includeAvailable If true, returns a list of the attributes and categories associated with a product type that have not been defined as a facet for the category. * @param responseFields Use this field to include those fields which are not included by default. * @param validate Validates that the product category associated with a facet is active. System-supplied and read only. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.FacetSet> * @see com.mozu.api.contracts.productadmin.FacetSet */
Retrieves a list of the facets defined for the specified category. <code><code> MozuClient mozuClient=GetFacetCategoryListClient( categoryId, includeAvailable, validate, responseFields); client.setBaseAddress(url); client.executeRequest(); FacetSet facetSet = client.Result(); </code></code>
getFacetCategoryListClient
{ "repo_name": "johngatti/mozu-java", "path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/FacetClient.java", "license": "mit", "size": 10638 }
[ "com.mozu.api.MozuClient", "com.mozu.api.MozuClientFactory", "com.mozu.api.MozuUrl" ]
import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
418,407
public Request createRequest(HttpHeaders headers, RequestBody body, UriInfo uriInfo, Request.Type requestType, ResourceInstance resource) { switch (requestType) { case GET: return new GetRequest(headers, body, uriInfo, resource); case PUT: return createPutRequest(headers, body, uriInfo, resource); case DELETE: return new DeleteRequest(headers, body, uriInfo, resource); case POST: return createPostRequest(headers, body, uriInfo, resource); default: throw new IllegalArgumentException("Invalid request type: " + requestType); } }
Request function(HttpHeaders headers, RequestBody body, UriInfo uriInfo, Request.Type requestType, ResourceInstance resource) { switch (requestType) { case GET: return new GetRequest(headers, body, uriInfo, resource); case PUT: return createPutRequest(headers, body, uriInfo, resource); case DELETE: return new DeleteRequest(headers, body, uriInfo, resource); case POST: return createPostRequest(headers, body, uriInfo, resource); default: throw new IllegalArgumentException(STR + requestType); } }
/** * Create a request instance. * * @param headers http headers * @param uriInfo uri information * @param requestType http request type * @param resource associated resource instance * * @return a new Request instance */
Create a request instance
createRequest
{ "repo_name": "zouzhberk/ambaridemo", "path": "demo-server/src/main/java/org/apache/ambari/server/api/services/RequestFactory.java", "license": "apache-2.0", "size": 6471 }
[ "javax.ws.rs.core.HttpHeaders", "javax.ws.rs.core.UriInfo", "org.apache.ambari.server.api.resources.ResourceInstance" ]
import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.UriInfo; import org.apache.ambari.server.api.resources.ResourceInstance;
import javax.ws.rs.core.*; import org.apache.ambari.server.api.resources.*;
[ "javax.ws", "org.apache.ambari" ]
javax.ws; org.apache.ambari;
827,627
public List<CmsFormatterChangeSet> getFormatterChangeSets() { CmsADEConfigData currentConfig = this; List<CmsFormatterChangeSet> result = Lists.newArrayList(); while (currentConfig != null) { CmsFormatterChangeSet changes = currentConfig.getOwnFormatterChangeSet(); if (changes != null) { result.add(changes); } currentConfig = currentConfig.parent(); } Collections.reverse(result); return result; }
List<CmsFormatterChangeSet> function() { CmsADEConfigData currentConfig = this; List<CmsFormatterChangeSet> result = Lists.newArrayList(); while (currentConfig != null) { CmsFormatterChangeSet changes = currentConfig.getOwnFormatterChangeSet(); if (changes != null) { result.add(changes); } currentConfig = currentConfig.parent(); } Collections.reverse(result); return result; }
/** * Returns the formatter change sets for this and all parent sitemaps, ordered by increasing folder depth of the sitemap.<p> * * @return the formatter change sets for all ancestor sitemaps */
Returns the formatter change sets for this and all parent sitemaps, ordered by increasing folder depth of the sitemap
getFormatterChangeSets
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/ade/configuration/CmsADEConfigData.java", "license": "lgpl-2.1", "size": 71441 }
[ "com.google.common.collect.Lists", "java.util.Collections", "java.util.List", "org.opencms.ade.configuration.formatters.CmsFormatterChangeSet" ]
import com.google.common.collect.Lists; import java.util.Collections; import java.util.List; import org.opencms.ade.configuration.formatters.CmsFormatterChangeSet;
import com.google.common.collect.*; import java.util.*; import org.opencms.ade.configuration.formatters.*;
[ "com.google.common", "java.util", "org.opencms.ade" ]
com.google.common; java.util; org.opencms.ade;
2,023,948
@SimpleFunction(description = "Draws the specified text relative to the specified coordinates " + "using the values of the FontSize and TextAlignment properties.") public void DrawText(String text, int x, int y) { float fontScalingFactor = $form().deviceDensity(); float correctedX = x * fontScalingFactor; float correctedY = y * fontScalingFactor; view.canvas.drawText(text, correctedX, correctedY, paint); view.invalidate(); }
@SimpleFunction(description = STR + STR) void function(String text, int x, int y) { float fontScalingFactor = $form().deviceDensity(); float correctedX = x * fontScalingFactor; float correctedY = y * fontScalingFactor; view.canvas.drawText(text, correctedX, correctedY, paint); view.invalidate(); }
/** * Draws the specified text relative to the specified coordinates * using the values of the {@link #FontSize(float)} and * {@link #TextAlignment(int)} properties. * * @param text the text to draw * @param x the x-coordinate of the origin * @param y the y-coordinate of the origin */
Draws the specified text relative to the specified coordinates using the values of the <code>#FontSize(float)</code> and <code>#TextAlignment(int)</code> properties
DrawText
{ "repo_name": "afmckinney/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/Canvas.java", "license": "apache-2.0", "size": 56654 }
[ "com.google.appinventor.components.annotations.SimpleFunction" ]
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.*;
[ "com.google.appinventor" ]
com.google.appinventor;
2,831
private void download() { JFrame f = EditorAgent.getRegistry().getTaskBar().getFrame(); FileChooser chooser = new FileChooser(f, FileChooser.SAVE, "Download", "Select where to download the file.", null, true); chooser.setSelectedFileFull(FileAnnotationData.ORIGINAL_METADATA_NAME); chooser.setApproveButtonText("Download"); IconManager icons = IconManager.getInstance(); chooser.setTitleIcon(icons.getIcon(IconManager.DOWNLOAD_48)); chooser.addPropertyChangeListener(this); chooser.centerDialog(); } private boolean metadataLoaded; private JButton downloadButton; private JComponent toolBar; private JComponent statusBar;
void function() { JFrame f = EditorAgent.getRegistry().getTaskBar().getFrame(); FileChooser chooser = new FileChooser(f, FileChooser.SAVE, STR, STR, null, true); chooser.setSelectedFileFull(FileAnnotationData.ORIGINAL_METADATA_NAME); chooser.setApproveButtonText(STR); IconManager icons = IconManager.getInstance(); chooser.setTitleIcon(icons.getIcon(IconManager.DOWNLOAD_48)); chooser.addPropertyChangeListener(this); chooser.centerDialog(); } boolean metadataLoaded; private JButton functionButton; private JComponent toolBar; private JComponent statusBar;
/** * Brings up a dialog so that the user can select where to * download the file. */
Brings up a dialog so that the user can select where to download the file
download
{ "repo_name": "joshmoore/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/editor/OriginalMetadataComponent.java", "license": "gpl-2.0", "size": 13271 }
[ "javax.swing.JButton", "javax.swing.JComponent", "javax.swing.JFrame", "org.openmicroscopy.shoola.agents.editor.EditorAgent", "org.openmicroscopy.shoola.agents.metadata.IconManager", "org.openmicroscopy.shoola.util.ui.filechooser.FileChooser" ]
import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import org.openmicroscopy.shoola.agents.editor.EditorAgent; import org.openmicroscopy.shoola.agents.metadata.IconManager; import org.openmicroscopy.shoola.util.ui.filechooser.FileChooser;
import javax.swing.*; import org.openmicroscopy.shoola.agents.editor.*; import org.openmicroscopy.shoola.agents.metadata.*; import org.openmicroscopy.shoola.util.ui.filechooser.*;
[ "javax.swing", "org.openmicroscopy.shoola" ]
javax.swing; org.openmicroscopy.shoola;
2,230,539
public void setEntityState(Entity entityIn, byte state) { }
void function(Entity entityIn, byte state) { }
/** * sends a Packet 38 (Entity Status) to all tracked players of that entity */
sends a Packet 38 (Entity Status) to all tracked players of that entity
setEntityState
{ "repo_name": "danielyc/test-1.9.4", "path": "build/tmp/recompileMc/sources/net/minecraft/world/World.java", "license": "gpl-3.0", "size": 141454 }
[ "net.minecraft.entity.Entity" ]
import net.minecraft.entity.Entity;
import net.minecraft.entity.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
1,463,027
public void unfreezePersistentStore() throws StandardException; /** Encrypt cleartext into ciphertext.
void function() throws StandardException; /** Encrypt cleartext into ciphertext.
/** * Unfreeze the database, persistent storage can now be altered. * * @exception StandardException Standard Derby exception policy. */
Unfreeze the database, persistent storage can now be altered
unfreezePersistentStore
{ "repo_name": "apache/derby", "path": "java/org.apache.derby.engine/org/apache/derby/iapi/store/raw/RawStoreFactory.java", "license": "apache-2.0", "size": 41291 }
[ "org.apache.derby.shared.common.error.StandardException" ]
import org.apache.derby.shared.common.error.StandardException;
import org.apache.derby.shared.common.error.*;
[ "org.apache.derby" ]
org.apache.derby;
2,716,245
@Test public void checkState() { // Create the parameters for input. It needs an IUpdateable and a // ConcurrentLinkedQueue. ICEObject object = new ICEObject(); ConcurrentLinkedQueue<AbstractMeshController> queue = new ConcurrentLinkedQueue<AbstractMeshController>(); // The AbstractMeshController to test. (TestMeshController adds nothing // to the real implementation.) TestMeshController controller = new TestMeshController(object, queue); assertEquals(StateType.None, controller.getState()); controller.setState(null); // Check the new state of the controller. assertEquals(StateType.None, controller.getState()); // The queue should be empty (no change). assertTrue(queue.isEmpty()); controller.setState(StateType.Selected); // Check the new state of the controller. assertEquals(StateType.Selected, controller.getState()); // The controller should now be on the queue. assertTrue(queue.peek() == controller); // Reset the queue. queue.clear(); controller.setState(StateType.Selected); // Check the new state of the controller. assertEquals(StateType.Selected, controller.getState()); // The queue should be empty (no change). assertTrue(queue.isEmpty()); return; }
void function() { ICEObject object = new ICEObject(); ConcurrentLinkedQueue<AbstractMeshController> queue = new ConcurrentLinkedQueue<AbstractMeshController>(); TestMeshController controller = new TestMeshController(object, queue); assertEquals(StateType.None, controller.getState()); controller.setState(null); assertEquals(StateType.None, controller.getState()); assertTrue(queue.isEmpty()); controller.setState(StateType.Selected); assertEquals(StateType.Selected, controller.getState()); assertTrue(queue.peek() == controller); queue.clear(); controller.setState(StateType.Selected); assertEquals(StateType.Selected, controller.getState()); assertTrue(queue.isEmpty()); return; }
/** * <p> * Tests the ability to get and set the state of the view associated with * this controller. * </p> * */
Tests the ability to get and set the state of the view associated with this controller.
checkState
{ "repo_name": "SmithRWORNL/ice", "path": "tests/org.eclipse.ice.client.widgets.rcp.test/src/org/eclipse/ice/client/widgets/mesh/test/AbstractMeshControllerTester.java", "license": "epl-1.0", "size": 13087 }
[ "java.util.concurrent.ConcurrentLinkedQueue", "org.eclipse.ice.client.widgets.mesh.AbstractMeshController", "org.eclipse.ice.client.widgets.mesh.StateType", "org.eclipse.ice.datastructures.ICEObject", "org.junit.Assert" ]
import java.util.concurrent.ConcurrentLinkedQueue; import org.eclipse.ice.client.widgets.mesh.AbstractMeshController; import org.eclipse.ice.client.widgets.mesh.StateType; import org.eclipse.ice.datastructures.ICEObject; import org.junit.Assert;
import java.util.concurrent.*; import org.eclipse.ice.client.widgets.mesh.*; import org.eclipse.ice.datastructures.*; import org.junit.*;
[ "java.util", "org.eclipse.ice", "org.junit" ]
java.util; org.eclipse.ice; org.junit;
2,443,536
public static boolean writeFile(File file, InputStream stream, boolean append) { OutputStream o = null; try { makeDirs(file.getAbsolutePath()); o = new FileOutputStream(file, append); byte data[] = new byte[1024]; int length = -1; while ((length = stream.read(data)) != -1) { o.write(data, 0, length); } o.flush(); return true; } catch (FileNotFoundException e) { throw new RuntimeException("FileNotFoundException occurred. ", e); } catch (IOException e) { throw new RuntimeException("IOException occurred. ", e); } finally { if (o != null) { try { o.close(); stream.close(); } catch (IOException e) { throw new RuntimeException("IOException occurred. ", e); } } } }
static boolean function(File file, InputStream stream, boolean append) { OutputStream o = null; try { makeDirs(file.getAbsolutePath()); o = new FileOutputStream(file, append); byte data[] = new byte[1024]; int length = -1; while ((length = stream.read(data)) != -1) { o.write(data, 0, length); } o.flush(); return true; } catch (FileNotFoundException e) { throw new RuntimeException(STR, e); } catch (IOException e) { throw new RuntimeException(STR, e); } finally { if (o != null) { try { o.close(); stream.close(); } catch (IOException e) { throw new RuntimeException(STR, e); } } } }
/** * write file * * @param file the file to be opened for writing. * @param stream the input stream * @param append if <code>true</code>, then bytes will be written to the end of the file rather than the beginning * @return return true * @throws RuntimeException if an error occurs while operator FileOutputStream */
write file
writeFile
{ "repo_name": "DesignQu/MVPFrames", "path": "Common/src/main/java/com/tool/common/utils/FileUtils.java", "license": "apache-2.0", "size": 26780 }
[ "java.io.File", "java.io.FileNotFoundException", "java.io.FileOutputStream", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream" ]
import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,658,297
public Timestamp getUpdated(); public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
Timestamp function(); public static final String COLUMNNAME_UpdatedBy = STR;
/** Get Updated. * Date this record was updated */
Get Updated. Date this record was updated
getUpdated
{ "repo_name": "arthurmelo88/palmetalADP", "path": "adempiere_360/base/src/org/compiere/model/I_AD_User.java", "license": "gpl-2.0", "size": 13937 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,101,953
if(this.minorPremise.isPresent()) throw new AIFArgumentBuilderException(); this.minorPremise = super.iNodeText(Optional.empty(), description); return this; }
if(this.minorPremise.isPresent()) throw new AIFArgumentBuilderException(); this.minorPremise = super.iNodeText(Optional.empty(), description); return this; }
/** Set the minor premise of this argument by providing its description. This will cause the creation of a new I-Node with * the given description, of which the ID becomes the ID of the premise. Example: "p". */
Set the minor premise of this argument by providing its description. This will cause the creation of a new I-Node with
setMinorPremiseByDescription
{ "repo_name": "BasTesterink/OO2APL-capabilities-library", "path": "src/argumentationAIFCapability/argumentbuilders/ModusPonensBuilder.java", "license": "mit", "size": 5043 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
1,551,282
@Override public void notifyChanged(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "dresden-ocl/dresdenocl", "path": "plugins/org.dresdenocl.language.ocl.edit/src/org/dresdenocl/language/ocl/provider/CallExpCSItemProvider.java", "license": "lgpl-3.0", "size": 2597 }
[ "org.eclipse.emf.common.notify.Notification" ]
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
523,755
public boolean reserveHistoryForPreloading(Map<T2<Integer, Integer>, Long> reservationMap) { return false; }
boolean function(Map<T2<Integer, Integer>, Long> reservationMap) { return false; }
/** * Reserve update history for preloading. * * @param reservationMap Map contains of counters for partitions of groups. * @return True if successfully reserved. */
Reserve update history for preloading
reserveHistoryForPreloading
{ "repo_name": "NSAmelchev/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java", "license": "apache-2.0", "size": 62500 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,422,561
protected int getProxyPort(Element configElement) throws BeanCreationException { if (!configElement.hasAttributeNS(null, PROXY_PORT_ATTRIB_NAME)) { return DEFAULT_PROXY_PORT; } String port = DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, PROXY_PORT_ATTRIB_NAME)); if (port == null) { log.error("SVN resource definition attribute '" + PROXY_PORT_ATTRIB_NAME + "' may not be an empty string"); throw new BeanCreationException("SVN resource definition attribute '" + PROXY_PORT_ATTRIB_NAME + "' may not be an empty string"); } try { return Integer.parseInt(port); } catch (NumberFormatException e) { log.error("SVN resource definition attribute '" + PROXY_PORT_ATTRIB_NAME + "' contains an invalid number"); throw new BeanCreationException("SVN resource definition attribute '" + PROXY_PORT_ATTRIB_NAME + "' contains an invalid number"); } }
int function(Element configElement) throws BeanCreationException { if (!configElement.hasAttributeNS(null, PROXY_PORT_ATTRIB_NAME)) { return DEFAULT_PROXY_PORT; } String port = DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, PROXY_PORT_ATTRIB_NAME)); if (port == null) { log.error(STR + PROXY_PORT_ATTRIB_NAME + STR); throw new BeanCreationException(STR + PROXY_PORT_ATTRIB_NAME + STR); } try { return Integer.parseInt(port); } catch (NumberFormatException e) { log.error(STR + PROXY_PORT_ATTRIB_NAME + STR); throw new BeanCreationException(STR + PROXY_PORT_ATTRIB_NAME + STR); } }
/** * Gets the value of the {@value #PROXY_PORT_ATTRIB_NAME} attribute. * * @param configElement resource configuration element * * @return value of the attribute, or {@value #DEFAULT_PROXY_PORT} if the attribute is not defined * * @throws BeanCreationException thrown if the attribute is present but contains an empty string */
Gets the value of the #PROXY_PORT_ATTRIB_NAME attribute
getProxyPort
{ "repo_name": "brainysmith/shibboleth-common", "path": "src/main/java/edu/internet2/middleware/shibboleth/common/config/resource/SVNResourceBeanDefinitionParser.java", "license": "apache-2.0", "size": 22636 }
[ "org.opensaml.xml.util.DatatypeHelper", "org.springframework.beans.factory.BeanCreationException", "org.w3c.dom.Element" ]
import org.opensaml.xml.util.DatatypeHelper; import org.springframework.beans.factory.BeanCreationException; import org.w3c.dom.Element;
import org.opensaml.xml.util.*; import org.springframework.beans.factory.*; import org.w3c.dom.*;
[ "org.opensaml.xml", "org.springframework.beans", "org.w3c.dom" ]
org.opensaml.xml; org.springframework.beans; org.w3c.dom;
1,174,895
public static ExtensionDescription getDefaultDescription(boolean required, boolean repeatable) { ExtensionDescription desc = ExtensionDescription.getDefaultDescription(Relation.class); desc.setRequired(required); desc.setRepeatable(repeatable); return desc; }
static ExtensionDescription function(boolean required, boolean repeatable) { ExtensionDescription desc = ExtensionDescription.getDefaultDescription(Relation.class); desc.setRequired(required); desc.setRepeatable(repeatable); return desc; }
/** * Returns the extension description, specifying whether it is required, and * whether it is repeatable. * * @param required whether it is required * @param repeatable whether it is repeatable * @return extension description */
Returns the extension description, specifying whether it is required, and whether it is repeatable
getDefaultDescription
{ "repo_name": "ermh/Gdata-mavenized", "path": "java/src/com/google/gdata/data/contacts/Relation.java", "license": "apache-2.0", "size": 6475 }
[ "com.google.gdata.data.ExtensionDescription" ]
import com.google.gdata.data.ExtensionDescription;
import com.google.gdata.data.*;
[ "com.google.gdata" ]
com.google.gdata;
91,840
public E argMax() { double maxCount = Double.NEGATIVE_INFINITY; E maxKey = null; for (Map.Entry<E, Double> entry : entries.entrySet()) { if (entry.getValue() > maxCount || maxKey == null) { maxKey = entry.getKey(); maxCount = entry.getValue(); } } return maxKey; }
E function() { double maxCount = Double.NEGATIVE_INFINITY; E maxKey = null; for (Map.Entry<E, Double> entry : entries.entrySet()) { if (entry.getValue() > maxCount maxKey == null) { maxKey = entry.getKey(); maxCount = entry.getValue(); } } return maxKey; }
/** * Finds the key with maximum count. This is a linear operation, and ties * are broken arbitrarily. * * @return a key with minumum count */
Finds the key with maximum count. This is a linear operation, and ties are broken arbitrarily
argMax
{ "repo_name": "text-machine-lab/CliRel", "path": "model/kim/berkeleyparser/src/edu/berkeley/nlp/util/Counter.java", "license": "apache-2.0", "size": 14057 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,943,445
public final void setParent(ChannelIF parent) { this.parent = parent; }
final void function(ChannelIF parent) { this.parent = parent; }
/** * Sets parent channel of this item. * * @param parent parent channel. */
Sets parent channel of this item
setParent
{ "repo_name": "nikos/informa", "path": "src/main/java/de/nava/informa/utils/manager/memory/Item.java", "license": "epl-1.0", "size": 1343 }
[ "de.nava.informa.core.ChannelIF" ]
import de.nava.informa.core.ChannelIF;
import de.nava.informa.core.*;
[ "de.nava.informa" ]
de.nava.informa;
222,960
@SuppressWarnings("unchecked") public Element addContent(int index, Collection c) { content.addAll(index, c); return this; }
@SuppressWarnings(STR) Element function(int index, Collection c) { content.addAll(index, c); return this; }
/** * Inserts the content in a collection into the content list * at the given index. In event of an exception the original content * will be unchanged and the objects in the supplied collection will be * unaltered. * * @param index location for adding the collection * @param c collection to insert * @return the parent on which the method was called * @throws IndexOutOfBoundsException if index is negative or beyond * the current number of children * @throws IllegalAddException if any item in the collection * already has a parent or is of an inappropriate type. */
Inserts the content in a collection into the content list at the given index. In event of an exception the original content will be unchanged and the objects in the supplied collection will be unaltered
addContent
{ "repo_name": "roboidstudio/embedded", "path": "org.jdom/src/org/jdom/Element.java", "license": "lgpl-2.1", "size": 58137 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,189,835
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 12, 4, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 12, 13, 12, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 1, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 0, 12, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 11, 4, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 11, 10, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 11, 7, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 0, 4, 12, 1, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 0, 10, 12, 1, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 0, 7, 12, 1, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 11, 2, 10, 12, 10, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 8, 0, 7, 8, 0, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); for (int i = 1; i <= 11; i += 2) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 0, i, 11, 0, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 12, i, 11, 12, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 10, i, 0, 11, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 10, i, 12, 11, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i, 13, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 0, 13, i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 12, 13, i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), i + 1, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), i + 1, 13, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, i + 1, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 12, 13, i + 1, structureBoundingBoxIn); } this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 12, 13, 0, structureBoundingBoxIn); for (int k = 3; k <= 9; k += 2) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 7, k, 1, 8, k, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 7, k, 11, 8, k, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); } this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 8, 2, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 4, 12, 2, 8, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 0, 8, 1, 3, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 9, 8, 1, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 4, 3, 1, 8, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 4, 12, 1, 8, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); for (int l = 4; l <= 8; ++l) { for (int j = 0; j <= 2; ++j) { this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), l, -1, j, structureBoundingBoxIn); this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), l, -1, 12 - j, structureBoundingBoxIn); } } for (int i1 = 0; i1 <= 2; ++i1) { for (int j1 = 4; j1 <= 8; ++j1) { this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i1, -1, j1, structureBoundingBoxIn); this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 12 - i1, -1, j1, structureBoundingBoxIn); } } this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 5, 7, 5, 7, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 6, 6, 4, 6, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 6, 0, 6, structureBoundingBoxIn); IBlockState iblockstate = Blocks.FLOWING_LAVA.getDefaultState(); this.setBlockState(worldIn, iblockstate, 6, 5, 6, structureBoundingBoxIn); BlockPos blockpos = new BlockPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6)); if (structureBoundingBoxIn.isVecInside(blockpos)) { worldIn.immediateBlockTick(blockpos, iblockstate, randomIn); } return true; } } public static class NetherStalkRoom extends StructureNetherBridgePieces.Piece { public NetherStalkRoom() { } public NetherStalkRoom(int p_i45612_1_, Random p_i45612_2_, StructureBoundingBox p_i45612_3_, EnumFacing p_i45612_4_) { super(p_i45612_1_); this.setCoordBaseMode(p_i45612_4_); this.boundingBox = p_i45612_3_; }
boolean function(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 3, 0, 12, 4, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 12, 13, 12, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 1, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 5, 0, 12, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 11, 4, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 11, 10, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 11, 7, 12, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 5, 0, 4, 12, 1, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 5, 0, 10, 12, 1, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 9, 0, 7, 12, 1, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 11, 2, 10, 12, 10, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 8, 0, 7, 8, 0, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); for (int i = 1; i <= 11; i += 2) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 0, i, 11, 0, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, i, 10, 12, i, 11, 12, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 10, i, 0, 11, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 10, i, 12, 11, i, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i, 13, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 0, 13, i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 12, 13, i, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), i + 1, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), i + 1, 13, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, i + 1, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 12, 13, i + 1, structureBoundingBoxIn); } this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, 12, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 0, 13, 0, structureBoundingBoxIn); this.setBlockState(worldIn, Blocks.NETHER_BRICK_FENCE.getDefaultState(), 12, 13, 0, structureBoundingBoxIn); for (int k = 3; k <= 9; k += 2) { this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 7, k, 1, 8, k, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 11, 7, k, 11, 8, k, Blocks.NETHER_BRICK_FENCE.getDefaultState(), Blocks.NETHER_BRICK_FENCE.getDefaultState(), false); } this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 2, 0, 8, 2, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 4, 12, 2, 8, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 0, 8, 1, 3, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 9, 8, 1, 12, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 4, 3, 1, 8, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 4, 12, 1, 8, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); for (int l = 4; l <= 8; ++l) { for (int j = 0; j <= 2; ++j) { this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), l, -1, j, structureBoundingBoxIn); this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), l, -1, 12 - j, structureBoundingBoxIn); } } for (int i1 = 0; i1 <= 2; ++i1) { for (int j1 = 4; j1 <= 8; ++j1) { this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), i1, -1, j1, structureBoundingBoxIn); this.replaceAirAndLiquidDownwards(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 12 - i1, -1, j1, structureBoundingBoxIn); } } this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 5, 5, 7, 5, 7, Blocks.NETHER_BRICK.getDefaultState(), Blocks.NETHER_BRICK.getDefaultState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 6, 6, 4, 6, Blocks.AIR.getDefaultState(), Blocks.AIR.getDefaultState(), false); this.setBlockState(worldIn, Blocks.NETHER_BRICK.getDefaultState(), 6, 0, 6, structureBoundingBoxIn); IBlockState iblockstate = Blocks.FLOWING_LAVA.getDefaultState(); this.setBlockState(worldIn, iblockstate, 6, 5, 6, structureBoundingBoxIn); BlockPos blockpos = new BlockPos(this.getXWithOffset(6, 6), this.getYWithOffset(5), this.getZWithOffset(6, 6)); if (structureBoundingBoxIn.isVecInside(blockpos)) { worldIn.immediateBlockTick(blockpos, iblockstate, randomIn); } return true; } } public static class NetherStalkRoom extends StructureNetherBridgePieces.Piece { public NetherStalkRoom() { } public NetherStalkRoom(int p_i45612_1_, Random p_i45612_2_, StructureBoundingBox p_i45612_3_, EnumFacing p_i45612_4_) { super(p_i45612_1_); this.setCoordBaseMode(p_i45612_4_); this.boundingBox = p_i45612_3_; }
/** * second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes * Mineshafts at the end, it adds Fences... */
second Part of Structure generating, this for example places Spiderwebs, Mob Spawners, it closes Mineshafts at the end, it adds Fences..
addComponentParts
{ "repo_name": "TheGreatAndPowerfulWeegee/wipunknown", "path": "build/tmp/recompileMc/sources/net/minecraft/world/gen/structure/StructureNetherBridgePieces.java", "license": "gpl-3.0", "size": 107152 }
[ "java.util.Random", "net.minecraft.block.state.IBlockState", "net.minecraft.init.Blocks", "net.minecraft.util.EnumFacing", "net.minecraft.util.math.BlockPos", "net.minecraft.world.World" ]
import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World;
import java.util.*; import net.minecraft.block.state.*; import net.minecraft.init.*; import net.minecraft.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*;
[ "java.util", "net.minecraft.block", "net.minecraft.init", "net.minecraft.util", "net.minecraft.world" ]
java.util; net.minecraft.block; net.minecraft.init; net.minecraft.util; net.minecraft.world;
830,238
private void updateNonIpInterface(Connection dbc, Date now, DbNodeEntry node, int ifIndex, IfSnmpCollector snmpc) throws SQLException { if (log().isDebugEnabled()) { log().debug("updateNonIpInterface: node= " + node.getNodeId() + " ifIndex= " + ifIndex); } // Sanity Check if (snmpc == null || snmpc.failed()) { return; } // Construct InetAddress object for "0.0.0.0" address InetAddress ifAddr = null; ifAddr = ZERO_ZERO_ZERO_ZERO; if (ifAddr == null) return; updateSnmpInfoForNonIpInterface(dbc, node, ifIndex, snmpc, ifAddr); }
void function(Connection dbc, Date now, DbNodeEntry node, int ifIndex, IfSnmpCollector snmpc) throws SQLException { if (log().isDebugEnabled()) { log().debug(STR + node.getNodeId() + STR + ifIndex); } if (snmpc == null snmpc.failed()) { return; } InetAddress ifAddr = null; ifAddr = ZERO_ZERO_ZERO_ZERO; if (ifAddr == null) return; updateSnmpInfoForNonIpInterface(dbc, node, ifIndex, snmpc, ifAddr); }
/** * This method is responsible for updating the ipInterface table entry for a * specific interface. * * @param dbc * Database Connection * @param now * Date/time to be associated with the update. * @param node * Node entry for the node being rescanned * @param ifIndex * Interface index of non-IP interface to update * @param snmpc * SNMP collector or null if SNMP not supported. * * @throws SQLException * if there is a problem updating the ipInterface table. */
This method is responsible for updating the ipInterface table entry for a specific interface
updateNonIpInterface
{ "repo_name": "tharindum/opennms_dashboard", "path": "opennms-services/src/main/java/org/opennms/netmgt/capsd/RescanProcessor.java", "license": "gpl-2.0", "size": 164398 }
[ "java.net.InetAddress", "java.sql.Connection", "java.sql.SQLException", "java.util.Date" ]
import java.net.InetAddress; import java.sql.Connection; import java.sql.SQLException; import java.util.Date;
import java.net.*; import java.sql.*; import java.util.*;
[ "java.net", "java.sql", "java.util" ]
java.net; java.sql; java.util;
118,569
private void activateLeaderConnection(GrpcMessagingConnection leaderConnection) throws IOException { // Register connection error listener. leaderConnection.onException((error) -> { LOG.warn("Backup-leader connection failed.", error); }); // Register connection close listener. mLeaderConnectionCloseListener = leaderConnection.onClose((connection) -> { LOG.info("Backup-leader connection closed. {}", connection); // Cancel ongoing backup if leader is lost. if (mBackupFuture != null && !mBackupFuture.isDone()) { LOG.warn("Cancelling ongoing backup as backup-leader is lost."); mBackupFuture.cancel(true); mBackupTracker.reset(); } // Re-establish leader connection to a potentially new leader. mExecutorService.submit(() -> { establishConnectionToLeader(); }); }); // Register message handlers under catalyst context. try { mGrpcMessagingContext.execute(() -> { // Register suspend message handler. leaderConnection.handler(BackupSuspendMessage.class, this::handleSuspendJournalsMessage); // Register backup message handler. leaderConnection.handler(BackupRequestMessage.class, this::handleRequestMessage); // Send handshake message to introduce connection to leader. leaderConnection.sendAndReceive(new BackupHandshakeMessage( NetworkAddressUtils.getLocalHostName((int) ServerConfiguration.global() .getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)))); }).get(); } catch (InterruptedException ie) { throw new RuntimeException("Interrupted while activating backup-leader connection."); } catch (ExecutionException ee) { leaderConnection.close(); throw new IOException("Failed to activate backup-leader connection.", ee.getCause()); } }
void function(GrpcMessagingConnection leaderConnection) throws IOException { leaderConnection.onException((error) -> { LOG.warn(STR, error); }); mLeaderConnectionCloseListener = leaderConnection.onClose((connection) -> { LOG.info(STR, connection); if (mBackupFuture != null && !mBackupFuture.isDone()) { LOG.warn(STR); mBackupFuture.cancel(true); mBackupTracker.reset(); } mExecutorService.submit(() -> { establishConnectionToLeader(); }); }); try { mGrpcMessagingContext.execute(() -> { leaderConnection.handler(BackupSuspendMessage.class, this::handleSuspendJournalsMessage); leaderConnection.handler(BackupRequestMessage.class, this::handleRequestMessage); leaderConnection.sendAndReceive(new BackupHandshakeMessage( NetworkAddressUtils.getLocalHostName((int) ServerConfiguration.global() .getMs(PropertyKey.NETWORK_HOST_RESOLUTION_TIMEOUT_MS)))); }).get(); } catch (InterruptedException ie) { throw new RuntimeException(STR); } catch (ExecutionException ee) { leaderConnection.close(); throw new IOException(STR, ee.getCause()); } }
/** * Prepares new leader connection. */
Prepares new leader connection
activateLeaderConnection
{ "repo_name": "bf8086/alluxio", "path": "core/server/master/src/main/java/alluxio/master/backup/BackupWorkerRole.java", "license": "apache-2.0", "size": 16056 }
[ "java.io.IOException", "java.util.concurrent.ExecutionException" ]
import java.io.IOException; import java.util.concurrent.ExecutionException;
import java.io.*; import java.util.concurrent.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,690,218
public ConsulJaxRsClient update(ServiceHealth health) { this.health = health; return this; }
ConsulJaxRsClient function(ServiceHealth health) { this.health = health; return this; }
/** * Update the client state from the provided Consul health * * @param health the service health from Consul * @return the updated client */
Update the client state from the provided Consul health
update
{ "repo_name": "ozwolf-software/consul-jaxrs", "path": "src/main/java/net/ozwolf/consul/client/ConsulJaxRsClient.java", "license": "apache-2.0", "size": 8516 }
[ "com.orbitz.consul.model.health.ServiceHealth" ]
import com.orbitz.consul.model.health.ServiceHealth;
import com.orbitz.consul.model.health.*;
[ "com.orbitz.consul" ]
com.orbitz.consul;
1,943,135
public ArrayList<Peak> getPeaks() { return peaks; }
ArrayList<Peak> function() { return peaks; }
/** * Gets the list of peaks inside this spectrum. * * @return The list of peaks. */
Gets the list of peaks inside this spectrum
getPeaks
{ "repo_name": "vtomasr5/tap", "path": "src/tazam/PowerSpectrum.java", "license": "gpl-3.0", "size": 7311 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
1,297,227
private synchronized static void establishCacheManager() { URL url = PreparedStatementFactory.class.getResource("/ehcache.xml"); logger.debug("Establishing cache manager with config file: " + url.getPath()); if (manager == null) { manager = CacheManager.newInstance(url); } cacheManagerEstablished = true; }
synchronized static void function() { URL url = PreparedStatementFactory.class.getResource(STR); logger.debug(STR + url.getPath()); if (manager == null) { manager = CacheManager.newInstance(url); } cacheManagerEstablished = true; }
/** * Establishes the cache if it doesn't exist. */
Establishes the cache if it doesn't exist
establishCacheManager
{ "repo_name": "PearsonEducation/Docussandra", "path": "cassandra/src/main/java/com/pearson/docussandra/cache/CacheFactory.java", "license": "apache-2.0", "size": 3105 }
[ "com.pearson.docussandra.persistence.helper.PreparedStatementFactory", "net.sf.ehcache.CacheManager" ]
import com.pearson.docussandra.persistence.helper.PreparedStatementFactory; import net.sf.ehcache.CacheManager;
import com.pearson.docussandra.persistence.helper.*; import net.sf.ehcache.*;
[ "com.pearson.docussandra", "net.sf.ehcache" ]
com.pearson.docussandra; net.sf.ehcache;
264,781
public static String toString(JSONArray ja) throws JSONException { int i; JSONObject jo; String key; Iterator keys; int length; Object object; StringBuffer sb = new StringBuffer(); String tagName; String value; // Emit <tagName tagName = ja.getString(0); XML.noSpace(tagName); tagName = XML.escape(tagName); sb.append('<'); sb.append(tagName); object = ja.opt(1); if (object instanceof JSONObject) { i = 2; jo = (JSONObject)object; // Emit the attributes keys = jo.keys(); while (keys.hasNext()) { key = keys.next().toString(); XML.noSpace(key); value = jo.optString(key); if (value != null) { sb.append(' '); sb.append(XML.escape(key)); sb.append('='); sb.append('"'); sb.append(XML.escape(value)); sb.append('"'); } } } else { i = 1; } //Emit content in body length = ja.length(); if (i >= length) { sb.append('/'); sb.append('>'); } else { sb.append('>'); do { object = ja.get(i); i += 1; if (object != null) { if (object instanceof String) { sb.append(XML.escape(object.toString())); } else if (object instanceof JSONObject) { sb.append(toString((JSONObject)object)); } else if (object instanceof JSONArray) { sb.append(toString((JSONArray)object)); } } } while (i < length); sb.append('<'); sb.append('/'); sb.append(tagName); sb.append('>'); } return sb.toString(); }
static String function(JSONArray ja) throws JSONException { int i; JSONObject jo; String key; Iterator keys; int length; Object object; StringBuffer sb = new StringBuffer(); String tagName; String value; tagName = ja.getString(0); XML.noSpace(tagName); tagName = XML.escape(tagName); sb.append('<'); sb.append(tagName); object = ja.opt(1); if (object instanceof JSONObject) { i = 2; jo = (JSONObject)object; keys = jo.keys(); while (keys.hasNext()) { key = keys.next().toString(); XML.noSpace(key); value = jo.optString(key); if (value != null) { sb.append(' '); sb.append(XML.escape(key)); sb.append('='); sb.append('STR'); } } } else { i = 1; } length = ja.length(); if (i >= length) { sb.append('/'); sb.append('>'); } else { sb.append('>'); do { object = ja.get(i); i += 1; if (object != null) { if (object instanceof String) { sb.append(XML.escape(object.toString())); } else if (object instanceof JSONObject) { sb.append(toString((JSONObject)object)); } else if (object instanceof JSONArray) { sb.append(toString((JSONArray)object)); } } } while (i < length); sb.append('<'); sb.append('/'); sb.append(tagName); sb.append('>'); } return sb.toString(); }
/** * Reverse the JSONML transformation, making an XML text from a JSONArray. * @param ja A JSONArray. * @return An XML string. * @throws JSONException */
Reverse the JSONML transformation, making an XML text from a JSONArray
toString
{ "repo_name": "jerumble/vVoteVerifier", "path": "src/com/vvote/thirdparty/json/orgjson/JSONML.java", "license": "gpl-3.0", "size": 15024 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,225,886
public void init(JSONObject options) { mListener.onRequestFailed(mInstanceId, NOT_SUPPORTED_ERROR); }
void function(JSONObject options) { mListener.onRequestFailed(mInstanceId, NOT_SUPPORTED_ERROR); }
/** * Called when init command is received. */
Called when init command is received
init
{ "repo_name": "crosswalk-project/crosswalk-android-extensions", "path": "iap/src/org/xwalk/extensions/InAppPurchaseHelper.java", "license": "bsd-3-clause", "size": 2629 }
[ "org.json.JSONObject" ]
import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
936,330
@SuppressWarnings("ThrowableResultOfMethodCallIgnored") public static void writeError(Throwable ex, BinaryRawWriterEx writer) { writer.writeObjectDetached(ex.getClass().getName()); writer.writeObjectDetached(ex.getMessage()); writer.writeObjectDetached(X.getFullStackTrace(ex)); PlatformNativeException nativeCause = X.cause(ex, PlatformNativeException.class); if (nativeCause != null) { writer.writeBoolean(true); writer.writeObjectDetached(nativeCause.cause()); } else writer.writeBoolean(false); }
@SuppressWarnings(STR) static void function(Throwable ex, BinaryRawWriterEx writer) { writer.writeObjectDetached(ex.getClass().getName()); writer.writeObjectDetached(ex.getMessage()); writer.writeObjectDetached(X.getFullStackTrace(ex)); PlatformNativeException nativeCause = X.cause(ex, PlatformNativeException.class); if (nativeCause != null) { writer.writeBoolean(true); writer.writeObjectDetached(nativeCause.cause()); } else writer.writeBoolean(false); }
/** * Writes error. * * @param ex Error. * @param writer Writer. */
Writes error
writeError
{ "repo_name": "pperalta/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java", "license": "apache-2.0", "size": 31920 }
[ "org.apache.ignite.internal.binary.BinaryRawWriterEx", "org.apache.ignite.internal.processors.platform.PlatformNativeException", "org.apache.ignite.internal.util.typedef.X" ]
import org.apache.ignite.internal.binary.BinaryRawWriterEx; import org.apache.ignite.internal.processors.platform.PlatformNativeException; import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.binary.*; import org.apache.ignite.internal.processors.platform.*; import org.apache.ignite.internal.util.typedef.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,467,026
Map<String, Integer> getMessageCountForAllQueues(List<String> queueNames) throws AndesException;
Map<String, Integer> getMessageCountForAllQueues(List<String> queueNames) throws AndesException;
/** * Get a map of queue names and the message count in the database for each queue in the data store * * @param queueNames list of queue names of which the message count should be retrieved * @return Map of queue names and the message count for each queue */
Get a map of queue names and the message count in the database for each queue in the data store
getMessageCountForAllQueues
{ "repo_name": "indikasampath2000/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/kernel/MessageStore.java", "license": "apache-2.0", "size": 17422 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,362,258
private static void addToSwarm(Object swarm, SystemTimer t) { final boolean isDebugEnabled = logger.isTraceEnabled(); // Get or add list of timers for this swarm... ArrayList swarmSet; synchronized (allSwarms) { swarmSet = (ArrayList) allSwarms.get(swarm); if (swarmSet == null) { if (isDebugEnabled) { logger.trace("SystemTimer#addToSwarm: created swarm {}", swarm); } swarmSet = new ArrayList(); allSwarms.put(swarm, swarmSet); } } // synchronized // Add the timer to the swarm's list if (isDebugEnabled) { logger.trace("SystemTimer#addToSwarm: adding timer <{}>", t); } WeakReference wr = new WeakReference(t); synchronized (swarmSet) { swarmSet.add(wr); } // synchronized } private static long lastSweepAllTime = 0; private static final long SWEEP_ALL_INTERVAL = 2 * 60 * 1000; // 2 minutes
static void function(Object swarm, SystemTimer t) { final boolean isDebugEnabled = logger.isTraceEnabled(); ArrayList swarmSet; synchronized (allSwarms) { swarmSet = (ArrayList) allSwarms.get(swarm); if (swarmSet == null) { if (isDebugEnabled) { logger.trace(STR, swarm); } swarmSet = new ArrayList(); allSwarms.put(swarm, swarmSet); } } if (isDebugEnabled) { logger.trace(STR, t); } WeakReference wr = new WeakReference(t); synchronized (swarmSet) { swarmSet.add(wr); } } private static long lastSweepAllTime = 0; private static final long SWEEP_ALL_INTERVAL = 2 * 60 * 1000;
/** * Add the given timer is in the given swarm. Used only by constructors. * * @param swarm swarm to add the timer to * @param t timer to add */
Add the given timer is in the given swarm. Used only by constructors
addToSwarm
{ "repo_name": "pdxrunner/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/SystemTimer.java", "license": "apache-2.0", "size": 14529 }
[ "java.lang.ref.WeakReference", "java.util.ArrayList" ]
import java.lang.ref.WeakReference; import java.util.ArrayList;
import java.lang.ref.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,110,919
List<IPoint2<T>> getPoints();
List<IPoint2<T>> getPoints();
/** * Returns the {@link IPoint2 Points} of this {@code IPolyLine2}. * * @return the {@link IPoint2 Points} of this {@code IPolyLine2}. */
Returns the <code>IPoint2 Points</code> of this IPolyLine2
getPoints
{ "repo_name": "aftenkap/jutility-math", "path": "src/main/java/org/jutility/math/geometry/IPolyLine2.java", "license": "apache-2.0", "size": 2715 }
[ "java.util.List", "org.jutility.math.vectoralgebra.IPoint2" ]
import java.util.List; import org.jutility.math.vectoralgebra.IPoint2;
import java.util.*; import org.jutility.math.vectoralgebra.*;
[ "java.util", "org.jutility.math" ]
java.util; org.jutility.math;
1,179,512
public void testSingleGuyTwoTeachers() { boolean selection = FreeColTestUtils.setStudentSelection(false); Game game = ServerTestHelper.startServerGame(getTestMap(true)); Colony colony = getSchoolColony(4, SchoolLevel.UNIVERSITY); Building university = colony.getBuilding(universityType); Iterator<Unit> units = colony.getUnitList().iterator(); Unit colonist = units.next(); colonist.setType(freeColonistType); Building townHall = colony.getBuilding(townHallType); clearWorkLocation(townHall); colonist.setLocation(townHall); Unit lumberJack = units.next(); lumberJack.setType(expertLumberJackType); Unit blackSmith = units.next(); blackSmith.setType(masterBlacksmithType); // It should take 4 turns to train an expert lumber jack and 6 // to train a blacksmith, so the lumber jack chould be // finished teaching first. The school works for now as // first come first serve. blackSmith.setLocation(university); lumberJack.setLocation(university); assertTrue(colonist.getTeacher() == blackSmith); assertNull(lumberJack.getStudent()); assertEquals(1, getUnitList(colony, freeColonistType).size()); assertEquals(1, getUnitList(colony, expertLumberJackType).size()); assertEquals(1, getUnitList(colony, masterBlacksmithType).size()); trainForTurns(colony, blackSmith.getNeededTurnsOfTraining()); assertEquals(0, getUnitList(colony, freeColonistType).size()); assertEquals(1, getUnitList(colony, expertLumberJackType).size()); assertEquals(2, getUnitList(colony, masterBlacksmithType).size()); FreeColTestUtils.setStudentSelection(selection); }
void function() { boolean selection = FreeColTestUtils.setStudentSelection(false); Game game = ServerTestHelper.startServerGame(getTestMap(true)); Colony colony = getSchoolColony(4, SchoolLevel.UNIVERSITY); Building university = colony.getBuilding(universityType); Iterator<Unit> units = colony.getUnitList().iterator(); Unit colonist = units.next(); colonist.setType(freeColonistType); Building townHall = colony.getBuilding(townHallType); clearWorkLocation(townHall); colonist.setLocation(townHall); Unit lumberJack = units.next(); lumberJack.setType(expertLumberJackType); Unit blackSmith = units.next(); blackSmith.setType(masterBlacksmithType); blackSmith.setLocation(university); lumberJack.setLocation(university); assertTrue(colonist.getTeacher() == blackSmith); assertNull(lumberJack.getStudent()); assertEquals(1, getUnitList(colony, freeColonistType).size()); assertEquals(1, getUnitList(colony, expertLumberJackType).size()); assertEquals(1, getUnitList(colony, masterBlacksmithType).size()); trainForTurns(colony, blackSmith.getNeededTurnsOfTraining()); assertEquals(0, getUnitList(colony, freeColonistType).size()); assertEquals(1, getUnitList(colony, expertLumberJackType).size()); assertEquals(2, getUnitList(colony, masterBlacksmithType).size()); FreeColTestUtils.setStudentSelection(selection); }
/** * If there are two teachers, but just one colonist to be taught. */
If there are two teachers, but just one colonist to be taught
testSingleGuyTwoTeachers
{ "repo_name": "FreeCol/freecol", "path": "test/src/net/sf/freecol/server/model/ServerBuildingTest.java", "license": "gpl-2.0", "size": 50196 }
[ "java.util.Iterator", "net.sf.freecol.common.model.Building", "net.sf.freecol.common.model.Colony", "net.sf.freecol.common.model.Game", "net.sf.freecol.common.model.Unit", "net.sf.freecol.server.ServerTestHelper", "net.sf.freecol.util.test.FreeColTestUtils" ]
import java.util.Iterator; import net.sf.freecol.common.model.Building; import net.sf.freecol.common.model.Colony; import net.sf.freecol.common.model.Game; import net.sf.freecol.common.model.Unit; import net.sf.freecol.server.ServerTestHelper; import net.sf.freecol.util.test.FreeColTestUtils;
import java.util.*; import net.sf.freecol.common.model.*; import net.sf.freecol.server.*; import net.sf.freecol.util.test.*;
[ "java.util", "net.sf.freecol" ]
java.util; net.sf.freecol;
885,536
public String getSignature(String stringToSign, byte[] derivedSigningKey) throws SignatureException { try { return new String(Hex.encode(calculateHmacSHA256(stringToSign, derivedSigningKey)), ENCODING); } catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException e) { throw new SignatureException(SIGNATURE_ERROR + e.getMessage()); } }
String function(String stringToSign, byte[] derivedSigningKey) throws SignatureException { try { return new String(Hex.encode(calculateHmacSHA256(stringToSign, derivedSigningKey)), ENCODING); } catch (NoSuchAlgorithmException InvalidKeyException UnsupportedEncodingException e) { throw new SignatureException(SIGNATURE_ERROR + e.getMessage()); } }
/** * Calculates the AWS Signature Version 4 by signing (calculates the HmacSHA256) the string-to-sign with the derived key. * * @param stringToSign String-to-sign the includes meta information about the request. * @param derivedSigningKey Signing key derived from the AWS secret access key. * @return AWS Signature Version 4. */
Calculates the AWS Signature Version 4 by signing (calculates the HmacSHA256) the string-to-sign with the derived key
getSignature
{ "repo_name": "victorursan/cs-actions", "path": "cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureV4.java", "license": "apache-2.0", "size": 7330 }
[ "java.io.UnsupportedEncodingException", "java.security.InvalidKeyException", "java.security.NoSuchAlgorithmException", "java.security.SignatureException", "org.bouncycastle.util.encoders.Hex" ]
import java.io.UnsupportedEncodingException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SignatureException; import org.bouncycastle.util.encoders.Hex;
import java.io.*; import java.security.*; import org.bouncycastle.util.encoders.*;
[ "java.io", "java.security", "org.bouncycastle.util" ]
java.io; java.security; org.bouncycastle.util;
2,274,527
public static void e(String tag, String format, Object... params) { String msg = String.format(PREFIX + format, params); Log.e(tag, msg); writeToFile(tag, msg); }
static void function(String tag, String format, Object... params) { String msg = String.format(PREFIX + format, params); Log.e(tag, msg); writeToFile(tag, msg); }
/** * log for error * * @param tag tag * @param format message format, such as "%d ..." * @param params message content params * @see Log#e(String, String) */
log for error
e
{ "repo_name": "chengzijian/Bibabo", "path": "Framework/src/main/java/com/bibabo/framework/utils/LogUtils.java", "license": "apache-2.0", "size": 8579 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,018,661
public double getProjectedDistance(Atom point) { Atom projected = getProjectedPoint(point); if( projected == null) { // translation only return Double.NaN; } try { return Calc.getDistance(point, projected); } catch(StructureException e) { // Should be unreachable return Double.NaN; } }
double function(Atom point) { Atom projected = getProjectedPoint(point); if( projected == null) { return Double.NaN; } try { return Calc.getDistance(point, projected); } catch(StructureException e) { return Double.NaN; } }
/** * Get the distance from a point to the axis of rotation * @param point * @return The distance to the axis, or NaN if the RotationAxis is purely translational */
Get the distance from a point to the axis of rotation
getProjectedDistance
{ "repo_name": "kumar-physics/BioJava", "path": "biojava3-structure/src/main/java/org/biojava/bio/structure/align/util/RotationAxis.java", "license": "lgpl-2.1", "size": 15057 }
[ "org.biojava.bio.structure.Atom", "org.biojava.bio.structure.Calc", "org.biojava.bio.structure.StructureException" ]
import org.biojava.bio.structure.Atom; import org.biojava.bio.structure.Calc; import org.biojava.bio.structure.StructureException;
import org.biojava.bio.structure.*;
[ "org.biojava.bio" ]
org.biojava.bio;
2,010,180
public Observable<ServiceResponse<Void>> putDurationValidAsync(Map<String, Period> arrayBody) { if (arrayBody == null) { throw new IllegalArgumentException("Parameter arrayBody is required and cannot be null."); }
Observable<ServiceResponse<Void>> function(Map<String, Period> arrayBody) { if (arrayBody == null) { throw new IllegalArgumentException(STR); }
/** * Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}. * * @param arrayBody the Map&lt;String, Period&gt; value * @return the {@link ServiceResponse} object if successful. */
Set dictionary value {"0": "P123DT22H14M12.011S", "1": "P5DT1H0M0S"}
putDurationValidAsync
{ "repo_name": "haocs/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java", "license": "mit", "size": 176746 }
[ "com.microsoft.rest.ServiceResponse", "java.util.Map", "org.joda.time.Period" ]
import com.microsoft.rest.ServiceResponse; import java.util.Map; import org.joda.time.Period;
import com.microsoft.rest.*; import java.util.*; import org.joda.time.*;
[ "com.microsoft.rest", "java.util", "org.joda.time" ]
com.microsoft.rest; java.util; org.joda.time;
1,873,519
public void setToolbar(@NonNull Activity activity, @NonNull Toolbar toolbar, boolean recreateActionBarDrawerToggle) { this.mDrawerBuilder.mToolbar = toolbar; this.mDrawerBuilder.handleDrawerNavigation(activity, recreateActionBarDrawerToggle); }
void function(@NonNull Activity activity, @NonNull Toolbar toolbar, boolean recreateActionBarDrawerToggle) { this.mDrawerBuilder.mToolbar = toolbar; this.mDrawerBuilder.handleDrawerNavigation(activity, recreateActionBarDrawerToggle); }
/** * Sets the toolbar which should be used in combination with the drawer * This will handle the ActionBarDrawerToggle for you. * Do not set this if you are in a sub activity and want to handle the back arrow on your own * * @param activity * @param toolbar the toolbar which is used in combination with the drawer * @param recreateActionBarDrawerToggle defines if the ActionBarDrawerToggle needs to be recreated with the new set Toolbar */
Sets the toolbar which should be used in combination with the drawer This will handle the ActionBarDrawerToggle for you. Do not set this if you are in a sub activity and want to handle the back arrow on your own
setToolbar
{ "repo_name": "Ryan---Yang/MaterialDrawer", "path": "library/src/main/java/com/mikepenz/materialdrawer/Drawer.java", "license": "apache-2.0", "size": 29425 }
[ "android.app.Activity", "android.support.annotation.NonNull", "android.support.v7.widget.Toolbar" ]
import android.app.Activity; import android.support.annotation.NonNull; import android.support.v7.widget.Toolbar;
import android.app.*; import android.support.annotation.*; import android.support.v7.widget.*;
[ "android.app", "android.support" ]
android.app; android.support;
2,765,203
@Test(expected = GeniePreconditionException.class) public void testMessageArgConstructor() throws GeniePreconditionException { final GeniePreconditionException ge = new GeniePreconditionException(ERROR_MESSAGE); Assert.assertEquals(HttpURLConnection.HTTP_PRECON_FAILED, ge.getErrorCode()); Assert.assertEquals(ERROR_MESSAGE, ge.getMessage()); Assert.assertNull(ge.getCause()); throw ge; }
@Test(expected = GeniePreconditionException.class) void function() throws GeniePreconditionException { final GeniePreconditionException ge = new GeniePreconditionException(ERROR_MESSAGE); Assert.assertEquals(HttpURLConnection.HTTP_PRECON_FAILED, ge.getErrorCode()); Assert.assertEquals(ERROR_MESSAGE, ge.getMessage()); Assert.assertNull(ge.getCause()); throw ge; }
/** * Test the constructor. * * @throws GeniePreconditionException On a precondition issue */
Test the constructor
testMessageArgConstructor
{ "repo_name": "rspieldenner/genie", "path": "genie-common/src/test/java/com/netflix/genie/common/exceptions/TestGeniePreconditionException.java", "license": "apache-2.0", "size": 2706 }
[ "java.net.HttpURLConnection", "org.junit.Assert", "org.junit.Test" ]
import java.net.HttpURLConnection; import org.junit.Assert; import org.junit.Test;
import java.net.*; import org.junit.*;
[ "java.net", "org.junit" ]
java.net; org.junit;
1,770,861
protected void removeAnnotations(final List< ? extends Annotation> annotations, final boolean fireModelChanged) { if (!annotations.isEmpty()) { final Iterator< ? extends Annotation> e = annotations.iterator(); while (e.hasNext()) { removeAnnotation(e.next(), false); } if (fireModelChanged) { fireModelChanged(); } } }
void function(final List< ? extends Annotation> annotations, final boolean fireModelChanged) { if (!annotations.isEmpty()) { final Iterator< ? extends Annotation> e = annotations.iterator(); while (e.hasNext()) { removeAnnotation(e.next(), false); } if (fireModelChanged) { fireModelChanged(); } } }
/** * Removes the given annotations from this model. If requested all annotation model listeners will be informed about this change. * <code>modelInitiated</code> indicates whether the deletion has been initiated by this model or by one of its clients. * * @param annotations the annotations to be removed * @param fireModelChanged indicates whether to notify all model listeners */
Removes the given annotations from this model. If requested all annotation model listeners will be informed about this change. <code>modelInitiated</code> indicates whether the deletion has been initiated by this model or by one of its clients
removeAnnotations
{ "repo_name": "Ori-Libhaber/che-core", "path": "ide/che-core-ide-jseditor/src/main/java/org/eclipse/che/ide/jseditor/client/annotation/AnnotationModelImpl.java", "license": "epl-1.0", "size": 12637 }
[ "java.util.Iterator", "java.util.List", "org.eclipse.che.ide.api.text.annotation.Annotation" ]
import java.util.Iterator; import java.util.List; import org.eclipse.che.ide.api.text.annotation.Annotation;
import java.util.*; import org.eclipse.che.ide.api.text.annotation.*;
[ "java.util", "org.eclipse.che" ]
java.util; org.eclipse.che;
1,898,283
public IgniteCache<K, V> withExpiryPolicy(ExpiryPolicy plc);
IgniteCache<K, V> function(ExpiryPolicy plc);
/** * Returns cache with the specified expired policy set. This policy will be used for each operation * invoked on the returned cache. * <p> * This method does not modify existing cache instance. * * @param plc Expire policy to use. * @return Cache instance with the specified expiry policy set. */
Returns cache with the specified expired policy set. This policy will be used for each operation invoked on the returned cache. This method does not modify existing cache instance
withExpiryPolicy
{ "repo_name": "andrey-kuznetsov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/IgniteCache.java", "license": "apache-2.0", "size": 77739 }
[ "javax.cache.expiry.ExpiryPolicy" ]
import javax.cache.expiry.ExpiryPolicy;
import javax.cache.expiry.*;
[ "javax.cache" ]
javax.cache;
2,790,955
public Observable<String> pfaddManyObservable(String key, List<String> elements) { io.vertx.rx.java.ObservableFuture<String> handler = io.vertx.rx.java.RxHelper.observableFuture(); pfaddMany(key, elements, handler.toHandler()); return handler; }
Observable<String> function(String key, List<String> elements) { io.vertx.rx.java.ObservableFuture<String> handler = io.vertx.rx.java.RxHelper.observableFuture(); pfaddMany(key, elements, handler.toHandler()); return handler; }
/** * Adds the specified elements to the specified HyperLogLog. * @param key Key string * @param elements Elementa to add * @return */
Adds the specified elements to the specified HyperLogLog
pfaddManyObservable
{ "repo_name": "brianjcj/vertx-redis-client", "path": "src/main/generated/io/vertx/rxjava/redis/RedisTransaction.java", "license": "apache-2.0", "size": 184983 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
638,611
public int calcModifierDamage(int level, DamageSource source) { return source.canHarmInCreative() ? 0 : (this.protectionType == EnchantmentProtection.Type.ALL ? level : (this.protectionType == EnchantmentProtection.Type.FIRE && source.isFireDamage() ? level * 2 : (this.protectionType == EnchantmentProtection.Type.FALL && source == DamageSource.fall ? level * 3 : (this.protectionType == EnchantmentProtection.Type.EXPLOSION && source.isExplosion() ? level * 2 : (this.protectionType == EnchantmentProtection.Type.PROJECTILE && source.isProjectile() ? level * 2 : 0))))); }
int function(int level, DamageSource source) { return source.canHarmInCreative() ? 0 : (this.protectionType == EnchantmentProtection.Type.ALL ? level : (this.protectionType == EnchantmentProtection.Type.FIRE && source.isFireDamage() ? level * 2 : (this.protectionType == EnchantmentProtection.Type.FALL && source == DamageSource.fall ? level * 3 : (this.protectionType == EnchantmentProtection.Type.EXPLOSION && source.isExplosion() ? level * 2 : (this.protectionType == EnchantmentProtection.Type.PROJECTILE && source.isProjectile() ? level * 2 : 0))))); }
/** * Calculates the damage protection of the enchantment based on level and damage source passed. */
Calculates the damage protection of the enchantment based on level and damage source passed
calcModifierDamage
{ "repo_name": "Merlijnv/MFM", "path": "build/tmp/recompileMc/sources/net/minecraft/enchantment/EnchantmentProtection.java", "license": "gpl-3.0", "size": 5014 }
[ "net.minecraft.util.DamageSource" ]
import net.minecraft.util.DamageSource;
import net.minecraft.util.*;
[ "net.minecraft.util" ]
net.minecraft.util;
1,763,904
void onReactionAdd(ReactionAddEvent event);
void onReactionAdd(ReactionAddEvent event);
/** * This method is called every time a reaction is added to a message. * * @param event The event. */
This method is called every time a reaction is added to a message
onReactionAdd
{ "repo_name": "BtoBastian/Javacord", "path": "javacord-api/src/main/java/org/javacord/api/listener/message/reaction/ReactionAddListener.java", "license": "lgpl-3.0", "size": 985 }
[ "org.javacord.api.event.message.reaction.ReactionAddEvent" ]
import org.javacord.api.event.message.reaction.ReactionAddEvent;
import org.javacord.api.event.message.reaction.*;
[ "org.javacord.api" ]
org.javacord.api;
1,463,222
@Deprecated private Pipeline getPipeline() { if (pipeline == null) { throw new IllegalStateException("owning pipeline not set"); } return pipeline; }
Pipeline function() { if (pipeline == null) { throw new IllegalStateException(STR); } return pipeline; }
/** * Returns the owning {@link Pipeline} of this {@code PTransform}. * * @throws IllegalStateException if the owning {@code Pipeline} hasn't been * set yet */
Returns the owning <code>Pipeline</code> of this PTransform
getPipeline
{ "repo_name": "twcctz500000/DataflowJavaSDK", "path": "sdk/src/main/java/com/google/cloud/dataflow/sdk/transforms/PTransform.java", "license": "apache-2.0", "size": 14269 }
[ "com.google.cloud.dataflow.sdk.Pipeline" ]
import com.google.cloud.dataflow.sdk.Pipeline;
import com.google.cloud.dataflow.sdk.*;
[ "com.google.cloud" ]
com.google.cloud;
2,144,615
public IntegrationAccountSessionFilter withChangedTime(DateTime changedTime) { this.changedTime = changedTime; return this; }
IntegrationAccountSessionFilter function(DateTime changedTime) { this.changedTime = changedTime; return this; }
/** * Set the changed time of integration account sessions. * * @param changedTime the changedTime value to set * @return the IntegrationAccountSessionFilter object itself. */
Set the changed time of integration account sessions
withChangedTime
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/logic/mgmt-v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/IntegrationAccountSessionFilter.java", "license": "mit", "size": 1196 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
1,049,828
private void processLiteralNew(DetailAST ast) { if (ast.getParent().getType() != TokenTypes.METHOD_REF) { instantiations.add(ast); } }
void function(DetailAST ast) { if (ast.getParent().getType() != TokenTypes.METHOD_REF) { instantiations.add(ast); } }
/** * Collects a "new" token. * @param ast the "new" token */
Collects a "new" token
processLiteralNew
{ "repo_name": "sabaka/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalInstantiationCheck.java", "license": "lgpl-2.1", "size": 12020 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "com.puppycrawl.tools.checkstyle.api.TokenTypes" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.api.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
2,785,505
private void putAllForCreate(Map<? extends K, ? extends V> m) { for (Map.Entry<? extends K, ? extends V> entry : m.entrySet()) { int hash = (entry.getKey() == null) ? 0 : hash(entry.getKey().hashCode()); int i = indexFor(hash, table.length); for (Entry<K,V> e = table[i]; e != null; e = e.next) { Object k; if (e.hash == hash && ((k = e.key) == entry.getKey() || (entry.getKey() != null && entry.getKey().equals(k)))) { e.value = entry.getValue(); return; } } createEntry(hash, entry.getKey(), entry.getValue(), i); } } /** * Method to insert a key value pair in HashMap * @param key * @param value * @return {@link V}
void function(Map<? extends K, ? extends V> m) { for (Map.Entry<? extends K, ? extends V> entry : m.entrySet()) { int hash = (entry.getKey() == null) ? 0 : hash(entry.getKey().hashCode()); int i = indexFor(hash, table.length); for (Entry<K,V> e = table[i]; e != null; e = e.next) { Object k; if (e.hash == hash && ((k = e.key) == entry.getKey() (entry.getKey() != null && entry.getKey().equals(k)))) { e.value = entry.getValue(); return; } } createEntry(hash, entry.getKey(), entry.getValue(), i); } } /** * Method to insert a key value pair in HashMap * @param key * @param value * @return {@link V}
/** * Method to put all values while creating a HashMap * @param m */
Method to put all values while creating a HashMap
putAllForCreate
{ "repo_name": "deepak-malik/Data-Structures-In-Java", "path": "src/com/deepak/data/structures/Hashing/CustomHashMap.java", "license": "mit", "size": 11614 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,011,044
public String getOwner() { return this.getCOSDictionary().getNameAsString(COSName.O); }
String function() { return this.getCOSDictionary().getNameAsString(COSName.O); }
/** * Returns the owner of the attributes. * * @return the owner of the attributes */
Returns the owner of the attributes
getOwner
{ "repo_name": "sencko/NALB", "path": "nalb2013/src/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDAttributeObject.java", "license": "gpl-2.0", "size": 6603 }
[ "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
2,151,683
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "KAMP-Research/KAMP", "path": "bundles/Toometa/toometa.pcmarchoptions.edit/src/pcmarchoptions/provider/PCM_FunctionalityConnectionItemProvider.java", "license": "apache-2.0", "size": 5285 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
316,103