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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
private static boolean format(Configuration conf, boolean force,
boolean isInteractive) throws IOException {
initializeGenericKeys(conf);
checkAllowFormat(conf);
if (UserGroupInformation.isSecurityEnabled()) {
InetSocketAddress socAddr = getAddress(conf);
SecurityUtil
.login(conf, DFS_NAMENODE_KEYTAB_FILE_KEY, DFS_NAMENODE_USER_NAME_KEY,
socAddr.getHostName());
}
// if clusterID is not provided - see if you can find the current one
String clusterId = StartupOption.FORMAT.getClusterId();
if (clusterId == null || clusterId.equals("")) {
//Generate a new cluster id
clusterId = StorageInfo.newClusterID();
}
System.out.println("Formatting using clusterid: " + clusterId);
try {
HdfsStorageFactory.setConfiguration(conf);
if (force) {
HdfsStorageFactory.formatStorageNonTransactional();
} else {
HdfsStorageFactory.formatStorage();
}
StorageInfo
.storeStorageInfoToDB(clusterId); //this adds new row to the db
} catch (StorageException e) {
throw new RuntimeException(e.getMessage());
}
return false;
} | static boolean function(Configuration conf, boolean force, boolean isInteractive) throws IOException { initializeGenericKeys(conf); checkAllowFormat(conf); if (UserGroupInformation.isSecurityEnabled()) { InetSocketAddress socAddr = getAddress(conf); SecurityUtil .login(conf, DFS_NAMENODE_KEYTAB_FILE_KEY, DFS_NAMENODE_USER_NAME_KEY, socAddr.getHostName()); } String clusterId = StartupOption.FORMAT.getClusterId(); if (clusterId == null clusterId.equals(STRFormatting using clusterid: " + clusterId); try { HdfsStorageFactory.setConfiguration(conf); if (force) { HdfsStorageFactory.formatStorageNonTransactional(); } else { HdfsStorageFactory.formatStorage(); } StorageInfo .storeStorageInfoToDB(clusterId); } catch (StorageException e) { throw new RuntimeException(e.getMessage()); } return false; } | /**
* Verify that configured directories exist, then Interactively confirm that
* formatting is desired for each existing directory and format them.
*
* @param conf
* @param force
* @return true if formatting was aborted, false otherwise
* @throws IOException
*/ | Verify that configured directories exist, then Interactively confirm that formatting is desired for each existing directory and format them | format | {
"repo_name": "srijeyanthan/hops",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java",
"license": "apache-2.0",
"size": 40625
} | [
"io.hops.exception.StorageException",
"io.hops.metadata.HdfsStorageFactory",
"java.io.IOException",
"java.net.InetSocketAddress",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hdfs.server.common.HdfsServerConstants",
"org.apache.hadoop.hdfs.server.common.StorageInfo",
"org.apache.hadoop.security.SecurityUtil",
"org.apache.hadoop.security.UserGroupInformation"
] | import io.hops.exception.StorageException; import io.hops.metadata.HdfsStorageFactory; import java.io.IOException; import java.net.InetSocketAddress; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; import org.apache.hadoop.hdfs.server.common.StorageInfo; import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.UserGroupInformation; | import io.hops.exception.*; import io.hops.metadata.*; import java.io.*; import java.net.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.server.common.*; import org.apache.hadoop.security.*; | [
"io.hops.exception",
"io.hops.metadata",
"java.io",
"java.net",
"org.apache.hadoop"
] | io.hops.exception; io.hops.metadata; java.io; java.net; org.apache.hadoop; | 264,565 |
EReference getNamedElement_Parent(); | EReference getNamedElement_Parent(); | /**
* Returns the meta object for the container reference '{@link xmbase.NamedElement#getParent <em>Parent</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the container reference '<em>Parent</em>'.
* @see xmbase.NamedElement#getParent()
* @see #getNamedElement()
* @generated
*/ | Returns the meta object for the container reference '<code>xmbase.NamedElement#getParent Parent</code>'. | getNamedElement_Parent | {
"repo_name": "abstratt/xm",
"path": "xmodel/src-gen/xmbase/XmbasePackage.java",
"license": "agpl-3.0",
"size": 53166
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,084,667 |
public T caseDiagramModelArchimateConnection(IDiagramModelArchimateConnection object) {
return null;
}
| T function(IDiagramModelArchimateConnection object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Diagram Model Archimate Connection</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Diagram Model Archimate Connection</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Diagram Model Archimate Connection'. This implementation returns null; returning a non-null result will terminate the switch. | caseDiagramModelArchimateConnection | {
"repo_name": "archimatetool/archi",
"path": "com.archimatetool.model/src/com/archimatetool/model/util/ArchimateSwitch.java",
"license": "mit",
"size": 256079
} | [
"com.archimatetool.model.IDiagramModelArchimateConnection"
] | import com.archimatetool.model.IDiagramModelArchimateConnection; | import com.archimatetool.model.*; | [
"com.archimatetool.model"
] | com.archimatetool.model; | 2,036,879 |
public void setNavigationTransform(Matrix4f trans) {
implTrans.set(trans);
} | void function(Matrix4f trans) { implTrans.set(trans); } | /**
* Set a new transform for this viewpoint. Used to notify
* vp of navigation changes.
*
* @param trans The view transform
*/ | Set a new transform for this viewpoint. Used to notify vp of navigation changes | setNavigationTransform | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/web3d/vrml/renderer/ogl/nodes/navigation/OGLViewpoint.java",
"license": "gpl-2.0",
"size": 9994
} | [
"javax.vecmath.Matrix4f"
] | import javax.vecmath.Matrix4f; | import javax.vecmath.*; | [
"javax.vecmath"
] | javax.vecmath; | 1,414,162 |
private void updateUIWidgets() {
if (mAddressRequested) {
mProgressBar.setVisibility(ProgressBar.VISIBLE);
mFetchAddressButton.setEnabled(false);
} else {
mProgressBar.setVisibility(ProgressBar.GONE);
mFetchAddressButton.setEnabled(true);
}
} | void function() { if (mAddressRequested) { mProgressBar.setVisibility(ProgressBar.VISIBLE); mFetchAddressButton.setEnabled(false); } else { mProgressBar.setVisibility(ProgressBar.GONE); mFetchAddressButton.setEnabled(true); } } | /**
* Toggles the visibility of the progress bar. Enables or disables the Fetch Address button.
*/ | Toggles the visibility of the progress bar. Enables or disables the Fetch Address button | updateUIWidgets | {
"repo_name": "googlesamples/android-play-location",
"path": "LocationAddress/app/src/main/java/com/google/android/gms/location/sample/locationaddress/MainActivity.java",
"license": "apache-2.0",
"size": 16530
} | [
"android.widget.ProgressBar"
] | import android.widget.ProgressBar; | import android.widget.*; | [
"android.widget"
] | android.widget; | 1,634,785 |
public static boolean hasInput(ActionAnalysisMetadata action, String basename) {
try {
getInput(action, basename);
return true;
} catch (AssertionError e) {
return false;
}
} | static boolean function(ActionAnalysisMetadata action, String basename) { try { getInput(action, basename); return true; } catch (AssertionError e) { return false; } } | /**
* Returns true if an artifact that is an input to "action" with the specific
* basename exists.
*/ | Returns true if an artifact that is an input to "action" with the specific basename exists | hasInput | {
"repo_name": "aehlig/bazel",
"path": "src/test/java/com/google/devtools/build/lib/actions/util/ActionsTestUtil.java",
"license": "apache-2.0",
"size": 30948
} | [
"com.google.devtools.build.lib.actions.ActionAnalysisMetadata"
] | import com.google.devtools.build.lib.actions.ActionAnalysisMetadata; | import com.google.devtools.build.lib.actions.*; | [
"com.google.devtools"
] | com.google.devtools; | 965,038 |
public void setInterpreterCache(int version, Object toCache) {
if (interpCache == null)
// JMF_ENCODING_VERSION is always the latest version we support
interpCache = new Object[JMFRegistry.JMF_ENCODING_VERSION];
interpCache[version - 1] = toCache;
} | void function(int version, Object toCache) { if (interpCache == null) interpCache = new Object[JMFRegistry.JMF_ENCODING_VERSION]; interpCache[version - 1] = toCache; } | /**
* Set an entry in the interpreter Cache (indexed by JMF encoding version, of which the
* first is expected to be 1).
*
* @param version the JMF encoding version
* @param toCache the Object that the SchemaInterpreter wishes to cache
*/ | Set an entry in the interpreter Cache (indexed by JMF encoding version, of which the first is expected to be 1) | setInterpreterCache | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchema.java",
"license": "epl-1.0",
"size": 27045
} | [
"com.ibm.ws.sib.mfp.jmf.JMFRegistry"
] | import com.ibm.ws.sib.mfp.jmf.JMFRegistry; | import com.ibm.ws.sib.mfp.jmf.*; | [
"com.ibm.ws"
] | com.ibm.ws; | 2,644,452 |
@Test
public void testWriteMetadataMethod() {
final Instruction instruction =
Instructions.writeMetadata(metadata1, metadataMask1);
final Instructions.MetadataInstruction metadataInstruction =
checkAndConvert(instruction,
Instruction.Type.METADATA,
Instructions.MetadataInstruction.class);
assertThat(metadataInstruction.metadata(), is(metadata1));
assertThat(metadataInstruction.metadataMask(), is(metadataMask1));
} | void function() { final Instruction instruction = Instructions.writeMetadata(metadata1, metadataMask1); final Instructions.MetadataInstruction metadataInstruction = checkAndConvert(instruction, Instruction.Type.METADATA, Instructions.MetadataInstruction.class); assertThat(metadataInstruction.metadata(), is(metadata1)); assertThat(metadataInstruction.metadataMask(), is(metadataMask1)); } | /**
* Test the write metadata method.
*/ | Test the write metadata method | testWriteMetadataMethod | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "core/api/src/test/java/org/onosproject/net/flow/instructions/InstructionsTest.java",
"license": "apache-2.0",
"size": 53514
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import org.hamcrest.*; | [
"org.hamcrest"
] | org.hamcrest; | 2,252,399 |
public Mappable[] getAllMappables()
{
ArrayList listMessageList = new ArrayList();
Iterator iterator = entryList.iterator();
Object value;
while (iterator.hasNext()) {
value = iterator.next();
if (value instanceof Mappable) {
listMessageList.add(value);
}
}
return (Mappable[])listMessageList.toArray(new Mappable[0]);
} | Mappable[] function() { ArrayList listMessageList = new ArrayList(); Iterator iterator = entryList.iterator(); Object value; while (iterator.hasNext()) { value = iterator.next(); if (value instanceof Mappable) { listMessageList.add(value); } } return (Mappable[])listMessageList.toArray(new Mappable[0]); } | /**
* Returns all of the values that have the Mappable type, i.e., nested
* messages.
*/ | Returns all of the values that have the Mappable type, i.e., nested messages | getAllMappables | {
"repo_name": "ameybarve15/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/cache/data/ListMessage.java",
"license": "apache-2.0",
"size": 17666
} | [
"java.util.ArrayList",
"java.util.Iterator"
] | import java.util.ArrayList; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 292,431 |
public LanguagesList readList(File file) {
Document doc = new Document();
SAXBuilder builder = new SAXBuilder();
try {
doc = builder.build(file);
} catch (JDOMException | IOException e) {
e.printStackTrace();
}
return parseXML(doc);
}
// Be very careful with this. Back up all your configuration files before running, or they
// could be lost.
| LanguagesList function(File file) { Document doc = new Document(); SAXBuilder builder = new SAXBuilder(); try { doc = builder.build(file); } catch (JDOMException IOException e) { e.printStackTrace(); } return parseXML(doc); } | /**
* Parse an XML file, and generate a LanguagesList object from the data found inside.
* @param file File to write to.
* @return Populated language list.
*/ | Parse an XML file, and generate a LanguagesList object from the data found inside | readList | {
"repo_name": "samohtj/Source-Code-Line-Counter",
"path": "src/linecounter/LanguagesFileReader.java",
"license": "gpl-3.0",
"size": 3915
} | [
"java.io.File",
"java.io.IOException",
"org.jdom2.Document",
"org.jdom2.JDOMException",
"org.jdom2.input.SAXBuilder"
] | import java.io.File; import java.io.IOException; import org.jdom2.Document; import org.jdom2.JDOMException; import org.jdom2.input.SAXBuilder; | import java.io.*; import org.jdom2.*; import org.jdom2.input.*; | [
"java.io",
"org.jdom2",
"org.jdom2.input"
] | java.io; org.jdom2; org.jdom2.input; | 2,883,116 |
static ValueExtractor<LocalTime> timeValueExtractor() {
return ValidatingValueExtractor.<LocalTime>builder()
.setExtractor(jsonNode -> LocalTime.parse(jsonNode.textValue()))
.setValidator(JsonNode::isTextual)
.build();
} | static ValueExtractor<LocalTime> timeValueExtractor() { return ValidatingValueExtractor.<LocalTime>builder() .setExtractor(jsonNode -> LocalTime.parse(jsonNode.textValue())) .setValidator(JsonNode::isTextual) .build(); } | /**
* Extracts LocalTime from the JsonNode (ISO 8601 format string) if it is valid.
*
* <p>Throws {@link UnsupportedRowJsonException} if value is out of bounds.
*/ | Extracts LocalTime from the JsonNode (ISO 8601 format string) if it is valid. Throws <code>UnsupportedRowJsonException</code> if value is out of bounds | timeValueExtractor | {
"repo_name": "lukecwik/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonValueExtractors.java",
"license": "apache-2.0",
"size": 9399
} | [
"com.fasterxml.jackson.databind.JsonNode",
"java.time.LocalTime"
] | import com.fasterxml.jackson.databind.JsonNode; import java.time.LocalTime; | import com.fasterxml.jackson.databind.*; import java.time.*; | [
"com.fasterxml.jackson",
"java.time"
] | com.fasterxml.jackson; java.time; | 714,825 |
public int getUsersNumberOfDomain(String domainId) {
SilverTrace.info("admin", "AdminController.getUsersNumberOfDomain",
"root.MSG_GEN_ENTER_METHOD", "domainID = " + domainId);
try {
return getAdminService().getUsersNumberOfDomain(domainId);
} catch (Exception e) {
SilverTrace.error("admin", "AdminController.getUsersNumberOfDomain",
"admin.MSG_ERR_GET_ALL_DOMAINS", e);
return 0;
}
} | int function(String domainId) { SilverTrace.info("admin", STR, STR, STR + domainId); try { return getAdminService().getUsersNumberOfDomain(domainId); } catch (Exception e) { SilverTrace.error("admin", STR, STR, e); return 0; } } | /**
* Get number of the domain's users
*/ | Get number of the domain's users | getUsersNumberOfDomain | {
"repo_name": "NicolasEYSSERIC/Silverpeas-Core",
"path": "lib-core/src/main/java/com/stratelia/webactiv/beans/admin/AdminController.java",
"license": "agpl-3.0",
"size": 59799
} | [
"com.stratelia.silverpeas.silvertrace.SilverTrace",
"com.stratelia.webactiv.beans.admin.AdminReference"
] | import com.stratelia.silverpeas.silvertrace.SilverTrace; import com.stratelia.webactiv.beans.admin.AdminReference; | import com.stratelia.silverpeas.silvertrace.*; import com.stratelia.webactiv.beans.admin.*; | [
"com.stratelia.silverpeas",
"com.stratelia.webactiv"
] | com.stratelia.silverpeas; com.stratelia.webactiv; | 2,577,521 |
public static void startDeleteAll(ConversationQueryHandler handler, int token,
boolean deleteAll) {
synchronized (sDeletingThreadsLock) {
if (DELETEDEBUG) {
Log.v(TAG, "Conversation startDeleteAll sDeletingThreads: " +
sDeletingThreads);
}
if (sDeletingThreads) {
Log.e(TAG, "startDeleteAll already in the middle of a delete", new Exception());
}
sDeletingThreads = true;
String selection = deleteAll ? null : "locked=0";
QKSMSApp app = QKSMSApp.getApplication();
//app.getPduLoaderManager().clear();
//app.getThumbnailManager().clear();
handler.setDeleteToken(token);
handler.startDelete(token, new Long(-1), Threads.CONTENT_URI, selection, null);
}
}
public static class ConversationQueryHandler extends AsyncQueryHandler {
private int mDeleteToken;
public ConversationQueryHandler(ContentResolver cr) {
super(cr);
} | static void function(ConversationQueryHandler handler, int token, boolean deleteAll) { synchronized (sDeletingThreadsLock) { if (DELETEDEBUG) { Log.v(TAG, STR + sDeletingThreads); } if (sDeletingThreads) { Log.e(TAG, STR, new Exception()); } sDeletingThreads = true; String selection = deleteAll ? null : STR; QKSMSApp app = QKSMSApp.getApplication(); handler.setDeleteToken(token); handler.startDelete(token, new Long(-1), Threads.CONTENT_URI, selection, null); } } public static class ConversationQueryHandler extends AsyncQueryHandler { private int mDeleteToken; public ConversationQueryHandler(ContentResolver cr) { super(cr); } | /**
* Start deleting all conversations in the database.
*
* @param handler An AsyncQueryHandler that will receive onDeleteComplete
* upon completion of all conversations being deleted
* @param token The token that will be passed to onDeleteComplete
* @param deleteAll Delete the whole thread including locked messages
*/ | Start deleting all conversations in the database | startDeleteAll | {
"repo_name": "liuhuibin/qksms",
"path": "QKSMS/src/main/java/com/moez/QKSMS/data/Conversation.java",
"license": "gpl-3.0",
"size": 56425
} | [
"android.content.AsyncQueryHandler",
"android.content.ContentResolver",
"android.provider.Telephony",
"android.util.Log",
"com.moez.QKSMS"
] | import android.content.AsyncQueryHandler; import android.content.ContentResolver; import android.provider.Telephony; import android.util.Log; import com.moez.QKSMS; | import android.content.*; import android.provider.*; import android.util.*; import com.moez.*; | [
"android.content",
"android.provider",
"android.util",
"com.moez"
] | android.content; android.provider; android.util; com.moez; | 1,273,167 |
@Override
public INDArray create(double[] data, int[] shape, int[] stride, int offset) {
return new NDArray(data, shape, stride, offset);
} | INDArray function(double[] data, int[] shape, int[] stride, int offset) { return new NDArray(data, shape, stride, offset); } | /**
* Creates an ndarray with the specified shape
*
* @param data
* @param shape the shape of the ndarray
* @param stride the stride for the ndarray
* @param offset the offset of the ndarray
* @return the instance
*/ | Creates an ndarray with the specified shape | create | {
"repo_name": "phvu/nd4j",
"path": "nd4j-x86/src/main/java/org/nd4j/linalg/cpu/CpuNDArrayFactory.java",
"license": "apache-2.0",
"size": 14049
} | [
"org.nd4j.linalg.api.ndarray.INDArray"
] | import org.nd4j.linalg.api.ndarray.INDArray; | import org.nd4j.linalg.api.ndarray.*; | [
"org.nd4j.linalg"
] | org.nd4j.linalg; | 1,671,672 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } | /**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Handles the HTTP <code>POST</code> method | doPost | {
"repo_name": "AshishNamdev/bugBasket",
"path": "src/java/controller/BugInfo.java",
"license": "mpl-2.0",
"size": 4974
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 2,417,067 |
@Test
public void testGetDocumentProperties() {
System.out.println("GetDocumentProperties");
String name = "test_multi_pages.docx";
String storage = "";
String folder = "";
try {
DocumentPropertiesResponse result = wordsApi.GetDocumentProperties(name, storage, folder);
} catch (ApiException apiException) {
System.out.println("exp:" + apiException.getMessage());
assertNull(apiException);
}
} | void function() { System.out.println(STR); String name = STR; String storage = STRSTRexp:" + apiException.getMessage()); assertNull(apiException); } } | /**
* Test of GetDocumentProperties method, of class WordsApi.
*/ | Test of GetDocumentProperties method, of class WordsApi | testGetDocumentProperties | {
"repo_name": "asposewordscloud/Aspose.Words_Cloud_SDK_For_Java",
"path": "src/test/java/com/aspose/words/api/WordsApiTest.java",
"license": "mit",
"size": 42592
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,104,554 |
@NullSafe
default boolean remove(Row row) {
return Optional.ofNullable(row)
.map(this::indexOf)
.filter(index -> index > -1)
.map(this::removeRow)
.orElse(false);
}
/**
* Sets the {@link Object value} at the given {@link Row} and {@link Column} {@link Integer indexes}
* in this {@link Table}.
*
* @param rowIndex {@link Integer} value indicating the {@link Row} index.
* @param columnIndex {@link Integer} value indicating the {@link Column} index.
* @param value the {@link Object value} to set at the referenced {@link Row} and {@link Column}
* in this {@link Table}.
* @return the current {@link Object} value at the given {@link Row} and {@link Column}.
* @throws IndexOutOfBoundsException if either the {@link Row} or {@link Column} {@link Integer index} | default boolean remove(Row row) { return Optional.ofNullable(row) .map(this::indexOf) .filter(index -> index > -1) .map(this::removeRow) .orElse(false); } /** * Sets the {@link Object value} at the given {@link Row} and {@link Column} {@link Integer indexes} * in this {@link Table}. * * @param rowIndex {@link Integer} value indicating the {@link Row} index. * @param columnIndex {@link Integer} value indicating the {@link Column} index. * @param value the {@link Object value} to set at the referenced {@link Row} and {@link Column} * in this {@link Table}. * @return the current {@link Object} value at the given {@link Row} and {@link Column}. * @throws IndexOutOfBoundsException if either the {@link Row} or {@link Column} {@link Integer index} | /**
* Removes the given {@link Row} from this {@link Table}.
*
* @param row {@link Row} to remove.
* @return a boolean value indicating whether the given {@link Row} was successfully removed.
* @see org.cp.elements.data.struct.tabular.Row
* @see #indexOf(Row)
* @see #removeRow(int)
*/ | Removes the given <code>Row</code> from this <code>Table</code> | remove | {
"repo_name": "codeprimate-software/cp-elements",
"path": "src/main/java/org/cp/elements/data/struct/tabular/Table.java",
"license": "apache-2.0",
"size": 8931
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 1,775,322 |
public void setMultiplyRate (BigDecimal MultiplyRate); | void function (BigDecimal MultiplyRate); | /** Set Multiply Rate.
* Rate to multiple the source by to calculate the target.
*/ | Set Multiply Rate. Rate to multiple the source by to calculate the target | setMultiplyRate | {
"repo_name": "geneos/adempiere",
"path": "base/src/org/compiere/model/I_C_UOM_Conversion.java",
"license": "gpl-2.0",
"size": 5761
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,841,117 |
public void setTriggersMmeValue(String triggersMmeValue)
throws JNCException {
setTriggersMmeValue(new YangString(triggersMmeValue));
} | void function(String triggersMmeValue) throws JNCException { setTriggersMmeValue(new YangString(triggersMmeValue)); } | /**
* Sets the value for child leaf "triggers-mme",
* using a String value.
* @param triggersMmeValue used during instantiation.
*/ | Sets the value for child leaf "triggers-mme", using a String value | setTriggersMmeValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/csl/AgwCslOper.java",
"license": "apache-2.0",
"size": 28765
} | [
"com.tailf.jnc.YangString"
] | import com.tailf.jnc.YangString; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 2,648,852 |
public ServiceFuture<DiagnosticDetectorResponseInner> executeSiteDetectorAsync(String resourceGroupName, String siteName, String detectorName, String diagnosticCategory, final ServiceCallback<DiagnosticDetectorResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(executeSiteDetectorWithServiceResponseAsync(resourceGroupName, siteName, detectorName, diagnosticCategory), serviceCallback);
} | ServiceFuture<DiagnosticDetectorResponseInner> function(String resourceGroupName, String siteName, String detectorName, String diagnosticCategory, final ServiceCallback<DiagnosticDetectorResponseInner> serviceCallback) { return ServiceFuture.fromResponse(executeSiteDetectorWithServiceResponseAsync(resourceGroupName, siteName, detectorName, diagnosticCategory), serviceCallback); } | /**
* Execute Detector.
* Description for Execute Detector.
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param siteName Site Name
* @param detectorName Detector Resource Name
* @param diagnosticCategory Category Name
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Execute Detector. Description for Execute Detector | executeSiteDetectorAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/appservice/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/appservice/v2019_08_01/implementation/DiagnosticsInner.java",
"license": "mit",
"size": 278784
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,268,929 |
private Map<String, Set<String>> getAllowedPermissionsMap(SiteInfo site)
{
NodeRef nodeRef = site.getNodeRef();
return getAllowedPermissionsMap(nodeRef);
}
| Map<String, Set<String>> function(SiteInfo site) { NodeRef nodeRef = site.getNodeRef(); return getAllowedPermissionsMap(nodeRef); } | /**
* Gets the authorities and their allowed permissions for a site root
*/ | Gets the authorities and their allowed permissions for a site root | getAllowedPermissionsMap | {
"repo_name": "loftuxab/alfresco-community-loftux",
"path": "projects/repository/source/test-java/org/alfresco/repo/site/SiteServiceImplTest.java",
"license": "lgpl-3.0",
"size": 154784
} | [
"java.util.Map",
"java.util.Set",
"org.alfresco.service.cmr.repository.NodeRef",
"org.alfresco.service.cmr.site.SiteInfo"
] | import java.util.Map; import java.util.Set; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.site.SiteInfo; | import java.util.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.cmr.site.*; | [
"java.util",
"org.alfresco.service"
] | java.util; org.alfresco.service; | 2,883,364 |
@Test
public void testCloning() throws CloneNotSupportedException {
BarRenderer3D r1 = new BarRenderer3D();
BarRenderer3D r2 = (BarRenderer3D) r1.clone();
assertNotSame(r1, r2);
assertSame(r1.getClass(), r2.getClass());
assertEquals(r1, r2);
} | void function() throws CloneNotSupportedException { BarRenderer3D r1 = new BarRenderer3D(); BarRenderer3D r2 = (BarRenderer3D) r1.clone(); assertNotSame(r1, r2); assertSame(r1.getClass(), r2.getClass()); assertEquals(r1, r2); } | /**
* Confirm that cloning works.
*/ | Confirm that cloning works | testCloning | {
"repo_name": "akardapolov/ASH-Viewer",
"path": "jfreechart-fse/src/test/java/org/jfree/chart/renderer/category/BarRenderer3DTest.java",
"license": "gpl-3.0",
"size": 4998
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,661,240 |
@Override
public FudgeContext getFudgeContext() {
return _fudgeContext;
} | FudgeContext function() { return _fudgeContext; } | /**
* Gets the fudge context.
*
* @return the fudge context, not null
*/ | Gets the fudge context | getFudgeContext | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-LiveData/src/main/java/com/opengamma/livedata/client/CogdaLiveDataClient.java",
"license": "apache-2.0",
"size": 19405
} | [
"org.fudgemsg.FudgeContext"
] | import org.fudgemsg.FudgeContext; | import org.fudgemsg.*; | [
"org.fudgemsg"
] | org.fudgemsg; | 785,404 |
@Override
public synchronized void nextTwoBytes(int[] data, boolean bigEndian) {
//try to read audio data
int tmpRead = 0;
int numRead = 0;
try {
while (numRead < this.buf.length && tmpRead != -1) {
tmpRead = this.data.read(this.buf, numRead,
this.buf.length - numRead);
numRead += tmpRead;
}
} catch (IOException e) {
//this shouldn't happen if the bytes were written correctly to
//the temp file, but this sound should now be invalid at least
this.position = this.numBytesPerChannel;
System.err.println("Failed reading bytes for stream sound");
}
//copy the values into the caller buffer
if (bigEndian) {
//left
data[0] = ((this.buf[0] << 8) |
(this.buf[1] & 0xFF));
//right
data[1] = ((this.buf[2] << 8) |
(this.buf[3] & 0xFF));
}
else {
//left
data[0] = ((this.buf[1] << 8) |
(this.buf[0] & 0xFF));
//right
data[1] = ((this.buf[3] << 8) |
(this.buf[2] & 0xFF));
}
//increment the position appropriately
if (tmpRead == -1) { //reached end of file in the middle of reading
//this should never happen
this.position = this.numBytesPerChannel;
}
else {
this.position += 2;
}
//wrap if looping, stop otherwise
if (this.position >= this.numBytesPerChannel) {
if (this.loop) {
this.setPosition(this.loopPosition);
}
else {
this.playing = false;
}
}
} | synchronized void function(int[] data, boolean bigEndian) { int tmpRead = 0; int numRead = 0; try { while (numRead < this.buf.length && tmpRead != -1) { tmpRead = this.data.read(this.buf, numRead, this.buf.length - numRead); numRead += tmpRead; } } catch (IOException e) { this.position = this.numBytesPerChannel; System.err.println(STR); } if (bigEndian) { data[0] = ((this.buf[0] << 8) (this.buf[1] & 0xFF)); data[1] = ((this.buf[2] << 8) (this.buf[3] & 0xFF)); } else { data[0] = ((this.buf[1] << 8) (this.buf[0] & 0xFF)); data[1] = ((this.buf[3] << 8) (this.buf[2] & 0xFF)); } if (tmpRead == -1) { this.position = this.numBytesPerChannel; } else { this.position += 2; } if (this.position >= this.numBytesPerChannel) { if (this.loop) { this.setPosition(this.loopPosition); } else { this.playing = false; } } } | /**
* Get the next two bytes from the music data in the specified
* endianness.
* @param data length-2 array to write in next two bytes from each
* channel
* @param bigEndian true if the bytes should be read big-endian
*/ | Get the next two bytes from the music data in the specified endianness | nextTwoBytes | {
"repo_name": "TyrfingX/TyrLib",
"path": "com.tyrfing.games.tyrlib3.tinysound/src/com/tyrfing/games/tyrlib3/tinysound/internal/StreamMusic.java",
"license": "mit",
"size": 17805
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,353,610 |
public synchronized void fillFromList(List<TrackModel> tracks) {
// Clear all entries
mData.clear();
mOriginalList = tracks;
if (mIntelligenceFactor == 0) {
return;
}
LinkedHashMap<String, List<Integer>> hashMap = new LinkedHashMap<>();
if (tracks == null || tracks.isEmpty()) {
// Abort for empty data structures
return;
}
// Iterate over the list and add all tracks to their artist lists
int trackNo = 0;
for (TrackModel track : tracks) {
String artistName = track.getTrackArtistName();
List<Integer> list = hashMap.get(artistName);
if (list == null) {
// If artist is not already in HashMap add a new list for it
list = new ArrayList<>();
hashMap.put(artistName, list);
}
// Add pair of position in original playlist and track itself to artists bucket list
list.add(trackNo);
// Increase the track number (index) of the original playlist
trackNo++;
}
if (BuildConfig.DEBUG) {
Log.v(TAG, "Recreated buckets with: " + hashMap.size() + " artists");
}
mData.addAll(hashMap.values());
Collections.shuffle(mData);
} | synchronized void function(List<TrackModel> tracks) { mData.clear(); mOriginalList = tracks; if (mIntelligenceFactor == 0) { return; } LinkedHashMap<String, List<Integer>> hashMap = new LinkedHashMap<>(); if (tracks == null tracks.isEmpty()) { return; } int trackNo = 0; for (TrackModel track : tracks) { String artistName = track.getTrackArtistName(); List<Integer> list = hashMap.get(artistName); if (list == null) { list = new ArrayList<>(); hashMap.put(artistName, list); } list.add(trackNo); trackNo++; } if (BuildConfig.DEBUG) { Log.v(TAG, STR + hashMap.size() + STR); } mData.addAll(hashMap.values()); Collections.shuffle(mData); } | /**
* Creates a list of artists and their tracks with position in the original playlist
*
* @param tracks List of tracks
*/ | Creates a list of artists and their tracks with position in the original playlist | fillFromList | {
"repo_name": "gateship-one/odyssey",
"path": "app/src/main/java/org/gateshipone/odyssey/models/TrackRandomGenerator.java",
"license": "gpl-3.0",
"size": 9665
} | [
"android.util.Log",
"java.util.ArrayList",
"java.util.Collections",
"java.util.LinkedHashMap",
"java.util.List",
"org.gateshipone.odyssey.BuildConfig"
] | import android.util.Log; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import org.gateshipone.odyssey.BuildConfig; | import android.util.*; import java.util.*; import org.gateshipone.odyssey.*; | [
"android.util",
"java.util",
"org.gateshipone.odyssey"
] | android.util; java.util; org.gateshipone.odyssey; | 99,053 |
public static long incrementExact(final long n) throws MathRuntimeException {
if (n == Long.MAX_VALUE) {
throw new MathRuntimeException(LocalizedCoreFormats.OVERFLOW_IN_ADDITION, n, 1);
}
return n + 1;
} | static long function(final long n) throws MathRuntimeException { if (n == Long.MAX_VALUE) { throw new MathRuntimeException(LocalizedCoreFormats.OVERFLOW_IN_ADDITION, n, 1); } return n + 1; } | /** Increment a number, detecting overflows.
* @param n number to increment
* @return n+1 if no overflows occur
* @exception MathRuntimeException if an overflow occurs
*/ | Increment a number, detecting overflows | incrementExact | {
"repo_name": "sdinot/hipparchus",
"path": "hipparchus-core/src/main/java/org/hipparchus/util/FastMath.java",
"license": "apache-2.0",
"size": 173587
} | [
"org.hipparchus.exception.LocalizedCoreFormats",
"org.hipparchus.exception.MathRuntimeException"
] | import org.hipparchus.exception.LocalizedCoreFormats; import org.hipparchus.exception.MathRuntimeException; | import org.hipparchus.exception.*; | [
"org.hipparchus.exception"
] | org.hipparchus.exception; | 1,221,287 |
public static <T> Node<T> searchWithShiftLeft(
BiDirectionalNullTerminatedTailedLinkedList<T> l, T x) {
for (Node<T> p = l.getHead().getNext(); p != l.getTail(); p = p
.getNext()) {
if (x.equals(p.getData())) {
// We found element that match
// 1. Remove this element from linked list
T e = l.delete(p);
l.push(e);
// The first element is the successful tested element
return l.getHead().getNext();
}
}
return null;
} | static <T> Node<T> function( BiDirectionalNullTerminatedTailedLinkedList<T> l, T x) { for (Node<T> p = l.getHead().getNext(); p != l.getTail(); p = p .getNext()) { if (x.equals(p.getData())) { T e = l.delete(p); l.push(e); return l.getHead().getNext(); } } return null; } | /**
* Sequential search algorithm for unordered data in linked list moving
* successful tested element in the beginning of the list.
*
* @param l
* @param x
* @param <T>
* @return
*/ | Sequential search algorithm for unordered data in linked list moving successful tested element in the beginning of the list | searchWithShiftLeft | {
"repo_name": "dzhemriza/fsola",
"path": "src/main/java/org/fsola/searching/SequentialSearch.java",
"license": "apache-2.0",
"size": 4759
} | [
"org.fsola.datastructures.linkedlist.BiDirectionalNullTerminatedTailedLinkedList"
] | import org.fsola.datastructures.linkedlist.BiDirectionalNullTerminatedTailedLinkedList; | import org.fsola.datastructures.linkedlist.*; | [
"org.fsola.datastructures"
] | org.fsola.datastructures; | 2,439,384 |
jLabel1 = new javax.swing.JLabel();
tfUsuario = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
Senha = new javax.swing.JLabel();
btAcessar = new javax.swing.JButton();
btSair = new javax.swing.JButton();
pfSenha = new javax.swing.JPasswordField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Acessar o Sistema");
jLabel2.setText("Login:");
Senha.setText("Senha:"); | jLabel1 = new javax.swing.JLabel(); tfUsuario = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); Senha = new javax.swing.JLabel(); btAcessar = new javax.swing.JButton(); btSair = new javax.swing.JButton(); pfSenha = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setText(STR); jLabel2.setText(STR); Senha.setText(STR); | /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. regenerated by the Form Editor | initComponents | {
"repo_name": "ifes-ci/Trabalhos2016-POO1",
"path": "SystemVP-Rafael-Roger/src/views/FrmTelaLogin.java",
"license": "gpl-3.0",
"size": 8566
} | [
"javax.swing.JPasswordField"
] | import javax.swing.JPasswordField; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 218,167 |
@Test
public void testTypedRuleFail1() throws IOException {
assertEqual("typedRuleFail1", ErrorCodes.TYPE_CONSISTENCY);
} | void function() throws IOException { assertEqual(STR, ErrorCodes.TYPE_CONSISTENCY); } | /**
* Tests typed rules failing due to an incompatible return type.
*
* @throws IOException should not occur
*/ | Tests typed rules failing due to an incompatible return type | testTypedRuleFail1 | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/Instantiation/de.uni_hildesheim.sse.vil.buildlang.tests/src/test/de/uni_hildesheim/sse/vil/buildlang/BasicTests.java",
"license": "apache-2.0",
"size": 16990
} | [
"java.io.IOException",
"net.ssehub.easy.dslCore.translation.ErrorCodes"
] | import java.io.IOException; import net.ssehub.easy.dslCore.translation.ErrorCodes; | import java.io.*; import net.ssehub.easy.*; | [
"java.io",
"net.ssehub.easy"
] | java.io; net.ssehub.easy; | 2,313,826 |
public ClassReferenceMirror[] getGenerics() {
return Arrays.copyOf(genericParameters, genericParameters.length);
} | ClassReferenceMirror[] function() { return Arrays.copyOf(genericParameters, genericParameters.length); } | /**
* Returns the generic parameters that this reference was declared with.
* @return
*/ | Returns the generic parameters that this reference was declared with | getGenerics | {
"repo_name": "sk89q/CommandHelper",
"path": "src/main/java/com/laytonsmith/PureUtilities/ClassLoading/ClassMirror/ClassReferenceMirror.java",
"license": "mit",
"size": 7303
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 2,705,059 |
@Test
public void removeAuthorsTest() {
Cookie cookieSessionId = login(username, password);
AuthorDetailDTO authors = new AuthorDetailDTO(oraculo.get(0));
Response response = target.path(authors.getId().toString())
.request().cookie(cookieSessionId).delete();
Assert.assertEquals(OkWithoutContent, response.getStatus());
} | void function() { Cookie cookieSessionId = login(username, password); AuthorDetailDTO authors = new AuthorDetailDTO(oraculo.get(0)); Response response = target.path(authors.getId().toString()) .request().cookie(cookieSessionId).delete(); Assert.assertEquals(OkWithoutContent, response.getStatus()); } | /**
* Prueba para desasociar un Authors existente de un Book existente
*
* @generated
*/ | Prueba para desasociar un Authors existente de un Book existente | removeAuthorsTest | {
"repo_name": "diegofruizs/book",
"path": "book-api/src/test/java/co/edu/uniandes/csw/book/tests/rest/BookAuthorsTest.java",
"license": "mit",
"size": 9720
} | [
"co.edu.uniandes.csw.book.dtos.detail.AuthorDetailDTO",
"javax.ws.rs.core.Cookie",
"javax.ws.rs.core.Response",
"org.junit.Assert"
] | import co.edu.uniandes.csw.book.dtos.detail.AuthorDetailDTO; import javax.ws.rs.core.Cookie; import javax.ws.rs.core.Response; import org.junit.Assert; | import co.edu.uniandes.csw.book.dtos.detail.*; import javax.ws.rs.core.*; import org.junit.*; | [
"co.edu.uniandes",
"javax.ws",
"org.junit"
] | co.edu.uniandes; javax.ws; org.junit; | 874,002 |
public void show(IBinder windowToken, int touchX, int touchY) {
WindowManager.LayoutParams lp;
int pixelFormat;
pixelFormat = PixelFormat.TRANSLUCENT;
lp = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT,
touchX-mRegistrationX, touchY-mRegistrationY,
WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
,
pixelFormat);
// lp.token = mStatusBarView.getWindowToken();
lp.gravity = Gravity.LEFT | Gravity.TOP;
lp.token = windowToken;
lp.setTitle("DragView");
mLayoutParams = lp;
mWindowManager.addView(this, lp);
} | void function(IBinder windowToken, int touchX, int touchY) { WindowManager.LayoutParams lp; int pixelFormat; pixelFormat = PixelFormat.TRANSLUCENT; lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, touchX-mRegistrationX, touchY-mRegistrationY, WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS , pixelFormat); lp.gravity = Gravity.LEFT Gravity.TOP; lp.token = windowToken; lp.setTitle(STR); mLayoutParams = lp; mWindowManager.addView(this, lp); } | /**
* Create a window containing this view and show it.
*
* @param windowToken obtained from v.getWindowToken() from one of your views
* @param touchX the x coordinate the user touched in screen coordinates
* @param touchY the y coordinate the user touched in screen coordinates
*/ | Create a window containing this view and show it | show | {
"repo_name": "MicroHealthLLC/My-PHR",
"path": "android/Source/src/com/micro/health/family/health/record/dragdropfamily/DragView.java",
"license": "agpl-3.0",
"size": 6482
} | [
"android.graphics.PixelFormat",
"android.os.IBinder",
"android.view.Gravity",
"android.view.ViewGroup",
"android.view.WindowManager"
] | import android.graphics.PixelFormat; import android.os.IBinder; import android.view.Gravity; import android.view.ViewGroup; import android.view.WindowManager; | import android.graphics.*; import android.os.*; import android.view.*; | [
"android.graphics",
"android.os",
"android.view"
] | android.graphics; android.os; android.view; | 2,462,151 |
public static synchronized void warning(String... message)
{
Check.notNull(message);
if (LEVELS.contains(WARNING))
{
LOGGER.logp(Level.WARNING, null, null, getMessage(message));
}
}
| static synchronized void function(String... message) { Check.notNull(message); if (LEVELS.contains(WARNING)) { LOGGER.logp(Level.WARNING, null, null, getMessage(message)); } } | /**
* Display a check verbose message to error output.
*
* @param message The list of messages (must not be <code>null</code>).
* @see Verbose#WARNING
*/ | Display a check verbose message to error output | warning | {
"repo_name": "b3dgs/lionengine",
"path": "lionengine-core/src/main/java/com/b3dgs/lionengine/Verbose.java",
"license": "gpl-3.0",
"size": 7427
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 539,441 |
public CoinbaseTransaction getCoinbaseTransaction(final String transactionIdOrIdemField) throws IOException {
final CoinbaseTransaction transaction = coinbase.getTransactionDetails(transactionIdOrIdemField, exchangeSpecification.getApiKey(), signatureCreator, getNonce());
return handleResponse(transaction);
} | CoinbaseTransaction function(final String transactionIdOrIdemField) throws IOException { final CoinbaseTransaction transaction = coinbase.getTransactionDetails(transactionIdOrIdemField, exchangeSpecification.getApiKey(), signatureCreator, getNonce()); return handleResponse(transaction); } | /**
* Authenticated resource which returns the details of an individual transaction.
*
* @see <a href="https://coinbase.com/api/doc/1.0/transactions/show.html">coinbase.com/api/doc/1.0/transactions/show.html</a>
* @param transactionIdOrIdemField
* @return
* @throws IOException
*/ | Authenticated resource which returns the details of an individual transaction | getCoinbaseTransaction | {
"repo_name": "habibmasuro/XChange",
"path": "xchange-coinbase/src/main/java/com/xeiam/xchange/coinbase/service/polling/CoinbaseAccountServiceRaw.java",
"license": "mit",
"size": 27451
} | [
"com.xeiam.xchange.coinbase.dto.account.CoinbaseTransaction",
"java.io.IOException"
] | import com.xeiam.xchange.coinbase.dto.account.CoinbaseTransaction; import java.io.IOException; | import com.xeiam.xchange.coinbase.dto.account.*; import java.io.*; | [
"com.xeiam.xchange",
"java.io"
] | com.xeiam.xchange; java.io; | 27,952 |
public LNode getNode() {
assert nodes.length == 1;
return nodes[0];
}
/**
* {@inheritDoc} | LNode function() { assert nodes.length == 1; return nodes[0]; } /** * {@inheritDoc} | /**
* Returns the contained node. This may only be used for node groups with exactly one node.
*
* @return the contained node
*/ | Returns the contained node. This may only be used for node groups with exactly one node | getNode | {
"repo_name": "ExplorViz/ExplorViz",
"path": "src-external/de/cau/cs/kieler/klay/layered/p3order/NodeGroup.java",
"license": "apache-2.0",
"size": 7951
} | [
"de.cau.cs.kieler.klay.layered.graph.LNode"
] | import de.cau.cs.kieler.klay.layered.graph.LNode; | import de.cau.cs.kieler.klay.layered.graph.*; | [
"de.cau.cs"
] | de.cau.cs; | 893,456 |
this.startDate = startDate;
setDateRange(ds, Tags.PPSStartDate, startDate );
} | this.startDate = startDate; setDateRange(ds, Tags.PPSStartDate, startDate ); } | /**
* Set the start date.
* <p>
* Set both <code>startDate and startDateAsLong</code>.<br>
* If the parameter is null or empty, both values are set to <code>null</code>
*
* @param startDate The start Date to set.
* @throws ParseException
*/ | Set the start date. Set both <code>startDate and startDateAsLong</code>. If the parameter is null or empty, both values are set to <code>null</code> | setStartDate | {
"repo_name": "medicayun/medicayundicom",
"path": "dcm4jboss-all/tags/DCM4CHEE_2_14_2_TAGA/dcm4jboss-web/src/java/org/dcm4chex/archive/web/maverick/mpps/MPPSFilter.java",
"license": "apache-2.0",
"size": 5067
} | [
"org.dcm4che.dict.Tags"
] | import org.dcm4che.dict.Tags; | import org.dcm4che.dict.*; | [
"org.dcm4che.dict"
] | org.dcm4che.dict; | 1,197,473 |
public Record createEditedRecord() {
// Load variables.
EditText recordName = (EditText) findViewById(R.id.recordName);
EditText recordComment = (EditText) findViewById(R.id.recordComment);
// Convert variables.
String name = recordName.getText().toString();
String comment = recordComment.getText().toString();
Date date = record.getDate();
// Name is required to be entered.
if (!name.isEmpty() && !name.trim().equals("")) {
// Create new record, set its comment and fields.
Record newRecord = new Record(name, date);
newRecord.setComment(comment);
newRecord.setFields(fields);
return newRecord;
} else {
// If no name is entered, refuse to continue.
recordName.setError("Name entry is required!");
return null;
}
} | Record function() { EditText recordName = (EditText) findViewById(R.id.recordName); EditText recordComment = (EditText) findViewById(R.id.recordComment); String name = recordName.getText().toString(); String comment = recordComment.getText().toString(); Date date = record.getDate(); if (!name.isEmpty() && !name.trim().equals(STRName entry is required!"); return null; } } | /**
* Loads variables from user input, converts them into the format used in the model SizeBook,
* and returns it in the form of a Record.
*/ | Loads variables from user input, converts them into the format used in the model SizeBook, and returns it in the form of a Record | createEditedRecord | {
"repo_name": "nyitrch/nyitrai-SizeBook",
"path": "app/src/main/java/com/ualberta/nyitrai/nyitrai_sizebook/SizeBookEditRecordActivity.java",
"license": "apache-2.0",
"size": 9231
} | [
"android.widget.EditText",
"java.util.Date"
] | import android.widget.EditText; import java.util.Date; | import android.widget.*; import java.util.*; | [
"android.widget",
"java.util"
] | android.widget; java.util; | 725,199 |
@Override
public Class<? extends UIComponent> getJavaClass(FacesInstance instance) {
return getClass();
} | Class<? extends UIComponent> function(FacesInstance instance) { return getClass(); } | /**
* A component can implement FacesDefinitionClass to instruct the compiler
* to use a different class. We stop it here the Data Iterator implementation.
* A basic data iterator uses this to either crate the component that
* creates the controls at load time, or iterate them dynamically at runtime.
*/ | A component can implement FacesDefinitionClass to instruct the compiler to use a different class. We stop it here the Data Iterator implementation. A basic data iterator uses this to either crate the component that creates the controls at load time, or iterate them dynamically at runtime | getJavaClass | {
"repo_name": "jesse-gallagher/XPagesExtensionLibrary",
"path": "extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.controls/src/com/ibm/xsp/extlib/component/data/UIDataSourceIterator.java",
"license": "apache-2.0",
"size": 19898
} | [
"com.ibm.xsp.page.parse.types.FacesInstance",
"javax.faces.component.UIComponent"
] | import com.ibm.xsp.page.parse.types.FacesInstance; import javax.faces.component.UIComponent; | import com.ibm.xsp.page.parse.types.*; import javax.faces.component.*; | [
"com.ibm.xsp",
"javax.faces"
] | com.ibm.xsp; javax.faces; | 2,564,252 |
public void setBlobMetadata(Map<String, String> blobMetadata) {
this.blobMetadata = blobMetadata;
} | void function(Map<String, String> blobMetadata) { this.blobMetadata = blobMetadata; } | /**
* Set the blob meta-data
*/ | Set the blob meta-data | setBlobMetadata | {
"repo_name": "DariusX/camel",
"path": "components/camel-azure/src/main/java/org/apache/camel/component/azure/blob/BlobServiceConfiguration.java",
"license": "apache-2.0",
"size": 7007
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 844,572 |
public Date getDate()
{
return revDate;
} | Date function() { return revDate; } | /**
* Returns the date of the revision
* @return the date
*/ | Returns the date of the revision | getDate | {
"repo_name": "centic9/subversion-ppa",
"path": "subversion/bindings/javahl/src/org/apache/subversion/javahl/types/Revision.java",
"license": "apache-2.0",
"size": 9963
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 952,715 |
public void exitExact_numeric_type(SQLParser.Exact_numeric_typeContext ctx) { } | public void exitExact_numeric_type(SQLParser.Exact_numeric_typeContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterExact_numeric_type | {
"repo_name": "HEIG-GAPS/slasher",
"path": "slasher.corrector/src/main/java/ch/gaps/slasher/corrector/SQLParserBaseListener.java",
"license": "mit",
"size": 73849
} | [
"ch.gaps.slasher.corrector.SQLParser"
] | import ch.gaps.slasher.corrector.SQLParser; | import ch.gaps.slasher.corrector.*; | [
"ch.gaps.slasher"
] | ch.gaps.slasher; | 761,091 |
options = provider.getStore(config);
// if necessary, deprecate and replace options from persistent store
for (final Entry<String, OptionValue> option : options) {
final String name = option.getKey();
final OptionValidator validator = VALIDATORS.get(name);
if (validator == null) {
// deprecated option, delete.
options.delete(name);
logger.warn("Deleting deprecated option `{}`", name);
} else {
final String canonicalName = validator.getOptionName().toLowerCase();
if (!name.equals(canonicalName)) {
// for backwards compatibility <= 1.1, rename to lower case.
logger.warn("Changing option name to lower case `{}`", name);
final OptionValue value = option.getValue();
options.delete(name);
options.put(canonicalName, value);
}
}
}
return this;
} | options = provider.getStore(config); for (final Entry<String, OptionValue> option : options) { final String name = option.getKey(); final OptionValidator validator = VALIDATORS.get(name); if (validator == null) { options.delete(name); logger.warn(STR, name); } else { final String canonicalName = validator.getOptionName().toLowerCase(); if (!name.equals(canonicalName)) { logger.warn(STR, name); final OptionValue value = option.getValue(); options.delete(name); options.put(canonicalName, value); } } } return this; } | /**
* Initializes this option manager.
*
* @return this option manager
* @throws IOException
*/ | Initializes this option manager | init | {
"repo_name": "hnfgns/incubator-drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/server/options/SystemOptionManager.java",
"license": "apache-2.0",
"size": 10742
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 429,682 |
public Resource assignReservedContainer(FSSchedulerNode node) {
RMContainer rmContainer = node.getReservedContainer();
Priority priority = rmContainer.getReservedPriority();
// Make sure the application still needs requests at this priority
if (app.getTotalRequiredResources(priority) == 0) {
unreserve(priority, node);
return Resources.none();
}
// Fail early if the reserved container won't fit.
// Note that we have an assumption here that there's only one container size
// per priority.
if (!Resources.fitsIn(node.getReservedContainer().getReservedResource(),
node.getAvailableResource())) {
return Resources.none();
}
return assignContainer(node, true);
} | Resource function(FSSchedulerNode node) { RMContainer rmContainer = node.getReservedContainer(); Priority priority = rmContainer.getReservedPriority(); if (app.getTotalRequiredResources(priority) == 0) { unreserve(priority, node); return Resources.none(); } if (!Resources.fitsIn(node.getReservedContainer().getReservedResource(), node.getAvailableResource())) { return Resources.none(); } return assignContainer(node, true); } | /**
* Called when this application already has an existing reservation on the
* given node. Sees whether we can turn the reservation into an allocation.
* Also checks whether the application needs the reservation anymore, and
* releases it if not.
*
* @param node
* Node that the application has an existing reservation on
*/ | Called when this application already has an existing reservation on the given node. Sees whether we can turn the reservation into an allocation. Also checks whether the application needs the reservation anymore, and releases it if not | assignReservedContainer | {
"repo_name": "yelshater/hadoop-2.3.0",
"path": "hadoop-yarn-server-resourcemanager-2.3.0-cdh5.1.0/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/AppSchedulable.java",
"license": "apache-2.0",
"size": 15459
} | [
"org.apache.hadoop.yarn.api.records.Priority",
"org.apache.hadoop.yarn.api.records.Resource",
"org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer",
"org.apache.hadoop.yarn.util.resource.Resources"
] | import org.apache.hadoop.yarn.api.records.Priority; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.util.resource.Resources; | import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.*; import org.apache.hadoop.yarn.util.resource.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,274,409 |
public static int getPreferredColumnWidth(JTable table, int columnIndex)
{
final TableColumn col = table.getColumnModel().getColumn(columnIndex);
int width = 0;
TableCellRenderer renderer = col.getHeaderRenderer();
if (renderer == null)
renderer = table.getTableHeader().getDefaultRenderer();
Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0);
width = comp.getPreferredSize().width;
// Get maximum width of column data
for (int r = 0; r < table.getRowCount(); r++)
{
renderer = table.getCellRenderer(r, columnIndex);
comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, columnIndex), false, false, r, columnIndex);
width = Math.max(width, comp.getPreferredSize().width);
}
return width;
} | static int function(JTable table, int columnIndex) { final TableColumn col = table.getColumnModel().getColumn(columnIndex); int width = 0; TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) renderer = table.getTableHeader().getDefaultRenderer(); Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); width = comp.getPreferredSize().width; for (int r = 0; r < table.getRowCount(); r++) { renderer = table.getCellRenderer(r, columnIndex); comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, columnIndex), false, false, r, columnIndex); width = Math.max(width, comp.getPreferredSize().width); } return width; } | /**
* Get the preferred width of a column.
*
* @param table - the table to process
* @param columnIndex - the index of the requested column
*
* @return The preferred width of the column.
*/ | Get the preferred width of a column | getPreferredColumnWidth | {
"repo_name": "selfbus/development-tools",
"path": "lpc-debugger/src/main/java/selfbus/debugger/gui/table/TableUtils.java",
"license": "gpl-3.0",
"size": 3670
} | [
"java.awt.Component",
"javax.swing.JTable",
"javax.swing.table.TableCellRenderer",
"javax.swing.table.TableColumn"
] | import java.awt.Component; import javax.swing.JTable; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; | import java.awt.*; import javax.swing.*; import javax.swing.table.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,072,387 |
//-----------------------------------------------------------------------
public final MetaProperty<ManageableLegalEntity> legalEntity() {
return _legalEntity;
} | final MetaProperty<ManageableLegalEntity> function() { return _legalEntity; } | /**
* The meta-property for the {@code legalEntity} property.
* @return the meta-property, not null
*/ | The meta-property for the legalEntity property | legalEntity | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Master/src/main/java/com/opengamma/master/legalentity/LegalEntityDocument.java",
"license": "apache-2.0",
"size": 9174
} | [
"org.joda.beans.MetaProperty"
] | import org.joda.beans.MetaProperty; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 1,265,825 |
protected boolean[] canHandleMissing(boolean nominalPredictor,
boolean numericPredictor, boolean stringPredictor, boolean datePredictor,
boolean relationalPredictor, boolean multiInstance,
boolean predictorMissing, int missingLevel) {
if (missingLevel == 100) {
print("100% ");
}
print("missing");
if (predictorMissing) {
print(" predictor");
}
print(" values");
printAttributeSummary(nominalPredictor, numericPredictor, stringPredictor,
datePredictor, relationalPredictor, multiInstance);
print("...");
Vector<String> accepts = new Vector<String>();
accepts.addElement("missing");
accepts.addElement("value");
accepts.addElement("train");
int numTrain = getNumInstances();
return runBasicTest(nominalPredictor, numericPredictor, stringPredictor,
datePredictor, relationalPredictor, multiInstance, missingLevel,
predictorMissing, numTrain, accepts);
} | boolean[] function(boolean nominalPredictor, boolean numericPredictor, boolean stringPredictor, boolean datePredictor, boolean relationalPredictor, boolean multiInstance, boolean predictorMissing, int missingLevel) { if (missingLevel == 100) { print(STR); } print(STR); if (predictorMissing) { print(STR); } print(STR); printAttributeSummary(nominalPredictor, numericPredictor, stringPredictor, datePredictor, relationalPredictor, multiInstance); print("..."); Vector<String> accepts = new Vector<String>(); accepts.addElement(STR); accepts.addElement("value"); accepts.addElement("train"); int numTrain = getNumInstances(); return runBasicTest(nominalPredictor, numericPredictor, stringPredictor, datePredictor, relationalPredictor, multiInstance, missingLevel, predictorMissing, numTrain, accepts); } | /**
* Checks basic missing value handling of the scheme. If the missing values
* cause an exception to be thrown by the scheme, this will be recorded.
*
* @param nominalPredictor if true use nominal predictor attributes
* @param numericPredictor if true use numeric predictor attributes
* @param stringPredictor if true use string predictor attributes
* @param datePredictor if true use date predictor attributes
* @param relationalPredictor if true use relational predictor attributes
* @param multiInstance whether multi-instance is needed
* @param predictorMissing true if the missing values may be in the predictors
* @param missingLevel the percentage of missing values
* @return index 0 is true if the test was passed, index 1 is true if test was
* acceptable
*/ | Checks basic missing value handling of the scheme. If the missing values cause an exception to be thrown by the scheme, this will be recorded | canHandleMissing | {
"repo_name": "ahmedvc/umple",
"path": "Umplificator/UmplifiedProjects/weka-umplified-0/src/main/java/weka/clusterers/CheckClusterer.java",
"license": "mit",
"size": 43260
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 1,535,239 |
@NonNull
public MultiColor getTemporaryValue (@NonNull String preferenceValue) {
return getValue(preferenceValue);
} | MultiColor function (@NonNull String preferenceValue) { return getValue(preferenceValue); } | /**
* Converts a String preference value representing a MultiColor into a MultiColor instance,
* based on this Definition.
*
* @param preferenceValue A String preference value that can be converted to a MultiColor.
* @return A new MultiColor, evaluated for this definition and the given preference value.
* @deprecated A temporary value is no longer used. Use {@link #getValue(String)} instead.
*/ | Converts a String preference value representing a MultiColor into a MultiColor instance, based on this Definition | getTemporaryValue | {
"repo_name": "CypherCove/CovePrefs",
"path": "coveprefs/src/main/java/com/cyphercove/coveprefs/utils/MultiColor.java",
"license": "apache-2.0",
"size": 17883
} | [
"androidx.annotation.NonNull"
] | import androidx.annotation.NonNull; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 2,605,119 |
static boolean isObjectLitKey(Node node, Node parent) {
switch (node.getType()) {
case Token.STRING:
return parent.getType() == Token.OBJECTLIT;
case Token.GET:
case Token.SET:
return true;
}
return false;
} | static boolean isObjectLitKey(Node node, Node parent) { switch (node.getType()) { case Token.STRING: return parent.getType() == Token.OBJECTLIT; case Token.GET: case Token.SET: return true; } return false; } | /**
* Determines whether a node represents an object literal key
* (e.g. key1 in {key1: value1, key2: value2}).
*
* @param node A node
* @param parent The node's parent
*/ | Determines whether a node represents an object literal key (e.g. key1 in {key1: value1, key2: value2}) | isObjectLitKey | {
"repo_name": "nuxleus/closure-compiler",
"path": "src/com/google/javascript/jscomp/NodeUtil.java",
"license": "apache-2.0",
"size": 89782
} | [
"com.google.javascript.rhino.Node",
"com.google.javascript.rhino.Token"
] | import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 193,544 |
public Long append(long timestamp, byte[] key, byte[] value) {
return append(timestamp, wrapNullable(key), wrapNullable(value), Record.EMPTY_HEADERS);
} | Long function(long timestamp, byte[] key, byte[] value) { return append(timestamp, wrapNullable(key), wrapNullable(value), Record.EMPTY_HEADERS); } | /**
* Append a new record at the next sequential offset.
* @param timestamp The record timestamp
* @param key The record key
* @param value The record value
* @return CRC of the record or null if record-level CRC is not supported for the message format
*/ | Append a new record at the next sequential offset | append | {
"repo_name": "airbnb/kafka",
"path": "clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java",
"license": "apache-2.0",
"size": 34059
} | [
"org.apache.kafka.common.utils.Utils"
] | import org.apache.kafka.common.utils.Utils; | import org.apache.kafka.common.utils.*; | [
"org.apache.kafka"
] | org.apache.kafka; | 2,734,125 |
public final Resource currentResource(String resourcePath) {
if (resourcePath != null) {
Resource resource = resourceResolver().getResource(resourcePath);
if (resource == null) {
throw new IllegalArgumentException("Resource does not exist: " + resourcePath);
}
return currentResource(resource);
} else {
return currentResource((Resource) null);
}
} | final Resource function(String resourcePath) { if (resourcePath != null) { Resource resource = resourceResolver().getResource(resourcePath); if (resource == null) { throw new IllegalArgumentException(STR + resourcePath); } return currentResource(resource); } else { return currentResource((Resource) null); } } | /**
* Set current resource in request.
* @param resourcePath Resource path
* @return Current resource
*/ | Set current resource in request | currentResource | {
"repo_name": "tteofili/sling",
"path": "testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java",
"license": "apache-2.0",
"size": 14007
} | [
"org.apache.sling.api.resource.Resource"
] | import org.apache.sling.api.resource.Resource; | import org.apache.sling.api.resource.*; | [
"org.apache.sling"
] | org.apache.sling; | 287,232 |
public void setAffine(AffineTransform affine) {
touch();
this.affine = affine;
try {
invAffine = affine.createInverse();
} catch (NoninvertibleTransformException e) {
invAffine = null;
}
} | void function(AffineTransform affine) { touch(); this.affine = affine; try { invAffine = affine.createInverse(); } catch (NoninvertibleTransformException e) { invAffine = null; } } | /**
* Set the affine transform.
* @param affine the new Affine transform to apply.
*/ | Set the affine transform | setAffine | {
"repo_name": "adufilie/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/renderable/AffineRable8Bit.java",
"license": "apache-2.0",
"size": 4748
} | [
"java.awt.geom.AffineTransform",
"java.awt.geom.NoninvertibleTransformException"
] | import java.awt.geom.AffineTransform; import java.awt.geom.NoninvertibleTransformException; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 568,458 |
@Deprecated
public String getRepoInfo(Cluster cluster, ServiceComponent component, Host host) throws SystemException {
final JsonArray jsonList = getBaseUrls(cluster, component, host);
final RepositoryVersionEntity rve = getRepositoryVersionEntity(cluster, component);
if (null == rve || null == jsonList) {
return "";
}
final JsonArray result = new JsonArray();
for (JsonElement e : jsonList) {
JsonObject obj = e.getAsJsonObject();
String repoId = obj.has("repoId") ? obj.get("repoId").getAsString() : null;
String repoName = obj.has("repoName") ? obj.get("repoName").getAsString() : null;
String baseUrl = obj.has("baseUrl") ? obj.get("baseUrl").getAsString() : null;
String osType = obj.has("osType") ? obj.get("osType").getAsString() : null;
if (null == repoId || null == baseUrl || null == osType || null == repoName) {
continue;
}
for (OperatingSystemEntity ose : rve.getOperatingSystems()) {
if (ose.getOsType().equals(osType) && ose.isAmbariManagedRepos()) {
for (RepositoryEntity re : ose.getRepositories()) {
if (re.getName().equals(repoName) &&
!re.getBaseUrl().equals(baseUrl)) {
obj.addProperty("baseUrl", re.getBaseUrl());
}
}
result.add(e);
}
}
}
return result.toString();
}
/**
* Executed by two different representations of repos. When we are comfortable with the new
* implementation, this may be removed and called inline in {@link #getCommandRepository(Cluster, ServiceComponent, Host)} | String function(Cluster cluster, ServiceComponent component, Host host) throws SystemException { final JsonArray jsonList = getBaseUrls(cluster, component, host); final RepositoryVersionEntity rve = getRepositoryVersionEntity(cluster, component); if (null == rve null == jsonList) { return STRrepoIdSTRrepoIdSTRrepoNameSTRrepoNameSTRbaseUrlSTRbaseUrlSTRosTypeSTRosTypeSTRbaseUrl", re.getBaseUrl()); } } result.add(e); } } } return result.toString(); } /** * Executed by two different representations of repos. When we are comfortable with the new * implementation, this may be removed and called inline in {@link #getCommandRepository(Cluster, ServiceComponent, Host)} | /**
* Get repository info given a cluster and host.
*
* @param cluster the cluster
* @param host the host
*
* @return the repo info
*
* @deprecated use {@link #getCommandRepository(Cluster, ServiceComponent, Host)} instead.
* @throws SystemException if the repository information can not be obtained
*/ | Get repository info given a cluster and host | getRepoInfo | {
"repo_name": "arenadata/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelper.java",
"license": "apache-2.0",
"size": 31494
} | [
"com.google.gson.JsonArray",
"org.apache.ambari.server.controller.spi.SystemException",
"org.apache.ambari.server.orm.entities.RepositoryVersionEntity",
"org.apache.ambari.server.state.Cluster",
"org.apache.ambari.server.state.Host",
"org.apache.ambari.server.state.ServiceComponent"
] | import com.google.gson.JsonArray; import org.apache.ambari.server.controller.spi.SystemException; import org.apache.ambari.server.orm.entities.RepositoryVersionEntity; import org.apache.ambari.server.state.Cluster; import org.apache.ambari.server.state.Host; import org.apache.ambari.server.state.ServiceComponent; | import com.google.gson.*; import org.apache.ambari.server.controller.spi.*; import org.apache.ambari.server.orm.entities.*; import org.apache.ambari.server.state.*; | [
"com.google.gson",
"org.apache.ambari"
] | com.google.gson; org.apache.ambari; | 1,677,659 |
protected List<Map<String, String>> loadRoleQualifiers(Context context, String roleId) {
PeopleFlowTypeService peopleFlowTypeService = context.getPeopleFlowTypeService();
List<Map<String, String>> roleQualifierList = new ArrayList<Map<String, String>>();
if (peopleFlowTypeService != null) {
Document document = DocumentRouteHeaderValue.to(context.getRouteContext().getDocument());
DocumentRouteHeaderValueContent content = new DocumentRouteHeaderValueContent(document.getDocumentId());
content.setDocumentContent(context.getRouteContext().getDocumentContent().getDocContent());
DocumentContent documentContent = DocumentRouteHeaderValueContent.to(content);
Map<String, String> roleQualifiers = peopleFlowTypeService.resolveRoleQualifiers(
context.getPeopleFlow().getTypeId(), roleId, document, documentContent
);
if (roleQualifiers != null) {
roleQualifierList.add(roleQualifiers);
}
boolean versionOk = VersionHelper.compareVersion(context.getPeopleFlowTypeServiceVersion(), CoreConstants.Versions.VERSION_2_3_0) != -1;
if(versionOk) {
List<Map<String, String>> multipleRoleQualifiers = peopleFlowTypeService.resolveMultipleRoleQualifiers(
context.getPeopleFlow().getTypeId(), roleId, document, documentContent);
if (multipleRoleQualifiers != null) {
roleQualifierList.addAll(multipleRoleQualifiers);
}
}
}
return roleQualifierList;
} | List<Map<String, String>> function(Context context, String roleId) { PeopleFlowTypeService peopleFlowTypeService = context.getPeopleFlowTypeService(); List<Map<String, String>> roleQualifierList = new ArrayList<Map<String, String>>(); if (peopleFlowTypeService != null) { Document document = DocumentRouteHeaderValue.to(context.getRouteContext().getDocument()); DocumentRouteHeaderValueContent content = new DocumentRouteHeaderValueContent(document.getDocumentId()); content.setDocumentContent(context.getRouteContext().getDocumentContent().getDocContent()); DocumentContent documentContent = DocumentRouteHeaderValueContent.to(content); Map<String, String> roleQualifiers = peopleFlowTypeService.resolveRoleQualifiers( context.getPeopleFlow().getTypeId(), roleId, document, documentContent ); if (roleQualifiers != null) { roleQualifierList.add(roleQualifiers); } boolean versionOk = VersionHelper.compareVersion(context.getPeopleFlowTypeServiceVersion(), CoreConstants.Versions.VERSION_2_3_0) != -1; if(versionOk) { List<Map<String, String>> multipleRoleQualifiers = peopleFlowTypeService.resolveMultipleRoleQualifiers( context.getPeopleFlow().getTypeId(), roleId, document, documentContent); if (multipleRoleQualifiers != null) { roleQualifierList.addAll(multipleRoleQualifiers); } } } return roleQualifierList; } | /**
* Uses the appropriate {@link PeopleFlowTypeService} to get the role qualifier maps for the given document and
* role.
*
* <p>Note that the PeopleFlowTypeService is selected based on the type id of the PeopleFlow.</p>
*
* @param context the context for request generation
* @param roleId the ID of the role for whom qualifiers are being loaded
* @return the qualifier maps, or an empty list if there are none
*/ | Uses the appropriate <code>PeopleFlowTypeService</code> to get the role qualifier maps for the given document and role. Note that the PeopleFlowTypeService is selected based on the type id of the PeopleFlow | loadRoleQualifiers | {
"repo_name": "gathreya/rice-kc",
"path": "rice-middleware/impl/src/main/java/org/kuali/rice/kew/impl/peopleflow/PeopleFlowRequestGeneratorImpl.java",
"license": "apache-2.0",
"size": 29330
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.kuali.rice.core.api.CoreConstants",
"org.kuali.rice.core.api.util.VersionHelper",
"org.kuali.rice.kew.api.document.Document",
"org.kuali.rice.kew.api.document.DocumentContent",
"org.kuali.rice.kew.framework.peopleflow.PeopleFlowTypeService",
"org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue",
"org.kuali.rice.kew.routeheader.DocumentRouteHeaderValueContent"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; import org.kuali.rice.core.api.CoreConstants; import org.kuali.rice.core.api.util.VersionHelper; import org.kuali.rice.kew.api.document.Document; import org.kuali.rice.kew.api.document.DocumentContent; import org.kuali.rice.kew.framework.peopleflow.PeopleFlowTypeService; import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue; import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValueContent; | import java.util.*; import org.kuali.rice.core.api.*; import org.kuali.rice.core.api.util.*; import org.kuali.rice.kew.api.document.*; import org.kuali.rice.kew.framework.peopleflow.*; import org.kuali.rice.kew.routeheader.*; | [
"java.util",
"org.kuali.rice"
] | java.util; org.kuali.rice; | 2,280,793 |
if (isInited) return (CorePackage)EPackage.Registry.INSTANCE.getEPackage(CorePackage.eNS_URI);
// Obtain or create and register package
CorePackageImpl theCorePackage = (CorePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CorePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CorePackageImpl());
isInited = true;
// Obtain or create and register interdependencies
UppaalPackageImpl theUppaalPackage = (UppaalPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(UppaalPackage.eNS_URI) instanceof UppaalPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(UppaalPackage.eNS_URI) : UppaalPackage.eINSTANCE);
TypesPackageImpl theTypesPackage = (TypesPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI) instanceof TypesPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI) : TypesPackage.eINSTANCE);
DeclarationsPackageImpl theDeclarationsPackage = (DeclarationsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(DeclarationsPackage.eNS_URI) instanceof DeclarationsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(DeclarationsPackage.eNS_URI) : DeclarationsPackage.eINSTANCE);
GlobalPackageImpl theGlobalPackage = (GlobalPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(GlobalPackage.eNS_URI) instanceof GlobalPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(GlobalPackage.eNS_URI) : GlobalPackage.eINSTANCE);
SystemPackageImpl theSystemPackage = (SystemPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SystemPackage.eNS_URI) instanceof SystemPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SystemPackage.eNS_URI) : SystemPackage.eINSTANCE);
TemplatesPackageImpl theTemplatesPackage = (TemplatesPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(TemplatesPackage.eNS_URI) instanceof TemplatesPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(TemplatesPackage.eNS_URI) : TemplatesPackage.eINSTANCE);
StatementsPackageImpl theStatementsPackage = (StatementsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(StatementsPackage.eNS_URI) instanceof StatementsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(StatementsPackage.eNS_URI) : StatementsPackage.eINSTANCE);
ExpressionsPackageImpl theExpressionsPackage = (ExpressionsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExpressionsPackage.eNS_URI) instanceof ExpressionsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExpressionsPackage.eNS_URI) : ExpressionsPackage.eINSTANCE);
VisualsPackageImpl theVisualsPackage = (VisualsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(VisualsPackage.eNS_URI) instanceof VisualsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(VisualsPackage.eNS_URI) : VisualsPackage.eINSTANCE);
// Create package meta-data objects
theCorePackage.createPackageContents();
theUppaalPackage.createPackageContents();
theTypesPackage.createPackageContents();
theDeclarationsPackage.createPackageContents();
theGlobalPackage.createPackageContents();
theSystemPackage.createPackageContents();
theTemplatesPackage.createPackageContents();
theStatementsPackage.createPackageContents();
theExpressionsPackage.createPackageContents();
theVisualsPackage.createPackageContents();
// Initialize created meta-data
theCorePackage.initializePackageContents();
theUppaalPackage.initializePackageContents();
theTypesPackage.initializePackageContents();
theDeclarationsPackage.initializePackageContents();
theGlobalPackage.initializePackageContents();
theSystemPackage.initializePackageContents();
theTemplatesPackage.initializePackageContents();
theStatementsPackage.initializePackageContents();
theExpressionsPackage.initializePackageContents();
theVisualsPackage.initializePackageContents();
| if (isInited) return (CorePackage)EPackage.Registry.INSTANCE.getEPackage(CorePackage.eNS_URI); CorePackageImpl theCorePackage = (CorePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CorePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CorePackageImpl()); isInited = true; UppaalPackageImpl theUppaalPackage = (UppaalPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(UppaalPackage.eNS_URI) instanceof UppaalPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(UppaalPackage.eNS_URI) : UppaalPackage.eINSTANCE); TypesPackageImpl theTypesPackage = (TypesPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI) instanceof TypesPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI) : TypesPackage.eINSTANCE); DeclarationsPackageImpl theDeclarationsPackage = (DeclarationsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(DeclarationsPackage.eNS_URI) instanceof DeclarationsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(DeclarationsPackage.eNS_URI) : DeclarationsPackage.eINSTANCE); GlobalPackageImpl theGlobalPackage = (GlobalPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(GlobalPackage.eNS_URI) instanceof GlobalPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(GlobalPackage.eNS_URI) : GlobalPackage.eINSTANCE); SystemPackageImpl theSystemPackage = (SystemPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SystemPackage.eNS_URI) instanceof SystemPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SystemPackage.eNS_URI) : SystemPackage.eINSTANCE); TemplatesPackageImpl theTemplatesPackage = (TemplatesPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(TemplatesPackage.eNS_URI) instanceof TemplatesPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(TemplatesPackage.eNS_URI) : TemplatesPackage.eINSTANCE); StatementsPackageImpl theStatementsPackage = (StatementsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(StatementsPackage.eNS_URI) instanceof StatementsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(StatementsPackage.eNS_URI) : StatementsPackage.eINSTANCE); ExpressionsPackageImpl theExpressionsPackage = (ExpressionsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExpressionsPackage.eNS_URI) instanceof ExpressionsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExpressionsPackage.eNS_URI) : ExpressionsPackage.eINSTANCE); VisualsPackageImpl theVisualsPackage = (VisualsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(VisualsPackage.eNS_URI) instanceof VisualsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(VisualsPackage.eNS_URI) : VisualsPackage.eINSTANCE); theCorePackage.createPackageContents(); theUppaalPackage.createPackageContents(); theTypesPackage.createPackageContents(); theDeclarationsPackage.createPackageContents(); theGlobalPackage.createPackageContents(); theSystemPackage.createPackageContents(); theTemplatesPackage.createPackageContents(); theStatementsPackage.createPackageContents(); theExpressionsPackage.createPackageContents(); theVisualsPackage.createPackageContents(); theCorePackage.initializePackageContents(); theUppaalPackage.initializePackageContents(); theTypesPackage.initializePackageContents(); theDeclarationsPackage.initializePackageContents(); theGlobalPackage.initializePackageContents(); theSystemPackage.initializePackageContents(); theTemplatesPackage.initializePackageContents(); theStatementsPackage.initializePackageContents(); theExpressionsPackage.initializePackageContents(); theVisualsPackage.initializePackageContents(); | /**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link CorePackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/ | Creates, registers, and initializes the Package for this model, and for any others upon which it depends. This method is used to initialize <code>CorePackage#eINSTANCE</code> when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. | init | {
"repo_name": "uppaal-emf/uppaal",
"path": "metamodel/org.muml.uppaal/src/org/muml/uppaal/core/impl/CorePackageImpl.java",
"license": "epl-1.0",
"size": 12133
} | [
"org.eclipse.emf.ecore.EPackage",
"org.muml.uppaal.UppaalPackage",
"org.muml.uppaal.core.CorePackage",
"org.muml.uppaal.declarations.DeclarationsPackage",
"org.muml.uppaal.declarations.global.GlobalPackage",
"org.muml.uppaal.declarations.global.impl.GlobalPackageImpl",
"org.muml.uppaal.declarations.impl.DeclarationsPackageImpl",
"org.muml.uppaal.declarations.system.SystemPackage",
"org.muml.uppaal.declarations.system.impl.SystemPackageImpl",
"org.muml.uppaal.expressions.ExpressionsPackage",
"org.muml.uppaal.expressions.impl.ExpressionsPackageImpl",
"org.muml.uppaal.impl.UppaalPackageImpl",
"org.muml.uppaal.statements.StatementsPackage",
"org.muml.uppaal.statements.impl.StatementsPackageImpl",
"org.muml.uppaal.templates.TemplatesPackage",
"org.muml.uppaal.templates.impl.TemplatesPackageImpl",
"org.muml.uppaal.types.TypesPackage",
"org.muml.uppaal.types.impl.TypesPackageImpl",
"org.muml.uppaal.visuals.VisualsPackage",
"org.muml.uppaal.visuals.impl.VisualsPackageImpl"
] | import org.eclipse.emf.ecore.EPackage; import org.muml.uppaal.UppaalPackage; import org.muml.uppaal.core.CorePackage; import org.muml.uppaal.declarations.DeclarationsPackage; import org.muml.uppaal.declarations.global.GlobalPackage; import org.muml.uppaal.declarations.global.impl.GlobalPackageImpl; import org.muml.uppaal.declarations.impl.DeclarationsPackageImpl; import org.muml.uppaal.declarations.system.SystemPackage; import org.muml.uppaal.declarations.system.impl.SystemPackageImpl; import org.muml.uppaal.expressions.ExpressionsPackage; import org.muml.uppaal.expressions.impl.ExpressionsPackageImpl; import org.muml.uppaal.impl.UppaalPackageImpl; import org.muml.uppaal.statements.StatementsPackage; import org.muml.uppaal.statements.impl.StatementsPackageImpl; import org.muml.uppaal.templates.TemplatesPackage; import org.muml.uppaal.templates.impl.TemplatesPackageImpl; import org.muml.uppaal.types.TypesPackage; import org.muml.uppaal.types.impl.TypesPackageImpl; import org.muml.uppaal.visuals.VisualsPackage; import org.muml.uppaal.visuals.impl.VisualsPackageImpl; | import org.eclipse.emf.ecore.*; import org.muml.uppaal.*; import org.muml.uppaal.core.*; import org.muml.uppaal.declarations.*; import org.muml.uppaal.declarations.global.*; import org.muml.uppaal.declarations.global.impl.*; import org.muml.uppaal.declarations.impl.*; import org.muml.uppaal.declarations.system.*; import org.muml.uppaal.declarations.system.impl.*; import org.muml.uppaal.expressions.*; import org.muml.uppaal.expressions.impl.*; import org.muml.uppaal.impl.*; import org.muml.uppaal.statements.*; import org.muml.uppaal.statements.impl.*; import org.muml.uppaal.templates.*; import org.muml.uppaal.templates.impl.*; import org.muml.uppaal.types.*; import org.muml.uppaal.types.impl.*; import org.muml.uppaal.visuals.*; import org.muml.uppaal.visuals.impl.*; | [
"org.eclipse.emf",
"org.muml.uppaal"
] | org.eclipse.emf; org.muml.uppaal; | 2,217,409 |
public void initializeModel(CMMCore core_) {
// apply pre-init props and initialize com ports
for (String key : comPortInUse_.keySet()) {
try {
Device portDev = comPortInUse_.get(key);
for (int i=0; i<portDev.getNumberOfSetupProperties(); i++) {
PropertyItem pi = portDev.getSetupProperty(i);
if (pi.preInit)
core_.setProperty(portDev.getName(), pi.name, pi.value);
}
core_.initializeDevice(portDev.getName());
portDev.loadDataFromHardware(core_);
} catch (Exception e) {
ReportingUtils.showError(e);
}
}
// apply pre-init properties
for (Device d : devices_) {
for (int i=0; i<d.getNumberOfSetupProperties(); i++) {
PropertyItem pi = d.getSetupProperty(i);
if (pi.preInit) {
try {
core_.setProperty(d.getName(), pi.name, pi.value);
} catch (Exception e) {
ReportingUtils.showError(e);
}
}
}
}
// initialize hubs first
for (Device d : new ArrayList<Device>(devices_)) {
if (d.isHub() && !d.isInitialized()) {
try {
core_.initializeDevice(d.getName());
d.loadDataFromHardware(core_);
d.setInitialized(true);
d.discoverPeripherals(core_);
} catch (Exception e) {
int sel = JOptionPane.showConfirmDialog(null, e.getMessage() + "\nRemove device " + d.getName() + " from the list?",
"Initialization Error", JOptionPane.YES_NO_OPTION);
if (sel == JOptionPane.YES_OPTION) {
removePeripherals(d.getName(), core_);
removeDevice(d.getName());
try {
core_.unloadDevice(d.getName());
} catch (Exception e1) {
ReportingUtils.showError(e1);
}
}
}
}
}
// then remaining devices
for (Device d : new ArrayList<Device>(devices_)) {
if (!d.isInitialized() && !d.isCore()) {
try {
String parentHub = d.getParentHub();
if (! (parentHub.length() == 0) )
core_.setParentLabel(d.getName(), parentHub);
core_.initializeDevice(d.getName());
d.loadDataFromHardware(core_);
d.setInitialized(true);
} catch (Exception e) {
int sel = JOptionPane.showConfirmDialog(null, e.getMessage() + "\nRemove device " + d.getName() + " from the list?",
"Initialization Error", JOptionPane.YES_NO_OPTION);
if (sel == JOptionPane.YES_OPTION) {
removePeripherals(d.getName(), core_);
removeDevice(d.getName());
try {
core_.unloadDevice(d.getName());
} catch (Exception e1) {
ReportingUtils.showError(e1);
}
}
}
}
}
}
| void function(CMMCore core_) { for (String key : comPortInUse_.keySet()) { try { Device portDev = comPortInUse_.get(key); for (int i=0; i<portDev.getNumberOfSetupProperties(); i++) { PropertyItem pi = portDev.getSetupProperty(i); if (pi.preInit) core_.setProperty(portDev.getName(), pi.name, pi.value); } core_.initializeDevice(portDev.getName()); portDev.loadDataFromHardware(core_); } catch (Exception e) { ReportingUtils.showError(e); } } for (Device d : devices_) { for (int i=0; i<d.getNumberOfSetupProperties(); i++) { PropertyItem pi = d.getSetupProperty(i); if (pi.preInit) { try { core_.setProperty(d.getName(), pi.name, pi.value); } catch (Exception e) { ReportingUtils.showError(e); } } } } for (Device d : new ArrayList<Device>(devices_)) { if (d.isHub() && !d.isInitialized()) { try { core_.initializeDevice(d.getName()); d.loadDataFromHardware(core_); d.setInitialized(true); d.discoverPeripherals(core_); } catch (Exception e) { int sel = JOptionPane.showConfirmDialog(null, e.getMessage() + STR + d.getName() + STR, STR, JOptionPane.YES_NO_OPTION); if (sel == JOptionPane.YES_OPTION) { removePeripherals(d.getName(), core_); removeDevice(d.getName()); try { core_.unloadDevice(d.getName()); } catch (Exception e1) { ReportingUtils.showError(e1); } } } } } for (Device d : new ArrayList<Device>(devices_)) { if (!d.isInitialized() && !d.isCore()) { try { String parentHub = d.getParentHub(); if (! (parentHub.length() == 0) ) core_.setParentLabel(d.getName(), parentHub); core_.initializeDevice(d.getName()); d.loadDataFromHardware(core_); d.setInitialized(true); } catch (Exception e) { int sel = JOptionPane.showConfirmDialog(null, e.getMessage() + STR + d.getName() + STR, STR, JOptionPane.YES_NO_OPTION); if (sel == JOptionPane.YES_OPTION) { removePeripherals(d.getName(), core_); removeDevice(d.getName()); try { core_.unloadDevice(d.getName()); } catch (Exception e1) { ReportingUtils.showError(e1); } } } } } } | /**
* This method attempts to initialize all devices in a model, simulating what
* MMCore does upon loading configuration file
*/ | This method attempts to initialize all devices in a model, simulating what MMCore does upon loading configuration file | initializeModel | {
"repo_name": "kmdouglass/Micro-Manager",
"path": "mmstudio/src/org/micromanager/conf2/MicroscopeModel.java",
"license": "mit",
"size": 58732
} | [
"java.util.ArrayList",
"javax.swing.JOptionPane",
"org.micromanager.utils.PropertyItem",
"org.micromanager.utils.ReportingUtils"
] | import java.util.ArrayList; import javax.swing.JOptionPane; import org.micromanager.utils.PropertyItem; import org.micromanager.utils.ReportingUtils; | import java.util.*; import javax.swing.*; import org.micromanager.utils.*; | [
"java.util",
"javax.swing",
"org.micromanager.utils"
] | java.util; javax.swing; org.micromanager.utils; | 907,703 |
@Test (timeout = 5000)
public void testReservationWithMultiplePriorities() throws IOException {
scheduler.init(conf);
scheduler.start();
scheduler.reinitialize(conf, resourceManager.getRMContext());
// Add a node
RMNode node1 = MockNodes.newNodeInfo(1, Resources.createResource(2048, 2));
NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1);
scheduler.handle(nodeEvent1);
NodeUpdateSchedulerEvent updateEvent = new NodeUpdateSchedulerEvent(node1);
// Create first app and take up half resources so the second app that asks
// for the entire node won't have enough.
FSAppAttempt app1 = scheduler.getSchedulerApp(
createSchedulingRequest(1024, 1, "queue", "user", 1));
scheduler.update();
scheduler.handle(updateEvent);
assertEquals("Basic allocation failed", 1, app1.getLiveContainers().size());
// Create another app and reserve at a lower priority first
ApplicationAttemptId attId =
createSchedulingRequest(2048, 2, "queue1", "user1", 1, 2);
FSAppAttempt app2 = scheduler.getSchedulerApp(attId);
scheduler.update();
scheduler.handle(updateEvent);
assertEquals("Reservation at lower priority failed",
1, app2.getReservedContainers().size());
// Request container on the second app at a higher priority
createSchedulingRequestExistingApplication(2048, 2, 1, attId);
// Complete the first container so we can trigger allocation for app2
ContainerId containerId =
app1.getLiveContainers().iterator().next().getContainerId();
scheduler.allocate(app1.getApplicationAttemptId(), new ArrayList<>(), null,
Arrays.asList(containerId), null, null, NULL_UPDATE_REQUESTS);
// Trigger allocation for app2
scheduler.handle(updateEvent);
// Reserved container (at lower priority) should be run
Collection<RMContainer> liveContainers = app2.getLiveContainers();
assertEquals("Allocation post completion failed", 1, liveContainers.size());
assertEquals("High prio container allocated against low prio reservation",
2, liveContainers.iterator().next().getContainer().
getPriority().getPriority());
} | @Test (timeout = 5000) void function() throws IOException { scheduler.init(conf); scheduler.start(); scheduler.reinitialize(conf, resourceManager.getRMContext()); RMNode node1 = MockNodes.newNodeInfo(1, Resources.createResource(2048, 2)); NodeAddedSchedulerEvent nodeEvent1 = new NodeAddedSchedulerEvent(node1); scheduler.handle(nodeEvent1); NodeUpdateSchedulerEvent updateEvent = new NodeUpdateSchedulerEvent(node1); FSAppAttempt app1 = scheduler.getSchedulerApp( createSchedulingRequest(1024, 1, "queue", "user", 1)); scheduler.update(); scheduler.handle(updateEvent); assertEquals(STR, 1, app1.getLiveContainers().size()); ApplicationAttemptId attId = createSchedulingRequest(2048, 2, STR, "user1", 1, 2); FSAppAttempt app2 = scheduler.getSchedulerApp(attId); scheduler.update(); scheduler.handle(updateEvent); assertEquals(STR, 1, app2.getReservedContainers().size()); createSchedulingRequestExistingApplication(2048, 2, 1, attId); ContainerId containerId = app1.getLiveContainers().iterator().next().getContainerId(); scheduler.allocate(app1.getApplicationAttemptId(), new ArrayList<>(), null, Arrays.asList(containerId), null, null, NULL_UPDATE_REQUESTS); scheduler.handle(updateEvent); Collection<RMContainer> liveContainers = app2.getLiveContainers(); assertEquals(STR, 1, liveContainers.size()); assertEquals(STR, 2, liveContainers.iterator().next().getContainer(). getPriority().getPriority()); } | /**
* Reserve at a lower priority and verify the lower priority request gets
* allocated
*/ | Reserve at a lower priority and verify the lower priority request gets allocated | testReservationWithMultiplePriorities | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java",
"license": "apache-2.0",
"size": 235881
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Collection",
"org.apache.hadoop.yarn.api.records.ApplicationAttemptId",
"org.apache.hadoop.yarn.api.records.ContainerId",
"org.apache.hadoop.yarn.server.resourcemanager.MockNodes",
"org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer",
"org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent",
"org.apache.hadoop.yarn.util.resource.Resources",
"org.junit.Assert",
"org.junit.Test"
] | import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.server.resourcemanager.MockNodes; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAddedSchedulerEvent; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeUpdateSchedulerEvent; import org.apache.hadoop.yarn.util.resource.Resources; import org.junit.Assert; import org.junit.Test; | import java.io.*; import java.util.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.server.resourcemanager.*; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.*; import org.apache.hadoop.yarn.server.resourcemanager.rmnode.*; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.*; import org.apache.hadoop.yarn.util.resource.*; import org.junit.*; | [
"java.io",
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.io; java.util; org.apache.hadoop; org.junit; | 1,405,611 |
public static <E> Bindable<Set<E>> setOf(Class<E> elementType) {
return of(ResolvableType.forClassWithGenerics(Set.class, elementType));
} | static <E> Bindable<Set<E>> function(Class<E> elementType) { return of(ResolvableType.forClassWithGenerics(Set.class, elementType)); } | /**
* Create a new {@link Bindable} {@link Set} of the specified element type.
* @param <E> the element type
* @param elementType the set element type
* @return a {@link Bindable} instance
*/ | Create a new <code>Bindable</code> <code>Set</code> of the specified element type | setOf | {
"repo_name": "isopov/spring-boot",
"path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java",
"license": "apache-2.0",
"size": 7659
} | [
"java.util.Set",
"org.springframework.core.ResolvableType"
] | import java.util.Set; import org.springframework.core.ResolvableType; | import java.util.*; import org.springframework.core.*; | [
"java.util",
"org.springframework.core"
] | java.util; org.springframework.core; | 1,945,556 |
public void readExternal( ObjectInput in )
throws IOException, ClassNotFoundException
{
int size = in.readInt();
for(int i = 0; i < size; i++) {
Object key = in.readObject();
Object value = in.readObject();
put(key, value);
}
}
| void function( ObjectInput in ) throws IOException, ClassNotFoundException { int size = in.readInt(); for(int i = 0; i < size; i++) { Object key = in.readObject(); Object value = in.readObject(); put(key, value); } } | /**
* Deserializes this map from the given stream.
*
* @param in the stream to deserialize from
* @throws IOException if the stream raises it
* @throws ClassNotFoundException if the stream raises it
*/ | Deserializes this map from the given stream | readExternal | {
"repo_name": "bbossgroups/bbossgroups-3.5",
"path": "bboss-persistent/src-jdk5/com/frameworkset/commons/dbcp/datasources/SequencedHashMap.java",
"license": "apache-2.0",
"size": 33333
} | [
"java.io.IOException",
"java.io.ObjectInput"
] | import java.io.IOException; import java.io.ObjectInput; | import java.io.*; | [
"java.io"
] | java.io; | 538,351 |
protected final TemplateContext getContext() {
return fContext;
}
/**
* {@inheritDoc} | final TemplateContext function() { return fContext; } /** * {@inheritDoc} | /**
* Returns the context in which the template was requested.
*
* @return the context in which the template was requested
* @since 3.1
*/ | Returns the context in which the template was requested | getContext | {
"repo_name": "sleshchenko/che",
"path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/ui/text/template/contentassist/TemplateProposal.java",
"license": "epl-1.0",
"size": 21592
} | [
"org.eclipse.jface.text.templates.TemplateContext"
] | import org.eclipse.jface.text.templates.TemplateContext; | import org.eclipse.jface.text.templates.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 1,846,603 |
static void copyNewerDevResources(File devEtcDir, File artHome) throws IOException {
File homeEtcDir = updateArtEtc(devEtcDir, new File(artHome, "etc"));
createConfigBootstrap(homeEtcDir);
} | static void copyNewerDevResources(File devEtcDir, File artHome) throws IOException { File homeEtcDir = updateArtEtc(devEtcDir, new File(artHome, "etc")); createConfigBootstrap(homeEtcDir); } | /**
* Copy newer files from the standalone dir to the working artifactory home dir
*/ | Copy newer files from the standalone dir to the working artifactory home dir | copyNewerDevResources | {
"repo_name": "alancnet/artifactory",
"path": "distribution/standalone/src/test/java/org/artifactory/webapp/main/StartArtifactoryTomcatDev.java",
"license": "apache-2.0",
"size": 6809
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,130,987 |
public final void setLowerBound(DateTime date) {
lowerBound.set(date);
} | final void function(DateTime date) { lowerBound.set(date); } | /**
* Sets the lower bound of the axis.
*
* @param date The lower bound date.
*
* @see #lowerBoundProperty()
*/ | Sets the lower bound of the axis | setLowerBound | {
"repo_name": "mhmdfy/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/timeline/ui/detailview/DateAxis.java",
"license": "apache-2.0",
"size": 11944
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 2,769,971 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String str = request.getPathInfo();
if(str==null || str.trim().equals("")){
throw new IOException("Invalid file");
}
if(str.charAt(0)=='/'){
str = str.substring(1, str.length());
}
str = str.replaceAll("/", File.separator);
String uploadpath = TextResourcesUtil.getText("uploadpath");
File file = new File(uploadpath+File.separator+str);
sendFile(response, file);
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String str = request.getPathInfo(); if(str==null str.trim().equals(STRInvalid fileSTR/STRuploadpath"); File file = new File(uploadpath+File.separator+str); sendFile(response, file); } | /**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods | processRequest | {
"repo_name": "AYD-2-GRPX-2015/SimpleFaqSystem",
"path": "src/java/sfs/GetUploadedFileServlet.java",
"license": "gpl-3.0",
"size": 4207
} | [
"java.io.File",
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.File; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 1,327,985 |
protected void fireInlineProjectionDisabled() {
if (fInlineProjectionListeners != null) {
Iterator e = new ArrayList(fInlineProjectionListeners).iterator();
while (e.hasNext()) {
IInlineProjectionListener l = (IInlineProjectionListener) e.next();
l.inlineProjectionDisabled();
}
}
}
| void function() { if (fInlineProjectionListeners != null) { Iterator e = new ArrayList(fInlineProjectionListeners).iterator(); while (e.hasNext()) { IInlineProjectionListener l = (IInlineProjectionListener) e.next(); l.inlineProjectionDisabled(); } } } | /**
* Notifies all registered projection listeners that projection mode has
* been disabled.
*/ | Notifies all registered projection listeners that projection mode has been disabled | fireInlineProjectionDisabled | {
"repo_name": "ckaestne/CIDE",
"path": "other/CIDE/src/coloredide/editor/inlineprojection/InlineProjectionJavaViewer.java",
"license": "gpl-3.0",
"size": 61019
} | [
"java.util.ArrayList",
"java.util.Iterator"
] | import java.util.ArrayList; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 738,295 |
private static HyperGraph getFavoredPath(HyperGraph input, Node s, Node t, Comparator<HyperEdge> comparator) {
HyperGraph bestUnfavoredPath = new HyperGraph();
PriorityQueue<HyperEdge> q = new PriorityQueue<>(input.getEdgeCount(), comparator);
for (HyperEdge edge : input.getEdges()) {
q.add(edge);
}
boolean pathFound = false;
HyperEdge unfavored;
while (!q.isEmpty()) {
HyperGraph g = new HyperGraph(bestUnfavoredPath);
PriorityQueue<HyperEdge> nq = new PriorityQueue<>(q.size(), comparator);
ArrayList<HyperEdge> buffer = new ArrayList<>();
do {
unfavored = q.poll();
g.addEdge(unfavored);
buffer = new ArrayList<>();
buffer.add(unfavored);
while (!q.isEmpty() && q.peek().getWeight() == unfavored.getWeight()) {
buffer.add(q.peek());
g.addEdge(q.peek());
q.poll();
}
pathFound = pathExists(g, s, t);
if (!pathFound) {
for (HyperEdge edge : buffer) {
nq.add(edge);
}
}
} while (!pathFound && !q.isEmpty());
for (HyperEdge edge : buffer) {
bestUnfavoredPath.addEdge(edge);
}
q = nq;
}
if (!pathFound) {
return new HyperGraph();
}
return getPath(bestUnfavoredPath, s, t);
} | static HyperGraph function(HyperGraph input, Node s, Node t, Comparator<HyperEdge> comparator) { HyperGraph bestUnfavoredPath = new HyperGraph(); PriorityQueue<HyperEdge> q = new PriorityQueue<>(input.getEdgeCount(), comparator); for (HyperEdge edge : input.getEdges()) { q.add(edge); } boolean pathFound = false; HyperEdge unfavored; while (!q.isEmpty()) { HyperGraph g = new HyperGraph(bestUnfavoredPath); PriorityQueue<HyperEdge> nq = new PriorityQueue<>(q.size(), comparator); ArrayList<HyperEdge> buffer = new ArrayList<>(); do { unfavored = q.poll(); g.addEdge(unfavored); buffer = new ArrayList<>(); buffer.add(unfavored); while (!q.isEmpty() && q.peek().getWeight() == unfavored.getWeight()) { buffer.add(q.peek()); g.addEdge(q.peek()); q.poll(); } pathFound = pathExists(g, s, t); if (!pathFound) { for (HyperEdge edge : buffer) { nq.add(edge); } } } while (!pathFound && !q.isEmpty()); for (HyperEdge edge : buffer) { bestUnfavoredPath.addEdge(edge); } q = nq; } if (!pathFound) { return new HyperGraph(); } return getPath(bestUnfavoredPath, s, t); } | /**
* Finds favored path in the given graph from source node to the target node
* using the comparator for edge selection.
*
* @param input Input graph.
* @param s Source node.
* @param t Target node.
* @param comparator Comparator for edge weights.
* @return Favored path.
*/ | Finds favored path in the given graph from source node to the target node using the comparator for edge selection | getFavoredPath | {
"repo_name": "eullah01/PreProPath",
"path": "src/ppp/PredictablePathAlogrithm.java",
"license": "gpl-2.0",
"size": 6184
} | [
"java.util.ArrayList",
"java.util.Comparator",
"java.util.PriorityQueue"
] | import java.util.ArrayList; import java.util.Comparator; import java.util.PriorityQueue; | import java.util.*; | [
"java.util"
] | java.util; | 1,926,873 |
protected ResponseEntity<Object> handleMissingServletRequestParameter(MissingServletRequestParameterException ex,
HttpHeaders headers, HttpStatus status, WebRequest request) {
return handleExceptionInternal(ex, null, headers, status, request);
} | ResponseEntity<Object> function(MissingServletRequestParameterException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { return handleExceptionInternal(ex, null, headers, status, request); } | /**
* Customize the response for MissingServletRequestParameterException.
* This method delegates to {@link #handleExceptionInternal(Exception, Object, HttpHeaders, HttpStatus, WebRequest)}.
* @param ex the exception
* @param headers the headers to be written to the response
* @param status the selected response status
* @param request the current request
* @return a {@code ResponseEntity} instance
*/ | Customize the response for MissingServletRequestParameterException. This method delegates to <code>#handleExceptionInternal(Exception, Object, HttpHeaders, HttpStatus, WebRequest)</code> | handleMissingServletRequestParameter | {
"repo_name": "leogoing/spring_jeesite",
"path": "spring-webmvc-4.0/org/springframework/web/servlet/mvc/method/annotation/ResponseEntityExceptionHandler.java",
"license": "apache-2.0",
"size": 18606
} | [
"org.springframework.http.HttpHeaders",
"org.springframework.http.HttpStatus",
"org.springframework.http.ResponseEntity",
"org.springframework.web.bind.MissingServletRequestParameterException",
"org.springframework.web.context.request.WebRequest"
] | import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.MissingServletRequestParameterException; import org.springframework.web.context.request.WebRequest; | import org.springframework.http.*; import org.springframework.web.bind.*; import org.springframework.web.context.request.*; | [
"org.springframework.http",
"org.springframework.web"
] | org.springframework.http; org.springframework.web; | 1,849,178 |
public static Path getTempTaskAttemptPath(TaskAttemptContext context,
final String jobUUID, Path out) {
return new Path(
getTempJobAttemptPath(jobUUID, out),
String.valueOf(context.getTaskAttemptID()));
} | static Path function(TaskAttemptContext context, final String jobUUID, Path out) { return new Path( getTempJobAttemptPath(jobUUID, out), String.valueOf(context.getTaskAttemptID())); } | /**
* Compute the path where the output of a given task attempt will be placed.
* @param context task context
* @param jobUUID unique Job ID.
* @param out output directory of job
* @return the path to store temporary job attempt data.
*/ | Compute the path where the output of a given task attempt will be placed | getTempTaskAttemptPath | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/commit/CommitUtilsWithMR.java",
"license": "apache-2.0",
"size": 6856
} | [
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.mapreduce.TaskAttemptContext"
] | import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapreduce.TaskAttemptContext; | import org.apache.hadoop.fs.*; import org.apache.hadoop.mapreduce.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 973,716 |
EAttribute getNamedElement_Name(); | EAttribute getNamedElement_Name(); | /**
* Returns the meta object for the attribute '{@link org.eclectic.idc.core.NamedElement#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see org.eclectic.idc.core.NamedElement#getName()
* @see #getNamedElement()
* @generated
*/ | Returns the meta object for the attribute '<code>org.eclectic.idc.core.NamedElement#getName Name</code>'. | getNamedElement_Name | {
"repo_name": "jesusc/eclectic",
"path": "plugins/org.eclectic.idc/src-gen/org/eclectic/idc/core/CorePackage.java",
"license": "gpl-3.0",
"size": 86808
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 673,246 |
@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": "adbrucker/SecureBPMN",
"path": "designer/src/org.activiti.designer.model.edit/src/org/eclipse/bpmn2/provider/GlobalScriptTaskItemProvider.java",
"license": "apache-2.0",
"size": 5706
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,343,078 |
//@author A0111736M
private void setKeybinding(ConsoleReader cr) {
final String insert = "\033[2~"; | void function(ConsoleReader cr) { final String insert = STR; | /**
* Maps the required keyboard keys to perform the required function when
* triggered.
*
* @param cr ConsoleReader object
*/ | Maps the required keyboard keys to perform the required function when triggered | setKeybinding | {
"repo_name": "cs2103aug2014-w11-4j/main",
"path": "src/rubberduck/menu/UnixInterface.java",
"license": "gpl-2.0",
"size": 9746
} | [
"jline.console.ConsoleReader"
] | import jline.console.ConsoleReader; | import jline.console.*; | [
"jline.console"
] | jline.console; | 2,454,984 |
public List<Integer> getMatchingQuads(Cases missing, int degrees) {
List<Integer> matches = new ArrayList<Integer>();
int sides = missing.countPattern(this.defaultpat);
for (int i = 0; i < this.gridQuads.size(); i++) {
Cases q = this.gridQuads.get(i);
if ((q.equalsIgnoreRotation(missing, degrees))
&& (q.countPattern(this.defaultpat) == sides)) {
matches.add(Integer.valueOf(i));
}
}
return matches;
}
| List<Integer> function(Cases missing, int degrees) { List<Integer> matches = new ArrayList<Integer>(); int sides = missing.countPattern(this.defaultpat); for (int i = 0; i < this.gridQuads.size(); i++) { Cases q = this.gridQuads.get(i); if ((q.equalsIgnoreRotation(missing, degrees)) && (q.countPattern(this.defaultpat) == sides)) { matches.add(Integer.valueOf(i)); } } return matches; } | /**
* Method getMatchingQuads.
*
* @param missing
* Cases
* @param degrees
* int
*
* @return List<Integer>
*/ | Method getMatchingQuads | getMatchingQuads | {
"repo_name": "laynos/GLPOO_ESIEA_1415_Eternity_Souhel",
"path": "eternity/src/main/java/fr/esiea/glpoo/création_pièces_terrain/Terrain.java",
"license": "apache-2.0",
"size": 18602
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,600,192 |
public void flush()
throws IOException {
ob.flush();
}
| void function() throws IOException { ob.flush(); } | /**
* Will send the buffer to the client.
*/ | Will send the buffer to the client | flush | {
"repo_name": "yuyupapa/OpenSource",
"path": "apache-tomcat-6.0.48/java/org/apache/catalina/connector/CoyoteOutputStream.java",
"license": "apache-2.0",
"size": 2540
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,526,154 |
private static boolean isHLogLinkPath(final Path path) {
return path.depth() == 2;
}
} | static boolean function(final Path path) { return path.depth() == 2; } } | /**
* HLog files are encoded as serverName/logName
* and since all the other files should be in /hbase/table/..path..
* we can rely on the depth, for now.
*/ | HLog files are encoded as serverName/logName and since all the other files should be in /hbase/table/..path.. we can rely on the depth, for now | isHLogLinkPath | {
"repo_name": "lilonglai/hbase-0.96.2",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java",
"license": "apache-2.0",
"size": 32444
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 204,926 |
List<OFMessage> getMessagesFromCapture() {
List<OFMessage> msgs = new ArrayList<OFMessage>();
assertTrue("No write on channel was captured",
writeCapture.hasCaptured());
List<List<OFMessage>> capturedVals = writeCapture.getValues();
for (List<OFMessage> oneWriteList: capturedVals)
msgs.addAll(oneWriteList);
writeCapture.reset();
return msgs;
} | List<OFMessage> getMessagesFromCapture() { List<OFMessage> msgs = new ArrayList<OFMessage>(); assertTrue(STR, writeCapture.hasCaptured()); List<List<OFMessage>> capturedVals = writeCapture.getValues(); for (List<OFMessage> oneWriteList: capturedVals) msgs.addAll(oneWriteList); writeCapture.reset(); return msgs; } | /**
* Extract the list of OFMessages that was captured by the Channel.write()
* capture. Will check that something was actually captured first. We'll
* collapse the messages from multiple writes into a single list of
* OFMessages.
* Resets the channelWriteCapture.
*/ | Extract the list of OFMessages that was captured by the Channel.write() capture. Will check that something was actually captured first. We'll collapse the messages from multiple writes into a single list of OFMessages. Resets the channelWriteCapture | getMessagesFromCapture | {
"repo_name": "deepurple/floodlight",
"path": "src/test/java/net/floodlightcontroller/core/internal/OFChannelHandlerVer13Test.java",
"license": "apache-2.0",
"size": 18340
} | [
"java.util.ArrayList",
"java.util.List",
"org.easymock.EasyMock",
"org.junit.Assert",
"org.projectfloodlight.openflow.protocol.OFMessage"
] | import java.util.ArrayList; import java.util.List; import org.easymock.EasyMock; import org.junit.Assert; import org.projectfloodlight.openflow.protocol.OFMessage; | import java.util.*; import org.easymock.*; import org.junit.*; import org.projectfloodlight.openflow.protocol.*; | [
"java.util",
"org.easymock",
"org.junit",
"org.projectfloodlight.openflow"
] | java.util; org.easymock; org.junit; org.projectfloodlight.openflow; | 2,206,982 |
public AllMemberHandler reflectAll(); | AllMemberHandler function(); | /**
* This part of the DSL controls reflection of a list of reflection
* elements.
*
* @return An object to control reflection of lists of elements.
*/ | This part of the DSL controls reflection of a list of reflection elements | reflectAll | {
"repo_name": "vidageek/mirror",
"path": "src/main/java/net/vidageek/mirror/dsl/MemberController.java",
"license": "apache-2.0",
"size": 614
} | [
"net.vidageek.mirror.reflect.dsl.AllMemberHandler"
] | import net.vidageek.mirror.reflect.dsl.AllMemberHandler; | import net.vidageek.mirror.reflect.dsl.*; | [
"net.vidageek.mirror"
] | net.vidageek.mirror; | 2,767,819 |
@Override
public ItemsVO doCreateItemsTableIfNot(ItemsVO vo) {
String sql = StringUtilsExt.replaceArrayMerge(SQL_CREATE_ITEMS_TABLE_IF_NOT,
new String[] { "#itemsManageTable#", "#colname#", "#coltype#" },
new String[] { vo.getItemsManageTable(), vo.getColname(), vo.getColtype() });
logger.debug("JDBC::doCreateItemsTableIfNot sql={}", sql);
Yank.execute(sql, null);
return vo;
} | ItemsVO function(ItemsVO vo) { String sql = StringUtilsExt.replaceArrayMerge(SQL_CREATE_ITEMS_TABLE_IF_NOT, new String[] { STR, STR, STR }, new String[] { vo.getItemsManageTable(), vo.getColname(), vo.getColtype() }); logger.debug(STR, sql); Yank.execute(sql, null); return vo; } | /**************
* ITEMS DAOs *
**************/ | ITEMS DAOs | doCreateItemsTableIfNot | {
"repo_name": "cschneider/openhab",
"path": "bundles/persistence/org.openhab.persistence.jdbc/java/org/openhab/persistence/jdbc/db/JdbcSqliteDAO.java",
"license": "epl-1.0",
"size": 3647
} | [
"org.knowm.yank.Yank",
"org.openhab.persistence.jdbc.model.ItemsVO",
"org.openhab.persistence.jdbc.utils.StringUtilsExt"
] | import org.knowm.yank.Yank; import org.openhab.persistence.jdbc.model.ItemsVO; import org.openhab.persistence.jdbc.utils.StringUtilsExt; | import org.knowm.yank.*; import org.openhab.persistence.jdbc.model.*; import org.openhab.persistence.jdbc.utils.*; | [
"org.knowm.yank",
"org.openhab.persistence"
] | org.knowm.yank; org.openhab.persistence; | 1,195,131 |
public long createStudent(long fkCourseId, String name, String surname,
String mail) {
ContentValues initialValues = new ContentValues();
initialValues.put(S_FIRST_NAME, name);
initialValues.put(S_LAST_NAME, surname);
initialValues.put(S_MAIL, mail);
initialValues.put(S_FK_COURSE, fkCourseId);
return database.insert(TABLE_STUDENT, null, initialValues);
} | long function(long fkCourseId, String name, String surname, String mail) { ContentValues initialValues = new ContentValues(); initialValues.put(S_FIRST_NAME, name); initialValues.put(S_LAST_NAME, surname); initialValues.put(S_MAIL, mail); initialValues.put(S_FK_COURSE, fkCourseId); return database.insert(TABLE_STUDENT, null, initialValues); } | /**
* Create a new Student instance.
*
* @return row id, -1 if failure.
*/ | Create a new Student instance | createStudent | {
"repo_name": "fabriph/peer-instruction",
"path": "teacher-app-studio/PITeacher/app/src/main/java/com/fabricioph/piteacher/adapters/DBAdapter.java",
"license": "apache-2.0",
"size": 43538
} | [
"android.content.ContentValues"
] | import android.content.ContentValues; | import android.content.*; | [
"android.content"
] | android.content; | 2,273,917 |
public boolean getBoolean(int row, int column)
throws SQLException
{
Object object = getObject(row, column);
if (object instanceof Boolean)
return ((Boolean) object).booleanValue();
else if (object instanceof Number)
return ((Number) object).intValue() != 0;
else if (object instanceof String) {
String s = (String) object;
return s.startsWith("t") || s.startsWith("y");
}
else
return object != null;
} | boolean function(int row, int column) throws SQLException { Object object = getObject(row, column); if (object instanceof Boolean) return ((Boolean) object).booleanValue(); else if (object instanceof Number) return ((Number) object).intValue() != 0; else if (object instanceof String) { String s = (String) object; return s.startsWith("t") s.startsWith("y"); } else return object != null; } | /**
* Returns the boolean value for the column.
*/ | Returns the boolean value for the column | getBoolean | {
"repo_name": "christianchristensen/resin",
"path": "modules/resin/src/com/caucho/amber/query/ResultSetCacheChunk.java",
"license": "gpl-2.0",
"size": 7894
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,458,111 |
public ConnectionConfiguration withKeystorePassword(String keystorePassword) {
checkArgument(keystorePassword != null, "ConnectionConfiguration.create()"
+ ".withKeystorePassword(keystorePassword) called with null keystorePassword");
return builder().setKeystorePassword(keystorePassword).build();
} | ConnectionConfiguration function(String keystorePassword) { checkArgument(keystorePassword != null, STR + STR); return builder().setKeystorePassword(keystorePassword).build(); } | /**
* If Elasticsearch uses SSL/TLS with mutual authentication (via shield),
* provide the password to open the client keystore.
*
* @param keystorePassword the password of the client keystore.
* @return the {@link ConnectionConfiguration} object with keystore passwo:rd set.
*/ | If Elasticsearch uses SSL/TLS with mutual authentication (via shield), provide the password to open the client keystore | withKeystorePassword | {
"repo_name": "eljefe6a/incubator-beam",
"path": "sdks/java/io/elasticsearch/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIO.java",
"license": "apache-2.0",
"size": 35084
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 2,506,462 |
static void setPriority(ArrayList<String> overlays,
boolean restartUi) {
try {
interfacerInterface.changePriority(overlays, restartUi);
} catch (RemoteException ignored) {
}
} | static void setPriority(ArrayList<String> overlays, boolean restartUi) { try { interfacerInterface.changePriority(overlays, restartUi); } catch (RemoteException ignored) { } } | /**
* Set priority of overlays
*
* @param overlays List of overlays
* @param restartUi Whether to restart SystemUI or not
*/ | Set priority of overlays | setPriority | {
"repo_name": "nicholaschum/substratum",
"path": "app/src/main/java/projekt/substratum/common/platform/ThemeInterfacerService.java",
"license": "gpl-3.0",
"size": 6520
} | [
"android.os.RemoteException",
"java.util.ArrayList"
] | import android.os.RemoteException; import java.util.ArrayList; | import android.os.*; import java.util.*; | [
"android.os",
"java.util"
] | android.os; java.util; | 2,547,254 |
public final void addDirectory(File file) throws IOException {
this.addURL(file.getCanonicalFile().toURL());
} | final void function(File file) throws IOException { this.addURL(file.getCanonicalFile().toURL()); } | /**
* Adds a new directory of class files.
*
* @param file
* for jar or directory
* @throws IOException
*/ | Adds a new directory of class files | addDirectory | {
"repo_name": "apache/cocoon",
"path": "core/cocoon-sitemap/cocoon-sitemap-impl/src/main/java/org/apache/cocoon/classloader/DefaultClassLoader.java",
"license": "apache-2.0",
"size": 6193
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,821,208 |
public Form getCurrent(){
Form current = impl.getCurrentForm();
if(current != null && current instanceof Dialog) {
if(((Dialog)current).isMenu() || ((Dialog)current).isDisposed()) {
Form p = current.getPreviousForm();
if(p != null) {
return p;
}
// we are in the middle of a transition so we should extract the next form
if(animationQueue != null) {
int size = animationQueue.size();
for(int iter = 0 ; iter < size ; iter++) {
Animation o = animationQueue.get(iter);
if(o instanceof Transition) {
return (Form)((Transition)o).getDestination();
}
}
}
}
}
return current;
} | Form function(){ Form current = impl.getCurrentForm(); if(current != null && current instanceof Dialog) { if(((Dialog)current).isMenu() ((Dialog)current).isDisposed()) { Form p = current.getPreviousForm(); if(p != null) { return p; } if(animationQueue != null) { int size = animationQueue.size(); for(int iter = 0 ; iter < size ; iter++) { Animation o = animationQueue.get(iter); if(o instanceof Transition) { return (Form)((Transition)o).getDestination(); } } } } } return current; } | /**
* Return the form currently displayed on the screen or null if no form is
* currently displayed.
*
* @return the form currently displayed on the screen or null if no form is
* currently displayed
*/ | Return the form currently displayed on the screen or null if no form is currently displayed | getCurrent | {
"repo_name": "codenameone/CodenameOne",
"path": "CodenameOne/src/com/codename1/ui/Display.java",
"license": "gpl-2.0",
"size": 192339
} | [
"com.codename1.ui.animations.Animation",
"com.codename1.ui.animations.Transition"
] | import com.codename1.ui.animations.Animation; import com.codename1.ui.animations.Transition; | import com.codename1.ui.animations.*; | [
"com.codename1.ui"
] | com.codename1.ui; | 508,920 |
public static MemoryPoolMXBean findHeap() {
List<MemoryPoolMXBean> heaps = new ArrayList<>();
for (MemoryPoolMXBean mxBean : ManagementFactory.getMemoryPoolMXBeans()) {
if(mxBean.getType() != MemoryType.HEAP) {
continue;
}
if(!mxBean.isUsageThresholdSupported())
continue;
heaps.add(mxBean);
}
return ListFns.maxBy(heaps, input -> input.getUsage().getMax());
} | static MemoryPoolMXBean function() { List<MemoryPoolMXBean> heaps = new ArrayList<>(); for (MemoryPoolMXBean mxBean : ManagementFactory.getMemoryPoolMXBeans()) { if(mxBean.getType() != MemoryType.HEAP) { continue; } if(!mxBean.isUsageThresholdSupported()) continue; heaps.add(mxBean); } return ListFns.maxBy(heaps, input -> input.getUsage().getMax()); } | /**
* Some heuristics taken from Galago for finding the heap we want to monitor.
* @return the {@link MemoryPoolMXBean} representing the heap.
*/ | Some heuristics taken from Galago for finding the heap we want to monitor | findHeap | {
"repo_name": "jjfiv/chai",
"path": "src/main/java/ciir/jfoley/chai/jvm/MemoryNotifier.java",
"license": "bsd-3-clause",
"size": 3638
} | [
"java.lang.management.ManagementFactory",
"java.lang.management.MemoryPoolMXBean",
"java.lang.management.MemoryType",
"java.util.ArrayList",
"java.util.List"
] | import java.lang.management.ManagementFactory; import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryType; import java.util.ArrayList; import java.util.List; | import java.lang.management.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,619,020 |
SqlFunction calciteFunction(); | SqlFunction calciteFunction(); | /**
* Returns the SQL operator corresponding to this aggregation function. Should be a singleton.
*
* @return operator
*/ | Returns the SQL operator corresponding to this aggregation function. Should be a singleton | calciteFunction | {
"repo_name": "noddi/druid",
"path": "sql/src/main/java/io/druid/sql/calcite/expression/SqlExtractionOperator.java",
"license": "apache-2.0",
"size": 1778
} | [
"org.apache.calcite.sql.SqlFunction"
] | import org.apache.calcite.sql.SqlFunction; | import org.apache.calcite.sql.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 709,328 |
return client.getBlobAsyncClient(blobPath)
.download()
.reduce(new ByteArrayOutputStream(), (os, buffer) -> {
try {
os.write(FluxUtil.byteBufferToArray(buffer));
} catch (IOException e) {
throw LOGGER.logExceptionAsError(new UncheckedIOException(e));
}
return os;
}).map(ByteArrayOutputStream::toByteArray);
} | return client.getBlobAsyncClient(blobPath) .download() .reduce(new ByteArrayOutputStream(), (os, buffer) -> { try { os.write(FluxUtil.byteBufferToArray(buffer)); } catch (IOException e) { throw LOGGER.logExceptionAsError(new UncheckedIOException(e)); } return os; }).map(ByteArrayOutputStream::toByteArray); } | /**
* Reduces a Flux of ByteBuffer into a Mono of String
*/ | Reduces a Flux of ByteBuffer into a Mono of String | downloadToByteArray | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storage/azure-storage-blob-changefeed/src/main/java/com/azure/storage/blob/changefeed/implementation/util/DownloadUtils.java",
"license": "mit",
"size": 1672
} | [
"com.azure.core.util.FluxUtil",
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.UncheckedIOException"
] | import com.azure.core.util.FluxUtil; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UncheckedIOException; | import com.azure.core.util.*; import java.io.*; | [
"com.azure.core",
"java.io"
] | com.azure.core; java.io; | 2,432,047 |
void visit(Less node); | void visit(Less node); | /**
* Visits an AST node of type Less.
*
* @param node
* The AST node to visit
*/ | Visits an AST node of type Less | visit | {
"repo_name": "team-worthwhile/worthwhile",
"path": "implementierung/src/worthwhile.model/src/edu/kit/iti/formal/pse/worthwhile/model/ast/visitor/IASTNodeVisitor.java",
"license": "bsd-3-clause",
"size": 13590
} | [
"edu.kit.iti.formal.pse.worthwhile.model.ast.Less"
] | import edu.kit.iti.formal.pse.worthwhile.model.ast.Less; | import edu.kit.iti.formal.pse.worthwhile.model.ast.*; | [
"edu.kit.iti"
] | edu.kit.iti; | 494,733 |
@SuppressWarnings("cast")
public GenPolynomial<C> normalform(Map<Integer, GenPolynomial<C>> mp, GenPolynomial<C> Ap) {
if (mp == null || mp.isEmpty()) {
return Ap;
}
if (Ap == null || Ap.isZERO()) {
return Ap;
}
int l;
GenPolynomial<C>[] P;
//synchronized ( mp ) { // no more required
l = mp.size();
P = (GenPolynomial<C>[]) new GenPolynomial[l];
P = mp.values().toArray(P);
l = P.length;
//}
Map.Entry<ExpVector, C> m;
Map.Entry<ExpVector, C> m1;
ExpVector e;
ExpVector f = null;
C a;
boolean mt = false;
GenPolynomial<C> Rz = Ap.ring.getZERO();
GenPolynomial<C> R = Rz.copy();
GenPolynomial<C> p = null;
//GenPolynomial<C> Q = null;
GenPolynomial<C> S = Ap.copy();
while (S.length() > 0) {
if (mp.size() != l) {
//long t = System.currentTimeMillis();
//synchronized ( mp ) { // no more required, ok in distributed
P = mp.values().toArray(P);
l = P.length;
//}
//t = System.currentTimeMillis()-t;
//logger.info("Pp.toArray() = " + t + " ms, size() = " + l);
//logger.info("Pp.toArray() size() = " + l);
S = Ap.copy(); // S.add(R)? // restart reduction ?
R = Rz.copy();
}
m = S.leadingMonomial();
e = m.getKey();
a = m.getValue();
for (int i = 0; i < P.length; i++) {
p = P[i];
f = p.leadingExpVector();
if (f != null) {
mt = e.multipleOf(f);
if (mt)
break;
}
}
if (!mt) {
//logger.debug("irred");
//R = R.sum( a, e );
//S = S.subtract( a, e );
R.doPutToMap(e, a);
S.doRemoveFromMap(e, a);
// System.out.println(" S = " + S);
} else {
//logger.debug("red");
m1 = p.leadingMonomial();
e = e.subtract(f);
a = a.divide(m1.getValue());
//Q = p.multiply( a, e );
//S = S.subtract( Q );
S = S.subtractMultiple(a, e, p);
}
}
return R;
} | @SuppressWarnings("cast") GenPolynomial<C> function(Map<Integer, GenPolynomial<C>> mp, GenPolynomial<C> Ap) { if (mp == null mp.isEmpty()) { return Ap; } if (Ap == null Ap.isZERO()) { return Ap; } int l; GenPolynomial<C>[] P; l = mp.size(); P = (GenPolynomial<C>[]) new GenPolynomial[l]; P = mp.values().toArray(P); l = P.length; Map.Entry<ExpVector, C> m; Map.Entry<ExpVector, C> m1; ExpVector e; ExpVector f = null; C a; boolean mt = false; GenPolynomial<C> Rz = Ap.ring.getZERO(); GenPolynomial<C> R = Rz.copy(); GenPolynomial<C> p = null; GenPolynomial<C> S = Ap.copy(); while (S.length() > 0) { if (mp.size() != l) { P = mp.values().toArray(P); l = P.length; S = Ap.copy(); R = Rz.copy(); } m = S.leadingMonomial(); e = m.getKey(); a = m.getValue(); for (int i = 0; i < P.length; i++) { p = P[i]; f = p.leadingExpVector(); if (f != null) { mt = e.multipleOf(f); if (mt) break; } } if (!mt) { R.doPutToMap(e, a); S.doRemoveFromMap(e, a); } else { m1 = p.leadingMonomial(); e = e.subtract(f); a = a.divide(m1.getValue()); S = S.subtractMultiple(a, e, p); } } return R; } | /**
* Normalform. Allows concurrent modification of the DHT.
* @param Ap polynomial.
* @param mp a map from Integers to polynomials, e.g. a distributed hash
* table, concurrent modification allowed.
* @return nf(Ap) with respect to Pp.
*/ | Normalform. Allows concurrent modification of the DHT | normalform | {
"repo_name": "breandan/java-algebra-system",
"path": "src/edu/jas/gb/ReductionPar.java",
"license": "gpl-2.0",
"size": 6800
} | [
"edu.jas.poly.ExpVector",
"edu.jas.poly.GenPolynomial",
"java.util.Map"
] | import edu.jas.poly.ExpVector; import edu.jas.poly.GenPolynomial; import java.util.Map; | import edu.jas.poly.*; import java.util.*; | [
"edu.jas.poly",
"java.util"
] | edu.jas.poly; java.util; | 1,053,484 |
public List<ErrorDetails> details() {
return this.details;
} | List<ErrorDetails> function() { return this.details; } | /**
* Get the details value.
*
* @return the details value
*/ | Get the details value | details | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/Error.java",
"license": "mit",
"size": 2994
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,129,327 |
protected String acceptInput() {
printInputPrefix();
try {
while(_state >= 0 && !_inputter.ready()) {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
_state = -1;
e.printStackTrace();
}
}
} catch (IOException ex) {
_state = -1;
ex.printStackTrace();
}
if(_state < 0) return "";
String str = "";
try {
str = _inputter.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
| String function() { printInputPrefix(); try { while(_state >= 0 && !_inputter.ready()) { try { Thread.sleep(10); } catch (InterruptedException e) { _state = -1; e.printStackTrace(); } } } catch (IOException ex) { _state = -1; ex.printStackTrace(); } if(_state < 0) return STR"; try { str = _inputter.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } | /**
* Gets user input from console.
*
* @return the input content
*/ | Gets user input from console | acceptInput | {
"repo_name": "joelam789/flame-ring",
"path": "project/flame-ring/src/org/flamering/app/ConsoleApp.java",
"license": "apache-2.0",
"size": 16298
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 131,251 |
public List<CourseAttributes> getSoftDeletedCoursesForInstructors(List<InstructorAttributes> instructorList) {
assert instructorList != null;
return coursesLogic.getSoftDeletedCoursesForInstructors(instructorList);
} | List<CourseAttributes> function(List<InstructorAttributes> instructorList) { assert instructorList != null; return coursesLogic.getSoftDeletedCoursesForInstructors(instructorList); } | /**
* Preconditions: <br>
* * All parameters are non-null.
*
* @return Courses in Recycle Bin that the given instructors is in.
*/ | Preconditions: All parameters are non-null | getSoftDeletedCoursesForInstructors | {
"repo_name": "TEAMMATES/teammates",
"path": "src/main/java/teammates/logic/api/Logic.java",
"license": "gpl-2.0",
"size": 53736
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,144,019 |
public Map<Music, Map<String, String>> find(final FilesystemTreeEntry entry,
final String name) throws IOException, MPDException {
onlyMusicSupported(entry);
final Map<Music, Map<String, String>> foundStickers;
if (isAvailable()) {
final CommandResult result =
mConnection.submit(CMD_ACTION_FIND, entry.getFullPath(), name).get();
final KeyValueResponse response = new KeyValueResponse(result);
final Map<String, Music> musicPair = getMusicPair(response);
foundStickers = new HashMap<>(musicPair.size());
final Map<String, String> currentTrackStickers = new HashMap<>();
Music currentMusic = null;
for (final Map.Entry<String, String> mapEntry : response) {
final String key = mapEntry.getKey();
if (CMD_RESPONSE_FILE.equals(key)) {
if (!foundStickers.isEmpty()) {
foundStickers.put(currentMusic, currentTrackStickers);
currentTrackStickers.clear();
}
currentMusic = musicPair.get(mapEntry.getValue());
} else if (CMD_RESPONSE_STICKER.equals(key)) {
final String value = mapEntry.getValue();
final int delimiterIndex = value.indexOf('=');
final String stickerKey = value.substring(0, delimiterIndex);
final String stickerValue = value.substring(delimiterIndex + 1);
currentTrackStickers.put(stickerKey, stickerValue);
}
}
} else {
Log.debug(TAG, STICKERS_NOT_AVAILABLE);
foundStickers = Collections.emptyMap();
}
return foundStickers;
} | Map<Music, Map<String, String>> function(final FilesystemTreeEntry entry, final String name) throws IOException, MPDException { onlyMusicSupported(entry); final Map<Music, Map<String, String>> foundStickers; if (isAvailable()) { final CommandResult result = mConnection.submit(CMD_ACTION_FIND, entry.getFullPath(), name).get(); final KeyValueResponse response = new KeyValueResponse(result); final Map<String, Music> musicPair = getMusicPair(response); foundStickers = new HashMap<>(musicPair.size()); final Map<String, String> currentTrackStickers = new HashMap<>(); Music currentMusic = null; for (final Map.Entry<String, String> mapEntry : response) { final String key = mapEntry.getKey(); if (CMD_RESPONSE_FILE.equals(key)) { if (!foundStickers.isEmpty()) { foundStickers.put(currentMusic, currentTrackStickers); currentTrackStickers.clear(); } currentMusic = musicPair.get(mapEntry.getValue()); } else if (CMD_RESPONSE_STICKER.equals(key)) { final String value = mapEntry.getValue(); final int delimiterIndex = value.indexOf('='); final String stickerKey = value.substring(0, delimiterIndex); final String stickerValue = value.substring(delimiterIndex + 1); currentTrackStickers.put(stickerKey, stickerValue); } } } else { Log.debug(TAG, STICKERS_NOT_AVAILABLE); foundStickers = Collections.emptyMap(); } return foundStickers; } | /**
* Searches the media server sticker database for matching stickers below the entry given. For
* each matching track, it prints the URI and that one sticker's value.
*
* @param entry The entry to search below in the entry's hierarchy.
* @param name The name to search the stickers for.
* @return A map of entries from the media server.
* @throws IOException Thrown upon a communication error with the server.
* @throws MPDException Thrown if an error occurs as a result of command execution.
*/ | Searches the media server sticker database for matching stickers below the entry given. For each matching track, it prints the URI and that one sticker's value | find | {
"repo_name": "hurzl/dmix",
"path": "JMPDComm/src/main/java/com/anpmech/mpd/subsystem/Sticker.java",
"license": "apache-2.0",
"size": 17863
} | [
"com.anpmech.mpd.Log",
"com.anpmech.mpd.commandresponse.KeyValueResponse",
"com.anpmech.mpd.connection.CommandResult",
"com.anpmech.mpd.exception.MPDException",
"com.anpmech.mpd.item.FilesystemTreeEntry",
"com.anpmech.mpd.item.Music",
"java.io.IOException",
"java.util.Collections",
"java.util.HashMap",
"java.util.Map"
] | import com.anpmech.mpd.Log; import com.anpmech.mpd.commandresponse.KeyValueResponse; import com.anpmech.mpd.connection.CommandResult; import com.anpmech.mpd.exception.MPDException; import com.anpmech.mpd.item.FilesystemTreeEntry; import com.anpmech.mpd.item.Music; import java.io.IOException; import java.util.Collections; import java.util.HashMap; import java.util.Map; | import com.anpmech.mpd.*; import com.anpmech.mpd.commandresponse.*; import com.anpmech.mpd.connection.*; import com.anpmech.mpd.exception.*; import com.anpmech.mpd.item.*; import java.io.*; import java.util.*; | [
"com.anpmech.mpd",
"java.io",
"java.util"
] | com.anpmech.mpd; java.io; java.util; | 360,302 |
private Set<Input> readFromFile(Scanner scanner) throws WrongFormatException {
Set<Input> inputSet = new HashSet<Input>();
if (!scanner.hasNextLine()) {
throw new WrongFormatException(N_TEST_CASES_NOT_FOUND);
}
int nCases = parsePositiveInt(scanner.nextLine(), Input.N_CASES_MIN, Input.N_CASES_MAX);
for (int i = 0; i < nCases; i++) {
Input input = readCase(i, scanner, nCases);
inputSet.add(input);
}
return inputSet;
}
| Set<Input> function(Scanner scanner) throws WrongFormatException { Set<Input> inputSet = new HashSet<Input>(); if (!scanner.hasNextLine()) { throw new WrongFormatException(N_TEST_CASES_NOT_FOUND); } int nCases = parsePositiveInt(scanner.nextLine(), Input.N_CASES_MIN, Input.N_CASES_MAX); for (int i = 0; i < nCases; i++) { Input input = readCase(i, scanner, nCases); inputSet.add(input); } return inputSet; } | /**
* PRIVATE HELPER METHODS
*/ | PRIVATE HELPER METHODS | readFromFile | {
"repo_name": "adriwankenobi/paint-shop-java",
"path": "src/com/acerete/input/FileInputReader.java",
"license": "gpl-2.0",
"size": 4645
} | [
"com.acerete.exception.WrongFormatException",
"java.util.HashSet",
"java.util.Scanner",
"java.util.Set"
] | import com.acerete.exception.WrongFormatException; import java.util.HashSet; import java.util.Scanner; import java.util.Set; | import com.acerete.exception.*; import java.util.*; | [
"com.acerete.exception",
"java.util"
] | com.acerete.exception; java.util; | 1,454,015 |
public void setParentResource(CmsResource parentResource) {
if (parentResource.isFile()) {
m_parentPath = CmsResource.getFolderPath(parentResource.getRootPath());
} else {
m_parentPath = parentResource.getRootPath();
}
} | void function(CmsResource parentResource) { if (parentResource.isFile()) { m_parentPath = CmsResource.getFolderPath(parentResource.getRootPath()); } else { m_parentPath = parentResource.getRootPath(); } } | /**
* Sets the parent path to read visited resources from using the given resource as parent.<p>
*
* @param parentResource the resource to use as parent resource
*/ | Sets the parent path to read visited resources from using the given resource as parent | setParentResource | {
"repo_name": "victos/opencms-core",
"path": "src/org/opencms/db/CmsVisitedByFilter.java",
"license": "lgpl-2.1",
"size": 7332
} | [
"org.opencms.file.CmsResource"
] | import org.opencms.file.CmsResource; | import org.opencms.file.*; | [
"org.opencms.file"
] | org.opencms.file; | 990,784 |
Optional<SkullType> getSkullType(String name); | Optional<SkullType> getSkullType(String name); | /**
* Gets the {@link SkullType} with the provided name.
*
* @param name The name of the skull type
* @return The {@link SkullType} with the given name or Optional.absent() if not found
*/ | Gets the <code>SkullType</code> with the provided name | getSkullType | {
"repo_name": "SpongeHistory/SpongeAPI-History",
"path": "src/main/java/org/spongepowered/api/GameRegistry.java",
"license": "mit",
"size": 37085
} | [
"com.google.common.base.Optional",
"org.spongepowered.api.block.tile.data.SkullType"
] | import com.google.common.base.Optional; import org.spongepowered.api.block.tile.data.SkullType; | import com.google.common.base.*; import org.spongepowered.api.block.tile.data.*; | [
"com.google.common",
"org.spongepowered.api"
] | com.google.common; org.spongepowered.api; | 1,218,114 |
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
if(getViewPager().getCurrentItem() == adapter.getCount() - 1) {
doneBtn.setVisibility(View.VISIBLE);
nextBtn.setVisibility(View.GONE);
skipBtn.setVisibility(View.GONE);
}else{
doneBtn.setVisibility(View.GONE);
nextBtn.setVisibility(View.VISIBLE);
skipBtn.setVisibility(View.VISIBLE);
}
} | void function(int position) { super.onPageSelected(position); if(getViewPager().getCurrentItem() == adapter.getCount() - 1) { doneBtn.setVisibility(View.VISIBLE); nextBtn.setVisibility(View.GONE); skipBtn.setVisibility(View.GONE); }else{ doneBtn.setVisibility(View.GONE); nextBtn.setVisibility(View.VISIBLE); skipBtn.setVisibility(View.VISIBLE); } } | /**
* Show/hide buttons depending on page
* @param position
*/ | Show/hide buttons depending on page | onPageSelected | {
"repo_name": "KishorAndroid/PocketHub",
"path": "app/src/main/java/com/github/pockethub/android/ui/WelcomeActivity.java",
"license": "apache-2.0",
"size": 6894
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,779,074 |
public static boolean isXiaomiDevice() {
return new File("/system/etc/permissions/platform-miui.xml").exists();
} | static boolean function() { return new File(STR).exists(); } | /**
* Checks if the device is a Xiaomi device
*
* @return True, if it passes all Xiaomi tests
*/ | Checks if the device is a Xiaomi device | isXiaomiDevice | {
"repo_name": "nicholaschum/substratum",
"path": "app/src/main/java/projekt/substratum/common/Systems.java",
"license": "gpl-3.0",
"size": 28233
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,203,507 |
public MetaProperty<ConventionLink<C>> convention() {
return _convention;
} | MetaProperty<ConventionLink<C>> function() { return _convention; } | /**
* The meta-property for the {@code convention} property.
* @return the meta-property, not null
*/ | The meta-property for the convention property | convention | {
"repo_name": "jeorme/OG-Platform",
"path": "sesame/sesame-function/src/main/java/com/opengamma/sesame/sabr/SabrSurfaceSelector.java",
"license": "apache-2.0",
"size": 14541
} | [
"com.opengamma.core.link.ConventionLink",
"org.joda.beans.MetaProperty"
] | import com.opengamma.core.link.ConventionLink; import org.joda.beans.MetaProperty; | import com.opengamma.core.link.*; import org.joda.beans.*; | [
"com.opengamma.core",
"org.joda.beans"
] | com.opengamma.core; org.joda.beans; | 486,572 |
Map<String, String> cookies();
} | Map<String, String> cookies(); } | /**
* Retrieve all of the request/response cookies as a map
* @return cookies
*/ | Retrieve all of the request/response cookies as a map | cookies | {
"repo_name": "recastrodiaz/jsoup",
"path": "src/main/java/org/jsoup/Connection.java",
"license": "mit",
"size": 23366
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,802,723 |
public List<String> downloadOutputs(String outputPrefix, int numLinesExpected) throws Exception {
// Download the pipeline results.
List<String> results = null;
ExponentialBackOff backoff = new ExponentialBackOff.Builder()
.setMaxIntervalMillis(6000)
.build();
while (true) {
try {
results = Lists.newArrayList();
for (GcsPath path : gcsUtil.expand(GcsPath.fromUri(outputPrefix + "*"))) {
BufferedReader reader = openOutput(path.toString());
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
results.add(line);
}
reader.close();
}
} catch (FileNotFoundException e) {
long backOffMillis = backoff.nextBackOffMillis();
if (backOffMillis == BackOff.STOP) {
throw e;
}
Thread.sleep(backOffMillis);
}
long backOffMillis = backoff.nextBackOffMillis();
if (numLinesExpected == results.size()
|| backOffMillis == BackOff.STOP) {
// If we have the number of results we expect OR we've used all the retries
// (e.g., due to a real test failure), exit from this loop.
break;
}
Thread.sleep(backOffMillis);
}
return results;
} | List<String> function(String outputPrefix, int numLinesExpected) throws Exception { List<String> results = null; ExponentialBackOff backoff = new ExponentialBackOff.Builder() .setMaxIntervalMillis(6000) .build(); while (true) { try { results = Lists.newArrayList(); for (GcsPath path : gcsUtil.expand(GcsPath.fromUri(outputPrefix + "*"))) { BufferedReader reader = openOutput(path.toString()); for (String line = reader.readLine(); line != null; line = reader.readLine()) { results.add(line); } reader.close(); } } catch (FileNotFoundException e) { long backOffMillis = backoff.nextBackOffMillis(); if (backOffMillis == BackOff.STOP) { throw e; } Thread.sleep(backOffMillis); } long backOffMillis = backoff.nextBackOffMillis(); if (numLinesExpected == results.size() backOffMillis == BackOff.STOP) { break; } Thread.sleep(backOffMillis); } return results; } | /**
* Download multi file test output.
*
* Some cloud storage operations are eventually consistent
* https://cloud.google.com/storage/docs/consistency so
* be robust for those cases.
*
* @param outputPrefix prefix for files to download
* @param numLinesExpected number of line expected
* @return lines from all test output files
* @throws Exception
*/ | Download multi file test output. Some cloud storage operations are eventually consistent HREF so be robust for those cases | downloadOutputs | {
"repo_name": "googlegenomics/dataflow-java",
"path": "src/test/java/com/google/cloud/genomics/dataflow/pipelines/IntegrationTestHelper.java",
"license": "apache-2.0",
"size": 7363
} | [
"com.google.api.client.util.BackOff",
"com.google.api.client.util.ExponentialBackOff",
"com.google.api.client.util.Lists",
"java.io.BufferedReader",
"java.io.FileNotFoundException",
"java.util.List",
"org.apache.beam.sdk.util.gcsfs.GcsPath"
] | import com.google.api.client.util.BackOff; import com.google.api.client.util.ExponentialBackOff; import com.google.api.client.util.Lists; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.util.List; import org.apache.beam.sdk.util.gcsfs.GcsPath; | import com.google.api.client.util.*; import java.io.*; import java.util.*; import org.apache.beam.sdk.util.gcsfs.*; | [
"com.google.api",
"java.io",
"java.util",
"org.apache.beam"
] | com.google.api; java.io; java.util; org.apache.beam; | 1,081,093 |
public void idhtColumns(final boolean scale) {
int oldNthreads = ConcurrencyUtils.getNumberOfThreads();
ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads));
int nthreads = ConcurrencyUtils.getNumberOfThreads();
if ((nthreads > 1) && (size() >= ConcurrencyUtils.getThreadsBeginN_2D())) {
ConcurrencyUtils.setThreadsBeginN_1D_FFT_2Threads(Integer.MAX_VALUE);
ConcurrencyUtils.setThreadsBeginN_1D_FFT_4Threads(Integer.MAX_VALUE);
nthreads = Math.min(nthreads, columns);
Future<?>[] futures = new Future[nthreads];
int k = columns / nthreads;
for (int j = 0; j < nthreads; j++) {
final int firstColumn = columns - j * k;
final int lastColumn = (j == (nthreads - 1)) ? 0 : firstColumn - k;
futures[j] = ConcurrencyUtils.submit(new Runnable() {
| void function(final boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); int nthreads = ConcurrencyUtils.getNumberOfThreads(); if ((nthreads > 1) && (size() >= ConcurrencyUtils.getThreadsBeginN_2D())) { ConcurrencyUtils.setThreadsBeginN_1D_FFT_2Threads(Integer.MAX_VALUE); ConcurrencyUtils.setThreadsBeginN_1D_FFT_4Threads(Integer.MAX_VALUE); nthreads = Math.min(nthreads, columns); Future<?>[] futures = new Future[nthreads]; int k = columns / nthreads; for (int j = 0; j < nthreads; j++) { final int firstColumn = columns - j * k; final int lastColumn = (j == (nthreads - 1)) ? 0 : firstColumn - k; futures[j] = ConcurrencyUtils.submit(new Runnable() { | /**
* Computes the inverse of the discrete Hartley transform (IDHT) of each
* column of this matrix.
*
* @param scale
* if true then scaling is performed
*
*/ | Computes the inverse of the discrete Hartley transform (IDHT) of each column of this matrix | idhtColumns | {
"repo_name": "Shappiro/GEOFRAME",
"path": "PROJECTS/oms3.proj.richards1d/src/JAVA/parallelcolt-code/src/cern/colt/matrix/tdouble/impl/DenseColumnDoubleMatrix2D.java",
"license": "gpl-3.0",
"size": 123607
} | [
"edu.emory.mathcs.utils.ConcurrencyUtils",
"java.util.concurrent.Future"
] | import edu.emory.mathcs.utils.ConcurrencyUtils; import java.util.concurrent.Future; | import edu.emory.mathcs.utils.*; import java.util.concurrent.*; | [
"edu.emory.mathcs",
"java.util"
] | edu.emory.mathcs; java.util; | 2,155,331 |
@Nullable
Widget getWidget(int groupId, int childId); | Widget getWidget(int groupId, int childId); | /**
* Gets a widget by its raw group ID and child ID.
* <p>
* Note: Use {@link #getWidget(WidgetInfo)} for a more human-readable
* version of this method.
*
* @param groupId the group ID
* @param childId the child widget ID
* @return the widget corresponding to the group and child pair
*/ | Gets a widget by its raw group ID and child ID. Note: Use <code>#getWidget(WidgetInfo)</code> for a more human-readable version of this method | getWidget | {
"repo_name": "Sethtroll/runelite",
"path": "runelite-api/src/main/java/net/runelite/api/Client.java",
"license": "bsd-2-clause",
"size": 40333
} | [
"net.runelite.api.widgets.Widget"
] | import net.runelite.api.widgets.Widget; | import net.runelite.api.widgets.*; | [
"net.runelite.api"
] | net.runelite.api; | 1,078,489 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.