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 static Locale getOfbizLocaleArgOrCurrent(List<?> args, String key, int position, Environment env) throws TemplateModelException {
Locale locale = getOfbizLocaleArg(getModel(args, key, position));
return (locale != null) ? locale : ContextFtlUtil.getCurrentLocale(env);
} | static Locale function(List<?> args, String key, int position, Environment env) throws TemplateModelException { Locale locale = getOfbizLocaleArg(getModel(args, key, position)); return (locale != null) ? locale : ContextFtlUtil.getCurrentLocale(env); } | /**
* Special handler that tries to read a locale arg and if not present gets it from context locale,
* or falls back on request if present (abstracted method, behavior could change).
*/ | Special handler that tries to read a locale arg and if not present gets it from context locale, or falls back on request if present (abstracted method, behavior could change) | getOfbizLocaleArgOrCurrent | {
"repo_name": "ilscipio/scipio-erp",
"path": "framework/webapp/src/com/ilscipio/scipio/ce/webapp/ftl/context/TransformUtil.java",
"license": "apache-2.0",
"size": 32646
} | [
"freemarker.core.Environment",
"freemarker.template.TemplateModelException",
"java.util.List",
"java.util.Locale"
] | import freemarker.core.Environment; import freemarker.template.TemplateModelException; import java.util.List; import java.util.Locale; | import freemarker.core.*; import freemarker.template.*; import java.util.*; | [
"freemarker.core",
"freemarker.template",
"java.util"
] | freemarker.core; freemarker.template; java.util; | 2,671,465 |
public String[] getServlets() {
String[] result = null;
Container[] children = findChildren();
if (children != null) {
result = new String[children.length];
for( int i=0; i< children.length; i++ ) {
result[i] = children[i].getObjectName().toString();
}
}
return result;
}
| String[] function() { String[] result = null; Container[] children = findChildren(); if (children != null) { result = new String[children.length]; for( int i=0; i< children.length; i++ ) { result[i] = children[i].getObjectName().toString(); } } return result; } | /**
* JSR77 servlets attribute
*
* @return list of all servlets ( we know about )
*/ | JSR77 servlets attribute | getServlets | {
"repo_name": "WhiteBearSolutions/WBSAirback",
"path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/catalina/core/StandardContext.java",
"license": "apache-2.0",
"size": 198551
} | [
"org.apache.catalina.Container"
] | import org.apache.catalina.Container; | import org.apache.catalina.*; | [
"org.apache.catalina"
] | org.apache.catalina; | 1,555,225 |
Collection<ICab2bQuery> getUsersQueriesDetail(String serializedDCR) throws RemoteException;
| Collection<ICab2bQuery> getUsersQueriesDetail(String serializedDCR) throws RemoteException; | /**
* This method returns all the queries with only their name and description populated.
*
* @return list of IParameterizedQuery having only their name and description populated
* @throws RemoteException if retrieving fails
*/ | This method returns all the queries with only their name and description populated | getUsersQueriesDetail | {
"repo_name": "NCIP/cab2b",
"path": "software/cab2b/src/java/common/edu/wustl/cab2b/common/ejb/queryengine/QueryEngineBusinessInterface.java",
"license": "bsd-3-clause",
"size": 3953
} | [
"edu.wustl.cab2b.common.queryengine.ICab2bQuery",
"java.rmi.RemoteException",
"java.util.Collection"
] | import edu.wustl.cab2b.common.queryengine.ICab2bQuery; import java.rmi.RemoteException; import java.util.Collection; | import edu.wustl.cab2b.common.queryengine.*; import java.rmi.*; import java.util.*; | [
"edu.wustl.cab2b",
"java.rmi",
"java.util"
] | edu.wustl.cab2b; java.rmi; java.util; | 2,336,649 |
private static boolean cancelPotentialDownload(String url, ImageView imageView) {
BitmapDownloaderTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView);
if (bitmapDownloaderTask != null) {
String bitmapUrl = bitmapDownloaderTask.url;
if ((bitmapUrl == null) || (!bitmapUrl.equals(url))) {
bitmapDownloaderTask.cancel(true);
} else {
// The same URL is already being downloaded.
return false;
}
}
return true;
} | static boolean function(String url, ImageView imageView) { BitmapDownloaderTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView); if (bitmapDownloaderTask != null) { String bitmapUrl = bitmapDownloaderTask.url; if ((bitmapUrl == null) (!bitmapUrl.equals(url))) { bitmapDownloaderTask.cancel(true); } else { return false; } } return true; } | /**
* Returns true if the current download has been canceled or if there was no download in
* progress on this image view.
* Returns false if the download in progress deals with the same url. The download is not
* stopped in that case.
*/ | Returns true if the current download has been canceled or if there was no download in progress on this image view. Returns false if the download in progress deals with the same url. The download is not stopped in that case | cancelPotentialDownload | {
"repo_name": "JasonBrannon/GoVRE",
"path": "Android/src/com/echo5bravo/govre/UTILS/ImageDownloader.java",
"license": "mit",
"size": 15159
} | [
"android.widget.ImageView"
] | import android.widget.ImageView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 1,932,025 |
public List<ByteBuffer> getCommitted() {
return committed;
} | List<ByteBuffer> function() { return committed; } | /**
* Returns the committed buffers.
* @return the committed
*/ | Returns the committed buffers | getCommitted | {
"repo_name": "asakusafw/asakusafw-compiler",
"path": "vanilla/runtime/core/src/main/java/com/asakusafw/vanilla/core/mirror/MockDataChannel.java",
"license": "apache-2.0",
"size": 1751
} | [
"java.nio.ByteBuffer",
"java.util.List"
] | import java.nio.ByteBuffer; import java.util.List; | import java.nio.*; import java.util.*; | [
"java.nio",
"java.util"
] | java.nio; java.util; | 818,245 |
private JPanel getGrouperButtonPanel() {
if (grouperButtonPanel == null) {
GridBagConstraints gridBagConstraints20 = new GridBagConstraints();
gridBagConstraints20.gridx = 0;
gridBagConstraints20.insets = new Insets(2, 2, 2, 2);
gridBagConstraints20.gridy = 1;
GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
gridBagConstraints19.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints19.gridx = 0;
gridBagConstraints19.gridy = 0;
gridBagConstraints19.insets = new Insets(2, 2, 2, 2);
gridBagConstraints19.weightx = 1.0;
grouperButtonPanel = new JPanel();
grouperButtonPanel.setLayout(new GridBagLayout());
grouperButtonPanel.setBorder(BorderFactory.createTitledBorder(null,
"Load Grid Grouper", TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, new Font("Dialog",
Font.BOLD, 12), new Color(62, 109, 181)));
grouperButtonPanel.add(getGridGrouperURI(), gridBagConstraints19);
grouperButtonPanel.add(getLoadGridGrouper(), gridBagConstraints20);
}
return grouperButtonPanel;
} | JPanel function() { if (grouperButtonPanel == null) { GridBagConstraints gridBagConstraints20 = new GridBagConstraints(); gridBagConstraints20.gridx = 0; gridBagConstraints20.insets = new Insets(2, 2, 2, 2); gridBagConstraints20.gridy = 1; GridBagConstraints gridBagConstraints19 = new GridBagConstraints(); gridBagConstraints19.fill = GridBagConstraints.HORIZONTAL; gridBagConstraints19.gridx = 0; gridBagConstraints19.gridy = 0; gridBagConstraints19.insets = new Insets(2, 2, 2, 2); gridBagConstraints19.weightx = 1.0; grouperButtonPanel = new JPanel(); grouperButtonPanel.setLayout(new GridBagLayout()); grouperButtonPanel.setBorder(BorderFactory.createTitledBorder(null, STR, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font(STR, Font.BOLD, 12), new Color(62, 109, 181))); grouperButtonPanel.add(getGridGrouperURI(), gridBagConstraints19); grouperButtonPanel.add(getLoadGridGrouper(), gridBagConstraints20); } return grouperButtonPanel; } | /**
* This method initializes grouperButtonPanel
*
* @return javax.swing.JPanel
*/ | This method initializes grouperButtonPanel | getGrouperButtonPanel | {
"repo_name": "NCIP/cagrid",
"path": "cagrid/Software/core/caGrid/projects/gaards-ui/src/org/cagrid/gaards/ui/gridgrouper/expressioneditor/GridGrouperExpressionEditor.java",
"license": "bsd-3-clause",
"size": 27901
} | [
"java.awt.Color",
"java.awt.Font",
"java.awt.GridBagConstraints",
"java.awt.GridBagLayout",
"java.awt.Insets",
"javax.swing.BorderFactory",
"javax.swing.JPanel",
"javax.swing.border.TitledBorder"
] | import java.awt.Color; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.border.TitledBorder; | import java.awt.*; import javax.swing.*; import javax.swing.border.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 237,540 |
@Override
public void translate(final ITranslationEnvironment environment, final IInstruction instruction,
final List<ReilInstruction> instructions) throws InternalTranslationException {
TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "UMAAL");
translateAll(environment, instruction, "UMAAL", instructions);
} | void function(final ITranslationEnvironment environment, final IInstruction instruction, final List<ReilInstruction> instructions) throws InternalTranslationException { TranslationHelpers.checkTranslationArguments(environment, instruction, instructions, "UMAAL"); translateAll(environment, instruction, "UMAAL", instructions); } | /**
* UMAAL{<cond>} <RdLo>, <RdHi>, <Rm>, <Rs>
*
* Operation:
*
* if ConditionPassed(cond) then result = Rm * Rs + RdLo + RdHi // Unsigned multiplication and
* additions RdLo = result[31:0] RdHi = result[63:32]
*/ | UMAAL{} , , , Operation: if ConditionPassed(cond) then result = Rm * Rs + RdLo + RdHi // Unsigned multiplication and additions RdLo = result[31:0] RdHi = result[63:32] | translate | {
"repo_name": "guiquanz/binnavi",
"path": "src/main/java/com/google/security/zynamics/reil/translators/arm/ARMUmaalTranslator.java",
"license": "apache-2.0",
"size": 3830
} | [
"com.google.security.zynamics.reil.ReilInstruction",
"com.google.security.zynamics.reil.translators.ITranslationEnvironment",
"com.google.security.zynamics.reil.translators.InternalTranslationException",
"com.google.security.zynamics.reil.translators.TranslationHelpers",
"com.google.security.zynamics.zylib.disassembly.IInstruction",
"java.util.List"
] | import com.google.security.zynamics.reil.ReilInstruction; import com.google.security.zynamics.reil.translators.ITranslationEnvironment; import com.google.security.zynamics.reil.translators.InternalTranslationException; import com.google.security.zynamics.reil.translators.TranslationHelpers; import com.google.security.zynamics.zylib.disassembly.IInstruction; import java.util.List; | import com.google.security.zynamics.reil.*; import com.google.security.zynamics.reil.translators.*; import com.google.security.zynamics.zylib.disassembly.*; import java.util.*; | [
"com.google.security",
"java.util"
] | com.google.security; java.util; | 66,428 |
public void doLocalUpdate()
{
if (this.targetLocation == null)
{
this.targetLocation = new Vec3d(this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION));
}
if (this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ) < 1.0D)
{
((PhaseSittingFlaming)this.dragon.getPhaseManager().getPhase(PhaseList.SITTING_FLAMING)).resetFlameCount();
this.dragon.getPhaseManager().setPhase(PhaseList.SITTING_SCANNING);
}
} | void function() { if (this.targetLocation == null) { this.targetLocation = new Vec3d(this.dragon.worldObj.getTopSolidOrLiquidBlock(WorldGenEndPodium.END_PODIUM_LOCATION)); } if (this.targetLocation.squareDistanceTo(this.dragon.posX, this.dragon.posY, this.dragon.posZ) < 1.0D) { ((PhaseSittingFlaming)this.dragon.getPhaseManager().getPhase(PhaseList.SITTING_FLAMING)).resetFlameCount(); this.dragon.getPhaseManager().setPhase(PhaseList.SITTING_SCANNING); } } | /**
* Gives the phase a chance to update its status.
* Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote.
*/ | Gives the phase a chance to update its status. Called by dragon's onLivingUpdate. Only used when !worldObj.isRemote | doLocalUpdate | {
"repo_name": "MartyParty21/AwakenDreamsClient",
"path": "mcp/src/minecraft/net/minecraft/entity/boss/dragon/phase/PhaseLanding.java",
"license": "gpl-3.0",
"size": 3172
} | [
"net.minecraft.util.math.Vec3d",
"net.minecraft.world.gen.feature.WorldGenEndPodium"
] | import net.minecraft.util.math.Vec3d; import net.minecraft.world.gen.feature.WorldGenEndPodium; | import net.minecraft.util.math.*; import net.minecraft.world.gen.feature.*; | [
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.util; net.minecraft.world; | 2,574,099 |
default byte[] getBytes(int columnIndex) {
// TODO check that "if the value is SQL NULL, the value returned is null" is correctly implemented
throw ExceptionFactory.createException(CJOperationNotSupportedException.class, Messages.getString("OperationNotSupportedException.0"));
} | default byte[] getBytes(int columnIndex) { throw ExceptionFactory.createException(CJOperationNotSupportedException.class, Messages.getString(STR)); } | /**
* Returns the value at the given column as a byte array.
* The bytes represent the raw values returned by the server.
*
* @param columnIndex
* index of column (starting at 0) to return from.
* @return the value for the given column; if the value is SQL <code>NULL</code>, the value returned is <code>null</code>
*/ | Returns the value at the given column as a byte array. The bytes represent the raw values returned by the server | getBytes | {
"repo_name": "ac2cz/FoxTelem",
"path": "lib/mysql-connector-java-8.0.13/src/main/core-api/java/com/mysql/cj/result/Row.java",
"license": "gpl-3.0",
"size": 4589
} | [
"com.mysql.cj.Messages",
"com.mysql.cj.exceptions.CJOperationNotSupportedException",
"com.mysql.cj.exceptions.ExceptionFactory"
] | import com.mysql.cj.Messages; import com.mysql.cj.exceptions.CJOperationNotSupportedException; import com.mysql.cj.exceptions.ExceptionFactory; | import com.mysql.cj.*; import com.mysql.cj.exceptions.*; | [
"com.mysql.cj"
] | com.mysql.cj; | 2,312,093 |
protected DTO findByCode(String code) throws InstanceNotFoundException {
return toDTO(getIntegrationEntityDAO().findByCode(code));
} | DTO function(String code) throws InstanceNotFoundException { return toDTO(getIntegrationEntityDAO().findByCode(code)); } | /**
* Returns a DTO searching by code. This will be useful for all REST
* services of IntegrationEntities
*
* @param code
* this is the code for the element which will be searched
* @return DTO which represents the IntegrationEntity with this code
* @throws InstanceNotFoundException
* If entity with this code is not found
*/ | Returns a DTO searching by code. This will be useful for all REST services of IntegrationEntities | findByCode | {
"repo_name": "bolobr/IEBT-Libreplan",
"path": "libreplan-webapp/src/main/java/org/libreplan/ws/common/impl/GenericRESTService.java",
"license": "agpl-3.0",
"size": 8401
} | [
"org.libreplan.business.common.exceptions.InstanceNotFoundException"
] | import org.libreplan.business.common.exceptions.InstanceNotFoundException; | import org.libreplan.business.common.exceptions.*; | [
"org.libreplan.business"
] | org.libreplan.business; | 1,180,515 |
public void createApp()
{
// Create and set up the window
m_appFrame = new JFrame("WordFinder");
m_appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
m_appFrame.addComponentListener(this);
// Set the window size and center it
m_appFrame.setMinimumSize(new Dimension(300, 300));
m_appFrame.setPreferredSize(new Dimension(800, 600));
m_appFrame.setSize(new Dimension(800, 600));
centerOnScreen();
// Generate the GUI and add it to the frame
buildUI();
// Display the window
m_appFrame.pack();
m_appFrame.setVisible(true);
tfWord.requestFocusInWindow();
}
| void function() { m_appFrame = new JFrame(STR); m_appFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); m_appFrame.addComponentListener(this); m_appFrame.setMinimumSize(new Dimension(300, 300)); m_appFrame.setPreferredSize(new Dimension(800, 600)); m_appFrame.setSize(new Dimension(800, 600)); centerOnScreen(); buildUI(); m_appFrame.pack(); m_appFrame.setVisible(true); tfWord.requestFocusInWindow(); } | /**
* Create the application's GUI.
*/ | Create the application's GUI | createApp | {
"repo_name": "argonium/wordfinder",
"path": "src/io/miti/wordfinder/WordFinder.java",
"license": "mit",
"size": 35487
} | [
"java.awt.Dimension",
"javax.swing.JFrame"
] | import java.awt.Dimension; import javax.swing.JFrame; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,114,901 |
public void setIsotopePattern(final IsotopePattern pattern) {
isotopePattern = pattern;
} | void function(final IsotopePattern pattern) { isotopePattern = pattern; } | /**
* Sets the isotope pattern of this compound.
*
* @param pattern the isotope pattern.
*/ | Sets the isotope pattern of this compound | setIsotopePattern | {
"repo_name": "tomas-pluskal/mzmine3",
"path": "src/main/java/io/github/mzmine/modules/dataprocessing/id_onlinecompounddb/DBCompound.java",
"license": "gpl-2.0",
"size": 3519
} | [
"io.github.mzmine.datamodel.IsotopePattern"
] | import io.github.mzmine.datamodel.IsotopePattern; | import io.github.mzmine.datamodel.*; | [
"io.github.mzmine"
] | io.github.mzmine; | 2,822,179 |
public Node toNode(Document doc, Object o, short type) throws PageException; | Node function(Document doc, Object o, short type) throws PageException; | /**
* casts a value to a XML Object defined by type parameter
* @param doc XML Document
* @param o Object to cast
* @param type type to cast to
* @return XML Text Object
* @throws PageException
*/ | casts a value to a XML Object defined by type parameter | toNode | {
"repo_name": "lucee/unoffical-Lucee-no-jre",
"path": "source/java/loader/src/lucee/runtime/util/XMLUtil.java",
"license": "lgpl-2.1",
"size": 10306
} | [
"org.w3c.dom.Document",
"org.w3c.dom.Node"
] | import org.w3c.dom.Document; import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 405,574 |
private boolean checkRangeOfPercentage(CssKeyNode node, float percentage) {
// check whether the percentage is between 0% and 100%
if (percentage < 0 || percentage > 100) {
errorManager.report(new GssError(WRONG_KEY_VALUE_ERROR_MESSAGE,
node.getSourceCodeLocation()));
return false;
}
return true;
} | boolean function(CssKeyNode node, float percentage) { if (percentage < 0 percentage > 100) { errorManager.report(new GssError(WRONG_KEY_VALUE_ERROR_MESSAGE, node.getSourceCodeLocation())); return false; } return true; } | /**
* Checks if the percentage is between 0% and 100% inclusive.
*
* @param node The {@link CssKeyNode} to get the location in case of an error
* @param percentage The value represented as a float
* @return Returns true if there is no error
*/ | Checks if the percentage is between 0% and 100% inclusive | checkRangeOfPercentage | {
"repo_name": "buntarb/closure-stylesheets",
"path": "src/com/google/common/css/compiler/passes/ProcessKeyframes.java",
"license": "apache-2.0",
"size": 5425
} | [
"com.google.common.css.compiler.ast.CssKeyNode",
"com.google.common.css.compiler.ast.GssError"
] | import com.google.common.css.compiler.ast.CssKeyNode; import com.google.common.css.compiler.ast.GssError; | import com.google.common.css.compiler.ast.*; | [
"com.google.common"
] | com.google.common; | 1,287,817 |
public void unlockTable(Connection con, String table) throws SQLException
{
} | void function(Connection con, String table) throws SQLException { } | /**
* Unlocks the specified table.
*
* @param con The JDBC connection to use.
* @param table The name of the table to unlock.
* @exception SQLException No Statement could be created or executed.
*/ | Unlocks the specified table | unlockTable | {
"repo_name": "besom/bbossgroups-mvn",
"path": "bboss_persistent/src/main/java/com/frameworkset/orm/adapter/DBPostgres.java",
"license": "apache-2.0",
"size": 5723
} | [
"java.sql.Connection",
"java.sql.SQLException"
] | import java.sql.Connection; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,637,648 |
private void initNotificationBuilder(Context context) {
// inti builder.
mNotificationBuilder = new NotificationCompat.Builder(context);
mNotificationView = new RemoteViews(context.getPackageName(),
R.layout.simple_sound_cloud_notification);
mNotificationExpandedView = new RemoteViews(context.getPackageName(),
R.layout.simple_sound_cloud_notification_expanded);
// add right icon on Lollipop.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
addSmallIcon(mNotificationView);
addSmallIcon(mNotificationExpandedView);
}
// set pending intents
mNotificationView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent);
mNotificationExpandedView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent);
mNotificationView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_next, mNextPendingIntent);
mNotificationExpandedView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_next, mNextPendingIntent);
mNotificationView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent);
mNotificationExpandedView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent);
mNotificationView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_clear, mClearPendingIntent);
mNotificationExpandedView.setOnClickPendingIntent(
R.id.simple_sound_cloud_notification_clear, mClearPendingIntent);
// add icon for action bar.
mNotificationBuilder.setSmallIcon(mNotificationConfig.getNotificationIcon());
// set the remote view.
mNotificationBuilder.setContent(mNotificationView);
// set the notification priority.
mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH);
// set the content intent.
Class<?> playerActivity = mNotificationConfig.getNotificationActivity();
if (playerActivity != null) {
Intent i = new Intent(context, playerActivity);
PendingIntent contentIntent = PendingIntent.getActivity(context, REQUEST_DISPLAYING_CONTROLLER,
i, PendingIntent.FLAG_UPDATE_CURRENT);
mNotificationBuilder.setContentIntent(contentIntent);
}
}
/**
* Build the notification with the internal {@link android.app.Notification.Builder} | void function(Context context) { mNotificationBuilder = new NotificationCompat.Builder(context); mNotificationView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification); mNotificationExpandedView = new RemoteViews(context.getPackageName(), R.layout.simple_sound_cloud_notification_expanded); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { addSmallIcon(mNotificationView); addSmallIcon(mNotificationExpandedView); } mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_previous, mPreviousPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_next, mNextPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_play, mTogglePlaybackPendingIntent); mNotificationView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); mNotificationExpandedView.setOnClickPendingIntent( R.id.simple_sound_cloud_notification_clear, mClearPendingIntent); mNotificationBuilder.setSmallIcon(mNotificationConfig.getNotificationIcon()); mNotificationBuilder.setContent(mNotificationView); mNotificationBuilder.setPriority(NotificationCompat.PRIORITY_HIGH); Class<?> playerActivity = mNotificationConfig.getNotificationActivity(); if (playerActivity != null) { Intent i = new Intent(context, playerActivity); PendingIntent contentIntent = PendingIntent.getActivity(context, REQUEST_DISPLAYING_CONTROLLER, i, PendingIntent.FLAG_UPDATE_CURRENT); mNotificationBuilder.setContentIntent(contentIntent); } } /** * Build the notification with the internal {@link android.app.Notification.Builder} | /**
* Init all static components of the notification.
*
* @param context context used to instantiate the builder.
*/ | Init all static components of the notification | initNotificationBuilder | {
"repo_name": "duck-duck-go/Soundcloud-and-YouTube",
"path": "library/src/main/java/fr/tvbarthel/cheerleader/library/player/NotificationManager.java",
"license": "apache-2.0",
"size": 13988
} | [
"android.app.Notification",
"android.app.PendingIntent",
"android.content.Context",
"android.content.Intent",
"android.os.Build",
"android.support.v4.app.NotificationCompat",
"android.widget.RemoteViews"
] | import android.app.Notification; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.os.Build; import android.support.v4.app.NotificationCompat; import android.widget.RemoteViews; | import android.app.*; import android.content.*; import android.os.*; import android.support.v4.app.*; import android.widget.*; | [
"android.app",
"android.content",
"android.os",
"android.support",
"android.widget"
] | android.app; android.content; android.os; android.support; android.widget; | 1,140,523 |
public State getStateAtVertex (int vertexIndex) {
State ret = null;
TIntList edgeList;
if (profileRequest.reverseSearch) {
edgeList = streetLayer.outgoingEdges.get(vertexIndex);
} else {
edgeList = streetLayer.incomingEdges.get(vertexIndex);
}
for (TIntIterator it = edgeList.iterator(); it.hasNext();) {
int eidx = it.next();
State state = getStateAtEdge(eidx);
if (state == null) continue;
if (ret == null) ret = state;
else if (ret.getRoutingVariable(quantityToMinimize) > state.getRoutingVariable(quantityToMinimize)) {
ret = state;
}
}
return ret;
} | State function (int vertexIndex) { State ret = null; TIntList edgeList; if (profileRequest.reverseSearch) { edgeList = streetLayer.outgoingEdges.get(vertexIndex); } else { edgeList = streetLayer.incomingEdges.get(vertexIndex); } for (TIntIterator it = edgeList.iterator(); it.hasNext();) { int eidx = it.next(); State state = getStateAtEdge(eidx); if (state == null) continue; if (ret == null) ret = state; else if (ret.getRoutingVariable(quantityToMinimize) > state.getRoutingVariable(quantityToMinimize)) { ret = state; } } return ret; } | /**
* Get a single best state at a vertex. NB this should not be used for propagating to samples, as you need to apply
* turn costs/restrictions during propagation.
*/ | Get a single best state at a vertex. NB this should not be used for propagating to samples, as you need to apply turn costs/restrictions during propagation | getStateAtVertex | {
"repo_name": "conveyal/r5",
"path": "src/main/java/com/conveyal/r5/streets/StreetRouter.java",
"license": "mit",
"size": 59065
} | [
"gnu.trove.iterator.TIntIterator",
"gnu.trove.list.TIntList"
] | import gnu.trove.iterator.TIntIterator; import gnu.trove.list.TIntList; | import gnu.trove.iterator.*; import gnu.trove.list.*; | [
"gnu.trove.iterator",
"gnu.trove.list"
] | gnu.trove.iterator; gnu.trove.list; | 1,544,613 |
@Test(timeout = 1000 * 60)
public void writeFileManyPackets() throws Exception {
Future<Long> checksumActual;
Future<Long> checksumExpected;
long length = PACKET_SIZE * 30000 + PACKET_SIZE / 3;
try (PacketWriter writer = create(Long.MAX_VALUE)) {
checksumExpected = writeFile(writer, length, 10, length / 3);
checksumExpected.get();
checksumActual = verifyWriteRequests(mChannel, 10, length / 3);
}
Assert.assertEquals(checksumExpected.get(), checksumActual.get());
} | @Test(timeout = 1000 * 60) void function() throws Exception { Future<Long> checksumActual; Future<Long> checksumExpected; long length = PACKET_SIZE * 30000 + PACKET_SIZE / 3; try (PacketWriter writer = create(Long.MAX_VALUE)) { checksumExpected = writeFile(writer, length, 10, length / 3); checksumExpected.get(); checksumActual = verifyWriteRequests(mChannel, 10, length / 3); } Assert.assertEquals(checksumExpected.get(), checksumActual.get()); } | /**
* Writes lots of packets.
*/ | Writes lots of packets | writeFileManyPackets | {
"repo_name": "jswudi/alluxio",
"path": "core/client/fs/src/test/java/alluxio/client/block/stream/NettyPacketWriterTest.java",
"license": "apache-2.0",
"size": 10260
} | [
"java.util.concurrent.Future",
"org.junit.Assert",
"org.junit.Test"
] | import java.util.concurrent.Future; import org.junit.Assert; import org.junit.Test; | import java.util.concurrent.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 844,190 |
public void enterPattern_matcher(SQLParser.Pattern_matcherContext ctx) { } | public void enterPattern_matcher(SQLParser.Pattern_matcherContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitPattern_matching_predicate | {
"repo_name": "HEIG-GAPS/slasher",
"path": "slasher.corrector/src/main/java/ch/gaps/slasher/corrector/SQLParserBaseListener.java",
"license": "mit",
"size": 73849
} | [
"ch.gaps.slasher.corrector.SQLParser"
] | import ch.gaps.slasher.corrector.SQLParser; | import ch.gaps.slasher.corrector.*; | [
"ch.gaps.slasher"
] | ch.gaps.slasher; | 761,352 |
@Override
public void onConnected(Bundle bundle) {
Log.d(TAG, "onConnected: Connected to Google Play Services!");
} | void function(Bundle bundle) { Log.d(TAG, STR); } | /**
* GoogleApiClient.ConnectionCallbacks implementation
* This callback happens when we are connected to Google Play Services.
* @param bundle
*/ | GoogleApiClient.ConnectionCallbacks implementation This callback happens when we are connected to Google Play Services | onConnected | {
"repo_name": "yeelin/weatherberry",
"path": "app/src/main/java/com/example/yeelin/homework/weatherberry/fragment/BasePlayServicesFragment.java",
"license": "mit",
"size": 7024
} | [
"android.os.Bundle",
"android.util.Log"
] | import android.os.Bundle; import android.util.Log; | import android.os.*; import android.util.*; | [
"android.os",
"android.util"
] | android.os; android.util; | 1,601,488 |
SnappyUtil.validateBuffer(buffer, off, len);
if (needsInput()) {
// No buffered output bytes and no input to consume, need more input
return 0;
}
if (!outputBuffer.hasRemaining()) {
// There is uncompressed input, compress it now
int maxOutputSize = Snappy.maxCompressedLength(inputBuffer.position());
if (maxOutputSize > outputBuffer.capacity()) {
ByteBuffer oldBuffer = outputBuffer;
outputBuffer = ByteBuffer.allocateDirect(maxOutputSize);
CleanUtil.clean(oldBuffer);
}
// Reset the previous outputBuffer
outputBuffer.clear();
inputBuffer.limit(inputBuffer.position());
inputBuffer.position(0);
int size = Snappy.compress(inputBuffer, outputBuffer);
outputBuffer.limit(size);
inputBuffer.limit(0);
inputBuffer.rewind();
}
// Return compressed output up to 'len'
int numBytes = Math.min(len, outputBuffer.remaining());
outputBuffer.get(buffer, off, numBytes);
bytesWritten += numBytes;
return numBytes;
} | SnappyUtil.validateBuffer(buffer, off, len); if (needsInput()) { return 0; } if (!outputBuffer.hasRemaining()) { int maxOutputSize = Snappy.maxCompressedLength(inputBuffer.position()); if (maxOutputSize > outputBuffer.capacity()) { ByteBuffer oldBuffer = outputBuffer; outputBuffer = ByteBuffer.allocateDirect(maxOutputSize); CleanUtil.clean(oldBuffer); } outputBuffer.clear(); inputBuffer.limit(inputBuffer.position()); inputBuffer.position(0); int size = Snappy.compress(inputBuffer, outputBuffer); outputBuffer.limit(size); inputBuffer.limit(0); inputBuffer.rewind(); } int numBytes = Math.min(len, outputBuffer.remaining()); outputBuffer.get(buffer, off, numBytes); bytesWritten += numBytes; return numBytes; } | /**
* Fills specified buffer with compressed data. Returns actual number
* of bytes of compressed data. A return value of 0 indicates that
* needsInput() should be called in order to determine if more input
* data is required.
*
* @param buffer Buffer for the compressed data
* @param off Start offset of the data
* @param len Size of the buffer
* @return The actual number of bytes of compressed data.
*/ | Fills specified buffer with compressed data. Returns actual number of bytes of compressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required | compress | {
"repo_name": "HyukjinKwon/parquet-mr",
"path": "parquet-hadoop/src/main/java/org/apache/parquet/hadoop/codec/SnappyCompressor.java",
"license": "apache-2.0",
"size": 5655
} | [
"java.nio.ByteBuffer",
"org.xerial.snappy.Snappy"
] | import java.nio.ByteBuffer; import org.xerial.snappy.Snappy; | import java.nio.*; import org.xerial.snappy.*; | [
"java.nio",
"org.xerial.snappy"
] | java.nio; org.xerial.snappy; | 2,335,323 |
List<ReportTable> getAllReportTables();
| List<ReportTable> getAllReportTables(); | /**
* Retrieves a Collection of all ReportTables.
*
* @return a Collection of ReportTables.
*/ | Retrieves a Collection of all ReportTables | getAllReportTables | {
"repo_name": "vietnguyen/dhis2-core",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTableService.java",
"license": "bsd-3-clause",
"size": 4106
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,654,651 |
public State retrieve() {
State state = new State();
state.add_state("photoAt", 2);
for (int i = 0; i < size; i++) {
state.get_state("photoAt").add("" + i, IdMap.instance().obj2atom(photoAt[i]));
}
state.add_state("ownerName", 1).add(owner.getName());
state.add_state("ownerPassword", 1).add(owner.getPassword());
state.add_state("loggedIn", 1);
if (loggedUser != null)
state.get_state("loggedIn").add(loggedUser.getName());
return state;
}
| State function() { State state = new State(); state.add_state(STR, 2); for (int i = 0; i < size; i++) { state.get_state(STR).add(STRownerNameSTRownerPasswordSTRloggedInSTRloggedIn").add(loggedUser.getName()); return state; } | /*** added by DBaseFineFit modified by DOwnerFineFit
*/ | added by DBaseFineFit modified by DOwnerFineFit | retrieve | {
"repo_name": "coderocket/finefit",
"path": "demos/deltafit/a_remove_owner_finefit/src/it/unito/Album/ArrayPhotoAlbum.java",
"license": "gpl-3.0",
"size": 3850
} | [
"com.finefit.sut.State"
] | import com.finefit.sut.State; | import com.finefit.sut.*; | [
"com.finefit.sut"
] | com.finefit.sut; | 940,308 |
public void loadScalingData(SampleModel sm) {
// Supposing integral transfer type
isTTypeIntegral = true;
nColorChannels = sm.getNumBands();
channelMinValues = new float[nColorChannels];
channelMulipliers = new float[nColorChannels];
invChannelMulipliers = new float[nColorChannels];
boolean isSignedShort =
(sm.getTransferType() == DataBuffer.TYPE_SHORT);
float maxVal;
for (int i=0; i<nColorChannels; i++) {
channelMinValues[i] = 0;
if (isSignedShort) {
channelMulipliers[i] = MAX_SHORT / MAX_SIGNED_SHORT;
invChannelMulipliers[i] = MAX_SIGNED_SHORT / MAX_SHORT;
} else {
maxVal = ((1 << sm.getSampleSize(i)) - 1);
channelMulipliers[i] = MAX_SHORT / maxVal;
invChannelMulipliers[i] = maxVal / MAX_SHORT;
}
}
} | void function(SampleModel sm) { isTTypeIntegral = true; nColorChannels = sm.getNumBands(); channelMinValues = new float[nColorChannels]; channelMulipliers = new float[nColorChannels]; invChannelMulipliers = new float[nColorChannels]; boolean isSignedShort = (sm.getTransferType() == DataBuffer.TYPE_SHORT); float maxVal; for (int i=0; i<nColorChannels; i++) { channelMinValues[i] = 0; if (isSignedShort) { channelMulipliers[i] = MAX_SHORT / MAX_SIGNED_SHORT; invChannelMulipliers[i] = MAX_SIGNED_SHORT / MAX_SHORT; } else { maxVal = ((1 << sm.getSampleSize(i)) - 1); channelMulipliers[i] = MAX_SHORT / maxVal; invChannelMulipliers[i] = maxVal / MAX_SHORT; } } } | /**
* Use this method only for integral transfer types.
* Extracts min/max values from the sample model
* @param sm - sample model
*/ | Use this method only for integral transfer types. Extracts min/max values from the sample model | loadScalingData | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/java/classlib/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/color/ColorScaler.java",
"license": "apache-2.0",
"size": 12861
} | [
"java.awt.image.DataBuffer",
"java.awt.image.SampleModel"
] | import java.awt.image.DataBuffer; import java.awt.image.SampleModel; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 2,295,703 |
public List<Criteria> getOredCriteria() {
return oredCriteria;
} | List<Criteria> function() { return oredCriteria; } | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table m_prj_customize_view
*
* @mbggenerated Thu Jul 16 10:50:12 ICT 2015
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_customize_view | getOredCriteria | {
"repo_name": "uniteddiversity/mycollab",
"path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/domain/ProjectCustomizeViewExample.java",
"license": "agpl-3.0",
"size": 35727
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,874,254 |
private final int getProximityPosition(XPathContext xctxt, int predPos,
boolean findLast)
{
int pos = 0;
int context = xctxt.getCurrentNode();
DTM dtm = xctxt.getDTM(context);
int parent = dtm.getParent(context);
try
{
DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.CHILD);
for (int child = traverser.first(parent); DTM.NULL != child;
child = traverser.next(parent, child))
{
try
{
xctxt.pushCurrentNode(child);
if (NodeTest.SCORE_NONE != super.execute(xctxt, child))
{
boolean pass = true;
try
{
xctxt.pushSubContextList(this);
for (int i = 0; i < predPos; i++)
{
xctxt.pushPredicatePos(i);
try
{
XObject pred = m_predicates[i].execute(xctxt);
try
{
if (XObject.CLASS_NUMBER == pred.getType())
{
if ((pos + 1) != (int) pred.numWithSideEffects())
{
pass = false;
break;
}
}
else if (!pred.boolWithSideEffects())
{
pass = false;
break;
}
}
finally
{
pred.detach();
}
}
finally
{
xctxt.popPredicatePos();
}
}
}
finally
{
xctxt.popSubContextList();
}
if (pass)
pos++;
if (!findLast && child == context)
{
return pos;
}
}
}
finally
{
xctxt.popCurrentNode();
}
}
}
catch (javax.xml.transform.TransformerException se)
{
// TODO: should keep throw sax exception...
throw new java.lang.RuntimeException(se.getMessage());
}
return pos;
} | final int function(XPathContext xctxt, int predPos, boolean findLast) { int pos = 0; int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int parent = dtm.getParent(context); try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.CHILD); for (int child = traverser.first(parent); DTM.NULL != child; child = traverser.next(parent, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { if ((pos + 1) != (int) pred.numWithSideEffects()) { pass = false; break; } } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos++; if (!findLast && child == context) { return pos; } } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { throw new java.lang.RuntimeException(se.getMessage()); } return pos; } | /**
* Get the proximity position index of the current node based on this
* node test.
*
*
* @param xctxt XPath runtime context.
* @param predPos Which predicate we're evaluating of foo[1][2][3].
* @param findLast If true, don't terminate when the context node is found.
*
* @return the proximity position index of the current node based on the
* node test.
*/ | Get the proximity position index of the current node based on this node test | getProximityPosition | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/sun/org/apache/xpath/internal/patterns/StepPattern.java",
"license": "apache-2.0",
"size": 27432
} | [
"com.sun.org.apache.xml.internal.dtm.Axis",
"com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser",
"com.sun.org.apache.xpath.internal.XPathContext",
"com.sun.org.apache.xpath.internal.objects.XObject"
] | import com.sun.org.apache.xml.internal.dtm.Axis; import com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser; import com.sun.org.apache.xpath.internal.XPathContext; import com.sun.org.apache.xpath.internal.objects.XObject; | import com.sun.org.apache.xml.internal.dtm.*; import com.sun.org.apache.xpath.internal.*; import com.sun.org.apache.xpath.internal.objects.*; | [
"com.sun.org"
] | com.sun.org; | 2,798,420 |
@Test
public void testSSHWhenSplitRegionInProgress()
throws KeeperException, IOException, Exception {
// true indicates the region is split but still in RIT
testCaseWithSplitRegionPartial(true);
// false indicate the region is not split
testCaseWithSplitRegionPartial(false);
} | void function() throws KeeperException, IOException, Exception { testCaseWithSplitRegionPartial(true); testCaseWithSplitRegionPartial(false); } | /**
* To test if the split region is removed from RIT if the region was in SPLITTING state
* but the RS has actually completed the splitting in META but went down. See HBASE-6070
* and also HBASE-5806
* @throws KeeperException
* @throws IOException
*/ | To test if the split region is removed from RIT if the region was in SPLITTING state but the RS has actually completed the splitting in META but went down. See HBASE-6070 and also HBASE-5806 | testSSHWhenSplitRegionInProgress | {
"repo_name": "infospace/hbase",
"path": "src/test/java/org/apache/hadoop/hbase/master/TestAssignmentManager.java",
"license": "apache-2.0",
"size": 53132
} | [
"java.io.IOException",
"org.apache.zookeeper.KeeperException"
] | import java.io.IOException; import org.apache.zookeeper.KeeperException; | import java.io.*; import org.apache.zookeeper.*; | [
"java.io",
"org.apache.zookeeper"
] | java.io; org.apache.zookeeper; | 836,315 |
protected void handleAttributeDefinition(final String name, final String attribName, final String handlerClass)
throws ObjectDescriptionException {
final PropertyInfo propertyInfo = ModelBuilder.getInstance().createSimplePropertyInfo
(getPropertyDescriptor(name));
if (propertyInfo == null) {
throw new ObjectDescriptionException("Unable to load property " + name);
}
propertyInfo.setComments(new Comments(getOpenComment(), getCloseComment()));
propertyInfo.setPropertyType(PropertyType.ATTRIBUTE);
propertyInfo.setXmlName(attribName);
propertyInfo.setXmlHandler(handlerClass);
this.propertyList.add(propertyInfo);
}
| void function(final String name, final String attribName, final String handlerClass) throws ObjectDescriptionException { final PropertyInfo propertyInfo = ModelBuilder.getInstance().createSimplePropertyInfo (getPropertyDescriptor(name)); if (propertyInfo == null) { throw new ObjectDescriptionException(STR + name); } propertyInfo.setComments(new Comments(getOpenComment(), getCloseComment())); propertyInfo.setPropertyType(PropertyType.ATTRIBUTE); propertyInfo.setXmlName(attribName); propertyInfo.setXmlHandler(handlerClass); this.propertyList.add(propertyInfo); } | /**
* Handles the description of an attribute within an object definition.
*
* @param name the name.
* @param attribName the attribute name.
* @param handlerClass the fully qualified class name for the attribute handler.
*
* @throws ObjectDescriptionException if there is a problem with the object description.
*/ | Handles the description of an attribute within an object definition | handleAttributeDefinition | {
"repo_name": "jfree/jcommon",
"path": "src/main/java/org/jfree/xml/generator/DefaultModelReader.java",
"license": "lgpl-2.1",
"size": 15628
} | [
"org.jfree.xml.generator.model.Comments",
"org.jfree.xml.generator.model.PropertyInfo",
"org.jfree.xml.generator.model.PropertyType",
"org.jfree.xml.util.ObjectDescriptionException"
] | import org.jfree.xml.generator.model.Comments; import org.jfree.xml.generator.model.PropertyInfo; import org.jfree.xml.generator.model.PropertyType; import org.jfree.xml.util.ObjectDescriptionException; | import org.jfree.xml.generator.model.*; import org.jfree.xml.util.*; | [
"org.jfree.xml"
] | org.jfree.xml; | 1,967,127 |
protected mxPoint getOriginForCell(Object cell)
{
mxPoint result = origins.get(cell);
if (result == null)
{
mxGraph graph = graphComponent.getGraph();
if (cell != null)
{
result = new mxPoint(getOriginForCell(graph.getModel()
.getParent(cell)));
mxGeometry geo = graph.getCellGeometry(cell);
// TODO: Handle offset, relative geometries etc
if (geo != null)
{
result.setX(result.getX() + geo.getX());
result.setY(result.getY() + geo.getY());
}
}
if (result == null)
{
mxPoint t = graph.getView().getTranslate();
result = new mxPoint(-t.getX(), -t.getY());
}
origins.put(cell, result);
}
return result;
} | mxPoint function(Object cell) { mxPoint result = origins.get(cell); if (result == null) { mxGraph graph = graphComponent.getGraph(); if (cell != null) { result = new mxPoint(getOriginForCell(graph.getModel() .getParent(cell))); mxGeometry geo = graph.getCellGeometry(cell); if (geo != null) { result.setX(result.getX() + geo.getX()); result.setY(result.getY() + geo.getY()); } } if (result == null) { mxPoint t = graph.getView().getTranslate(); result = new mxPoint(-t.getX(), -t.getY()); } origins.put(cell, result); } return result; } | /**
* Returns the top, left corner of the given cell.
*/ | Returns the top, left corner of the given cell | getOriginForCell | {
"repo_name": "jgraph/mxgraph",
"path": "java/src/com/mxgraph/swing/util/mxMorphing.java",
"license": "apache-2.0",
"size": 6948
} | [
"com.mxgraph.util.mxPoint"
] | import com.mxgraph.util.mxPoint; | import com.mxgraph.util.*; | [
"com.mxgraph.util"
] | com.mxgraph.util; | 1,781,917 |
public static boolean importRealm(KeycloakSession session, RealmRepresentation rep, Strategy strategy, boolean skipUserDependent) {
String realmName = rep.getRealm();
RealmProvider model = session.realms();
RealmModel realm = model.getRealmByName(realmName);
if (realm != null) {
if (strategy == Strategy.IGNORE_EXISTING) {
logger.infof("Realm '%s' already exists. Import skipped", realmName);
return false;
} else {
logger.infof("Realm '%s' already exists. Removing it before import", realmName);
if (Config.getAdminRealm().equals(realm.getId())) {
// Delete all masterAdmin apps due to foreign key constraints
for (RealmModel currRealm : model.getRealms()) {
currRealm.setMasterAdminClient(null);
}
}
// TODO: For migration between versions, it should be possible to delete just realm but keep it's users
model.removeRealm(realm.getId());
}
}
RealmManager realmManager = new RealmManager(session);
realmManager.setContextPath(session.getContext().getContextPath());
realmManager.importRealm(rep, skipUserDependent);
if (System.getProperty(ExportImportConfig.ACTION) != null) {
logger.infof("Realm '%s' imported", realmName);
}
return true;
} | static boolean function(KeycloakSession session, RealmRepresentation rep, Strategy strategy, boolean skipUserDependent) { String realmName = rep.getRealm(); RealmProvider model = session.realms(); RealmModel realm = model.getRealmByName(realmName); if (realm != null) { if (strategy == Strategy.IGNORE_EXISTING) { logger.infof(STR, realmName); return false; } else { logger.infof(STR, realmName); if (Config.getAdminRealm().equals(realm.getId())) { for (RealmModel currRealm : model.getRealms()) { currRealm.setMasterAdminClient(null); } } model.removeRealm(realm.getId()); } } RealmManager realmManager = new RealmManager(session); realmManager.setContextPath(session.getContext().getContextPath()); realmManager.importRealm(rep, skipUserDependent); if (System.getProperty(ExportImportConfig.ACTION) != null) { logger.infof(STR, realmName); } return true; } | /**
* Fully import realm from representation, save it to model and return model of newly created realm
*
* @param session
* @param rep
* @param strategy specifies whether to overwrite or ignore existing realm or user entries
* @param skipUserDependent If true, then import of any models, which needs users already imported in DB, will be skipped. For example authorization
* @return newly imported realm (or existing realm if ignoreExisting is true and realm of this name already exists)
*/ | Fully import realm from representation, save it to model and return model of newly created realm | importRealm | {
"repo_name": "almighty/keycloak",
"path": "services/src/main/java/org/keycloak/exportimport/util/ImportUtils.java",
"license": "apache-2.0",
"size": 11707
} | [
"org.keycloak.Config",
"org.keycloak.exportimport.ExportImportConfig",
"org.keycloak.exportimport.Strategy",
"org.keycloak.models.KeycloakSession",
"org.keycloak.models.RealmModel",
"org.keycloak.models.RealmProvider",
"org.keycloak.representations.idm.RealmRepresentation",
"org.keycloak.services.managers.RealmManager"
] | import org.keycloak.Config; import org.keycloak.exportimport.ExportImportConfig; import org.keycloak.exportimport.Strategy; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; import org.keycloak.models.RealmProvider; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.services.managers.RealmManager; | import org.keycloak.*; import org.keycloak.exportimport.*; import org.keycloak.models.*; import org.keycloak.representations.idm.*; import org.keycloak.services.managers.*; | [
"org.keycloak",
"org.keycloak.exportimport",
"org.keycloak.models",
"org.keycloak.representations",
"org.keycloak.services"
] | org.keycloak; org.keycloak.exportimport; org.keycloak.models; org.keycloak.representations; org.keycloak.services; | 2,915,932 |
public static Event error(@Nullable Location location, String message){
return new Event(EventKind.ERROR, location, message, null);
} | static Event function(@Nullable Location location, String message){ return new Event(EventKind.ERROR, location, message, null); } | /**
* Reports an error.
*/ | Reports an error | error | {
"repo_name": "spxtr/bazel",
"path": "src/main/java/com/google/devtools/build/lib/events/Event.java",
"license": "apache-2.0",
"size": 6634
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,103,898 |
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair)
{
return repair.getItem() == Item.getItemFromBlock(Blocks.PLANKS) ? true : super.getIsRepairable(toRepair, repair);
}
| boolean function(ItemStack toRepair, ItemStack repair) { return repair.getItem() == Item.getItemFromBlock(Blocks.PLANKS) ? true : super.getIsRepairable(toRepair, repair); } | /**
* Return whether this item is repairable in an anvil.
*/ | Return whether this item is repairable in an anvil | getIsRepairable | {
"repo_name": "lucemans/ShapeClient-SRC",
"path": "net/minecraft/item/ItemShield.java",
"license": "mpl-2.0",
"size": 3536
} | [
"net.minecraft.init.Blocks"
] | import net.minecraft.init.Blocks; | import net.minecraft.init.*; | [
"net.minecraft.init"
] | net.minecraft.init; | 2,304,057 |
@org.junit.Test
public void testUnderstanding() {
Bot bot = Bot.createInstance();
//bot.setDebugLevel(Level.FINER);
Language language = bot.mind().getThought(Language.class);
language.setLearningMode(LearningMode.Disabled);
TextEntry text = bot.awareness().getSense(TextEntry.class);
List<String> output = registerForOutput(text);
text.input("is the sky blue?");
String response = waitForOutput(output);
assertUnknown(response);
text.input("the sky is blue");
response = waitForOutput(output);
assertKnown(response);
text.input("is the sky blue?");
response = waitForOutput(output);
assertTrue(response);
text.input("is the sky not blue?");
response = waitForOutput(output);
assertFalse(response);
text.input("is the sky red?");
response = waitForOutput(output);
assertKeyword(response, "blue");
assertUncertain(response);
text.input("is the sky not red?");
response = waitForOutput(output);
assertKeyword(response, "blue");
assertUncertain(response);
text.input("the sky is not blue");
response = waitForOutput(output);
assertKnown(response);
text.input("is the sky blue?");
response = waitForOutput(output);
assertFalse(response);
text.input("is the sky not blue?");
response = waitForOutput(output);
assertTrue(response);
text.input("is the sky not not blue?");
response = waitForOutput(output);
assertFalse(response);
text.input("is the sky red?");
response = waitForOutput(output);
assertUnknown(response);
text.input("remember that the sky is blue");
response = waitForOutput(output);
assertKeyword(response, "blue");
text.input("remember the sky is blue");
response = waitForOutput(output);
assertKnown(response);
text.input("I am a dog");
response = waitForOutput(output);
assertKnown(response);
assertKeyword(response, "a dog");
text.input("am I a dog");
response = waitForOutput(output);
assertTrue(response);
assertKeyword(response, "a dog");
text.input("I am a cat?");
response = waitForOutput(output);
assertFalse(response);
assertKeyword(response, "a cat");
text.input("I am not a cat");
response = waitForOutput(output);
assertFalse(response);
assertKeyword(response, "a cat");
text.input("I am a cat?");
response = waitForOutput(output);
assertFalse(response);
assertKeyword(response, "a cat");
//text.input("do you think that I am a cat?");
//response = waitForOutput(output);
//assertFalse(response);
//assertKeyword(response, "a cat");
text.input("are you a dog");
response = waitForOutput(output);
assertFalse(response);
assertKeyword(response, "I am not a dog");
text.input("you are a dog");
response = waitForOutput(output);
assertKnown(response);
assertKeyword(response, "I am a dog");
text.input("are you a dog");
response = waitForOutput(output);
assertTrue(response);
assertKeyword(response, "I am a dog");
bot.shutdown();
} | @org.junit.Test void function() { Bot bot = Bot.createInstance(); Language language = bot.mind().getThought(Language.class); language.setLearningMode(LearningMode.Disabled); TextEntry text = bot.awareness().getSense(TextEntry.class); List<String> output = registerForOutput(text); text.input(STR); String response = waitForOutput(output); assertUnknown(response); text.input(STR); response = waitForOutput(output); assertKnown(response); text.input(STR); response = waitForOutput(output); assertTrue(response); text.input(STR); response = waitForOutput(output); assertFalse(response); text.input(STR); response = waitForOutput(output); assertKeyword(response, "blue"); assertUncertain(response); text.input(STR); response = waitForOutput(output); assertKeyword(response, "blue"); assertUncertain(response); text.input(STR); response = waitForOutput(output); assertKnown(response); text.input(STR); response = waitForOutput(output); assertFalse(response); text.input(STR); response = waitForOutput(output); assertTrue(response); text.input(STR); response = waitForOutput(output); assertFalse(response); text.input(STR); response = waitForOutput(output); assertUnknown(response); text.input(STR); response = waitForOutput(output); assertKeyword(response, "blue"); text.input(STR); response = waitForOutput(output); assertKnown(response); text.input(STR); response = waitForOutput(output); assertKnown(response); assertKeyword(response, STR); text.input(STR); response = waitForOutput(output); assertTrue(response); assertKeyword(response, STR); text.input(STR); response = waitForOutput(output); assertFalse(response); assertKeyword(response, STR); text.input(STR); response = waitForOutput(output); assertFalse(response); assertKeyword(response, STR); text.input(STR); response = waitForOutput(output); assertFalse(response); assertKeyword(response, STR); text.input(STR); response = waitForOutput(output); assertFalse(response); assertKeyword(response, STR); text.input(STR); response = waitForOutput(output); assertKnown(response); assertKeyword(response, STR); text.input(STR); response = waitForOutput(output); assertTrue(response); assertKeyword(response, STR); bot.shutdown(); } | /**
* Test language understanding.
*/ | Test language understanding | testUnderstanding | {
"repo_name": "BOTlibre/BOTlibre",
"path": "ai-engine-test/source/org/botlibre/test/TestUnderstanding.java",
"license": "epl-1.0",
"size": 16992
} | [
"java.util.List",
"org.botlibre.Bot",
"org.botlibre.sense.text.TextEntry",
"org.botlibre.thought.language.Language"
] | import java.util.List; import org.botlibre.Bot; import org.botlibre.sense.text.TextEntry; import org.botlibre.thought.language.Language; | import java.util.*; import org.botlibre.*; import org.botlibre.sense.text.*; import org.botlibre.thought.language.*; | [
"java.util",
"org.botlibre",
"org.botlibre.sense",
"org.botlibre.thought"
] | java.util; org.botlibre; org.botlibre.sense; org.botlibre.thought; | 2,228,135 |
Message queryServers(Message request, String workZone,
Hashtable<Server, Object> visitedServers, boolean tcpOnly)
throws DomainProtocolException, SecurityException {
QuestionRecord qRecord;
SList slist = SList.getInstance();
Server curServer;
byte[] outBuf = new byte[MSG_MAX_BYTES];
int outBufLen;
byte[] inBuf = new byte[MSG_MAX_BYTES];
Message receivedMes = null;
int idx = 0;
int curTimeout = this.initialTimeout;
boolean received = false;
boolean parsed = false;
boolean correctAnswer = false;
int rCode = -1;
// determine a question
if (!request.getQuestionRecords().hasMoreElements()) {
// jndi.71=no question record
throw new IllegalArgumentException(Messages.getString("jndi.71")); //$NON-NLS-1$
}
qRecord = request.getQuestionRecords().nextElement();
// preparing a domain protocol message
outBufLen = request.writeBytes(outBuf, 0);
// sending message and trying to receive an answer
for (int round = 0; round < this.timeoutRetries; round++) {
Set<Server> queriedServers = new HashSet<Server>();
// start of round
while (true) {
int responseTime = 0;
received = false;
parsed = false;
rCode = -1;
// get next server
curServer = slist.getBestGuess(workZone, visitedServers);
if (curServer == null || queriedServers.contains(curServer)) {
// end of round
break;
}
if (curServer.getIP() == null) {
// if we don't know IP lets start background resolving
// thread
startResolvingThread(curServer.getName(), qRecord
.getQClass());
slist.updateEntry(workZone, curServer,
SList.NETWORK_FAILURE);
queriedServers.add(curServer);
continue;
}
// send the message and receive the answer
try {
// if (LogConst.DEBUG) {
// ProviderMgr.logger.fine("Timeout is set to " +
// curTimeout);
// ProviderMgr.logger.fine("Querying server \"" +
// curServer + "\"");
// }
// timeBeforeSending = System.currentTimeMillis();
if (tcpOnly) {
TransportMgr.sendReceiveTCP(curServer.getIP(),
curServer.getPort(), outBuf, outBufLen, inBuf,
inBuf.length, curTimeout);
} else {
TransportMgr.sendReceiveUDP(curServer.getIP(),
curServer.getPort(), outBuf, outBufLen, inBuf,
inBuf.length, curTimeout);
}
// responseTime = (int) (System.currentTimeMillis() -
// timeBeforeSending);
// ProviderMgr.logger.fine("Answer received in " +
// responseTime + " milliseconds");
received = true;
} catch (SocketTimeoutException e) {
slist.updateEntry(workZone, curServer, SList.TIMEOUT);
// if (LogConst.DEBUG) {
// ProviderMgr.logger.fine("Socket timeout");
// }
} catch (DomainProtocolException e) {
// problems with receiving the message
// skipping this server
slist.updateEntry(workZone, curServer,
SList.NETWORK_FAILURE);
// ProviderMgr.logger.log(Level.WARNING,
// "Connection failure", e);
}
// parse the message
if (received) {
try {
boolean answerSectionIsTruncated = false;
receivedMes = new Message();
idx = 0;
idx = Message.parseMessage(inBuf, idx, receivedMes);
// if (LogConst.DEBUG) {
// ProviderMgr.logger.finest("Received message:\n" +
// receivedMes.toString());
// }
parsed = true;
// handle a truncation
if (receivedMes.isTc() && !tcpOnly) {
// The Message is truncated.
// Let's try to establish a TCP connection
// and retransmit the message over that connection.
// if (LogConst.DEBUG) {
// ProviderMgr.logger.fine("Message is truncated");
// ProviderMgr.logger.fine("Trying to establish " +
// "a connection over TCP");
// }
try {
Message receivedMesTcp;
int idx2;
TransportMgr.sendReceiveTCP(curServer.getIP(),
curServer.getPort(), outBuf, outBufLen,
inBuf, inBuf.length, curTimeout);
receivedMesTcp = new Message();
idx2 = Message.parseMessage(inBuf, 0,
receivedMesTcp);
// complete message was received
if (!receivedMesTcp.isTc()) {
receivedMes = receivedMesTcp;
idx = idx2;
}
} catch (Exception e) {
// ProviderMgr.logger.log(Level.WARNING,
// "Receiving a complete message" +
// " over TCP failed", e);
// if (LogConst.DEBUG) {
// ProviderMgr.logger.fine(
// "Parsing the message " +
// "previously received over UDP");
// }
}
}
// Is the message still truncated?
// (It is possible in case if TCP connection failed)
if (receivedMes.isTc()) {
// check if the ANSWER section is truncated
// or not
if (!receivedMes.getAuthorityRRs()
.hasMoreElements()
&& !receivedMes.getAdditionalRRs()
.hasMoreElements()) {
answerSectionIsTruncated = true;
}
}
rCode = receivedMes.getRCode();
if (rCode == ProviderConstants.NO_ERROR) {
// correct message has been received
slist
.updateEntry(workZone, curServer,
responseTime);
visitedServers.put(curServer, new Object()); // $NON-LOCK-1$
if (!answerSectionIsTruncated) {
correctAnswer = true;
break;
}
} else if (rCode == ProviderConstants.SERVER_FAILURE) {
// removing server from list
// ProviderMgr.logger.warning("Server failure. " +
// errMsg);
slist.updateEntry(workZone, curServer,
SList.SERVER_FAILURE);
visitedServers.put(curServer, new Object()); // $NON-LOCK-1$
} else if (rCode == ProviderConstants.FORMAT_ERROR) {
// removing server from list
// ProviderMgr.logger.warning("Format error. " +
// errMsg);
slist.updateEntry(workZone, curServer,
SList.SERVER_FAILURE);
visitedServers.put(curServer, new Object()); // $NON-LOCK-1$
} else if (rCode == ProviderConstants.NAME_ERROR) {
// ProviderMgr.logger.warning("Name error. " +
// errMsg);
if (receivedMes.isAA()) {
slist.updateEntry(workZone, curServer,
responseTime);
visitedServers.put(curServer, new Object()); // $NON-LOCK-1$
correctAnswer = true;
// if (LogConst.DEBUG) {
// ProviderMgr.logger.fine(
// "Return name error to user");
// }
break;
}
// This server is not authoritative server for
// this zone. It should not answer with a
// name error. Probably it is misconfigured.
slist.updateEntry(workZone, curServer,
SList.SERVER_FAILURE);
visitedServers.put(curServer, new Object()); // $NON-LOCK-1$
// if (LogConst.DEBUG) {
// ProviderMgr.logger.fine(
// "Not authoritative answer. " +
// "Skip it.");
// }
} else if (rCode == ProviderConstants.NOT_IMPLEMENTED) {
// ProviderMgr.logger.warning("Not implemented. " +
// errMsg);
slist.updateEntry(workZone, curServer,
SList.SERVER_FAILURE);
visitedServers.put(curServer, new Object()); // $NON-LOCK-1$
} else if (rCode == ProviderConstants.REFUSED) {
// ProviderMgr.logger.warning("Refused. " +
// errMsg);
slist.updateEntry(workZone, curServer,
SList.SERVER_FAILURE);
visitedServers.put(curServer, new Object()); // $NON-LOCK-1$
}
} catch (DomainProtocolException e) {
// removing this server from SLIST
slist.dropServer(workZone, curServer);
// ProviderMgr.logger.warning("Unknown error.");
} catch (IndexOutOfBoundsException e) {
// bad message received
slist.dropServer(workZone, curServer);
// ProviderMgr.logger.warning("Bad message received: " +
// " IndexOutOfBoundsException.");
}
}
queriedServers.add(curServer);
}
// end of round
if (received & parsed & correctAnswer) {
// correct answer received
return receivedMes;
}
curTimeout *= 2;
}
// give up - no correct message has been received
return null;
} | Message queryServers(Message request, String workZone, Hashtable<Server, Object> visitedServers, boolean tcpOnly) throws DomainProtocolException, SecurityException { QuestionRecord qRecord; SList slist = SList.getInstance(); Server curServer; byte[] outBuf = new byte[MSG_MAX_BYTES]; int outBufLen; byte[] inBuf = new byte[MSG_MAX_BYTES]; Message receivedMes = null; int idx = 0; int curTimeout = this.initialTimeout; boolean received = false; boolean parsed = false; boolean correctAnswer = false; int rCode = -1; if (!request.getQuestionRecords().hasMoreElements()) { throw new IllegalArgumentException(Messages.getString(STR)); } qRecord = request.getQuestionRecords().nextElement(); outBufLen = request.writeBytes(outBuf, 0); for (int round = 0; round < this.timeoutRetries; round++) { Set<Server> queriedServers = new HashSet<Server>(); while (true) { int responseTime = 0; received = false; parsed = false; rCode = -1; curServer = slist.getBestGuess(workZone, visitedServers); if (curServer == null queriedServers.contains(curServer)) { break; } if (curServer.getIP() == null) { startResolvingThread(curServer.getName(), qRecord .getQClass()); slist.updateEntry(workZone, curServer, SList.NETWORK_FAILURE); queriedServers.add(curServer); continue; } try { if (tcpOnly) { TransportMgr.sendReceiveTCP(curServer.getIP(), curServer.getPort(), outBuf, outBufLen, inBuf, inBuf.length, curTimeout); } else { TransportMgr.sendReceiveUDP(curServer.getIP(), curServer.getPort(), outBuf, outBufLen, inBuf, inBuf.length, curTimeout); } received = true; } catch (SocketTimeoutException e) { slist.updateEntry(workZone, curServer, SList.TIMEOUT); } catch (DomainProtocolException e) { slist.updateEntry(workZone, curServer, SList.NETWORK_FAILURE); } if (received) { try { boolean answerSectionIsTruncated = false; receivedMes = new Message(); idx = 0; idx = Message.parseMessage(inBuf, idx, receivedMes); parsed = true; if (receivedMes.isTc() && !tcpOnly) { try { Message receivedMesTcp; int idx2; TransportMgr.sendReceiveTCP(curServer.getIP(), curServer.getPort(), outBuf, outBufLen, inBuf, inBuf.length, curTimeout); receivedMesTcp = new Message(); idx2 = Message.parseMessage(inBuf, 0, receivedMesTcp); if (!receivedMesTcp.isTc()) { receivedMes = receivedMesTcp; idx = idx2; } } catch (Exception e) { } } if (receivedMes.isTc()) { if (!receivedMes.getAuthorityRRs() .hasMoreElements() && !receivedMes.getAdditionalRRs() .hasMoreElements()) { answerSectionIsTruncated = true; } } rCode = receivedMes.getRCode(); if (rCode == ProviderConstants.NO_ERROR) { slist .updateEntry(workZone, curServer, responseTime); visitedServers.put(curServer, new Object()); if (!answerSectionIsTruncated) { correctAnswer = true; break; } } else if (rCode == ProviderConstants.SERVER_FAILURE) { slist.updateEntry(workZone, curServer, SList.SERVER_FAILURE); visitedServers.put(curServer, new Object()); } else if (rCode == ProviderConstants.FORMAT_ERROR) { slist.updateEntry(workZone, curServer, SList.SERVER_FAILURE); visitedServers.put(curServer, new Object()); } else if (rCode == ProviderConstants.NAME_ERROR) { if (receivedMes.isAA()) { slist.updateEntry(workZone, curServer, responseTime); visitedServers.put(curServer, new Object()); correctAnswer = true; break; } slist.updateEntry(workZone, curServer, SList.SERVER_FAILURE); visitedServers.put(curServer, new Object()); } else if (rCode == ProviderConstants.NOT_IMPLEMENTED) { slist.updateEntry(workZone, curServer, SList.SERVER_FAILURE); visitedServers.put(curServer, new Object()); } else if (rCode == ProviderConstants.REFUSED) { slist.updateEntry(workZone, curServer, SList.SERVER_FAILURE); visitedServers.put(curServer, new Object()); } } catch (DomainProtocolException e) { slist.dropServer(workZone, curServer); } catch (IndexOutOfBoundsException e) { slist.dropServer(workZone, curServer); } } queriedServers.add(curServer); } if (received & parsed & correctAnswer) { return receivedMes; } curTimeout *= 2; } return null; } | /**
* Query available DNS servers for desired information. This method doesn't
* look into the local cache. Drops all answers that contains "server fail"
* and "not implemented" answer codes and returns the first "good" answer.
*
* @param request
* a DNS message that contains the request record
* @param workZone
* a zone that is closest known (grand-) parent of the desired
* name
* @param visitedServers
* the hash list of servers, that should not be examined; this
* method also appends to this list all server that have been
* visited during execution of this method
* @param tcpOnly
* <code>true</code> if we want to use TCP protocol only;
* otherwise UDP will be tried first
* @return the message received; <code>null</code> if none found
* @throws DomainProtocolException
* some domain protocol related error occured
* @throws SecurityException
* if the resolver doesn't have the permission to use sockets
*/ | Query available DNS servers for desired information. This method doesn't look into the local cache. Drops all answers that contains "server fail" and "not implemented" answer codes and returns the first "good" answer | queryServers | {
"repo_name": "nextopio/nextop-client",
"path": "org.apache-jarjar/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java",
"license": "apache-2.0",
"size": 67411
} | [
"java.net.SocketTimeoutException",
"java.util.HashSet",
"java.util.Hashtable",
"java.util.Set",
"org.apache.harmony.jndi.internal.nls.Messages",
"org.apache.harmony.jndi.provider.dns.SList"
] | import java.net.SocketTimeoutException; import java.util.HashSet; import java.util.Hashtable; import java.util.Set; import org.apache.harmony.jndi.internal.nls.Messages; import org.apache.harmony.jndi.provider.dns.SList; | import java.net.*; import java.util.*; import org.apache.harmony.jndi.internal.nls.*; import org.apache.harmony.jndi.provider.dns.*; | [
"java.net",
"java.util",
"org.apache.harmony"
] | java.net; java.util; org.apache.harmony; | 1,363,287 |
public void saveTask(TaskDefinition task) {
Context.getSchedulerService().saveTaskDefinition(task);
}
| void function(TaskDefinition task) { Context.getSchedulerService().saveTaskDefinition(task); } | /**
* Save a task in the database.
*
* @param task the <code>TaskDefinition</code> to save
* @deprecated use saveTaskDefinition which follows correct naming standard
*/ | Save a task in the database | saveTask | {
"repo_name": "Bhamni/openmrs-core",
"path": "api/src/main/java/org/openmrs/scheduler/timer/TimerSchedulerServiceImpl.java",
"license": "mpl-2.0",
"size": 17058
} | [
"org.openmrs.api.context.Context",
"org.openmrs.scheduler.TaskDefinition"
] | import org.openmrs.api.context.Context; import org.openmrs.scheduler.TaskDefinition; | import org.openmrs.api.context.*; import org.openmrs.scheduler.*; | [
"org.openmrs.api",
"org.openmrs.scheduler"
] | org.openmrs.api; org.openmrs.scheduler; | 1,492,974 |
public List<SystemOverview> listActiveSystems(User loggedInUser)
throws FaultException {
return SystemManager.systemListShortActive(loggedInUser, null);
} | List<SystemOverview> function(User loggedInUser) throws FaultException { return SystemManager.systemListShortActive(loggedInUser, null); } | /**
* Gets a list of all active systems visible to user
* @param loggedInUser The current user
* @return Returns an array of maps representing all active systems visible to user
*
* @throws FaultException A FaultException is thrown if a valid user can not be found
* from the passed in session key
*
* @xmlrpc.doc Returns a list of active servers visible to the user.
* @xmlrpc.param #param("string", "sessionKey")
* @xmlrpc.returntype
* #array()
* $SystemOverviewSerializer
* #array_end()
*/ | Gets a list of all active systems visible to user | listActiveSystems | {
"repo_name": "moio/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java",
"license": "gpl-2.0",
"size": 230187
} | [
"com.redhat.rhn.FaultException",
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.frontend.dto.SystemOverview",
"com.redhat.rhn.manager.system.SystemManager",
"java.util.List"
] | import com.redhat.rhn.FaultException; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.dto.SystemOverview; import com.redhat.rhn.manager.system.SystemManager; import java.util.List; | import com.redhat.rhn.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.dto.*; import com.redhat.rhn.manager.system.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 227,594 |
public void dispositivoSeleccionado(View v) {
}
| void function(View v) { } | /**
* Dispositivo seleccionado.
*
* @param v
* the v
*/ | Dispositivo seleccionado | dispositivoSeleccionado | {
"repo_name": "sprayz/Phytris",
"path": "src/proyecto/blocktris/ActividadBluetooth.java",
"license": "gpl-3.0",
"size": 6232
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,504,819 |
public TextureComponent fetchTextureComponent(String filename)
throws IOException
{
TextureComponent ret_val = (TextureComponent)componentMap.get(filename);
if(ret_val == null)
{
ret_val = load2DImage(filename);
componentMap.put(filename, ret_val);
}
return ret_val;
} | TextureComponent function(String filename) throws IOException { TextureComponent ret_val = (TextureComponent)componentMap.get(filename); if(ret_val == null) { ret_val = load2DImage(filename); componentMap.put(filename, ret_val); } return ret_val; } | /**
* Param fetch the imagecomponent named by the filename. The filename may
* be either absolute or relative to the classpath.
*
* @param filename The filename to fetch
* @return The TextureComponent instance for that filename
* @throws IOException An I/O error occurred during loading
*/ | Param fetch the imagecomponent named by the filename. The filename may be either absolute or relative to the classpath | fetchTextureComponent | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "aviatrix3d/src/java/org/j3d/renderer/aviatrix3d/texture/FixedTextureCache.java",
"license": "gpl-2.0",
"size": 8887
} | [
"java.io.IOException",
"org.j3d.aviatrix3d.TextureComponent"
] | import java.io.IOException; import org.j3d.aviatrix3d.TextureComponent; | import java.io.*; import org.j3d.aviatrix3d.*; | [
"java.io",
"org.j3d.aviatrix3d"
] | java.io; org.j3d.aviatrix3d; | 1,470,062 |
public static GANSSSignals fromPerAligned(byte[] encodedBytes) {
GANSSSignals result = new GANSSSignals();
result.decodePerAligned(new BitStreamReader(encodedBytes));
return result;
} | static GANSSSignals function(byte[] encodedBytes) { GANSSSignals result = new GANSSSignals(); result.decodePerAligned(new BitStreamReader(encodedBytes)); return result; } | /**
* Creates a new GANSSSignals from encoded stream.
*/ | Creates a new GANSSSignals from encoded stream | fromPerAligned | {
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/rrlp_components/GANSSSignals.java",
"license": "apache-2.0",
"size": 2981
} | [
"com.google.location.suplclient.asn1.base.BitStreamReader"
] | import com.google.location.suplclient.asn1.base.BitStreamReader; | import com.google.location.suplclient.asn1.base.*; | [
"com.google.location"
] | com.google.location; | 994,318 |
@Override
public InputStream createInputStream() throws IOException {
if (this.file != null) {
return new FileInputStream(this.file);
} else {
return new ByteArrayInputStream(new byte[] {});
}
} | InputStream function() throws IOException { if (this.file != null) { return new FileInputStream(this.file); } else { return new ByteArrayInputStream(new byte[] {}); } } | /**
* Return a new {@link FileInputStream} for the current filename.
* @return the new input stream.
* @throws IOException If an IO problem occurs.
* @see PartSource#createInputStream()
*/ | Return a new <code>FileInputStream</code> for the current filename | createInputStream | {
"repo_name": "stanfy/enroscar",
"path": "net/src/main/java/com/stanfy/enroscar/rest/request/net/multipart/FilePartSource.java",
"license": "apache-2.0",
"size": 2592
} | [
"java.io.ByteArrayInputStream",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.ByteArrayInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,181,113 |
@Override
public List findWithNamedQuery(String queryName, int resultLimit) {
try {
Query query = sessionFactory.openSession().getNamedQuery(queryName);
List qResult = query.list();
if (!qResult.isEmpty()) {
return qResult;
} else {
return null;
}
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
| List function(String queryName, int resultLimit) { try { Query query = sessionFactory.openSession().getNamedQuery(queryName); List qResult = query.list(); if (!qResult.isEmpty()) { return qResult; } else { return null; } } catch (Exception ex) { ex.printStackTrace(); return null; } } | /**
* Named query with limited number of results
*
* @param queryName
* @param resultLimit
* @return
*/ | Named query with limited number of results | findWithNamedQuery | {
"repo_name": "bidurbs/yogaStudio",
"path": "poweryoga/src/main/java/com/saviour/poweryoga/crudfacade/CRUDFacadeImpl.java",
"license": "apache-2.0",
"size": 8819
} | [
"java.util.List",
"org.hibernate.Query"
] | import java.util.List; import org.hibernate.Query; | import java.util.*; import org.hibernate.*; | [
"java.util",
"org.hibernate"
] | java.util; org.hibernate; | 2,664,884 |
private static String getTypeName(int type)
{
Registry reg = DataBrowserAgent.getRegistry();
switch (type) {
case MOVIE: return "Movies";
case ORPHANED_IMAGES:
String v = (String) reg.lookup(LookupNames.ORPHANED_IMAGE_NAME);
if (CommonsLangUtils.isNotBlank(v)) {
return v;
}
return "Orphaned Images";
case TAG:
return "Tags used not owned";
case OTHER:
default:
return "Other files";
}
}
private int type;
public TreeFileSet(int type)
{
super(getTypeName(type));
switch (type) {
case MOVIE:
case TAG:
case ORPHANED_IMAGES:
this.type = type;
break;
case OTHER:
default:
this.type = OTHER;
}
}
public int getType() { return type; } | static String function(int type) { Registry reg = DataBrowserAgent.getRegistry(); switch (type) { case MOVIE: return STR; case ORPHANED_IMAGES: String v = (String) reg.lookup(LookupNames.ORPHANED_IMAGE_NAME); if (CommonsLangUtils.isNotBlank(v)) { return v; } return STR; case TAG: return STR; case OTHER: default: return STR; } } private int type; public TreeFileSet(int type) { super(getTypeName(type)); switch (type) { case MOVIE: case TAG: case ORPHANED_IMAGES: this.type = type; break; case OTHER: default: this.type = OTHER; } } public int getType() { return type; } | /**
* Returns the value corresponding to the passed index.
*
* @param type The type to handle;
* @return See above.
*/ | Returns the value corresponding to the passed index | getTypeName | {
"repo_name": "joansmith/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/util/browser/TreeFileSet.java",
"license": "gpl-2.0",
"size": 4182
} | [
"org.openmicroscopy.shoola.agents.dataBrowser.DataBrowserAgent",
"org.openmicroscopy.shoola.env.LookupNames",
"org.openmicroscopy.shoola.env.config.Registry",
"org.openmicroscopy.shoola.util.CommonsLangUtils"
] | import org.openmicroscopy.shoola.agents.dataBrowser.DataBrowserAgent; import org.openmicroscopy.shoola.env.LookupNames; import org.openmicroscopy.shoola.env.config.Registry; import org.openmicroscopy.shoola.util.CommonsLangUtils; | import org.openmicroscopy.shoola.agents.*; import org.openmicroscopy.shoola.env.*; import org.openmicroscopy.shoola.env.config.*; import org.openmicroscopy.shoola.util.*; | [
"org.openmicroscopy.shoola"
] | org.openmicroscopy.shoola; | 1,975,165 |
//-----------------------------------------------------------------------
public final MetaProperty<Set<ObjectId>> positionObjectIds() {
return _positionObjectIds;
} | final MetaProperty<Set<ObjectId>> function() { return _positionObjectIds; } | /**
* The meta-property for the {@code positionObjectIds} property.
* @return the meta-property, not null
*/ | The meta-property for the positionObjectIds property | positionObjectIds | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master/src/main/java/com/opengamma/master/position/PositionSearchRequest.java",
"license": "apache-2.0",
"size": 29171
} | [
"com.opengamma.id.ObjectId",
"java.util.Set",
"org.joda.beans.MetaProperty"
] | import com.opengamma.id.ObjectId; import java.util.Set; import org.joda.beans.MetaProperty; | import com.opengamma.id.*; import java.util.*; import org.joda.beans.*; | [
"com.opengamma.id",
"java.util",
"org.joda.beans"
] | com.opengamma.id; java.util; org.joda.beans; | 176,026 |
default BiConsumer2E<T, U, E1, E2> andThen(final BiConsumer<? super T, ? super U> after) {
Objects.requireNonNull(after);
return (l, r) -> {
accept(l, r);
after.accept(l, r);
};
} | default BiConsumer2E<T, U, E1, E2> andThen(final BiConsumer<? super T, ? super U> after) { Objects.requireNonNull(after); return (l, r) -> { accept(l, r); after.accept(l, r); }; } | /**
* Returns a composed {@code BiConsumer2E} that performs, in sequence, this
* operation followed by the {@code after} operation. If performing either
* operation throws an exception, it is relayed to the caller of the
* composed operation. If performing this operation throws an exception,
* the {@code after} operation will not be performed.
*
* @param after the operation to perform after this operation
* @return a composed {@code BiConsumer2E} that performs in sequence this
* operation followed by the {@code after} operation
* @throws NullPointerException if {@code after} is null
*/ | Returns a composed BiConsumer2E that performs, in sequence, this operation followed by the after operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the after operation will not be performed | andThen | {
"repo_name": "adamretter/j8fu",
"path": "src/main/java/com/evolvedbinary/j8fu/function/BiConsumer2E.java",
"license": "bsd-3-clause",
"size": 5198
} | [
"java.util.Objects",
"java.util.function.BiConsumer"
] | import java.util.Objects; import java.util.function.BiConsumer; | import java.util.*; import java.util.function.*; | [
"java.util"
] | java.util; | 2,022,446 |
public static MailboxListFragment newInstance(long accountId, long initialCurrentMailboxId,
boolean enableHighlight) {
final MailboxListFragment instance = new MailboxListFragment();
final Bundle args = new Bundle();
args.putLong(ARG_ACCOUNT_ID, accountId);
args.putLong(ARG_INITIAL_CURRENT_MAILBOX_ID, initialCurrentMailboxId);
args.putBoolean(ARG_ENABLE_HIGHLIGHT, enableHighlight);
instance.setArguments(args);
return instance;
}
private Long mImmutableAccountId;
private long mImmutableInitialCurrentMailboxId;
private boolean mImmutableEnableHighlight; | static MailboxListFragment function(long accountId, long initialCurrentMailboxId, boolean enableHighlight) { final MailboxListFragment instance = new MailboxListFragment(); final Bundle args = new Bundle(); args.putLong(ARG_ACCOUNT_ID, accountId); args.putLong(ARG_INITIAL_CURRENT_MAILBOX_ID, initialCurrentMailboxId); args.putBoolean(ARG_ENABLE_HIGHLIGHT, enableHighlight); instance.setArguments(args); return instance; } private Long mImmutableAccountId; private long mImmutableInitialCurrentMailboxId; private boolean mImmutableEnableHighlight; | /**
* Create a new instance with initialization parameters.
*
* This fragment should be created only with this method. (Arguments should always be set.)
*
* @param accountId The ID of the account we want to view
* @param initialCurrentMailboxId ID of the mailbox of interest.
* Pass {@link Mailbox#NO_MAILBOX} to show top-level mailboxes.
* @param enableHighlight {@code true} if highlighting is enabled on the current screen
* configuration. (We don't highlight mailboxes on one-pane.)
*/ | Create a new instance with initialization parameters. This fragment should be created only with this method. (Arguments should always be set.) | newInstance | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Email/src/com/android/email/activity/MailboxListFragment.java",
"license": "gpl-2.0",
"size": 50687
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 238,726 |
EReference getStateInternal__Comment_1(); | EReference getStateInternal__Comment_1(); | /**
* Returns the meta object for the containment reference list '{@link cruise.umple.umple.StateInternal_#getComment_1 <em>Comment 1</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Comment 1</em>'.
* @see cruise.umple.umple.StateInternal_#getComment_1()
* @see #getStateInternal_()
* @generated
*/ | Returns the meta object for the containment reference list '<code>cruise.umple.umple.StateInternal_#getComment_1 Comment 1</code>'. | getStateInternal__Comment_1 | {
"repo_name": "ahmedvc/umple",
"path": "cruise.umple.xtext/src-gen/cruise/umple/umple/UmplePackage.java",
"license": "mit",
"size": 485842
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 392,275 |
public void testProperties2 ()
{
Attribute attribute;
Attribute space;
Vector attributes;
Tag tag;
String html;
attributes = new Vector ();
attribute = new PageAttribute ();
attribute.setName ("wombat");
assertTrue ("should be standalone", attribute.isStandAlone ());
assertTrue ("should not be whitespace", !attribute.isWhitespace ());
assertTrue ("should not be valued", !attribute.isValued ());
assertTrue ("should not be empty", !attribute.isEmpty ());
attributes.add (attribute);
space = new PageAttribute ();
space.setValue (" ");
assertTrue ("should not be standalone", !space.isStandAlone ());
assertTrue ("should be whitespace", space.isWhitespace ());
assertTrue ("should be valued", space.isValued ());
assertTrue ("should not be empty", !space.isEmpty ());
attributes.add (space);
attribute = new PageAttribute ();
attribute.setName ("label");
attribute.setAssignment ("=");
attribute.setRawValue ("The civil war.");
assertTrue ("should not be standalone", !attribute.isStandAlone ());
assertTrue ("should not be whitespace", !attribute.isWhitespace ());
assertTrue ("should be valued", attribute.isValued ());
assertTrue ("should not be empty", !attribute.isEmpty ());
attributes.add (attribute);
attributes.add (space);
attribute = new PageAttribute ();
attribute.setName ("frameborder");
attribute.setAssignment ("= ");
attribute.setRawValue ("no");
assertTrue ("should not be standalone", !attribute.isStandAlone ());
assertTrue ("should not be whitespace", !attribute.isWhitespace ());
assertTrue ("should be valued", attribute.isValued ());
assertTrue ("should not be empty", !attribute.isEmpty ());
attributes.add (attribute);
attributes.add (space);
attribute = new PageAttribute ();
attribute.setName ("name");
attribute.setAssignment ("=");
attribute.setValue ("topFrame");
attribute.setQuote ('"');
assertTrue ("should not be standalone", !attribute.isStandAlone ());
assertTrue ("should not be whitespace", !attribute.isWhitespace ());
assertTrue ("should be valued", attribute.isValued ());
assertTrue ("should not be empty", !attribute.isEmpty ());
attributes.add (attribute);
tag = new TagNode (null, 0, 0, attributes);
html = "<wombat label=\"The civil war.\" frameborder= no name=\"topFrame\">";
assertStringEquals ("tag contents", html, tag.toHtml ());
}
| void function () { Attribute attribute; Attribute space; Vector attributes; Tag tag; String html; attributes = new Vector (); attribute = new PageAttribute (); attribute.setName (STR); assertTrue (STR, attribute.isStandAlone ()); assertTrue (STR, !attribute.isWhitespace ()); assertTrue (STR, !attribute.isValued ()); assertTrue (STR, !attribute.isEmpty ()); attributes.add (attribute); space = new PageAttribute (); space.setValue (" "); assertTrue (STR, !space.isStandAlone ()); assertTrue (STR, space.isWhitespace ()); assertTrue (STR, space.isValued ()); assertTrue (STR, !space.isEmpty ()); attributes.add (space); attribute = new PageAttribute (); attribute.setName ("label"); attribute.setAssignment ("="); attribute.setRawValue (STR); assertTrue (STR, !attribute.isStandAlone ()); assertTrue (STR, !attribute.isWhitespace ()); assertTrue (STR, attribute.isValued ()); assertTrue (STR, !attribute.isEmpty ()); attributes.add (attribute); attributes.add (space); attribute = new PageAttribute (); attribute.setName (STR); attribute.setAssignment (STR); attribute.setRawValue ("no"); assertTrue (STR, !attribute.isStandAlone ()); assertTrue (STR, !attribute.isWhitespace ()); assertTrue (STR, attribute.isValued ()); assertTrue (STR, !attribute.isEmpty ()); attributes.add (attribute); attributes.add (space); attribute = new PageAttribute (); attribute.setName ("name"); attribute.setAssignment ("="); attribute.setValue (STR); attribute.setQuote ('"'); assertTrue (STR, !attribute.isStandAlone ()); assertTrue (STR, !attribute.isWhitespace ()); assertTrue (STR, attribute.isValued ()); assertTrue (STR, !attribute.isEmpty ()); attributes.add (attribute); tag = new TagNode (null, 0, 0, attributes); html = "<wombat label=\STR frameborder= no name=\STR>STRtag contents", html, tag.toHtml ()); } | /**
* Test bean properties.
*/ | Test bean properties | testProperties2 | {
"repo_name": "socialwareinc/html-parser",
"path": "parser/src/test/java/org/htmlparser/tests/lexerTests/AttributeTests.java",
"license": "lgpl-3.0",
"size": 37178
} | [
"java.util.Vector",
"org.htmlparser.Attribute",
"org.htmlparser.Tag",
"org.htmlparser.lexer.PageAttribute",
"org.htmlparser.nodes.TagNode"
] | import java.util.Vector; import org.htmlparser.Attribute; import org.htmlparser.Tag; import org.htmlparser.lexer.PageAttribute; import org.htmlparser.nodes.TagNode; | import java.util.*; import org.htmlparser.*; import org.htmlparser.lexer.*; import org.htmlparser.nodes.*; | [
"java.util",
"org.htmlparser",
"org.htmlparser.lexer",
"org.htmlparser.nodes"
] | java.util; org.htmlparser; org.htmlparser.lexer; org.htmlparser.nodes; | 2,466,352 |
NUHttpGet httpGet = new NUHttpGet(url);
HttpResponse httpResponse = NUHttpClient.getHttpClient().execute(httpGet);
return EntityUtils.toString(httpResponse.getEntity());
} | NUHttpGet httpGet = new NUHttpGet(url); HttpResponse httpResponse = NUHttpClient.getHttpClient().execute(httpGet); return EntityUtils.toString(httpResponse.getEntity()); } | /**
* Get the content of a page.
* @param url url from which to read
* @return the String content of the page
* @throws Exception
*/ | Get the content of a page | getData | {
"repo_name": "Neembuu-Uploader/neembuu-uploader",
"path": "modules/neembuu-uploader-utils/src/neembuu/uploader/utils/NUHttpClientUtils.java",
"license": "gpl-3.0",
"size": 3371
} | [
"org.apache.http.HttpResponse",
"org.apache.http.util.EntityUtils"
] | import org.apache.http.HttpResponse; import org.apache.http.util.EntityUtils; | import org.apache.http.*; import org.apache.http.util.*; | [
"org.apache.http"
] | org.apache.http; | 1,746,456 |
public synchronized void setTabTitle(@NotNull String title, int tabIndex) {
// Throws exception if tabIndex is out of valid range
checkRange(tabIndex, 0, tabsData.size());
tabsData.get(tabIndex).tabTitle = title;
titleListeners.forEach(listener -> listener.changed(title, tabIndex));
} | synchronized void function(@NotNull String title, int tabIndex) { checkRange(tabIndex, 0, tabsData.size()); tabsData.get(tabIndex).tabTitle = title; titleListeners.forEach(listener -> listener.changed(title, tabIndex)); } | /**
* Sets the tab title of the specified tab.
* <p>
* Notifies all {@link TabTitleChangeListener} listeners of the change.
*
* @param title title to set
* @param tabIndex the index of the tab with title to set
*
* @throws IndexOutOfBoundsException if the index is out of range
* (index < 0 || index >= countTabs())
*/ | Sets the tab title of the specified tab. Notifies all <code>TabTitleChangeListener</code> listeners of the change | setTabTitle | {
"repo_name": "dmtolpeko/sqlines",
"path": "sqlines-studio-java/src/main/java/com/sqlines/studio/model/tabsdata/ObservableTabsData.java",
"license": "apache-2.0",
"size": 23316
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,434 |
List<ManagedPath> queryManagedPaths(String pathsPattern); | List<ManagedPath> queryManagedPaths(String pathsPattern); | /**
* Query managed server paths
* @param pathsPattern The path pattern to query for
* @return A list of managed server paths
*/ | Query managed server paths | queryManagedPaths | {
"repo_name": "ASzc/fuse-patch-jdk6",
"path": "core/src/main/java/org/wildfly/extras/patch/Server.java",
"license": "apache-2.0",
"size": 2375
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 962,826 |
public long getChannelPosition(Block b, BlockWriteStreams streams)
throws IOException {
FileOutputStream file = (FileOutputStream) streams.dataOut;
return file.getChannel().position();
} | long function(Block b, BlockWriteStreams streams) throws IOException { FileOutputStream file = (FileOutputStream) streams.dataOut; return file.getChannel().position(); } | /**
* Retrieves the offset in the block to which the
* the next write will write data to.
*/ | Retrieves the offset in the block to which the the next write will write data to | getChannelPosition | {
"repo_name": "ryanobjc/hadoop-cloudera",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java",
"license": "apache-2.0",
"size": 63084
} | [
"java.io.FileOutputStream",
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.Block"
] | import java.io.FileOutputStream; import java.io.IOException; import org.apache.hadoop.hdfs.protocol.Block; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 538,406 |
@NonNull
protected final PrintStream immutableGetPrintStream() {
return this.stream;
} | final PrintStream function() { return this.stream; } | /**
* Retrieves the {@link PrintStream}.
* @return such instance.
*/ | Retrieves the <code>PrintStream</code> | immutableGetPrintStream | {
"repo_name": "osoco/java-logging",
"path": "src/main/java/es/osoco/logging/adapter/printstream/PrintStreamLoggingConfiguration.java",
"license": "gpl-3.0",
"size": 2638
} | [
"java.io.PrintStream"
] | import java.io.PrintStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,172,103 |
protected synchronized void addProjectionListener(ProjectionListener l) {
projectionSupport.add(l);
} | synchronized void function(ProjectionListener l) { projectionSupport.add(l); } | /**
* Add a ProjectionListener to this menu and its components.
*/ | Add a ProjectionListener to this menu and its components | addProjectionListener | {
"repo_name": "d2fn/passage",
"path": "src/main/java/com/bbn/openmap/gui/menu/ProjectionMenu.java",
"license": "mit",
"size": 8119
} | [
"com.bbn.openmap.event.ProjectionListener"
] | import com.bbn.openmap.event.ProjectionListener; | import com.bbn.openmap.event.*; | [
"com.bbn.openmap"
] | com.bbn.openmap; | 1,348,404 |
@throws NullPointerException If {@code vertices} or any of its elements is {@code null}.
*/
public void set(final Vector<Point> vertices) {
if (vertices == null)
throw new NullPointerException("Vertices is null");
np = vertices.size();
final int minlen = np + 1;
if (minlen > p.length)
p = new Point[minlen+MINCAP];
for (int i=0; i<np; ++i) {
final Point pi = vertices.get(i);
if (pi == null)
throw new NullPointerException("Vertex "+i+" is null");
else p[i] = pi;
}
update();
}
/** Sets the vertices of the spline to the given vertices. Alias of method {@link #set(Vector)}.
@param vertices The vertices to be copied. The handles of the {@code Point} objects are copied. Any subsequent modifications of the vertices become effective only after calling the {@link #update()} method.
| @throws NullPointerException If {@code vertices} or any of its elements is {@code null}. */ void function(final Vector<Point> vertices) { if (vertices == null) throw new NullPointerException(STR); np = vertices.size(); final int minlen = np + 1; if (minlen > p.length) p = new Point[minlen+MINCAP]; for (int i=0; i<np; ++i) { final Point pi = vertices.get(i); if (pi == null) throw new NullPointerException(STR+i+STR); else p[i] = pi; } update(); } /** Sets the vertices of the spline to the given vertices. Alias of method {@link #set(Vector)}. @param vertices The vertices to be copied. The handles of the {@code Point} objects are copied. Any subsequent modifications of the vertices become effective only after calling the {@link #update()} method. | /** Sets the vertices of the spline to the given vertices.
@param vertices The vertices to be copied. The handles of the {@code Point} objects are copied. Any subsequent modifications of the vertices become effective only after calling the {@link #update()} method.
@throws NullPointerException If {@code vertices} or any of its elements is {@code null}.
*/ | Sets the vertices of the spline to the given vertices | set | {
"repo_name": "yajunyang/BioImage",
"path": "lib/ImageScience-master/ImageScience-master/src/main/java/imagescience/shape/Spline.java",
"license": "bsd-2-clause",
"size": 17884
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 2,530,302 |
public boolean canDeleteIndexContents(Index index, IndexSettings indexSettings) {
// index contents can be deleted if its an already closed index (so all its resources have
// already been relinquished)
final IndexService indexService = indexService(index);
if (indexService == null && nodeEnv.hasNodeFile()) {
return true;
}
return false;
} | boolean function(Index index, IndexSettings indexSettings) { final IndexService indexService = indexService(index); if (indexService == null && nodeEnv.hasNodeFile()) { return true; } return false; } | /**
* This method returns true if the current node is allowed to delete the given index.
* This is the case if the index is deleted in the metadata or there is no allocation
* on the local node and the index isn't on a shared file system.
* @param index {@code Index} to check whether deletion is allowed
* @param indexSettings {@code IndexSettings} for the given index
* @return true if the index can be deleted on this node
*/ | This method returns true if the current node is allowed to delete the given index. This is the case if the index is deleted in the metadata or there is no allocation on the local node and the index isn't on a shared file system | canDeleteIndexContents | {
"repo_name": "jimczi/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/indices/IndicesService.java",
"license": "apache-2.0",
"size": 62466
} | [
"org.elasticsearch.index.Index",
"org.elasticsearch.index.IndexService",
"org.elasticsearch.index.IndexSettings"
] | import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.IndexSettings; | import org.elasticsearch.index.*; | [
"org.elasticsearch.index"
] | org.elasticsearch.index; | 936,176 |
public static boolean isValidFileName (String name) {
try {
if (OsUtils.isWindows()) if (name.contains(">") || name.contains("<")) return false;
return new File(name).getCanonicalFile().getName().equals(name);
} catch (IOException e) {
return false;
}
} | static boolean function (String name) { try { if (OsUtils.isWindows()) if (name.contains(">") name.contains("<")) return false; return new File(name).getCanonicalFile().getName().equals(name); } catch (IOException e) { return false; } } | /**
* Checks whether given name is valid for current user OS.
* @param name that will be checked
* @return true if name is valid, false otherwise
*/ | Checks whether given name is valid for current user OS | isValidFileName | {
"repo_name": "StQuote/VisEditor",
"path": "UI/src/com/kotcrab/vis/ui/widget/file/FileUtils.java",
"license": "apache-2.0",
"size": 3181
} | [
"com.kotcrab.vis.ui.util.OsUtils",
"java.io.File",
"java.io.IOException"
] | import com.kotcrab.vis.ui.util.OsUtils; import java.io.File; import java.io.IOException; | import com.kotcrab.vis.ui.util.*; import java.io.*; | [
"com.kotcrab.vis",
"java.io"
] | com.kotcrab.vis; java.io; | 981,278 |
@OnError
public void onError (Session session, Throwable throwable, @PathParam("streamname") String streamName,
@PathParam("version") String version, @PathParam("tdomain") String tdomain) {
try {
PrivilegedCarbonContext.getThreadLocalCarbonContext().startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tdomain, true);
super.onError(session, throwable, streamName, version);
} finally {
PrivilegedCarbonContext.getThreadLocalCarbonContext().endTenantFlow();
}
} | void function (Session session, Throwable throwable, @PathParam(STR) String streamName, @PathParam(STR) String version, @PathParam(STR) String tdomain) { try { PrivilegedCarbonContext.getThreadLocalCarbonContext().startTenantFlow(); PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(tdomain, true); super.onError(session, throwable, streamName, version); } finally { PrivilegedCarbonContext.getThreadLocalCarbonContext().endTenantFlow(); } } | /**
* Web socket onError - Remove the registered sessions
*
* @param session - Users registered session.
* @param throwable - Status code for web-socket close.
* @param streamName - StreamName extracted from the ws url.
* @param version - Version extracted from the ws url.
*/ | Web socket onError - Remove the registered sessions | onError | {
"repo_name": "keizer619/carbon-analytics-common",
"path": "components/event-publisher/event-output-adapters/org.wso2.carbon.event.output.adapter.ui/org.wso2.carbon.event.output.adapter.ui.endpoint/src/main/java/TenantSubscriptionEndpoint.java",
"license": "apache-2.0",
"size": 4932
} | [
"javax.websocket.Session",
"javax.websocket.server.PathParam",
"org.wso2.carbon.context.PrivilegedCarbonContext"
] | import javax.websocket.Session; import javax.websocket.server.PathParam; import org.wso2.carbon.context.PrivilegedCarbonContext; | import javax.websocket.*; import javax.websocket.server.*; import org.wso2.carbon.context.*; | [
"javax.websocket",
"org.wso2.carbon"
] | javax.websocket; org.wso2.carbon; | 1,248,679 |
@Test
public void testBuildForwardStringForActionListCommand() throws Exception {
Assert.assertEquals(
awardAction.buildForwardStringForActionListCommand(MOCK_FORWARD_STRING,
MOCK_DOC_ID_REQUEST_PARAMETER),MOCK_EXPECTED_RESULT_STRING);
} | void function() throws Exception { Assert.assertEquals( awardAction.buildForwardStringForActionListCommand(MOCK_FORWARD_STRING, MOCK_DOC_ID_REQUEST_PARAMETER),MOCK_EXPECTED_RESULT_STRING); } | /**
*
* This test tests the AwardAction.buildForwardStringForActionListCommand method.
* @throws Exception
*/ | This test tests the AwardAction.buildForwardStringForActionListCommand method | testBuildForwardStringForActionListCommand | {
"repo_name": "sanjupolus/kc-coeus-1508.3",
"path": "coeus-impl/src/test/java/org/kuali/kra/award/web/struts/action/AwardActionTest.java",
"license": "agpl-3.0",
"size": 2065
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,021,180 |
@Test
public void testGetPortPairGroupCount() {
testCreatePortPairGroup();
assertThat(portPairGroupMgr.getPortPairGroupCount(), is(1));
} | void function() { testCreatePortPairGroup(); assertThat(portPairGroupMgr.getPortPairGroupCount(), is(1)); } | /**
* Checks the operation of getPortPairGroupCount() method.
*/ | Checks the operation of getPortPairGroupCount() method | testGetPortPairGroupCount | {
"repo_name": "planoAccess/clonedONOS",
"path": "apps/vtn/vtnrsc/src/test/java/org/onosproject/vtnrsc/portpairgroup/impl/PortPairGroupManagerTest.java",
"license": "apache-2.0",
"size": 5214
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import org.hamcrest.*; | [
"org.hamcrest"
] | org.hamcrest; | 1,353,392 |
public static boolean isDate(String date, String pattern) {
return DateValidator.getInstance().isValid(date, pattern);
} | static boolean function(String date, String pattern) { return DateValidator.getInstance().isValid(date, pattern); } | /**
* Validate using the specified <i>pattern</i>.
*
* @param date The value validation is being performed on.
* @param pattern The pattern used to validate the value against.
* @return <code>true</code> if the value is valid.
*/ | Validate using the specified pattern | isDate | {
"repo_name": "data-integrations/wrangler",
"path": "wrangler-core/src/main/java/io/cdap/functions/DataQuality.java",
"license": "apache-2.0",
"size": 9464
} | [
"org.apache.commons.validator.routines.DateValidator"
] | import org.apache.commons.validator.routines.DateValidator; | import org.apache.commons.validator.routines.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,956,552 |
@Select("SELECT id,gameId,name,data,stamp FROM saves WHERE gameId={saveGameId}")
public void selectList(String saveGameId,ListCallback<IPhoneSaveGameBean> callback) {} | @Select(STR) public void selectList(String saveGameId,ListCallback<IPhoneSaveGameBean> callback) {} | /**
* Records a Click value, and obtains the ID of the inserted record.
*/ | Records a Click value, and obtains the ID of the inserted record | insertSave | {
"repo_name": "Antokolos/iambookmaster",
"path": "src/com/iambookmaster/client/iphone/data/IPhoneDBDataService.java",
"license": "lgpl-3.0",
"size": 2689
} | [
"com.google.code.gwt.database.client.service.ListCallback",
"com.google.code.gwt.database.client.service.Select"
] | import com.google.code.gwt.database.client.service.ListCallback; import com.google.code.gwt.database.client.service.Select; | import com.google.code.gwt.database.client.service.*; | [
"com.google.code"
] | com.google.code; | 520,912 |
void setOkButton() {
if (this.okButton != null) {
this.okButton.setEnabled(!StringUtils.isBlank(ruleNameTextField.getText()) && atLeastOneConditionSet() && (shouldAlertCheckBox.isSelected() || shouldSaveCheckBox.isSelected()));
}
} | void setOkButton() { if (this.okButton != null) { this.okButton.setEnabled(!StringUtils.isBlank(ruleNameTextField.getText()) && atLeastOneConditionSet() && (shouldAlertCheckBox.isSelected() shouldSaveCheckBox.isSelected())); } } | /**
* Sets whether or not the OK button should be enabled based upon other UI
* elements
*/ | Sets whether or not the OK button should be enabled based upon other UI elements | setOkButton | {
"repo_name": "esaunders/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.java",
"license": "apache-2.0",
"size": 50353
} | [
"org.apache.commons.lang.StringUtils"
] | import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,015,183 |
public String allowUserToConnect(SocketAddress p_148542_1_, GameProfile p_148542_2_)
{
return p_148542_2_.getName().equalsIgnoreCase(this.getServerInstance().getServerOwner()) && this.func_152612_a(p_148542_2_.getName()) != null ? "That name is already taken." : super.allowUserToConnect(p_148542_1_, p_148542_2_);
} | String function(SocketAddress p_148542_1_, GameProfile p_148542_2_) { return p_148542_2_.getName().equalsIgnoreCase(this.getServerInstance().getServerOwner()) && this.func_152612_a(p_148542_2_.getName()) != null ? STR : super.allowUserToConnect(p_148542_1_, p_148542_2_); } | /**
* checks ban-lists, then white-lists, then space for the server. Returns null on success, or an error message
*/ | checks ban-lists, then white-lists, then space for the server. Returns null on success, or an error message | allowUserToConnect | {
"repo_name": "CheeseL0ver/Ore-TTM",
"path": "build/tmp/recompSrc/net/minecraft/server/integrated/IntegratedPlayerList.java",
"license": "lgpl-2.1",
"size": 2044
} | [
"com.mojang.authlib.GameProfile",
"java.net.SocketAddress"
] | import com.mojang.authlib.GameProfile; import java.net.SocketAddress; | import com.mojang.authlib.*; import java.net.*; | [
"com.mojang.authlib",
"java.net"
] | com.mojang.authlib; java.net; | 506,844 |
public boolean handleWaterMovement()
{
return this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox(), Material.water, this);
} | boolean function() { return this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox(), Material.water, this); } | /**
* Returns if this entity is in water and will end up adding the waters velocity to the entity
*/ | Returns if this entity is in water and will end up adding the waters velocity to the entity | handleWaterMovement | {
"repo_name": "TorchPowered/CraftBloom",
"path": "src/net/minecraft/entity/item/EntityXPOrb.java",
"license": "mit",
"size": 7966
} | [
"net.minecraft.block.material.Material"
] | import net.minecraft.block.material.Material; | import net.minecraft.block.material.*; | [
"net.minecraft.block"
] | net.minecraft.block; | 2,889,071 |
public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String virtualNetworkName, String virtualNetworkPeeringName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName), serviceCallback); } | /**
* Deletes the specified virtual network peering.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @param virtualNetworkPeeringName The name of the virtual network peering.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Deletes the specified virtual network peering | beginDeleteAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/VirtualNetworkPeeringsInner.java",
"license": "mit",
"size": 48368
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 764,761 |
public void printBitmap(String jobName, Bitmap bitmap) {
mImpl.printBitmap(jobName, bitmap, null);
} | void function(String jobName, Bitmap bitmap) { mImpl.printBitmap(jobName, bitmap, null); } | /**
* Prints a bitmap.
*
* @param jobName The print job name.
* @param bitmap The bitmap to print.
*/ | Prints a bitmap | printBitmap | {
"repo_name": "ycdev-aosp/sdk-support",
"path": "v4/src/java/android/support/v4/print/PrintHelper.java",
"license": "apache-2.0",
"size": 10877
} | [
"android.graphics.Bitmap"
] | import android.graphics.Bitmap; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,687,577 |
protected static synchronized void resetAllCounters() {
for (AtomicInteger counter : nodeCounters.values()) {
counter.set(0);
}
} | static synchronized void function() { for (AtomicInteger counter : nodeCounters.values()) { counter.set(0); } } | /**
* Helper method for test purposes that allows tests to start clean (made protected
* to ensure that it is not called accidentally)
*/ | Helper method for test purposes that allows tests to start clean (made protected to ensure that it is not called accidentally) | resetAllCounters | {
"repo_name": "jmandawg/camel",
"path": "camel-core/src/main/java/org/apache/camel/impl/DefaultNodeIdFactory.java",
"license": "apache-2.0",
"size": 2106
} | [
"java.util.concurrent.atomic.AtomicInteger"
] | import java.util.concurrent.atomic.AtomicInteger; | import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 1,817,031 |
return INSTANCE;
}
private static final ForexOptionVanillaBlackFlatMethod METHOD_FX_VAN = ForexOptionVanillaBlackFlatMethod.getInstance(); | return INSTANCE; } private static final ForexOptionVanillaBlackFlatMethod METHOD_FX_VAN = ForexOptionVanillaBlackFlatMethod.getInstance(); | /**
* Gets the calculator instance.
* @return The calculator.
*/ | Gets the calculator instance | getInstance | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/provider/calculator/blackforex/PresentValueForexBlackFlatCalculator.java",
"license": "apache-2.0",
"size": 2169
} | [
"com.opengamma.analytics.financial.forex.provider.ForexOptionVanillaBlackFlatMethod"
] | import com.opengamma.analytics.financial.forex.provider.ForexOptionVanillaBlackFlatMethod; | import com.opengamma.analytics.financial.forex.provider.*; | [
"com.opengamma.analytics"
] | com.opengamma.analytics; | 1,880,007 |
private Rectangle getConstraint( )
{
IFigure parent = ( (MasterPageEditPart) getParent( ) ).getFigure( );
Rectangle region = parent.getClientArea( );
Rectangle rect = new Rectangle( );
rect.height = -1;
rect.width = region.width;
// Define the default height value of header and footer
SimpleMasterPageHandle mphandle = ( (SimpleMasterPageHandle) ( (MasterPageEditPart) getParent( ) )
.getModel( ) );
if ( ( (SlotHandle) getModel( ) ).getSlotID( ) == SimpleMasterPageHandle.PAGE_HEADER_SLOT )
{
if ( mphandle.getPropertyHandle(
SimpleMasterPageHandle.HEADER_HEIGHT_PROP ).isSet( ) || DEUtil.isFixLayout( getParent( ).getModel( ) ))
{
DimensionHandle handle = mphandle.getHeaderHeight( );
rect.height = getHeight( handle );
}
}
else
{
if ( mphandle.getPropertyHandle(
SimpleMasterPageHandle.FOOTER_HEIGHT_PROP ).isSet( ) || DEUtil.isFixLayout( getParent( ).getModel( ) ))
{
DimensionHandle handle = mphandle.getFooterHeight( );
rect.height = getHeight( handle);
}
}
if ( ( (SlotHandle) getModel( ) ).getSlotID( ) == SimpleMasterPageHandle.PAGE_HEADER_SLOT )
{
rect.setLocation( 0, 0 );
}
else
{
rect.setLocation( -1, -1 );
}
return rect;
} | Rectangle function( ) { IFigure parent = ( (MasterPageEditPart) getParent( ) ).getFigure( ); Rectangle region = parent.getClientArea( ); Rectangle rect = new Rectangle( ); rect.height = -1; rect.width = region.width; SimpleMasterPageHandle mphandle = ( (SimpleMasterPageHandle) ( (MasterPageEditPart) getParent( ) ) .getModel( ) ); if ( ( (SlotHandle) getModel( ) ).getSlotID( ) == SimpleMasterPageHandle.PAGE_HEADER_SLOT ) { if ( mphandle.getPropertyHandle( SimpleMasterPageHandle.HEADER_HEIGHT_PROP ).isSet( ) DEUtil.isFixLayout( getParent( ).getModel( ) )) { DimensionHandle handle = mphandle.getHeaderHeight( ); rect.height = getHeight( handle ); } } else { if ( mphandle.getPropertyHandle( SimpleMasterPageHandle.FOOTER_HEIGHT_PROP ).isSet( ) DEUtil.isFixLayout( getParent( ).getModel( ) )) { DimensionHandle handle = mphandle.getFooterHeight( ); rect.height = getHeight( handle); } } if ( ( (SlotHandle) getModel( ) ).getSlotID( ) == SimpleMasterPageHandle.PAGE_HEADER_SLOT ) { rect.setLocation( 0, 0 ); } else { rect.setLocation( -1, -1 ); } return rect; } | /**
* Get the default constraint of area figure.
*
* @return
*/ | Get the default constraint of area figure | getConstraint | {
"repo_name": "sguan-actuate/birt",
"path": "UI/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/editors/schematic/editparts/AreaEditPart.java",
"license": "epl-1.0",
"size": 4783
} | [
"org.eclipse.birt.report.designer.util.DEUtil",
"org.eclipse.birt.report.model.api.DimensionHandle",
"org.eclipse.birt.report.model.api.SimpleMasterPageHandle",
"org.eclipse.birt.report.model.api.SlotHandle",
"org.eclipse.draw2d.IFigure",
"org.eclipse.draw2d.geometry.Rectangle"
] | import org.eclipse.birt.report.designer.util.DEUtil; import org.eclipse.birt.report.model.api.DimensionHandle; import org.eclipse.birt.report.model.api.SimpleMasterPageHandle; import org.eclipse.birt.report.model.api.SlotHandle; import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Rectangle; | import org.eclipse.birt.report.designer.util.*; import org.eclipse.birt.report.model.api.*; import org.eclipse.draw2d.*; import org.eclipse.draw2d.geometry.*; | [
"org.eclipse.birt",
"org.eclipse.draw2d"
] | org.eclipse.birt; org.eclipse.draw2d; | 560,515 |
private void loadFileMetadataAndJournal(LockedInodePath inodePath,
MountTable.Resolution resolution, LoadMetadataOptions options, JournalContext journalContext)
throws BlockInfoException, FileDoesNotExistException, InvalidPathException,
AccessControlException, FileAlreadyCompletedException, InvalidFileSizeException, IOException {
if (inodePath.fullPathExists()) {
return;
}
AlluxioURI ufsUri = resolution.getUri();
UnderFileSystem ufs = resolution.getUfs();
long ufsBlockSizeByte = ufs.getBlockSizeByte(ufsUri.toString());
UfsFileStatus ufsStatus = (UfsFileStatus) options.getUfsStatus();
if (ufsStatus == null) {
ufsStatus = ufs.getFileStatus(ufsUri.toString());
}
long ufsLength = ufsStatus.getContentLength();
// Metadata loaded from UFS has no TTL set.
CreateFileOptions createFileOptions =
CreateFileOptions.defaults().setBlockSizeBytes(ufsBlockSizeByte)
.setRecursive(options.isCreateAncestors()).setMetadataLoad(true).setPersisted(true);
String ufsOwner = ufsStatus.getOwner();
String ufsGroup = ufsStatus.getGroup();
short ufsMode = ufsStatus.getMode();
Mode mode = new Mode(ufsMode);
if (resolution.getShared()) {
mode.setOtherBits(mode.getOtherBits().or(mode.getOwnerBits()));
}
createFileOptions = createFileOptions.setOwner(ufsOwner).setGroup(ufsGroup).setMode(mode);
try {
createFileAndJournal(inodePath, createFileOptions, journalContext);
CompleteFileOptions completeOptions = CompleteFileOptions.defaults().setUfsLength(ufsLength);
completeFileAndJournal(inodePath, completeOptions, journalContext);
} catch (FileAlreadyExistsException e) {
// This may occur if there are concurrent load metadata requests. To allow loading metadata
// to be idempotent, ensure the full path exists when this happens.
mInodeTree.ensureFullInodePath(inodePath, inodePath.getLockMode());
}
} | void function(LockedInodePath inodePath, MountTable.Resolution resolution, LoadMetadataOptions options, JournalContext journalContext) throws BlockInfoException, FileDoesNotExistException, InvalidPathException, AccessControlException, FileAlreadyCompletedException, InvalidFileSizeException, IOException { if (inodePath.fullPathExists()) { return; } AlluxioURI ufsUri = resolution.getUri(); UnderFileSystem ufs = resolution.getUfs(); long ufsBlockSizeByte = ufs.getBlockSizeByte(ufsUri.toString()); UfsFileStatus ufsStatus = (UfsFileStatus) options.getUfsStatus(); if (ufsStatus == null) { ufsStatus = ufs.getFileStatus(ufsUri.toString()); } long ufsLength = ufsStatus.getContentLength(); CreateFileOptions createFileOptions = CreateFileOptions.defaults().setBlockSizeBytes(ufsBlockSizeByte) .setRecursive(options.isCreateAncestors()).setMetadataLoad(true).setPersisted(true); String ufsOwner = ufsStatus.getOwner(); String ufsGroup = ufsStatus.getGroup(); short ufsMode = ufsStatus.getMode(); Mode mode = new Mode(ufsMode); if (resolution.getShared()) { mode.setOtherBits(mode.getOtherBits().or(mode.getOwnerBits())); } createFileOptions = createFileOptions.setOwner(ufsOwner).setGroup(ufsGroup).setMode(mode); try { createFileAndJournal(inodePath, createFileOptions, journalContext); CompleteFileOptions completeOptions = CompleteFileOptions.defaults().setUfsLength(ufsLength); completeFileAndJournal(inodePath, completeOptions, journalContext); } catch (FileAlreadyExistsException e) { mInodeTree.ensureFullInodePath(inodePath, inodePath.getLockMode()); } } | /**
* Loads metadata for the file identified by the given path from UFS into Alluxio.
*
* @param inodePath the path for which metadata should be loaded
* @param resolution the UFS resolution of path
* @param options the load metadata options
* @param journalContext the journal context
* @throws BlockInfoException if an invalid block size is encountered
* @throws FileDoesNotExistException if there is no UFS path
* @throws InvalidPathException if invalid path is encountered
* @throws AccessControlException if permission checking fails or permission setting fails
* @throws FileAlreadyCompletedException if the file is already completed
* @throws InvalidFileSizeException if invalid file size is encountered
*/ | Loads metadata for the file identified by the given path from UFS into Alluxio | loadFileMetadataAndJournal | {
"repo_name": "Reidddddd/mo-alluxio",
"path": "core/server/master/src/main/java/alluxio/master/file/DefaultFileSystemMaster.java",
"license": "apache-2.0",
"size": 129113
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,538,879 |
@Override
public String getText(Object object) {
String label = ((TestCase)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_TestCase_type") :
getString("_UI_TestCase_type") + " " + label;
} | String function(Object object) { String label = ((TestCase)object).getName(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "ObeoNetwork/EAST-ADL-Designer",
"path": "plugins/org.obeonetwork.dsl.eastadl.edit/src/org/obeonetwork/dsl/east_adl/verification_validation/provider/TestCaseItemProvider.java",
"license": "epl-1.0",
"size": 6806
} | [
"org.obeonetwork.dsl.east_adl.verification_validation.TestCase"
] | import org.obeonetwork.dsl.east_adl.verification_validation.TestCase; | import org.obeonetwork.dsl.east_adl.verification_validation.*; | [
"org.obeonetwork.dsl"
] | org.obeonetwork.dsl; | 2,275,251 |
public static boolean isContributionMethod(@Nonnull Method method, boolean removeAbstractModifier) {
requireNonNull(method, ERROR_METHOD_NULL);
return isContributionMethod(MethodDescriptor.forMethod(method, removeAbstractModifier));
} | static boolean function(@Nonnull Method method, boolean removeAbstractModifier) { requireNonNull(method, ERROR_METHOD_NULL); return isContributionMethod(MethodDescriptor.forMethod(method, removeAbstractModifier)); } | /**
* Finds out if the given Method represents a contribution method
* by matching its name against the following pattern:
* "^with[A-Z][a-z0-9_]*[\w]*$"<p>
* <pre>
* // assuming getMethod() returns an appropriate Method reference
* isContributionMethod(getMethod("withRest")) = true
* isContributionMethod(getMethod("withMVCGroup")) = false
* isContributionMethod(getMethod("without")) = false
* </pre>
*
* @param method a Method reference
* @return true if the method name matches the given contribution method
* pattern, false otherwise.
*/ | Finds out if the given Method represents a contribution method by matching its name against the following pattern: "^with[A-Z][a-z0-9_]*[\w]*$" <code> assuming getMethod() returns an appropriate Method reference isContributionMethod(getMethod("withRest")) = true isContributionMethod(getMethod("withMVCGroup")) = false isContributionMethod(getMethod("without")) = false </code> | isContributionMethod | {
"repo_name": "levymoreira/griffon",
"path": "subprojects/griffon-core/src/main/java/griffon/util/GriffonClassUtils.java",
"license": "apache-2.0",
"size": 129659
} | [
"java.lang.reflect.Method",
"java.util.Objects",
"javax.annotation.Nonnull"
] | import java.lang.reflect.Method; import java.util.Objects; import javax.annotation.Nonnull; | import java.lang.reflect.*; import java.util.*; import javax.annotation.*; | [
"java.lang",
"java.util",
"javax.annotation"
] | java.lang; java.util; javax.annotation; | 235,132 |
@Test
public void testBranchCreatedNotifications() throws UnsupportedActionException, DataProviderException {
SaveRestoreService.getInstance().setSelectedDataProvider(dataProvider);
verify(dataProvider.getProvider(), times(1)).getBranches();
assertEquals("Default branch is selected", branch, selector.selectedBranchProperty().get());
dataProvider.getProvider().createNewBranch(branch, "newBranch");
// when new branch is created and selector notified, it should re-query the branches
verify(dataProvider.getProvider(), times(2)).getBranches();
assertEquals("New branch is selected", newBranch, selector.selectedBranchProperty().get());
} | void function() throws UnsupportedActionException, DataProviderException { SaveRestoreService.getInstance().setSelectedDataProvider(dataProvider); verify(dataProvider.getProvider(), times(1)).getBranches(); assertEquals(STR, branch, selector.selectedBranchProperty().get()); dataProvider.getProvider().createNewBranch(branch, STR); verify(dataProvider.getProvider(), times(2)).getBranches(); assertEquals(STR, newBranch, selector.selectedBranchProperty().get()); } | /**
* Test notifications when a new branch is created.
*
* @throws UnsupportedActionException
* @throws DataProviderException
*/ | Test notifications when a new branch is created | testBranchCreatedNotifications | {
"repo_name": "frib-high-level-controls/save-set-restore",
"path": "plugins/org.csstudio.saverestore.ui.test/src/org/csstudio/saverestore/ui/SelectorTest.java",
"license": "mit",
"size": 21215
} | [
"org.csstudio.saverestore.DataProviderException",
"org.csstudio.saverestore.SaveRestoreService",
"org.csstudio.saverestore.UnsupportedActionException",
"org.junit.Assert",
"org.mockito.Mockito"
] | import org.csstudio.saverestore.DataProviderException; import org.csstudio.saverestore.SaveRestoreService; import org.csstudio.saverestore.UnsupportedActionException; import org.junit.Assert; import org.mockito.Mockito; | import org.csstudio.saverestore.*; import org.junit.*; import org.mockito.*; | [
"org.csstudio.saverestore",
"org.junit",
"org.mockito"
] | org.csstudio.saverestore; org.junit; org.mockito; | 2,889,082 |
protected DisplayType getProposedType() {
DisplayType resultingType = m_configuredType;
if (resultingType.equals(DisplayType.none)) {
switch (m_rule) {
case rootLevel:
case labelLength:
resultingType = DisplayType.wide;
break;
case optional:
resultingType = DisplayType.singleline;
break;
default:
resultingType = m_default;
}
}
return resultingType;
}
| DisplayType function() { DisplayType resultingType = m_configuredType; if (resultingType.equals(DisplayType.none)) { switch (m_rule) { case rootLevel: case labelLength: resultingType = DisplayType.wide; break; case optional: resultingType = DisplayType.singleline; break; default: resultingType = m_default; } } return resultingType; } | /**
* Returns the proposed display type.<p>
*
* @return the proposed display type
*/ | Returns the proposed display type | getProposedType | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/ade/contenteditor/CmsContentTypeVisitor.java",
"license": "lgpl-2.1",
"size": 34156
} | [
"org.opencms.xml.content.I_CmsXmlContentHandler"
] | import org.opencms.xml.content.I_CmsXmlContentHandler; | import org.opencms.xml.content.*; | [
"org.opencms.xml"
] | org.opencms.xml; | 1,935,194 |
void forward(Ethernet eth, ConnectPoint inPort); | void forward(Ethernet eth, ConnectPoint inPort); | /**
* Forwards an ARP or neighbor solicitation request to its destination.
* Floods at the edg the request if the destination is not known.
*
* @param eth an ethernet frame containing an ARP or neighbor solicitation
* request.
* @param inPort the port the request was received on
*/ | Forwards an ARP or neighbor solicitation request to its destination. Floods at the edg the request if the destination is not known | forward | {
"repo_name": "sdnwiselab/onos",
"path": "core/api/src/main/java/org/onosproject/net/proxyarp/ProxyArpService.java",
"license": "apache-2.0",
"size": 2319
} | [
"org.onlab.packet.Ethernet",
"org.onosproject.net.ConnectPoint"
] | import org.onlab.packet.Ethernet; import org.onosproject.net.ConnectPoint; | import org.onlab.packet.*; import org.onosproject.net.*; | [
"org.onlab.packet",
"org.onosproject.net"
] | org.onlab.packet; org.onosproject.net; | 1,931,744 |
Observable<ServiceResponse<Boolean>> get200WithServiceResponseAsync(); | Observable<ServiceResponse<Boolean>> get200WithServiceResponseAsync(); | /**
* Get 200 success.
*
* @return the observable to the boolean object
*/ | Get 200 success | get200WithServiceResponseAsync | {
"repo_name": "yugangw-msft/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/http/HttpSuccess.java",
"license": "mit",
"size": 30999
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,624,102 |
public boolean isFlashOn() {
if (!useCamera) {
return false;
}
Camera.Parameters params = mCamera.getParameters();
return params.getFlashMode().equals(Parameters.FLASH_MODE_TORCH);
} | boolean function() { if (!useCamera) { return false; } Camera.Parameters params = mCamera.getParameters(); return params.getFlashMode().equals(Parameters.FLASH_MODE_TORCH); } | /**
* Check if the flash is on.
*
* @return state of the flash.
*/ | Check if the flash is on | isFlashOn | {
"repo_name": "alex-schwartzman/card.io-Android-source",
"path": "card.io/src/main/java/io/card/payment/CardScanner.java",
"license": "mit",
"size": 20908
} | [
"android.hardware.Camera"
] | import android.hardware.Camera; | import android.hardware.*; | [
"android.hardware"
] | android.hardware; | 616,861 |
public boolean excludeOnTaxonomyForProteinSequenceVersionIdSearchId(
Collection<Integer> excludeTaxonomy_Ids,
ProteinSequenceVersionObject proteinSequenceVersionObject,
int searchId ) throws Exception {
// Return true if all the taxonomy ids for the search id and protein sequence id are to be excluded
try {
// Get all taxonomy ids for protein sequence id and search id
TaxonomyIdsForProtSeqIdSearchId_Request taxonomyIdsForProtSeqIdSearchId_Request =
new TaxonomyIdsForProtSeqIdSearchId_Request();
taxonomyIdsForProtSeqIdSearchId_Request.setSearchId( searchId );
taxonomyIdsForProtSeqIdSearchId_Request.setProteinSequenceVersionId( proteinSequenceVersionObject.getProteinSequenceVersionId() );
TaxonomyIdsForProtSeqIdSearchId_Result taxonomyIdsForProtSeqIdSearchId_Result =
Cached_TaxonomyIdsFor_ProtSeqVersionId_SearchId.getInstance()
.getTaxonomyIdsForProtSeqIdSearchId_Result( taxonomyIdsForProtSeqIdSearchId_Request );
Set<Integer> taxonomyIds = taxonomyIdsForProtSeqIdSearchId_Result.getTaxonomyIds();
boolean excludeOnTaxonomyId = true;
for ( Integer taxonomyId : taxonomyIds ) {
if ( ! excludeTaxonomy_Ids.contains( taxonomyId ) ) {
excludeOnTaxonomyId = false;
}
}
return excludeOnTaxonomyId;
} catch ( Exception e ) {
String msg = "Error processing in excludeOnTaxonomyForProteinSequenceVersionIdSearchId(...)";
log.error( msg );
throw e;
}
} | boolean function( Collection<Integer> excludeTaxonomy_Ids, ProteinSequenceVersionObject proteinSequenceVersionObject, int searchId ) throws Exception { try { TaxonomyIdsForProtSeqIdSearchId_Request taxonomyIdsForProtSeqIdSearchId_Request = new TaxonomyIdsForProtSeqIdSearchId_Request(); taxonomyIdsForProtSeqIdSearchId_Request.setSearchId( searchId ); taxonomyIdsForProtSeqIdSearchId_Request.setProteinSequenceVersionId( proteinSequenceVersionObject.getProteinSequenceVersionId() ); TaxonomyIdsForProtSeqIdSearchId_Result taxonomyIdsForProtSeqIdSearchId_Result = Cached_TaxonomyIdsFor_ProtSeqVersionId_SearchId.getInstance() .getTaxonomyIdsForProtSeqIdSearchId_Result( taxonomyIdsForProtSeqIdSearchId_Request ); Set<Integer> taxonomyIds = taxonomyIdsForProtSeqIdSearchId_Result.getTaxonomyIds(); boolean excludeOnTaxonomyId = true; for ( Integer taxonomyId : taxonomyIds ) { if ( ! excludeTaxonomy_Ids.contains( taxonomyId ) ) { excludeOnTaxonomyId = false; } } return excludeOnTaxonomyId; } catch ( Exception e ) { String msg = STR; log.error( msg ); throw e; } } | /**
* The rules for if the passed in protein sequence version id and search id should be excluded
* for the passed in exclude taxonomy id Set.
*
* return true if should be excluded based on taxonomy id
*
* @param excludeTaxonomy_Ids
* @param proteinSequenceVersionObject
* @param searchId
* @return true if should be excluded based on taxonomy id
* @throws Exception
*
*/ | The rules for if the passed in protein sequence version id and search id should be excluded for the passed in exclude taxonomy id Set. return true if should be excluded based on taxonomy id | excludeOnTaxonomyForProteinSequenceVersionIdSearchId | {
"repo_name": "yeastrc/proxl-web-app",
"path": "proxl_web_app/src/main/java/org/yeastrc/xlink/www/web_utils/ExcludeOnTaxonomyForProteinSequenceVersionIdSearchId.java",
"license": "apache-2.0",
"size": 3098
} | [
"java.util.Collection",
"java.util.Set",
"org.yeastrc.xlink.www.objects.ProteinSequenceVersionObject"
] | import java.util.Collection; import java.util.Set; import org.yeastrc.xlink.www.objects.ProteinSequenceVersionObject; | import java.util.*; import org.yeastrc.xlink.www.objects.*; | [
"java.util",
"org.yeastrc.xlink"
] | java.util; org.yeastrc.xlink; | 928,690 |
@Message(id = Message.NONE, value = "About to add user '%s' for realm '%s'")
String aboutToAddUser(String username, String realm); | @Message(id = Message.NONE, value = STR) String aboutToAddUser(String username, String realm); | /**
* Confirmation of the user being added.
*
* @param username - The new username.
* @param realm - The realm the user is being added for.
*
* @return a {@link String} for the message.
*/ | Confirmation of the user being added | aboutToAddUser | {
"repo_name": "luck3y/wildfly-core",
"path": "domain-management/src/main/java/org/jboss/as/domain/management/logging/DomainManagementLogger.java",
"license": "lgpl-2.1",
"size": 66410
} | [
"org.jboss.logging.annotations.Message"
] | import org.jboss.logging.annotations.Message; | import org.jboss.logging.annotations.*; | [
"org.jboss.logging"
] | org.jboss.logging; | 707,518 |
public void setCardReverse(Image reverseImage) {
//cacheStore (backResourceName, reverseImage);
if (reverseImage == null) {
throw new IllegalArgumentException ("CardImages::setCardReverse() received null image.");
}
backImage = reverseImage;
}
| void function(Image reverseImage) { if (reverseImage == null) { throw new IllegalArgumentException (STR); } backImage = reverseImage; } | /**
* Set the reverse image for a card.
* <p>
* All calculations for card width, height, and offset are based on this card's dimensions.
* <p>
* @param reverseImage image for the reverse of a card.
*/ | Set the reverse image for a card. All calculations for card width, height, and offset are based on this card's dimensions. | setCardReverse | {
"repo_name": "heineman/algorithms-nutshell-2ed",
"path": "Blogs/src/algs/blog/graph/gui/view/CardImages.java",
"license": "mit",
"size": 5213
} | [
"java.awt.Image"
] | import java.awt.Image; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,465,920 |
public boolean isDebugEnabled() {
return isLoggable(Log.DEBUG);
}
| boolean function() { return isLoggable(Log.DEBUG); } | /**
* Is this logger instance enabled for the DEBUG level?
*
* @return True if this Logger is enabled for level DEBUG, false otherwise.
*/ | Is this logger instance enabled for the DEBUG level | isDebugEnabled | {
"repo_name": "tjth/bitcoinj-lotterycoin",
"path": "slf4j-1.7.16/slf4j-android/src/main/java/org/slf4j/impl/AndroidLoggerAdapter.java",
"license": "apache-2.0",
"size": 16947
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,343,044 |
protected final StreamManager getStreamManager(String streamName) {
return getStreamManager(Id.Namespace.DEFAULT, streamName);
} | final StreamManager function(String streamName) { return getStreamManager(Id.Namespace.DEFAULT, streamName); } | /**
* Returns a {@link StreamManager} for the specified stream in the default namespace
*
* @param streamName the specified stream
* @return {@link StreamManager} for the specified stream in the default namespace
*/ | Returns a <code>StreamManager</code> for the specified stream in the default namespace | getStreamManager | {
"repo_name": "anthcp/cdap",
"path": "cdap-unit-test/src/main/java/co/cask/cdap/test/ConfigurableTestBase.java",
"license": "apache-2.0",
"size": 33136
} | [
"co.cask.cdap.proto.Id"
] | import co.cask.cdap.proto.Id; | import co.cask.cdap.proto.*; | [
"co.cask.cdap"
] | co.cask.cdap; | 403,774 |
public void testRecoverExistingReplica() throws Exception {
final String indexName = "test-recover-existing-replica";
internalCluster().ensureAtLeastNumDataNodes(2);
List<String> dataNodes = randomSubsetOf(2, Sets.newHashSet(
clusterService().state().nodes().getDataNodes().valuesIt()).stream().map(DiscoveryNode::getName).collect(Collectors.toSet()));
createIndex(indexName, Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1)
.put("index.routing.allocation.include._name", String.join(",", dataNodes))
.build());
indexRandom(randomBoolean(), randomBoolean(), randomBoolean(), IntStream.range(0, randomIntBetween(0, 50))
.mapToObj(n -> client().prepareIndex(indexName).setSource("num", n)).collect(toList()));
ensureGreen(indexName);
client().admin().indices().prepareFlush(indexName).get(); | void function() throws Exception { final String indexName = STR; internalCluster().ensureAtLeastNumDataNodes(2); List<String> dataNodes = randomSubsetOf(2, Sets.newHashSet( clusterService().state().nodes().getDataNodes().valuesIt()).stream().map(DiscoveryNode::getName).collect(Collectors.toSet())); createIndex(indexName, Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1) .put(STR, String.join(",", dataNodes)) .build()); indexRandom(randomBoolean(), randomBoolean(), randomBoolean(), IntStream.range(0, randomIntBetween(0, 50)) .mapToObj(n -> client().prepareIndex(indexName).setSource("num", n)).collect(toList())); ensureGreen(indexName); client().admin().indices().prepareFlush(indexName).get(); | /**
* Ensures that if a replica of a closed index does not have the same content as the primary, then a file-based recovery will occur.
*/ | Ensures that if a replica of a closed index does not have the same content as the primary, then a file-based recovery will occur | testRecoverExistingReplica | {
"repo_name": "gingerwizard/elasticsearch",
"path": "server/src/internalClusterTest/java/org/elasticsearch/indices/state/CloseIndexIT.java",
"license": "apache-2.0",
"size": 27655
} | [
"java.util.List",
"java.util.stream.Collectors",
"java.util.stream.IntStream",
"org.elasticsearch.cluster.metadata.IndexMetadata",
"org.elasticsearch.cluster.node.DiscoveryNode",
"org.elasticsearch.common.settings.Settings",
"org.elasticsearch.common.util.set.Sets"
] | import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.set.Sets; | import java.util.*; import java.util.stream.*; import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.cluster.node.*; import org.elasticsearch.common.settings.*; import org.elasticsearch.common.util.set.*; | [
"java.util",
"org.elasticsearch.cluster",
"org.elasticsearch.common"
] | java.util; org.elasticsearch.cluster; org.elasticsearch.common; | 495,163 |
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int side, int meta) {
return blockForTexture.getIcon(side, textureMeta);
}
| @SideOnly(Side.CLIENT) IIcon function(int side, int meta) { return blockForTexture.getIcon(side, textureMeta); } | /**
* Gets the block's texture. Args: side, meta
*/ | Gets the block's texture. Args: side, meta | getIcon | {
"repo_name": "cbaakman/Tropicraft",
"path": "src/main/java/net/tropicraft/block/BlockTropicraftFenceGate.java",
"license": "mpl-2.0",
"size": 1674
} | [
"net.minecraft.util.IIcon"
] | import net.minecraft.util.IIcon; | import net.minecraft.util.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 2,687,167 |
void mergePermissions(String uri, GraphPermissions permissions, Transaction transaction)
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; | void mergePermissions(String uri, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException; | /** <p>Add to permissions on the graph.</p>
*
* @param uri the graph uri or {@link #DEFAULT_GRAPH} constant
* @param permissions the permissions to add to this graph
* @param transaction the open transaction to write in
*/ | Add to permissions on the graph | mergePermissions | {
"repo_name": "marklogic/java-client-api",
"path": "marklogic-client-api/src/main/java/com/marklogic/client/semantics/GraphManager.java",
"license": "apache-2.0",
"size": 32807
} | [
"com.marklogic.client.FailedRequestException",
"com.marklogic.client.ForbiddenUserException",
"com.marklogic.client.ResourceNotFoundException",
"com.marklogic.client.Transaction"
] | import com.marklogic.client.FailedRequestException; import com.marklogic.client.ForbiddenUserException; import com.marklogic.client.ResourceNotFoundException; import com.marklogic.client.Transaction; | import com.marklogic.client.*; | [
"com.marklogic.client"
] | com.marklogic.client; | 1,682,920 |
@Test
public void testNewInstance() {
Assert.assertEquals("W452", new Soundex().soundex("Williams"));
}
| void function() { Assert.assertEquals("W452", new Soundex().soundex(STR)); } | /**
* https://issues.apache.org/jira/browse/CODEC-54 https://issues.apache.org/jira/browse/CODEC-56
*/ | HREF HREF | testNewInstance | {
"repo_name": "886rs/commons-codec-1.10-src",
"path": "src/test/java/org/apache/commons/codec/language/SoundexTest.java",
"license": "apache-2.0",
"size": 15372
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 105,497 |
private void handleException(Throwable throwable) {
checkNotNull(throwable);
boolean completedWithFailure = false;
boolean firstTimeSeeingThisException = true;
if (allMustSucceed) {
// As soon as the first one fails, throw the exception up.
// The result of all other inputs is then ignored.
completedWithFailure = setException(throwable);
if (completedWithFailure) {
releaseResourcesAfterFailure();
} else {
// Go up the causal chain to see if we've already seen this cause; if we have, even if
// it's wrapped by a different exception, don't log it.
firstTimeSeeingThisException = addCausalChain(getOrInitSeenExceptions(), throwable);
}
}
// | and & used because it's faster than the branch required for || and &&
if (throwable instanceof Error
| (allMustSucceed & !completedWithFailure & firstTimeSeeingThisException)) {
String message =
(throwable instanceof Error)
? "Input Future failed with Error"
: "Got more than one input Future failure. Logging failures after the first";
logger.log(Level.SEVERE, message, throwable);
}
} | void function(Throwable throwable) { checkNotNull(throwable); boolean completedWithFailure = false; boolean firstTimeSeeingThisException = true; if (allMustSucceed) { completedWithFailure = setException(throwable); if (completedWithFailure) { releaseResourcesAfterFailure(); } else { firstTimeSeeingThisException = addCausalChain(getOrInitSeenExceptions(), throwable); } } if (throwable instanceof Error (allMustSucceed & !completedWithFailure & firstTimeSeeingThisException)) { String message = (throwable instanceof Error) ? STR : STR; logger.log(Level.SEVERE, message, throwable); } } | /**
* Fails this future with the given Throwable if {@link #allMustSucceed} is true. Also, logs the
* throwable if it is an {@link Error} or if {@link #allMustSucceed} is {@code true}, the
* throwable did not cause this future to fail, and it is the first time we've seen that
* particular Throwable.
*/ | Fails this future with the given Throwable if <code>#allMustSucceed</code> is true. Also, logs the throwable if it is an <code>Error</code> or if <code>#allMustSucceed</code> is true, the throwable did not cause this future to fail, and it is the first time we've seen that particular Throwable | handleException | {
"repo_name": "antlr/codebuff",
"path": "output/java_guava/1.4.18/AggregateFuture.java",
"license": "bsd-2-clause",
"size": 12055
} | [
"com.google.common.base.Preconditions",
"java.util.logging.Level"
] | import com.google.common.base.Preconditions; import java.util.logging.Level; | import com.google.common.base.*; import java.util.logging.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 980,105 |
public List<Capability> getCandidates(Requirement req)
{
List<Capability> candidates = m_candidateMap.get(req);
if (candidates != null)
{
return Collections.unmodifiableList(candidates);
}
return null;
} | List<Capability> function(Requirement req) { List<Capability> candidates = m_candidateMap.get(req); if (candidates != null) { return Collections.unmodifiableList(candidates); } return null; } | /**
* Gets the candidates associated with a given requirement.
*
* @param req the requirement whose candidates are desired.
* @return the matching candidates or null.
*/ | Gets the candidates associated with a given requirement | getCandidates | {
"repo_name": "aosgi/org.apache.felix.resolver",
"path": "src/main/java/org/apache/felix/resolver/Candidates.java",
"license": "apache-2.0",
"size": 58708
} | [
"java.util.Collections",
"java.util.List",
"org.osgi.resource.Capability",
"org.osgi.resource.Requirement"
] | import java.util.Collections; import java.util.List; import org.osgi.resource.Capability; import org.osgi.resource.Requirement; | import java.util.*; import org.osgi.resource.*; | [
"java.util",
"org.osgi.resource"
] | java.util; org.osgi.resource; | 1,842,754 |
public static Number div(Number left, Character right) {
return NumberNumberDiv.div(left, Integer.valueOf(right));
} | static Number function(Number left, Character right) { return NumberNumberDiv.div(left, Integer.valueOf(right)); } | /**
* Divide a Number by a Character. The ordinal value of the Character
* is used in the division (the ordinal value is the unicode
* value which for simple character sets is the ASCII value).
*
* @param left a Number
* @param right a Character
* @return the Number corresponding to the division of left by right
* @since 1.0
*/ | Divide a Number by a Character. The ordinal value of the Character is used in the division (the ordinal value is the unicode value which for simple character sets is the ASCII value) | div | {
"repo_name": "mv2a/yajsw",
"path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 704164
} | [
"org.codehaus.groovy.runtime.dgmimpl.NumberNumberDiv"
] | import org.codehaus.groovy.runtime.dgmimpl.NumberNumberDiv; | import org.codehaus.groovy.runtime.dgmimpl.*; | [
"org.codehaus.groovy"
] | org.codehaus.groovy; | 1,565,712 |
@Deprecated
public List<Row> getWriteBuffer() {
return mutator == null ? null : mutator.getWriteBuffer();
}
/**
* Sets the number of rows that a scanner will fetch at once.
* <p>
* This will override the value specified by
* {@code hbase.client.scanner.caching}.
* Increasing this value will reduce the amount of work needed each time
* {@code next()} is called on a scanner, at the expense of memory use
* (since more rows will need to be maintained in memory by the scanners).
* @param scannerCaching the number of rows a scanner will fetch at once.
* @deprecated Use {@link Scan#setCaching(int)} | List<Row> function() { return mutator == null ? null : mutator.getWriteBuffer(); } /** * Sets the number of rows that a scanner will fetch at once. * <p> * This will override the value specified by * {@code hbase.client.scanner.caching}. * Increasing this value will reduce the amount of work needed each time * {@code next()} is called on a scanner, at the expense of memory use * (since more rows will need to be maintained in memory by the scanners). * @param scannerCaching the number of rows a scanner will fetch at once. * @deprecated Use {@link Scan#setCaching(int)} | /**
* Kept in 0.96 for backward compatibility
* @deprecated since 0.96. This is an internal buffer that should not be read nor write.
*/ | Kept in 0.96 for backward compatibility | getWriteBuffer | {
"repo_name": "zshao/hbase-1.0.0-cdh5.4.1",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java",
"license": "apache-2.0",
"size": 71077
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,126,371 |
public AppAnalysisReport analyze(App app)
throws Exception;
| AppAnalysisReport function(App app) throws Exception; | /**
* Analyze the given application.
*
* @param app the application under analysis
* @return the analysis report
* @throws Exception
*/ | Analyze the given application | analyze | {
"repo_name": "oprisnik/semdroid",
"path": "semdroid-core/src/main/java/com/oprisnik/semdroid/analysis/AppAnalysisPlugin.java",
"license": "apache-2.0",
"size": 1880
} | [
"com.oprisnik.semdroid.analysis.results.AppAnalysisReport",
"com.oprisnik.semdroid.app.App"
] | import com.oprisnik.semdroid.analysis.results.AppAnalysisReport; import com.oprisnik.semdroid.app.App; | import com.oprisnik.semdroid.analysis.results.*; import com.oprisnik.semdroid.app.*; | [
"com.oprisnik.semdroid"
] | com.oprisnik.semdroid; | 1,344,990 |
private void findViews() {
ibShopcartBack = (ImageButton) findViewById(R.id.ib_shopcart_back);
tvShopcartEdit = (TextView) findViewById(R.id.tv_shopcart_edit);
recyclerview = (RecyclerView) findViewById(R.id.recyclerview);
checkboxAll = (CheckBox) findViewById(R.id.checkbox_all);
tvShopcartTotal = (TextView) findViewById(R.id.tv_shopcart_total);
btnCheckOut = (Button) findViewById(R.id.btn_check_out);
ll_check_all = (LinearLayout) findViewById(R.id.ll_check_all);
ll_delete = (LinearLayout) findViewById(R.id.ll_delete);
cb_all = (CheckBox) findViewById(R.id.cb_all);
btn_delete = (Button) findViewById(R.id.btn_delete);
btn_collection = (Button) findViewById(R.id.btn_collection);
ll_empty_shopcart = (LinearLayout) findViewById(R.id.ll_empty_shopcart);
tv_empty_cart_tobuy = (TextView) findViewById(R.id.tv_empty_cart_tobuy);
ibShopcartBack.setOnClickListener(this);
btnCheckOut.setOnClickListener(this);
tvShopcartEdit.setOnClickListener(this);
btn_delete.setOnClickListener(this);
tv_empty_cart_tobuy.setClickable(true);
tv_empty_cart_tobuy.setOnClickListener(this);
} | void function() { ibShopcartBack = (ImageButton) findViewById(R.id.ib_shopcart_back); tvShopcartEdit = (TextView) findViewById(R.id.tv_shopcart_edit); recyclerview = (RecyclerView) findViewById(R.id.recyclerview); checkboxAll = (CheckBox) findViewById(R.id.checkbox_all); tvShopcartTotal = (TextView) findViewById(R.id.tv_shopcart_total); btnCheckOut = (Button) findViewById(R.id.btn_check_out); ll_check_all = (LinearLayout) findViewById(R.id.ll_check_all); ll_delete = (LinearLayout) findViewById(R.id.ll_delete); cb_all = (CheckBox) findViewById(R.id.cb_all); btn_delete = (Button) findViewById(R.id.btn_delete); btn_collection = (Button) findViewById(R.id.btn_collection); ll_empty_shopcart = (LinearLayout) findViewById(R.id.ll_empty_shopcart); tv_empty_cart_tobuy = (TextView) findViewById(R.id.tv_empty_cart_tobuy); ibShopcartBack.setOnClickListener(this); btnCheckOut.setOnClickListener(this); tvShopcartEdit.setOnClickListener(this); btn_delete.setOnClickListener(this); tv_empty_cart_tobuy.setClickable(true); tv_empty_cart_tobuy.setOnClickListener(this); } | /**
* Find the Views in the layout<br />
* <br />
* Auto-created on 2016-10-11 21:08:02 by Android Layout Finder
* (http://www.buzzingandroid.com/tools/android-layout-finder)
*/ | Find the Views in the layout Auto-created on 2016-10-11 21:08:02 by Android Layout Finder (HREF) | findViews | {
"repo_name": "weiwenqiang/GitHub",
"path": "ShoppingCart/Shopping-master/app/src/main/java/com/atguigu/shoppingmall/shoppingcart/activity/ShoppingCartActivity.java",
"license": "apache-2.0",
"size": 6481
} | [
"android.support.v7.widget.RecyclerView",
"android.widget.Button",
"android.widget.CheckBox",
"android.widget.ImageButton",
"android.widget.LinearLayout",
"android.widget.TextView"
] | import android.support.v7.widget.RecyclerView; import android.widget.Button; import android.widget.CheckBox; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; | import android.support.v7.widget.*; import android.widget.*; | [
"android.support",
"android.widget"
] | android.support; android.widget; | 1,699,726 |
public void onDrawStart(IMap map);
/**
* This method is called each time the feature is changed.
* @param map This parameter indicates the map the event occurred on.
* @param updateList This parameter contains a list of changes. see {@link IEditUpdateData} | void function(IMap map); /** * This method is called each time the feature is changed. * @param map This parameter indicates the map the event occurred on. * @param updateList This parameter contains a list of changes. see {@link IEditUpdateData} | /**
* This method is called when the draw session begins.
* @param map This parameter indicates the map the event occurred on.
*/ | This method is called when the draw session begins | onDrawStart | {
"repo_name": "missioncommand/emp3-android",
"path": "sdk/sdk-api/src/main/java/mil/emp3/api/listeners/IDrawEventListener.java",
"license": "apache-2.0",
"size": 1691
} | [
"mil.emp3.api.interfaces.IEditUpdateData",
"mil.emp3.api.interfaces.IMap"
] | import mil.emp3.api.interfaces.IEditUpdateData; import mil.emp3.api.interfaces.IMap; | import mil.emp3.api.interfaces.*; | [
"mil.emp3.api"
] | mil.emp3.api; | 1,384,267 |
public void addLinkToContentlet(Contentlet contentlet, String linkInode, String relationName, User user, boolean respectFrontendRoles)throws DotSecurityException, DotDataException;
| void function(Contentlet contentlet, String linkInode, String relationName, User user, boolean respectFrontendRoles)throws DotSecurityException, DotDataException; | /**
* Adds a relationship to a contentlet
* @param contentlet
* @param linkInode
* @param relationName
* @param user
* @param respectFrontendRoles
* @throws DotSecurityException
* @throws DotDataException
*/ | Adds a relationship to a contentlet | addLinkToContentlet | {
"repo_name": "guhb/core",
"path": "src/com/dotmarketing/portlets/contentlet/business/ContentletAPI.java",
"license": "gpl-3.0",
"size": 64730
} | [
"com.dotmarketing.exception.DotDataException",
"com.dotmarketing.exception.DotSecurityException",
"com.dotmarketing.portlets.contentlet.model.Contentlet",
"com.liferay.portal.model.User"
] | import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.dotmarketing.portlets.contentlet.model.Contentlet; import com.liferay.portal.model.User; | import com.dotmarketing.exception.*; import com.dotmarketing.portlets.contentlet.model.*; import com.liferay.portal.model.*; | [
"com.dotmarketing.exception",
"com.dotmarketing.portlets",
"com.liferay.portal"
] | com.dotmarketing.exception; com.dotmarketing.portlets; com.liferay.portal; | 290,464 |
public void switchToExpenses() {
setCurrentMainCategory(Constants.EXPENSE_ID);
}
| void function() { setCurrentMainCategory(Constants.EXPENSE_ID); } | /**
* Sets the current main category to the expense category.
*/ | Sets the current main category to the expense category | switchToExpenses | {
"repo_name": "daubigne/Android-Budget-Project",
"path": "Android_Budget_App/src/it/chalmers/mufasa/android_budget_app/controller/TransactionController.java",
"license": "gpl-3.0",
"size": 2970
} | [
"it.chalmers.mufasa.android_budget_app.settings.Constants"
] | import it.chalmers.mufasa.android_budget_app.settings.Constants; | import it.chalmers.mufasa.android_budget_app.settings.*; | [
"it.chalmers.mufasa"
] | it.chalmers.mufasa; | 2,394,571 |
public static Map<String, Object> input(final String query) {
return input(query, null);
} | static Map<String, Object> function(final String query) { return input(query, null); } | /**
* Composes Web API input object from {@code query}.
*
* @param query
* @return
*/ | Composes Web API input object from query | input | {
"repo_name": "fieldenms/tg",
"path": "platform-pojo-bl/src/main/java/ua/com/fielden/platform/web_api/WebApiUtils.java",
"license": "mit",
"size": 4584
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,186,187 |
public static synchronized Properties loadEnvironment() {
if (env != null) return env;
// DGF lifted directly from Ant's Property task
env = new Properties();
Vector osEnv = Execute.getProcEnvironment();
for (Enumeration e = osEnv.elements(); e.hasMoreElements();) {
String entry = (String) e.nextElement();
int pos = entry.indexOf('=');
if (pos == -1) {
log.warn("Ignoring: " + entry);
} else {
env.put(entry.substring(0, pos),
entry.substring(pos + 1));
}
}
return env;
}
| static synchronized Properties function() { if (env != null) return env; env = new Properties(); Vector osEnv = Execute.getProcEnvironment(); for (Enumeration e = osEnv.elements(); e.hasMoreElements();) { String entry = (String) e.nextElement(); int pos = entry.indexOf('='); if (pos == -1) { log.warn(STR + entry); } else { env.put(entry.substring(0, pos), entry.substring(pos + 1)); } } return env; } | /** Returns the current process environment variables
*
* @return the current process environment variables
*/ | Returns the current process environment variables | loadEnvironment | {
"repo_name": "mogotest/selenium",
"path": "remote/server/src/java/org/openqa/selenium/server/browserlaunchers/WindowsUtils.java",
"license": "apache-2.0",
"size": 27932
} | [
"java.util.Enumeration",
"java.util.Properties",
"java.util.Vector",
"org.apache.tools.ant.taskdefs.Execute"
] | import java.util.Enumeration; import java.util.Properties; import java.util.Vector; import org.apache.tools.ant.taskdefs.Execute; | import java.util.*; import org.apache.tools.ant.taskdefs.*; | [
"java.util",
"org.apache.tools"
] | java.util; org.apache.tools; | 2,031,915 |
protected void runSQL(String sql) throws SystemException {
try {
DataSource dataSource = appMessagePersistence.getDataSource();
SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
sql, new int[0]);
sqlUpdate.update();
}
catch (Exception e) {
throw new SystemException(e);
}
}
@BeanReference(type = org.oep.ssomgt.service.ApplicationLocalService.class)
protected org.oep.ssomgt.service.ApplicationLocalService applicationLocalService;
@BeanReference(type = org.oep.ssomgt.service.ApplicationService.class)
protected org.oep.ssomgt.service.ApplicationService applicationService;
@BeanReference(type = ApplicationPersistence.class)
protected ApplicationPersistence applicationPersistence;
@BeanReference(type = ApplicationFinder.class)
protected ApplicationFinder applicationFinder;
@BeanReference(type = org.oep.ssomgt.service.AppMessageLocalService.class)
protected org.oep.ssomgt.service.AppMessageLocalService appMessageLocalService;
@BeanReference(type = org.oep.ssomgt.service.AppMessageService.class)
protected org.oep.ssomgt.service.AppMessageService appMessageService;
@BeanReference(type = AppMessagePersistence.class)
protected AppMessagePersistence appMessagePersistence;
@BeanReference(type = AppMessageFinder.class)
protected AppMessageFinder appMessageFinder;
@BeanReference(type = org.oep.ssomgt.service.AppRoleLocalService.class)
protected org.oep.ssomgt.service.AppRoleLocalService appRoleLocalService;
@BeanReference(type = org.oep.ssomgt.service.AppRoleService.class)
protected org.oep.ssomgt.service.AppRoleService appRoleService;
@BeanReference(type = AppRolePersistence.class)
protected AppRolePersistence appRolePersistence;
@BeanReference(type = org.oep.ssomgt.service.AppRole2EmployeeLocalService.class)
protected org.oep.ssomgt.service.AppRole2EmployeeLocalService appRole2EmployeeLocalService;
@BeanReference(type = org.oep.ssomgt.service.AppRole2EmployeeService.class)
protected org.oep.ssomgt.service.AppRole2EmployeeService appRole2EmployeeService;
@BeanReference(type = AppRole2EmployeePersistence.class)
protected AppRole2EmployeePersistence appRole2EmployeePersistence;
@BeanReference(type = AppRole2EmployeeFinder.class)
protected AppRole2EmployeeFinder appRole2EmployeeFinder;
@BeanReference(type = org.oep.ssomgt.service.AppRole2JobPosLocalService.class)
protected org.oep.ssomgt.service.AppRole2JobPosLocalService appRole2JobPosLocalService;
@BeanReference(type = org.oep.ssomgt.service.AppRole2JobPosService.class)
protected org.oep.ssomgt.service.AppRole2JobPosService appRole2JobPosService;
@BeanReference(type = AppRole2JobPosPersistence.class)
protected AppRole2JobPosPersistence appRole2JobPosPersistence;
@BeanReference(type = AppRole2JobPosFinder.class)
protected AppRole2JobPosFinder appRole2JobPosFinder;
@BeanReference(type = org.oep.ssomgt.service.UserSyncLocalService.class)
protected org.oep.ssomgt.service.UserSyncLocalService userSyncLocalService;
@BeanReference(type = org.oep.ssomgt.service.UserSyncService.class)
protected org.oep.ssomgt.service.UserSyncService userSyncService;
@BeanReference(type = UserSyncPersistence.class)
protected UserSyncPersistence userSyncPersistence;
@BeanReference(type = UserSyncFinder.class)
protected UserSyncFinder userSyncFinder;
@BeanReference(type = com.liferay.counter.service.CounterLocalService.class)
protected com.liferay.counter.service.CounterLocalService counterLocalService;
@BeanReference(type = com.liferay.portal.service.ResourceLocalService.class)
protected com.liferay.portal.service.ResourceLocalService resourceLocalService;
@BeanReference(type = com.liferay.portal.service.UserLocalService.class)
protected com.liferay.portal.service.UserLocalService userLocalService;
@BeanReference(type = com.liferay.portal.service.UserService.class)
protected com.liferay.portal.service.UserService userService;
@BeanReference(type = UserPersistence.class)
protected UserPersistence userPersistence;
private String _beanIdentifier;
private ClassLoader _classLoader;
private AppMessageServiceClpInvoker _clpInvoker = new AppMessageServiceClpInvoker(); | void function(String sql) throws SystemException { try { DataSource dataSource = appMessagePersistence.getDataSource(); SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource, sql, new int[0]); sqlUpdate.update(); } catch (Exception e) { throw new SystemException(e); } } @BeanReference(type = org.oep.ssomgt.service.ApplicationLocalService.class) protected org.oep.ssomgt.service.ApplicationLocalService applicationLocalService; @BeanReference(type = org.oep.ssomgt.service.ApplicationService.class) protected org.oep.ssomgt.service.ApplicationService applicationService; @BeanReference(type = ApplicationPersistence.class) protected ApplicationPersistence applicationPersistence; @BeanReference(type = ApplicationFinder.class) protected ApplicationFinder applicationFinder; @BeanReference(type = org.oep.ssomgt.service.AppMessageLocalService.class) protected org.oep.ssomgt.service.AppMessageLocalService appMessageLocalService; @BeanReference(type = org.oep.ssomgt.service.AppMessageService.class) protected org.oep.ssomgt.service.AppMessageService appMessageService; @BeanReference(type = AppMessagePersistence.class) protected AppMessagePersistence appMessagePersistence; @BeanReference(type = AppMessageFinder.class) protected AppMessageFinder appMessageFinder; @BeanReference(type = org.oep.ssomgt.service.AppRoleLocalService.class) protected org.oep.ssomgt.service.AppRoleLocalService appRoleLocalService; @BeanReference(type = org.oep.ssomgt.service.AppRoleService.class) protected org.oep.ssomgt.service.AppRoleService appRoleService; @BeanReference(type = AppRolePersistence.class) protected AppRolePersistence appRolePersistence; @BeanReference(type = org.oep.ssomgt.service.AppRole2EmployeeLocalService.class) protected org.oep.ssomgt.service.AppRole2EmployeeLocalService appRole2EmployeeLocalService; @BeanReference(type = org.oep.ssomgt.service.AppRole2EmployeeService.class) protected org.oep.ssomgt.service.AppRole2EmployeeService appRole2EmployeeService; @BeanReference(type = AppRole2EmployeePersistence.class) protected AppRole2EmployeePersistence appRole2EmployeePersistence; @BeanReference(type = AppRole2EmployeeFinder.class) protected AppRole2EmployeeFinder appRole2EmployeeFinder; @BeanReference(type = org.oep.ssomgt.service.AppRole2JobPosLocalService.class) protected org.oep.ssomgt.service.AppRole2JobPosLocalService appRole2JobPosLocalService; @BeanReference(type = org.oep.ssomgt.service.AppRole2JobPosService.class) protected org.oep.ssomgt.service.AppRole2JobPosService appRole2JobPosService; @BeanReference(type = AppRole2JobPosPersistence.class) protected AppRole2JobPosPersistence appRole2JobPosPersistence; @BeanReference(type = AppRole2JobPosFinder.class) protected AppRole2JobPosFinder appRole2JobPosFinder; @BeanReference(type = org.oep.ssomgt.service.UserSyncLocalService.class) protected org.oep.ssomgt.service.UserSyncLocalService userSyncLocalService; @BeanReference(type = org.oep.ssomgt.service.UserSyncService.class) protected org.oep.ssomgt.service.UserSyncService userSyncService; @BeanReference(type = UserSyncPersistence.class) protected UserSyncPersistence userSyncPersistence; @BeanReference(type = UserSyncFinder.class) protected UserSyncFinder userSyncFinder; @BeanReference(type = com.liferay.counter.service.CounterLocalService.class) protected com.liferay.counter.service.CounterLocalService counterLocalService; @BeanReference(type = com.liferay.portal.service.ResourceLocalService.class) protected com.liferay.portal.service.ResourceLocalService resourceLocalService; @BeanReference(type = com.liferay.portal.service.UserLocalService.class) protected com.liferay.portal.service.UserLocalService userLocalService; @BeanReference(type = com.liferay.portal.service.UserService.class) protected com.liferay.portal.service.UserService userService; @BeanReference(type = UserPersistence.class) protected UserPersistence userPersistence; private String _beanIdentifier; private ClassLoader _classLoader; private AppMessageServiceClpInvoker _clpInvoker = new AppMessageServiceClpInvoker(); | /**
* Performs an SQL query.
*
* @param sql the sql query
*/ | Performs an SQL query | runSQL | {
"repo_name": "openegovplatform/OEPv2",
"path": "oep-ssomgt-portlet/docroot/WEB-INF/src/org/oep/ssomgt/service/base/AppMessageServiceBaseImpl.java",
"license": "apache-2.0",
"size": 21159
} | [
"com.liferay.portal.kernel.bean.BeanReference",
"com.liferay.portal.kernel.dao.jdbc.SqlUpdate",
"com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil",
"com.liferay.portal.kernel.exception.SystemException",
"com.liferay.portal.service.persistence.UserPersistence",
"javax.sql.DataSource",
"org.oep.ssomgt.service.AppMessageService",
"org.oep.ssomgt.service.persistence.AppMessageFinder",
"org.oep.ssomgt.service.persistence.AppMessagePersistence",
"org.oep.ssomgt.service.persistence.AppRole2EmployeeFinder",
"org.oep.ssomgt.service.persistence.AppRole2EmployeePersistence",
"org.oep.ssomgt.service.persistence.AppRole2JobPosFinder",
"org.oep.ssomgt.service.persistence.AppRole2JobPosPersistence",
"org.oep.ssomgt.service.persistence.AppRolePersistence",
"org.oep.ssomgt.service.persistence.ApplicationFinder",
"org.oep.ssomgt.service.persistence.ApplicationPersistence",
"org.oep.ssomgt.service.persistence.UserSyncFinder",
"org.oep.ssomgt.service.persistence.UserSyncPersistence"
] | import com.liferay.portal.kernel.bean.BeanReference; import com.liferay.portal.kernel.dao.jdbc.SqlUpdate; import com.liferay.portal.kernel.dao.jdbc.SqlUpdateFactoryUtil; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.service.persistence.UserPersistence; import javax.sql.DataSource; import org.oep.ssomgt.service.AppMessageService; import org.oep.ssomgt.service.persistence.AppMessageFinder; import org.oep.ssomgt.service.persistence.AppMessagePersistence; import org.oep.ssomgt.service.persistence.AppRole2EmployeeFinder; import org.oep.ssomgt.service.persistence.AppRole2EmployeePersistence; import org.oep.ssomgt.service.persistence.AppRole2JobPosFinder; import org.oep.ssomgt.service.persistence.AppRole2JobPosPersistence; import org.oep.ssomgt.service.persistence.AppRolePersistence; import org.oep.ssomgt.service.persistence.ApplicationFinder; import org.oep.ssomgt.service.persistence.ApplicationPersistence; import org.oep.ssomgt.service.persistence.UserSyncFinder; import org.oep.ssomgt.service.persistence.UserSyncPersistence; | import com.liferay.portal.kernel.bean.*; import com.liferay.portal.kernel.dao.jdbc.*; import com.liferay.portal.kernel.exception.*; import com.liferay.portal.service.persistence.*; import javax.sql.*; import org.oep.ssomgt.service.*; import org.oep.ssomgt.service.persistence.*; | [
"com.liferay.portal",
"javax.sql",
"org.oep.ssomgt"
] | com.liferay.portal; javax.sql; org.oep.ssomgt; | 1,445,457 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Void>> deleteWithResponseAsync(
String resourceGroupName, String accountName, String firewallRuleName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (accountName == null) {
return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null."));
}
if (firewallRuleName == null) {
return Mono
.error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null."));
}
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
accountName,
firewallRuleName,
this.client.getApiVersion(),
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Void>> function( String resourceGroupName, String accountName, String firewallRuleName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (accountName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (firewallRuleName == null) { return Mono .error(new IllegalArgumentException(STR)); } return FluxUtil .withContext( context -> service .delete( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, accountName, firewallRuleName, this.client.getApiVersion(), context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Deletes the specified firewall rule from the specified Data Lake Store account.
*
* @param resourceGroupName The name of the Azure resource group.
* @param accountName The name of the Data Lake Store account.
* @param firewallRuleName The name of the firewall rule to delete.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Deletes the specified firewall rule from the specified Data Lake Store account | deleteWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datalakestore/azure-resourcemanager-datalakestore/src/main/java/com/azure/resourcemanager/datalakestore/implementation/FirewallRulesClientImpl.java",
"license": "mit",
"size": 55791
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 2,162,411 |
private void fillDetailFieldConfiguration(CmsListItem item, String detailId) {
StringBuffer html = new StringBuffer();
// search for the corresponding A_CmsSearchIndex:
String idxConfigName = (String)item.get(LIST_COLUMN_NAME);
I_CmsSearchFieldConfiguration idxFieldConfiguration = OpenCms.getSearchManager().getFieldConfiguration(
idxConfigName);
List<CmsSearchField> fields = idxFieldConfiguration.getFields();
html.append("<ul>\n");
Iterator<CmsSearchField> itFields = fields.iterator();
while (itFields.hasNext()) {
CmsLuceneField field = (CmsLuceneField)itFields.next();
String fieldName = field.getName();
boolean fieldStore = field.isStored();
String fieldIndex = field.getIndexed();
boolean fieldExcerpt = field.isInExcerpt();
String fieldDefault = field.getDefaultValue();
html.append(" <li>\n").append(" ");
html.append("name=").append(fieldName);
if (fieldStore) {
html.append(", ").append("store=").append(fieldStore);
}
if (!fieldIndex.equals("false")) {
html.append(", ").append("index=").append(fieldIndex);
}
if (fieldExcerpt) {
html.append(", ").append("excerpt=").append(fieldExcerpt);
}
if (fieldDefault != null) {
html.append(", ").append("default=").append(field.getDefaultValue());
}
html.append("\n").append(" <ul>\n");
Iterator<I_CmsSearchFieldMapping> itMappings = field.getMappings().iterator();
while (itMappings.hasNext()) {
CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next();
html.append(" <li>\n").append(" ");
html.append(mapping.getType().toString());
if (CmsStringUtil.isNotEmpty(mapping.getParam())) {
html.append("=").append(mapping.getParam()).append("\n");
}
html.append(" </li>");
}
html.append(" </ul>\n");
html.append(" </li>");
}
html.append("</ul>\n");
item.set(detailId, html.toString());
} | void function(CmsListItem item, String detailId) { StringBuffer html = new StringBuffer(); String idxConfigName = (String)item.get(LIST_COLUMN_NAME); I_CmsSearchFieldConfiguration idxFieldConfiguration = OpenCms.getSearchManager().getFieldConfiguration( idxConfigName); List<CmsSearchField> fields = idxFieldConfiguration.getFields(); html.append(STR); Iterator<CmsSearchField> itFields = fields.iterator(); while (itFields.hasNext()) { CmsLuceneField field = (CmsLuceneField)itFields.next(); String fieldName = field.getName(); boolean fieldStore = field.isStored(); String fieldIndex = field.getIndexed(); boolean fieldExcerpt = field.isInExcerpt(); String fieldDefault = field.getDefaultValue(); html.append(STR).append(" "); html.append("name=").append(fieldName); if (fieldStore) { html.append(STR).append(STR).append(fieldStore); } if (!fieldIndex.equals("false")) { html.append(STR).append(STR).append(fieldIndex); } if (fieldExcerpt) { html.append(STR).append(STR).append(fieldExcerpt); } if (fieldDefault != null) { html.append(STR).append(STR).append(field.getDefaultValue()); } html.append("\n").append(STR); Iterator<I_CmsSearchFieldMapping> itMappings = field.getMappings().iterator(); while (itMappings.hasNext()) { CmsSearchFieldMapping mapping = (CmsSearchFieldMapping)itMappings.next(); html.append(STR).append(" "); html.append(mapping.getType().toString()); if (CmsStringUtil.isNotEmpty(mapping.getParam())) { html.append("=").append(mapping.getParam()).append("\n"); } html.append(STR); } html.append(STR); html.append(STR); } html.append(STR); item.set(detailId, html.toString()); } | /**
* Fills details of the field configuration into the given item. <p>
*
* @param item the list item to fill
* @param detailId the id for the detail to fill
*/ | Fills details of the field configuration into the given item. | fillDetailFieldConfiguration | {
"repo_name": "alkacon/opencms-core",
"path": "src-modules/org/opencms/workplace/tools/searchindex/CmsSearchFieldConfigurationList.java",
"license": "lgpl-2.1",
"size": 20945
} | [
"java.util.Iterator",
"java.util.List",
"org.opencms.main.OpenCms",
"org.opencms.search.fields.CmsLuceneField",
"org.opencms.search.fields.CmsSearchField",
"org.opencms.search.fields.CmsSearchFieldConfiguration",
"org.opencms.search.fields.CmsSearchFieldMapping",
"org.opencms.util.CmsStringUtil",
"org.opencms.workplace.list.CmsListItem"
] | import java.util.Iterator; import java.util.List; import org.opencms.main.OpenCms; import org.opencms.search.fields.CmsLuceneField; import org.opencms.search.fields.CmsSearchField; import org.opencms.search.fields.CmsSearchFieldConfiguration; import org.opencms.search.fields.CmsSearchFieldMapping; import org.opencms.util.CmsStringUtil; import org.opencms.workplace.list.CmsListItem; | import java.util.*; import org.opencms.main.*; import org.opencms.search.fields.*; import org.opencms.util.*; import org.opencms.workplace.list.*; | [
"java.util",
"org.opencms.main",
"org.opencms.search",
"org.opencms.util",
"org.opencms.workplace"
] | java.util; org.opencms.main; org.opencms.search; org.opencms.util; org.opencms.workplace; | 496,455 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.