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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public CustomPortletModeType<T> description(String ... values) { if (values != null) { for(String name: values) { childNode.createChild("description").text(name); } } return this; }
CustomPortletModeType<T> function(String ... values) { if (values != null) { for(String name: values) { childNode.createChild(STR).text(name); } } return this; }
/** * Creates for all String objects representing <code>description</code> elements, * a new <code>description</code> element * @param values list of <code>description</code> objects * @return the current instance of <code>CustomPortletModeType<T></code> */
Creates for all String objects representing <code>description</code> elements, a new <code>description</code> element
description
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/portletapp20/CustomPortletModeTypeImpl.java", "license": "epl-1.0", "size": 7650 }
[ "org.jboss.shrinkwrap.descriptor.api.portletapp20.CustomPortletModeType" ]
import org.jboss.shrinkwrap.descriptor.api.portletapp20.CustomPortletModeType;
import org.jboss.shrinkwrap.descriptor.api.portletapp20.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
1,259,383
public Vector4f negate(Vector4f dest) { if (dest == null) dest = new Vector4f(); dest.x = -x; dest.y = -y; dest.z = -z; dest.w = -w; return dest; }
Vector4f function(Vector4f dest) { if (dest == null) dest = new Vector4f(); dest.x = -x; dest.y = -y; dest.z = -z; dest.w = -w; return dest; }
/** * Negate a vector and place the result in a destination vector. * @param dest The destination vector or null if a new vector is to be created * @return the negated vector */
Negate a vector and place the result in a destination vector
negate
{ "repo_name": "andrewmcvearry/mille-bean", "path": "lwjgl/src/java/org/lwjgl/util/vector/Vector4f.java", "license": "mit", "size": 8277 }
[ "org.lwjgl.util.vector.Vector4f" ]
import org.lwjgl.util.vector.Vector4f;
import org.lwjgl.util.vector.*;
[ "org.lwjgl.util" ]
org.lwjgl.util;
1,032,098
public void updateEntityWithOptionalForce(Entity entityIn, boolean forceUpdate) { if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal || entityIn instanceof EntityWaterMob)) { entityIn.setDead(); } if (!this.canSpawnNPCs() && entityIn instanceof INpc) { entityIn.setDead(); } super.updateEntityWithOptionalForce(entityIn, forceUpdate); }
void function(Entity entityIn, boolean forceUpdate) { if (!this.canSpawnAnimals() && (entityIn instanceof EntityAnimal entityIn instanceof EntityWaterMob)) { entityIn.setDead(); } if (!this.canSpawnNPCs() && entityIn instanceof INpc) { entityIn.setDead(); } super.updateEntityWithOptionalForce(entityIn, forceUpdate); }
/** * Updates the entity in the world if the chunk the entity is in is currently loaded or its forced to update. */
Updates the entity in the world if the chunk the entity is in is currently loaded or its forced to update
updateEntityWithOptionalForce
{ "repo_name": "danielyc/test-1.9.4", "path": "build/tmp/recompileMc/sources/net/minecraft/world/WorldServer.java", "license": "gpl-3.0", "size": 54443 }
[ "net.minecraft.entity.Entity", "net.minecraft.entity.INpc", "net.minecraft.entity.passive.EntityAnimal", "net.minecraft.entity.passive.EntityWaterMob" ]
import net.minecraft.entity.Entity; import net.minecraft.entity.INpc; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityWaterMob;
import net.minecraft.entity.*; import net.minecraft.entity.passive.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
2,563,667
protected boolean isNetworkConnected() { ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager == null) { return false; } NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); return ((networkInfo != null) && networkInfo.isConnected()); }
boolean function() { ConnectivityManager connectivityManager = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivityManager == null) { return false; } NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); return ((networkInfo != null) && networkInfo.isConnected()); }
/** * Is network connected? * @return true if connected, false otherwise */
Is network connected
isNetworkConnected
{ "repo_name": "FonsecaUniba/progettoMMQS", "path": "src/main/java/zame/promo/PromoView.java", "license": "mit", "size": 16457 }
[ "android.content.Context", "android.net.ConnectivityManager", "android.net.NetworkInfo" ]
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo;
import android.content.*; import android.net.*;
[ "android.content", "android.net" ]
android.content; android.net;
2,652,642
@Override public List getSections(MaintenanceDocument document, Maintainable oldMaintainable) { List<Section> sections = super.getSections(document, oldMaintainable); // if the document isn't new then we need to make the document type name field read-only if (!document.isNew()) { sectionLoop: for (Section section : sections) { for (Row row : section.getRows()) { for (Field field : row.getFields()) { if (KEWPropertyConstants.NAME.equals(field.getPropertyName())) { field.setReadOnly(true); break sectionLoop; } } } } } return sections; }
List function(MaintenanceDocument document, Maintainable oldMaintainable) { List<Section> sections = super.getSections(document, oldMaintainable); if (!document.isNew()) { sectionLoop: for (Section section : sections) { for (Row row : section.getRows()) { for (Field field : row.getFields()) { if (KEWPropertyConstants.NAME.equals(field.getPropertyName())) { field.setReadOnly(true); break sectionLoop; } } } } } return sections; }
/** * Override the getSections method on this maintainable so that the document type name field * can be set to read-only for */
Override the getSections method on this maintainable so that the document type name field can be set to read-only for
getSections
{ "repo_name": "sbower/kuali-rice-1", "path": "impl/src/main/java/org/kuali/rice/kew/document/DocumentTypeMaintainable.java", "license": "apache-2.0", "size": 7866 }
[ "java.util.List", "org.kuali.rice.kew.util.KEWPropertyConstants", "org.kuali.rice.kns.document.MaintenanceDocument", "org.kuali.rice.kns.maintenance.Maintainable", "org.kuali.rice.kns.web.ui.Field", "org.kuali.rice.kns.web.ui.Row", "org.kuali.rice.kns.web.ui.Section" ]
import java.util.List; import org.kuali.rice.kew.util.KEWPropertyConstants; import org.kuali.rice.kns.document.MaintenanceDocument; import org.kuali.rice.kns.maintenance.Maintainable; import org.kuali.rice.kns.web.ui.Field; import org.kuali.rice.kns.web.ui.Row; import org.kuali.rice.kns.web.ui.Section;
import java.util.*; import org.kuali.rice.kew.util.*; import org.kuali.rice.kns.document.*; import org.kuali.rice.kns.maintenance.*; import org.kuali.rice.kns.web.ui.*;
[ "java.util", "org.kuali.rice" ]
java.util; org.kuali.rice;
862,535
public EAttribute getCurve_XMultiplier() { return (EAttribute)getCurve().getEStructuralFeatures().get(6); }
EAttribute function() { return (EAttribute)getCurve().getEStructuralFeatures().get(6); }
/** * Returns the meta object for the attribute '{@link CIM15.IEC61970.Core.Curve#getXMultiplier <em>XMultiplier</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>XMultiplier</em>'. * @see CIM15.IEC61970.Core.Curve#getXMultiplier() * @see #getCurve() * @generated */
Returns the meta object for the attribute '<code>CIM15.IEC61970.Core.Curve#getXMultiplier XMultiplier</code>'.
getCurve_XMultiplier
{ "repo_name": "SES-fortiss/SmartGridCoSimulation", "path": "core/cim15/src/CIM15/IEC61970/Core/CorePackage.java", "license": "apache-2.0", "size": 304427 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
507,366
public MoveRequest createMoveRequest(Collection<EntityReference> sources, EntityReference destination) { return createMoveRequest(RefactoringJobs.MOVE, sources, destination); }
MoveRequest function(Collection<EntityReference> sources, EntityReference destination) { return createMoveRequest(RefactoringJobs.MOVE, sources, destination); }
/** * Creates a request to move the specified source entities to the specified destination entity (which becomes their * new parent). * * @param sources specifies the entities to be moved * @param destination specifies the place where to move the entities (their new parent entity) * @return the move request */
Creates a request to move the specified source entities to the specified destination entity (which becomes their new parent)
createMoveRequest
{ "repo_name": "pbondoer/xwiki-platform", "path": "xwiki-platform-core/xwiki-platform-refactoring/xwiki-platform-refactoring-api/src/main/java/org/xwiki/refactoring/script/RefactoringScriptService.java", "license": "lgpl-2.1", "size": 25389 }
[ "java.util.Collection", "org.xwiki.model.reference.EntityReference", "org.xwiki.refactoring.job.MoveRequest", "org.xwiki.refactoring.job.RefactoringJobs" ]
import java.util.Collection; import org.xwiki.model.reference.EntityReference; import org.xwiki.refactoring.job.MoveRequest; import org.xwiki.refactoring.job.RefactoringJobs;
import java.util.*; import org.xwiki.model.reference.*; import org.xwiki.refactoring.job.*;
[ "java.util", "org.xwiki.model", "org.xwiki.refactoring" ]
java.util; org.xwiki.model; org.xwiki.refactoring;
2,593,941
public static RxDocumentServiceRequest create(OperationType operation, ResourceType resourceType, String relativePath, Map<String, String> headers) { return new RxDocumentServiceRequest(operation, resourceType, relativePath, headers); }
static RxDocumentServiceRequest function(OperationType operation, ResourceType resourceType, String relativePath, Map<String, String> headers) { return new RxDocumentServiceRequest(operation, resourceType, relativePath, headers); }
/** * Creates a DocumentServiceRequest without body. * * @param operation the operation type. * @param resourceType the resource type. * @param relativePath the relative URI path. * @param headers the request headers. * @return the created document service request. */
Creates a DocumentServiceRequest without body
create
{ "repo_name": "moderakh/azure-documentdb-rxjava", "path": "azure-documentdb-rx/src/main/java/com/microsoft/azure/documentdb/rx/internal/RxDocumentServiceRequest.java", "license": "mit", "size": 10903 }
[ "com.microsoft.azure.documentdb.internal.OperationType", "com.microsoft.azure.documentdb.internal.ResourceType", "java.util.Map" ]
import com.microsoft.azure.documentdb.internal.OperationType; import com.microsoft.azure.documentdb.internal.ResourceType; import java.util.Map;
import com.microsoft.azure.documentdb.internal.*; import java.util.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
1,970,406
public void addAttribute(QName name, String value) throws JspParseException { if (SELECT.equals(name)) _select = value; else if (VAR.equals(name)) _var = value; else if (SCOPE.equals(name)) _scope = value; else throw error(L.l("'{0}' is an unknown attribute for <{1}>.", name.getName(), getTagName())); }
void function(QName name, String value) throws JspParseException { if (SELECT.equals(name)) _select = value; else if (VAR.equals(name)) _var = value; else if (SCOPE.equals(name)) _scope = value; else throw error(L.l(STR, name.getName(), getTagName())); }
/** * Adds an attribute. */
Adds an attribute
addAttribute
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/jsp/java/JstlXmlIf.java", "license": "gpl-2.0", "size": 3935 }
[ "com.caucho.jsp.JspParseException", "com.caucho.xml.QName" ]
import com.caucho.jsp.JspParseException; import com.caucho.xml.QName;
import com.caucho.jsp.*; import com.caucho.xml.*;
[ "com.caucho.jsp", "com.caucho.xml" ]
com.caucho.jsp; com.caucho.xml;
2,060,885
final int expectedCount = 3; Tracker tracker = new Tracker(new StubInput(new Task[]{ new Task("task1", "some desc"), new Task("task2", "some desc"), new Task("task3", "some desc") })); assertThat(expectedCount, is(tracker.getTaskManager().getAllTasks().length)); }
final int expectedCount = 3; Tracker tracker = new Tracker(new StubInput(new Task[]{ new Task("task1", STR), new Task("task2", STR), new Task("task3", STR) })); assertThat(expectedCount, is(tracker.getTaskManager().getAllTasks().length)); }
/** * Add task and equal result with expected. * */
Add task and equal result with expected
ifAddTaskCountOfTasksIncrease
{ "repo_name": "kuznetsovsergeyymailcom/homework", "path": "chapter_002/tracker/src/test/java/ru/skuznetsov/TrackerTest.java", "license": "apache-2.0", "size": 10439 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "ru.skuznetsov.input.StubInput" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import ru.skuznetsov.input.StubInput;
import org.hamcrest.*; import ru.skuznetsov.input.*;
[ "org.hamcrest", "ru.skuznetsov.input" ]
org.hamcrest; ru.skuznetsov.input;
1,309,437
Duration duration = new Duration(0); assertEquals("0 seconds", WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(999); assertEquals("0 seconds", WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(1000); assertEquals("1 second", WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(1010); assertEquals("1 second", WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(1999); assertEquals("1 second", WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(2034); assertEquals("2 seconds", WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(11111111L); assertEquals("3 hours, 5 minutes and 11 seconds", WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(848654688715648L); assertEquals("6 days, 5 hours, 31 minutes and 55 seconds", WatchDogUtils.makeDurationHumanReadable(duration)); }
Duration duration = new Duration(0); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(999); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(1000); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(1010); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(1999); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(2034); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(11111111L); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); duration = new Duration(848654688715648L); assertEquals(STR, WatchDogUtils.makeDurationHumanReadable(duration)); }
/** * Tests the human readable durations. */
Tests the human readable durations
testConvertJodaDurationToReadableString
{ "repo_name": "gabrielsimas/watchdog", "path": "WatchDogEclipsePlugin/WatchDogUnitTests/src/nl/tudelft/watchdog/util/WatchDogUtilsTest.java", "license": "mit", "size": 4868 }
[ "nl.tudelft.watchdog.eclipse.util.WatchDogUtils", "org.joda.time.Duration", "org.junit.Assert" ]
import nl.tudelft.watchdog.eclipse.util.WatchDogUtils; import org.joda.time.Duration; import org.junit.Assert;
import nl.tudelft.watchdog.eclipse.util.*; import org.joda.time.*; import org.junit.*;
[ "nl.tudelft.watchdog", "org.joda.time", "org.junit" ]
nl.tudelft.watchdog; org.joda.time; org.junit;
64,462
private Collection<QueryTree<String>> getUncoveredTrees(QueryTree<String> tree, List<QueryTree<String>> allTrees){ Collection<QueryTree<String>> uncoveredTrees = new ArrayList<QueryTree<String>>(); for (QueryTree<String> queryTree : allTrees) { boolean subsumed = queryTree.isSubsumedBy(tree); if(!subsumed){ uncoveredTrees.add(queryTree); } } return uncoveredTrees; }
Collection<QueryTree<String>> function(QueryTree<String> tree, List<QueryTree<String>> allTrees){ Collection<QueryTree<String>> uncoveredTrees = new ArrayList<QueryTree<String>>(); for (QueryTree<String> queryTree : allTrees) { boolean subsumed = queryTree.isSubsumedBy(tree); if(!subsumed){ uncoveredTrees.add(queryTree); } } return uncoveredTrees; }
/** * Return all trees from the given list {@code allTrees} which are not already subsumed by {@code tree}. * @param tree * @param allTrees * @return */
Return all trees from the given list allTrees which are not already subsumed by tree
getUncoveredTrees
{ "repo_name": "daftano/dl-learner", "path": "components-core/src/main/java/org/dllearner/algorithms/qtl/QTL2.java", "license": "gpl-3.0", "size": 13771 }
[ "java.util.ArrayList", "java.util.Collection", "java.util.List", "org.dllearner.algorithms.qtl.datastructures.QueryTree" ]
import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.dllearner.algorithms.qtl.datastructures.QueryTree;
import java.util.*; import org.dllearner.algorithms.qtl.datastructures.*;
[ "java.util", "org.dllearner.algorithms" ]
java.util; org.dllearner.algorithms;
2,115,122
public void contextInitialized(ServletContextEvent event) { this.context = event.getServletContext(); log("contextInitialized()"); }
void function(ServletContextEvent event) { this.context = event.getServletContext(); log(STR); }
/** * Record the fact that this web application has been initialized. * * @param event The servlet context event */
Record the fact that this web application has been initialized
contextInitialized
{ "repo_name": "IntecsSPA/buddata-ebxml-registry", "path": "Installer/distribution/bundled-tomcat/apache-tomcat-5.5.28/webapps/servlets-examples/WEB-INF/classes/listeners/SessionListener.java", "license": "gpl-3.0", "size": 5039 }
[ "javax.servlet.ServletContextEvent" ]
import javax.servlet.ServletContextEvent;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,320,352
@Override public void configure(JobConf job) { //add by wzt 2013-0315 numBytesToWrite = job.getLong("test.randomwrite.bytes_per_map", 1*1024*1024*1024); minKeySize = job.getInt("test.randomwrite.min_key", 10); keySizeRange = job.getInt("test.randomwrite.max_key", 1000) - minKeySize; minValueSize = job.getInt("test.randomwrite.min_value", 0); valueSizeRange = job.getInt("test.randomwrite.max_value", 20000) - minValueSize; } }
void function(JobConf job) { numBytesToWrite = job.getLong(STR, 1*1024*1024*1024); minKeySize = job.getInt(STR, 10); keySizeRange = job.getInt(STR, 1000) - minKeySize; minValueSize = job.getInt(STR, 0); valueSizeRange = job.getInt(STR, 20000) - minValueSize; } }
/** * Save the values out of the configuaration that we need to write * the data. */
Save the values out of the configuaration that we need to write the data
configure
{ "repo_name": "submergerock/avatar-hadoop", "path": "build/hadoop-0.20.1-dev/src/examples/org/apache/hadoop/examples/RandomWriter.java", "license": "apache-2.0", "size": 10444 }
[ "org.apache.hadoop.mapred.JobConf" ]
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,269,071
public interface OnItemClickListener { void onItemClick(View itemView, int position); }
interface OnItemClickListener { void function(View itemView, int position); }
/** * handles item click event * @param itemView clicked item * @param position adapter position of clicked item */
handles item click event
onItemClick
{ "repo_name": "despectra/github-repoview", "path": "githubrepoview/src/main/java/com/despectra/githubrepoview/ClickableViewHolder.java", "license": "mit", "size": 1280 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
806,925
@Override public Map<String, String> prepareParametersMap(TWorkItemLinkBean workItemLinkBean) { Map<String, String> parametersMap = new HashMap<String, String>(); Integer duration = workItemLinkBean.getIntegerValue1(); if (duration!=null) { parametersMap.put(DURATION, String.valueOf(duration)); } return parametersMap; }
Map<String, String> function(TWorkItemLinkBean workItemLinkBean) { Map<String, String> parametersMap = new HashMap<String, String>(); Integer duration = workItemLinkBean.getIntegerValue1(); if (duration!=null) { parametersMap.put(DURATION, String.valueOf(duration)); } return parametersMap; }
/** * Prepare the parameters map * Used in webservice * @param workItemLinkBean * @return */
Prepare the parameters map Used in webservice
prepareParametersMap
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/linkType/MeetingTopicLinkType.java", "license": "gpl-3.0", "size": 6986 }
[ "com.aurel.track.beans.TWorkItemLinkBean", "java.util.HashMap", "java.util.Map" ]
import com.aurel.track.beans.TWorkItemLinkBean; import java.util.HashMap; import java.util.Map;
import com.aurel.track.beans.*; import java.util.*;
[ "com.aurel.track", "java.util" ]
com.aurel.track; java.util;
935,606
private void setTokenExpired() { Log.d(TAG, "Setting item to expire..."); Calendar calendar = new GregorianCalendar(); calendar.add(Calendar.MINUTE, -30); Date date = calendar.getTime(); ITokenCacheStore cache = mContext.getCache(); String key = CacheKey.createCacheKey(mAuthority.getText().toString(), mResource.getText() .toString(), mClientId.getText().toString(), false, mUserid.getText().toString()); TokenCacheItem item = cache.getItem(key); setTime(cache, date, key, item); key = CacheKey.createCacheKey(mAuthority.getText().toString(), mResource.getText() .toString(), mClientId.getText().toString(), true, mUserid.getText().toString()); item = cache.getItem(key); setTime(cache, date, key, item); }
void function() { Log.d(TAG, STR); Calendar calendar = new GregorianCalendar(); calendar.add(Calendar.MINUTE, -30); Date date = calendar.getTime(); ITokenCacheStore cache = mContext.getCache(); String key = CacheKey.createCacheKey(mAuthority.getText().toString(), mResource.getText() .toString(), mClientId.getText().toString(), false, mUserid.getText().toString()); TokenCacheItem item = cache.getItem(key); setTime(cache, date, key, item); key = CacheKey.createCacheKey(mAuthority.getText().toString(), mResource.getText() .toString(), mClientId.getText().toString(), true, mUserid.getText().toString()); item = cache.getItem(key); setTime(cache, date, key, item); }
/** * set all expired */
set all expired
setTokenExpired
{ "repo_name": "w9jds/azure-activedirectory-library-for-android", "path": "tests/testapp/src/com/microsoft/aad/adal/testapp/MainActivity.java", "license": "apache-2.0", "size": 21780 }
[ "android.util.Log", "com.microsoft.aad.adal.CacheKey", "com.microsoft.aad.adal.ITokenCacheStore", "com.microsoft.aad.adal.TokenCacheItem", "java.util.Calendar", "java.util.Date", "java.util.GregorianCalendar" ]
import android.util.Log; import com.microsoft.aad.adal.CacheKey; import com.microsoft.aad.adal.ITokenCacheStore; import com.microsoft.aad.adal.TokenCacheItem; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar;
import android.util.*; import com.microsoft.aad.adal.*; import java.util.*;
[ "android.util", "com.microsoft.aad", "java.util" ]
android.util; com.microsoft.aad; java.util;
280,354
default void checkCanCreateViewWithSelectFromView(ConnectorTransactionHandle transactionHandle, Identity identity, SchemaTableName viewName) { denyCreateViewWithSelect(viewName.toString()); }
default void checkCanCreateViewWithSelectFromView(ConnectorTransactionHandle transactionHandle, Identity identity, SchemaTableName viewName) { denyCreateViewWithSelect(viewName.toString()); }
/** * Check if identity is allowed to create a view that selects from the specified view in this catalog. * * @throws com.facebook.presto.spi.security.AccessDeniedException if not allowed */
Check if identity is allowed to create a view that selects from the specified view in this catalog
checkCanCreateViewWithSelectFromView
{ "repo_name": "sumitkgec/presto", "path": "presto-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorAccessControl.java", "license": "apache-2.0", "size": 12031 }
[ "com.facebook.presto.spi.SchemaTableName", "com.facebook.presto.spi.security.AccessDeniedException", "com.facebook.presto.spi.security.Identity" ]
import com.facebook.presto.spi.SchemaTableName; import com.facebook.presto.spi.security.AccessDeniedException; import com.facebook.presto.spi.security.Identity;
import com.facebook.presto.spi.*; import com.facebook.presto.spi.security.*;
[ "com.facebook.presto" ]
com.facebook.presto;
974,911
public void fetch(String outputName, FloatBuffer dst) { getTensor(outputName).writeTo(dst); }
void function(String outputName, FloatBuffer dst) { getTensor(outputName).writeTo(dst); }
/** * Read from a Tensor named {@link outputName} and copy the contents into the <b>direct</b> and * <b>native ordered</b> java.nio buffer {@link dst}. {@link dst} must have capacity greater than * or equal to that of the source Tensor. This operation will not affect dst's content past the * source Tensor's size. */
Read from a Tensor named <code>outputName</code> and copy the contents into the direct and native ordered java.nio buffer <code>dst</code>. <code>dst</code> must have capacity greater than or equal to that of the source Tensor. This operation will not affect dst's content past the source Tensor's size
fetch
{ "repo_name": "tornadozou/tensorflow", "path": "tensorflow/contrib/android/java/org/tensorflow/contrib/android/TensorFlowInferenceInterface.java", "license": "apache-2.0", "size": 22858 }
[ "java.nio.FloatBuffer" ]
import java.nio.FloatBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
2,350,932
@Test public void hashRebuildTest() throws IOException { final int factor = 11; final File file = TestResourcesUtils.getTestResourceFile("RandomText/RandomText1/B.txt"); UniformFuzzyHash hash = new UniformFuzzyHash(file, factor); String hashString = hash.toString(); UniformFuzzyHash rebuiltHash = UniformFuzzyHash.rebuildFromString(hashString); String rebuiltHashString = rebuiltHash.toString(); Assert.assertTrue(hash.equals(rebuiltHash)); Assert.assertTrue(hashString.equals(rebuiltHashString)); }
void function() throws IOException { final int factor = 11; final File file = TestResourcesUtils.getTestResourceFile(STR); UniformFuzzyHash hash = new UniformFuzzyHash(file, factor); String hashString = hash.toString(); UniformFuzzyHash rebuiltHash = UniformFuzzyHash.rebuildFromString(hashString); String rebuiltHashString = rebuiltHash.toString(); Assert.assertTrue(hash.equals(rebuiltHash)); Assert.assertTrue(hashString.equals(rebuiltHashString)); }
/** * Hash rebuild test. * Tests the hash rebuild from a string representation of a hash computed over a test resource * file, and the hash equals method. * * @throws IOException In case an exception occurs reading a test resource file. */
Hash rebuild test. Tests the hash rebuild from a string representation of a hash computed over a test resource file, and the hash equals method
hashRebuildTest
{ "repo_name": "s3curitybug/similarity-uniform-fuzzy-hash", "path": "src/test/java/com/github/s3curitybug/similarityuniformfuzzyhash/UniformFuzzyHashTest.java", "license": "apache-2.0", "size": 3129 }
[ "java.io.File", "java.io.IOException", "org.junit.Assert" ]
import java.io.File; import java.io.IOException; import org.junit.Assert;
import java.io.*; import org.junit.*;
[ "java.io", "org.junit" ]
java.io; org.junit;
182,283
public XMPPServer getXMPPServer() { final XMPPServer xmppServer = XMPPServer.getInstance(); if (xmppServer == null) { // Show that the server is down showServerDown(); return null; } return xmppServer; }
XMPPServer function() { final XMPPServer xmppServer = XMPPServer.getInstance(); if (xmppServer == null) { showServerDown(); return null; } return xmppServer; }
/** * Returns the XMPP server object -- can get many config items from here. */
Returns the XMPP server object -- can get many config items from here
getXMPPServer
{ "repo_name": "GinRyan/OpenFireMODxmppServer", "path": "src/java/org/jivesoftware/util/WebManager.java", "license": "apache-2.0", "size": 13625 }
[ "org.jivesoftware.openfire.XMPPServer" ]
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.*;
[ "org.jivesoftware.openfire" ]
org.jivesoftware.openfire;
2,101,921
public void setCompileDependencies( List compileDependencies ) { this.compileDependencies = compileDependencies; }
void function( List compileDependencies ) { this.compileDependencies = compileDependencies; }
/** * Sets the compile dependencies. * * @param compileDependencies the new compile dependencies */
Sets the compile dependencies
setCompileDependencies
{ "repo_name": "lkwg82/enforcer-rules", "path": "src/test/java/org/apache/maven/plugins/enforcer/MockProject.java", "license": "apache-2.0", "size": 42736 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,226,552
public static <T1, T2> ObjectIntProcedure<T1> bind( ObjectIntProcedure<? super T2> delegate, Function<? super T1, T2> function) { return new BindObjectIntProcedure<>(delegate, function); }
static <T1, T2> ObjectIntProcedure<T1> function( ObjectIntProcedure<? super T2> delegate, Function<? super T1, T2> function) { return new BindObjectIntProcedure<>(delegate, function); }
/** * Bind the input of a ObjectIntProcedure to the result of an function, returning a new ObjectIntProcedure. * * @param delegate The ObjectIntProcedure to delegate the invocation to. * @param function The Function that will create the input for the delegate * @return A new ObjectIntProcedure */
Bind the input of a ObjectIntProcedure to the result of an function, returning a new ObjectIntProcedure
bind
{ "repo_name": "bhav0904/eclipse-collections", "path": "eclipse-collections/src/main/java/org/eclipse/collections/impl/block/factory/Functions.java", "license": "bsd-3-clause", "size": 38985 }
[ "org.eclipse.collections.api.block.function.Function", "org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure" ]
import org.eclipse.collections.api.block.function.Function; import org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure;
import org.eclipse.collections.api.block.function.*; import org.eclipse.collections.api.block.procedure.primitive.*;
[ "org.eclipse.collections" ]
org.eclipse.collections;
2,601,780
public void start() { conf = Configuration.getCurrent(); System.out.println(conf.getID()); if (!conf.isComplete()) { System.out.println("Incomplete, aborting"); // TODO check completion // for real return; } switch (conf.getTechnology()) { case "Storm": for (ClassDesc c : conf.getClasses()) { for (String alt : c.getAltDtsm().keySet()) { try { buildStormAnalyzableModel(c.getAltDtsm().get(alt)); generatePNML(String.valueOf(c.getId()), alt); genGSPN(); FileManager.editFiles(c.getId(), alt, extractStormId()); } catch (IOException e) { System.out.println(e.getMessage()); } } } break; case "Hadoop Map-reduce": for (ClassDesc c : conf.getClasses()) { for (String alt : c.getAltDtsm().keySet()) try { buildHadoopAnalyzableModel(c.getAltDtsm().get(alt)); generatePNML(String.valueOf(c.getId()), alt); if (Preferences.getSimulator().equals(Preferences.GSPN)){ genGSPN(); FileManager.editFiles(c.getId(), alt, extractHadoopId()); } else if (Preferences.getSimulator().equals(Preferences.JMT)){ genJSIM(c.getId(), alt, extractHadoopId()); SparkFileManager.editJSIMG(c.getId(), alt, extractHadoopId()); } else { System.err.println("Unknown simulator: " + Preferences.getSimulator()); return; } SparkFileManager.createStatFile(c.getId(), alt, extractHadoopId()); extractParametersFromHadoopModel(c, alt); } catch (Exception e) { System.out.println(e.getMessage()); } } break; case "Spark": for (ClassDesc c : conf.getClasses()) { for (String alt : c.getAltDtsm().keySet()) try { buildSparkAnalyzableModel(c.getAltDtsm().get(alt)); generatePNML(String.valueOf(c.getId()), alt); if (Preferences.getSimulator().equals(Preferences.DAG_SIM)){ System.err.println("Dag Sim not supported yet"); return; } else if (Preferences.getSimulator().equals(Preferences.GSPN)){ genGSPN(); SparkFileManager.editFiles(c.getId(), alt, extractSparkIds()); Thread.sleep(5000); } else if (Preferences.getSimulator().equals(Preferences.JMT)){ genJSIM(c.getId(), alt, extractSparkIds().getNumberOfConcurrentUsers()); SparkFileManager.editJSIMG(c.getId(), alt, extractSparkIds()); } else { System.err.println("Unknown simulator: " + Preferences.getSimulator()); return; } SparkFileManager.createStatFile(c.getId(), alt, extractSparkIds().getNumberOfConcurrentUsers()); extractParametersFromHadoopModel(c, alt); } catch (Exception e) { System.err.println("SPARK EXCEPTION"); e.printStackTrace(); } } break; default: System.err.println("Unknown technology: " + conf.getTechnology()); return; } FileManager.generateInputJson(); FileManager.generateOutputJson(); if (!Configuration.getCurrent().canSend()) { return; } try { setScenario(); NetworkManager.getInstance().sendModel(FileManager.selectFiles(), scenario); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
void function() { conf = Configuration.getCurrent(); System.out.println(conf.getID()); if (!conf.isComplete()) { System.out.println(STR); return; } switch (conf.getTechnology()) { case "Storm": for (ClassDesc c : conf.getClasses()) { for (String alt : c.getAltDtsm().keySet()) { try { buildStormAnalyzableModel(c.getAltDtsm().get(alt)); generatePNML(String.valueOf(c.getId()), alt); genGSPN(); FileManager.editFiles(c.getId(), alt, extractStormId()); } catch (IOException e) { System.out.println(e.getMessage()); } } } break; case STR: for (ClassDesc c : conf.getClasses()) { for (String alt : c.getAltDtsm().keySet()) try { buildHadoopAnalyzableModel(c.getAltDtsm().get(alt)); generatePNML(String.valueOf(c.getId()), alt); if (Preferences.getSimulator().equals(Preferences.GSPN)){ genGSPN(); FileManager.editFiles(c.getId(), alt, extractHadoopId()); } else if (Preferences.getSimulator().equals(Preferences.JMT)){ genJSIM(c.getId(), alt, extractHadoopId()); SparkFileManager.editJSIMG(c.getId(), alt, extractHadoopId()); } else { System.err.println(STR + Preferences.getSimulator()); return; } SparkFileManager.createStatFile(c.getId(), alt, extractHadoopId()); extractParametersFromHadoopModel(c, alt); } catch (Exception e) { System.out.println(e.getMessage()); } } break; case "Spark": for (ClassDesc c : conf.getClasses()) { for (String alt : c.getAltDtsm().keySet()) try { buildSparkAnalyzableModel(c.getAltDtsm().get(alt)); generatePNML(String.valueOf(c.getId()), alt); if (Preferences.getSimulator().equals(Preferences.DAG_SIM)){ System.err.println(STR); return; } else if (Preferences.getSimulator().equals(Preferences.GSPN)){ genGSPN(); SparkFileManager.editFiles(c.getId(), alt, extractSparkIds()); Thread.sleep(5000); } else if (Preferences.getSimulator().equals(Preferences.JMT)){ genJSIM(c.getId(), alt, extractSparkIds().getNumberOfConcurrentUsers()); SparkFileManager.editJSIMG(c.getId(), alt, extractSparkIds()); } else { System.err.println(STR + Preferences.getSimulator()); return; } SparkFileManager.createStatFile(c.getId(), alt, extractSparkIds().getNumberOfConcurrentUsers()); extractParametersFromHadoopModel(c, alt); } catch (Exception e) { System.err.println(STR); e.printStackTrace(); } } break; default: System.err.println(STR + conf.getTechnology()); return; } FileManager.generateInputJson(); FileManager.generateOutputJson(); if (!Configuration.getCurrent().canSend()) { return; } try { setScenario(); NetworkManager.getInstance().sendModel(FileManager.selectFiles(), scenario); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }
/** * Creates models from input files and upload them to the web service */
Creates models from input files and upload them to the web service
start
{ "repo_name": "MarcoIeni/diceH2020-space4cloud-plugin", "path": "bundles/D-SPACE4Cloud-plugin/src/it/polimi/diceH2020/plugin/control/DICEWrap.java", "license": "apache-2.0", "size": 14000 }
[ "it.polimi.diceH2020.plugin.net.NetworkManager", "it.polimi.diceH2020.plugin.preferences.Preferences", "java.io.IOException", "java.io.UnsupportedEncodingException" ]
import it.polimi.diceH2020.plugin.net.NetworkManager; import it.polimi.diceH2020.plugin.preferences.Preferences; import java.io.IOException; import java.io.UnsupportedEncodingException;
import it.polimi.*; import java.io.*;
[ "it.polimi", "java.io" ]
it.polimi; java.io;
2,055,173
public LongDescription getAdditionals() { return this.additionals; }
LongDescription function() { return this.additionals; }
/** * Missing description at method getAdditionals. * * @return the LongDescription. */
Missing description at method getAdditionals
getAdditionals
{ "repo_name": "NABUCCO/org.nabucco.business.provision", "path": "org.nabucco.business.provision.facade.datatype/src/main/gen/org/nabucco/business/provision/facade/datatype/ProvisionAssignment.java", "license": "epl-1.0", "size": 34808 }
[ "org.nabucco.framework.base.facade.datatype.text.LongDescription" ]
import org.nabucco.framework.base.facade.datatype.text.LongDescription;
import org.nabucco.framework.base.facade.datatype.text.*;
[ "org.nabucco.framework" ]
org.nabucco.framework;
1,677,131
azure .kubernetesClusters() .manager() .serviceClient() .getSnapshots() .deleteWithResponse("rg1", "snapshot1", Context.NONE); }
azure .kubernetesClusters() .manager() .serviceClient() .getSnapshots() .deleteWithResponse("rg1", STR, Context.NONE); }
/** * Sample code: Delete Snapshot. * * @param azure The entry point for accessing resource management APIs in Azure. */
Sample code: Delete Snapshot
deleteSnapshot
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/containerservice/generated/SnapshotsDeleteSamples.java", "license": "mit", "size": 945 }
[ "com.azure.core.util.Context" ]
import com.azure.core.util.Context;
import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
1,387,555
File getArtifactFileFromRepository(final GAV gav);
File getArtifactFileFromRepository(final GAV gav);
/** * Return an artifact from the repository * @param gav the GAV identifier * @return the artifact found */
Return an artifact from the repository
getArtifactFileFromRepository
{ "repo_name": "karreiro/uberfire", "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/ArtifactRepository.java", "license": "apache-2.0", "size": 3013 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
737,315
List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Facility facility) throws FacilityNotExistsException, ServiceNotExistsException;
List<Attribute> getRequiredAttributes(PerunSession sess, List<Service> services, Facility facility) throws FacilityNotExistsException, ServiceNotExistsException;
/** * Get facility attributes which are required by the services. * <p> * PRIVILEGE: Get only those required attributes principal has access to. * * @param sess perun session * @param facility you get attributes for this facility * @param services attributes required by this services you'll get * @return list of facility attributes which are required by the service * @throws InternalErrorException if an exception raise in concrete implementation, the exception is wrapped in InternalErrorException * @throws FacilityNotExistsException if the facility wasn't created from this resource * @throws ServiceNotExistsException if the service doesn't exists in underlying data source */
Get facility attributes which are required by the services.
getRequiredAttributes
{ "repo_name": "zoraseb/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/AttributesManager.java", "license": "bsd-2-clause", "size": 265364 }
[ "cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException", "cz.metacentrum.perun.core.api.exceptions.ServiceNotExistsException", "java.util.List" ]
import cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException; import cz.metacentrum.perun.core.api.exceptions.ServiceNotExistsException; import java.util.List;
import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,122,826
private Object[] buildArguments(JSOG jsog) { // The arguments will be stored here Object[] args = new Object[this.parameters.size()]; // Iterate over the parameters and build the argument array for (int i = 0; i < args.length; i++) { // Get the parameter Parameter parameter = this.parameters.get(i); // Evaluate the JsogPath on the input JSOG JSOG value = parameter.path.evaluate(jsog); // If the parameter is required, require it if (parameter.required && value.isNull()) { throw new IllegalArgumentException( "The `" + parameter.path + "' parameter is required"); } // Get the argument args[i] = value.getValueAs(parameter.type); } // Done, return the arguments return args; } /** * Invokes the method with the specified JSOG as the argument source. * @param obj - the object the underlying method is invoked from * @param jsog the JSOG on the JsogPath expressions will be evaluated. * @return the method's return value. * @throws InvocationTargetException if the method throws an exception. * @throws IllegalArgumentException {@link Method#invoke(Object, Object[])}
Object[] function(JSOG jsog) { Object[] args = new Object[this.parameters.size()]; for (int i = 0; i < args.length; i++) { Parameter parameter = this.parameters.get(i); JSOG value = parameter.path.evaluate(jsog); if (parameter.required && value.isNull()) { throw new IllegalArgumentException( STR + parameter.path + STR); } args[i] = value.getValueAs(parameter.type); } return args; } /** * Invokes the method with the specified JSOG as the argument source. * @param obj - the object the underlying method is invoked from * @param jsog the JSOG on the JsogPath expressions will be evaluated. * @return the method's return value. * @throws InvocationTargetException if the method throws an exception. * @throws IllegalArgumentException {@link Method#invoke(Object, Object[])}
/** * Builds an Object[] that can be passed to * {@link Method#invoke(Object, Object[])}. * * @param jsog the JSOG on which the JsogPath expressions are to be * evaluated. * @return an Object[] of arguments. * @throws IllegalArgumentException if a parameter is required but the value * is null. */
Builds an Object[] that can be passed to <code>Method#invoke(Object, Object[])</code>
buildArguments
{ "repo_name": "JeffreyRodriguez/JSOG", "path": "src/main/java/net/sf/jsog/dynamic/JsogMethod.java", "license": "unlicense", "size": 8960 }
[ "java.lang.reflect.InvocationTargetException", "java.lang.reflect.Method" ]
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,390,518
@Bean public static PropertiesFactoryBean configProperties(ResourceLoader resourceLoader) throws IOException { PropertiesFactoryBean props = new PropertiesFactoryBean(); props.setLocation(resourceLoader.getResource(CONFIG_PROPERTIES_URI)); props.afterPropertiesSet(); return props; }
static PropertiesFactoryBean function(ResourceLoader resourceLoader) throws IOException { PropertiesFactoryBean props = new PropertiesFactoryBean(); props.setLocation(resourceLoader.getResource(CONFIG_PROPERTIES_URI)); props.afterPropertiesSet(); return props; }
/** * Creates a new Properties. * * @param resourceLoader any ResourceLoader. * @return a Properties. * @throws IOException if the properties file is not found in * {@link #CONFIG_PROPERTIES_URI}. */
Creates a new Properties
configProperties
{ "repo_name": "dan-zx/zekke-webapp", "path": "src/main/java/com/zekke/webapp/config/MainConfig.java", "license": "apache-2.0", "size": 2676 }
[ "java.io.IOException", "org.springframework.beans.factory.config.PropertiesFactoryBean", "org.springframework.core.io.ResourceLoader" ]
import java.io.IOException; import org.springframework.beans.factory.config.PropertiesFactoryBean; import org.springframework.core.io.ResourceLoader;
import java.io.*; import org.springframework.beans.factory.config.*; import org.springframework.core.io.*;
[ "java.io", "org.springframework.beans", "org.springframework.core" ]
java.io; org.springframework.beans; org.springframework.core;
65,423
private static List<Integer> convertList(List<String> list) { if (list == null) { return null; } List<Integer> ret = new ArrayList<Integer>(list.size()); for (String v : list) { ret.add(StringUtils.toInt(v)); } return ret; }
static List<Integer> function(List<String> list) { if (list == null) { return null; } List<Integer> ret = new ArrayList<Integer>(list.size()); for (String v : list) { ret.add(StringUtils.toInt(v)); } return ret; }
/** * Convert list. * * @param list the list * @return the list */
Convert list
convertList
{ "repo_name": "jhunters/jprotobuf", "path": "src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java", "license": "apache-2.0", "size": 65039 }
[ "com.baidu.bjf.remoting.protobuf.utils.StringUtils", "java.util.ArrayList", "java.util.List" ]
import com.baidu.bjf.remoting.protobuf.utils.StringUtils; import java.util.ArrayList; import java.util.List;
import com.baidu.bjf.remoting.protobuf.utils.*; import java.util.*;
[ "com.baidu.bjf", "java.util" ]
com.baidu.bjf; java.util;
2,537,236
public long skip(long n) throws IOException { return fInputStream.skip(n); } // skip(long):long
long function(long n) throws IOException { return fInputStream.skip(n); }
/** * Skip characters. This method will block until some characters are * available, an I/O error occurs, or the end of the stream is reached. * * @param n The number of characters to skip * * @return The number of characters actually skipped * * @exception IOException If an I/O error occurs */
Skip characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached
skip
{ "repo_name": "WillJiang/WillJiang", "path": "src/plugins/embeddedjsp/src/main/java/org/apache/struts2/jasper/xmlparser/ASCIIReader.java", "license": "apache-2.0", "size": 7002 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
560,845
@Override public Resource createRelative(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ClassPathResource(pathToUse, this.classLoader, this.clazz); }
Resource function(String relativePath) { String pathToUse = StringUtils.applyRelativePath(this.path, relativePath); return new ClassPathResource(pathToUse, this.classLoader, this.clazz); }
/** * This implementation creates a ClassPathResource, applying the given path * relative to the path of the underlying resource of this descriptor. * @see org.springframework.util.StringUtils#applyRelativePath(String, String) */
This implementation creates a ClassPathResource, applying the given path relative to the path of the underlying resource of this descriptor
createRelative
{ "repo_name": "zollty-org/zollty-util", "path": "jretty-util/src/main/java/org/jretty/util/resource/ClassPathResource.java", "license": "gpl-2.0", "size": 9024 }
[ "org.jretty.util.StringUtils" ]
import org.jretty.util.StringUtils;
import org.jretty.util.*;
[ "org.jretty.util" ]
org.jretty.util;
2,541,839
public static boolean isUserNameWithAllowedDomainName(String userName, UserRealm realm) throws APIManagementException { int index; index = userName.indexOf('/'); // Check whether we have a secondary UserStoreManager setup. if (index > 0) { // Using the short-circuit. User name comes with the domain name. try { return !realm.getRealmConfiguration() .isRestrictedDomainForSlefSignUp(userName.substring(0, index)); } catch (UserStoreException e) { throw new APIManagementException(e.getMessage(), e); } } return true; }
static boolean function(String userName, UserRealm realm) throws APIManagementException { int index; index = userName.indexOf('/'); if (index > 0) { try { return !realm.getRealmConfiguration() .isRestrictedDomainForSlefSignUp(userName.substring(0, index)); } catch (UserStoreException e) { throw new APIManagementException(e.getMessage(), e); } } return true; }
/** * Check whether user can signup to the tenant domain * * @param userName - The user name * @param realm - The realm * @return - A boolean value * @throws APIManagementException */
Check whether user can signup to the tenant domain
isUserNameWithAllowedDomainName
{ "repo_name": "dhanuka84/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/SelfSignUpUtil.java", "license": "apache-2.0", "size": 9975 }
[ "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.user.api.UserStoreException", "org.wso2.carbon.user.core.UserRealm" ]
import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.UserRealm;
import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.user.api.*; import org.wso2.carbon.user.core.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,739,695
@Override public boolean ready(Node node, long now) { if (isReady(node, now)) return true; if (connectionStates.canConnect(node.idString(), now)) // if we are interested in sending to a node and we don't have a connection to it, initiate one initiateConnect(node, now); return false; }
boolean function(Node node, long now) { if (isReady(node, now)) return true; if (connectionStates.canConnect(node.idString(), now)) initiateConnect(node, now); return false; }
/** * Begin connecting to the given node, return true if we are already connected and ready to send to that node. * * @param node The node to check * @param now The current timestamp * @return True if we are ready to send to the given node */
Begin connecting to the given node, return true if we are already connected and ready to send to that node
ready
{ "repo_name": "Tony-Zhang03/kafka", "path": "clients/src/main/java/org/apache/kafka/clients/NetworkClient.java", "license": "apache-2.0", "size": 21555 }
[ "org.apache.kafka.common.Node" ]
import org.apache.kafka.common.Node;
import org.apache.kafka.common.*;
[ "org.apache.kafka" ]
org.apache.kafka;
2,114,701
@Factory public static <E> Matcher<? super Collection<? extends E>> hasSize(int n) { return new IsCollectionWithSize<E>(equalTo(n)); }
static <E> Matcher<? super Collection<? extends E>> function(int n) { return new IsCollectionWithSize<E>(equalTo(n)); }
/** * matches if the List<List<String>> object has size n; * @param size */
matches if the List> object has size n
hasSize
{ "repo_name": "TeamSPoon/logicmoo_base", "path": "prolog/logicmoo/pdt_server/pdt.plunit/src/org/cs3/plunit/matcher/CultivateMatcher.java", "license": "mit", "size": 3373 }
[ "java.util.Collection", "org.hamcrest.Matcher", "org.hamcrest.collection.IsCollectionWithSize" ]
import java.util.Collection; import org.hamcrest.Matcher; import org.hamcrest.collection.IsCollectionWithSize;
import java.util.*; import org.hamcrest.*; import org.hamcrest.collection.*;
[ "java.util", "org.hamcrest", "org.hamcrest.collection" ]
java.util; org.hamcrest; org.hamcrest.collection;
14,977
public IITPlaylist getPlaylist() { return new IITPlaylist(Dispatch.get(this, "Playlist").toDispatch()); }
IITPlaylist function() { return new IITPlaylist(Dispatch.get(this, STR).toDispatch()); }
/** * Wrapper for calling the ActiveX-Method with input-parameter(s). * * @return the result is of type IITPlaylist */
Wrapper for calling the ActiveX-Method with input-parameter(s)
getPlaylist
{ "repo_name": "cpesch/MetaMusic", "path": "itunes-com-library/src/main/java/slash/metamusic/itunes/com/binding/IITTrack.java", "license": "gpl-2.0", "size": 19298 }
[ "com.jacob.com.Dispatch" ]
import com.jacob.com.Dispatch;
import com.jacob.com.*;
[ "com.jacob.com" ]
com.jacob.com;
229,917
void loadState(Serializable state);
void loadState(Serializable state);
/** * Loads the delegate state. All implementations should follow this scheme: * * <pre> * <code> * DelegateImplementationState s = (DelegateImplementationState) state; * super.loadState(s.superState); * // load other variables from state here * </code> * </pre> * * @param state the delegates state. */
Loads the delegate state. All implementations should follow this scheme: <code> <code> DelegateImplementationState s = (DelegateImplementationState) state; super.loadState(s.superState); load other variables from state here </code> </code>
loadState
{ "repo_name": "ssoloff/triplea-game-triplea", "path": "game-core/src/main/java/games/strategy/engine/delegate/IDelegate.java", "license": "gpl-3.0", "size": 3172 }
[ "java.io.Serializable" ]
import java.io.Serializable;
import java.io.*;
[ "java.io" ]
java.io;
431,897
private void initializeFormulas(ItemBean item) { Map<String, CalculatedQuestionFormulaBean> formulas = item.getCalculatedQuestion().getFormulas(); for (CalculatedQuestionFormulaBean bean : formulas.values()) { bean.setActive(false); bean.setValidFormula(true); bean.setValidTolerance(true); } }
void function(ItemBean item) { Map<String, CalculatedQuestionFormulaBean> formulas = item.getCalculatedQuestion().getFormulas(); for (CalculatedQuestionFormulaBean bean : formulas.values()) { bean.setActive(false); bean.setValidFormula(true); bean.setValidTolerance(true); } }
/** * initializeFormulas() prepares any previously defined formulas for updates * that occur when extracting new formulas from instructions * @param item */
initializeFormulas() prepares any previously defined formulas for updates that occur when extracting new formulas from instructions
initializeFormulas
{ "repo_name": "ouit0408/sakai", "path": "samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/listener/author/CalculatedQuestionExtractListener.java", "license": "apache-2.0", "size": 27507 }
[ "java.util.Map", "org.sakaiproject.tool.assessment.ui.bean.author.CalculatedQuestionFormulaBean", "org.sakaiproject.tool.assessment.ui.bean.author.ItemBean" ]
import java.util.Map; import org.sakaiproject.tool.assessment.ui.bean.author.CalculatedQuestionFormulaBean; import org.sakaiproject.tool.assessment.ui.bean.author.ItemBean;
import java.util.*; import org.sakaiproject.tool.assessment.ui.bean.author.*;
[ "java.util", "org.sakaiproject.tool" ]
java.util; org.sakaiproject.tool;
2,642,686
List<ViewManager> createAllViewManagers( ReactApplicationContext catalystApplicationContext) { List<ViewManager> allViewManagers = new ArrayList<>(); for (ReactPackage reactPackage : mPackages) { allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext)); } return allViewManagers; }
List<ViewManager> createAllViewManagers( ReactApplicationContext catalystApplicationContext) { List<ViewManager> allViewManagers = new ArrayList<>(); for (ReactPackage reactPackage : mPackages) { allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext)); } return allViewManagers; }
/** * Uses configured {@link ReactPackage} instances to create all view managers */
Uses configured <code>ReactPackage</code> instances to create all view managers
createAllViewManagers
{ "repo_name": "glovebx/react-native", "path": "ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java", "license": "bsd-3-clause", "size": 25321 }
[ "com.facebook.react.bridge.ReactApplicationContext", "com.facebook.react.uimanager.ViewManager", "java.util.ArrayList", "java.util.List" ]
import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.ArrayList; import java.util.List;
import com.facebook.react.bridge.*; import com.facebook.react.uimanager.*; import java.util.*;
[ "com.facebook.react", "java.util" ]
com.facebook.react; java.util;
2,312,893
public static int getParameterAsInt (HttpServletRequest request, String parameter) { if (request == null || parameter == null) return 0; String data = getParameter(request, parameter); if (data == null || data.length() == 0) return 0; try { return Integer.parseInt(data); } catch (Exception e) { log.warn(parameter + "=" + data + " - " + e); } return 0; } // getParameterAsInt
static int function (HttpServletRequest request, String parameter) { if (request == null parameter == null) return 0; String data = getParameter(request, parameter); if (data == null data.length() == 0) return 0; try { return Integer.parseInt(data); } catch (Exception e) { log.warn(parameter + "=" + data + STR + e); } return 0; }
/** * Get integer Parameter - 0 if not defined. * * @param request request * @param parameter parameter * @return int result or 0 */
Get integer Parameter - 0 if not defined
getParameterAsInt
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.adempiere.adempiere/serverRoot/de.metas.adempiere.adempiere.serverRoot.base/src/main/java-legacy/org/adempiere/serverRoot/util/WebUtil.java", "license": "gpl-2.0", "size": 23390 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
1,686,399
@Override public synchronized void addLoggerAppender(final org.apache.logging.log4j.core.Logger logger, final Appender appender) { final String name = logger.getName(); appenders.putIfAbsent(appender.getName(), appender); final LoggerConfig lc = getLoggerConfig(name); if (lc.getName().equals(name)) { lc.addAppender(appender, null, null); } else { final LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), lc.isAdditive()); nlc.addAppender(appender, null, null); nlc.setParent(lc); loggers.putIfAbsent(name, nlc); setParents(); logger.getContext().updateLoggers(); } }
synchronized void function(final org.apache.logging.log4j.core.Logger logger, final Appender appender) { final String name = logger.getName(); appenders.putIfAbsent(appender.getName(), appender); final LoggerConfig lc = getLoggerConfig(name); if (lc.getName().equals(name)) { lc.addAppender(appender, null, null); } else { final LoggerConfig nlc = new LoggerConfig(name, lc.getLevel(), lc.isAdditive()); nlc.addAppender(appender, null, null); nlc.setParent(lc); loggers.putIfAbsent(name, nlc); setParents(); logger.getContext().updateLoggers(); } }
/** * Associates an Appender with a LoggerConfig. This method is synchronized in case a Logger with the * same name is being updated at the same time. * * Note: This method is not used when configuring via configuration. It is primarily used by * unit tests. * @param logger The Logger the Appender will be associated with. * @param appender The Appender. */
Associates an Appender with a LoggerConfig. This method is synchronized in case a Logger with the same name is being updated at the same time. Note: This method is not used when configuring via configuration. It is primarily used by unit tests
addLoggerAppender
{ "repo_name": "OuZhencong/log4j2", "path": "log4j-core/src/main/java/org/apache/logging/log4j/core/config/BaseConfiguration.java", "license": "apache-2.0", "size": 35017 }
[ "org.apache.logging.log4j.Logger", "org.apache.logging.log4j.core.Appender" ]
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.Appender;
import org.apache.logging.log4j.*; import org.apache.logging.log4j.core.*;
[ "org.apache.logging" ]
org.apache.logging;
2,846,083
public Optional<Configuration> fetchConfiguration(final String resourceUuid, final String configurationUuid) { final Optional<Resource> resourceOptional = fetchResource(resourceUuid); if (!resourceOptional.isPresent()) { DataModelUtil.LOG.debug("couldn't find resource '" + resourceUuid); return Optional.absent(); } final Configuration configuration = resourceOptional.get().getConfiguration(configurationUuid); return Optional.fromNullable(configuration); }
Optional<Configuration> function(final String resourceUuid, final String configurationUuid) { final Optional<Resource> resourceOptional = fetchResource(resourceUuid); if (!resourceOptional.isPresent()) { DataModelUtil.LOG.debug(STR + resourceUuid); return Optional.absent(); } final Configuration configuration = resourceOptional.get().getConfiguration(configurationUuid); return Optional.fromNullable(configuration); }
/** * Gets the configuration for the given resource identifier and configuration identifier * * @param resourceUuid a resource identifier * @param configurationUuid a configuration identifier * @return (optional) the matched configuration */
Gets the configuration for the given resource identifier and configuration identifier
fetchConfiguration
{ "repo_name": "philbritton/dswarm", "path": "controller/src/main/java/org/dswarm/controller/utils/DataModelUtil.java", "license": "apache-2.0", "size": 21075 }
[ "com.google.common.base.Optional", "org.dswarm.persistence.model.resource.Configuration", "org.dswarm.persistence.model.resource.Resource" ]
import com.google.common.base.Optional; import org.dswarm.persistence.model.resource.Configuration; import org.dswarm.persistence.model.resource.Resource;
import com.google.common.base.*; import org.dswarm.persistence.model.resource.*;
[ "com.google.common", "org.dswarm.persistence" ]
com.google.common; org.dswarm.persistence;
372,868
@Test public void testPartialRead() throws Exception { HLog log = HLogFactory.createHLog(fs, hbaseDir, logName, conf); long ts = System.currentTimeMillis(); WALEdit edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("1"), ts, value)); log.append(info, tableName, edit, ts, htd); edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("2"), ts+1, value)); log.append(info, tableName, edit, ts+1, htd); log.rollWriter(); Thread.sleep(1); long ts1 = System.currentTimeMillis(); edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("3"), ts1+1, value)); log.append(info, tableName, edit, ts1+1, htd); edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("4"), ts1+2, value)); log.append(info, tableName, edit, ts1+2, htd); log.close(); HLogInputFormat input = new HLogInputFormat(); Configuration jobConf = new Configuration(conf); jobConf.set("mapred.input.dir", logDir.toString()); jobConf.setLong(HLogInputFormat.END_TIME_KEY, ts); // only 1st file is considered, and only its 1st entry is used List<InputSplit> splits = input.getSplits(MapreduceTestingShim.createJobContext(jobConf)); assertEquals(1, splits.size()); testSplit(splits.get(0), Bytes.toBytes("1")); jobConf.setLong(HLogInputFormat.START_TIME_KEY, ts+1); jobConf.setLong(HLogInputFormat.END_TIME_KEY, ts1+1); splits = input.getSplits(MapreduceTestingShim.createJobContext(jobConf)); // both files need to be considered assertEquals(2, splits.size()); // only the 2nd entry from the 1st file is used testSplit(splits.get(0), Bytes.toBytes("2")); // only the 1nd entry from the 2nd file is used testSplit(splits.get(1), Bytes.toBytes("3")); }
void function() throws Exception { HLog log = HLogFactory.createHLog(fs, hbaseDir, logName, conf); long ts = System.currentTimeMillis(); WALEdit edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("1"), ts, value)); log.append(info, tableName, edit, ts, htd); edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("2"), ts+1, value)); log.append(info, tableName, edit, ts+1, htd); log.rollWriter(); Thread.sleep(1); long ts1 = System.currentTimeMillis(); edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("3"), ts1+1, value)); log.append(info, tableName, edit, ts1+1, htd); edit = new WALEdit(); edit.add(new KeyValue(rowName, family, Bytes.toBytes("4"), ts1+2, value)); log.append(info, tableName, edit, ts1+2, htd); log.close(); HLogInputFormat input = new HLogInputFormat(); Configuration jobConf = new Configuration(conf); jobConf.set(STR, logDir.toString()); jobConf.setLong(HLogInputFormat.END_TIME_KEY, ts); List<InputSplit> splits = input.getSplits(MapreduceTestingShim.createJobContext(jobConf)); assertEquals(1, splits.size()); testSplit(splits.get(0), Bytes.toBytes("1")); jobConf.setLong(HLogInputFormat.START_TIME_KEY, ts+1); jobConf.setLong(HLogInputFormat.END_TIME_KEY, ts1+1); splits = input.getSplits(MapreduceTestingShim.createJobContext(jobConf)); assertEquals(2, splits.size()); testSplit(splits.get(0), Bytes.toBytes("2")); testSplit(splits.get(1), Bytes.toBytes("3")); }
/** * Test partial reads from the log based on passed time range * @throws Exception */
Test partial reads from the log based on passed time range
testPartialRead
{ "repo_name": "francisliu/hbase_namespace", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/mapreduce/TestHLogRecordReader.java", "license": "apache-2.0", "size": 8779 }
[ "java.util.List", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.hbase.KeyValue", "org.apache.hadoop.hbase.regionserver.wal.HLog", "org.apache.hadoop.hbase.regionserver.wal.HLogFactory", "org.apache.hadoop.hbase.regionserver.wal.WALEdit", "org.apache.hadoop.hbase.util.Bytes", "org.apache.hadoop.mapreduce.InputSplit", "org.junit.Assert" ]
import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.regionserver.wal.HLog; import org.apache.hadoop.hbase.regionserver.wal.HLogFactory; import org.apache.hadoop.hbase.regionserver.wal.WALEdit; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.mapreduce.InputSplit; import org.junit.Assert;
import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.wal.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.mapreduce.*; import org.junit.*;
[ "java.util", "org.apache.hadoop", "org.junit" ]
java.util; org.apache.hadoop; org.junit;
2,390,766
public Type getRuntimeType() { return fObject.cls(); }
Type function() { return fObject.cls(); }
/** * Returns the <em>actual</em> type of the object. */
Returns the actual type of the object
getRuntimeType
{ "repo_name": "classicwuhao/maxuse", "path": "src/main/org/tzi/use/uml/ocl/value/ObjectValue.java", "license": "gpl-2.0", "size": 2311 }
[ "org.tzi.use.uml.ocl.type.Type" ]
import org.tzi.use.uml.ocl.type.Type;
import org.tzi.use.uml.ocl.type.*;
[ "org.tzi.use" ]
org.tzi.use;
469,834
@ApiModelProperty(value = "") public List<LocationLogResource> getContent() { return content; }
@ApiModelProperty(value = "") List<LocationLogResource> function() { return content; }
/** * Get content * @return content **/
Get content
getContent
{ "repo_name": "knetikmedia/knetikcloud-java-client", "path": "src/main/java/com/knetikcloud/model/PageResourceLocationLogResource.java", "license": "apache-2.0", "size": 7644 }
[ "com.knetikcloud.model.LocationLogResource", "io.swagger.annotations.ApiModelProperty", "java.util.List" ]
import com.knetikcloud.model.LocationLogResource; import io.swagger.annotations.ApiModelProperty; import java.util.List;
import com.knetikcloud.model.*; import io.swagger.annotations.*; import java.util.*;
[ "com.knetikcloud.model", "io.swagger.annotations", "java.util" ]
com.knetikcloud.model; io.swagger.annotations; java.util;
2,201,250
private static long getSizeOfPhysicalMemoryForLinux() { try (BufferedReader lineReader = new BufferedReader(new FileReader(LINUX_MEMORY_INFO_PATH))) { String line; while ((line = lineReader.readLine()) != null) { Matcher matcher = LINUX_MEMORY_REGEX.matcher(line); if (matcher.matches()) { String totalMemory = matcher.group(1); return Long.parseLong(totalMemory) * 1024L; // Convert from kilobyte to byte } } // expected line did not come LOG.error("Cannot determine the size of the physical memory for Linux host (using '/proc/meminfo'). Unexpected format."); return -1; } catch (NumberFormatException e) { LOG.error("Cannot determine the size of the physical memory for Linux host (using '/proc/meminfo'). Unexpected format."); return -1; } catch (Throwable t) { LOG.error("Cannot determine the size of the physical memory for Linux host (using '/proc/meminfo'): " + t.getMessage(), t); return -1; } }
static long function() { try (BufferedReader lineReader = new BufferedReader(new FileReader(LINUX_MEMORY_INFO_PATH))) { String line; while ((line = lineReader.readLine()) != null) { Matcher matcher = LINUX_MEMORY_REGEX.matcher(line); if (matcher.matches()) { String totalMemory = matcher.group(1); return Long.parseLong(totalMemory) * 1024L; } } LOG.error(STR); return -1; } catch (NumberFormatException e) { LOG.error(STR); return -1; } catch (Throwable t) { LOG.error(STR + t.getMessage(), t); return -1; } }
/** * Returns the size of the physical memory in bytes on a Linux-based * operating system. * * @return the size of the physical memory in bytes or <code>-1</code> if * the size could not be determined */
Returns the size of the physical memory in bytes on a Linux-based operating system
getSizeOfPhysicalMemoryForLinux
{ "repo_name": "actiontech/dble", "path": "src/main/java/com/actiontech/dble/memory/environment/Hardware.java", "license": "gpl-2.0", "size": 12169 }
[ "java.io.BufferedReader", "java.io.FileReader", "java.util.regex.Matcher" ]
import java.io.BufferedReader; import java.io.FileReader; import java.util.regex.Matcher;
import java.io.*; import java.util.regex.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,394,710
ITreeNode<CTag> getRootTag();
ITreeNode<CTag> getRootTag();
/** * Returns the root tag of the tag tree. * * @return The root tag of the tag tree. */
Returns the root tag of the tag tree
getRootTag
{ "repo_name": "juneJuly/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/Tagging/ITagManager.java", "license": "apache-2.0", "size": 3321 }
[ "com.google.security.zynamics.zylib.types.trees.ITreeNode" ]
import com.google.security.zynamics.zylib.types.trees.ITreeNode;
import com.google.security.zynamics.zylib.types.trees.*;
[ "com.google.security" ]
com.google.security;
259,030
public List<PrivateEndpointConnectionReference> privateEndpointConnections() { return this.privateEndpointConnections; }
List<PrivateEndpointConnectionReference> function() { return this.privateEndpointConnections; }
/** * Get the list of private endpoint connections that are set up for this resource. * * @return the privateEndpointConnections value */
Get the list of private endpoint connections that are set up for this resource
privateEndpointConnections
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appconfiguration/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/appconfiguration/v2020_06_01/implementation/ConfigurationStoreInner.java", "license": "mit", "size": 6411 }
[ "com.microsoft.azure.management.appconfiguration.v2020_06_01.PrivateEndpointConnectionReference", "java.util.List" ]
import com.microsoft.azure.management.appconfiguration.v2020_06_01.PrivateEndpointConnectionReference; import java.util.List;
import com.microsoft.azure.management.appconfiguration.v2020_06_01.*; import java.util.*;
[ "com.microsoft.azure", "java.util" ]
com.microsoft.azure; java.util;
1,190,839
@Override public void insertUpdate(DocumentEvent event) { if (Suppress) return; try { int off = event.getOffset(); int len = event.getLength(); String str = Base64.encodeBytes(STA.code.getText(off, len).getBytes("UTF-8")); STA.CT.send(STA.makeMessage("insert", off, len, str)); } catch(Exception e) { ErrorManager.logError("Error updating networked document: " + e); e.printStackTrace(); } T.restart(); }
@Override void function(DocumentEvent event) { if (Suppress) return; try { int off = event.getOffset(); int len = event.getLength(); String str = Base64.encodeBytes(STA.code.getText(off, len).getBytes("UTF-8")); STA.CT.send(STA.makeMessage(STR, off, len, str)); } catch(Exception e) { ErrorManager.logError(STR + e); e.printStackTrace(); } T.restart(); }
/** * When something is inserted. */
When something is inserted
insertUpdate
{ "repo_name": "jpverkamp/wombat-ide", "path": "ide/src/wombat/gui/text/sta/NetworkedDocumentListener.java", "license": "bsd-3-clause", "size": 2135 }
[ "javax.swing.event.DocumentEvent" ]
import javax.swing.event.DocumentEvent;
import javax.swing.event.*;
[ "javax.swing" ]
javax.swing;
1,328,762
public String jsComponentDependencies() { List<CmsSetupComponent> components = CmsCollectionsGenericWrapper.list(m_components.elementList()); Map<String, List<String>> componentDependencies = buildDepsForAllComponents(); StringBuffer jsCode = new StringBuffer(1024); jsCode.append("\t// an array holding the dependent components for the n-th component\n"); jsCode.append("\tvar componentDependencies = new Array("); jsCode.append(components.size()); jsCode.append(");\n"); for (int i = 0; i < components.size(); i++) { CmsSetupComponent component = components.get(i); List<String> dependencies = componentDependencies.get(component.getId()); jsCode.append("\tcomponentDependencies[" + i + "] = new Array("); if (dependencies != null) { for (int j = 0; j < dependencies.size(); j++) { jsCode.append("\"" + dependencies.get(j) + "\""); if (j < (dependencies.size() - 1)) { jsCode.append(", "); } } } jsCode.append(");\n"); } jsCode.append("\n\n"); return jsCode.toString(); }
String function() { List<CmsSetupComponent> components = CmsCollectionsGenericWrapper.list(m_components.elementList()); Map<String, List<String>> componentDependencies = buildDepsForAllComponents(); StringBuffer jsCode = new StringBuffer(1024); jsCode.append(STR\tvar componentDependencies = new Array(STR);\nSTR\tcomponentDependencies[STR] = new Array(STR\STR\STR, STR);\nSTR\n\n"); return jsCode.toString(); }
/** * Returns js code with array definition for the available component dependencies.<p> * * @return js code */
Returns js code with array definition for the available component dependencies
jsComponentDependencies
{ "repo_name": "mediaworx/opencms-core", "path": "src-setup/org/opencms/setup/CmsSetupBean.java", "license": "lgpl-2.1", "size": 115587 }
[ "java.util.List", "java.util.Map", "org.opencms.util.CmsCollectionsGenericWrapper" ]
import java.util.List; import java.util.Map; import org.opencms.util.CmsCollectionsGenericWrapper;
import java.util.*; import org.opencms.util.*;
[ "java.util", "org.opencms.util" ]
java.util; org.opencms.util;
1,027,427
protected static GMM globalAndUniformInit(Cluster cluster, GMM gmmInitialization, AudioFeatureSet featureSet, int maxNbComponent) throws DiarizationException, IOException { GMM gmm = (gmmInitialization.clone()); Gaussian gaussian = gmm.getComponent(0); int nbComponent = maxNbComponent; int length = 1; double weight = 1.0 / nbComponent; for (int i = 1; i < nbComponent; i++) { gmm.addComponent(gaussian); } int nb = 0; ArrayList<Integer> freatureIndexList = new ArrayList<Integer>(); ArrayList<String> showIndexList = new ArrayList<String>(); for (Segment segment : cluster) { nb += segment.getLength(); int start = segment.getStart(); int end = start + segment.getLength(); // int idx = seg.getShowIndex(); for (int i = start; i < end; i++) { freatureIndexList.add(i); showIndexList.add(segment.getShowName()); } } int step = nb / nbComponent; // int step = nb / nbComp; // logger.finest("step:" + step); int dim = featureSet.getFeatureSize(); gmm.getComponent(0).setWeight(weight); gmm.getComponent(0).setGLR(); for (int i = 1; i < nbComponent; i++) { for (int k = 0; k < dim; k++) { double sum = 0.0; for (int j = 0; j < length; j++) { int idx = freatureIndexList.get((i * step) + j); featureSet.setCurrentShow(showIndexList.get((i * step) + j)); sum += featureSet.getFeatureUnsafe(idx)[k]; } double mean = sum / length; gmm.getComponent(i).setMean(k, mean); } gmm.getComponent(i).setWeight(weight); gmm.getComponent(i).setGLR(); } return gmm; }
static GMM function(Cluster cluster, GMM gmmInitialization, AudioFeatureSet featureSet, int maxNbComponent) throws DiarizationException, IOException { GMM gmm = (gmmInitialization.clone()); Gaussian gaussian = gmm.getComponent(0); int nbComponent = maxNbComponent; int length = 1; double weight = 1.0 / nbComponent; for (int i = 1; i < nbComponent; i++) { gmm.addComponent(gaussian); } int nb = 0; ArrayList<Integer> freatureIndexList = new ArrayList<Integer>(); ArrayList<String> showIndexList = new ArrayList<String>(); for (Segment segment : cluster) { nb += segment.getLength(); int start = segment.getStart(); int end = start + segment.getLength(); for (int i = start; i < end; i++) { freatureIndexList.add(i); showIndexList.add(segment.getShowName()); } } int step = nb / nbComponent; int dim = featureSet.getFeatureSize(); gmm.getComponent(0).setWeight(weight); gmm.getComponent(0).setGLR(); for (int i = 1; i < nbComponent; i++) { for (int k = 0; k < dim; k++) { double sum = 0.0; for (int j = 0; j < length; j++) { int idx = freatureIndexList.get((i * step) + j); featureSet.setCurrentShow(showIndexList.get((i * step) + j)); sum += featureSet.getFeatureUnsafe(idx)[k]; } double mean = sum / length; gmm.getComponent(i).setMean(k, mean); } gmm.getComponent(i).setWeight(weight); gmm.getComponent(i).setGLR(); } return gmm; }
/** * Initialization: uniform initialization, ie random initialization of the means. * * @param cluster the cluster * @param gmmInitialization the initialization model * @param featureSet the features * @param maxNbComponent the maximum number of components * @return the GMM * @throws DiarizationException the diarization exception * @throws IOException Signals that an I/O exception has occurred. */
Initialization: uniform initialization, ie random initialization of the means
globalAndUniformInit
{ "repo_name": "Adirockzz95/GenderDetect", "path": "src/src/fr/lium/spkDiarization/libModel/gaussian/GMMFactory.java", "license": "gpl-3.0", "size": 27214 }
[ "fr.lium.spkDiarization.lib.DiarizationException", "fr.lium.spkDiarization.libClusteringData.Cluster", "fr.lium.spkDiarization.libClusteringData.Segment", "fr.lium.spkDiarization.libFeature.AudioFeatureSet", "java.io.IOException", "java.util.ArrayList" ]
import fr.lium.spkDiarization.lib.DiarizationException; import fr.lium.spkDiarization.libClusteringData.Cluster; import fr.lium.spkDiarization.libClusteringData.Segment; import fr.lium.spkDiarization.libFeature.AudioFeatureSet; import java.io.IOException; import java.util.ArrayList;
import fr.lium.*; import java.io.*; import java.util.*;
[ "fr.lium", "java.io", "java.util" ]
fr.lium; java.io; java.util;
1,829,587
public void saveMessage(View view) { // Get the text. EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); Context context = getApplicationContext(); try { // Save the text. if (!message.isEmpty()) { Snippet snippet = new Snippet(message, Const.getUserId(context)); snippet.save(context); // Intent back to Main. Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } else { CharSequence text = "Snippets can not be empty."; Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); toast.show(); } } catch (IOException e) { Log.e(TAG, e.getMessage(), e); } }
void function(View view) { EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); Context context = getApplicationContext(); try { if (!message.isEmpty()) { Snippet snippet = new Snippet(message, Const.getUserId(context)); snippet.save(context); Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } else { CharSequence text = STR; Toast toast = Toast.makeText(context, text, Toast.LENGTH_SHORT); toast.show(); } } catch (IOException e) { Log.e(TAG, e.getMessage(), e); } }
/** * Saves a message stored in an edit text widget. * * @param view */
Saves a message stored in an edit text widget
saveMessage
{ "repo_name": "icco/Snippets", "path": "app/src/main/java/org/devcloud/snippets/app/NewPostActivity.java", "license": "mit", "size": 3413 }
[ "android.content.Context", "android.content.Intent", "android.util.Log", "android.view.View", "android.widget.EditText", "android.widget.Toast", "java.io.IOException" ]
import android.content.Context; import android.content.Intent; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import java.io.IOException;
import android.content.*; import android.util.*; import android.view.*; import android.widget.*; import java.io.*;
[ "android.content", "android.util", "android.view", "android.widget", "java.io" ]
android.content; android.util; android.view; android.widget; java.io;
1,048,122
public Pair<List<Group>> getSurfaceResidues(double minAsaForSurface) { List<Group> surf1 = new ArrayList<Group>(); List<Group> surf2 = new ArrayList<Group>(); for (GroupAsa groupAsa:groupAsas1.values()) { if (groupAsa.getAsaU()>minAsaForSurface) { surf1.add(groupAsa.getGroup()); } } for (GroupAsa groupAsa:groupAsas2.values()) { if (groupAsa.getAsaU()>minAsaForSurface) { surf2.add(groupAsa.getGroup()); } } return new Pair<List<Group>>(surf1, surf2); }
Pair<List<Group>> function(double minAsaForSurface) { List<Group> surf1 = new ArrayList<Group>(); List<Group> surf2 = new ArrayList<Group>(); for (GroupAsa groupAsa:groupAsas1.values()) { if (groupAsa.getAsaU()>minAsaForSurface) { surf1.add(groupAsa.getGroup()); } } for (GroupAsa groupAsa:groupAsas2.values()) { if (groupAsa.getAsaU()>minAsaForSurface) { surf2.add(groupAsa.getGroup()); } } return new Pair<List<Group>>(surf1, surf2); }
/** * Returns the residues belonging to the surface * @param minAsaForSurface the minimum ASA to consider a residue on the surface * @return */
Returns the residues belonging to the surface
getSurfaceResidues
{ "repo_name": "pwrose/biojava", "path": "biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterface.java", "license": "lgpl-2.1", "size": 26213 }
[ "java.util.ArrayList", "java.util.List", "org.biojava.nbio.structure.Group", "org.biojava.nbio.structure.asa.GroupAsa" ]
import java.util.ArrayList; import java.util.List; import org.biojava.nbio.structure.Group; import org.biojava.nbio.structure.asa.GroupAsa;
import java.util.*; import org.biojava.nbio.structure.*; import org.biojava.nbio.structure.asa.*;
[ "java.util", "org.biojava.nbio" ]
java.util; org.biojava.nbio;
1,642,130
public Organisation getBelongsTo() { return belongsTo; }
Organisation function() { return belongsTo; }
/** * Gets the organisation an accepted present belongs to. * * @return The organisation of the accepted present as an object. */
Gets the organisation an accepted present belongs to
getBelongsTo
{ "repo_name": "InteractiveSystemsGroup/GamificationEngine-Kinben", "path": "src/main/java/info/interactivesystems/gamificationengine/entities/present/PresentAccepted.java", "license": "lgpl-3.0", "size": 3432 }
[ "info.interactivesystems.gamificationengine.entities.Organisation" ]
import info.interactivesystems.gamificationengine.entities.Organisation;
import info.interactivesystems.gamificationengine.entities.*;
[ "info.interactivesystems.gamificationengine" ]
info.interactivesystems.gamificationengine;
1,322,870
EReference getTTask_Deadlines();
EReference getTTask_Deadlines();
/** * Returns the meta object for the containment reference '{@link org.wso2.developerstudio.eclipse.humantask.model.ht.TTask#getDeadlines <em>Deadlines</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Deadlines</em>'. * @see org.wso2.developerstudio.eclipse.humantask.model.ht.TTask#getDeadlines() * @see #getTTask() * @generated */
Returns the meta object for the containment reference '<code>org.wso2.developerstudio.eclipse.humantask.model.ht.TTask#getDeadlines Deadlines</code>'.
getTTask_Deadlines
{ "repo_name": "chanakaudaya/developer-studio", "path": "humantask/org.wso2.tools.humantask.model/src/org/wso2/carbonstudio/eclipse/humantask/model/ht/HTPackage.java", "license": "apache-2.0", "size": 247810 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,563,508
public Variable getVariable(int idvariable) { return sdkDao.getVariable(idvariable); }
Variable function(int idvariable) { return sdkDao.getVariable(idvariable); }
/** * Metodo que consulta una variable * * @param idvariable Identificador de la variable a consultar * @return Objeto de tipo variable almacenado en la base de datos, si no se encuentra, el objeto tendra el campo idTipo = -1 */
Metodo que consulta una variable
getVariable
{ "repo_name": "cictourgune/apptrack-web", "path": "src/org/tourgune/egistour/facade/SDKFacade.java", "license": "apache-2.0", "size": 5176 }
[ "org.tourgune.egistour.bean.Variable" ]
import org.tourgune.egistour.bean.Variable;
import org.tourgune.egistour.bean.*;
[ "org.tourgune.egistour" ]
org.tourgune.egistour;
1,436,827
public void testCachingStrategiesWithNow() throws IOException { // if we hit all fields, this should contain a date field and should diable cachability String query = "now " + randomAlphaOfLengthBetween(4, 10); SimpleQueryStringBuilder queryBuilder = new SimpleQueryStringBuilder(query); assertQueryCachability(queryBuilder, false); // if we hit a date field with "now", this should diable cachability queryBuilder = new SimpleQueryStringBuilder("now"); queryBuilder.field(DATE_FIELD_NAME); assertQueryCachability(queryBuilder, false); // everything else is fine on all fields query = randomFrom("NoW", "nOw", "NOW") + " " + randomAlphaOfLengthBetween(4, 10); queryBuilder = new SimpleQueryStringBuilder(query); assertQueryCachability(queryBuilder, true); }
void function() throws IOException { String query = STR + randomAlphaOfLengthBetween(4, 10); SimpleQueryStringBuilder queryBuilder = new SimpleQueryStringBuilder(query); assertQueryCachability(queryBuilder, false); queryBuilder = new SimpleQueryStringBuilder("now"); queryBuilder.field(DATE_FIELD_NAME); assertQueryCachability(queryBuilder, false); query = randomFrom("NoW", "nOw", "NOW") + " " + randomAlphaOfLengthBetween(4, 10); queryBuilder = new SimpleQueryStringBuilder(query); assertQueryCachability(queryBuilder, true); }
/** * Query terms that contain "now" can trigger a query to not be cacheable. * This test checks the search context cacheable flag is updated accordingly. */
Query terms that contain "now" can trigger a query to not be cacheable. This test checks the search context cacheable flag is updated accordingly
testCachingStrategiesWithNow
{ "repo_name": "robin13/elasticsearch", "path": "server/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTests.java", "license": "apache-2.0", "size": 40313 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,096,424
protected ResourceLocation getEntityTexture(EntityLeashKnot entity) { return LEASH_KNOT_TEXTURES; }
ResourceLocation function(EntityLeashKnot entity) { return LEASH_KNOT_TEXTURES; }
/** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */
Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture
getEntityTexture
{ "repo_name": "MartyParty21/AwakenDreamsClient", "path": "mcp/src/minecraft/net/minecraft/client/renderer/entity/RenderLeashKnot.java", "license": "gpl-3.0", "size": 1909 }
[ "net.minecraft.entity.EntityLeashKnot", "net.minecraft.util.ResourceLocation" ]
import net.minecraft.entity.EntityLeashKnot; import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.*; import net.minecraft.util.*;
[ "net.minecraft.entity", "net.minecraft.util" ]
net.minecraft.entity; net.minecraft.util;
642,009
public void setBackgroundColor(Color color) { if (model.getBackgroundColor().equals(color)) return; model.setBackgroundColor(color); view.getViewport().setBackground(color); int index = model.getSelectedIndex(); if (index == ImViewer.GRID_INDEX) gridView.getViewport().setBackground(color); else if (index == ImViewer.PROJECTION_INDEX) projectionView.getViewport().setBackground(color); }
void function(Color color) { if (model.getBackgroundColor().equals(color)) return; model.setBackgroundColor(color); view.getViewport().setBackground(color); int index = model.getSelectedIndex(); if (index == ImViewer.GRID_INDEX) gridView.getViewport().setBackground(color); else if (index == ImViewer.PROJECTION_INDEX) projectionView.getViewport().setBackground(color); }
/** * Implemented as specified by the {@link Browser} interface. * @see Browser#setBackgroundColor(Color) */
Implemented as specified by the <code>Browser</code> interface
setBackgroundColor
{ "repo_name": "tp81/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/browser/BrowserComponent.java", "license": "gpl-2.0", "size": 20200 }
[ "java.awt.Color", "org.openmicroscopy.shoola.agents.imviewer.view.ImViewer" ]
import java.awt.Color; import org.openmicroscopy.shoola.agents.imviewer.view.ImViewer;
import java.awt.*; import org.openmicroscopy.shoola.agents.imviewer.view.*;
[ "java.awt", "org.openmicroscopy.shoola" ]
java.awt; org.openmicroscopy.shoola;
198,281
public void testMRRefreshDefault() throws IOException { // start a cluster with 2 hosts and no exclude-hosts file Configuration conf = new Configuration(); conf.set("mapred.hosts.exclude", ""); startCluster(2, 1, 0, UserGroupInformation.getLoginUser(),conf); conf = mr.createJobConf(new JobConf(conf)); // refresh with wrong user AdminOperationsProtocol client = getClient(conf, user1); boolean success = false; try { // Also try tool runner client.refreshNodes(); success = true; } catch (IOException ioe) {} assertFalse("Invalid user performed privileged refresh operation", success); // refresh with correct user success = false; client = getClient(conf, owner); try { client.refreshNodes(); success = true; } catch (IOException ioe){} assertTrue("Privileged user denied permission for refresh operation", success); // refresh with supergroup success = false; client = getClient(conf, user4); try { client.refreshNodes(); success = true; } catch (IOException ioe){} assertFalse("Invalid user performed privileged refresh operation", success); // check the cluster status and tracker size assertEquals("Trackers are lost upon refresh with empty hosts.exclude", 2, jt.getClusterStatus(false).getTaskTrackers()); assertEquals("Excluded node count is incorrect", 0, jt.getClusterStatus(false).getNumExcludedNodes()); // check if the host is disallowed Set<String> hosts = new HashSet<String>(); for (TaskTrackerStatus status : jt.taskTrackers()) { hosts.add(status.getHost()); } assertEquals("Host is excluded upon refresh with empty hosts.exclude", 2, hosts.size()); stopCluster(); }
void function() throws IOException { Configuration conf = new Configuration(); conf.set(STR, STRInvalid user performed privileged refresh operationSTRPrivileged user denied permission for refresh operationSTRInvalid user performed privileged refresh operationSTRTrackers are lost upon refresh with empty hosts.excludeSTRExcluded node count is incorrectSTRHost is excluded upon refresh with empty hosts.exclude", 2, hosts.size()); stopCluster(); }
/** * Check default value of mapred.hosts.exclude. Also check if only * owner is allowed to this command. */
Check default value of mapred.hosts.exclude. Also check if only owner is allowed to this command
testMRRefreshDefault
{ "repo_name": "sfu-nml/hadoop-vlocality", "path": "src/test/org/apache/hadoop/mapred/TestNodeRefresh.java", "license": "apache-2.0", "size": 13283 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration;
import java.io.*; import org.apache.hadoop.conf.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
785,534
protected boolean autoFlushIfRequired(Set querySpaces) throws HibernateException { errorIfClosed(); if ( ! isTransactionInProgress() ) { // do not auto-flush while outside a transaction return false; } AutoFlushEvent event = new AutoFlushEvent(querySpaces, this); AutoFlushEventListener[] autoFlushEventListener = listeners.getAutoFlushEventListeners(); for ( int i = 0; i < autoFlushEventListener.length; i++ ) { autoFlushEventListener[i].onAutoFlush(event); } return event.isFlushRequired(); }
boolean function(Set querySpaces) throws HibernateException { errorIfClosed(); if ( ! isTransactionInProgress() ) { return false; } AutoFlushEvent event = new AutoFlushEvent(querySpaces, this); AutoFlushEventListener[] autoFlushEventListener = listeners.getAutoFlushEventListeners(); for ( int i = 0; i < autoFlushEventListener.length; i++ ) { autoFlushEventListener[i].onAutoFlush(event); } return event.isFlushRequired(); }
/** * detect in-memory changes, determine if the changes are to tables * named in the query and, if so, complete execution the flush */
detect in-memory changes, determine if the changes are to tables named in the query and, if so, complete execution the flush
autoFlushIfRequired
{ "repo_name": "codeApeFromChina/resource", "path": "frame_packages/java_libs/hibernate-distribution-3.6.10.Final/project/hibernate-core/src/main/java/org/hibernate/impl/SessionImpl.java", "license": "unlicense", "size": 74430 }
[ "java.util.Set", "org.hibernate.HibernateException", "org.hibernate.event.AutoFlushEvent", "org.hibernate.event.AutoFlushEventListener" ]
import java.util.Set; import org.hibernate.HibernateException; import org.hibernate.event.AutoFlushEvent; import org.hibernate.event.AutoFlushEventListener;
import java.util.*; import org.hibernate.*; import org.hibernate.event.*;
[ "java.util", "org.hibernate", "org.hibernate.event" ]
java.util; org.hibernate; org.hibernate.event;
972,274
public static SortedMap getDisplayNames(ICUService service, ULocale locale) { Collator col; try { col = Collator.getInstance(locale.toLocale()); } catch (MissingResourceException e) { // if no collator resources, we can't collate col = null; } return service.getDisplayNames(locale, col, null); } private static final Random r = new Random(); // this is a multi thread test, can't 'unrandomize'
static SortedMap function(ICUService service, ULocale locale) { Collator col; try { col = Collator.getInstance(locale.toLocale()); } catch (MissingResourceException e) { col = null; } return service.getDisplayNames(locale, col, null); } private static final Random r = new Random();
/** * Convenience override of getDisplayNames(ULocale, Comparator, String) that * uses the default collator for the locale as the comparator to * sort the display names, and null for the matchID. */
Convenience override of getDisplayNames(ULocale, Comparator, String) that uses the default collator for the locale as the comparator to sort the display names, and null for the matchID
getDisplayNames
{ "repo_name": "mirego/j2objc", "path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/tests/android/icu/dev/test/util/ICUServiceThreadTest.java", "license": "apache-2.0", "size": 15953 }
[ "android.icu.impl.ICUService", "android.icu.util.ULocale", "java.text.Collator", "java.util.MissingResourceException", "java.util.Random", "java.util.SortedMap" ]
import android.icu.impl.ICUService; import android.icu.util.ULocale; import java.text.Collator; import java.util.MissingResourceException; import java.util.Random; import java.util.SortedMap;
import android.icu.impl.*; import android.icu.util.*; import java.text.*; import java.util.*;
[ "android.icu", "java.text", "java.util" ]
android.icu; java.text; java.util;
1,104,500
public void dispose() throws IllegalThreadStateException { // Check to be sure that the current Thread isn't in this AppContext if (this.threadGroup.parentOf(Thread.currentThread().getThreadGroup())) { throw new IllegalThreadStateException( "Current Thread is contained within AppContext to be disposed." ); } synchronized(this) { if (this.isDisposed) { return; // If already disposed, bail. } this.isDisposed = true; } final PropertyChangeSupport changeSupport = this.changeSupport; if (changeSupport != null) { changeSupport.firePropertyChange(DISPOSED_PROPERTY_NAME, false, true); } // First, we post an InvocationEvent to be run on the // EventDispatchThread which disposes of all top-level Frames and TrayIcons final Object notificationLock = new Object();
void function() throws IllegalThreadStateException { if (this.threadGroup.parentOf(Thread.currentThread().getThreadGroup())) { throw new IllegalThreadStateException( STR ); } synchronized(this) { if (this.isDisposed) { return; } this.isDisposed = true; } final PropertyChangeSupport changeSupport = this.changeSupport; if (changeSupport != null) { changeSupport.firePropertyChange(DISPOSED_PROPERTY_NAME, false, true); } final Object notificationLock = new Object();
/** * Disposes of this AppContext, all of its top-level Frames, and * all Threads and ThreadGroups contained within it. * * This method must be called from a Thread which is not contained * within this AppContext. * * @exception IllegalThreadStateException if the current thread is * contained within this AppContext * @since 1.2 */
Disposes of this AppContext, all of its top-level Frames, and all Threads and ThreadGroups contained within it. This method must be called from a Thread which is not contained within this AppContext
dispose
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jdk/src/share/classes/sun/awt/AppContext.java", "license": "gpl-2.0", "size": 32305 }
[ "java.beans.PropertyChangeSupport" ]
import java.beans.PropertyChangeSupport;
import java.beans.*;
[ "java.beans" ]
java.beans;
2,416,820
void write(ObjectOutput out) throws IOException { out.writeUTF(serverName); out.writeInt(serverPort); }
void write(ObjectOutput out) throws IOException { out.writeUTF(serverName); out.writeInt(serverPort); }
/** * Serialization routine. */
Serialization routine
write
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/gnu/java/rmi/server/UnicastConnectionManager.java", "license": "bsd-3-clause", "size": 14399 }
[ "java.io.IOException", "java.io.ObjectOutput" ]
import java.io.IOException; import java.io.ObjectOutput;
import java.io.*;
[ "java.io" ]
java.io;
2,554,656
public int shell_read(byte[] buf) { if (programsInputStream == null) return -1; try { int n = programsInputStream.read(buf); if (n <= 0) { programsInputStream.close(); programsInputStream = null; return 0; } else return n; } catch (IOException e) { try { programsInputStream.close(); } catch (IOException e2) {} programsInputStream = null; return -1; } } private boolean accel_inited, accel_exists; private double accel_x, accel_y, accel_z;
int function(byte[] buf) { if (programsInputStream == null) return -1; try { int n = programsInputStream.read(buf); if (n <= 0) { programsInputStream.close(); programsInputStream = null; return 0; } else return n; } catch (IOException e) { try { programsInputStream.close(); } catch (IOException e2) {} programsInputStream = null; return -1; } } private boolean accel_inited, accel_exists; private double accel_x, accel_y, accel_z;
/** * shell_read() * * Callback for core_import_programs(). Returns the number of bytes actually * read. Returns -1 if an error occurred; a return value of 0 signifies end of * input. */
shell_read() Callback for core_import_programs(). Returns the number of bytes actually read. Returns -1 if an error occurred; a return value of 0 signifies end of input
shell_read
{ "repo_name": "melak/free42", "path": "android/app/src/main/java/com/thomasokken/free42/Free42Activity.java", "license": "gpl-2.0", "size": 93842 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
628,599
ObjectMapper mapper = new ObjectMapper(); String result = null; try { result = mapper.writeValueAsString(object); } catch (JsonProcessingException e) { // e.printStackTrace(); } return result; }
ObjectMapper mapper = new ObjectMapper(); String result = null; try { result = mapper.writeValueAsString(object); } catch (JsonProcessingException e) { } return result; }
/** * Convert a POJO to JSON using Jackson libs * @param object The POJO to be converted * @return null if failed to convert, otherwise the result */
Convert a POJO to JSON using Jackson libs
ObjectToJsonString
{ "repo_name": "lisanhu2015/capstone-2015", "path": "SA/src/main/java/org/lsh/utils/HelperFunctions.java", "license": "apache-2.0", "size": 716 }
[ "com.fasterxml.jackson.core.JsonProcessingException", "com.fasterxml.jackson.databind.ObjectMapper" ]
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
1,471,023
public void setMessageWithOpenPgp(String decryptedData, OpenPgpSignatureResult signatureResult) { try { // TODO: get rid of PgpData? PgpData data = new PgpData(); data.setDecryptedData(decryptedData); data.setSignatureResult(signatureResult); mMessageView.setMessage(mAccount, (LocalMessage) mMessage, data, mController, mListener); } catch (MessagingException e) { Log.e(K9.LOG_TAG, "displayMessageBody failed", e); } }
void function(String decryptedData, OpenPgpSignatureResult signatureResult) { try { PgpData data = new PgpData(); data.setDecryptedData(decryptedData); data.setSignatureResult(signatureResult); mMessageView.setMessage(mAccount, (LocalMessage) mMessage, data, mController, mListener); } catch (MessagingException e) { Log.e(K9.LOG_TAG, STR, e); } }
/** * Used by MessageOpenPgpView */
Used by MessageOpenPgpView
setMessageWithOpenPgp
{ "repo_name": "Valodim/k-9", "path": "k9mail/src/main/java/com/fsck/k9/fragment/MessageViewFragment.java", "license": "bsd-3-clause", "size": 30785 }
[ "android.util.Log", "com.fsck.k9.crypto.PgpData", "com.fsck.k9.mail.MessagingException", "com.fsck.k9.mailstore.LocalMessage", "org.openintents.openpgp.OpenPgpSignatureResult" ]
import android.util.Log; import com.fsck.k9.crypto.PgpData; import com.fsck.k9.mail.MessagingException; import com.fsck.k9.mailstore.LocalMessage; import org.openintents.openpgp.OpenPgpSignatureResult;
import android.util.*; import com.fsck.k9.crypto.*; import com.fsck.k9.mail.*; import com.fsck.k9.mailstore.*; import org.openintents.openpgp.*;
[ "android.util", "com.fsck.k9", "org.openintents.openpgp" ]
android.util; com.fsck.k9; org.openintents.openpgp;
1,856,347
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length == 1 && args[0].length() > 0) { GameProfile gameprofile = server.getPlayerProfileCache().getGameProfileForUsername(args[0]); if (gameprofile == null) { throw new CommandException("commands.op.failed", new Object[] {args[0]}); } else { server.getPlayerList().addOp(gameprofile); notifyCommandListener(sender, this, "commands.op.success", new Object[] {args[0]}); } } else { throw new WrongUsageException("commands.op.usage", new Object[0]); } }
void function(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException { if (args.length == 1 && args[0].length() > 0) { GameProfile gameprofile = server.getPlayerProfileCache().getGameProfileForUsername(args[0]); if (gameprofile == null) { throw new CommandException(STR, new Object[] {args[0]}); } else { server.getPlayerList().addOp(gameprofile); notifyCommandListener(sender, this, STR, new Object[] {args[0]}); } } else { throw new WrongUsageException(STR, new Object[0]); } }
/** * Callback for when the command is executed */
Callback for when the command is executed
execute
{ "repo_name": "lucemans/ShapeClient-SRC", "path": "net/minecraft/command/server/CommandOp.java", "license": "mpl-2.0", "size": 2605 }
[ "com.mojang.authlib.GameProfile", "net.minecraft.command.CommandException", "net.minecraft.command.ICommandSender", "net.minecraft.command.WrongUsageException", "net.minecraft.server.MinecraftServer" ]
import com.mojang.authlib.GameProfile; import net.minecraft.command.CommandException; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.server.MinecraftServer;
import com.mojang.authlib.*; import net.minecraft.command.*; import net.minecraft.server.*;
[ "com.mojang.authlib", "net.minecraft.command", "net.minecraft.server" ]
com.mojang.authlib; net.minecraft.command; net.minecraft.server;
64,872
@Test void testIsAlwaysTrueAndFalseXisNullisNotNullisFalse() { // "((x IS NULL) IS NOT NULL) IS FALSE" -> false checkIs(isFalse(isNotNull(isNull(vBool()))), false); }
@Test void testIsAlwaysTrueAndFalseXisNullisNotNullisFalse() { checkIs(isFalse(isNotNull(isNull(vBool()))), false); }
/** Unit tests for * <a href="https://issues.apache.org/jira/browse/CALCITE-2438">[CALCITE-2438] * RexCall#isAlwaysTrue returns incorrect result</a>. */
Unit tests for [CALCITE-2438]
testIsAlwaysTrueAndFalseXisNullisNotNullisFalse
{ "repo_name": "jcamachor/calcite", "path": "core/src/test/java/org/apache/calcite/rex/RexProgramTest.java", "license": "apache-2.0", "size": 126975 }
[ "org.junit.jupiter.api.Test" ]
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.*;
[ "org.junit.jupiter" ]
org.junit.jupiter;
324,813
EAttribute getActionDescriptor_EvaluatorClass();
EAttribute getActionDescriptor_EvaluatorClass();
/** * Returns the meta object for the attribute '{@link uk.ac.lancs.comp.vmlLangInst.ActionDescriptor#getEvaluatorClass <em>Evaluator Class</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Evaluator Class</em>'. * @see uk.ac.lancs.comp.vmlLangInst.ActionDescriptor#getEvaluatorClass() * @see #getActionDescriptor() * @generated */
Returns the meta object for the attribute '<code>uk.ac.lancs.comp.vmlLangInst.ActionDescriptor#getEvaluatorClass Evaluator Class</code>'.
getActionDescriptor_EvaluatorClass
{ "repo_name": "szschaler/vml_star", "path": "uk.ac.lancs.comp.vmlstar.lang_inst.model/src/uk/ac/lancs/comp/vmlLangInst/VmlLangInstPackage.java", "license": "mit", "size": 27322 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,149,403
@TargetApi(12) public static int getBitmapSize(Bitmap bitmap) { if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } // Pre HC-MR1 return bitmap.getRowBytes() * bitmap.getHeight(); }
@TargetApi(12) static int function(Bitmap bitmap) { if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } return bitmap.getRowBytes() * bitmap.getHeight(); }
/** * Get the size in bytes of a bitmap. * * @param bitmap The bitmap to calculate the size of. * @return size of bitmap in bytes. */
Get the size in bytes of a bitmap
getBitmapSize
{ "repo_name": "stevenstrike/jabboid", "path": "src/fr/jbteam/jabboid/core/ImageCache.java", "license": "lgpl-3.0", "size": 7955 }
[ "android.annotation.TargetApi", "android.graphics.Bitmap" ]
import android.annotation.TargetApi; import android.graphics.Bitmap;
import android.annotation.*; import android.graphics.*;
[ "android.annotation", "android.graphics" ]
android.annotation; android.graphics;
121,567
public Date getLastSeen() { return lastSeen; }
Date function() { return lastSeen; }
/** * Returns the time when the player was last seen. * * @return The time when the player was last seen. */
Returns the time when the player was last seen
getLastSeen
{ "repo_name": "Adi3000/subsonic-main", "path": "src/main/java/net/sourceforge/subsonic/domain/Player.java", "license": "gpl-3.0", "size": 8657 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
257,065
private ServiceSessionRecord[] createServiceSessionRecords( HashMap serviceResults ) throws CatalogClientException { List<ServiceSessionRecord> ssrList = new ArrayList<ServiceSessionRecord>( 10 ); Iterator it = serviceResults.keySet().iterator(); while ( it.hasNext() ) { // one loop for every available service metadata catalog String catalog = (String) it.next(); Document doc = (Document) serviceResults.get( catalog ); List mdList; try { mdList = extractMetadata( doc ); } catch ( Exception e ) { throw new CatalogClientException( Messages.getMessage( "IGEO_STD_CSW_ERROR_EXTRACT_METADATA", e.getMessage() ) ); } for ( int j = 0; j < mdList.size(); j++ ) { // one loop for every service metadata element for the current catalog Node mdNode = (Node) mdList.get( j ); if ( !"service".equals( getMetadataType( (Element) mdNode ) ) ) { // Ignore the node if it is a data metadata type(i.e. dataset or dataseries) // Or use it if its a service metadata // TODO handle service metadata properly, also in iGeoPortal xslts continue; } String id = null; String title = null; String address = null; String serviceType = null; String serviceTypeVersion = null; try { id = extractValue( mdNode, config.getXPathToServiceIdentifier() ); title = extractValue( mdNode, config.getXPathToServiceTitle() ); address = extractValue( mdNode, config.getXPathToServiceAddress() ); serviceType = extractValue( mdNode, config.getXPathToServiceType() ); serviceTypeVersion = extractValue( mdNode, config.getXPathToServiceTypeVersion() ); } catch ( Exception e ) { throw new CatalogClientException( Messages.getMessage( "IGEO_STD_CSW_ERROR_EXTRACT_VAL", e.getMessage() ) ); } ServiceSessionRecord ssr = new ServiceSessionRecord( id, catalog, title, address, serviceType, serviceTypeVersion ); ssrList.add( ssr ); } } ServiceSessionRecord[] serviceSessionRecords = ssrList.toArray( new ServiceSessionRecord[ssrList.size()] ); return serviceSessionRecords; }
ServiceSessionRecord[] function( HashMap serviceResults ) throws CatalogClientException { List<ServiceSessionRecord> ssrList = new ArrayList<ServiceSessionRecord>( 10 ); Iterator it = serviceResults.keySet().iterator(); while ( it.hasNext() ) { String catalog = (String) it.next(); Document doc = (Document) serviceResults.get( catalog ); List mdList; try { mdList = extractMetadata( doc ); } catch ( Exception e ) { throw new CatalogClientException( Messages.getMessage( STR, e.getMessage() ) ); } for ( int j = 0; j < mdList.size(); j++ ) { Node mdNode = (Node) mdList.get( j ); if ( !STR.equals( getMetadataType( (Element) mdNode ) ) ) { continue; } String id = null; String title = null; String address = null; String serviceType = null; String serviceTypeVersion = null; try { id = extractValue( mdNode, config.getXPathToServiceIdentifier() ); title = extractValue( mdNode, config.getXPathToServiceTitle() ); address = extractValue( mdNode, config.getXPathToServiceAddress() ); serviceType = extractValue( mdNode, config.getXPathToServiceType() ); serviceTypeVersion = extractValue( mdNode, config.getXPathToServiceTypeVersion() ); } catch ( Exception e ) { throw new CatalogClientException( Messages.getMessage( STR, e.getMessage() ) ); } ServiceSessionRecord ssr = new ServiceSessionRecord( id, catalog, title, address, serviceType, serviceTypeVersion ); ssrList.add( ssr ); } } ServiceSessionRecord[] serviceSessionRecords = ssrList.toArray( new ServiceSessionRecord[ssrList.size()] ); return serviceSessionRecords; }
/** * This method creates a ServiceSessionRecord for each service metadata element in the passed serviceResults and * returns them as Array. * * @param serviceResults * Map containing service metadata catalogs as keys and metadata-Documents as values. * @return Returns an Array of ServiceSessionRecords. * @throws CatalogClientException */
This method creates a ServiceSessionRecord for each service metadata element in the passed serviceResults and returns them as Array
createServiceSessionRecords
{ "repo_name": "lat-lon/deegree2-base", "path": "deegree2-core/src/main/java/org/deegree/portal/standard/csw/control/AddToShoppingCartListener.java", "license": "lgpl-2.1", "size": 16816 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.Iterator", "java.util.List", "org.deegree.i18n.Messages", "org.deegree.portal.standard.csw.CatalogClientException", "org.deegree.portal.standard.csw.model.ServiceSessionRecord", "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.deegree.i18n.Messages; import org.deegree.portal.standard.csw.CatalogClientException; import org.deegree.portal.standard.csw.model.ServiceSessionRecord; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node;
import java.util.*; import org.deegree.i18n.*; import org.deegree.portal.standard.csw.*; import org.deegree.portal.standard.csw.model.*; import org.w3c.dom.*;
[ "java.util", "org.deegree.i18n", "org.deegree.portal", "org.w3c.dom" ]
java.util; org.deegree.i18n; org.deegree.portal; org.w3c.dom;
1,315,707
private File getTavernaStartupConfigurationDirectory() { File distroHome = null; File configDirectory = null; distroHome = applicationConfiguration.getStartupDir().toFile(); configDirectory = new File(distroHome, "conf"); if (!configDirectory.exists()) configDirectory.mkdir(); return configDirectory; }
File function() { File distroHome = null; File configDirectory = null; distroHome = applicationConfiguration.getStartupDir().toFile(); configDirectory = new File(distroHome, "conf"); if (!configDirectory.exists()) configDirectory.mkdir(); return configDirectory; }
/** * Get the Taverna distribution (startup) configuration directory. */
Get the Taverna distribution (startup) configuration directory
getTavernaStartupConfigurationDirectory
{ "repo_name": "apache/incubator-taverna-workbench", "path": "taverna-activity-palette-impl/src/main/java/org/apache/taverna/servicedescriptions/impl/ServiceDescriptionRegistryImpl.java", "license": "apache-2.0", "size": 23578 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,314,728
public boolean contains(Point2D p) { return path.contains(new java.awt.Point.Double(p.x(), p.y())); }
boolean function(Point2D p) { return path.contains(new java.awt.Point.Double(p.x(), p.y())); }
/** * Tests if the specified <code>Point2D</code> is inside the boundary of * this <code>Shape</code>. * * @param p the specified <code>Point2D</code> * @return <code>true</code> if this <code>Shape</code> contains the * specified <code>Point2D</code>, <code>false</code> * otherwise. */
Tests if the specified <code>Point2D</code> is inside the boundary of this <code>Shape</code>
contains
{ "repo_name": "chardnett/eureka", "path": "src/math/geom2d/curve/GeneralPath2D.java", "license": "gpl-2.0", "size": 19731 }
[ "math.geom2d.Point2D" ]
import math.geom2d.Point2D;
import math.geom2d.*;
[ "math.geom2d" ]
math.geom2d;
2,259,197
public static <T> T min(Iterator<T> self, Comparator<T> comparator) { return min(toList(self), comparator); }
static <T> T function(Iterator<T> self, Comparator<T> comparator) { return min(toList(self), comparator); }
/** * Selects the minimum value found from the Iterator using the given comparator. * * @param self an Iterator * @param comparator a Comparator * @return the minimum value * @see #min(java.util.Collection, java.util.Comparator) * @since 1.5.5 */
Selects the minimum value found from the Iterator using the given comparator
min
{ "repo_name": "mv2a/yajsw", "path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "apache-2.0", "size": 704164 }
[ "java.util.Comparator", "java.util.Iterator" ]
import java.util.Comparator; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,565,453
EAttribute getImplementation_PlatformType();
EAttribute getImplementation_PlatformType();
/** * Returns the meta object for the attribute '{@link acmm.Implementation#getPlatformType <em>Platform Type</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Platform Type</em>'. * @see acmm.Implementation#getPlatformType() * @see #getImplementation() * @generated */
Returns the meta object for the attribute '<code>acmm.Implementation#getPlatformType Platform Type</code>'.
getImplementation_PlatformType
{ "repo_name": "acgtic211/COScore-Community", "path": "cos/src/main/java/acmm/AcmmPackage.java", "license": "gpl-3.0", "size": 90938 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
418,834
@Test public void testLinkAccountByReauthentication_forgetPassword() throws Exception { brokerServerRule.update(new KeycloakRule.KeycloakSetup() {
void function() throws Exception { brokerServerRule.update(new KeycloakRule.KeycloakSetup() {
/** * Tests that duplication is detected and user wants to link federatedIdentity with existing account. He will confirm link by reauthentication (confirm password on login screen) * and additionally he goes through "forget password" */
Tests that duplication is detected and user wants to link federatedIdentity with existing account. He will confirm link by reauthentication (confirm password on login screen) and additionally he goes through "forget password"
testLinkAccountByReauthentication_forgetPassword
{ "repo_name": "mbaluch/keycloak", "path": "testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractFirstBrokerLoginTest.java", "license": "apache-2.0", "size": 35307 }
[ "org.keycloak.testsuite.rule.KeycloakRule" ]
import org.keycloak.testsuite.rule.KeycloakRule;
import org.keycloak.testsuite.rule.*;
[ "org.keycloak.testsuite" ]
org.keycloak.testsuite;
548,361
public static boolean deleteFileOrDir(File file) { if (file == null || !file.exists()) return false; if (file.isDirectory()) { File[] childFiles = file.listFiles(); if (childFiles != null){ boolean result = true; for (File childFile : childFiles) { result &= deleteFileOrDir(childFile); } return result && deleteFile(file); } } else if (file.isFile()){ return deleteFile(file); } return true; }
static boolean function(File file) { if (file == null !file.exists()) return false; if (file.isDirectory()) { File[] childFiles = file.listFiles(); if (childFiles != null){ boolean result = true; for (File childFile : childFiles) { result &= deleteFileOrDir(childFile); } return result && deleteFile(file); } } else if (file.isFile()){ return deleteFile(file); } return true; }
/** * Delete File or Directory. * @return boolean */
Delete File or Directory
deleteFileOrDir
{ "repo_name": "motcwang/MCommon", "path": "mcommon/src/main/java/im/wangchao/mcommon/utils/FileUtils.java", "license": "gpl-2.0", "size": 11955 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,754,421
@SuppressWarnings("unchecked") public static <K, T extends Persistent> DataStore<K, T> getDataStore( String dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Object auth) throws GoraException { try { Class<? extends DataStore<K,T>> c = (Class<? extends DataStore<K, T>>) Class.forName(dataStoreClass); return createDataStore(c, keyClass, persistentClass, auth, createProps(), null); } catch(GoraException ex) { throw ex; } catch (Exception ex) { throw new GoraException(ex); } }
@SuppressWarnings(STR) static <K, T extends Persistent> DataStore<K, T> function( String dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Object auth) throws GoraException { try { Class<? extends DataStore<K,T>> c = (Class<? extends DataStore<K, T>>) Class.forName(dataStoreClass); return createDataStore(c, keyClass, persistentClass, auth, createProps(), null); } catch(GoraException ex) { throw ex; } catch (Exception ex) { throw new GoraException(ex); } }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class <i>as string</i>. * @param keyClass The key class. * @param persistentClass The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */
Instantiate a new <code>DataStore</code>. Uses default properties. Uses 'null' schema
getDataStore
{ "repo_name": "thainb/GoraDynamoDB", "path": "gora-core/src/main/java/org/apache/gora/store/ws/impl/WSDataStoreFactory.java", "license": "apache-2.0", "size": 15718 }
[ "org.apache.gora.persistency.Persistent", "org.apache.gora.store.DataStore", "org.apache.gora.util.GoraException" ]
import org.apache.gora.persistency.Persistent; import org.apache.gora.store.DataStore; import org.apache.gora.util.GoraException;
import org.apache.gora.persistency.*; import org.apache.gora.store.*; import org.apache.gora.util.*;
[ "org.apache.gora" ]
org.apache.gora;
1,976,890
private Area convertToArea(Geometry geometry) { Coordinate[] c = geometry.getCoordinates(); List<Coord> points = new ArrayList<>(c.length); for (int n = 0; n < c.length; n++) { points.add(new Coord(c[n].y, c[n].x)); } return Java2DConverter.createArea(points); }
Area function(Geometry geometry) { Coordinate[] c = geometry.getCoordinates(); List<Coord> points = new ArrayList<>(c.length); for (int n = 0; n < c.length; n++) { points.add(new Coord(c[n].y, c[n].x)); } return Java2DConverter.createArea(points); }
/** * Converts the given geometry to an {@link Area} object. * @param geometry a polygon as {@link Geometry} object * @return the polygon converted to an {@link Area} object. */
Converts the given geometry to an <code>Area</code> object
convertToArea
{ "repo_name": "openstreetmap/mkgmap", "path": "src/uk/me/parabola/mkgmap/sea/optional/PrecompSeaGenerator.java", "license": "gpl-2.0", "size": 14492 }
[ "com.vividsolutions.jts.geom.Coordinate", "com.vividsolutions.jts.geom.Geometry", "java.awt.geom.Area", "java.util.ArrayList", "java.util.List", "uk.me.parabola.imgfmt.app.Coord", "uk.me.parabola.util.Java2DConverter" ]
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import java.awt.geom.Area; import java.util.ArrayList; import java.util.List; import uk.me.parabola.imgfmt.app.Coord; import uk.me.parabola.util.Java2DConverter;
import com.vividsolutions.jts.geom.*; import java.awt.geom.*; import java.util.*; import uk.me.parabola.imgfmt.app.*; import uk.me.parabola.util.*;
[ "com.vividsolutions.jts", "java.awt", "java.util", "uk.me.parabola" ]
com.vividsolutions.jts; java.awt; java.util; uk.me.parabola;
123,646
EReference getGeneratingUnit_GenUnitOpCostCurves();
EReference getGeneratingUnit_GenUnitOpCostCurves();
/** * Returns the meta object for the reference list '{@link CIM.IEC61970.Generation.Production.GeneratingUnit#getGenUnitOpCostCurves <em>Gen Unit Op Cost Curves</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference list '<em>Gen Unit Op Cost Curves</em>'. * @see CIM.IEC61970.Generation.Production.GeneratingUnit#getGenUnitOpCostCurves() * @see #getGeneratingUnit() * @generated */
Returns the meta object for the reference list '<code>CIM.IEC61970.Generation.Production.GeneratingUnit#getGenUnitOpCostCurves Gen Unit Op Cost Curves</code>'.
getGeneratingUnit_GenUnitOpCostCurves
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Generation/Production/ProductionPackage.java", "license": "mit", "size": 499866 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
806,781
public void testCreatePredictiveDistribution100() { System.out.println("createPredictiveDistribution(100)"); NUM_SAMPLES = 100; ArrayList<Double> inputs = createInputs(RANDOM); Model target = new Model(0.25); ArrayList<InputOutputPair<Vector,Double>> data = createData(inputs, target,RANDOM); BayesianRegression<Double,PosteriorType> instance = this.createInstance(); Evaluator<? super Vectorizable, ? extends ClosedFormDistribution<Double>> predictive = instance.createPredictiveDistribution( instance.learn(data) ); LinearRegression regression = new LinearRegression(); LinearDiscriminantWithBias mle = regression.learn(data); compareMethods(predictive, mle, target); }
void function() { System.out.println(STR); NUM_SAMPLES = 100; ArrayList<Double> inputs = createInputs(RANDOM); Model target = new Model(0.25); ArrayList<InputOutputPair<Vector,Double>> data = createData(inputs, target,RANDOM); BayesianRegression<Double,PosteriorType> instance = this.createInstance(); Evaluator<? super Vectorizable, ? extends ClosedFormDistribution<Double>> predictive = instance.createPredictiveDistribution( instance.learn(data) ); LinearRegression regression = new LinearRegression(); LinearDiscriminantWithBias mle = regression.learn(data); compareMethods(predictive, mle, target); }
/** * Test of createPredictiveDistribution method, of class BayesianRegression. */
Test of createPredictiveDistribution method, of class BayesianRegression
testCreatePredictiveDistribution100
{ "repo_name": "codeaudit/Foundry", "path": "Components/LearningCore/Test/gov/sandia/cognition/statistics/bayesian/BayesianRegressionTestHarness.java", "license": "bsd-3-clause", "size": 17066 }
[ "gov.sandia.cognition.evaluator.Evaluator", "gov.sandia.cognition.learning.algorithm.regression.LinearRegression", "gov.sandia.cognition.learning.data.InputOutputPair", "gov.sandia.cognition.learning.function.scalar.LinearDiscriminantWithBias", "gov.sandia.cognition.math.matrix.Vector", "gov.sandia.cognition.math.matrix.Vectorizable", "gov.sandia.cognition.statistics.ClosedFormDistribution", "java.util.ArrayList" ]
import gov.sandia.cognition.evaluator.Evaluator; import gov.sandia.cognition.learning.algorithm.regression.LinearRegression; import gov.sandia.cognition.learning.data.InputOutputPair; import gov.sandia.cognition.learning.function.scalar.LinearDiscriminantWithBias; import gov.sandia.cognition.math.matrix.Vector; import gov.sandia.cognition.math.matrix.Vectorizable; import gov.sandia.cognition.statistics.ClosedFormDistribution; import java.util.ArrayList;
import gov.sandia.cognition.evaluator.*; import gov.sandia.cognition.learning.algorithm.regression.*; import gov.sandia.cognition.learning.data.*; import gov.sandia.cognition.learning.function.scalar.*; import gov.sandia.cognition.math.matrix.*; import gov.sandia.cognition.statistics.*; import java.util.*;
[ "gov.sandia.cognition", "java.util" ]
gov.sandia.cognition; java.util;
1,521,878
private LineDataSet createSet() { LineDataSet set = new LineDataSet(null, "Dynamic Data"); set.setAxisDependency(YAxis.AxisDependency.LEFT); set.setColor(ColorTemplate.getHoloBlue()); set.setCircleColor(Color.WHITE); set.setLineWidth(2f); set.setCircleRadius(6f); set.setFillAlpha(65); set.setFillColor(ColorTemplate.getHoloBlue()); set.setHighLightColor(Color.rgb(244, 117, 117)); set.setValueTextColor(Color.WHITE); set.setValueTextSize(10f); set.setDrawValues(false); return set; } private Thread thread;
LineDataSet function() { LineDataSet set = new LineDataSet(null, STR); set.setAxisDependency(YAxis.AxisDependency.LEFT); set.setColor(ColorTemplate.getHoloBlue()); set.setCircleColor(Color.WHITE); set.setLineWidth(2f); set.setCircleRadius(6f); set.setFillAlpha(65); set.setFillColor(ColorTemplate.getHoloBlue()); set.setHighLightColor(Color.rgb(244, 117, 117)); set.setValueTextColor(Color.WHITE); set.setValueTextSize(10f); set.setDrawValues(false); return set; } private Thread thread;
/** * create linear type data set * * @return set */
create linear type data set
createSet
{ "repo_name": "StupidL/EmbeddedTool", "path": "app/src/main/java/me/stupideme/embeddedtool/view/activity/ChartActivity.java", "license": "apache-2.0", "size": 17080 }
[ "android.graphics.Color", "com.github.mikephil.charting.components.YAxis", "com.github.mikephil.charting.data.LineDataSet", "com.github.mikephil.charting.utils.ColorTemplate" ]
import android.graphics.Color; import com.github.mikephil.charting.components.YAxis; import com.github.mikephil.charting.data.LineDataSet; import com.github.mikephil.charting.utils.ColorTemplate;
import android.graphics.*; import com.github.mikephil.charting.components.*; import com.github.mikephil.charting.data.*; import com.github.mikephil.charting.utils.*;
[ "android.graphics", "com.github.mikephil" ]
android.graphics; com.github.mikephil;
1,523,200
public void testRemove2ElementsFull() throws Exception { final Element plainElement = paragraph.getElement(0); final Element boldElement = paragraph.getElement(1); final int offset = plainElement.getStartOffset(); final int length = boldElement.getEndOffset() - offset; buf.remove(offset, length, createEvent(offset, length)); final List<?> edits = getEdits(event); assertEquals(1, edits.size()); assertChange(edits.get(0), paragraph, 0, new int[] { 0, 5, 5, 9 }, new int[] {}); assertChildren(paragraph, new int[] { 9, 15, 15, 16 }, new AttributeSet[] { italic, null }); }
void function() throws Exception { final Element plainElement = paragraph.getElement(0); final Element boldElement = paragraph.getElement(1); final int offset = plainElement.getStartOffset(); final int length = boldElement.getEndOffset() - offset; buf.remove(offset, length, createEvent(offset, length)); final List<?> edits = getEdits(event); assertEquals(1, edits.size()); assertChange(edits.get(0), paragraph, 0, new int[] { 0, 5, 5, 9 }, new int[] {}); assertChildren(paragraph, new int[] { 9, 15, 15, 16 }, new AttributeSet[] { italic, null }); }
/** * The remove region contains two elements entirely. * Both elements are to be removed. */
The remove region contains two elements entirely. Both elements are to be removed
testRemove2ElementsFull
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/java6/modules/swing/src/test/api/java/common/javax/swing/text/DefaultStyledDocument_ElementBuffer_RemoveTest.java", "license": "apache-2.0", "size": 14015 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,267,222
public void setLogWriter(PrintWriter pw) { logWriter = pw; }
void function(PrintWriter pw) { logWriter = pw; }
/** * Sets the PrintWriter to which server messages are logged. <p> * * Setting this attribute to null disables server message logging * * @param pw the PrintWriter to which server messages are logged */
Sets the PrintWriter to which server messages are logged. Setting this attribute to null disables server message logging
setLogWriter
{ "repo_name": "proudh0n/emergencymasta", "path": "hsqldb/src/org/hsqldb/Server.java", "license": "gpl-2.0", "size": 70376 }
[ "java.io.PrintWriter" ]
import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
1,402,165
public static ChannelBuffer copiedBuffer( CharSequence string, int offset, int length, Charset charset) { return copiedBuffer(BIG_ENDIAN, string, offset, length, charset); }
static ChannelBuffer function( CharSequence string, int offset, int length, Charset charset) { return copiedBuffer(BIG_ENDIAN, string, offset, length, charset); }
/** * Creates a new big-endian buffer whose content is a subregion of * the specified {@code string} encoded in the specified {@code charset}. * The new buffer's {@code readerIndex} and {@code writerIndex} are * {@code 0} and the length of the encoded string respectively. */
Creates a new big-endian buffer whose content is a subregion of the specified string encoded in the specified charset. The new buffer's readerIndex and writerIndex are 0 and the length of the encoded string respectively
copiedBuffer
{ "repo_name": "nyankosama/simple-netty-source", "path": "src/main/java/org/jboss/netty/buffer/impl/ChannelBuffers.java", "license": "apache-2.0", "size": 39250 }
[ "java.nio.charset.Charset", "org.jboss.netty.buffer.ChannelBuffer" ]
import java.nio.charset.Charset; import org.jboss.netty.buffer.ChannelBuffer;
import java.nio.charset.*; import org.jboss.netty.buffer.*;
[ "java.nio", "org.jboss.netty" ]
java.nio; org.jboss.netty;
2,044,523
public void setPersoSelection(PersoSelection p_currentSelection) { if (currentSelection == null || p_currentSelection == null || !p_currentSelection.equals(currentSelection)) { if (currentSelection != null) { currentSelection.unfocus(); } // Focus the given perso (or focus NULL if selection is empty) if (p_currentSelection != null) { List<Perso> persos = p_currentSelection.getElement(); for (Perso perso : persos) { masterFrame.getPersoPanel().focusPerso(perso); } } currentSelection = p_currentSelection; if (currentSelection != null) { currentSelection.focus(); } } }
void function(PersoSelection p_currentSelection) { if (currentSelection == null p_currentSelection == null !p_currentSelection.equals(currentSelection)) { if (currentSelection != null) { currentSelection.unfocus(); } if (p_currentSelection != null) { List<Perso> persos = p_currentSelection.getElement(); for (Perso perso : persos) { masterFrame.getPersoPanel().focusPerso(perso); } } currentSelection = p_currentSelection; if (currentSelection != null) { currentSelection.focus(); } } }
/** * Set the current Perso selection. Three possible situations: * <ul> * <li>user gain focus on a character on the map</li> * <li>user pick a character from the library</li> * <li>user remove the focuses perso</li> * </ul> * * @param p_currentSelection */
Set the current Perso selection. Three possible situations: user gain focus on a character on the map user pick a character from the library user remove the focuses perso
setPersoSelection
{ "repo_name": "tchegito/zildo", "path": "zeditor/src/zeditor/windows/managers/MasterFrameManager.java", "license": "lgpl-3.0", "size": 16509 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,365,645
public void write(BibEntry entry, Writer out, BibDatabaseMode bibDatabaseMode, Boolean reformat) throws IOException { // if the entry has not been modified, write it as it was if (!reformat && !entry.hasChanged()) { out.write(entry.getParsedSerialization()); return; } writeUserComments(entry, out); out.write(OS.NEWLINE); writeRequiredFieldsFirstRemainingFieldsSecond(entry, out, bibDatabaseMode); out.write(OS.NEWLINE); }
void function(BibEntry entry, Writer out, BibDatabaseMode bibDatabaseMode, Boolean reformat) throws IOException { if (!reformat && !entry.hasChanged()) { out.write(entry.getParsedSerialization()); return; } writeUserComments(entry, out); out.write(OS.NEWLINE); writeRequiredFieldsFirstRemainingFieldsSecond(entry, out, bibDatabaseMode); out.write(OS.NEWLINE); }
/** * Writes the given BibEntry using the given writer * * @param entry The entry to write * @param out The writer to use * @param bibDatabaseMode The database mode (bibtex or biblatex) * @param reformat Should the entry be in any case, even if no change occurred? */
Writes the given BibEntry using the given writer
write
{ "repo_name": "ambro2/jabref", "path": "src/main/java/net/sf/jabref/logic/bibtex/BibEntryWriter.java", "license": "gpl-2.0", "size": 7138 }
[ "java.io.IOException", "java.io.Writer", "net.sf.jabref.model.database.BibDatabaseMode", "net.sf.jabref.model.entry.BibEntry" ]
import java.io.IOException; import java.io.Writer; import net.sf.jabref.model.database.BibDatabaseMode; import net.sf.jabref.model.entry.BibEntry;
import java.io.*; import net.sf.jabref.model.database.*; import net.sf.jabref.model.entry.*;
[ "java.io", "net.sf.jabref" ]
java.io; net.sf.jabref;
340,551
public static <TItem> Bson min(final String fieldName, final TItem value) { return new SimpleUpdate<TItem>(fieldName, value, "$min"); }
static <TItem> Bson function(final String fieldName, final TItem value) { return new SimpleUpdate<TItem>(fieldName, value, "$min"); }
/** * Creates an update that sets the value of the field to the given value if the given value is less than the current value of the * field. * * @param fieldName the non-null field name * @param value the value * @param <TItem> the value type * @return the update * @mongodb.driver.manual reference/operator/update/min/ $min */
Creates an update that sets the value of the field to the given value if the given value is less than the current value of the field
min
{ "repo_name": "jsonking/mongo-java-driver", "path": "driver-core/src/main/com/mongodb/client/model/Updates.java", "license": "apache-2.0", "size": 23724 }
[ "org.bson.conversions.Bson" ]
import org.bson.conversions.Bson;
import org.bson.conversions.*;
[ "org.bson.conversions" ]
org.bson.conversions;
622,812
@Test public void testItemInMutipleCollectionsError() throws Exception { User user = getUser(userDao, "testuser"); CollectionItem root = (CollectionItem) contentDao.getRootItem(user); CollectionItem a = new HibCollectionItem(); a.setName("a"); a.setOwner(user); a = contentDao.createCollection(root, a); ContentItem item = generateTestContent(); item.setName("test"); ContentItem newItem = contentDao.createContent(a, item); clearSession(); ContentItem queryItem = (ContentItem) contentDao.findItemByUid(newItem.getUid()); Assert.assertEquals(queryItem.getParents().size(), 1); CollectionItem b = new HibCollectionItem(); b.setName("b"); b.setOwner(user); b = contentDao.createCollection(root, b); ContentItem item2 = generateTestContent(); item2.setName("test"); contentDao.createContent(b, item2); // should get DuplicateItemName here try { contentDao.addItemToCollection(queryItem, b); Assert.fail("able to add item with same name to collection"); } catch (DuplicateItemNameException e) { } }
void function() throws Exception { User user = getUser(userDao, STR); CollectionItem root = (CollectionItem) contentDao.getRootItem(user); CollectionItem a = new HibCollectionItem(); a.setName("a"); a.setOwner(user); a = contentDao.createCollection(root, a); ContentItem item = generateTestContent(); item.setName("test"); ContentItem newItem = contentDao.createContent(a, item); clearSession(); ContentItem queryItem = (ContentItem) contentDao.findItemByUid(newItem.getUid()); Assert.assertEquals(queryItem.getParents().size(), 1); CollectionItem b = new HibCollectionItem(); b.setName("b"); b.setOwner(user); b = contentDao.createCollection(root, b); ContentItem item2 = generateTestContent(); item2.setName("test"); contentDao.createContent(b, item2); try { contentDao.addItemToCollection(queryItem, b); Assert.fail(STR); } catch (DuplicateItemNameException e) { } }
/** * Tests item in multiple collections error. * * @throws Exception * - if something is wrong this exception is thrown. */
Tests item in multiple collections error
testItemInMutipleCollectionsError
{ "repo_name": "1and1/cosmo", "path": "cosmo-core/src/test/unit/java/org/unitedinternet/cosmo/dao/hibernate/HibernateContentDaoTest.java", "license": "apache-2.0", "size": 70706 }
[ "org.junit.Assert", "org.unitedinternet.cosmo.dao.DuplicateItemNameException", "org.unitedinternet.cosmo.model.CollectionItem", "org.unitedinternet.cosmo.model.ContentItem", "org.unitedinternet.cosmo.model.User", "org.unitedinternet.cosmo.model.hibernate.HibCollectionItem" ]
import org.junit.Assert; import org.unitedinternet.cosmo.dao.DuplicateItemNameException; import org.unitedinternet.cosmo.model.CollectionItem; import org.unitedinternet.cosmo.model.ContentItem; import org.unitedinternet.cosmo.model.User; import org.unitedinternet.cosmo.model.hibernate.HibCollectionItem;
import org.junit.*; import org.unitedinternet.cosmo.dao.*; import org.unitedinternet.cosmo.model.*; import org.unitedinternet.cosmo.model.hibernate.*;
[ "org.junit", "org.unitedinternet.cosmo" ]
org.junit; org.unitedinternet.cosmo;
117,566
@Override public ImmutableSet<BuildTarget> findDepsForTargetFromConstructorArgs( BuildTarget buildTarget, Function<Optional<String>, Path> cellRoots, AppleBundleDescription.Arg constructorArg) { if (!constructorArg.deps.isPresent()) { return ImmutableSet.of(); } if (!cxxPlatformFlavorDomain.containsAnyOf(buildTarget.getFlavors())) { buildTarget = BuildTarget.builder(buildTarget).addAllFlavors( ImmutableSet.of(defaultCxxPlatform.getFlavor())).build(); } Optional<FatBinaryInfo> fatBinaryInfo = FatBinaryInfo.create(platformFlavorsToAppleCxxPlatforms, buildTarget); CxxPlatform cxxPlatform; if (fatBinaryInfo.isPresent()) { AppleCxxPlatform appleCxxPlatform = fatBinaryInfo.get().getRepresentativePlatform(); cxxPlatform = appleCxxPlatform.getCxxPlatform(); } else { cxxPlatform = AppleDescriptions.getCxxPlatformForBuildTarget( cxxPlatformFlavorDomain, defaultCxxPlatform, buildTarget); } String platformName = cxxPlatform.getFlavor().getName(); final Flavor actualWatchFlavor; if (ApplePlatform.isSimulator(platformName)) { actualWatchFlavor = ImmutableFlavor.builder().name("watchsimulator-i386").build(); } else if (platformName.startsWith(ApplePlatform.Name.IPHONEOS) || platformName.startsWith(ApplePlatform.Name.WATCHOS)) { actualWatchFlavor = ImmutableFlavor.builder().name("watchos-armv7k").build(); } else { actualWatchFlavor = ImmutableFlavor.builder().name(platformName).build(); } FluentIterable<BuildTarget> depsExcludingBinary = FluentIterable.from(constructorArg.deps.get()) .filter(Predicates.not(Predicates.equalTo(constructorArg.binary))); FluentIterable<BuildTarget> targetsWithPlatformFlavors = depsExcludingBinary.filter( BuildTargets.containsFlavors(cxxPlatformFlavorDomain)); FluentIterable<BuildTarget> targetsWithoutPlatformFlavors = depsExcludingBinary.filter( Predicates.not(BuildTargets.containsFlavors(cxxPlatformFlavorDomain)));
ImmutableSet<BuildTarget> function( BuildTarget buildTarget, Function<Optional<String>, Path> cellRoots, AppleBundleDescription.Arg constructorArg) { if (!constructorArg.deps.isPresent()) { return ImmutableSet.of(); } if (!cxxPlatformFlavorDomain.containsAnyOf(buildTarget.getFlavors())) { buildTarget = BuildTarget.builder(buildTarget).addAllFlavors( ImmutableSet.of(defaultCxxPlatform.getFlavor())).build(); } Optional<FatBinaryInfo> fatBinaryInfo = FatBinaryInfo.create(platformFlavorsToAppleCxxPlatforms, buildTarget); CxxPlatform cxxPlatform; if (fatBinaryInfo.isPresent()) { AppleCxxPlatform appleCxxPlatform = fatBinaryInfo.get().getRepresentativePlatform(); cxxPlatform = appleCxxPlatform.getCxxPlatform(); } else { cxxPlatform = AppleDescriptions.getCxxPlatformForBuildTarget( cxxPlatformFlavorDomain, defaultCxxPlatform, buildTarget); } String platformName = cxxPlatform.getFlavor().getName(); final Flavor actualWatchFlavor; if (ApplePlatform.isSimulator(platformName)) { actualWatchFlavor = ImmutableFlavor.builder().name(STR).build(); } else if (platformName.startsWith(ApplePlatform.Name.IPHONEOS) platformName.startsWith(ApplePlatform.Name.WATCHOS)) { actualWatchFlavor = ImmutableFlavor.builder().name(STR).build(); } else { actualWatchFlavor = ImmutableFlavor.builder().name(platformName).build(); } FluentIterable<BuildTarget> depsExcludingBinary = FluentIterable.from(constructorArg.deps.get()) .filter(Predicates.not(Predicates.equalTo(constructorArg.binary))); FluentIterable<BuildTarget> targetsWithPlatformFlavors = depsExcludingBinary.filter( BuildTargets.containsFlavors(cxxPlatformFlavorDomain)); FluentIterable<BuildTarget> targetsWithoutPlatformFlavors = depsExcludingBinary.filter( Predicates.not(BuildTargets.containsFlavors(cxxPlatformFlavorDomain)));
/** * Propagate the bundle's platform flavors to its dependents. */
Propagate the bundle's platform flavors to its dependents
findDepsForTargetFromConstructorArgs
{ "repo_name": "rhencke/buck", "path": "src/com/facebook/buck/apple/AppleBundleDescription.java", "license": "apache-2.0", "size": 9246 }
[ "com.facebook.buck.cxx.CxxPlatform", "com.facebook.buck.model.BuildTarget", "com.facebook.buck.model.BuildTargets", "com.facebook.buck.model.Flavor", "com.facebook.buck.model.ImmutableFlavor", "com.google.common.base.Function", "com.google.common.base.Optional", "com.google.common.base.Predicates", "com.google.common.collect.FluentIterable", "com.google.common.collect.ImmutableSet", "java.nio.file.Path" ]
import com.facebook.buck.cxx.CxxPlatform; import com.facebook.buck.model.BuildTarget; import com.facebook.buck.model.BuildTargets; import com.facebook.buck.model.Flavor; import com.facebook.buck.model.ImmutableFlavor; import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.base.Predicates; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableSet; import java.nio.file.Path;
import com.facebook.buck.cxx.*; import com.facebook.buck.model.*; import com.google.common.base.*; import com.google.common.collect.*; import java.nio.file.*;
[ "com.facebook.buck", "com.google.common", "java.nio" ]
com.facebook.buck; com.google.common; java.nio;
866,794
public T lzf() { LZFDataFormat lzfdf = new LZFDataFormat(); return dataFormat(lzfdf); }
T function() { LZFDataFormat lzfdf = new LZFDataFormat(); return dataFormat(lzfdf); }
/** * Uses the LZF deflater data format */
Uses the LZF deflater data format
lzf
{ "repo_name": "sebi-hgdata/camel", "path": "camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java", "license": "apache-2.0", "size": 38206 }
[ "org.apache.camel.model.dataformat.LZFDataFormat" ]
import org.apache.camel.model.dataformat.LZFDataFormat;
import org.apache.camel.model.dataformat.*;
[ "org.apache.camel" ]
org.apache.camel;
1,009,145
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Screen screen = null; WebSession mySession = null; try { // System.out.println( "HH Entering doPost: " ); // System.out.println( " - HH request " + request); // System.out.println( " - HH principle: " + // request.getUserPrincipal() ); // setCacheHeaders(response, 0); ServletContext context = getServletContext(); // FIXME: If a response is written by updateSession(), do not // call makeScreen() and writeScreen() mySession = updateSession(request, response, context); if (response.isCommitted()) return; // Note: For the lesson to track the status, we need to update // the lesson tracker object // from the screen.createContent() method. The create content is // the only point // where the lesson "knows" what has happened. To track it at a // latter point would // require the lesson to have memory. screen = makeScreen(mySession); // This calls the lesson's // handleRequest() if (response.isCommitted()) return; // perform lesson-specific tracking activities if (screen instanceof AbstractLesson) { AbstractLesson lesson = (AbstractLesson) screen; // we do not count the initial display of the lesson screen as a visit if ("GET".equals(request.getMethod())) { String uri = request.getRequestURI() + "?" + request.getQueryString(); if (!uri.endsWith(lesson.getLink())) screen.getLessonTracker(mySession).incrementNumVisits(); } else if ("POST".equals(request.getMethod()) && mySession.getPreviousScreen() == mySession.getCurrentScreen()) { screen.getLessonTracker(mySession).incrementNumVisits(); } } // log the access to this screen for this user UserTracker userTracker = UserTracker.instance(); userTracker.update(mySession, screen); log(request, screen.getClass().getName() + " | " + mySession.getParser().toString()); // Redirect the request to our View servlet String userAgent = request.getHeader("user-agent"); String clientBrowser = "Not known!"; if (userAgent != null) { clientBrowser = userAgent; } request.setAttribute("client.browser", clientBrowser); request.getSession().setAttribute("websession", mySession); request.getSession().setAttribute("course", mySession.getCourse()); request.getRequestDispatcher(getViewPage(mySession)).forward(request, response); } catch (Throwable t) { t.printStackTrace(); log("ERROR: " + t); screen = new ErrorScreen(mySession, t); } finally { try { this.writeScreen(mySession, screen, response); } catch (Throwable thr) { thr.printStackTrace(); log(request, "Could not write error screen: " + thr.getMessage()); } WebSession.returnConnection(mySession); // System.out.println( "HH Leaving doPost: " ); } }
void function(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { Screen screen = null; WebSession mySession = null; try { ServletContext context = getServletContext(); mySession = updateSession(request, response, context); if (response.isCommitted()) return; screen = makeScreen(mySession); if (response.isCommitted()) return; if (screen instanceof AbstractLesson) { AbstractLesson lesson = (AbstractLesson) screen; if ("GET".equals(request.getMethod())) { String uri = request.getRequestURI() + "?" + request.getQueryString(); if (!uri.endsWith(lesson.getLink())) screen.getLessonTracker(mySession).incrementNumVisits(); } else if ("POST".equals(request.getMethod()) && mySession.getPreviousScreen() == mySession.getCurrentScreen()) { screen.getLessonTracker(mySession).incrementNumVisits(); } } UserTracker userTracker = UserTracker.instance(); userTracker.update(mySession, screen); log(request, screen.getClass().getName() + " " + mySession.getParser().toString()); String userAgent = request.getHeader(STR); String clientBrowser = STR; if (userAgent != null) { clientBrowser = userAgent; } request.setAttribute(STR, clientBrowser); request.getSession().setAttribute(STR, mySession); request.getSession().setAttribute(STR, mySession.getCourse()); request.getRequestDispatcher(getViewPage(mySession)).forward(request, response); } catch (Throwable t) { t.printStackTrace(); log(STR + t); screen = new ErrorScreen(mySession, t); } finally { try { this.writeScreen(mySession, screen, response); } catch (Throwable thr) { thr.printStackTrace(); log(request, STR + thr.getMessage()); } WebSession.returnConnection(mySession); } }
/** * Description of the Method * * @param request * Description of the Parameter * @param response * Description of the Parameter * @exception IOException * Description of the Exception * @exception ServletException * Description of the Exception */
Description of the Method
doPost
{ "repo_name": "paulnguyen/cmpe279", "path": "eclipse/Webgoat/src/org/owasp/webgoat/HammerHead.java", "license": "apache-2.0", "size": 14588 }
[ "java.io.IOException", "javax.servlet.ServletContext", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.owasp.webgoat.lessons.AbstractLesson", "org.owasp.webgoat.session.ErrorScreen", "org.owasp.webgoat.session.Screen", "org.owasp.webgoat.session.UserTracker", "org.owasp.webgoat.session.WebSession" ]
import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.owasp.webgoat.lessons.AbstractLesson; import org.owasp.webgoat.session.ErrorScreen; import org.owasp.webgoat.session.Screen; import org.owasp.webgoat.session.UserTracker; import org.owasp.webgoat.session.WebSession;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import org.owasp.webgoat.lessons.*; import org.owasp.webgoat.session.*;
[ "java.io", "javax.servlet", "org.owasp.webgoat" ]
java.io; javax.servlet; org.owasp.webgoat;
2,157,775
public void writeConflicts(final Context geogig, Iterator<Conflict> conflicts, final ObjectId ours, final ObjectId theirs) throws StreamWriterException { writeConflicts(geogig, conflicts, ours, theirs, false); }
void function(final Context geogig, Iterator<Conflict> conflicts, final ObjectId ours, final ObjectId theirs) throws StreamWriterException { writeConflicts(geogig, conflicts, ours, theirs, false); }
/** * Writes the response for a set of conflicts while also supplying the geometry. * * @param geogig - a CommandLocator to call commands from * @param conflicts - a Conflict iterator to build the response from * @throws StreamWriterException */
Writes the response for a set of conflicts while also supplying the geometry
writeConflicts
{ "repo_name": "jdgarrett/geogig", "path": "src/web/api/src/main/java/org/locationtech/geogig/web/api/ResponseWriter.java", "license": "bsd-3-clause", "size": 62609 }
[ "java.util.Iterator", "org.locationtech.geogig.model.ObjectId", "org.locationtech.geogig.repository.Conflict", "org.locationtech.geogig.repository.Context" ]
import java.util.Iterator; import org.locationtech.geogig.model.ObjectId; import org.locationtech.geogig.repository.Conflict; import org.locationtech.geogig.repository.Context;
import java.util.*; import org.locationtech.geogig.model.*; import org.locationtech.geogig.repository.*;
[ "java.util", "org.locationtech.geogig" ]
java.util; org.locationtech.geogig;
1,773,292
private static String formatSimple(ChannelHandlerContext ctx, String eventName, Object msg) { String chStr = ctx.channel().toString(); String msgStr = String.valueOf(msg); StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length()); return buf.append(chStr).append(' ').append(eventName).append(": ").append(msgStr).toString(); }
static String function(ChannelHandlerContext ctx, String eventName, Object msg) { String chStr = ctx.channel().toString(); String msgStr = String.valueOf(msg); StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length()); return buf.append(chStr).append(' ').append(eventName).append(STR).append(msgStr).toString(); }
/** * Generates the default log message of the specified event whose argument is an arbitrary object. */
Generates the default log message of the specified event whose argument is an arbitrary object
formatSimple
{ "repo_name": "florianerhard/gedi", "path": "GediRemote/src/gedi/remote/ConfigLoggingHandler.java", "license": "apache-2.0", "size": 18725 }
[ "io.netty.channel.ChannelHandlerContext" ]
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.*;
[ "io.netty.channel" ]
io.netty.channel;
1,300,158
private void tryConnect( final RoutedRequest req, final HttpContext context) throws HttpException, IOException { HttpRoute route = req.getRoute(); int connectCount = 0; for (;;) { // Increment connect count connectCount++; try { if (!managedConn.isOpen()) { managedConn.open(route, context, params); } else { managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params)); } establishRoute(route, context); break; } catch (IOException ex) { try { managedConn.close(); } catch (IOException ignore) { } if (retryHandler.retryRequest(ex, connectCount, context)) { if (DEBUG) { logger.debug("I/O exception ({}) caught when connecting to the target host: {}", ex.getClass().getName(), ex.getMessage()); logger.debug(ex.getMessage(), ex); logger.debug("Retrying connect"); } } else { throw ex; } } } }
void function( final RoutedRequest req, final HttpContext context) throws HttpException, IOException { HttpRoute route = req.getRoute(); int connectCount = 0; for (;;) { connectCount++; try { if (!managedConn.isOpen()) { managedConn.open(route, context, params); } else { managedConn.setSocketTimeout(HttpConnectionParams.getSoTimeout(params)); } establishRoute(route, context); break; } catch (IOException ex) { try { managedConn.close(); } catch (IOException ignore) { } if (retryHandler.retryRequest(ex, connectCount, context)) { if (DEBUG) { logger.debug(STR, ex.getClass().getName(), ex.getMessage()); logger.debug(ex.getMessage(), ex); logger.debug(STR); } } else { throw ex; } } } }
/** * Establish connection either directly or through a tunnel and retry in case of * a recoverable I/O failure */
Establish connection either directly or through a tunnel and retry in case of a recoverable I/O failure
tryConnect
{ "repo_name": "cattong/WidgetLibrary", "path": "src/com/shejiaomao/core/http/LibRequestDirector.java", "license": "apache-2.0", "size": 43477 }
[ "java.io.IOException", "org.apache.http.HttpException", "org.apache.http.conn.routing.HttpRoute", "org.apache.http.impl.client.RoutedRequest", "org.apache.http.params.HttpConnectionParams", "org.apache.http.protocol.HttpContext" ]
import java.io.IOException; import org.apache.http.HttpException; import org.apache.http.conn.routing.HttpRoute; import org.apache.http.impl.client.RoutedRequest; import org.apache.http.params.HttpConnectionParams; import org.apache.http.protocol.HttpContext;
import java.io.*; import org.apache.http.*; import org.apache.http.conn.routing.*; import org.apache.http.impl.client.*; import org.apache.http.params.*; import org.apache.http.protocol.*;
[ "java.io", "org.apache.http" ]
java.io; org.apache.http;
2,031,289
public void addGroupToUser(Group group, User user) { Set<String> groupSet = user.getGroups() == null ? new HashSet<String>() : user.getGroups(); groupSet.add(group.getId()); user.setGroups(groupSet); if (CollectionUtils.isNotEmpty(group.getRoles())) { Set<String> groupRolesSet = user.getGroupRoles() == null ? new HashSet<String>() : user.getGroupRoles(); groupRolesSet.addAll(group.getRoles()); user.setGroupRoles(groupRolesSet); } alienUserDao.save(user); }
void function(Group group, User user) { Set<String> groupSet = user.getGroups() == null ? new HashSet<String>() : user.getGroups(); groupSet.add(group.getId()); user.setGroups(groupSet); if (CollectionUtils.isNotEmpty(group.getRoles())) { Set<String> groupRolesSet = user.getGroupRoles() == null ? new HashSet<String>() : user.getGroupRoles(); groupRolesSet.addAll(group.getRoles()); user.setGroupRoles(groupRolesSet); } alienUserDao.save(user); }
/** * Add a group to a user, including all the group roles * * @param group The group to process * @param user The user to process */
Add a group to a user, including all the group roles
addGroupToUser
{ "repo_name": "broly-git/alien4cloud", "path": "alien4cloud-security/src/main/java/alien4cloud/security/users/UserService.java", "license": "apache-2.0", "size": 8794 }
[ "java.util.HashSet", "java.util.Set", "org.apache.commons.collections4.CollectionUtils" ]
import java.util.HashSet; import java.util.Set; import org.apache.commons.collections4.CollectionUtils;
import java.util.*; import org.apache.commons.collections4.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
2,881,465
@Generated @StructureField(order = 2, isGetter = false) public native void setImr_ifindex(int value);
@StructureField(order = 2, isGetter = false) native void function(int value);
/** * Interface index; cast to uint32_t */
Interface index; cast to uint32_t
setImr_ifindex
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/struct/ip_mreqn.java", "license": "apache-2.0", "size": 2489 }
[ "org.moe.natj.c.ann.StructureField" ]
import org.moe.natj.c.ann.StructureField;
import org.moe.natj.c.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
1,623,425