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 boolean readFilesFromZip(File graphFile) { ZipFile zipFile = null; try { // --- Read the zip file content ------------------------ zipFile = new ZipFile(graphFile); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String fileName = entry.getName(); if (this.getValidFileNames().contains(fileName) == true) { // --- valid file name => import ---------------- InputStream inputStream = zipFile.getInputStream(entry); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); // --- Create CsvDataController for the file ---- CsvDataController csvDC = new CsvDataController(); csvDC.setHeadline(this.hasHeadline); csvDC.setSeparator(this.separator); csvDC.doImport(br); // --- Remind the controller for next steps ----- this.getCsvDataController().put(fileName, csvDC); inputStream.close(); br.close(); } } zipFile.close(); return true; } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { zipFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } return false; }
boolean function(File graphFile) { ZipFile zipFile = null; try { zipFile = new ZipFile(graphFile); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String fileName = entry.getName(); if (this.getValidFileNames().contains(fileName) == true) { InputStream inputStream = zipFile.getInputStream(entry); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); CsvDataController csvDC = new CsvDataController(); csvDC.setHeadline(this.hasHeadline); csvDC.setSeparator(this.separator); csvDC.doImport(br); this.getCsvDataController().put(fileName, csvDC); inputStream.close(); br.close(); } } zipFile.close(); return true; } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { zipFile.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } return false; }
/** * Read files from the specified zip file. * * @param graphFile the graph file * @return true, if successful */
Read files from the specified zip file
readFilesFromZip
{ "repo_name": "EnFlexIT/AgentWorkbench", "path": "eclipseProjects/org.agentgui/bundles/org.awb.env.networkModel/src/org/awb/env/networkModel/persistence/AbstractNetworkModelCsvImporter.java", "license": "lgpl-2.1", "size": 8330 }
[ "de.enflexit.common.csv.CsvDataController", "java.io.BufferedReader", "java.io.File", "java.io.IOException", "java.io.InputStream", "java.io.InputStreamReader", "java.util.Enumeration", "java.util.zip.ZipEntry", "java.util.zip.ZipFile" ]
import de.enflexit.common.csv.CsvDataController; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile;
import de.enflexit.common.csv.*; import java.io.*; import java.util.*; import java.util.zip.*;
[ "de.enflexit.common", "java.io", "java.util" ]
de.enflexit.common; java.io; java.util;
1,976,206
protected final void setAcceptedLanguage(LanguageMode lang) { checkState(this.setUpRan, "Attempted to configure before running setUp()."); setLanguage(lang, lang); }
final void function(LanguageMode lang) { checkState(this.setUpRan, STR); setLanguage(lang, lang); }
/** * What language to allow in source parsing. Also sets the output language. */
What language to allow in source parsing. Also sets the output language
setAcceptedLanguage
{ "repo_name": "MatrixFrog/closure-compiler", "path": "test/com/google/javascript/jscomp/CompilerTestCase.java", "license": "apache-2.0", "size": 77821 }
[ "com.google.common.base.Preconditions", "com.google.javascript.jscomp.CompilerOptions" ]
import com.google.common.base.Preconditions; import com.google.javascript.jscomp.CompilerOptions;
import com.google.common.base.*; import com.google.javascript.jscomp.*;
[ "com.google.common", "com.google.javascript" ]
com.google.common; com.google.javascript;
727,330
public void fine(String message) { if (logLevel.includes(LogLevel.FINE)) { logger.info(message); writeLog("[FINE] " + message); } } // -------- // Debug log methods // --------
void function(String message) { if (logLevel.includes(LogLevel.FINE)) { logger.info(message); writeLog(STR + message); } }
/** * Log a FINE message if enabled. * <p> * Implementation note: this logs a message on INFO level because * levels below INFO are disabled by Bukkit/Spigot. * * @param message The message to log */
Log a FINE message if enabled. Implementation note: this logs a message on INFO level because levels below INFO are disabled by Bukkit/Spigot
fine
{ "repo_name": "AuthMe/AuthMeReloaded", "path": "src/main/java/fr/xephi/authme/ConsoleLogger.java", "license": "gpl-3.0", "size": 8104 }
[ "fr.xephi.authme.output.LogLevel" ]
import fr.xephi.authme.output.LogLevel;
import fr.xephi.authme.output.*;
[ "fr.xephi.authme" ]
fr.xephi.authme;
27,049
JavaClassDescription getReferencedClass(String referencedName) throws SCRDescriptorException;
JavaClassDescription getReferencedClass(String referencedName) throws SCRDescriptorException;
/** * Search for the class. * If the referenced name is not fully qualified, the imports * of the class are searched. * @param referencedName * @return The java class description or null * @throws SCRDescriptorException */
Search for the class. If the referenced name is not fully qualified, the imports of the class are searched
getReferencedClass
{ "repo_name": "boneman1231/org.apache.felix", "path": "trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/tags/JavaClassDescription.java", "license": "apache-2.0", "size": 4350 }
[ "org.apache.felix.scrplugin.SCRDescriptorException" ]
import org.apache.felix.scrplugin.SCRDescriptorException;
import org.apache.felix.scrplugin.*;
[ "org.apache.felix" ]
org.apache.felix;
268,742
public static void escapeParameterReferences(final TemplateDTO templateDto) { final String encodingVersion = templateDto.getEncodingVersion(); if (encodingVersion == null) { escapeParameterReferences(templateDto.getSnippet()); } else { switch (encodingVersion) { case "1.0": case "1.1": case "1.2": escapeParameterReferences(templateDto.getSnippet()); break; } } }
static void function(final TemplateDTO templateDto) { final String encodingVersion = templateDto.getEncodingVersion(); if (encodingVersion == null) { escapeParameterReferences(templateDto.getSnippet()); } else { switch (encodingVersion) { case "1.0": case "1.1": case "1.2": escapeParameterReferences(templateDto.getSnippet()); break; } } }
/** * If template was serialized in a version before Parameters were supported, ensures that any reference to a * Parameter is escaped so that the value is treated as a literal value. * @param templateDto the template */
If template was serialized in a version before Parameters were supported, ensures that any reference to a Parameter is escaped so that the value is treated as a literal value
escapeParameterReferences
{ "repo_name": "jtstorck/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/TemplateUtils.java", "license": "apache-2.0", "size": 15781 }
[ "org.apache.nifi.web.api.dto.TemplateDTO" ]
import org.apache.nifi.web.api.dto.TemplateDTO;
import org.apache.nifi.web.api.dto.*;
[ "org.apache.nifi" ]
org.apache.nifi;
376,614
public void init() { Engine.instance().getEventRegistry().addListener("Plugin", this); Engine.instance().getEventRegistry().addListener("akteraobjectcreated", this); Engine.instance().getEventRegistry().addListener("akteraobjectmodified", this); Engine.instance().getEventRegistry().addListener("akteraobjectremoved", this); Engine.instance().getEventRegistry().addListener("guimanager", this); Engine.instance().getEventRegistry().addListener("User", this); }
void function() { Engine.instance().getEventRegistry().addListener(STR, this); Engine.instance().getEventRegistry().addListener(STR, this); Engine.instance().getEventRegistry().addListener(STR, this); Engine.instance().getEventRegistry().addListener(STR, this); Engine.instance().getEventRegistry().addListener(STR, this); Engine.instance().getEventRegistry().addListener("User", this); }
/** * Initialize the client manager. */
Initialize the client manager
init
{ "repo_name": "iritgo/iritgo-aktera", "path": "aktera-aktario-aktario/src/main/java/de/iritgo/aktera/aktario/akteraconnector/ConnectorServerManager.java", "license": "apache-2.0", "size": 31210 }
[ "de.iritgo.aktario.core.Engine", "de.iritgo.aktario.framework.user.User" ]
import de.iritgo.aktario.core.Engine; import de.iritgo.aktario.framework.user.User;
import de.iritgo.aktario.core.*; import de.iritgo.aktario.framework.user.*;
[ "de.iritgo.aktario" ]
de.iritgo.aktario;
225,640
public void setSpans(FSArray v) { if (CCPTextAnnotation_Type.featOkTst && ((CCPTextAnnotation_Type)jcasType).casFeat_spans == null) jcasType.jcas.throwFeatMissing("spans", "edu.ucdenver.ccp.nlp.core.uima.annotation.CCPTextAnnotation"); jcasType.ll_cas.ll_setRefValue(addr, ((CCPTextAnnotation_Type)jcasType).casFeatCode_spans, jcasType.ll_cas.ll_getFSRef(v));}
void function(FSArray v) { if (CCPTextAnnotation_Type.featOkTst && ((CCPTextAnnotation_Type)jcasType).casFeat_spans == null) jcasType.jcas.throwFeatMissing("spans", STR); jcasType.ll_cas.ll_setRefValue(addr, ((CCPTextAnnotation_Type)jcasType).casFeatCode_spans, jcasType.ll_cas.ll_getFSRef(v));}
/** setter for spans - sets This FSArray stores the CCPSpans which comprise this annotation. It should be noted that for an annotation with multiple spans, the default begin and end fields are set to the beginning of the first span and the end of the final span, respectively. * @generated */
setter for spans - sets This FSArray stores the CCPSpans which comprise this annotation. It should be noted that for an annotation with multiple spans, the default begin and end fields are set to the beginning of the first span and the end of the final span, respectively
setSpans
{ "repo_name": "rockt/ChemSpot", "path": "src/main/types/edu/ucdenver/ccp/nlp/core/uima/annotation/CCPTextAnnotation.java", "license": "epl-1.0", "size": 14118 }
[ "org.apache.uima.jcas.cas.FSArray" ]
import org.apache.uima.jcas.cas.FSArray;
import org.apache.uima.jcas.cas.*;
[ "org.apache.uima" ]
org.apache.uima;
520,474
public void reset(ActionMapping mapping, HttpServletRequest request) { this.loginName = null; this.password = null; }
void function(ActionMapping mapping, HttpServletRequest request) { this.loginName = null; this.password = null; }
/** * Resets the values of all the fields. * This method defined in ActionForm is overridden in this class. */
Resets the values of all the fields. This method defined in ActionForm is overridden in this class
reset
{ "repo_name": "NCIP/cab2b", "path": "software/dependencies/commonpackage/HEAD_TAG_10_Jan_2007_RELEASE_BRANCH_FOR_V11/src/edu/wustl/common/actionForm/LoginForm.java", "license": "bsd-3-clause", "size": 4228 }
[ "javax.servlet.http.HttpServletRequest", "org.apache.struts.action.ActionMapping" ]
import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionMapping;
import javax.servlet.http.*; import org.apache.struts.action.*;
[ "javax.servlet", "org.apache.struts" ]
javax.servlet; org.apache.struts;
115,404
public List<GbStudentGradeInfo> buildGradeMatrix(List<Assignment> assignments, GbAssignmentGradeSortOrder sortOrder) throws GbException { return this.buildGradeMatrix(assignments, this.getGradeableUsers(), sortOrder); }
List<GbStudentGradeInfo> function(List<Assignment> assignments, GbAssignmentGradeSortOrder sortOrder) throws GbException { return this.buildGradeMatrix(assignments, this.getGradeableUsers(), sortOrder); }
/** * Build the matrix of assignments, students and grades for all students, with the specified sortOrder * * @param assignments list of assignments * @param sortOrder the sort order * @return */
Build the matrix of assignments, students and grades for all students, with the specified sortOrder
buildGradeMatrix
{ "repo_name": "maurercw/gradebookNG", "path": "tool/src/java/org/sakaiproject/gradebookng/business/GradebookNgBusinessService.java", "license": "apache-2.0", "size": 41343 }
[ "java.util.List", "org.sakaiproject.gradebookng.business.exception.GbException", "org.sakaiproject.gradebookng.business.model.GbAssignmentGradeSortOrder", "org.sakaiproject.gradebookng.business.model.GbStudentGradeInfo", "org.sakaiproject.service.gradebook.shared.Assignment" ]
import java.util.List; import org.sakaiproject.gradebookng.business.exception.GbException; import org.sakaiproject.gradebookng.business.model.GbAssignmentGradeSortOrder; import org.sakaiproject.gradebookng.business.model.GbStudentGradeInfo; import org.sakaiproject.service.gradebook.shared.Assignment;
import java.util.*; import org.sakaiproject.gradebookng.business.exception.*; import org.sakaiproject.gradebookng.business.model.*; import org.sakaiproject.service.gradebook.shared.*;
[ "java.util", "org.sakaiproject.gradebookng", "org.sakaiproject.service" ]
java.util; org.sakaiproject.gradebookng; org.sakaiproject.service;
1,632,091
public static String getApplicationSortByField (String sortBy) { String updatedSortBy = ""; if (RestApiConstants.SORT_BY_NAME.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_NAME; } else if (RestApiConstants.SORT_BY_OWNER.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_CREATED_BY; } else if (RestApiConstants.SORT_BY_THROTTLING_TIER.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_TIER; } else if (RestApiConstants.SORT_BY_STATUS.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_STATUS; } return updatedSortBy; }
static String function (String sortBy) { String updatedSortBy = ""; if (RestApiConstants.SORT_BY_NAME.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_NAME; } else if (RestApiConstants.SORT_BY_OWNER.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_CREATED_BY; } else if (RestApiConstants.SORT_BY_THROTTLING_TIER.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_TIER; } else if (RestApiConstants.SORT_BY_STATUS.equals(sortBy)) { updatedSortBy = APIConstants.APPLICATION_STATUS; } return updatedSortBy; }
/*** * Converts the sort by object according to the input * * @param sortBy * @return Updated sort by field */
Converts the sort by object according to the input
getApplicationSortByField
{ "repo_name": "ruks/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.store.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/store/v1/mappings/ApplicationMappingUtil.java", "license": "apache-2.0", "size": 12768 }
[ "org.wso2.carbon.apimgt.impl.APIConstants", "org.wso2.carbon.apimgt.rest.api.common.RestApiConstants" ]
import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.rest.api.common.RestApiConstants;
import org.wso2.carbon.apimgt.impl.*; import org.wso2.carbon.apimgt.rest.api.common.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,505,455
@Test public void testParseMinKey() throws JsonParseException { final Object doc = Json.parse("{ a : MinKey() }"); assertEquals(BuilderFactory.start().addMinKey("a").build(), doc); }
void function() throws JsonParseException { final Object doc = Json.parse(STR); assertEquals(BuilderFactory.start().addMinKey("a").build(), doc); }
/** * Test Parsing a MinKey() element. * * @throws JsonParseException * On a test failure. */
Test Parsing a MinKey() element
testParseMinKey
{ "repo_name": "allanbank/mongodb-async-driver", "path": "src/test/java/com/allanbank/mongodb/bson/json/JsonTest.java", "license": "apache-2.0", "size": 22377 }
[ "com.allanbank.mongodb.bson.builder.BuilderFactory", "com.allanbank.mongodb.error.JsonParseException", "org.junit.Assert" ]
import com.allanbank.mongodb.bson.builder.BuilderFactory; import com.allanbank.mongodb.error.JsonParseException; import org.junit.Assert;
import com.allanbank.mongodb.bson.builder.*; import com.allanbank.mongodb.error.*; import org.junit.*;
[ "com.allanbank.mongodb", "org.junit" ]
com.allanbank.mongodb; org.junit;
2,226,481
private static Set<Integer> getDataFileIds(List<DataFile> list) { return list.stream().map(BaseEntity::getId).collect(Collectors.toSet()); }
static Set<Integer> function(List<DataFile> list) { return list.stream().map(BaseEntity::getId).collect(Collectors.toSet()); }
/** * Get the set of ids of the data files of the selected file items. * * @param list * * @return */
Get the set of ids of the data files of the selected file items
getDataFileIds
{ "repo_name": "intuit/Tank", "path": "web/web_support/src/main/java/com/intuit/tank/project/AssociateDataFileBean.java", "license": "epl-1.0", "size": 3410 }
[ "com.intuit.tank.project.DataFile", "java.util.List", "java.util.Set", "java.util.stream.Collectors" ]
import com.intuit.tank.project.DataFile; import java.util.List; import java.util.Set; import java.util.stream.Collectors;
import com.intuit.tank.project.*; import java.util.*; import java.util.stream.*;
[ "com.intuit.tank", "java.util" ]
com.intuit.tank; java.util;
2,904,531
public static void setHardwareEqualityEnforced(boolean e) { sHardwareEqualityEnforced = e; } protected Beacon(Parcel in) { int size = in.readInt(); this.mIdentifiers = new ArrayList<Identifier>(size); for (int i = 0; i < size; i++) { mIdentifiers.add(Identifier.parse(in.readString())); } mDistance = in.readDouble(); mRssi = in.readInt(); mTxPower = in.readInt(); mBluetoothAddress = in.readString(); mBeaconTypeCode = in.readInt(); mServiceUuid = in.readInt(); int dataSize = in.readInt(); this.mDataFields = new ArrayList<Long>(dataSize); for (int i = 0; i < dataSize; i++) { mDataFields.add(in.readLong()); } int extraDataSize = in.readInt(); if (LogManager.isVerboseLoggingEnabled()) { LogManager.d(TAG, "reading "+extraDataSize+" extra data fields from parcel"); } this.mExtraDataFields = new ArrayList<Long>(extraDataSize); for (int i = 0; i < extraDataSize; i++) { mExtraDataFields.add(in.readLong()); } mManufacturer = in.readInt(); mBluetoothName = in.readString(); } protected Beacon(Beacon otherBeacon) { super(); mIdentifiers = new ArrayList<>(otherBeacon.mIdentifiers); mDataFields = new ArrayList<>(otherBeacon.mDataFields); mExtraDataFields = new ArrayList<>(otherBeacon.mExtraDataFields); this.mDistance = otherBeacon.mDistance; this.mRunningAverageRssi = otherBeacon.mRunningAverageRssi; this.mRssi = otherBeacon.mRssi; this.mTxPower = otherBeacon.mTxPower; this.mBluetoothAddress = otherBeacon.mBluetoothAddress; this.mBeaconTypeCode = otherBeacon.getBeaconTypeCode(); this.mServiceUuid = otherBeacon.getServiceUuid(); this.mBluetoothName = otherBeacon.mBluetoothName; } protected Beacon() { mIdentifiers = new ArrayList<Identifier>(1); mDataFields = new ArrayList<Long>(1); mExtraDataFields = new ArrayList<Long>(1); }
static void function(boolean e) { sHardwareEqualityEnforced = e; } protected Beacon(Parcel in) { int size = in.readInt(); this.mIdentifiers = new ArrayList<Identifier>(size); for (int i = 0; i < size; i++) { mIdentifiers.add(Identifier.parse(in.readString())); } mDistance = in.readDouble(); mRssi = in.readInt(); mTxPower = in.readInt(); mBluetoothAddress = in.readString(); mBeaconTypeCode = in.readInt(); mServiceUuid = in.readInt(); int dataSize = in.readInt(); this.mDataFields = new ArrayList<Long>(dataSize); for (int i = 0; i < dataSize; i++) { mDataFields.add(in.readLong()); } int extraDataSize = in.readInt(); if (LogManager.isVerboseLoggingEnabled()) { LogManager.d(TAG, STR+extraDataSize+STR); } this.mExtraDataFields = new ArrayList<Long>(extraDataSize); for (int i = 0; i < extraDataSize; i++) { mExtraDataFields.add(in.readLong()); } mManufacturer = in.readInt(); mBluetoothName = in.readString(); } protected Beacon(Beacon otherBeacon) { super(); mIdentifiers = new ArrayList<>(otherBeacon.mIdentifiers); mDataFields = new ArrayList<>(otherBeacon.mDataFields); mExtraDataFields = new ArrayList<>(otherBeacon.mExtraDataFields); this.mDistance = otherBeacon.mDistance; this.mRunningAverageRssi = otherBeacon.mRunningAverageRssi; this.mRssi = otherBeacon.mRssi; this.mTxPower = otherBeacon.mTxPower; this.mBluetoothAddress = otherBeacon.mBluetoothAddress; this.mBeaconTypeCode = otherBeacon.getBeaconTypeCode(); this.mServiceUuid = otherBeacon.getServiceUuid(); this.mBluetoothName = otherBeacon.mBluetoothName; } protected Beacon() { mIdentifiers = new ArrayList<Identifier>(1); mDataFields = new ArrayList<Long>(1); mExtraDataFields = new ArrayList<Long>(1); }
/** * Configures whether a the bluetoothAddress (mac address) must be the same for two Beacons * to be configured equal. This setting applies to all beacon instances in the same process. * Defaults to false for backward compatibility. * * @param e */
Configures whether a the bluetoothAddress (mac address) must be the same for two Beacons to be configured equal. This setting applies to all beacon instances in the same process. Defaults to false for backward compatibility
setHardwareEqualityEnforced
{ "repo_name": "hdodenhof/android-beacon-library", "path": "src/main/java/org/altbeacon/beacon/Beacon.java", "license": "apache-2.0", "size": 23425 }
[ "android.os.Parcel", "java.util.ArrayList", "org.altbeacon.beacon.logging.LogManager" ]
import android.os.Parcel; import java.util.ArrayList; import org.altbeacon.beacon.logging.LogManager;
import android.os.*; import java.util.*; import org.altbeacon.beacon.logging.*;
[ "android.os", "java.util", "org.altbeacon.beacon" ]
android.os; java.util; org.altbeacon.beacon;
1,995,882
public void unpackConfigFile() throws MaltChainedException { checkConfigDirectory(); JarInputStream jis; try { if (url == null) { jis = new JarInputStream(new FileInputStream(workingDirectory.getPath()+File.separator+getName()+".mco")); } else { jis = new JarInputStream(url.openConnection().getInputStream()); } unpackConfigFile(jis); jis.close(); } catch (FileNotFoundException e) { throw new ConfigurationException("Could not unpack configuration. The configuration file '"+workingDirectory.getPath()+File.separator+getName()+".mco"+"' cannot be found. ", e); } catch (IOException e) { if (configDirectory.exists()) { deleteConfigDirectory(); } throw new ConfigurationException("Could not unpack configuration. ", e); } initCreatedByMaltParserVersionFromInfoFile(); }
void function() throws MaltChainedException { checkConfigDirectory(); JarInputStream jis; try { if (url == null) { jis = new JarInputStream(new FileInputStream(workingDirectory.getPath()+File.separator+getName()+".mco")); } else { jis = new JarInputStream(url.openConnection().getInputStream()); } unpackConfigFile(jis); jis.close(); } catch (FileNotFoundException e) { throw new ConfigurationException(STR+workingDirectory.getPath()+File.separator+getName()+".mco"+STR, e); } catch (IOException e) { if (configDirectory.exists()) { deleteConfigDirectory(); } throw new ConfigurationException(STR, e); } initCreatedByMaltParserVersionFromInfoFile(); }
/** * Unpacks the malt configuration file (.mco). * * @throws MaltChainedException */
Unpacks the malt configuration file (.mco)
unpackConfigFile
{ "repo_name": "gitpan/uplug-main", "path": "share/ext/parser/malt/src/org/maltparser/core/config/ConfigurationDir.java", "license": "gpl-3.0", "size": 42985 }
[ "java.io.File", "java.io.FileInputStream", "java.io.FileNotFoundException", "java.io.IOException", "java.util.jar.JarInputStream", "org.maltparser.core.exception.MaltChainedException" ]
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.jar.JarInputStream; import org.maltparser.core.exception.MaltChainedException;
import java.io.*; import java.util.jar.*; import org.maltparser.core.exception.*;
[ "java.io", "java.util", "org.maltparser.core" ]
java.io; java.util; org.maltparser.core;
1,008,864
public Map<String, String> getParam() { return getParameters(); }
Map<String, String> function() { return getParameters(); }
/** * Gets the parameters for this dynamic function format.<p> * * @return the map of parameters for the dynamic function */
Gets the parameters for this dynamic function format
getParam
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/jsp/util/CmsDynamicFunctionFormatWrapper.java", "license": "lgpl-2.1", "size": 3847 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,969,916
private void reassign(GridServiceDeployment dep, AffinityTopologyVersion topVer) throws IgniteCheckedException { ServiceConfiguration cfg = dep.configuration(); Object nodeFilter = cfg.getNodeFilter(); if (nodeFilter != null) ctx.resource().injectGeneric(nodeFilter); int totalCnt = cfg.getTotalCount(); int maxPerNodeCnt = cfg.getMaxPerNodeCount(); String cacheName = cfg.getCacheName(); Object affKey = cfg.getAffinityKey(); while (true) { GridServiceAssignments assigns = new GridServiceAssignments(cfg, dep.nodeId(), topVer.topologyVersion()); Collection<ClusterNode> nodes; // Call node filter outside of transaction. if (affKey == null) { nodes = ctx.discovery().nodes(topVer); if (assigns.nodeFilter() != null) { Collection<ClusterNode> nodes0 = new ArrayList<>(); for (ClusterNode node : nodes) { if (assigns.nodeFilter().apply(node)) nodes0.add(node); } nodes = nodes0; } } else nodes = null; try (IgniteInternalTx tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { GridServiceAssignmentsKey key = new GridServiceAssignmentsKey(cfg.getName()); GridServiceAssignments oldAssigns = (GridServiceAssignments)cache.get(key); Map<UUID, Integer> cnts = new HashMap<>(); if (affKey != null) { ClusterNode n = ctx.affinity().mapKeyToNode(cacheName, affKey, topVer); if (n != null) { int cnt = maxPerNodeCnt == 0 ? totalCnt == 0 ? 1 : totalCnt : maxPerNodeCnt; cnts.put(n.id(), cnt); } } else { if (!nodes.isEmpty()) { int size = nodes.size(); int perNodeCnt = totalCnt != 0 ? totalCnt / size : maxPerNodeCnt; int remainder = totalCnt != 0 ? totalCnt % size : 0; if (perNodeCnt > maxPerNodeCnt && maxPerNodeCnt != 0) { perNodeCnt = maxPerNodeCnt; remainder = 0; } for (ClusterNode n : nodes) cnts.put(n.id(), perNodeCnt); assert perNodeCnt >= 0; assert remainder >= 0; if (remainder > 0) { int cnt = perNodeCnt + 1; if (oldAssigns != null) { Collection<UUID> used = new HashSet<>(); // Avoid redundant moving of services. for (Map.Entry<UUID, Integer> e : oldAssigns.assigns().entrySet()) { // Do not assign services to left nodes. if (ctx.discovery().node(e.getKey()) == null) continue; // If old count and new count match, then reuse the assignment. if (e.getValue() == cnt) { cnts.put(e.getKey(), cnt); used.add(e.getKey()); if (--remainder == 0) break; } } if (remainder > 0) { List<Map.Entry<UUID, Integer>> entries = new ArrayList<>(cnts.entrySet()); // Randomize. Collections.shuffle(entries); for (Map.Entry<UUID, Integer> e : entries) { // Assign only the ones that have not been reused from previous assignments. if (!used.contains(e.getKey())) { if (e.getValue() < maxPerNodeCnt || maxPerNodeCnt == 0) { e.setValue(e.getValue() + 1); if (--remainder == 0) break; } } } } } else { List<Map.Entry<UUID, Integer>> entries = new ArrayList<>(cnts.entrySet()); // Randomize. Collections.shuffle(entries); for (Map.Entry<UUID, Integer> e : entries) { e.setValue(e.getValue() + 1); if (--remainder == 0) break; } } } } } assigns.assigns(cnts); cache.put(key, assigns); tx.commit(); break; } catch (ClusterTopologyCheckedException e) { if (log.isDebugEnabled()) log.debug("Topology changed while reassigning (will retry): " + e.getMessage()); U.sleep(10); } } }
void function(GridServiceDeployment dep, AffinityTopologyVersion topVer) throws IgniteCheckedException { ServiceConfiguration cfg = dep.configuration(); Object nodeFilter = cfg.getNodeFilter(); if (nodeFilter != null) ctx.resource().injectGeneric(nodeFilter); int totalCnt = cfg.getTotalCount(); int maxPerNodeCnt = cfg.getMaxPerNodeCount(); String cacheName = cfg.getCacheName(); Object affKey = cfg.getAffinityKey(); while (true) { GridServiceAssignments assigns = new GridServiceAssignments(cfg, dep.nodeId(), topVer.topologyVersion()); Collection<ClusterNode> nodes; if (affKey == null) { nodes = ctx.discovery().nodes(topVer); if (assigns.nodeFilter() != null) { Collection<ClusterNode> nodes0 = new ArrayList<>(); for (ClusterNode node : nodes) { if (assigns.nodeFilter().apply(node)) nodes0.add(node); } nodes = nodes0; } } else nodes = null; try (IgniteInternalTx tx = cache.txStartEx(PESSIMISTIC, REPEATABLE_READ)) { GridServiceAssignmentsKey key = new GridServiceAssignmentsKey(cfg.getName()); GridServiceAssignments oldAssigns = (GridServiceAssignments)cache.get(key); Map<UUID, Integer> cnts = new HashMap<>(); if (affKey != null) { ClusterNode n = ctx.affinity().mapKeyToNode(cacheName, affKey, topVer); if (n != null) { int cnt = maxPerNodeCnt == 0 ? totalCnt == 0 ? 1 : totalCnt : maxPerNodeCnt; cnts.put(n.id(), cnt); } } else { if (!nodes.isEmpty()) { int size = nodes.size(); int perNodeCnt = totalCnt != 0 ? totalCnt / size : maxPerNodeCnt; int remainder = totalCnt != 0 ? totalCnt % size : 0; if (perNodeCnt > maxPerNodeCnt && maxPerNodeCnt != 0) { perNodeCnt = maxPerNodeCnt; remainder = 0; } for (ClusterNode n : nodes) cnts.put(n.id(), perNodeCnt); assert perNodeCnt >= 0; assert remainder >= 0; if (remainder > 0) { int cnt = perNodeCnt + 1; if (oldAssigns != null) { Collection<UUID> used = new HashSet<>(); for (Map.Entry<UUID, Integer> e : oldAssigns.assigns().entrySet()) { if (ctx.discovery().node(e.getKey()) == null) continue; if (e.getValue() == cnt) { cnts.put(e.getKey(), cnt); used.add(e.getKey()); if (--remainder == 0) break; } } if (remainder > 0) { List<Map.Entry<UUID, Integer>> entries = new ArrayList<>(cnts.entrySet()); Collections.shuffle(entries); for (Map.Entry<UUID, Integer> e : entries) { if (!used.contains(e.getKey())) { if (e.getValue() < maxPerNodeCnt maxPerNodeCnt == 0) { e.setValue(e.getValue() + 1); if (--remainder == 0) break; } } } } } else { List<Map.Entry<UUID, Integer>> entries = new ArrayList<>(cnts.entrySet()); Collections.shuffle(entries); for (Map.Entry<UUID, Integer> e : entries) { e.setValue(e.getValue() + 1); if (--remainder == 0) break; } } } } } assigns.assigns(cnts); cache.put(key, assigns); tx.commit(); break; } catch (ClusterTopologyCheckedException e) { if (log.isDebugEnabled()) log.debug(STR + e.getMessage()); U.sleep(10); } } }
/** * Reassigns service to nodes. * * @param dep Service deployment. * @param topVer Topology version. * @throws IgniteCheckedException If failed. */
Reassigns service to nodes
reassign
{ "repo_name": "afinka77/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java", "license": "apache-2.0", "size": 70588 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.Collections", "java.util.HashMap", "java.util.HashSet", "java.util.List", "java.util.Map", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.internal.cluster.ClusterTopologyCheckedExcept...
import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.services.ServiceConfiguration;
import java.util.*; import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.services.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
702,157
private NumberReplicas countNodes(Block b, Iterator<DatanodeDescriptor> nodeIter) { int count = 0; int live = 0; int corrupt = 0; int excess = 0; Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b); while ( nodeIter.hasNext() ) { DatanodeDescriptor node = nodeIter.next(); if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) { corrupt++; } else if (node.isDecommissionInProgress() || node.isDecommissioned()) { count++; } else { Collection<Block> blocksExcess = excessReplicateMap.get(node.getStorageID()); if (blocksExcess != null && blocksExcess.contains(b)) { excess++; } else { live++; } } } return new NumberReplicas(live, count, corrupt, excess); }
NumberReplicas function(Block b, Iterator<DatanodeDescriptor> nodeIter) { int count = 0; int live = 0; int corrupt = 0; int excess = 0; Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b); while ( nodeIter.hasNext() ) { DatanodeDescriptor node = nodeIter.next(); if ((nodesCorrupt != null) && (nodesCorrupt.contains(node))) { corrupt++; } else if (node.isDecommissionInProgress() node.isDecommissioned()) { count++; } else { Collection<Block> blocksExcess = excessReplicateMap.get(node.getStorageID()); if (blocksExcess != null && blocksExcess.contains(b)) { excess++; } else { live++; } } } return new NumberReplicas(live, count, corrupt, excess); }
/** * Counts the number of nodes in the given list into active and * decommissioned counters. */
Counts the number of nodes in the given list into active and decommissioned counters
countNodes
{ "repo_name": "davidl1/hortonworks-extension", "path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java", "license": "apache-2.0", "size": 218585 }
[ "java.util.Collection", "java.util.Iterator", "org.apache.hadoop.hdfs.protocol.Block" ]
import java.util.Collection; import java.util.Iterator; import org.apache.hadoop.hdfs.protocol.Block;
import java.util.*; import org.apache.hadoop.hdfs.protocol.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
1,232,279
public static FlexiDateTime ofLenient(final LocalDate date, final OffsetTime time) { ArgumentChecker.notNull(date, "date"); if (time != null) { return new FlexiDateTime(date, time.toLocalTime(), time.getOffset()); } return new FlexiDateTime(date, null, null); }
static FlexiDateTime function(final LocalDate date, final OffsetTime time) { ArgumentChecker.notNull(date, "date"); if (time != null) { return new FlexiDateTime(date, time.toLocalTime(), time.getOffset()); } return new FlexiDateTime(date, null, null); }
/** * Obtains a flexi date-time, specifying the date and optionally the time. * <p> * This factory requires the date. * * @param date the date, not null * @param time the time, may be null * @return the date-time, not null */
Obtains a flexi date-time, specifying the date and optionally the time. This factory requires the date
ofLenient
{ "repo_name": "McLeodMoores/starling", "path": "projects/util/src/main/java/com/opengamma/util/time/FlexiDateTime.java", "license": "apache-2.0", "size": 11700 }
[ "com.opengamma.util.ArgumentChecker", "org.threeten.bp.LocalDate", "org.threeten.bp.OffsetTime" ]
import com.opengamma.util.ArgumentChecker; import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetTime;
import com.opengamma.util.*; import org.threeten.bp.*;
[ "com.opengamma.util", "org.threeten.bp" ]
com.opengamma.util; org.threeten.bp;
2,115,334
@Test public void testSimpleDate() { final Calendar cal = Calendar.getInstance(); final DatePrinter format = getInstance(YYYY_MM_DD); cal.set(2004, Calendar.DECEMBER, 31); assertEquals("2004/12/31", format.format(cal)); cal.set(999, Calendar.DECEMBER, 31); assertEquals("0999/12/31", format.format(cal)); cal.set(1, Calendar.MARCH, 2); assertEquals("0001/03/02", format.format(cal)); }
void function() { final Calendar cal = Calendar.getInstance(); final DatePrinter format = getInstance(YYYY_MM_DD); cal.set(2004, Calendar.DECEMBER, 31); assertEquals(STR, format.format(cal)); cal.set(999, Calendar.DECEMBER, 31); assertEquals(STR, format.format(cal)); cal.set(1, Calendar.MARCH, 2); assertEquals(STR, format.format(cal)); }
/** * testLowYearPadding showed that the date was buggy * This test confirms it, getting 366 back as a date */
testLowYearPadding showed that the date was buggy This test confirms it, getting 366 back as a date
testSimpleDate
{ "repo_name": "jacktan1991/commons-lang", "path": "src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java", "license": "apache-2.0", "size": 14162 }
[ "java.util.Calendar", "org.junit.Assert" ]
import java.util.Calendar; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
2,183,401
private boolean createPDF(String mPath, String outputPath) { try { PdfReader reader = new PdfReader(mPath); OutputStream os = new FileOutputStream(outputPath); PdfStamper stamper = new PdfStamper(reader, os); invert(stamper); stamper.close(); os.close(); return true; } catch (Exception er) { er.printStackTrace(); return false; } }
boolean function(String mPath, String outputPath) { try { PdfReader reader = new PdfReader(mPath); OutputStream os = new FileOutputStream(outputPath); PdfStamper stamper = new PdfStamper(reader, os); invert(stamper); stamper.close(); os.close(); return true; } catch (Exception er) { er.printStackTrace(); return false; } }
/** * invokes invert method passing stamper as parameter * * @param mPath original file path * @param outputPath output file path */
invokes invert method passing stamper as parameter
createPDF
{ "repo_name": "Swati4star/Images-to-PDF", "path": "app/src/main/java/swati4star/createpdf/util/InvertPdf.java", "license": "gpl-3.0", "size": 4148 }
[ "com.itextpdf.text.pdf.PdfReader", "com.itextpdf.text.pdf.PdfStamper", "java.io.FileOutputStream", "java.io.OutputStream" ]
import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfStamper; import java.io.FileOutputStream; import java.io.OutputStream;
import com.itextpdf.text.pdf.*; import java.io.*;
[ "com.itextpdf.text", "java.io" ]
com.itextpdf.text; java.io;
2,363,539
byte[] read() throws IOException { try { MessageProp prop = new MessageProp(0, false); byte[] token = new byte[dis.readInt()]; dis.readFully(token); byte[] bytes; try { synchronized (gssContext) { bytes = gssContext.unwrap( token, 0, token.length, prop); } } catch (GSSException e) { IOException ioe = new IOException( "Failed to unwrap a GSS token of length " + token.length); ioe.initCause(e); throw ioe; } doEncryption = prop.getPrivacy(); if (connectionLogger.isLoggable(Level.FINEST)) { connectionLogger.log( Level.FINEST, "received a " + token.length + " bytes token (" + (doEncryption ? "" : "not ") + "encrypted), " + bytes.length + " bytes when " + "unwrapped"); } return bytes; } catch (IOException ioe) { if (connectionLogger.isLoggable(Levels.FAILED)) { logThrow(connectionLogger, Levels.FAILED, this.getClass(), "read", "read fails on connection {0}, throws", new Object[] {this}, ioe); } throw ioe; } } } static class ConnectionInputStream extends InputStream { private byte[] buf; private int offset; // point to the byte for next read private final Connection connection; ConnectionInputStream(Connection connection) { buf = new byte[0]; // indicate no buffered data available offset = 0; this.connection = connection; }
byte[] read() throws IOException { try { MessageProp prop = new MessageProp(0, false); byte[] token = new byte[dis.readInt()]; dis.readFully(token); byte[] bytes; try { synchronized (gssContext) { bytes = gssContext.unwrap( token, 0, token.length, prop); } } catch (GSSException e) { IOException ioe = new IOException( STR + token.length); ioe.initCause(e); throw ioe; } doEncryption = prop.getPrivacy(); if (connectionLogger.isLoggable(Level.FINEST)) { connectionLogger.log( Level.FINEST, STR + token.length + STR + (doEncryption ? STRnot STRencrypted), STR bytes when STRunwrappedSTRreadSTRread fails on connection {0}, throws", new Object[] {this}, ioe); } throw ioe; } } } static class ConnectionInputStream extends InputStream { private byte[] buf; private int offset; private final Connection connection; ConnectionInputStream(Connection connection) { buf = new byte[0]; offset = 0; this.connection = connection; }
/** * Block until a complete GSS token has been received, unwrap * it, and return its content. * * @return byte array of the unwrapped GSS token * @throws IOException if problems encountered */
Block until a complete GSS token has been received, unwrap it, and return its content
read
{ "repo_name": "pfirmstone/JGDMS", "path": "JGDMS/jgdms-jeri/src/main/java/net/jini/jeri/kerberos/KerberosUtil.java", "license": "apache-2.0", "size": 37840 }
[ "java.io.IOException", "java.io.InputStream", "java.util.logging.Level", "org.ietf.jgss.GSSException", "org.ietf.jgss.MessageProp" ]
import java.io.IOException; import java.io.InputStream; import java.util.logging.Level; import org.ietf.jgss.GSSException; import org.ietf.jgss.MessageProp;
import java.io.*; import java.util.logging.*; import org.ietf.jgss.*;
[ "java.io", "java.util", "org.ietf.jgss" ]
java.io; java.util; org.ietf.jgss;
1,602,527
private List getResourcesLockedByOtherUser(List resourceList) throws CmsException { List lockedResourcesByOtherUser = new ArrayList(); Iterator i = resourceList.iterator(); while (i.hasNext()) { CmsResource resource = (CmsResource)i.next(); // get the lock state for the resource CmsLock lock = getCms().getLock(resource); // add this resource to the list if this is locked by another user if (!lock.isUnlocked() && !lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { lockedResourcesByOtherUser.add(resource); } } return lockedResourcesByOtherUser; }
List function(List resourceList) throws CmsException { List lockedResourcesByOtherUser = new ArrayList(); Iterator i = resourceList.iterator(); while (i.hasNext()) { CmsResource resource = (CmsResource)i.next(); CmsLock lock = getCms().getLock(resource); if (!lock.isUnlocked() && !lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { lockedResourcesByOtherUser.add(resource); } } return lockedResourcesByOtherUser; }
/** * Returns a list of resources that are locked by another user as the current user.<p> * * @param resourceList the list of all (mixed) resources * * @return a list of resources that are locked by another user as the current user * @throws CmsException if the getLock operation fails */
Returns a list of resources that are locked by another user as the current user
getResourcesLockedByOtherUser
{ "repo_name": "serrapos/opencms-core", "path": "src-modules/org/opencms/workplace/tools/content/CmsPropertyDelete.java", "license": "lgpl-2.1", "size": 15467 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.opencms.file.CmsResource", "org.opencms.lock.CmsLock", "org.opencms.main.CmsException" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.opencms.file.CmsResource; import org.opencms.lock.CmsLock; import org.opencms.main.CmsException;
import java.util.*; import org.opencms.file.*; import org.opencms.lock.*; import org.opencms.main.*;
[ "java.util", "org.opencms.file", "org.opencms.lock", "org.opencms.main" ]
java.util; org.opencms.file; org.opencms.lock; org.opencms.main;
1,285,778
public synchronized void saveNamespace(FSNamesystem source, NameNodeFile nnf, Canceler canceler) throws IOException { assert editLog != null : "editLog must be initialized"; LOG.info("Save namespace ..."); storage.attemptRestoreRemovedStorage(); boolean editLogWasOpen = editLog.isSegmentOpen(); if (editLogWasOpen) { editLog.endCurrentLogSegment(true); } long imageTxId = getLastAppliedOrWrittenTxId(); try { saveFSImageInAllDirs(source, nnf, imageTxId, canceler); storage.writeAll(); } finally { if (editLogWasOpen) { editLog.startLogSegment(imageTxId + 1, true); // Take this opportunity to note the current transaction. // Even if the namespace save was cancelled, this marker // is only used to determine what transaction ID is required // for startup. So, it doesn't hurt to update it unnecessarily. storage.writeTransactionIdFileToStorage(imageTxId + 1); } } }
synchronized void function(FSNamesystem source, NameNodeFile nnf, Canceler canceler) throws IOException { assert editLog != null : STR; LOG.info(STR); storage.attemptRestoreRemovedStorage(); boolean editLogWasOpen = editLog.isSegmentOpen(); if (editLogWasOpen) { editLog.endCurrentLogSegment(true); } long imageTxId = getLastAppliedOrWrittenTxId(); try { saveFSImageInAllDirs(source, nnf, imageTxId, canceler); storage.writeAll(); } finally { if (editLogWasOpen) { editLog.startLogSegment(imageTxId + 1, true); storage.writeTransactionIdFileToStorage(imageTxId + 1); } } }
/** * Save the contents of the FS image to a new image file in each of the * current storage directories. */
Save the contents of the FS image to a new image file in each of the current storage directories
saveNamespace
{ "repo_name": "Reidddddd/mo-hadoop2.6.0", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java", "license": "apache-2.0", "size": 60060 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.server.namenode.NNStorage", "org.apache.hadoop.hdfs.util.Canceler" ]
import java.io.IOException; import org.apache.hadoop.hdfs.server.namenode.NNStorage; import org.apache.hadoop.hdfs.util.Canceler;
import java.io.*; import org.apache.hadoop.hdfs.server.namenode.*; import org.apache.hadoop.hdfs.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,292,640
@Override public List<NodeDetail> getDescendantDetails(NodePK nodePK) { Connection con = getConnection(); try { return NodeDAO.getDescendantDetails(con, nodePK); } catch (SQLException re) { throw new NodeRuntimeException("NodeBmEJB.getDescendantDetails()", SilverpeasRuntimeException.ERROR, "node.GETTING_DETAIL_OF_DESCENDANTS_FAILED", "nodeId = " + nodePK.getId(), re); } finally { DBUtil.close(con); } }
List<NodeDetail> function(NodePK nodePK) { Connection con = getConnection(); try { return NodeDAO.getDescendantDetails(con, nodePK); } catch (SQLException re) { throw new NodeRuntimeException(STR, SilverpeasRuntimeException.ERROR, STR, STR + nodePK.getId(), re); } finally { DBUtil.close(con); } }
/** * Get descendant node details of a node * * @param nodePK A NodePK * @return A List of NodeDetail * @see NodePK * @since 1.0 */
Get descendant node details of a node
getDescendantDetails
{ "repo_name": "ebonnet/Silverpeas-Core", "path": "core-library/src/main/java/org/silverpeas/core/node/service/DefaultNodeService.java", "license": "agpl-3.0", "size": 35612 }
[ "java.sql.Connection", "java.sql.SQLException", "java.util.List", "org.silverpeas.core.exception.SilverpeasRuntimeException", "org.silverpeas.core.node.dao.NodeDAO", "org.silverpeas.core.node.model.NodeDetail", "org.silverpeas.core.node.model.NodePK", "org.silverpeas.core.node.model.NodeRuntimeExcepti...
import java.sql.Connection; import java.sql.SQLException; import java.util.List; import org.silverpeas.core.exception.SilverpeasRuntimeException; import org.silverpeas.core.node.dao.NodeDAO; import org.silverpeas.core.node.model.NodeDetail; import org.silverpeas.core.node.model.NodePK; import org.silverpeas.core.node.model.NodeRuntimeException; import org.silverpeas.core.persistence.jdbc.DBUtil;
import java.sql.*; import java.util.*; import org.silverpeas.core.exception.*; import org.silverpeas.core.node.dao.*; import org.silverpeas.core.node.model.*; import org.silverpeas.core.persistence.jdbc.*;
[ "java.sql", "java.util", "org.silverpeas.core" ]
java.sql; java.util; org.silverpeas.core;
2,355,368
@Test public void testValidTimestampNoExpires() throws Exception { Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(doc); secHeader.insertSecurityHeader(); WSSecTimestamp timestamp = new WSSecTimestamp(); timestamp.setTimeToLive(0); Document createdDoc = timestamp.build(doc, secHeader); if (LOG.isDebugEnabled()) { String outputString = XMLUtils.prettyDocumentToString(createdDoc); LOG.debug(outputString); } // // Do some processing // WSHandlerResult wsResult = verify(createdDoc); WSSecurityEngineResult actionResult = wsResult.getActionResults().get(WSConstants.TS).get(0); assertTrue(actionResult != null); Timestamp receivedTimestamp = (Timestamp)actionResult.get(WSSecurityEngineResult.TAG_TIMESTAMP); assertTrue(receivedTimestamp != null); }
void function() throws Exception { Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG); WSSecHeader secHeader = new WSSecHeader(doc); secHeader.insertSecurityHeader(); WSSecTimestamp timestamp = new WSSecTimestamp(); timestamp.setTimeToLive(0); Document createdDoc = timestamp.build(doc, secHeader); if (LOG.isDebugEnabled()) { String outputString = XMLUtils.prettyDocumentToString(createdDoc); LOG.debug(outputString); } WSSecurityEngineResult actionResult = wsResult.getActionResults().get(WSConstants.TS).get(0); assertTrue(actionResult != null); Timestamp receivedTimestamp = (Timestamp)actionResult.get(WSSecurityEngineResult.TAG_TIMESTAMP); assertTrue(receivedTimestamp != null); }
/** * This is a test for processing a valid Timestamp with no expires element */
This is a test for processing a valid Timestamp with no expires element
testValidTimestampNoExpires
{ "repo_name": "clibois/wss4j", "path": "ws-security-dom/src/test/java/org/apache/wss4j/dom/message/TimestampTest.java", "license": "apache-2.0", "size": 33363 }
[ "org.apache.wss4j.common.util.XMLUtils", "org.apache.wss4j.dom.WSConstants", "org.apache.wss4j.dom.common.SOAPUtil", "org.apache.wss4j.dom.engine.WSSecurityEngineResult", "org.apache.wss4j.dom.message.token.Timestamp", "org.w3c.dom.Document" ]
import org.apache.wss4j.common.util.XMLUtils; import org.apache.wss4j.dom.WSConstants; import org.apache.wss4j.dom.common.SOAPUtil; import org.apache.wss4j.dom.engine.WSSecurityEngineResult; import org.apache.wss4j.dom.message.token.Timestamp; import org.w3c.dom.Document;
import org.apache.wss4j.common.util.*; import org.apache.wss4j.dom.*; import org.apache.wss4j.dom.common.*; import org.apache.wss4j.dom.engine.*; import org.apache.wss4j.dom.message.token.*; import org.w3c.dom.*;
[ "org.apache.wss4j", "org.w3c.dom" ]
org.apache.wss4j; org.w3c.dom;
46,911
public boolean disconnect() { boolean success = true; if (folder != null && folder.isOpen() == true) { try { folder.close(false); } catch (MessagingException ex) { log.error("Exception encountered while trying tho close the folder: " + ex, ex); success = false; } } if (store != null && store.isConnected() == true) { try { store.close(); } catch (MessagingException ex) { log.error("Exception encountered while trying to close the store: " + ex, ex); success = false; } } return success; }
boolean function() { boolean success = true; if (folder != null && folder.isOpen() == true) { try { folder.close(false); } catch (MessagingException ex) { log.error(STR + ex, ex); success = false; } } if (store != null && store.isConnected() == true) { try { store.close(); } catch (MessagingException ex) { log.error(STR + ex, ex); success = false; } } return success; }
/** * Disconnects the folder and store if given and is opened yet. * @return */
Disconnects the folder and store if given and is opened yet
disconnect
{ "repo_name": "developerleo/ProjectForge-2nd", "path": "src/main/java/org/projectforge/mail/MailAccount.java", "license": "gpl-3.0", "size": 12077 }
[ "javax.mail.MessagingException" ]
import javax.mail.MessagingException;
import javax.mail.*;
[ "javax.mail" ]
javax.mail;
746,867
String cacheKey = MageConstants.CacheKey.CALLBACK_CONTEXT_PREFIX + messageId; return getCache().fetchJsonSerializable(cacheKey, MageConstants.CacheTtl.CALLBACK_CONTEXT, CallbackContext.class, () -> getDao().getCallbackContext(messageId) ); }
String cacheKey = MageConstants.CacheKey.CALLBACK_CONTEXT_PREFIX + messageId; return getCache().fetchJsonSerializable(cacheKey, MageConstants.CacheTtl.CALLBACK_CONTEXT, CallbackContext.class, () -> getDao().getCallbackContext(messageId) ); }
/** * Fetches the context data for a callback message, using the message ID * @param messageId the message ID * @return the context data */
Fetches the context data for a callback message, using the message ID
getCallbackContext
{ "repo_name": "rapidpro/mage", "path": "src/main/java/io/rapidpro/mage/service/MessageService.java", "license": "agpl-3.0", "size": 9722 }
[ "io.rapidpro.mage.MageConstants", "io.rapidpro.mage.core.CallbackContext" ]
import io.rapidpro.mage.MageConstants; import io.rapidpro.mage.core.CallbackContext;
import io.rapidpro.mage.*; import io.rapidpro.mage.core.*;
[ "io.rapidpro.mage" ]
io.rapidpro.mage;
155,146
public List<Object> values(CacheKeyFilter filter) throws IOException;
List<Object> function(CacheKeyFilter filter) throws IOException;
/** * Returns a list of values containing in this cache that match the given * filter. * The set is NOT backed by the cache, so changes to the cache are NOT * reflected in the set, and vice-versa. * * @return a set of the entries contained in this cache. */
Returns a list of values containing in this cache that match the given filter. The set is NOT backed by the cache, so changes to the cache are NOT reflected in the set, and vice-versa
values
{ "repo_name": "lucee/unoffical-Lucee-no-jre", "path": "source/java/loader/src/lucee/commons/io/cache/Cache.java", "license": "lgpl-2.1", "size": 7179 }
[ "java.io.IOException", "java.util.List" ]
import java.io.IOException; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,470,899
@Test(expected = IllegalArgumentException.class) public void nullRDFFormatToRetrieveCatalogMetaData(){ try { this.fairMetaDataService.retrieveCatalogMetaData( ExampleTurtleFiles.EXAMPLE_CATALOG_ID, null); fail("This test is excepeted to throw IllegalArgumentException"); } catch (FairMetadataServiceException ex) { String errorMsg = "The test is excepted to throw " + "FairMetadataServiceException"; fail(errorMsg); } }
@Test(expected = IllegalArgumentException.class) void function(){ try { this.fairMetaDataService.retrieveCatalogMetaData( ExampleTurtleFiles.EXAMPLE_CATALOG_ID, null); fail(STR); } catch (FairMetadataServiceException ex) { String errorMsg = STR + STR; fail(errorMsg); } }
/** * Test to retrieve catalog metadata with empty catalogID, * this test is excepted to throw IllegalArgumentException exception */
Test to retrieve catalog metadata with empty catalogID, this test is excepted to throw IllegalArgumentException exception
nullRDFFormatToRetrieveCatalogMetaData
{ "repo_name": "DTL-FAIRData/ODEX-FAIRDataPoint", "path": "fdp-api/java/FairDataPoint/src/test/java/nl/dtls/fairdatapoint/service/impl/FairMetaDataServiceImplTest.java", "license": "apache-2.0", "size": 9683 }
[ "nl.dtls.fairdatapoint.service.FairMetadataServiceException", "nl.dtls.fairdatapoint.utils.ExampleTurtleFiles", "org.junit.Assert", "org.junit.Test" ]
import nl.dtls.fairdatapoint.service.FairMetadataServiceException; import nl.dtls.fairdatapoint.utils.ExampleTurtleFiles; import org.junit.Assert; import org.junit.Test;
import nl.dtls.fairdatapoint.service.*; import nl.dtls.fairdatapoint.utils.*; import org.junit.*;
[ "nl.dtls.fairdatapoint", "org.junit" ]
nl.dtls.fairdatapoint; org.junit;
2,811,047
public Entity installEntity(Entity entity, boolean reinstall);
Entity function(Entity entity, boolean reinstall);
/** * Install an Entity, if one does not exist. * * <p> * This method is appropriate to requests coming from the presentation layer. The embedded * manager identity is required and used as a signal to perform the full installation routine. * To simply update the given entity, please use {@link ContextMgr#storeEntity(Entity)}. * </p> * * @param entity * @param reinstall */
Install an Entity, if one does not exist. This method is appropriate to requests coming from the presentation layer. The embedded manager identity is required and used as a signal to perform the full installation routine. To simply update the given entity, please use <code>ContextMgr#storeEntity(Entity)</code>.
installEntity
{ "repo_name": "eldevanjr/helianto", "path": "helianto-core/src/main/java/org/helianto/core/PostInstallationMgr.java", "license": "apache-2.0", "size": 2981 }
[ "org.helianto.core.domain.Entity" ]
import org.helianto.core.domain.Entity;
import org.helianto.core.domain.*;
[ "org.helianto.core" ]
org.helianto.core;
1,825,168
void dropTunnel(IpAddress srcIp, IpAddress dstIp);
void dropTunnel(IpAddress srcIp, IpAddress dstIp);
/** * Drops the configuration for the tunnel. * * @param srcIp source IP address * @param dstIp destination IP address */
Drops the configuration for the tunnel
dropTunnel
{ "repo_name": "packet-tracker/onos-1.4.0-custom-build", "path": "ovsdb/api/src/main/java/org/onosproject/ovsdb/controller/OvsdbClientService.java", "license": "apache-2.0", "size": 8069 }
[ "org.onlab.packet.IpAddress" ]
import org.onlab.packet.IpAddress;
import org.onlab.packet.*;
[ "org.onlab.packet" ]
org.onlab.packet;
417,776
default Set<String> configTags() { return ConfigUtils.getConfigTags(this.getClass()); }
default Set<String> configTags() { return ConfigUtils.getConfigTags(this.getClass()); }
/** * Return a list of field names that were annotated with either * {@link DefaultValue} or {@link DefaultValueInt}. * * @return The list of field names so annotated. */
Return a list of field names that were annotated with either <code>DefaultValue</code> or <code>DefaultValueInt</code>
configTags
{ "repo_name": "FraunhoferIOSB/SensorThingsServer", "path": "FROST-Server.Core/src/main/java/de/fraunhofer/iosb/ilt/frostserver/settings/ConfigDefaults.java", "license": "lgpl-3.0", "size": 3691 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,101,338
@FIXVersion(introduced="4.3") public void setParties() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
@FIXVersion(introduced="4.3") void function() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
/** * Sets the Parties component if used in this message to the proper implementation * class. */
Sets the Parties component if used in this message to the proper implementation class
setParties
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/OrderModificationRequestMsg.java", "license": "gpl-3.0", "size": 149491 }
[ "net.hades.fix.message.anno.FIXVersion" ]
import net.hades.fix.message.anno.FIXVersion;
import net.hades.fix.message.anno.*;
[ "net.hades.fix" ]
net.hades.fix;
1,390,067
private void setupExperiment(String name, String outputPath, TimeUnit epsilon, TimeUnit referenceUnit, TimeFormatter formatter, ArrayList<String> reportOutputs, ArrayList<String> traceOutputs, ArrayList<String> errorOutputs, ArrayList<String> debugOutputs) { // initialize variables _traceOutput = new ArrayList<OutputType>(); _debugOutput = new ArrayList<OutputType>(); _errorOutput = new ArrayList<OutputType>(); _reportOutput = new ArrayList<OutputType>(); _status = NOT_INITIALIZED; _stopConditions = new ArrayList<ModelCondition>(); // empty, i.e. no Stopper // can be set at // instantiation time _expThreads = new ThreadGroup(name); _registryFileOutput = new ArrayList<FileOutput>(); _registryOutputType = new ArrayList<OutputType>(); lastSuffix = 0; // no batches have run so far ;-) _showProgressBar = true; // display a progress bar for this experiment _showProgressBarAutoclose = false; // do not autoclose progress bar for this experiment _error = false; // no error or warning so far ;-) _silent = false; // notify the user about what is going on _interruptingException = null; // no interruption yet // Check and set output path // if (pathName == null // || (pathName != null && (pathName.isEmpty() || pathName // .equals(".")))) // this.pathName = System.getProperty("user.dir", "."); // else this._pathName = outputPath; // set class variables for basic messagetypes try { tracenote = (Class<TraceNote>) Class .forName("desmoj.core.report.TraceNote"); debugnote = (Class<DebugNote>) Class .forName("desmoj.core.report.DebugNote"); errormessage = (Class<ErrorMessage>) Class .forName("desmoj.core.report.ErrorMessage"); reporter = (Class<Reporter>) Class .forName("desmoj.core.report.Reporter"); } catch (ClassNotFoundException cnfEx) { System.err.println("Can not create Experiment!"); System.err.println("Constructor of desmoj.core.Experiment."); System.err.println("Classes are probably not installed correctly."); System.err.println("Check your CLASSPATH setting."); System.err.println("Exception caught : " + cnfEx); } // create output system first _messMan = new MessageDistributor(); // create and register the debug output for (String debugOutputType : debugOutputs) { try { Class<OutputType> debugOType = (Class<OutputType>) Class .forName((debugOutputType != null) ? debugOutputType : DEFAULT_DEBUG_OUTPUT_TYPE); OutputType dbg = debugOType.newInstance(); _debugOutput.add(dbg); if (debugOutputType != null) dbg.open(_pathName, name); _messMan.register(dbg, debugnote); _messMan.switchOff(debugnote); register(dbg); } catch (Exception e) { System.err.println(e.toString()); } } // create and register the report output for (String reportOutputType : reportOutputs) { try { Class<OutputType> reportOType = (Class<OutputType>) Class .forName((reportOutputType != null) ? reportOutputType : DEFAULT_REPORT_OUTPUT_TYPE); OutputType rpt = reportOType.newInstance(); _reportOutput.add(rpt); if (reportOutputType != null) rpt.open(_pathName, name); _messMan.register(rpt, reporter); register(rpt); } catch (Exception e) { System.err.println(e.toString()); } } // create and register the error output for (String errorOutputType : errorOutputs) { try { Class<OutputType> errorOType = (Class<OutputType>) Class .forName((errorOutputType != null) ? errorOutputType : DEFAULT_ERROR_OUTPUT_TYPE); OutputType err = errorOType.newInstance(); _errorOutput.add(err); // err.setTimeFloats(timeFloats); if (errorOutputType != null) err.open(_pathName, name); _messMan.register(err, errormessage); register(err); } catch (Exception e) { System.err.println(e.toString()); } } // create and register the trace output for (String traceOutputType : traceOutputs) { try { Class<OutputType> traceOType = (Class<OutputType>) Class .forName((traceOutputType != null) ? traceOutputType : DEFAULT_TRACE_OUTPUT_TYPE); OutputType trc = traceOType.newInstance(); _traceOutput.add(trc); if (traceOutputType != null) trc.open(_pathName, name); _messMan.register(trc, tracenote); _messMan.switchOff(tracenote); register(trc); } catch (Exception e) { System.err.println(e.toString()); } } // create the distributionmanager to register distributions at _distMan = new DistributionManager(name, 979); // now create the simulation runtime accessories _client = null; // no object connected // check for null reference if (epsilon == null) { // set to default unit epsilon = TimeOperations.getEpsilon(); } if (referenceUnit == null) { // set to default unit referenceUnit = TimeOperations.getReferenceUnit(); } // swap epsilon and reference unit if the reference unit has a // finer granularity than epsilon if (referenceUnit.compareTo(epsilon) < 0) { TimeUnit buffer = referenceUnit; referenceUnit = epsilon; epsilon = buffer; } // set epsilon and referenceUnit TimeOperations.setEpsilon(epsilon); TimeOperations.setReferenceUnit(referenceUnit); // set time formatter (use default if null passed) if (formatter == null) TimeOperations.setTimeFormatter(TimeOperations.getDefaultTimeFormatter(), false); else TimeOperations.setTimeFormatter(formatter, true); // building the scheduler: prepare event list... // (for efficiency reasons, we use the TreeList-based implementation) EventList eventList = new EventTreeList(); // create the scheduler (and clock) clientScheduler = createScheduler(name, eventList); // create a resource database and tell it that it belongs to this // experiment _resDB = new ResourceDB(this); // set status to first valid value - initialized, but not connected _status = INITIALIZED; }
void function(String name, String outputPath, TimeUnit epsilon, TimeUnit referenceUnit, TimeFormatter formatter, ArrayList<String> reportOutputs, ArrayList<String> traceOutputs, ArrayList<String> errorOutputs, ArrayList<String> debugOutputs) { _traceOutput = new ArrayList<OutputType>(); _debugOutput = new ArrayList<OutputType>(); _errorOutput = new ArrayList<OutputType>(); _reportOutput = new ArrayList<OutputType>(); _status = NOT_INITIALIZED; _stopConditions = new ArrayList<ModelCondition>(); _expThreads = new ThreadGroup(name); _registryFileOutput = new ArrayList<FileOutput>(); _registryOutputType = new ArrayList<OutputType>(); lastSuffix = 0; _showProgressBar = true; _showProgressBarAutoclose = false; _error = false; _silent = false; _interruptingException = null; this._pathName = outputPath; try { tracenote = (Class<TraceNote>) Class .forName(STR); debugnote = (Class<DebugNote>) Class .forName(STR); errormessage = (Class<ErrorMessage>) Class .forName(STR); reporter = (Class<Reporter>) Class .forName(STR); } catch (ClassNotFoundException cnfEx) { System.err.println(STR); System.err.println(STR); System.err.println(STR); System.err.println(STR); System.err.println(STR + cnfEx); } _messMan = new MessageDistributor(); for (String debugOutputType : debugOutputs) { try { Class<OutputType> debugOType = (Class<OutputType>) Class .forName((debugOutputType != null) ? debugOutputType : DEFAULT_DEBUG_OUTPUT_TYPE); OutputType dbg = debugOType.newInstance(); _debugOutput.add(dbg); if (debugOutputType != null) dbg.open(_pathName, name); _messMan.register(dbg, debugnote); _messMan.switchOff(debugnote); register(dbg); } catch (Exception e) { System.err.println(e.toString()); } } for (String reportOutputType : reportOutputs) { try { Class<OutputType> reportOType = (Class<OutputType>) Class .forName((reportOutputType != null) ? reportOutputType : DEFAULT_REPORT_OUTPUT_TYPE); OutputType rpt = reportOType.newInstance(); _reportOutput.add(rpt); if (reportOutputType != null) rpt.open(_pathName, name); _messMan.register(rpt, reporter); register(rpt); } catch (Exception e) { System.err.println(e.toString()); } } for (String errorOutputType : errorOutputs) { try { Class<OutputType> errorOType = (Class<OutputType>) Class .forName((errorOutputType != null) ? errorOutputType : DEFAULT_ERROR_OUTPUT_TYPE); OutputType err = errorOType.newInstance(); _errorOutput.add(err); if (errorOutputType != null) err.open(_pathName, name); _messMan.register(err, errormessage); register(err); } catch (Exception e) { System.err.println(e.toString()); } } for (String traceOutputType : traceOutputs) { try { Class<OutputType> traceOType = (Class<OutputType>) Class .forName((traceOutputType != null) ? traceOutputType : DEFAULT_TRACE_OUTPUT_TYPE); OutputType trc = traceOType.newInstance(); _traceOutput.add(trc); if (traceOutputType != null) trc.open(_pathName, name); _messMan.register(trc, tracenote); _messMan.switchOff(tracenote); register(trc); } catch (Exception e) { System.err.println(e.toString()); } } _distMan = new DistributionManager(name, 979); _client = null; if (epsilon == null) { epsilon = TimeOperations.getEpsilon(); } if (referenceUnit == null) { referenceUnit = TimeOperations.getReferenceUnit(); } if (referenceUnit.compareTo(epsilon) < 0) { TimeUnit buffer = referenceUnit; referenceUnit = epsilon; epsilon = buffer; } TimeOperations.setEpsilon(epsilon); TimeOperations.setReferenceUnit(referenceUnit); if (formatter == null) TimeOperations.setTimeFormatter(TimeOperations.getDefaultTimeFormatter(), false); else TimeOperations.setTimeFormatter(formatter, true); EventList eventList = new EventTreeList(); clientScheduler = createScheduler(name, eventList); _resDB = new ResourceDB(this); _status = INITIALIZED; }
/** * Private helper method to initialize the experiment; should be called * from all constructors. * * @param name * String : The name of the experiment determining the * outputfile's names, too. So please avoid characters that your * local filesystem does not support in filenames. * @param outputPath * java.lang.String : The output path for report files * @param epsilon * java.util.concurrent.TimeUnit: The granularity of simulation * time. * @param referenceUnit * java.util.concurrent.TimeUnit : In statements without an * explicit declaration of a TimeUnit the reference unit is used. * @param formatter * desmoj.core.simulator.TimeFormatter: Defines how time values * will be formatted in the output files. * * @see java.util.concurrent.TimeUnit */
Private helper method to initialize the experiment; should be called from all constructors
setupExperiment
{ "repo_name": "muhd7rosli/desmoj", "path": "src/desmoj/core/simulator/Experiment.java", "license": "apache-2.0", "size": 100241 }
[ "java.util.ArrayList", "java.util.concurrent.TimeUnit" ]
import java.util.ArrayList; import java.util.concurrent.TimeUnit;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,006,343
public static IdempotentRepository memoryIdempotentRepository(Map<String, Object> cache) { return new MemoryIdempotentRepository(cache); }
static IdempotentRepository function(Map<String, Object> cache) { return new MemoryIdempotentRepository(cache); }
/** * Creates a new memory based repository using the given {@link Map} to * use to store the processed message ids. * <p/> * Care should be taken to use a suitable underlying {@link Map} to avoid this class being a * memory leak. * * @param cache the cache */
Creates a new memory based repository using the given <code>Map</code> to use to store the processed message ids. Care should be taken to use a suitable underlying <code>Map</code> to avoid this class being a memory leak
memoryIdempotentRepository
{ "repo_name": "punkhorn/camel-upstream", "path": "core/camel-support/src/main/java/org/apache/camel/support/processor/idempotent/MemoryIdempotentRepository.java", "license": "apache-2.0", "size": 4570 }
[ "java.util.Map", "org.apache.camel.spi.IdempotentRepository" ]
import java.util.Map; import org.apache.camel.spi.IdempotentRepository;
import java.util.*; import org.apache.camel.spi.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
305,234
public WorkflowDTO createWorkflowDTO(String wfType) { WorkflowDTO workflowDTO = null; if(WorkflowConstants.WF_TYPE_AM_APPLICATION_CREATION.equals(wfType)){ workflowDTO = new ApplicationWorkflowDTO(); }else if(WorkflowConstants.WF_TYPE_AM_APPLICATION_REGISTRATION_PRODUCTION.equals(wfType)){ workflowDTO = new ApplicationRegistrationWorkflowDTO(); ((ApplicationRegistrationWorkflowDTO)workflowDTO).setKeyType(APIConstants.API_KEY_TYPE_PRODUCTION); }else if(WorkflowConstants.WF_TYPE_AM_APPLICATION_REGISTRATION_SANDBOX.equals(wfType)){ workflowDTO = new ApplicationRegistrationWorkflowDTO(); ((ApplicationRegistrationWorkflowDTO)workflowDTO).setKeyType(APIConstants.API_KEY_TYPE_SANDBOX); }else if(WorkflowConstants.WF_TYPE_AM_SUBSCRIPTION_CREATION.equals(wfType)){ workflowDTO = new SubscriptionWorkflowDTO(); }else if(WorkflowConstants.WF_TYPE_AM_USER_SIGNUP.equals(wfType)){ workflowDTO = new WorkflowDTO(); } workflowDTO.setWorkflowType(wfType); return workflowDTO; }
WorkflowDTO function(String wfType) { WorkflowDTO workflowDTO = null; if(WorkflowConstants.WF_TYPE_AM_APPLICATION_CREATION.equals(wfType)){ workflowDTO = new ApplicationWorkflowDTO(); }else if(WorkflowConstants.WF_TYPE_AM_APPLICATION_REGISTRATION_PRODUCTION.equals(wfType)){ workflowDTO = new ApplicationRegistrationWorkflowDTO(); ((ApplicationRegistrationWorkflowDTO)workflowDTO).setKeyType(APIConstants.API_KEY_TYPE_PRODUCTION); }else if(WorkflowConstants.WF_TYPE_AM_APPLICATION_REGISTRATION_SANDBOX.equals(wfType)){ workflowDTO = new ApplicationRegistrationWorkflowDTO(); ((ApplicationRegistrationWorkflowDTO)workflowDTO).setKeyType(APIConstants.API_KEY_TYPE_SANDBOX); }else if(WorkflowConstants.WF_TYPE_AM_SUBSCRIPTION_CREATION.equals(wfType)){ workflowDTO = new SubscriptionWorkflowDTO(); }else if(WorkflowConstants.WF_TYPE_AM_USER_SIGNUP.equals(wfType)){ workflowDTO = new WorkflowDTO(); } workflowDTO.setWorkflowType(wfType); return workflowDTO; }
/** * Create a DTO object related to a given workflow type. * @param wfType Type of the workflow. */
Create a DTO object related to a given workflow type
createWorkflowDTO
{ "repo_name": "kasun32/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/workflow/WorkflowExecutorFactory.java", "license": "apache-2.0", "size": 5203 }
[ "org.wso2.carbon.apimgt.impl.APIConstants", "org.wso2.carbon.apimgt.impl.dto.ApplicationRegistrationWorkflowDTO", "org.wso2.carbon.apimgt.impl.dto.ApplicationWorkflowDTO", "org.wso2.carbon.apimgt.impl.dto.SubscriptionWorkflowDTO", "org.wso2.carbon.apimgt.impl.dto.WorkflowDTO" ]
import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.dto.ApplicationRegistrationWorkflowDTO; import org.wso2.carbon.apimgt.impl.dto.ApplicationWorkflowDTO; import org.wso2.carbon.apimgt.impl.dto.SubscriptionWorkflowDTO; import org.wso2.carbon.apimgt.impl.dto.WorkflowDTO;
import org.wso2.carbon.apimgt.impl.*; import org.wso2.carbon.apimgt.impl.dto.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,184,319
public Paint getItemLabelPaint(int row, int column); /** * Returns the paint used for all item labels. This may be * <code>null</code>, in which case the per series paint settings will * apply. * * @return The paint (possibly <code>null</code>). * * @see #setItemLabelPaint(Paint) * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #getSeriesItemLabelPaint(int)}
Paint function(int row, int column); /** * Returns the paint used for all item labels. This may be * <code>null</code>, in which case the per series paint settings will * apply. * * @return The paint (possibly <code>null</code>). * * @see #setItemLabelPaint(Paint) * * @deprecated This method should no longer be used (as of version 1.0.6). * It is sufficient to rely on {@link #getSeriesItemLabelPaint(int)}
/** * Returns the paint used to draw an item label. * * @param row the row index (zero based). * @param column the column index (zero based). * * @return The paint (never <code>null</code>). */
Returns the paint used to draw an item label
getItemLabelPaint
{ "repo_name": "apetresc/JFreeChart", "path": "src/main/java/org/jfree/chart/renderer/category/CategoryItemRenderer.java", "license": "lgpl-2.1", "size": 67879 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,641,975
public static boolean isCPUSupport(){ boolean excludeX86 = "true".equals(options.get(SETTING_EXCLUDE_X86SUPPORT)); boolean isX86AndExcluded = WXSoInstallMgrSdk.isX86() && excludeX86; boolean isCPUSupport = WXSoInstallMgrSdk.isCPUSupport() && !isX86AndExcluded; if (WXEnvironment.isApkDebugable()) { WXLogUtils.d("WXEnvironment.sSupport:" + isCPUSupport + "isX86AndExclueded: "+ isX86AndExcluded); } return isCPUSupport; }
static boolean function(){ boolean excludeX86 = "true".equals(options.get(SETTING_EXCLUDE_X86SUPPORT)); boolean isX86AndExcluded = WXSoInstallMgrSdk.isX86() && excludeX86; boolean isCPUSupport = WXSoInstallMgrSdk.isCPUSupport() && !isX86AndExcluded; if (WXEnvironment.isApkDebugable()) { WXLogUtils.d(STR + isCPUSupport + STR+ isX86AndExcluded); } return isCPUSupport; }
/** * Determine whether Weex supports the current CPU architecture * @return true when support */
Determine whether Weex supports the current CPU architecture
isCPUSupport
{ "repo_name": "erha19/incubator-weex", "path": "android/sdk/src/main/java/com/taobao/weex/WXEnvironment.java", "license": "apache-2.0", "size": 12624 }
[ "com.taobao.weex.utils.WXLogUtils", "com.taobao.weex.utils.WXSoInstallMgrSdk" ]
import com.taobao.weex.utils.WXLogUtils; import com.taobao.weex.utils.WXSoInstallMgrSdk;
import com.taobao.weex.utils.*;
[ "com.taobao.weex" ]
com.taobao.weex;
2,912,834
void setProjectDescription(@NotNull String projectDescription);
void setProjectDescription(@NotNull String projectDescription);
/** * Set the project's description value. * * @param projectDescription * project's description to set */
Set the project's description value
setProjectDescription
{ "repo_name": "dhuebner/che", "path": "plugins/plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/importer/page/GithubImporterPageView.java", "license": "epl-1.0", "size": 6284 }
[ "javax.validation.constraints.NotNull" ]
import javax.validation.constraints.NotNull;
import javax.validation.constraints.*;
[ "javax.validation" ]
javax.validation;
1,887,293
public Collection<ClusterNode> remoteAliveNodesWithCaches(AffinityTopologyVersion topVer) { return resolveDiscoCache(CU.cacheId(null), topVer).remoteAliveNodesWithCaches(); }
Collection<ClusterNode> function(AffinityTopologyVersion topVer) { return resolveDiscoCache(CU.cacheId(null), topVer).remoteAliveNodesWithCaches(); }
/** * Gets cache remote nodes for cache with given name. * * @param topVer Topology version. * @return Collection of cache nodes. */
Gets cache remote nodes for cache with given name
remoteAliveNodesWithCaches
{ "repo_name": "chandresh-pancholi/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java", "license": "apache-2.0", "size": 138014 }
[ "java.util.Collection", "org.apache.ignite.cluster.ClusterNode", "org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion", "org.apache.ignite.internal.util.typedef.internal.CU" ]
import java.util.Collection; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.util.typedef.internal.CU;
import java.util.*; import org.apache.ignite.cluster.*; import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.util.typedef.internal.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
2,203,929
private void writeToFile(String from, boolean append, File to) throws IOException { FileWriter out = null; try { out = new FileWriter(to.getAbsolutePath(), append); StringReader in = new StringReader(from); char[] buffer = new char[BUFFER_SIZE]; int bytesRead; while (true) { bytesRead = in.read(buffer); if (bytesRead == -1) { break; } out.write(buffer, 0, bytesRead); } out.flush(); } finally { if (out != null) { out.close(); } } }
void function(String from, boolean append, File to) throws IOException { FileWriter out = null; try { out = new FileWriter(to.getAbsolutePath(), append); StringReader in = new StringReader(from); char[] buffer = new char[BUFFER_SIZE]; int bytesRead; while (true) { bytesRead = in.read(buffer); if (bytesRead == -1) { break; } out.write(buffer, 0, bytesRead); } out.flush(); } finally { if (out != null) { out.close(); } } }
/** * Writes a string to a file. If destination file exists, it may be * overwritten depending on the "append" value. * * @param from string to write * @param to file to write to * @param append if true, append to existing file, else overwrite * @exception Exception most likely an IOException */
Writes a string to a file. If destination file exists, it may be overwritten depending on the "append" value
writeToFile
{ "repo_name": "Mayo-WE01051879/mayosapp", "path": "Build/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java", "license": "mit", "size": 14474 }
[ "java.io.File", "java.io.FileWriter", "java.io.IOException", "java.io.StringReader" ]
import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.StringReader;
import java.io.*;
[ "java.io" ]
java.io;
2,540,650
StringBuilder storageProfile = new StringBuilder().append("\n\tStorageProfile: "); if (resource.storageProfile().imageReference() != null) { storageProfile.append("\n\t\tImageReference:"); storageProfile.append("\n\t\t\tPublisher: ").append(resource.storageProfile().imageReference().publisher()); storageProfile.append("\n\t\t\tOffer: ").append(resource.storageProfile().imageReference().offer()); storageProfile.append("\n\t\t\tSKU: ").append(resource.storageProfile().imageReference().sku()); storageProfile.append("\n\t\t\tVersion: ").append(resource.storageProfile().imageReference().version()); } if (resource.storageProfile().osDisk() != null) { storageProfile.append("\n\t\tOSDisk:"); storageProfile.append("\n\t\t\tOSType: ").append(resource.storageProfile().osDisk().osType()); storageProfile.append("\n\t\t\tName: ").append(resource.storageProfile().osDisk().name()); storageProfile.append("\n\t\t\tCaching: ").append(resource.storageProfile().osDisk().caching()); storageProfile.append("\n\t\t\tCreateOption: ").append(resource.storageProfile().osDisk().createOption()); storageProfile.append("\n\t\t\tDiskSizeGB: ").append(resource.storageProfile().osDisk().diskSizeGB()); if (resource.storageProfile().osDisk().image() != null) { storageProfile.append("\n\t\t\tImage Uri: ").append(resource.storageProfile().osDisk().image().uri()); } if (resource.storageProfile().osDisk().vhd() != null) { storageProfile.append("\n\t\t\tVhd Uri: ").append(resource.storageProfile().osDisk().vhd().uri()); } if (resource.storageProfile().osDisk().encryptionSettings() != null) { storageProfile.append("\n\t\t\tEncryptionSettings: "); storageProfile.append("\n\t\t\t\tEnabled: ").append(resource.storageProfile().osDisk().encryptionSettings().enabled()); storageProfile.append("\n\t\t\t\tDiskEncryptionKey Uri: ").append(resource .storageProfile() .osDisk() .encryptionSettings() .diskEncryptionKey().secretUrl()); storageProfile.append("\n\t\t\t\tKeyEncryptionKey Uri: ").append(resource .storageProfile() .osDisk() .encryptionSettings() .keyEncryptionKey().keyUrl()); } } if (resource.storageProfile().dataDisks() != null) { int i = 0; for (DataDisk disk : resource.storageProfile().dataDisks()) { storageProfile.append("\n\t\tDataDisk: #").append(i++); storageProfile.append("\n\t\t\tName: ").append(disk.name()); storageProfile.append("\n\t\t\tCaching: ").append(disk.caching()); storageProfile.append("\n\t\t\tCreateOption: ").append(disk.createOption()); storageProfile.append("\n\t\t\tDiskSizeGB: ").append(disk.diskSizeGB()); storageProfile.append("\n\t\t\tLun: ").append(disk.lun()); if (disk.vhd().uri() != null) { storageProfile.append("\n\t\t\tVhd Uri: ").append(disk.vhd().uri()); } if (disk.image() != null) { storageProfile.append("\n\t\t\tImage Uri: ").append(disk.image().uri()); } } } StringBuilder osProfile = new StringBuilder().append("\n\tOSProfile: "); osProfile.append("\n\t\tComputerName:").append(resource.osProfile().computerName()); if (resource.osProfile().windowsConfiguration() != null) { osProfile.append("\n\t\t\tWindowsConfiguration: "); osProfile.append("\n\t\t\t\tProvisionVMAgent: ") .append(resource.osProfile().windowsConfiguration().provisionVMAgent()); osProfile.append("\n\t\t\t\tEnableAutomaticUpdates: ") .append(resource.osProfile().windowsConfiguration().enableAutomaticUpdates()); osProfile.append("\n\t\t\t\tTimeZone: ") .append(resource.osProfile().windowsConfiguration().timeZone()); } if (resource.osProfile().linuxConfiguration() != null) { osProfile.append("\n\t\t\tLinuxConfiguration: "); osProfile.append("\n\t\t\t\tDisablePasswordAuthentication: ") .append(resource.osProfile().linuxConfiguration().disablePasswordAuthentication()); } StringBuilder networkProfile = new StringBuilder().append("\n\tNetworkProfile: "); for (String networkInterfaceId : resource.networkInterfaceIds()) { networkProfile.append("\n\t\tId:").append(networkInterfaceId); } System.out.println(new StringBuilder().append("Virtual Machine: ").append(resource.id()) .append("Name: ").append(resource.name()) .append("\n\tResource group: ").append(resource.resourceGroupName()) .append("\n\tRegion: ").append(resource.region()) .append("\n\tTags: ").append(resource.tags()) .append("\n\tHardwareProfile: ") .append("\n\t\tSize: ").append(resource.size()) .append(storageProfile) .append(osProfile) .append(networkProfile) .toString()); }
StringBuilder storageProfile = new StringBuilder().append(STR); if (resource.storageProfile().imageReference() != null) { storageProfile.append(STR); storageProfile.append(STR).append(resource.storageProfile().imageReference().publisher()); storageProfile.append(STR).append(resource.storageProfile().imageReference().offer()); storageProfile.append(STR).append(resource.storageProfile().imageReference().sku()); storageProfile.append(STR).append(resource.storageProfile().imageReference().version()); } if (resource.storageProfile().osDisk() != null) { storageProfile.append(STR); storageProfile.append(STR).append(resource.storageProfile().osDisk().osType()); storageProfile.append(STR).append(resource.storageProfile().osDisk().name()); storageProfile.append(STR).append(resource.storageProfile().osDisk().caching()); storageProfile.append(STR).append(resource.storageProfile().osDisk().createOption()); storageProfile.append(STR).append(resource.storageProfile().osDisk().diskSizeGB()); if (resource.storageProfile().osDisk().image() != null) { storageProfile.append(STR).append(resource.storageProfile().osDisk().image().uri()); } if (resource.storageProfile().osDisk().vhd() != null) { storageProfile.append(STR).append(resource.storageProfile().osDisk().vhd().uri()); } if (resource.storageProfile().osDisk().encryptionSettings() != null) { storageProfile.append(STR); storageProfile.append(STR).append(resource.storageProfile().osDisk().encryptionSettings().enabled()); storageProfile.append(STR).append(resource .storageProfile() .osDisk() .encryptionSettings() .diskEncryptionKey().secretUrl()); storageProfile.append(STR).append(resource .storageProfile() .osDisk() .encryptionSettings() .keyEncryptionKey().keyUrl()); } } if (resource.storageProfile().dataDisks() != null) { int i = 0; for (DataDisk disk : resource.storageProfile().dataDisks()) { storageProfile.append(STR).append(i++); storageProfile.append(STR).append(disk.name()); storageProfile.append(STR).append(disk.caching()); storageProfile.append(STR).append(disk.createOption()); storageProfile.append(STR).append(disk.diskSizeGB()); storageProfile.append(STR).append(disk.lun()); if (disk.vhd().uri() != null) { storageProfile.append(STR).append(disk.vhd().uri()); } if (disk.image() != null) { storageProfile.append(STR).append(disk.image().uri()); } } } StringBuilder osProfile = new StringBuilder().append(STR); osProfile.append(STR).append(resource.osProfile().computerName()); if (resource.osProfile().windowsConfiguration() != null) { osProfile.append(STR); osProfile.append(STR) .append(resource.osProfile().windowsConfiguration().provisionVMAgent()); osProfile.append(STR) .append(resource.osProfile().windowsConfiguration().enableAutomaticUpdates()); osProfile.append(STR) .append(resource.osProfile().windowsConfiguration().timeZone()); } if (resource.osProfile().linuxConfiguration() != null) { osProfile.append(STR); osProfile.append(STR) .append(resource.osProfile().linuxConfiguration().disablePasswordAuthentication()); } StringBuilder networkProfile = new StringBuilder().append(STR); for (String networkInterfaceId : resource.networkInterfaceIds()) { networkProfile.append(STR).append(networkInterfaceId); } System.out.println(new StringBuilder().append(STR).append(resource.id()) .append(STR).append(resource.name()) .append(STR).append(resource.resourceGroupName()) .append(STR).append(resource.region()) .append(STR).append(resource.tags()) .append(STR) .append(STR).append(resource.size()) .append(storageProfile) .append(osProfile) .append(networkProfile) .toString()); }
/** * Shows the virtual machine. * @param resource virtual machine to show */
Shows the virtual machine
print
{ "repo_name": "herveyw/azure-sdk-for-java", "path": "azure/src/test/java/com/microsoft/azure/management/TestUtils.java", "license": "mit", "size": 6137 }
[ "com.microsoft.azure.management.compute.DataDisk" ]
import com.microsoft.azure.management.compute.DataDisk;
import com.microsoft.azure.management.compute.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,288,037
@Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(XALPackage.eINSTANCE.getAddressLinesType_AddressLine()); childrenFeatures.add(XALPackage.eINSTANCE.getAddressLinesType_Any()); childrenFeatures.add(XALPackage.eINSTANCE.getAddressLinesType_AnyAttribute()); } return childrenFeatures; }
Collection<? extends EStructuralFeature> function(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(XALPackage.eINSTANCE.getAddressLinesType_AddressLine()); childrenFeatures.add(XALPackage.eINSTANCE.getAddressLinesType_Any()); childrenFeatures.add(XALPackage.eINSTANCE.getAddressLinesType_AnyAttribute()); } return childrenFeatures; }
/** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This specifies how to implement <code>#getChildren</code> and is used to deduce an appropriate feature for an <code>org.eclipse.emf.edit.command.AddCommand</code>, <code>org.eclipse.emf.edit.command.RemoveCommand</code> or <code>org.eclipse.emf.edit.command.MoveCommand</code> in <code>#createCommand</code>.
getChildrenFeatures
{ "repo_name": "markus1978/citygml4emf", "path": "de.hub.citygml.emf.ecore.edit/src/org/oasis/xAL/provider/AddressLinesTypeItemProvider.java", "license": "apache-2.0", "size": 224293 }
[ "java.util.Collection", "org.eclipse.emf.ecore.EStructuralFeature", "org.oasis.xAL.XALPackage" ]
import java.util.Collection; import org.eclipse.emf.ecore.EStructuralFeature; import org.oasis.xAL.XALPackage;
import java.util.*; import org.eclipse.emf.ecore.*; import org.oasis.*;
[ "java.util", "org.eclipse.emf", "org.oasis" ]
java.util; org.eclipse.emf; org.oasis;
595,136
public Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> query( InetSocketAddress nameServerAddr, DnsQuestion question, Promise<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>> promise) { return query0(nameServerAddr, question, EMPTY_ADDITIONALS, promise); }
Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> function( InetSocketAddress nameServerAddr, DnsQuestion question, Promise<AddressedEnvelope<? extends DnsResponse, InetSocketAddress>> promise) { return query0(nameServerAddr, question, EMPTY_ADDITIONALS, promise); }
/** * Sends a DNS query with the specified question using the specified name server list. */
Sends a DNS query with the specified question using the specified name server list
query
{ "repo_name": "xiaoaowanghu/MJServer", "path": "MJServer/nettysrc/io/netty/resolver/dns/DnsNameResolver.java", "license": "gpl-3.0", "size": 39731 }
[ "io.netty.channel.AddressedEnvelope", "io.netty.handler.codec.dns.DnsQuestion", "io.netty.handler.codec.dns.DnsResponse", "io.netty.util.concurrent.Future", "io.netty.util.concurrent.Promise", "java.net.InetSocketAddress" ]
import io.netty.channel.AddressedEnvelope; import io.netty.handler.codec.dns.DnsQuestion; import io.netty.handler.codec.dns.DnsResponse; import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Promise; import java.net.InetSocketAddress;
import io.netty.channel.*; import io.netty.handler.codec.dns.*; import io.netty.util.concurrent.*; import java.net.*;
[ "io.netty.channel", "io.netty.handler", "io.netty.util", "java.net" ]
io.netty.channel; io.netty.handler; io.netty.util; java.net;
1,531,874
public void testPrimaryBalanceAfterRecovery() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); int numBuckets = 30; createPR(vm0, 1); createPR(vm1, 1); createPR(vm2, 1); createData(vm0, 0, numBuckets, "a"); Set<Integer> vm0Buckets = getBucketList(vm0); Set<Integer> vm1Buckets = getBucketList(vm1); Set<Integer> vm2Buckets = getBucketList(vm2); //We expect to see 10 primaries on each node since we have 30 buckets Set<Integer> vm0Primaries = getPrimaryBucketList(vm0); assertEquals("Expected 10 primaries " + vm0Primaries, 10, vm0Primaries.size()); Set<Integer> vm1Primaries = getPrimaryBucketList(vm1); assertEquals("Expected 10 primaries " + vm1Primaries, 10, vm1Primaries.size()); Set<Integer> vm2Primaries = getPrimaryBucketList(vm2); assertEquals("Expected 10 primaries " + vm2Primaries, 10, vm2Primaries.size()); //bounce vm0 closeCache(vm0); createPR(vm0, 1); waitForBucketRecovery(vm0, vm0Buckets); assertEquals(vm0Buckets,getBucketList(vm0)); assertEquals(vm1Buckets,getBucketList(vm1)); assertEquals(vm2Buckets,getBucketList(vm2)); //The primaries should be evenly distributed after recovery. vm0Primaries = getPrimaryBucketList(vm0); assertEquals("Expected 10 primaries " + vm0Primaries, 10, vm0Primaries.size()); vm1Primaries = getPrimaryBucketList(vm1); assertEquals("Expected 10 primaries " + vm1Primaries, 10, vm1Primaries.size()); vm2Primaries = getPrimaryBucketList(vm2); assertEquals("Expected 10 primaries " + vm2Primaries, 10, vm2Primaries.size()); }
void function() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); int numBuckets = 30; createPR(vm0, 1); createPR(vm1, 1); createPR(vm2, 1); createData(vm0, 0, numBuckets, "a"); Set<Integer> vm0Buckets = getBucketList(vm0); Set<Integer> vm1Buckets = getBucketList(vm1); Set<Integer> vm2Buckets = getBucketList(vm2); Set<Integer> vm0Primaries = getPrimaryBucketList(vm0); assertEquals(STR + vm0Primaries, 10, vm0Primaries.size()); Set<Integer> vm1Primaries = getPrimaryBucketList(vm1); assertEquals(STR + vm1Primaries, 10, vm1Primaries.size()); Set<Integer> vm2Primaries = getPrimaryBucketList(vm2); assertEquals(STR + vm2Primaries, 10, vm2Primaries.size()); closeCache(vm0); createPR(vm0, 1); waitForBucketRecovery(vm0, vm0Buckets); assertEquals(vm0Buckets,getBucketList(vm0)); assertEquals(vm1Buckets,getBucketList(vm1)); assertEquals(vm2Buckets,getBucketList(vm2)); vm0Primaries = getPrimaryBucketList(vm0); assertEquals(STR + vm0Primaries, 10, vm0Primaries.size()); vm1Primaries = getPrimaryBucketList(vm1); assertEquals(STR + vm1Primaries, 10, vm1Primaries.size()); vm2Primaries = getPrimaryBucketList(vm2); assertEquals(STR + vm2Primaries, 10, vm2Primaries.size()); }
/** * Test to make sure that primaries are rebalanced after recovering from * disk. */
Test to make sure that primaries are rebalanced after recovering from disk
testPrimaryBalanceAfterRecovery
{ "repo_name": "nchandrappa/incubator-geode", "path": "gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java", "license": "apache-2.0", "size": 70139 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,510,837
public static void stopAndShutdownServices(Object... services) throws Exception { if (services == null) { return; } List<Object> list = Arrays.asList(services); stopAndShutdownServices(list); }
static void function(Object... services) throws Exception { if (services == null) { return; } List<Object> list = Arrays.asList(services); stopAndShutdownServices(list); }
/** * Stops and shutdowns each element of the given {@code services} if {@code services} itself is * not {@code null}, otherwise this method would return immediately. * <p/> * If there's any exception being thrown while stopping/shutting down the elements one after * the other this method would rethrow the <b>first</b> such exception being thrown. * * @see #stopAndShutdownServices(Collection) */
Stops and shutdowns each element of the given services if services itself is not null, otherwise this method would return immediately. If there's any exception being thrown while stopping/shutting down the elements one after the other this method would rethrow the first such exception being thrown
stopAndShutdownServices
{ "repo_name": "YMartsynkevych/camel", "path": "camel-core/src/main/java/org/apache/camel/util/ServiceHelper.java", "license": "apache-2.0", "size": 18040 }
[ "java.util.Arrays", "java.util.List" ]
import java.util.Arrays; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
667,845
public static <K, V> void inTx(Ignite ignite, IgniteCache<K, V> cache, TransactionConcurrency concurrency, TransactionIsolation isolation, IgniteInClosureX<IgniteCache<K ,V>> clo) throws IgniteCheckedException { try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { clo.applyx(cache); tx.commit(); } }
static <K, V> void function(Ignite ignite, IgniteCache<K, V> cache, TransactionConcurrency concurrency, TransactionIsolation isolation, IgniteInClosureX<IgniteCache<K ,V>> clo) throws IgniteCheckedException { try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) { clo.applyx(cache); tx.commit(); } }
/** * Execute closure inside cache transaction. * * @param cache Cache. * @param concurrency Concurrency. * @param isolation Isolation. * @param clo Closure. * @throws IgniteCheckedException If failed. */
Execute closure inside cache transaction
inTx
{ "repo_name": "agura/incubator-ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java", "license": "apache-2.0", "size": 61699 }
[ "org.apache.ignite.Ignite", "org.apache.ignite.IgniteCache", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.util.lang.IgniteInClosureX", "org.apache.ignite.transactions.Transaction", "org.apache.ignite.transactions.TransactionConcurrency", "org.apache.ignite.transactions.Transac...
import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.util.lang.IgniteInClosureX; import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation;
import org.apache.ignite.*; import org.apache.ignite.internal.util.lang.*; import org.apache.ignite.transactions.*;
[ "org.apache.ignite" ]
org.apache.ignite;
433,052
public JSONArray getResponseArray() throws JSONException { // if responseArray is already set, return it if (responseArray != null) return responseArray; Client client = Client.create(new DefaultClientConfig()); WebResource resource = client.resource(uri).path(Helper.SORT_PATH); resource.accept(MediaType.APPLICATION_JSON); String encoding = "UTF-8"; try { String arrayParam = URLEncoder.encode(requestArray.toString(), encoding); String localeParam = URLEncoder.encode(locale.toString(), encoding); ClientResponse response = resource.queryParam(Helper.LOCALE_PARAMETER_NAME, localeParam) .queryParam(Helper.REQUEST_ARRAY_PARAMETER_NAME, arrayParam).get(ClientResponse.class); responseArray = new JSONArray(response.getEntity(String.class)); return responseArray; } catch (UnsupportedEncodingException e) { System.err.println(encoding + " encoding not supported:" + e.getMessage()); return null; } } public SortClient() { try { this.uri = new URI(Helper.DEFAULT_URI); this.requestArray = new JSONArray(Helper.DEFAULT_REQUEST_ARRAY); this.locale = new Locale(Helper.DEFAULT_LOCALE); } catch (URISyntaxException e) { System.err.println("The default URI(" + Helper.DEFAULT_URI + ") is not parsable."); } catch (JSONException e) { System.err.println("The default array (" + Helper.DEFAULT_REQUEST_ARRAY + ") is not parsable."); } }
JSONArray function() throws JSONException { if (responseArray != null) return responseArray; Client client = Client.create(new DefaultClientConfig()); WebResource resource = client.resource(uri).path(Helper.SORT_PATH); resource.accept(MediaType.APPLICATION_JSON); String encoding = "UTF-8"; try { String arrayParam = URLEncoder.encode(requestArray.toString(), encoding); String localeParam = URLEncoder.encode(locale.toString(), encoding); ClientResponse response = resource.queryParam(Helper.LOCALE_PARAMETER_NAME, localeParam) .queryParam(Helper.REQUEST_ARRAY_PARAMETER_NAME, arrayParam).get(ClientResponse.class); responseArray = new JSONArray(response.getEntity(String.class)); return responseArray; } catch (UnsupportedEncodingException e) { System.err.println(encoding + STR + e.getMessage()); return null; } } public SortClient() { try { this.uri = new URI(Helper.DEFAULT_URI); this.requestArray = new JSONArray(Helper.DEFAULT_REQUEST_ARRAY); this.locale = new Locale(Helper.DEFAULT_LOCALE); } catch (URISyntaxException e) { System.err.println(STR + Helper.DEFAULT_URI + STR); } catch (JSONException e) { System.err.println(STR + Helper.DEFAULT_REQUEST_ARRAY + STR); } }
/** * Executes a GET request with the requestArray object to the server * specified by the url, receives the response an sets the responseArray * field before returning it. * * @return if the field responseArray is not null, returns the field * responseArray, else does a get request with the requestArray and * locale parameters, sets the responseArray field to the received * result and returns the value of the responseArray afterwards * * @throws JSONException * if the response cannot be parsed as a JSON array */
Executes a GET request with the requestArray object to the server specified by the url, receives the response an sets the responseArray field before returning it
getResponseArray
{ "repo_name": "eschleining/RESTJsonSort", "path": "RESTSortClient/src/main/java/client/SortClient.java", "license": "gpl-2.0", "size": 14147 }
[ "com.sun.jersey.api.client.Client", "com.sun.jersey.api.client.ClientResponse", "com.sun.jersey.api.client.WebResource", "com.sun.jersey.api.client.config.DefaultClientConfig", "java.io.UnsupportedEncodingException", "java.net.URISyntaxException", "java.net.URLEncoder", "java.util.Locale", "javax.ws...
import com.sun.jersey.api.client.Client; import com.sun.jersey.api.client.ClientResponse; import com.sun.jersey.api.client.WebResource; import com.sun.jersey.api.client.config.DefaultClientConfig; import java.io.UnsupportedEncodingException; import java.net.URISyntaxException; import java.net.URLEncoder; import java.util.Locale; import javax.ws.rs.core.MediaType; import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONException;
import com.sun.jersey.api.client.*; import com.sun.jersey.api.client.config.*; import java.io.*; import java.net.*; import java.util.*; import javax.ws.rs.core.*; import org.codehaus.jettison.json.*;
[ "com.sun.jersey", "java.io", "java.net", "java.util", "javax.ws", "org.codehaus.jettison" ]
com.sun.jersey; java.io; java.net; java.util; javax.ws; org.codehaus.jettison;
1,414,185
@WebMethod(operationName = "CreateAuxItems") @WebResult(targetNamespace = "urn:sbmappservices72") @RequestWrapper(localName = "CreateAuxItems", targetNamespace = "urn:sbmappservices72", className = "com.prisch.sbm.stubs.CreateAuxItems") @ResponseWrapper(localName = "CreateAuxItemsResponse", targetNamespace = "urn:sbmappservices72", className = "com.prisch.sbm.stubs.CreateAuxItemsResponse") public List<TTItemHolder> createAuxItems( @WebParam(name = "auth", targetNamespace = "urn:sbmappservices72") Auth auth, @WebParam(name = "table", targetNamespace = "urn:sbmappservices72") TableIdentifier table, @WebParam(name = "item", targetNamespace = "urn:sbmappservices72") List<TTItem> item, @WebParam(name = "options", targetNamespace = "urn:sbmappservices72") MultipleResponseItemOptions options) throws AEWebservicesFaultFault ;
@WebMethod(operationName = STR) @WebResult(targetNamespace = STR) @RequestWrapper(localName = STR, targetNamespace = STR, className = STR) @ResponseWrapper(localName = STR, targetNamespace = STR, className = STR) List<TTItemHolder> function( @WebParam(name = "auth", targetNamespace = STR) Auth auth, @WebParam(name = "table", targetNamespace = STR) TableIdentifier table, @WebParam(name = "item", targetNamespace = STR) List<TTItem> item, @WebParam(name = STR, targetNamespace = STR) MultipleResponseItemOptions options) throws AEWebservicesFaultFault ;
/** * Service definition of function ae__CreateAuxItems * * @param item * @param auth * @param options * @param table * @return * returns java.util.List<com.prisch.sbm.stubs.TTItemHolder> * @throws AEWebservicesFaultFault */
Service definition of function ae__CreateAuxItems
createAuxItems
{ "repo_name": "PriscH/SlackAgent", "path": "client/src/main/java/com/prisch/sbm/stubs/Sbmappservices72PortType.java", "license": "gpl-3.0", "size": 42158 }
[ "java.util.List", "javax.jws.WebMethod", "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.ws.RequestWrapper", "javax.xml.ws.ResponseWrapper" ]
import java.util.List; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper;
import java.util.*; import javax.jws.*; import javax.xml.ws.*;
[ "java.util", "javax.jws", "javax.xml" ]
java.util; javax.jws; javax.xml;
426,007
private static <E> void verifyLinkedHashSetContents( LinkedHashSet<E> set, Collection<E> contents) { assertEquals("LinkedHashSet should have preserved order for iteration", new ArrayList<E>(set), new ArrayList<E>(contents)); verifySetContents(set, contents); }
static <E> void function( LinkedHashSet<E> set, Collection<E> contents) { assertEquals(STR, new ArrayList<E>(set), new ArrayList<E>(contents)); verifySetContents(set, contents); }
/** * Utility method to verify that the given LinkedHashSet is equal to and * hashes identically to a set constructed with the elements in the given * collection. Also verifies that the ordering in the set is the same * as the ordering of the given contents. */
Utility method to verify that the given LinkedHashSet is equal to and hashes identically to a set constructed with the elements in the given collection. Also verifies that the ordering in the set is the same as the ordering of the given contents
verifyLinkedHashSetContents
{ "repo_name": "g0alshhhit/guavaHelper", "path": "guava-tests/test/com/google/common/collect/SetsTest.java", "license": "apache-2.0", "size": 41867 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.LinkedHashSet" ]
import java.util.ArrayList; import java.util.Collection; import java.util.LinkedHashSet;
import java.util.*;
[ "java.util" ]
java.util;
2,541,957
private static float getAutofitTextSize(CharSequence text, TextPaint paint, float targetWidth, int maxLines, float low, float high, float precision, DisplayMetrics displayMetrics) { float mid = (low + high) / 2.0f; int lineCount = 1; StaticLayout layout = null; paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mid, displayMetrics)); if (maxLines != 1) { layout = new StaticLayout(text, paint, (int)targetWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true); lineCount = layout.getLineCount(); } if (SPEW) Log.d(TAG, "low=" + low + " high=" + high + " mid=" + mid + " target=" + targetWidth + " maxLines=" + maxLines + " lineCount=" + lineCount); if (lineCount > maxLines) { // For the case that `text` has more newline characters than `maxLines`. if ((high - low) < precision) { return low; } return getAutofitTextSize(text, paint, targetWidth, maxLines, low, mid, precision, displayMetrics); } else if (lineCount < maxLines) { return getAutofitTextSize(text, paint, targetWidth, maxLines, mid, high, precision, displayMetrics); } else { float maxLineWidth = 0; if (maxLines == 1) { maxLineWidth = paint.measureText(text, 0, text.length()); } else { for (int i = 0; i < lineCount; i++) { if (layout.getLineWidth(i) > maxLineWidth) { maxLineWidth = layout.getLineWidth(i); } } } if ((high - low) < precision) { return low; } else if (maxLineWidth > targetWidth) { return getAutofitTextSize(text, paint, targetWidth, maxLines, low, mid, precision, displayMetrics); } else if (maxLineWidth < targetWidth) { return getAutofitTextSize(text, paint, targetWidth, maxLines, mid, high, precision, displayMetrics); } else { return mid; } } }
static float function(CharSequence text, TextPaint paint, float targetWidth, int maxLines, float low, float high, float precision, DisplayMetrics displayMetrics) { float mid = (low + high) / 2.0f; int lineCount = 1; StaticLayout layout = null; paint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, mid, displayMetrics)); if (maxLines != 1) { layout = new StaticLayout(text, paint, (int)targetWidth, Layout.Alignment.ALIGN_NORMAL, 1.0f, 0.0f, true); lineCount = layout.getLineCount(); } if (SPEW) Log.d(TAG, "low=" + low + STR + high + STR + mid + STR + targetWidth + STR + maxLines + STR + lineCount); if (lineCount > maxLines) { if ((high - low) < precision) { return low; } return getAutofitTextSize(text, paint, targetWidth, maxLines, low, mid, precision, displayMetrics); } else if (lineCount < maxLines) { return getAutofitTextSize(text, paint, targetWidth, maxLines, mid, high, precision, displayMetrics); } else { float maxLineWidth = 0; if (maxLines == 1) { maxLineWidth = paint.measureText(text, 0, text.length()); } else { for (int i = 0; i < lineCount; i++) { if (layout.getLineWidth(i) > maxLineWidth) { maxLineWidth = layout.getLineWidth(i); } } } if ((high - low) < precision) { return low; } else if (maxLineWidth > targetWidth) { return getAutofitTextSize(text, paint, targetWidth, maxLines, low, mid, precision, displayMetrics); } else if (maxLineWidth < targetWidth) { return getAutofitTextSize(text, paint, targetWidth, maxLines, mid, high, precision, displayMetrics); } else { return mid; } } }
/** * Recursive binary search to find the best size for the text. */
Recursive binary search to find the best size for the text
getAutofitTextSize
{ "repo_name": "SamKnows/skandroid-core", "path": "libcore/src/me/grantland/widget/AutofitHelper.java", "license": "gpl-2.0", "size": 17847 }
[ "android.text.Layout", "android.text.StaticLayout", "android.text.TextPaint", "android.util.DisplayMetrics", "android.util.Log", "android.util.TypedValue" ]
import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue;
import android.text.*; import android.util.*;
[ "android.text", "android.util" ]
android.text; android.util;
2,633,561
public static void delegateWheelEvent(MouseWheelEvent e, MouseWheelListener l) { if (e.getID() == MouseEvent.MOUSE_WHEEL) { l.mouseWheelMoved(e); } }
static void function(MouseWheelEvent e, MouseWheelListener l) { if (e.getID() == MouseEvent.MOUSE_WHEEL) { l.mouseWheelMoved(e); } }
/** * Delegate a mouse wheel event by type to the provided listener. * @param e mouse event * @param l listener to delegate to */
Delegate a mouse wheel event by type to the provided listener
delegateWheelEvent
{ "repo_name": "triathematician/blaisemath", "path": "blaise-common/src/main/java/com/googlecode/blaisemath/util/swing/MouseEvents.java", "license": "apache-2.0", "size": 2822 }
[ "java.awt.event.MouseEvent", "java.awt.event.MouseWheelEvent", "java.awt.event.MouseWheelListener" ]
import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,196,342
public List<ResourceReference> getResourceDependencies() { List<ResourceReference> resourceReferences = new ArrayList<ResourceReference>(); JobEntryCopy copy = null; JobEntryInterface entry = null; for ( int i = 0; i < jobcopies.size(); i++ ) { copy = jobcopies.get( i ); // get the job entry copy entry = copy.getEntry(); resourceReferences.addAll( entry.getResourceDependencies( this ) ); } return resourceReferences; }
List<ResourceReference> function() { List<ResourceReference> resourceReferences = new ArrayList<ResourceReference>(); JobEntryCopy copy = null; JobEntryInterface entry = null; for ( int i = 0; i < jobcopies.size(); i++ ) { copy = jobcopies.get( i ); entry = copy.getEntry(); resourceReferences.addAll( entry.getResourceDependencies( this ) ); } return resourceReferences; }
/** * Gets the resource dependencies. * * @return the resource dependencies */
Gets the resource dependencies
getResourceDependencies
{ "repo_name": "lgrill-pentaho/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/job/JobMeta.java", "license": "apache-2.0", "size": 88937 }
[ "java.util.ArrayList", "java.util.List", "org.pentaho.di.job.entry.JobEntryCopy", "org.pentaho.di.job.entry.JobEntryInterface", "org.pentaho.di.resource.ResourceReference" ]
import java.util.ArrayList; import java.util.List; import org.pentaho.di.job.entry.JobEntryCopy; import org.pentaho.di.job.entry.JobEntryInterface; import org.pentaho.di.resource.ResourceReference;
import java.util.*; import org.pentaho.di.job.entry.*; import org.pentaho.di.resource.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
553,217
public String getConstantString( int index, byte tag ) throws ClassFormatException { Constant c; int i; c = getConstant(index, tag); switch (tag) { case Constants.CONSTANT_Class: i = ((ConstantClass) c).getNameIndex(); break; case Constants.CONSTANT_String: i = ((ConstantString) c).getStringIndex(); break; default: throw new RuntimeException("getConstantString called with illegal tag " + tag); } // Finally get the string from the constant pool c = getConstant(i, Constants.CONSTANT_Utf8); return ((ConstantUtf8) c).getBytes(); }
String function( int index, byte tag ) throws ClassFormatException { Constant c; int i; c = getConstant(index, tag); switch (tag) { case Constants.CONSTANT_Class: i = ((ConstantClass) c).getNameIndex(); break; case Constants.CONSTANT_String: i = ((ConstantString) c).getStringIndex(); break; default: throw new RuntimeException(STR + tag); } c = getConstant(i, Constants.CONSTANT_Utf8); return ((ConstantUtf8) c).getBytes(); }
/** * Get string from constant pool and bypass the indirection of * `ConstantClass' and `ConstantString' objects. I.e. these classes have * an index field that points to another entry of the constant pool of * type `ConstantUtf8' which contains the real data. * * @param index Index in constant pool * @param tag Tag of expected constant, either ConstantClass or ConstantString * @return Contents of string reference * @see ConstantClass * @see ConstantString * @throws ClassFormatException */
Get string from constant pool and bypass the indirection of `ConstantClass' and `ConstantString' objects. I.e. these classes have an index field that points to another entry of the constant pool of type `ConstantUtf8' which contains the real data
getConstantString
{ "repo_name": "wenzhucjy/tomcat_source", "path": "tomcat-8.0.9-sourcecode/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java", "license": "apache-2.0", "size": 9715 }
[ "org.apache.tomcat.util.bcel.Constants" ]
import org.apache.tomcat.util.bcel.Constants;
import org.apache.tomcat.util.bcel.*;
[ "org.apache.tomcat" ]
org.apache.tomcat;
408,242
@Override public synchronized void addResponseInterceptor( Interceptor<Response> interceptor) { if (!responseInterceptors.contains(interceptor)) { responseInterceptors.add(interceptor); } hasResponseInterceptors = responseInterceptors.size() > 0; }
synchronized void function( Interceptor<Response> interceptor) { if (!responseInterceptors.contains(interceptor)) { responseInterceptors.add(interceptor); } hasResponseInterceptors = responseInterceptors.size() > 0; }
/** * This method adds interceptor, which allows overriding response object set * by handler. * * @param interceptor */
This method adds interceptor, which allows overriding response object set by handler
addResponseInterceptor
{ "repo_name": "bhatti/PlexServices", "path": "plexsvc-framework/src/main/java/com/plexobject/service/impl/InterceptorLifecycleImpl.java", "license": "mit", "size": 6829 }
[ "com.plexobject.handler.Response", "com.plexobject.service.Interceptor" ]
import com.plexobject.handler.Response; import com.plexobject.service.Interceptor;
import com.plexobject.handler.*; import com.plexobject.service.*;
[ "com.plexobject.handler", "com.plexobject.service" ]
com.plexobject.handler; com.plexobject.service;
1,292,382
this.userCodeClassLoader = Preconditions.checkNotNull(userCodeClassLoader); }
this.userCodeClassLoader = Preconditions.checkNotNull(userCodeClassLoader); }
/** * Set the user code class loader. * Only relevant if this configuration instance was deserialized from binary form. * * <p>This method is not part of the public user-facing API, and cannot be overriden. * * @param userCodeClassLoader user code class loader. */
Set the user code class loader. Only relevant if this configuration instance was deserialized from binary form. This method is not part of the public user-facing API, and cannot be overriden
setUserCodeClassLoader
{ "repo_name": "WangTaoTheTonic/flink", "path": "flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerConfigSnapshot.java", "license": "apache-2.0", "size": 3329 }
[ "org.apache.flink.util.Preconditions" ]
import org.apache.flink.util.Preconditions;
import org.apache.flink.util.*;
[ "org.apache.flink" ]
org.apache.flink;
551,117
public ScheduledEvent getScheduledEvent() { if (scheduledEvent != null && scheduledEvent.eIsProxy()) { InternalEObject oldScheduledEvent = (InternalEObject)scheduledEvent; scheduledEvent = (ScheduledEvent)eResolveProxy(oldScheduledEvent); if (scheduledEvent != oldScheduledEvent) { } } return scheduledEvent; }
ScheduledEvent function() { if (scheduledEvent != null && scheduledEvent.eIsProxy()) { InternalEObject oldScheduledEvent = (InternalEObject)scheduledEvent; scheduledEvent = (ScheduledEvent)eResolveProxy(oldScheduledEvent); if (scheduledEvent != oldScheduledEvent) { } } return scheduledEvent; }
/** * Returns the value of the '<em><b>Scheduled Event</b></em>' reference. * It is bidirectional and its opposite is '{@link CIM15.IEC61970.Informative.InfCommon.ScheduledEvent#getActivityRecord <em>Activity Record</em>}'. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Scheduled Event</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Scheduled Event</em>' reference. * @see #setScheduledEvent(ScheduledEvent) * @see CIM15.IEC61970.Informative.InfCommon.ScheduledEvent#getActivityRecord * @generated */
Returns the value of the 'Scheduled Event' reference. It is bidirectional and its opposite is '<code>CIM15.IEC61970.Informative.InfCommon.ScheduledEvent#getActivityRecord Activity Record</code>'. If the meaning of the 'Scheduled Event' reference isn't clear, there really should be more of a description here...
getScheduledEvent
{ "repo_name": "SES-fortiss/SmartGridCoSimulation", "path": "core/cim15/src/CIM15/IEC61968/Common/ActivityRecord.java", "license": "apache-2.0", "size": 28481 }
[ "org.eclipse.emf.ecore.InternalEObject" ]
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,342,233
@Deprecated public QName getXmlName() { return null; }
QName function() { return null; }
/** * We'll never use a wrapper element in XJC. Always return null. */
We'll never use a wrapper element in XJC. Always return null
getXmlName
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jaxws/drop_included/jaxws_src/src/com/sun/tools/internal/xjc/model/CReferencePropertyInfo.java", "license": "gpl-2.0", "size": 7551 }
[ "javax.xml.namespace.QName" ]
import javax.xml.namespace.QName;
import javax.xml.namespace.*;
[ "javax.xml" ]
javax.xml;
2,180,241
@SuppressWarnings("deprecation") private void _renderDescription( UIXRenderingContext context, UINode node ) throws IOException { if (isInaccessibleMode(context)) return; Object label = node.getAttributeValue(context, DESCRIPTION_ATTR); if (label == null) return; // Do not attempt to render this label if the underlying // platform does not support hidden labels if (!HiddenLabelUtils.supportsHiddenLabels(context)) return; ResponseWriter writer = context.getResponseWriter(); writer.startElement("span", null); renderStyleClassAttribute(context,HIDDEN_LABEL_STYLE_CLASS); writer.writeText(label, null); writer.endElement("span"); }
@SuppressWarnings(STR) void function( UIXRenderingContext context, UINode node ) throws IOException { if (isInaccessibleMode(context)) return; Object label = node.getAttributeValue(context, DESCRIPTION_ATTR); if (label == null) return; if (!HiddenLabelUtils.supportsHiddenLabels(context)) return; ResponseWriter writer = context.getResponseWriter(); writer.startElement("span", null); renderStyleClassAttribute(context,HIDDEN_LABEL_STYLE_CLASS); writer.writeText(label, null); writer.endElement("span"); }
/** * Used for inserting a SPAN tag with p_OraHiddenLabel style class and * the description attribute. * @param context The rendering context * @param node The UINode which is being rendered * @throws IOException */
Used for inserting a SPAN tag with p_OraHiddenLabel style class and the description attribute
_renderDescription
{ "repo_name": "adamrduffy/trinidad-1.0.x", "path": "trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/ui/laf/base/xhtml/StyledTextRenderer.java", "license": "apache-2.0", "size": 8350 }
[ "java.io.IOException", "javax.faces.context.ResponseWriter", "org.apache.myfaces.trinidadinternal.ui.UINode", "org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext" ]
import java.io.IOException; import javax.faces.context.ResponseWriter; import org.apache.myfaces.trinidadinternal.ui.UINode; import org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext;
import java.io.*; import javax.faces.context.*; import org.apache.myfaces.trinidadinternal.ui.*;
[ "java.io", "javax.faces", "org.apache.myfaces" ]
java.io; javax.faces; org.apache.myfaces;
1,503,200
public void setViewSize(Dimension newSize) { Component view = getView(); if (view != null) { Dimension oldSize = view.getSize(); if (!newSize.equals(oldSize)) { // scrollUnderway will be true if this is invoked as the // result of a validate and setViewPosition was previously // invoked. scrollUnderway = false; view.setSize(newSize); isViewSizeSet = true; fireStateChanged(); } } }
void function(Dimension newSize) { Component view = getView(); if (view != null) { Dimension oldSize = view.getSize(); if (!newSize.equals(oldSize)) { scrollUnderway = false; view.setSize(newSize); isViewSizeSet = true; fireStateChanged(); } } }
/** * Sets the size of the view. A state changed event will be fired. * * @param newSize * a <code>Dimension</code> object specifying the new size of the * view */
Sets the size of the view. A state changed event will be fired
setViewSize
{ "repo_name": "javalovercn/j2se_for_android", "path": "src/javax/swing/JViewport.java", "license": "gpl-2.0", "size": 11352 }
[ "java.awt.Component", "java.awt.Dimension" ]
import java.awt.Component; import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,218,609
public static Token makeToken(int kind, String image, int beginLine, int beginColumn, int endLine, int endColumn) { Token ans = new Token(kind, image); ans.beginLine = beginLine; ans.beginColumn = beginColumn; ans.endLine = endLine; ans.endColumn = endColumn; return ans; } public enum Unit { D, M, Y }
static Token function(int kind, String image, int beginLine, int beginColumn, int endLine, int endColumn) { Token ans = new Token(kind, image); ans.beginLine = beginLine; ans.beginColumn = beginColumn; ans.endLine = endLine; ans.endColumn = endColumn; return ans; } public enum Unit { D, M, Y }
/** * Augments the Token constructor with settings for begin/end line/column * @param kind the kind * @param image the image * @param beginLine the beginning line * @param beginColumn the beginning column * @param endLine the ending line * @param endColumn the ending column * @return the new Token */
Augments the Token constructor with settings for begin/end line/column
makeToken
{ "repo_name": "querycert/qcert", "path": "compiler/parsingJava/sqlppParser/src/org/qcert/sqlpp/LexicalFixup.java", "license": "apache-2.0", "size": 6753 }
[ "org.apache.asterix.lang.sqlpp.parser.Token" ]
import org.apache.asterix.lang.sqlpp.parser.Token;
import org.apache.asterix.lang.sqlpp.parser.*;
[ "org.apache.asterix" ]
org.apache.asterix;
2,206,058
public HashMap<Enchantment, Integer> getEnchants() { return enchants; }
HashMap<Enchantment, Integer> function() { return enchants; }
/** * gets this items enchantments * @return - the hashmap of this items enchantments. */
gets this items enchantments
getEnchants
{ "repo_name": "Spoutcraft/Spoutcraft", "path": "src/main/java/org/spoutcraft/api/inventory/ItemStack.java", "license": "lgpl-3.0", "size": 8572 }
[ "java.util.HashMap", "net.minecraft.src.Enchantment" ]
import java.util.HashMap; import net.minecraft.src.Enchantment;
import java.util.*; import net.minecraft.src.*;
[ "java.util", "net.minecraft.src" ]
java.util; net.minecraft.src;
1,032,911
@Generated @Selector("requireGestureRecognizerToFail:") public native void requireGestureRecognizerToFail(UIGestureRecognizer otherGestureRecognizer);
@Selector(STR) native void function(UIGestureRecognizer otherGestureRecognizer);
/** * create a relationship with another gesture recognizer that will prevent this gesture's actions from being called until otherGestureRecognizer transitions to UIGestureRecognizerStateFailed * if otherGestureRecognizer transitions to UIGestureRecognizerStateRecognized or UIGestureRecognizerStateBegan then this recognizer will instead transition to UIGestureRecognizerStateFailed * example usage: a single tap may require a double tap to fail */
create a relationship with another gesture recognizer that will prevent this gesture's actions from being called until otherGestureRecognizer transitions to UIGestureRecognizerStateFailed if otherGestureRecognizer transitions to UIGestureRecognizerStateRecognized or UIGestureRecognizerStateBegan then this recognizer will instead transition to UIGestureRecognizerStateFailed example usage: a single tap may require a double tap to fail
requireGestureRecognizerToFail
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIGestureRecognizer.java", "license": "apache-2.0", "size": 17111 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
1,591,147
protected void removeContextFromChild(BridgeContext ctx, Element e) { if (SVG_NAMESPACE_URI.equals(e.getNamespaceURI())) { if (e.getLocalName().equals(SVG_TSPAN_TAG)) { ((AbstractTextChildBridgeUpdateHandler) ((SVGOMElement) e).getSVGContext()).dispose(); } else if (e.getLocalName().equals(SVG_TEXT_PATH_TAG)) { ((AbstractTextChildBridgeUpdateHandler) ((SVGOMElement) e).getSVGContext()).dispose(); } else if (e.getLocalName().equals(SVG_TREF_TAG)) { ((AbstractTextChildBridgeUpdateHandler) ((SVGOMElement) e).getSVGContext()).dispose(); } } Node child = getFirstChild(e); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { removeContextFromChild(ctx, (Element)child); } child = getNextSibling(child); } }
void function(BridgeContext ctx, Element e) { if (SVG_NAMESPACE_URI.equals(e.getNamespaceURI())) { if (e.getLocalName().equals(SVG_TSPAN_TAG)) { ((AbstractTextChildBridgeUpdateHandler) ((SVGOMElement) e).getSVGContext()).dispose(); } else if (e.getLocalName().equals(SVG_TEXT_PATH_TAG)) { ((AbstractTextChildBridgeUpdateHandler) ((SVGOMElement) e).getSVGContext()).dispose(); } else if (e.getLocalName().equals(SVG_TREF_TAG)) { ((AbstractTextChildBridgeUpdateHandler) ((SVGOMElement) e).getSVGContext()).dispose(); } } Node child = getFirstChild(e); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { removeContextFromChild(ctx, (Element)child); } child = getNextSibling(child); } }
/** * From the <code>SVGContext</code> from the element children of the node. * * @param ctx the <code>BridgeContext</code> for the document * @param e the <code>Element</code> whose subtree's elements will have * threir <code>SVGContext</code>s removed * * @see org.apache.batik.dom.svg.SVGContext * @see org.apache.batik.bridge.BridgeUpdateHandler */
From the <code>SVGContext</code> from the element children of the node
removeContextFromChild
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/bridge/SVGTextElementBridge.java", "license": "apache-2.0", "size": 114566 }
[ "org.apache.batik.dom.svg.SVGOMElement", "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import org.apache.batik.dom.svg.SVGOMElement; import org.w3c.dom.Element; import org.w3c.dom.Node;
import org.apache.batik.dom.svg.*; import org.w3c.dom.*;
[ "org.apache.batik", "org.w3c.dom" ]
org.apache.batik; org.w3c.dom;
2,201,980
public State getState(String propertyName) { // TODO Auto-generated method stub return _state.get(propertyName); }
State function(String propertyName) { return _state.get(propertyName); }
/** * Callback to get the {@link State} for a given property name * * @param propertyName a possibly null, possibly empty property name * @return the {@link State} for the propertyName or null if not found */
Callback to get the <code>State</code> for a given property name
getState
{ "repo_name": "sebmarchand/openhab2-addons", "path": "addons/binding/org.openhab.binding.atlona/src/main/java/org/openhab/binding/atlona/internal/StatefulHandlerCallback.java", "license": "epl-1.0", "size": 4824 }
[ "org.eclipse.smarthome.core.types.State" ]
import org.eclipse.smarthome.core.types.State;
import org.eclipse.smarthome.core.types.*;
[ "org.eclipse.smarthome" ]
org.eclipse.smarthome;
365,321
INDArray ones(int columns);
INDArray ones(int columns);
/** * Creates a row vector with the specified number of columns * * @param columns the columns of the ndarray * @return the created ndarray */
Creates a row vector with the specified number of columns
ones
{ "repo_name": "drlebedev/nd4j", "path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/NDArrayFactory.java", "license": "apache-2.0", "size": 43801 }
[ "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;
2,762,876
private Object handleContains(Object info) throws OperationFailedException { try { OperationContext operationContext = null; Object[] args = (Object[]) info; if (args.length > 1) { operationContext = (OperationContext) ((args[1] instanceof OperationContext) ? args[1] : null); } if (args[0] instanceof Object[]) { return Local_Contains((Object[]) args[0], operationContext); } else { if (Local_Contains(args[0], operationContext)) { return true; } } } catch (Exception e) { if (_clusteredExceptions) { throw new OperationFailedException(e); } } return null; }
Object function(Object info) throws OperationFailedException { try { OperationContext operationContext = null; Object[] args = (Object[]) info; if (args.length > 1) { operationContext = (OperationContext) ((args[1] instanceof OperationContext) ? args[1] : null); } if (args[0] instanceof Object[]) { return Local_Contains((Object[]) args[0], operationContext); } else { if (Local_Contains(args[0], operationContext)) { return true; } } } catch (Exception e) { if (_clusteredExceptions) { throw new OperationFailedException(e); } } return null; }
/** * Hanlde cluster-wide Get(key) requests. * * @param info the object containing parameters for this operation. * @return object to be sent back to the requestor. */
Hanlde cluster-wide Get(key) requests
handleContains
{ "repo_name": "Alachisoft/TayzGrid", "path": "src/tgcache/src/com/alachisoft/tayzgrid/caching/topologies/clustered/PartitionedServerCache.java", "license": "apache-2.0", "size": 225795 }
[ "com.alachisoft.tayzgrid.caching.OperationContext", "com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException" ]
import com.alachisoft.tayzgrid.caching.OperationContext; import com.alachisoft.tayzgrid.runtime.exceptions.OperationFailedException;
import com.alachisoft.tayzgrid.caching.*; import com.alachisoft.tayzgrid.runtime.exceptions.*;
[ "com.alachisoft.tayzgrid" ]
com.alachisoft.tayzgrid;
1,650,948
protected int getIntProperty(String value, String key) throws StandardException { int intVal = -1; try { intVal = Integer.parseInt(value); } catch (NumberFormatException nfe) { throw StandardException.newException(SQLState.LANG_INVALID_NUMBER_FORMAT_FOR_OVERRIDE, value, key); } return intVal; }
int function(String value, String key) throws StandardException { int intVal = -1; try { intVal = Integer.parseInt(value); } catch (NumberFormatException nfe) { throw StandardException.newException(SQLState.LANG_INVALID_NUMBER_FORMAT_FOR_OVERRIDE, value, key); } return intVal; }
/** * Get the int value of a Property * * @param value Property value as a String * @param key Key value of property * * @return The int value of the property * * @exception StandardException Thrown on failure */
Get the int value of a Property
getIntProperty
{ "repo_name": "trejkaz/derby", "path": "java/engine/org/apache/derby/impl/sql/compile/QueryTreeNode.java", "license": "apache-2.0", "size": 52496 }
[ "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.reference.SQLState" ]
import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.reference.*;
[ "org.apache.derby" ]
org.apache.derby;
1,832,437
private void addDescriptionMetadata(Set<String> concepts, Set<String> descriptions) throws Exception { String line = ""; PushBackReader reader = readers.getReader(Rf2Readers.Keys.DESCRIPTION); while ((line = reader.readLine()) != null) { final String fields[] = FieldedStringTokenizer.split(line, "\t"); if (!fields[0].equals("id")) { // If concept id matches, add description metadata if (concepts.contains(fields[4])) { descriptions.add(fields[0]); concepts.add(fields[3]); concepts.add(fields[6]); concepts.add(fields[8]); } } } // Add definition metadata too reader = readers.getReader(Rf2Readers.Keys.DEFINITION); while ((line = reader.readLine()) != null) { final String fields[] = FieldedStringTokenizer.split(line, "\t"); if (!fields[0].equals("id")) { // If concept id matches, add description metadata if (concepts.contains(fields[4])) { descriptions.add(fields[0]); concepts.add(fields[3]); concepts.add(fields[6]); concepts.add(fields[8]); } } } }
void function(Set<String> concepts, Set<String> descriptions) throws Exception { String line = STR\tSTRidSTR\tSTRid")) { if (concepts.contains(fields[4])) { descriptions.add(fields[0]); concepts.add(fields[3]); concepts.add(fields[6]); concepts.add(fields[8]); } } } }
/** * Adds the description metadata. * * @param concepts the concepts * @param descriptions the descriptions * @throws Exception the exception */
Adds the description metadata
addDescriptionMetadata
{ "repo_name": "WestCoastInformatics/UMLS-Terminology-Server", "path": "jpa-services/src/main/java/com/wci/umls/server/jpa/algo/Rf2SnapshotSamplerAlgorithm.java", "license": "apache-2.0", "size": 23054 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,949,876
public List<HealthIncident> getHealthIncidents() { return healthIncidents; }
List<HealthIncident> function() { return healthIncidents; }
/** * Details of recent health incidents associated with the institution. * @return healthIncidents **/
Details of recent health incidents associated with the institution
getHealthIncidents
{ "repo_name": "plaid/plaid-java", "path": "src/main/java/com/plaid/client/model/InstitutionStatus.java", "license": "mit", "size": 10751 }
[ "com.plaid.client.model.HealthIncident", "java.util.List" ]
import com.plaid.client.model.HealthIncident; import java.util.List;
import com.plaid.client.model.*; import java.util.*;
[ "com.plaid.client", "java.util" ]
com.plaid.client; java.util;
1,520,208
public static <T extends Comparable<T>> List<T> skim(Iterable<T> values, int max) { Comparator<T> comparator = ComparableComparator.getInstance(); return skim(values, max, comparator); }
static <T extends Comparable<T>> List<T> function(Iterable<T> values, int max) { Comparator<T> comparator = ComparableComparator.getInstance(); return skim(values, max, comparator); }
/** * Returns the <i>max</i> smallest elements in the given list, according to their natural sort order * * @param values * @param max * @return */
Returns the max smallest elements in the given list, according to their natural sort order
skim
{ "repo_name": "sgmiller/hiveelements", "path": "core/src/main/java/com/beecavegames/util/CollectionUtil.java", "license": "apache-2.0", "size": 6079 }
[ "java.util.Comparator", "java.util.List", "org.apache.commons.collections15.comparators.ComparableComparator" ]
import java.util.Comparator; import java.util.List; import org.apache.commons.collections15.comparators.ComparableComparator;
import java.util.*; import org.apache.commons.collections15.comparators.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
2,288,334
@Generated(hash = 404234) public synchronized void resetTags() { tags = null; }
@Generated(hash = 404234) synchronized void function() { tags = null; }
/** * Resets a to-many relationship, making the next get call to query for a fresh result. */
Resets a to-many relationship, making the next get call to query for a fresh result
resetTags
{ "repo_name": "st1hy/Red-Calorie", "path": "database/src/main/java/com/github/st1hy/countthemcalories/database/IngredientTemplate.java", "license": "mit", "size": 7962 }
[ "org.greenrobot.greendao.annotation.Generated" ]
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.*;
[ "org.greenrobot.greendao" ]
org.greenrobot.greendao;
2,386,861
public void setHosts(@NonNull String... hosts) { setReadHosts(hosts); setWriteHosts(hosts); }
void function(@NonNull String... hosts) { setReadHosts(hosts); setWriteHosts(hosts); }
/** * Set read and write hosts to the same value (convenience method). * * @param hosts New hosts. Must not be empty. */
Set read and write hosts to the same value (convenience method)
setHosts
{ "repo_name": "algolia/algoliasearch-client-android", "path": "algoliasearch/src/main/java/com/algolia/search/saas/AbstractClient.java", "license": "mit", "size": 29600 }
[ "android.support.annotation.NonNull" ]
import android.support.annotation.NonNull;
import android.support.annotation.*;
[ "android.support" ]
android.support;
867,849
private static boolean renderModel (BlockModelRenderer renderer, boolean useAO, IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, IVertexBuilder buffer, boolean checkSides, int overlay) { try { final IModelData modelData = model.getModelData(world, pos, state, EmptyModelData.INSTANCE); return useAO ? renderer.renderModelSmooth(world, model, state, pos, matrix, buffer, checkSides, RANDOM, 0L, overlay, modelData) : renderer.renderModelFlat(world, model, state, pos, matrix, buffer, checkSides, RANDOM, 0L, overlay, modelData); } catch (final Throwable throwable) { final CrashReport crashreport = CrashReport.forThrowable(throwable, "Tesselating block model"); final CrashReportCategory crashreportcategory = crashreport.addCategory("Block model being tesselated"); CrashReportCategory.populateBlockDetails(crashreportcategory, pos, state); crashreportcategory.setDetail("Using AO", useAO); throw new ReportedException(crashreport); } }
static boolean function (BlockModelRenderer renderer, boolean useAO, IBlockDisplayReader world, IBakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, IVertexBuilder buffer, boolean checkSides, int overlay) { try { final IModelData modelData = model.getModelData(world, pos, state, EmptyModelData.INSTANCE); return useAO ? renderer.renderModelSmooth(world, model, state, pos, matrix, buffer, checkSides, RANDOM, 0L, overlay, modelData) : renderer.renderModelFlat(world, model, state, pos, matrix, buffer, checkSides, RANDOM, 0L, overlay, modelData); } catch (final Throwable throwable) { final CrashReport crashreport = CrashReport.forThrowable(throwable, STR); final CrashReportCategory crashreportcategory = crashreport.addCategory(STR); CrashReportCategory.populateBlockDetails(crashreportcategory, pos, state); crashreportcategory.setDetail(STR, useAO); throw new ReportedException(crashreport); } }
/** * This only exists for optifine compatibility mode. */
This only exists for optifine compatibility mode
renderModel
{ "repo_name": "Darkhax-Minecraft/Bookshelf", "path": "src/main/java/net/darkhax/bookshelf/util/RenderUtils.java", "license": "lgpl-2.1", "size": 26872 }
[ "com.mojang.blaze3d.matrix.MatrixStack", "com.mojang.blaze3d.vertex.IVertexBuilder", "net.minecraft.block.BlockState", "net.minecraft.client.renderer.BlockModelRenderer", "net.minecraft.client.renderer.model.IBakedModel", "net.minecraft.crash.CrashReport", "net.minecraft.crash.CrashReportCategory", "n...
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.BlockModelRenderer; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReportCategory; import net.minecraft.crash.ReportedException; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockDisplayReader; import net.minecraftforge.client.model.data.EmptyModelData; import net.minecraftforge.client.model.data.IModelData;
import com.mojang.blaze3d.matrix.*; import com.mojang.blaze3d.vertex.*; import net.minecraft.block.*; import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.model.*; import net.minecraft.crash.*; import net.minecraft.util.math.*; import net.minecraft.world.*; import net.minecraftforge.client.model.data.*;
[ "com.mojang.blaze3d", "net.minecraft.block", "net.minecraft.client", "net.minecraft.crash", "net.minecraft.util", "net.minecraft.world", "net.minecraftforge.client" ]
com.mojang.blaze3d; net.minecraft.block; net.minecraft.client; net.minecraft.crash; net.minecraft.util; net.minecraft.world; net.minecraftforge.client;
1,465,411
protected void fireValueChangedEvent() { ValueChangeEvent.fire(this, getFormValue()); }
void function() { ValueChangeEvent.fire(this, getFormValue()); }
/** * Helper method for firing a 'value changed' event.<p> */
Helper method for firing a 'value changed' event
fireValueChangedEvent
{ "repo_name": "it-tavis/opencms-core", "path": "src-gwt/org/opencms/gwt/client/ui/input/CmsCheckBox.java", "license": "lgpl-2.1", "size": 11155 }
[ "com.google.gwt.event.logical.shared.ValueChangeEvent" ]
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.*;
[ "com.google.gwt" ]
com.google.gwt;
2,170,500
public static void main (String args[]) throws java.lang.Exception { // Check the command-line arguments. if (args.length != 1) { System.err.println("Usage: java DTDGenerator input-file >output-file"); System.exit(1); } // Instantiate and run the application DTDGenerator app = new DTDGenerator(); DocumentInfo doc = app.prepare(args[0]); app.run(doc); app.printDTD(); } public DTDGenerator () { elementList = new BinaryTree(); }
static void function (String args[]) throws java.lang.Exception { if (args.length != 1) { System.err.println(STR); System.exit(1); } DTDGenerator app = new DTDGenerator(); DocumentInfo doc = app.prepare(args[0]); app.run(doc); app.printDTD(); } public DTDGenerator () { elementList = new BinaryTree(); }
/** * Entry point * Usage: java DTDGenerator input-file >output-file */
Entry point Usage: java DTDGenerator input-file >output-file
main
{ "repo_name": "alastrina123/debrief", "path": "contribs/saxon6_5_2/samples/java/DTDGenerator.java", "license": "epl-1.0", "size": 20452 }
[ "com.icl.saxon.om.DocumentInfo", "com.icl.saxon.sort.BinaryTree" ]
import com.icl.saxon.om.DocumentInfo; import com.icl.saxon.sort.BinaryTree;
import com.icl.saxon.om.*; import com.icl.saxon.sort.*;
[ "com.icl.saxon" ]
com.icl.saxon;
848,992
protected Type typeCheckContents(SymbolTable stable) throws TypeCheckError { final int n = elementCount(); for (int i = 0; i < n; i++) { SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i); item.typeCheck(stable); } return Type.Void; }
Type function(SymbolTable stable) throws TypeCheckError { final int n = elementCount(); for (int i = 0; i < n; i++) { SyntaxTreeNode item = (SyntaxTreeNode)_contents.elementAt(i); item.typeCheck(stable); } return Type.Void; }
/** * Call typeCheck() on all child syntax tree nodes. * @param stable The compiler/parser's symbol table */
Call typeCheck() on all child syntax tree nodes
typeCheckContents
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SyntaxTreeNode.java", "license": "mit", "size": 33194 }
[ "com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type", "com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError" ]
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError;
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*;
[ "com.sun.org" ]
com.sun.org;
1,698,206
@Configurable public void setStrictMapping(boolean isStrict) throws ServletException { _isStrictMapping = isStrict; }
void function(boolean isStrict) throws ServletException { _isStrictMapping = isStrict; }
/** * Set true if strict mapping. */
Set true if strict mapping
setStrictMapping
{ "repo_name": "dlitz/resin", "path": "modules/resin/src/com/caucho/server/webapp/WebApp.java", "license": "gpl-2.0", "size": 130864 }
[ "javax.servlet.ServletException" ]
import javax.servlet.ServletException;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
116,762
public static Object invokeMethod(Method method, Object target, Object... args) { try { return method.invoke(target, args); } catch (Exception ex) { handleReflectionException(ex); } throw new IllegalStateException("Should never get here"); }
static Object function(Method method, Object target, Object... args) { try { return method.invoke(target, args); } catch (Exception ex) { handleReflectionException(ex); } throw new IllegalStateException(STR); }
/** * Invoke the specified {@link Method} against the supplied target object with the * supplied arguments. The target object can be <code>null</code> when invoking a * static {@link Method}. * <p>Thrown exceptions are handled via a call to {@link #handleReflectionException}. * @param method the method to invoke * @param target the target object to invoke the method on * @param args the invocation arguments (may be <code>null</code>) * @return the invocation result, if any */
Invoke the specified <code>Method</code> against the supplied target object with the supplied arguments. The target object can be <code>null</code> when invoking a static <code>Method</code>. Thrown exceptions are handled via a call to <code>#handleReflectionException</code>
invokeMethod
{ "repo_name": "TinyGroup/tiny", "path": "framework/org.tinygroup.commons/src/main/java/org/tinygroup/commons/tools/ReflectionUtils.java", "license": "gpl-3.0", "size": 25137 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,376,748
public Duration prefetchTime() { return prefetchTime; }
Duration function() { return prefetchTime; }
/** * The amount of time, relative to STS token expiration, that the cached credentials are considered close to stale * and should be updated. */
The amount of time, relative to STS token expiration, that the cached credentials are considered close to stale and should be updated
prefetchTime
{ "repo_name": "aws/aws-sdk-java-v2", "path": "services/sts/src/main/java/software/amazon/awssdk/services/sts/auth/StsCredentialsProvider.java", "license": "apache-2.0", "size": 7871 }
[ "java.time.Duration" ]
import java.time.Duration;
import java.time.*;
[ "java.time" ]
java.time;
850,211
public boolean pressDPadCenter() { try { return mAutomatorService.pressKey("center"); } catch (RemoteException e) { return false; } }
boolean function() { try { return mAutomatorService.pressKey(STR); } catch (RemoteException e) { return false; } }
/** * Simulates a short press on the CENTER button. * @return true if successful, else return false * @since API Level 16 */
Simulates a short press on the CENTER button
pressDPadCenter
{ "repo_name": "lokeller/multiuiautomator", "path": "src/com/android/uiautomator/core/UiDevice.java", "license": "apache-2.0", "size": 22653 }
[ "android.os.RemoteException" ]
import android.os.RemoteException;
import android.os.*;
[ "android.os" ]
android.os;
853,146
void retrievePacket(Socket socket, long id, DataInputStream is) throws IOException { if (registeredPackets.containsKey(id)) { throw new IOException("Invalid packet id"); } RegisteredPacket rp = registeredPackets.get(id); rp.retrievePacket(rp.create(is, socket)); }
void retrievePacket(Socket socket, long id, DataInputStream is) throws IOException { if (registeredPackets.containsKey(id)) { throw new IOException(STR); } RegisteredPacket rp = registeredPackets.get(id); rp.retrievePacket(rp.create(is, socket)); }
/** * Retrieve a packet with the given id. * * @param id The id of the packet. * @param is The input stream. * @throws IOException When reading the packet does not work. */
Retrieve a packet with the given id
retrievePacket
{ "repo_name": "PenguinMenaceTechnologies/PenguinMenaceEngine", "path": "src/main/java/net/pme/network/Network.java", "license": "gpl-2.0", "size": 4410 }
[ "java.io.DataInputStream", "java.io.IOException", "java.net.Socket" ]
import java.io.DataInputStream; import java.io.IOException; import java.net.Socket;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
53,198
public void applyPatch( PatchDelegate delegate, String oldJarPath, String deltaPath, OutputStream result ) throws IOException;
void function( PatchDelegate delegate, String oldJarPath, String deltaPath, OutputStream result ) throws IOException;
/** * Applies a patch previously created with <code>createPatch</code>. * Pass in a delegate to be notified of the status of the patch. */
Applies a patch previously created with <code>createPatch</code>. Pass in a delegate to be notified of the status of the patch
applyPatch
{ "repo_name": "VEDAGroup/webstart-maven-plugin", "path": "webstart-jnlp-servlet/src/main/java/jnlp/sample/jardiff/Patcher.java", "license": "mit", "size": 2496 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
58,480
public FileUploadRangeFromURLHeaders setDateProperty(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { this.dateProperty = new DateTimeRfc1123(dateProperty); } return this; }
FileUploadRangeFromURLHeaders function(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { this.dateProperty = new DateTimeRfc1123(dateProperty); } return this; }
/** * Set the dateProperty property: A UTC date/time value generated by the * service that indicates the time at which the response was initiated. * * @param dateProperty the dateProperty value to set. * @return the FileUploadRangeFromURLHeaders object itself. */
Set the dateProperty property: A UTC date/time value generated by the service that indicates the time at which the response was initiated
setDateProperty
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/FileUploadRangeFromURLHeaders.java", "license": "mit", "size": 9218 }
[ "com.azure.core.util.DateTimeRfc1123", "java.time.OffsetDateTime" ]
import com.azure.core.util.DateTimeRfc1123; import java.time.OffsetDateTime;
import com.azure.core.util.*; import java.time.*;
[ "com.azure.core", "java.time" ]
com.azure.core; java.time;
2,011,079
public List<Connection> getConnections() { List<Connection> lc = new ArrayList<Connection>(); for (NetworkInterface i : net) { lc.addAll(i.getConnections()); } return lc; }
List<Connection> function() { List<Connection> lc = new ArrayList<Connection>(); for (NetworkInterface i : net) { lc.addAll(i.getConnections()); } return lc; }
/** * Returns a copy of the list of connections this host has with other hosts * @return a copy of the list of connections this host has with other hosts */
Returns a copy of the list of connections this host has with other hosts
getConnections
{ "repo_name": "kuizhiqing/one", "path": "core/DTNHost.java", "license": "gpl-3.0", "size": 13875 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,845,370
@Test public void checkMissingParameter() throws BadRequestException { Map<String, String> parameters = singletonMap("foo", "this is a foo bar"); boolean accept = githubFactoryParametersResolver.accept(parameters); // shouldn't be accepted assertFalse(accept); }
void function() throws BadRequestException { Map<String, String> parameters = singletonMap("foo", STR); boolean accept = githubFactoryParametersResolver.accept(parameters); assertFalse(accept); }
/** * Check missing parameter name can't be accepted by this resolver */
Check missing parameter name can't be accepted by this resolver
checkMissingParameter
{ "repo_name": "bartlomiej-laczkowski/che", "path": "plugins/plugin-github/che-plugin-github-factory-resolver/src/test/java/org/eclipse/che/plugin/github/factory/resolver/GithubFactoryParametersResolverTest.java", "license": "epl-1.0", "size": 9927 }
[ "java.util.Collections", "java.util.Map", "org.eclipse.che.api.core.BadRequestException", "org.testng.Assert" ]
import java.util.Collections; import java.util.Map; import org.eclipse.che.api.core.BadRequestException; import org.testng.Assert;
import java.util.*; import org.eclipse.che.api.core.*; import org.testng.*;
[ "java.util", "org.eclipse.che", "org.testng" ]
java.util; org.eclipse.che; org.testng;
2,190,794
public boolean hasDirectConfigDependencyOn(BuildTask buildTask) { if (buildTask == null || this.equals(buildTask)) { return false; } BuildConfiguration buildConfiguration = buildConfigurationAudited.getBuildConfiguration(); if (buildConfiguration == null || buildConfiguration.getDependencies() == null) { return false; } return buildConfiguration.getDependencies() .contains(buildTask.getBuildConfigurationAudited().getBuildConfiguration()); }
boolean function(BuildTask buildTask) { if (buildTask == null this.equals(buildTask)) { return false; } BuildConfiguration buildConfiguration = buildConfigurationAudited.getBuildConfiguration(); if (buildConfiguration == null buildConfiguration.getDependencies() == null) { return false; } return buildConfiguration.getDependencies() .contains(buildTask.getBuildConfigurationAudited().getBuildConfiguration()); }
/** * Check if this build task has a direct build configuration dependency on the given build task * * @param buildTask The buildTask with the config to check * @return true if this task's build config has a direct dependency on the build config of the given task, otherwise * false */
Check if this build task has a direct build configuration dependency on the given build task
hasDirectConfigDependencyOn
{ "repo_name": "matedo1/pnc", "path": "spi/src/main/java/org/jboss/pnc/spi/coordinator/BuildTask.java", "license": "apache-2.0", "size": 10087 }
[ "org.jboss.pnc.model.BuildConfiguration" ]
import org.jboss.pnc.model.BuildConfiguration;
import org.jboss.pnc.model.*;
[ "org.jboss.pnc" ]
org.jboss.pnc;
483,460
@SuppressWarnings("unchecked") public static <RT> RT eval(String expression, VariableResolver variableResolver) { ParseTree parseTree = createParseTree(expression); return (RT) new ExpressionCalculatorVisitor() .withVariableResolver(variableResolver) .visit(parseTree); }
@SuppressWarnings(STR) static <RT> RT function(String expression, VariableResolver variableResolver) { ParseTree parseTree = createParseTree(expression); return (RT) new ExpressionCalculatorVisitor() .withVariableResolver(variableResolver) .visit(parseTree); }
/** * Evaluates the expression using provided {@link VariableResolver}. * * @param <RT> result type */
Evaluates the expression using provided <code>VariableResolver</code>
eval
{ "repo_name": "virgo47/vexpressed", "path": "src/main/java/com/virgo47/vexpressed/VexpressedUtils.java", "license": "bsd-3-clause", "size": 4912 }
[ "com.virgo47.vexpressed.core.ExpressionCalculatorVisitor", "com.virgo47.vexpressed.core.VariableResolver", "org.antlr.v4.runtime.tree.ParseTree" ]
import com.virgo47.vexpressed.core.ExpressionCalculatorVisitor; import com.virgo47.vexpressed.core.VariableResolver; import org.antlr.v4.runtime.tree.ParseTree;
import com.virgo47.vexpressed.core.*; import org.antlr.v4.runtime.tree.*;
[ "com.virgo47.vexpressed", "org.antlr.v4" ]
com.virgo47.vexpressed; org.antlr.v4;
1,984,307
public int getLine(EObject element);
int function(EObject element);
/** * Returns the line where the given element starts. */
Returns the line where the given element starts
getLine
{ "repo_name": "DarwinSPL/DarwinSPL", "path": "plugins/eu.hyvar.dataValues.resource.hydatavalue/src-gen/eu/hyvar/dataValues/resource/hydatavalue/IHydatavalueLocationMap.java", "license": "apache-2.0", "size": 2404 }
[ "org.eclipse.emf.ecore.EObject" ]
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,901,544
public static CompositeOperatorEstimator.Builder getDefaultEstimator(ClassLoader loader) { return CompositeOperatorEstimator.builder() .withInput(new BasicExternalInputEstimator()) .withOutput(new BasicConstantEstimator(OperatorEstimate.UNKNOWN_SIZE)) .withMarker(new BasicPropagateEstimator()) .load(loader, OperatorEstimatorBinding.class); }
static CompositeOperatorEstimator.Builder function(ClassLoader loader) { return CompositeOperatorEstimator.builder() .withInput(new BasicExternalInputEstimator()) .withOutput(new BasicConstantEstimator(OperatorEstimate.UNKNOWN_SIZE)) .withMarker(new BasicPropagateEstimator()) .load(loader, OperatorEstimatorBinding.class); }
/** * Returns a builder for the preset basic {@link OperatorEstimator}. * @param loader the class loader * @return the created builder */
Returns a builder for the preset basic <code>OperatorEstimator</code>
getDefaultEstimator
{ "repo_name": "ashigeru/asakusafw-compiler", "path": "compiler-project/optimizer/src/main/java/com/asakusafw/lang/compiler/optimizer/basic/BasicOptimizers.java", "license": "apache-2.0", "size": 2563 }
[ "com.asakusafw.lang.compiler.optimizer.OperatorEstimate" ]
import com.asakusafw.lang.compiler.optimizer.OperatorEstimate;
import com.asakusafw.lang.compiler.optimizer.*;
[ "com.asakusafw.lang" ]
com.asakusafw.lang;
2,404,943
FeatureMap getInteriorGroup();
FeatureMap getInteriorGroup();
/** * Returns the value of the '<em><b>Interior Group</b></em>' attribute list. * The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * <!-- begin-model-doc --> * A boundary of a surface consists of a number of rings. The "interior" rings seperate the surface / surface patch from the area enclosed by the rings. * <!-- end-model-doc --> * @return the value of the '<em>Interior Group</em>' attribute list. * @see net.opengis.gml311.Gml311Package#getPolygonPatchType_InteriorGroup() * @model unique="false" dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true" * extendedMetaData="kind='group' name='interior:group' namespace='##targetNamespace'" * @generated */
Returns the value of the 'Interior Group' attribute list. The list contents are of type <code>org.eclipse.emf.ecore.util.FeatureMap.Entry</code>. A boundary of a surface consists of a number of rings. The "interior" rings seperate the surface / surface patch from the area enclosed by the rings.
getInteriorGroup
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wmts/src/net/opengis/gml311/PolygonPatchType.java", "license": "lgpl-2.1", "size": 8082 }
[ "org.eclipse.emf.ecore.util.FeatureMap" ]
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,937,708
public List<String> getServices_wsdls() { ArrayList<String> list = new ArrayList<>(); List<Object> objList = this.resources.getSharedDiskOrDataNodeOrComputeNode(); if (objList != null) { for (Object obj : objList) { if (obj instanceof ServiceType) { list.add(((ServiceType) obj).getWsdl()); } } } return list; }
List<String> function() { ArrayList<String> list = new ArrayList<>(); List<Object> objList = this.resources.getSharedDiskOrDataNodeOrComputeNode(); if (objList != null) { for (Object obj : objList) { if (obj instanceof ServiceType) { list.add(((ServiceType) obj).getWsdl()); } } } return list; }
/** * Returns a List of the WSDLs of the declared Services. * * @return */
Returns a List of the WSDLs of the declared Services
getServices_wsdls
{ "repo_name": "mF2C/COMPSs", "path": "compss/runtime/config/xml/resources/src/main/java/es/bsc/compss/types/resources/ResourcesFile.java", "license": "apache-2.0", "size": 130588 }
[ "es.bsc.compss.types.resources.jaxb.ServiceType", "java.util.ArrayList", "java.util.List" ]
import es.bsc.compss.types.resources.jaxb.ServiceType; import java.util.ArrayList; import java.util.List;
import es.bsc.compss.types.resources.jaxb.*; import java.util.*;
[ "es.bsc.compss", "java.util" ]
es.bsc.compss; java.util;
56,383
public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; if (!StringUtils.hasText(this.defaultServletName)) { if (this.servletContext.getNamedDispatcher(COMMON_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = COMMON_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(GAE_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = GAE_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(RESIN_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = RESIN_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(WEBLOGIC_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = WEBLOGIC_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(WEBSPHERE_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = WEBSPHERE_DEFAULT_SERVLET_NAME; } else { throw new IllegalStateException("Unable to locate the default servlet for serving static content. " + "Please set the 'defaultServletName' property explicitly."); } } }
void function(ServletContext servletContext) { this.servletContext = servletContext; if (!StringUtils.hasText(this.defaultServletName)) { if (this.servletContext.getNamedDispatcher(COMMON_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = COMMON_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(GAE_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = GAE_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(RESIN_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = RESIN_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(WEBLOGIC_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = WEBLOGIC_DEFAULT_SERVLET_NAME; } else if (this.servletContext.getNamedDispatcher(WEBSPHERE_DEFAULT_SERVLET_NAME) != null) { this.defaultServletName = WEBSPHERE_DEFAULT_SERVLET_NAME; } else { throw new IllegalStateException(STR + STR); } } }
/** * If the {@code defaultServletName} property has not been explicitly set, * attempts to locate the default Servlet using the known common * container-specific names. */
If the defaultServletName property has not been explicitly set, attempts to locate the default Servlet using the known common container-specific names
setServletContext
{ "repo_name": "kingtang/spring-learn", "path": "spring-webmvc/src/main/java/org/springframework/web/servlet/resource/DefaultServletHttpRequestHandler.java", "license": "gpl-3.0", "size": 5126 }
[ "javax.servlet.ServletContext", "org.springframework.util.StringUtils" ]
import javax.servlet.ServletContext; import org.springframework.util.StringUtils;
import javax.servlet.*; import org.springframework.util.*;
[ "javax.servlet", "org.springframework.util" ]
javax.servlet; org.springframework.util;
732,366
private static byte[] readClass(final InputStream is, boolean close) throws IOException { if (is == null) { throw new IOException("Class not found"); } try { byte[] b = new byte[is.available()]; int len = 0; while (true) { int n = is.read(b, len, b.length - len); if (n == -1) { if (len < b.length) { byte[] c = new byte[len]; System.arraycopy(b, 0, c, 0, len); b = c; } return b; } len += n; if (len == b.length) { int last = is.read(); if (last < 0) { return b; } byte[] c = new byte[b.length + 1000]; System.arraycopy(b, 0, c, 0, len); c[len++] = (byte) last; b = c; } } } finally { if (close) { is.close(); } } } // ------------------------------------------------------------------------ // Public methods // ------------------------------------------------------------------------ /** * Makes the given visitor visit the Java class of this {@link ClassReader} * . This class is the one specified in the constructor (see * {@link #ClassReader(byte[]) ClassReader}). * * @param classVisitor * the visitor that must visit this class. * @param flags * option flags that can be used to modify the default behavior * of this class. See {@link #SKIP_DEBUG}, {@link #EXPAND_FRAMES}
static byte[] function(final InputStream is, boolean close) throws IOException { if (is == null) { throw new IOException(STR); } try { byte[] b = new byte[is.available()]; int len = 0; while (true) { int n = is.read(b, len, b.length - len); if (n == -1) { if (len < b.length) { byte[] c = new byte[len]; System.arraycopy(b, 0, c, 0, len); b = c; } return b; } len += n; if (len == b.length) { int last = is.read(); if (last < 0) { return b; } byte[] c = new byte[b.length + 1000]; System.arraycopy(b, 0, c, 0, len); c[len++] = (byte) last; b = c; } } } finally { if (close) { is.close(); } } } /** * Makes the given visitor visit the Java class of this {@link ClassReader} * . This class is the one specified in the constructor (see * {@link #ClassReader(byte[]) ClassReader}). * * @param classVisitor * the visitor that must visit this class. * @param flags * option flags that can be used to modify the default behavior * of this class. See {@link #SKIP_DEBUG}, {@link #EXPAND_FRAMES}
/** * Reads the bytecode of a class. * * @param is * an input stream from which to read the class. * @param close * true to close the input stream after reading. * @return the bytecode read from the given input stream. * @throws IOException * if a problem occurs during reading. */
Reads the bytecode of a class
readClass
{ "repo_name": "mrange/fsharpadvent2016", "path": "src/perfhm/src/clojure/asm/ClassReader.java", "license": "apache-2.0", "size": 84921 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
716,353
public void figureRemoved(DrawingEvent e) { if (model.getState() != MeasurementViewer.READY) return; Figure f = e.getFigure(); if (f instanceof ROIFigure) { ROIFigure roi = (ROIFigure) f; if (keyRemove) { if (roi.isReadOnly() || !roi.canDelete()) { view.getDrawing().removeDrawingListener(this); view.getDrawing().add(roi); view.getDrawing().addDrawingListener(this); return; } view.markROIForDelete(roi); keyRemove = false; } view.removeROI(roi); model.setDataChanged(); } }
void function(DrawingEvent e) { if (model.getState() != MeasurementViewer.READY) return; Figure f = e.getFigure(); if (f instanceof ROIFigure) { ROIFigure roi = (ROIFigure) f; if (keyRemove) { if (roi.isReadOnly() !roi.canDelete()) { view.getDrawing().removeDrawingListener(this); view.getDrawing().add(roi); view.getDrawing().addDrawingListener(this); return; } view.markROIForDelete(roi); keyRemove = false; } view.removeROI(roi); model.setDataChanged(); } }
/** * Removes the selected figure from the display. * @see DrawingListener#figureRemoved(DrawingEvent) */
Removes the selected figure from the display
figureRemoved
{ "repo_name": "stelfrich/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/measurement/view/MeasurementViewerControl.java", "license": "gpl-2.0", "size": 25799 }
[ "org.jhotdraw.draw.DrawingEvent", "org.jhotdraw.draw.Figure", "org.openmicroscopy.shoola.util.roi.figures.ROIFigure" ]
import org.jhotdraw.draw.DrawingEvent; import org.jhotdraw.draw.Figure; import org.openmicroscopy.shoola.util.roi.figures.ROIFigure;
import org.jhotdraw.draw.*; import org.openmicroscopy.shoola.util.roi.figures.*;
[ "org.jhotdraw.draw", "org.openmicroscopy.shoola" ]
org.jhotdraw.draw; org.openmicroscopy.shoola;
1,691,250
public static Stores getManifestAppStore() { return manifestStore; }
static Stores function() { return manifestStore; }
/** * Gets the store preference specified in the application manifest for unified services. * * @return Store identifier * * @see com.annahid.libs.artenus.unified.UnifiedServices */
Gets the store preference specified in the application manifest for unified services
getManifestAppStore
{ "repo_name": "hessan/artenus", "path": "src/main/java/com/annahid/libs/artenus/Artenus.java", "license": "gpl-3.0", "size": 9599 }
[ "com.annahid.libs.artenus.unified.Stores" ]
import com.annahid.libs.artenus.unified.Stores;
import com.annahid.libs.artenus.unified.*;
[ "com.annahid.libs" ]
com.annahid.libs;
1,290,454
public static void main(String[] args) throws Exception { final RemoteControlConfiguration configuration; final SeleniumServer seleniumProxy; configuration = RemoteControlLauncher.parseLauncherOptions(args); checkArgsSanity(configuration); System.setProperty("org.openqa.jetty.http.HttpRequest.maxFormContentSize", "0"); // default max // is 200k; // zero is // infinite seleniumProxy = new SeleniumServer(slowResourceProperty(), configuration); seleniumProxy.boot(); // todo: This is still buggy because it should resolve to external port seleniumProxy.LOGGER.info( format("RemoteWebDriver instances should connect to: http://%s:%d/wd/hub", networkUtils.getPrivateLocalAddress(), seleniumProxy.getPort())); } public SeleniumServer() throws Exception { this(slowResourceProperty(), new RemoteControlConfiguration()); } public SeleniumServer(RemoteControlConfiguration configuration) throws Exception { this(slowResourceProperty(), configuration); } public SeleniumServer(boolean slowResources) throws Exception { this(slowResources, new RemoteControlConfiguration()); } public SeleniumServer(boolean slowResources, RemoteControlConfiguration configuration) throws Exception { this.configuration = configuration; debugMode = configuration.isDebugMode(); jettyThreads = configuration.getJettyThreads(); LOGGER = configureLogging(configuration.getLoggingOptions(), debugMode); logStartupInfo(); sanitizeProxyConfiguration(); createJettyServer(slowResources); configuration.setSeleniumServer(this); }
static void function(String[] args) throws Exception { final RemoteControlConfiguration configuration; final SeleniumServer seleniumProxy; configuration = RemoteControlLauncher.parseLauncherOptions(args); checkArgsSanity(configuration); System.setProperty(STR, "0"); seleniumProxy = new SeleniumServer(slowResourceProperty(), configuration); seleniumProxy.boot(); seleniumProxy.LOGGER.info( format("RemoteWebDriver instances should connect to: http: networkUtils.getPrivateLocalAddress(), seleniumProxy.getPort())); } public SeleniumServer() throws Exception { this(slowResourceProperty(), new RemoteControlConfiguration()); } public SeleniumServer(RemoteControlConfiguration configuration) throws Exception { this(slowResourceProperty(), configuration); } public SeleniumServer(boolean slowResources) throws Exception { this(slowResources, new RemoteControlConfiguration()); } public SeleniumServer(boolean slowResources, RemoteControlConfiguration configuration) throws Exception { this.configuration = configuration; debugMode = configuration.isDebugMode(); jettyThreads = configuration.getJettyThreads(); LOGGER = configureLogging(configuration.getLoggingOptions(), debugMode); logStartupInfo(); sanitizeProxyConfiguration(); createJettyServer(slowResources); configuration.setSeleniumServer(this); }
/** * Starts up the server on the specified port (or default if no port was specified) and then * starts interactive mode if specified. * * @param args - either "-port" followed by a number, or "-interactive" * @throws Exception - you know, just in case. */
Starts up the server on the specified port (or default if no port was specified) and then starts interactive mode if specified
main
{ "repo_name": "Appdynamics/selenium", "path": "java/server/src/org/openqa/selenium/server/SeleniumServer.java", "license": "apache-2.0", "size": 32399 }
[ "java.lang.String", "org.openqa.selenium.server.cli.RemoteControlLauncher" ]
import java.lang.String; import org.openqa.selenium.server.cli.RemoteControlLauncher;
import java.lang.*; import org.openqa.selenium.server.cli.*;
[ "java.lang", "org.openqa.selenium" ]
java.lang; org.openqa.selenium;
645,075
public java.util.List<fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI> getSubterm_terms_VariableHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.terms.impl.VariableImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI( (fr.lip6.move.pnml.hlpn.terms.Variable)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.terms.impl.VariableImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.terms.hlapi.VariableHLAPI( (fr.lip6.move.pnml.hlpn.terms.Variable)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of VariableHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of VariableHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_terms_VariableHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/LessThanOrEqualHLAPI.java", "license": "epl-1.0", "size": 108661 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
2,815,429
public static CleanCachesOption cleanCaches(boolean value) { return new CleanCachesOption(value); }
static CleanCachesOption function(boolean value) { return new CleanCachesOption(value); }
/** * Creates a {@link CleanCachesOption}. * * @param value * should caches be cleaned? * @return clean caches option */
Creates a <code>CleanCachesOption</code>
cleanCaches
{ "repo_name": "ops4j/org.ops4j.pax.exam2", "path": "core/pax-exam/src/main/java/org/ops4j/pax/exam/CoreOptions.java", "license": "apache-2.0", "size": 30795 }
[ "org.ops4j.pax.exam.options.extra.CleanCachesOption" ]
import org.ops4j.pax.exam.options.extra.CleanCachesOption;
import org.ops4j.pax.exam.options.extra.*;
[ "org.ops4j.pax" ]
org.ops4j.pax;
158,205
Optional<BibEntryType> type = entryTypesManager.enrich(entry.getType(), this.mode); if (type.isPresent()) { return entry.allFieldsPresent(type.get().getRequiredFields(), database.orElse(null)); } else { return true; } }
Optional<BibEntryType> type = entryTypesManager.enrich(entry.getType(), this.mode); if (type.isPresent()) { return entry.allFieldsPresent(type.get().getRequiredFields(), database.orElse(null)); } else { return true; } }
/** * Returns true if this entry contains the fields it needs to be * complete. * @param entryTypesManager */
Returns true if this entry contains the fields it needs to be complete
hasAllRequiredFields
{ "repo_name": "zellerdev/jabref", "path": "src/main/java/org/jabref/logic/TypedBibEntry.java", "license": "mit", "size": 1832 }
[ "java.util.Optional", "org.jabref.model.entry.BibEntryType" ]
import java.util.Optional; import org.jabref.model.entry.BibEntryType;
import java.util.*; import org.jabref.model.entry.*;
[ "java.util", "org.jabref.model" ]
java.util; org.jabref.model;
1,733,781