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 boolean isConnectedMobile(Context context) { NetworkInfo info = getNetworkInfo(context); return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_MOBILE); }
static boolean function(Context context) { NetworkInfo info = getNetworkInfo(context); return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_MOBILE); }
/** * Check if there is any connectivity to a mobile network * * @param context * @return */
Check if there is any connectivity to a mobile network
isConnectedMobile
{ "repo_name": "FDoubleman/wd-edx-android", "path": "VideoLocker/src/main/java/org/edx/mobile/util/NetworkUtil.java", "license": "apache-2.0", "size": 5168 }
[ "android.content.Context", "android.net.ConnectivityManager", "android.net.NetworkInfo" ]
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo;
import android.content.*; import android.net.*;
[ "android.content", "android.net" ]
android.content; android.net;
417,280
public boolean authorizePath(String userName, String pathName) { Path path = FileSystemUtil.createFullyQualifiedPath(new Path(pathName)); PrivilegeRequest request = new PrivilegeRequest( new AuthorizeableUri(path.toString()), Privilege.ALL); return getAuthzChecker().hasAccess(new User(userName), request); }
boolean function(String userName, String pathName) { Path path = FileSystemUtil.createFullyQualifiedPath(new Path(pathName)); PrivilegeRequest request = new PrivilegeRequest( new AuthorizeableUri(path.toString()), Privilege.ALL); return getAuthzChecker().hasAccess(new User(userName), request); }
/** * Check if 'username' has FULL privilege to 'pathName' */
Check if 'username' has FULL privilege to 'pathName'
authorizePath
{ "repo_name": "cloudera/recordservice", "path": "fe/src/main/java/com/cloudera/impala/service/Frontend.java", "license": "apache-2.0", "size": 56702 }
[ "com.cloudera.impala.authorization.AuthorizeableUri", "com.cloudera.impala.authorization.Privilege", "com.cloudera.impala.authorization.PrivilegeRequest", "com.cloudera.impala.authorization.User", "com.cloudera.impala.common.FileSystemUtil", "org.apache.hadoop.fs.Path" ]
import com.cloudera.impala.authorization.AuthorizeableUri; import com.cloudera.impala.authorization.Privilege; import com.cloudera.impala.authorization.PrivilegeRequest; import com.cloudera.impala.authorization.User; import com.cloudera.impala.common.FileSystemUtil; import org.apache.hadoop.fs.Path;
import com.cloudera.impala.authorization.*; import com.cloudera.impala.common.*; import org.apache.hadoop.fs.*;
[ "com.cloudera.impala", "org.apache.hadoop" ]
com.cloudera.impala; org.apache.hadoop;
621,958
public Iterator<String> getExpressionTokenizer() { return new Tokenizer(this.expression); }
Iterator<String> function() { return new Tokenizer(this.expression); }
/** * Get an iterator for this expression, allows iterating over an expression * token by token. * * @return A new iterator instance for this expression. */
Get an iterator for this expression, allows iterating over an expression token by token
getExpressionTokenizer
{ "repo_name": "guanghaofan/SapphireProgramReader", "path": "SapphireProgramReader/src/sapphireprogramreader/com/udojava/evalex/Expression.java", "license": "gpl-2.0", "size": 33686 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,221,065
public Declaration getImportedDeclaration(TypeDeclaration td, String name, List<Type> signature, boolean ellipsis) { for (Import i: getImports()) { TypeDeclaration itd = i.getTypeDeclaration(); if (itd!=null && itd.equals(td) && !i.isAmbiguous() && i.getAlias().equals(name)) { //in case of an overloaded member, this will //be the "abstraction", so search for the //correct overloaded version Declaration d = i.getDeclaration(); return d.getContainer() .getMember(d.getName(), signature, ellipsis); } } return null; }
Declaration function(TypeDeclaration td, String name, List<Type> signature, boolean ellipsis) { for (Import i: getImports()) { TypeDeclaration itd = i.getTypeDeclaration(); if (itd!=null && itd.equals(td) && !i.isAmbiguous() && i.getAlias().equals(name)) { Declaration d = i.getDeclaration(); return d.getContainer() .getMember(d.getName(), signature, ellipsis); } } return null; }
/** * Search the imports of a compilation unit for the * named member declaration. */
Search the imports of a compilation unit for the named member declaration
getImportedDeclaration
{ "repo_name": "ceylon/ceylon-model", "path": "src/com/redhat/ceylon/model/typechecker/model/Unit.java", "license": "apache-2.0", "size": 74167 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
862,070
public void logAnswersArray(Logger localLogger, String uecName) { int numAlts = altAnswers[0].length; int[] specificAlts = new int[numAlts+1]; Arrays.fill(specificAlts, 1); logAnswersArray(localLogger, uecName, specificAlts, Integer.MAX_VALUE); }
void function(Logger localLogger, String uecName) { int numAlts = altAnswers[0].length; int[] specificAlts = new int[numAlts+1]; Arrays.fill(specificAlts, 1); logAnswersArray(localLogger, uecName, specificAlts, Integer.MAX_VALUE); }
/** * Log the current values in the answers array. * * @param localLogger = the logger to send the results to * @param uecName = user defined input * * no limit to the number of alternatives logged. If a max number of alts logged * is desired, use the other method. */
Log the current values in the answers array
logAnswersArray
{ "repo_name": "moeckel/silo", "path": "third-party/common-base/src/java/com/pb/common/calculator/UtilityExpressionCalculator.java", "license": "gpl-2.0", "size": 65403 }
[ "java.util.Arrays", "org.apache.log4j.Logger" ]
import java.util.Arrays; import org.apache.log4j.Logger;
import java.util.*; import org.apache.log4j.*;
[ "java.util", "org.apache.log4j" ]
java.util; org.apache.log4j;
1,810,039
public static PercentType getPercentTypeFromByte(int value) { return new PercentType(BigDecimal.valueOf(value).multiply(BigDecimal.valueOf(100)) .divide(BigDecimal.valueOf(DmxChannel.DMX_MAX_VALUE), 0, BigDecimal.ROUND_UP).intValue()); }
static PercentType function(int value) { return new PercentType(BigDecimal.valueOf(value).multiply(BigDecimal.valueOf(100)) .divide(BigDecimal.valueOf(DmxChannel.DMX_MAX_VALUE), 0, BigDecimal.ROUND_UP).intValue()); }
/** * Convert a 0-255 scale value to a percent type. * * @param pt * percent type to convert * @return converted value 0-255 */
Convert a 0-255 scale value to a percent type
getPercentTypeFromByte
{ "repo_name": "computergeek1507/openhab", "path": "bundles/binding/org.openhab.binding.dmx/src/main/java/org/openhab/binding/dmx/internal/core/DmxUtil.java", "license": "epl-1.0", "size": 3228 }
[ "java.math.BigDecimal", "org.openhab.core.library.types.PercentType" ]
import java.math.BigDecimal; import org.openhab.core.library.types.PercentType;
import java.math.*; import org.openhab.core.library.types.*;
[ "java.math", "org.openhab.core" ]
java.math; org.openhab.core;
1,766,325
public void enableMenus() { disabledMenus.clear(); List<MenuItem> menuItems = this.modulesMenu.getChildren(); for (MenuItem menuItem : menuItems) { if (!menuItem.isEnabled()) { disabledMenus.add(menuItem.getText()); menuItem.setEnabled(true); } } }
void function() { disabledMenus.clear(); List<MenuItem> menuItems = this.modulesMenu.getChildren(); for (MenuItem menuItem : menuItems) { if (!menuItem.isEnabled()) { disabledMenus.add(menuItem.getText()); menuItem.setEnabled(true); } } }
/** * Enables the disabled menu items. */
Enables the disabled menu items
enableMenus
{ "repo_name": "unicesi/QD-SPL", "path": "CaseStudy/co.shift.pcs.basic.web/src/co/shift/pcs/basic/web/client/MenuPanel.java", "license": "lgpl-3.0", "size": 5072 }
[ "com.vaadin.ui.MenuBar", "java.util.List" ]
import com.vaadin.ui.MenuBar; import java.util.List;
import com.vaadin.ui.*; import java.util.*;
[ "com.vaadin.ui", "java.util" ]
com.vaadin.ui; java.util;
1,073,203
@SuppressWarnings("unchecked") public List<ListEntry<T>> getAllEntries() { ArrayList<ListEntry<T>> builtList = new ArrayList<ListEntry<T>>(); for(String key : list.keySet()) { builtList.add((ListEntry<T>)list.get(key)); } return builtList; }
@SuppressWarnings(STR) List<ListEntry<T>> function() { ArrayList<ListEntry<T>> builtList = new ArrayList<ListEntry<T>>(); for(String key : list.keySet()) { builtList.add((ListEntry<T>)list.get(key)); } return builtList; }
/** * Returns a list of all entries in this PersistantList */
Returns a list of all entries in this PersistantList
getAllEntries
{ "repo_name": "madelinecameron/CS397", "path": "src/com/Lumension/android/permission_scanner/PersistantList.java", "license": "mit", "size": 7455 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,600,217
public com.google.cloud.dialogflow.v2beta1.EntityType getEntityType( com.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest request) { return blockingUnaryCall( getChannel(), getGetEntityTypeMethodHelper(), getCallOptions(), request); }
com.google.cloud.dialogflow.v2beta1.EntityType function( com.google.cloud.dialogflow.v2beta1.GetEntityTypeRequest request) { return blockingUnaryCall( getChannel(), getGetEntityTypeMethodHelper(), getCallOptions(), request); }
/** * * * <pre> * Retrieves the specified entity type. * </pre> */
<code> Retrieves the specified entity type. </code>
getEntityType
{ "repo_name": "vam-google/google-cloud-java", "path": "google-api-grpc/grpc-google-cloud-dialogflow-v2beta1/src/main/java/com/google/cloud/dialogflow/v2beta1/EntityTypesGrpc.java", "license": "apache-2.0", "size": 72349 }
[ "io.grpc.stub.ClientCalls" ]
import io.grpc.stub.ClientCalls;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
2,460,327
public String getMessage(String key) throws MissingResourceException { return getMessage(key, (String[]) null); } /** * <p>Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:</p> * <dir> * This message has two variables: {0} and {1} * </dir> * @param key The resource key * @param arg0 The argument to place in variable {0}
String function(String key) throws MissingResourceException { return getMessage(key, (String[]) null); } /** * <p>Gets a string message from the resource bundle for the given key. The * message may contain variables that will be substituted with the given * arguments. Variables have the format:</p> * <dir> * This message has two variables: {0} and {1} * </dir> * @param key The resource key * @param arg0 The argument to place in variable {0}
/** * Gets a string message from the resource bundle for the given key * @param key The resource key * @return The message */
Gets a string message from the resource bundle for the given key
getMessage
{ "repo_name": "hugosato/apache-axis", "path": "src/org/apache/axis/i18n/MessageBundle.java", "license": "apache-2.0", "size": 7747 }
[ "java.util.MissingResourceException" ]
import java.util.MissingResourceException;
import java.util.*;
[ "java.util" ]
java.util;
1,964,345
protected void selectVerticalAutoTickUnit(Graphics2D g2, Rectangle2D drawArea, Rectangle2D dataArea, RectangleEdge edge) { double tickLabelWidth = estimateMaximumTickLabelWidth(g2, getTickUnit()); // Compute number of labels double n = getRange().getLength() * tickLabelWidth / dataArea.getHeight(); setTickUnit( (NumberTickUnit) getStandardTickUnits().getCeilingTickUnit(n), false, false ); } protected static class CycleBoundTick extends NumberTick { public boolean mapToLastCycle; public CycleBoundTick(boolean mapToLastCycle, Number number, String label, TextAnchor textAnchor, TextAnchor rotationAnchor, double angle) { super(number, label, textAnchor, rotationAnchor, angle); this.mapToLastCycle = mapToLastCycle; } }
void function(Graphics2D g2, Rectangle2D drawArea, Rectangle2D dataArea, RectangleEdge edge) { double tickLabelWidth = estimateMaximumTickLabelWidth(g2, getTickUnit()); double n = getRange().getLength() * tickLabelWidth / dataArea.getHeight(); setTickUnit( (NumberTickUnit) getStandardTickUnits().getCeilingTickUnit(n), false, false ); } protected static class CycleBoundTick extends NumberTick { public boolean mapToLastCycle; public CycleBoundTick(boolean mapToLastCycle, Number number, String label, TextAnchor textAnchor, TextAnchor rotationAnchor, double angle) { super(number, label, textAnchor, rotationAnchor, angle); this.mapToLastCycle = mapToLastCycle; } }
/** * Selects a tick unit when the axis is displayed vertically. * * @param g2 the graphics device. * @param drawArea the drawing area. * @param dataArea the data area. * @param edge the side of the rectangle on which the axis is displayed. */
Selects a tick unit when the axis is displayed vertically
selectVerticalAutoTickUnit
{ "repo_name": "raedle/univis", "path": "lib/jfreechart-1.0.1/src/org/jfree/chart/axis/CyclicNumberAxis.java", "license": "lgpl-2.1", "size": 42414 }
[ "java.awt.Graphics2D", "java.awt.geom.Rectangle2D", "org.jfree.ui.RectangleEdge", "org.jfree.ui.TextAnchor" ]
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.ui.RectangleEdge; import org.jfree.ui.TextAnchor;
import java.awt.*; import java.awt.geom.*; import org.jfree.ui.*;
[ "java.awt", "org.jfree.ui" ]
java.awt; org.jfree.ui;
1,224,852
public DateTime finalizingTimeUtc() { return this.finalizingTimeUtc; }
DateTime function() { return this.finalizingTimeUtc; }
/** * Get the finalizingTimeUtc value. * * @return the finalizingTimeUtc value */
Get the finalizingTimeUtc value
finalizingTimeUtc
{ "repo_name": "herveyw/azure-sdk-for-java", "path": "azure-mgmt-datalake-analytics/src/main/java/com/microsoft/azure/management/datalake/analytics/models/JobStatistics.java", "license": "mit", "size": 1544 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
93,317
private boolean setOrigin(String origin) { assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; Log.d(TAG, "Set origin: %s", origin); if (!isWidevine()) { Log.d(TAG, "Property " + ORIGIN + " isn't supported"); return true; } assert mMediaDrm != null; assert !origin.isEmpty(); try { mMediaDrm.setPropertyString(ORIGIN, origin); mOrigin = origin; mOriginSet = true; return true; } catch (java.lang.IllegalArgumentException e) { Log.e(TAG, "Failed to set security origin %s", origin, e); } catch (java.lang.IllegalStateException e) { Log.e(TAG, "Failed to set security origin %s", origin, e); } Log.e(TAG, "Security origin %s not supported!", origin); return false; }
boolean function(String origin) { assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.M; Log.d(TAG, STR, origin); if (!isWidevine()) { Log.d(TAG, STR + ORIGIN + STR); return true; } assert mMediaDrm != null; assert !origin.isEmpty(); try { mMediaDrm.setPropertyString(ORIGIN, origin); mOrigin = origin; mOriginSet = true; return true; } catch (java.lang.IllegalArgumentException e) { Log.e(TAG, STR, origin, e); } catch (java.lang.IllegalStateException e) { Log.e(TAG, STR, origin, e); } Log.e(TAG, STR, origin); return false; }
/** * Set the security origin for the MediaDrm. All information should be isolated for different * origins, e.g. certificates, licenses. */
Set the security origin for the MediaDrm. All information should be isolated for different origins, e.g. certificates, licenses
setOrigin
{ "repo_name": "youtube/cobalt", "path": "third_party/chromium/media/base/android/java/src/org/chromium/media/MediaDrmBridge.java", "license": "bsd-3-clause", "size": 62151 }
[ "android.os.Build", "org.chromium.base.Log" ]
import android.os.Build; import org.chromium.base.Log;
import android.os.*; import org.chromium.base.*;
[ "android.os", "org.chromium.base" ]
android.os; org.chromium.base;
249,367
@Test public void toStringT() { final CodeSection[] codeSections = CODE_SECTION_FACTORY.getAll(); for (final CodeSection codeSection : codeSections) { final ResourceDemandingInternalAction rdia = new ResourceDemandingInternalAction(ResourceDemandType.RESOURCE_TYPE_CPU, codeSection); assertThat(rdia, hasOverriddenToString()); } }
void function() { final CodeSection[] codeSections = CODE_SECTION_FACTORY.getAll(); for (final CodeSection codeSection : codeSections) { final ResourceDemandingInternalAction rdia = new ResourceDemandingInternalAction(ResourceDemandType.RESOURCE_TYPE_CPU, codeSection); assertThat(rdia, hasOverriddenToString()); } }
/** * Test method for {@link ResourceDemandingInternalAction#toString()}. * */
Test method for <code>ResourceDemandingInternalAction#toString()</code>
toStringT
{ "repo_name": "Beagle-PSE/Beagle", "path": "Core/src/test/java/de/uka/ipd/sdq/beagle/core/ResourceDemandingInternalActionTest.java", "license": "epl-1.0", "size": 6167 }
[ "de.uka.ipd.sdq.beagle.core.testutil.ToStringMatcher", "org.junit.Assert" ]
import de.uka.ipd.sdq.beagle.core.testutil.ToStringMatcher; import org.junit.Assert;
import de.uka.ipd.sdq.beagle.core.testutil.*; import org.junit.*;
[ "de.uka.ipd", "org.junit" ]
de.uka.ipd; org.junit;
163,480
public static <T> Collection<T> findAll(Collection<T> self, Closure closure) { Collection<T> answer = createSimilarCollection(self); Iterator<T> iter = self.iterator(); return findAll(closure, answer, iter); }
static <T> Collection<T> function(Collection<T> self, Closure closure) { Collection<T> answer = createSimilarCollection(self); Iterator<T> iter = self.iterator(); return findAll(closure, answer, iter); }
/** * Finds all values matching the closure condition. * <pre class="groovyTestCase">assert [2,4] == [1,2,3,4].findAll { it % 2 == 0 }</pre> * * @param self a Collection * @param closure a closure condition * @return a Collection of matching values * @since 1.5.6 */
Finds all values matching the closure condition. assert [2,4] == [1,2,3,4].findAll { it % 2 == 0 }</code>
findAll
{ "repo_name": "xien777/yajsw", "path": "yajsw/wrapper/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java", "license": "lgpl-2.1", "size": 704150 }
[ "groovy.lang.Closure", "java.util.Collection", "java.util.Iterator" ]
import groovy.lang.Closure; import java.util.Collection; import java.util.Iterator;
import groovy.lang.*; import java.util.*;
[ "groovy.lang", "java.util" ]
groovy.lang; java.util;
2,415,715
public void set(int timeout, String property, Object value) { set(timeout, property, value, (SuccessCallback)null); }
void function(int timeout, String property, Object value) { set(timeout, property, value, (SuccessCallback)null); }
/** * Sets a property. * @param timeout The timeout in ms * @param property The property name. * @param value The property value. */
Sets a property
set
{ "repo_name": "Firethunder/CodenameOne", "path": "CodenameOne/src/com/codename1/ui/BrowserComponent.java", "license": "gpl-2.0", "size": 64174 }
[ "com.codename1.util.SuccessCallback" ]
import com.codename1.util.SuccessCallback;
import com.codename1.util.*;
[ "com.codename1.util" ]
com.codename1.util;
895,237
EReference getProgram_Variables();
EReference getProgram_Variables();
/** * Returns the meta object for the containment reference list '{@link org.xtext.xrobot.dsl.xRobotDSL.Program#getVariables <em>Variables</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Variables</em>'. * @see org.xtext.xrobot.dsl.xRobotDSL.Program#getVariables() * @see #getProgram() * @generated */
Returns the meta object for the containment reference list '<code>org.xtext.xrobot.dsl.xRobotDSL.Program#getVariables Variables</code>'.
getProgram_Variables
{ "repo_name": "JanKoehnlein/XRobot", "path": "org.xtext.xrobot.dsl/src-gen/org/xtext/xrobot/dsl/xRobotDSL/XRobotDSLPackage.java", "license": "epl-1.0", "size": 21860 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
524,771
public static String formatDate(Date d) { try { return (d == null ? "" : Format.DATE_FORMATTER.format(d)); } catch (ArrayIndexOutOfBoundsException e) { LOGGER.info("MapperDate 2 : failed to map date => " + d); return null; } }
static String function(Date d) { try { return (d == null ? STRMapperDate 2 : failed to map date => " + d); return null; } }
/** * Format date. * * @param d date * @return formatted string date */
Format date
formatDate
{ "repo_name": "VladimirKarassouloff/training-java", "path": "projetmaven/binding/src/main/java/cdb/mapper/MapperDate.java", "license": "apache-2.0", "size": 1412 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
838,738
public XADataSource swap(final DataSource dataSource) { XADataSource result = createXADataSource(); setProperties(result, getDatabaseAccessConfiguration(dataSource)); return result; }
XADataSource function(final DataSource dataSource) { XADataSource result = createXADataSource(); setProperties(result, getDatabaseAccessConfiguration(dataSource)); return result; }
/** * Swap data source to database access configuration. * * @param dataSource data source * @return XADataSource XA data source */
Swap data source to database access configuration
swap
{ "repo_name": "leeyazhou/sharding-jdbc", "path": "sharding-transaction/sharding-transaction-2pc/sharding-transaction-xa/sharding-transaction-xa-core/src/main/java/org/apache/shardingsphere/transaction/xa/jta/datasource/swapper/DataSourceSwapper.java", "license": "apache-2.0", "size": 6000 }
[ "javax.sql.DataSource", "javax.sql.XADataSource" ]
import javax.sql.DataSource; import javax.sql.XADataSource;
import javax.sql.*;
[ "javax.sql" ]
javax.sql;
1,316,039
public PointerType getPointerType() { return getModel().getPointerType(); }
PointerType function() { return getModel().getPointerType(); }
/** * Returns the type of the pointer * FG_TYPE1 (standard version) or FG_TYPE2 * @return the type of the pointer */
Returns the type of the pointer FG_TYPE1 (standard version) or FG_TYPE2
getPointerType
{ "repo_name": "hervegirod/j6dof-flight-sim", "path": "src/steelseries/eu/hansolo/steelseries/gauges/AbstractRadial.java", "license": "gpl-3.0", "size": 156025 }
[ "eu.hansolo.steelseries.tools.PointerType" ]
import eu.hansolo.steelseries.tools.PointerType;
import eu.hansolo.steelseries.tools.*;
[ "eu.hansolo.steelseries" ]
eu.hansolo.steelseries;
321,382
Enumeration<String> enm; String key; if (m_Properties == null) { try { m_Properties = Environment.getInstance().read(PlaceholdersDefinition.KEY); } catch (Exception e) { m_Properties = new Properties(); } m_NoCollapse = new HashSet<>(); if (m_Properties.hasKey(NO_COLLAPSE) && !m_Properties.getProperty(NO_COLLAPSE).trim().isEmpty()) m_NoCollapse.addAll(Arrays.asList(m_Properties.getProperty(NO_COLLAPSE).replace(" ", "").split(","))); m_Placeholders = new HashMap<>(); enm = (Enumeration<String>) m_Properties.propertyNames(); while (enm.hasMoreElements()) { key = enm.nextElement(); if (key.equals(NO_COLLAPSE)) continue; m_Placeholders.put(key, m_Properties.getPath(key)); } } }
Enumeration<String> enm; String key; if (m_Properties == null) { try { m_Properties = Environment.getInstance().read(PlaceholdersDefinition.KEY); } catch (Exception e) { m_Properties = new Properties(); } m_NoCollapse = new HashSet<>(); if (m_Properties.hasKey(NO_COLLAPSE) && !m_Properties.getProperty(NO_COLLAPSE).trim().isEmpty()) m_NoCollapse.addAll(Arrays.asList(m_Properties.getProperty(NO_COLLAPSE).replace(" ", STR,"))); m_Placeholders = new HashMap<>(); enm = (Enumeration<String>) m_Properties.propertyNames(); while (enm.hasMoreElements()) { key = enm.nextElement(); if (key.equals(NO_COLLAPSE)) continue; m_Placeholders.put(key, m_Properties.getPath(key)); } } }
/** * loads the props file and interpretes it. */
loads the props file and interpretes it
initialize
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/core/Placeholders.java", "license": "gpl-3.0", "size": 12244 }
[ "java.util.Arrays", "java.util.Enumeration", "java.util.HashMap", "java.util.HashSet" ]
import java.util.Arrays; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet;
import java.util.*;
[ "java.util" ]
java.util;
2,516,555
public static OMRaster getIconRaster(double lat, double lon, String iconURL) { URL url = getIconRasterURL(iconURL); if (url == null) return null; return getIconRaster(lat, lon, url); }
static OMRaster function(double lat, double lon, String iconURL) { URL url = getIconRasterURL(iconURL); if (url == null) return null; return getIconRaster(lat, lon, url); }
/** * Create an OMRaster at a latitude/longitude, from a image URL. * * @param lat latitide in decimal degrees * @param lon longitude in decimal degrees. * @param iconURL a URL for an image */
Create an OMRaster at a latitude/longitude, from a image URL
getIconRaster
{ "repo_name": "d2fn/passage", "path": "src/main/java/com/bbn/openmap/layer/location/URLRasterLocation.java", "license": "mit", "size": 11326 }
[ "com.bbn.openmap.omGraphics.OMRaster" ]
import com.bbn.openmap.omGraphics.OMRaster;
import com.bbn.openmap.*;
[ "com.bbn.openmap" ]
com.bbn.openmap;
2,085,744
public static void closeQuietly(Source src) { if (src instanceof StreamSource) { StreamSource streamSource = (StreamSource) src; IOUtils.closeQuietly(streamSource.getReader()); } else if (src instanceof ImageSource) { if (ImageUtil.getImageInputStream(src) != null) { try { ImageUtil.getImageInputStream(src).close(); } catch (IOException ioe) { // ignore } } } else if (src instanceof SAXSource) { InputSource is = ((SAXSource) src).getInputSource(); if (is != null) { IOUtils.closeQuietly(is.getByteStream()); IOUtils.closeQuietly(is.getCharacterStream()); } } removeStreams(src); }
static void function(Source src) { if (src instanceof StreamSource) { StreamSource streamSource = (StreamSource) src; IOUtils.closeQuietly(streamSource.getReader()); } else if (src instanceof ImageSource) { if (ImageUtil.getImageInputStream(src) != null) { try { ImageUtil.getImageInputStream(src).close(); } catch (IOException ioe) { } } } else if (src instanceof SAXSource) { InputSource is = ((SAXSource) src).getInputSource(); if (is != null) { IOUtils.closeQuietly(is.getByteStream()); IOUtils.closeQuietly(is.getCharacterStream()); } } removeStreams(src); }
/** * Closes the InputStreams or ImageInputStreams of Source objects. Any exception occurring * while closing the stream is ignored. * @param src the Source object */
Closes the InputStreams or ImageInputStreams of Source objects. Any exception occurring while closing the stream is ignored
closeQuietly
{ "repo_name": "apache/xml-graphics-commons", "path": "src/main/java/org/apache/xmlgraphics/io/XmlSourceUtil.java", "license": "apache-2.0", "size": 6257 }
[ "java.io.IOException", "javax.xml.transform.Source", "javax.xml.transform.sax.SAXSource", "javax.xml.transform.stream.StreamSource", "org.apache.commons.io.IOUtils", "org.apache.xmlgraphics.image.loader.ImageSource", "org.apache.xmlgraphics.image.loader.util.ImageUtil", "org.xml.sax.InputSource" ]
import java.io.IOException; import javax.xml.transform.Source; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.IOUtils; import org.apache.xmlgraphics.image.loader.ImageSource; import org.apache.xmlgraphics.image.loader.util.ImageUtil; import org.xml.sax.InputSource;
import java.io.*; import javax.xml.transform.*; import javax.xml.transform.sax.*; import javax.xml.transform.stream.*; import org.apache.commons.io.*; import org.apache.xmlgraphics.image.loader.*; import org.apache.xmlgraphics.image.loader.util.*; import org.xml.sax.*;
[ "java.io", "javax.xml", "org.apache.commons", "org.apache.xmlgraphics", "org.xml.sax" ]
java.io; javax.xml; org.apache.commons; org.apache.xmlgraphics; org.xml.sax;
1,577,432
protected String resolvePlaceholder(String path, String key, Preferences preferences) { if (path != null) { // Do not create the node if it does not exist... try { if (preferences.nodeExists(path)) { return preferences.node(path).get(key, null); } else { return null; } } catch (BackingStoreException ex) { throw new BeanDefinitionStoreException("Cannot access specified node path [" + path + "]", ex); } } else { return preferences.get(key, null); } }
String function(String path, String key, Preferences preferences) { if (path != null) { try { if (preferences.nodeExists(path)) { return preferences.node(path).get(key, null); } else { return null; } } catch (BackingStoreException ex) { throw new BeanDefinitionStoreException(STR + path + "]", ex); } } else { return preferences.get(key, null); } }
/** * Resolve the given path and key against the given Preferences. * @param path the preferences path (placeholder part before '/') * @param key the preferences key (placeholder part after '/') * @param preferences the Preferences to resolve against * @return the value for the placeholder, or <code>null</code> if none found */
Resolve the given path and key against the given Preferences
resolvePlaceholder
{ "repo_name": "codeApeFromChina/resource", "path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/beans/factory/config/PreferencesPlaceholderConfigurer.java", "license": "unlicense", "size": 4469 }
[ "java.util.prefs.BackingStoreException", "java.util.prefs.Preferences", "org.springframework.beans.factory.BeanDefinitionStoreException" ]
import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; import org.springframework.beans.factory.BeanDefinitionStoreException;
import java.util.prefs.*; import org.springframework.beans.factory.*;
[ "java.util", "org.springframework.beans" ]
java.util; org.springframework.beans;
437,462
protected String scanScheme(String uri) { int i = 0; if (uri == null) return null; int length = uri.length(); if (length == 0) return null; int ch = uri.charAt(0); if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') { for (i = 1; i < length; i++) { ch = uri.charAt(i); if (ch == ':') return uri.substring(0, i).toLowerCase(Locale.ENGLISH); if (! (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch >= '0' && ch <= '0' || ch == '+' || ch == '-' || ch == '.')) break; } } return null; }
String function(String uri) { int i = 0; if (uri == null) return null; int length = uri.length(); if (length == 0) return null; int ch = uri.charAt(0); if (ch >= 'a' && ch <= 'z' ch >= 'A' && ch <= 'Z') { for (i = 1; i < length; i++) { ch = uri.charAt(i); if (ch == ':') return uri.substring(0, i).toLowerCase(Locale.ENGLISH); if (! (ch >= 'a' && ch <= 'z' ch >= 'A' && ch <= 'Z' ch >= '0' && ch <= '0' ch == '+' ch == '-' ch == '.')) break; } } return null; }
/** * Returns the scheme portion of a uri. Since schemes are case-insensitive, * normalize them to lower case. */
Returns the scheme portion of a uri. Since schemes are case-insensitive, normalize them to lower case
scanScheme
{ "repo_name": "gruppo4/quercus-upstream", "path": "modules/kernel/src/com/caucho/vfs/Path.java", "license": "gpl-2.0", "size": 36959 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
2,682,925
public void enterBoolean_type(SQLParser.Boolean_typeContext ctx) { }
public void enterBoolean_type(SQLParser.Boolean_typeContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitPrecision_param
{ "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,096
@Override public void zoomRangeAxes(double factor, PlotRenderingInfo state, Point2D source, boolean useAnchor) { double anchorY = this.getRangeAxis().java2DToValue(source.getY(), state.getDataArea(), RectangleEdge.LEFT); this.rangeAxis.resizeRange(factor, anchorY); }
void function(double factor, PlotRenderingInfo state, Point2D source, boolean useAnchor) { double anchorY = this.getRangeAxis().java2DToValue(source.getY(), state.getDataArea(), RectangleEdge.LEFT); this.rangeAxis.resizeRange(factor, anchorY); }
/** * Multiplies the range on the range axis/axes by the specified factor. * * @param factor the zoom factor. * @param state the plot state. * @param source the source point. * @param useAnchor a flag that controls whether or not the source point * is used for the zoom anchor. * * @since 1.0.7 */
Multiplies the range on the range axis/axes by the specified factor
zoomRangeAxes
{ "repo_name": "greearb/jfreechart-fse-ct", "path": "src/main/java/org/jfree/chart/plot/ThermometerPlot.java", "license": "lgpl-2.1", "size": 55687 }
[ "java.awt.geom.Point2D", "org.jfree.chart.ui.RectangleEdge" ]
import java.awt.geom.Point2D; import org.jfree.chart.ui.RectangleEdge;
import java.awt.geom.*; import org.jfree.chart.ui.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
1,987,763
public LogAssertion withLevel(final Level level) { return withLevel(Matchers.equalTo(level)); }
LogAssertion function(final Level level) { return withLevel(Matchers.equalTo(level)); }
/** * Sets the assertion to expect the message to have the passed {@code level}. The use of this method is * sufficient to assert a * message is logged. No other method calls are required, other than the * call to {@link Log4jCapturer#assertThat(LogAssertion)}. * * @param level * the level to expect * @return this instance */
Sets the assertion to expect the message to have the passed level. The use of this method is sufficient to assert a message is logged. No other method calls are required, other than the call to <code>Log4jCapturer#assertThat(LogAssertion)</code>
withLevel
{ "repo_name": "pulkitpivotal/ndbench", "path": "ndbench-core/src/test/java/org/libex/test/logging/log4j/Log4jCapturer.java", "license": "apache-2.0", "size": 15731 }
[ "org.apache.log4j.Level", "org.hamcrest.Matchers" ]
import org.apache.log4j.Level; import org.hamcrest.Matchers;
import org.apache.log4j.*; import org.hamcrest.*;
[ "org.apache.log4j", "org.hamcrest" ]
org.apache.log4j; org.hamcrest;
841,903
public void setSender(Account sender) { this.sender = sender; }
void function(Account sender) { this.sender = sender; }
/** * Sets the sender. * * @param sender * the new sender */
Sets the sender
setSender
{ "repo_name": "NEMPH/nem-apps-lib", "path": "src/main/java/io/nem/apps/model/TransactionBlock.java", "license": "mit", "size": 4572 }
[ "org.nem.core.model.Account" ]
import org.nem.core.model.Account;
import org.nem.core.model.*;
[ "org.nem.core" ]
org.nem.core;
1,546,845
public void setImaginaryFormat(NumberFormat imaginaryFormat) { if (imaginaryFormat == null) { throw MathRuntimeException.createIllegalArgumentException( "null imaginary format"); } this.imaginaryFormat = imaginaryFormat; }
void function(NumberFormat imaginaryFormat) { if (imaginaryFormat == null) { throw MathRuntimeException.createIllegalArgumentException( STR); } this.imaginaryFormat = imaginaryFormat; }
/** * Modify the imaginaryFormat. * @param imaginaryFormat The new imaginaryFormat value. * @throws IllegalArgumentException if <code>imaginaryFormat</code> is * <code>null</code>. */
Modify the imaginaryFormat
setImaginaryFormat
{ "repo_name": "SpoonLabs/astor", "path": "examples/Math-issue-340/src/main/java/org/apache/commons/math/complex/ComplexFormat.java", "license": "gpl-2.0", "size": 13704 }
[ "java.text.NumberFormat", "org.apache.commons.math.MathRuntimeException" ]
import java.text.NumberFormat; import org.apache.commons.math.MathRuntimeException;
import java.text.*; import org.apache.commons.math.*;
[ "java.text", "org.apache.commons" ]
java.text; org.apache.commons;
1,664,959
public void onInflateCourierButtonsCall() { LayoutInflater vi = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = vi.inflate(R.layout.current_order_courier_buttons, null); Button buttonAccept = (Button) v.findViewById(R.id.progress_accept_button); Button buttonFinish = (Button) v.findViewById(R.id.progress_success_button); Button buttonCancel = (Button) v.findViewById(R.id.progress_cancel_button); ViewGroup insertPoint = (ViewGroup) getActivity().findViewById(R.id.progress_buttons_insert_point); insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); setButtonsListeners(buttonAccept, buttonFinish, buttonCancel); }
void function() { LayoutInflater vi = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = vi.inflate(R.layout.current_order_courier_buttons, null); Button buttonAccept = (Button) v.findViewById(R.id.progress_accept_button); Button buttonFinish = (Button) v.findViewById(R.id.progress_success_button); Button buttonCancel = (Button) v.findViewById(R.id.progress_cancel_button); ViewGroup insertPoint = (ViewGroup) getActivity().findViewById(R.id.progress_buttons_insert_point); insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); setButtonsListeners(buttonAccept, buttonFinish, buttonCancel); }
/** * Method launches only if the user is a courier. Inflates the courier buttons. */
Method launches only if the user is a courier. Inflates the courier buttons
onInflateCourierButtonsCall
{ "repo_name": "MiWy/CourierApplication", "path": "app/src/main/java/com/tryouts/courierapplication/fragments/CurrentOrderFragment.java", "license": "mpl-2.0", "size": 7186 }
[ "android.content.Context", "android.view.LayoutInflater", "android.view.View", "android.view.ViewGroup", "android.widget.Button" ]
import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button;
import android.content.*; import android.view.*; import android.widget.*;
[ "android.content", "android.view", "android.widget" ]
android.content; android.view; android.widget;
763,872
String getPlan(Filter filter, NodeState rootState);
String getPlan(Filter filter, NodeState rootState);
/** * Get the query plan for the given filter. This method is called when * running an {@code EXPLAIN SELECT} query, or for logging purposes. The * result should be human readable. * * @param filter the filter * @param rootState root state of the current repository snapshot * @return the query plan */
Get the query plan for the given filter. This method is called when running an EXPLAIN SELECT query, or for logging purposes. The result should be human readable
getPlan
{ "repo_name": "meggermo/jackrabbit-oak", "path": "oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/QueryIndex.java", "license": "apache-2.0", "size": 21858 }
[ "org.apache.jackrabbit.oak.spi.state.NodeState" ]
import org.apache.jackrabbit.oak.spi.state.NodeState;
import org.apache.jackrabbit.oak.spi.state.*;
[ "org.apache.jackrabbit" ]
org.apache.jackrabbit;
684,312
public void setFieldReader(VRMLFieldReader fieldReader) { this.fieldReader = fieldReader; }
void function(VRMLFieldReader fieldReader) { this.fieldReader = fieldReader; }
/** * Set the reader to use for parsing field values. * * @param fieldReader The reader */
Set the reader to use for parsing field values
setFieldReader
{ "repo_name": "Norkart/NK-VirtualGlobe", "path": "Xj3D/apps/cadfilter/src/java/xj3d/filter/node/AbstractEncodable.java", "license": "gpl-2.0", "size": 5048 }
[ "org.web3d.vrml.parser.VRMLFieldReader" ]
import org.web3d.vrml.parser.VRMLFieldReader;
import org.web3d.vrml.parser.*;
[ "org.web3d.vrml" ]
org.web3d.vrml;
1,322,516
final public void println(int v) { try { _out.println(v); } catch (IOException e) { log.log(Level.FINE, e.toString(), e); } }
final void function(int v) { try { _out.println(v); } catch (IOException e) { log.log(Level.FINE, e.toString(), e); } }
/** * Prints an integer followed by a newline. * * @param v the value to print */
Prints an integer followed by a newline
println
{ "repo_name": "baratine/baratine", "path": "framework/src/main/java/com/caucho/v5/vfs/StreamPrintWriter.java", "license": "gpl-2.0", "size": 7435 }
[ "java.io.IOException", "java.util.logging.Level" ]
import java.io.IOException; import java.util.logging.Level;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,159,930
private boolean populateResource(Resource resource, Request request, Predicate predicate) throws SystemException { Set<String> propertyIds = getPropertyIds(); if (propertyIds.isEmpty()) { return true; } String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId); if (hostProvider.getCollectorHostName(clusterName, GANGLIA) == null) { if (LOG.isWarnEnabled()) { LOG.warn("Attempting to get metrics but the Ganglia server is unknown. Resource=" + resource + " : Cluster=" + clusterName); } return true; } setProperties(resource, clusterName, request, getRequestPropertyIds(request, predicate)); return true; }
boolean function(Resource resource, Request request, Predicate predicate) throws SystemException { Set<String> propertyIds = getPropertyIds(); if (propertyIds.isEmpty()) { return true; } String clusterName = (String) resource.getPropertyValue(clusterNamePropertyId); if (hostProvider.getCollectorHostName(clusterName, GANGLIA) == null) { if (LOG.isWarnEnabled()) { LOG.warn(STR + resource + STR + clusterName); } return true; } setProperties(resource, clusterName, request, getRequestPropertyIds(request, predicate)); return true; }
/** * Populate a resource by obtaining the requested Ganglia RESOURCE_METRICS. * * @param resource the resource to be populated * @param request the request * @param predicate the predicate * * @return true if the resource was successfully populated with the requested properties * * @throws SystemException if unable to populate the resource */
Populate a resource by obtaining the requested Ganglia RESOURCE_METRICS
populateResource
{ "repo_name": "radicalbit/ambari", "path": "ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/ganglia/GangliaReportPropertyProvider.java", "license": "apache-2.0", "size": 7952 }
[ "java.util.Set", "org.apache.ambari.server.controller.spi.Predicate", "org.apache.ambari.server.controller.spi.Request", "org.apache.ambari.server.controller.spi.Resource", "org.apache.ambari.server.controller.spi.SystemException" ]
import java.util.Set; import org.apache.ambari.server.controller.spi.Predicate; import org.apache.ambari.server.controller.spi.Request; import org.apache.ambari.server.controller.spi.Resource; import org.apache.ambari.server.controller.spi.SystemException;
import java.util.*; import org.apache.ambari.server.controller.spi.*;
[ "java.util", "org.apache.ambari" ]
java.util; org.apache.ambari;
1,840,686
EReference getDocumentRoot_FormalExpression();
EReference getDocumentRoot_FormalExpression();
/** * Returns the meta object for the containment reference '{@link org.eclipse.bpmn2.DocumentRoot#getFormalExpression <em>Formal Expression</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Formal Expression</em>'. * @see org.eclipse.bpmn2.DocumentRoot#getFormalExpression() * @see #getDocumentRoot() * @generated */
Returns the meta object for the containment reference '<code>org.eclipse.bpmn2.DocumentRoot#getFormalExpression Formal Expression</code>'.
getDocumentRoot_FormalExpression
{ "repo_name": "Rikkola/kie-wb-common", "path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java", "license": "apache-2.0", "size": 929298 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,123,991
public static void main( Sincerity sincerity, String[] arguments ) throws SincerityException { String mainClassName = arguments[0]; String[] mainArguments = new String[arguments.length - 1]; System.arraycopy( arguments, 1, mainArguments, 0, mainArguments.length ); main( sincerity, mainClassName, mainArguments ); }
static void function( Sincerity sincerity, String[] arguments ) throws SincerityException { String mainClassName = arguments[0]; String[] mainArguments = new String[arguments.length - 1]; System.arraycopy( arguments, 1, mainArguments, 0, mainArguments.length ); main( sincerity, mainClassName, mainArguments ); }
/** * Executes the main() method of the class named by the first argument using * the current bootstrap. * * @param sincerity * The Sincerity instance * @param arguments * The class name followed by the arguments for main() * @throws SincerityException * In case of an error */
Executes the main() method of the class named by the first argument using the current bootstrap
main
{ "repo_name": "tliron/sincerity", "path": "components/sincerity/source/com/threecrickets/sincerity/util/ClassUtil.java", "license": "lgpl-3.0", "size": 3324 }
[ "com.threecrickets.sincerity.Sincerity", "com.threecrickets.sincerity.exception.SincerityException" ]
import com.threecrickets.sincerity.Sincerity; import com.threecrickets.sincerity.exception.SincerityException;
import com.threecrickets.sincerity.*; import com.threecrickets.sincerity.exception.*;
[ "com.threecrickets.sincerity" ]
com.threecrickets.sincerity;
2,003,687
private WMSCapabilities getCapabilities( String url, String version ) { WMSCapabilities capa = null; HttpClient httpclient = new HttpClient(); try { enableProxyUsage( httpclient, new URL( url ) ); } catch ( MalformedURLException e ) { LOG.logError( "the passed url was not well formed.", e ); } httpclient.getHttpConnectionManager().getParams().setSoTimeout( 15000 ); StringBuffer sb = new StringBuffer( 500 ); sb.append( url ); if ( url.indexOf( "?" ) < 0 ) { sb.append( "?" ); } else if ( url.charAt( url.length() - 1 ) != '&' ) { sb.append( "&" ); } if ( url.toUpperCase().indexOf( "SERVICE=WMS" ) > -1 ) { // this is extremely stupid but // a) there are some WMS that use SERVICE=WMS as a vendor specific parameter // b) other WMS (ArcGIS) does not accept the same parameter twice in a GetCapabilties request sb.append( "request=GetCapabilities&version=" ); } else { sb.append( "request=GetCapabilities&service=WMS&version=" ); } sb.append( version ); if ( userNames.get( url ) != null ) { sb.append( "&USER=" ).append( userNames.get( url ) ); sb.append( "&PASSWORD=" ); if ( passwords.get( url ) != null ) { sb.append( passwords.get( url ) ); } } LOG.logDebug( sb.toString() ); GetMethod httpget = new GetMethod( sb.toString() ); try { httpclient.executeMethod( httpget ); XMLFragment xml = new XMLFragment(); xml.load( new InputStreamReader( httpget.getResponseBodyAsStream() ), XMLFragment.DEFAULT_URL ); WMSCapabilitiesDocument cdoc = WMSCapabilitiesDocumentFactory.getWMSCapabilitiesDocument( xml.getRootElement() ); capa = (WMSCapabilities) cdoc.parseCapabilities(); } catch ( Exception e ) { LOG.logError( "GetCaps failed for " + sb.toString() ); } return capa; }
WMSCapabilities function( String url, String version ) { WMSCapabilities capa = null; HttpClient httpclient = new HttpClient(); try { enableProxyUsage( httpclient, new URL( url ) ); } catch ( MalformedURLException e ) { LOG.logError( STR, e ); } httpclient.getHttpConnectionManager().getParams().setSoTimeout( 15000 ); StringBuffer sb = new StringBuffer( 500 ); sb.append( url ); if ( url.indexOf( "?" ) < 0 ) { sb.append( "?" ); } else if ( url.charAt( url.length() - 1 ) != '&' ) { sb.append( "&" ); } if ( url.toUpperCase().indexOf( STR ) > -1 ) { sb.append( STR ); } else { sb.append( STR ); } sb.append( version ); if ( userNames.get( url ) != null ) { sb.append( STR ).append( userNames.get( url ) ); sb.append( STR ); if ( passwords.get( url ) != null ) { sb.append( passwords.get( url ) ); } } LOG.logDebug( sb.toString() ); GetMethod httpget = new GetMethod( sb.toString() ); try { httpclient.executeMethod( httpget ); XMLFragment xml = new XMLFragment(); xml.load( new InputStreamReader( httpget.getResponseBodyAsStream() ), XMLFragment.DEFAULT_URL ); WMSCapabilitiesDocument cdoc = WMSCapabilitiesDocumentFactory.getWMSCapabilitiesDocument( xml.getRootElement() ); capa = (WMSCapabilities) cdoc.parseCapabilities(); } catch ( Exception e ) { LOG.logError( STR + sb.toString() ); } return capa; }
/** * Performs a GetCapabilities request (now also with proxy usage enabled) * * @param url * @param version * @return the obtained WMSCapbilities */
Performs a GetCapabilities request (now also with proxy usage enabled)
getCapabilities
{ "repo_name": "lat-lon/deegree2-base", "path": "deegree2-core/src/main/java/org/deegree/portal/standard/wms/control/DynLegendListener.java", "license": "lgpl-2.1", "size": 33078 }
[ "java.io.InputStreamReader", "java.net.MalformedURLException", "org.apache.commons.httpclient.HttpClient", "org.apache.commons.httpclient.methods.GetMethod", "org.deegree.enterprise.WebUtils", "org.deegree.framework.xml.XMLFragment", "org.deegree.ogcwebservices.wms.capabilities.WMSCapabilities", "org.deegree.ogcwebservices.wms.capabilities.WMSCapabilitiesDocument", "org.deegree.ogcwebservices.wms.capabilities.WMSCapabilitiesDocumentFactory" ]
import java.io.InputStreamReader; import java.net.MalformedURLException; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.GetMethod; import org.deegree.enterprise.WebUtils; import org.deegree.framework.xml.XMLFragment; import org.deegree.ogcwebservices.wms.capabilities.WMSCapabilities; import org.deegree.ogcwebservices.wms.capabilities.WMSCapabilitiesDocument; import org.deegree.ogcwebservices.wms.capabilities.WMSCapabilitiesDocumentFactory;
import java.io.*; import java.net.*; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.methods.*; import org.deegree.enterprise.*; import org.deegree.framework.xml.*; import org.deegree.ogcwebservices.wms.capabilities.*;
[ "java.io", "java.net", "org.apache.commons", "org.deegree.enterprise", "org.deegree.framework", "org.deegree.ogcwebservices" ]
java.io; java.net; org.apache.commons; org.deegree.enterprise; org.deegree.framework; org.deegree.ogcwebservices;
55,808
@Test(expected = GenieServerException.class) public void testGetFileMethodValidS3Path() throws GenieException { final ObjectMetadata objectMetadata = Mockito.mock(ObjectMetadata.class); Mockito.when(this.s3Client.getObject(Mockito.any(GetObjectRequest.class), Mockito.any(File.class))) .thenReturn(objectMetadata); final ArgumentCaptor<GetObjectRequest> argument = ArgumentCaptor.forClass(GetObjectRequest.class); s3FileTransfer.getFile(S3_PATH, LOCAL_PATH); Mockito.verify(this.s3Client).getObject(argument.capture(), Mockito.any()); Assert.assertEquals(S3_BUCKET, argument.getValue().getBucketName()); Assert.assertEquals(S3_KEY, argument.getValue().getKey()); Mockito .verify(this.downloadTimer, Mockito.times(1)) .record(Mockito.anyLong(), Mockito.eq(TimeUnit.NANOSECONDS)); }
@Test(expected = GenieServerException.class) void function() throws GenieException { final ObjectMetadata objectMetadata = Mockito.mock(ObjectMetadata.class); Mockito.when(this.s3Client.getObject(Mockito.any(GetObjectRequest.class), Mockito.any(File.class))) .thenReturn(objectMetadata); final ArgumentCaptor<GetObjectRequest> argument = ArgumentCaptor.forClass(GetObjectRequest.class); s3FileTransfer.getFile(S3_PATH, LOCAL_PATH); Mockito.verify(this.s3Client).getObject(argument.capture(), Mockito.any()); Assert.assertEquals(S3_BUCKET, argument.getValue().getBucketName()); Assert.assertEquals(S3_KEY, argument.getValue().getKey()); Mockito .verify(this.downloadTimer, Mockito.times(1)) .record(Mockito.anyLong(), Mockito.eq(TimeUnit.NANOSECONDS)); }
/** * Test the getFile method for valid s3 path. * * @throws GenieException If there is any problem */
Test the getFile method for valid s3 path
testGetFileMethodValidS3Path
{ "repo_name": "irontable/genie", "path": "genie-core/src/test/java/com/netflix/genie/core/services/impl/S3FileTransferImplUnitTests.java", "license": "apache-2.0", "size": 8088 }
[ "com.amazonaws.services.s3.model.GetObjectRequest", "com.amazonaws.services.s3.model.ObjectMetadata", "com.netflix.genie.common.exceptions.GenieException", "com.netflix.genie.common.exceptions.GenieServerException", "java.io.File", "java.util.concurrent.TimeUnit", "org.junit.Assert", "org.junit.Test", "org.mockito.ArgumentCaptor", "org.mockito.Mockito" ]
import com.amazonaws.services.s3.model.GetObjectRequest; import com.amazonaws.services.s3.model.ObjectMetadata; import com.netflix.genie.common.exceptions.GenieException; import com.netflix.genie.common.exceptions.GenieServerException; import java.io.File; import java.util.concurrent.TimeUnit; import org.junit.Assert; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mockito;
import com.amazonaws.services.s3.model.*; import com.netflix.genie.common.exceptions.*; import java.io.*; import java.util.concurrent.*; import org.junit.*; import org.mockito.*;
[ "com.amazonaws.services", "com.netflix.genie", "java.io", "java.util", "org.junit", "org.mockito" ]
com.amazonaws.services; com.netflix.genie; java.io; java.util; org.junit; org.mockito;
1,260,573
private void sendErrorPacket(Packet packet, PacketError.Condition error) { if (packet instanceof IQ) { IQ reply = IQ.createResultIQ((IQ) packet); reply.setChildElement(((IQ) packet).getChildElement().createCopy()); reply.setError(error); router.route(reply); } else { Packet reply = packet.createCopy(); reply.setError(error); reply.setFrom(packet.getTo()); reply.setTo(packet.getFrom()); router.route(reply); } }
void function(Packet packet, PacketError.Condition error) { if (packet instanceof IQ) { IQ reply = IQ.createResultIQ((IQ) packet); reply.setChildElement(((IQ) packet).getChildElement().createCopy()); reply.setError(error); router.route(reply); } else { Packet reply = packet.createCopy(); reply.setError(error); reply.setFrom(packet.getTo()); reply.setTo(packet.getFrom()); router.route(reply); } }
/** * Generate a conflict packet to indicate that the nickname being requested/used is already in * use by another user. * * @param packet the packet to be bounced. * @param error the reason why the operation failed. */
Generate a conflict packet to indicate that the nickname being requested/used is already in use by another user
sendErrorPacket
{ "repo_name": "qyj415/openfire", "path": "src/java/org/jivesoftware/openfire/muc/spi/LocalMUCUser.java", "license": "apache-2.0", "size": 29459 }
[ "org.xmpp.packet.IQ", "org.xmpp.packet.Packet", "org.xmpp.packet.PacketError" ]
import org.xmpp.packet.IQ; import org.xmpp.packet.Packet; import org.xmpp.packet.PacketError;
import org.xmpp.packet.*;
[ "org.xmpp.packet" ]
org.xmpp.packet;
2,279,371
protected void plotData(final VCanvasPlotter plotter, final Map<Integer, List<Float>> pointValues, final Map<Integer, List<Date>> pointDates) { currentlyRendering = true;
void function(final VCanvasPlotter plotter, final Map<Integer, List<Float>> pointValues, final Map<Integer, List<Date>> pointDates) { currentlyRendering = true;
/** * Plots graphs onto the canvas using a plotter * * @param plotter * The plotter to use to plot the graph with * @param pointValues * The values (y-axis) to plot onto the canvas * @param pointDates * The dates (x-axis) to plot onto the canvas */
Plots graphs onto the canvas using a plotter
plotData
{ "repo_name": "bpupadhyaya/dashboard-demo-1", "path": "src/main/java/com/vaadin/addon/timeline/gwt/client/VTimelineCanvasComponent.java", "license": "apache-2.0", "size": 12159 }
[ "java.util.Date", "java.util.List", "java.util.Map" ]
import java.util.Date; import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,959,496
private void setCheckBox(MainDocumentPart documentPart, HashMap<String, String> map) { try { ClassFinder finder = new ClassFinder(FldChar.class); new TraversalUtil(documentPart.getContent(), finder); for (Object o : finder.results) { Object o2 = XmlUtils.unwrap(o); // this is ok, provided the results of the Callback // won't be marshalled FldChar fldChar = (FldChar) o; if (fldChar.getFfData() != null) { boolean check = false; for (JAXBElement<?> nameOrEnabledOrCalcOnExit : fldChar.getFfData().getNameOrEnabledOrCalcOnExit()) { if (nameOrEnabledOrCalcOnExit.getValue() instanceof CTFFName) { CTFFName name = (CTFFName) nameOrEnabledOrCalcOnExit.getValue(); if (map.get(name.getVal()).equals("true")) { check = true; } } else if (nameOrEnabledOrCalcOnExit.getValue() instanceof CTFFCheckBox) { CTFFCheckBox ccb = (CTFFCheckBox) nameOrEnabledOrCalcOnExit.getValue(); if (check) { ccb.setDefault(new BooleanDefaultTrue()); check = false; } } } } } } catch (Exception e) { e.printStackTrace(); } }
void function(MainDocumentPart documentPart, HashMap<String, String> map) { try { ClassFinder finder = new ClassFinder(FldChar.class); new TraversalUtil(documentPart.getContent(), finder); for (Object o : finder.results) { Object o2 = XmlUtils.unwrap(o); FldChar fldChar = (FldChar) o; if (fldChar.getFfData() != null) { boolean check = false; for (JAXBElement<?> nameOrEnabledOrCalcOnExit : fldChar.getFfData().getNameOrEnabledOrCalcOnExit()) { if (nameOrEnabledOrCalcOnExit.getValue() instanceof CTFFName) { CTFFName name = (CTFFName) nameOrEnabledOrCalcOnExit.getValue(); if (map.get(name.getVal()).equals("true")) { check = true; } } else if (nameOrEnabledOrCalcOnExit.getValue() instanceof CTFFCheckBox) { CTFFCheckBox ccb = (CTFFCheckBox) nameOrEnabledOrCalcOnExit.getValue(); if (check) { ccb.setDefault(new BooleanDefaultTrue()); check = false; } } } } } } catch (Exception e) { e.printStackTrace(); } }
/** * Verifica se no documento contem checkBox se sim e se estiver true na * variavel map checa o componente checkBox * * @param documentPart objeto contem o doc * @param map contem todas as informacoes dos parametros e das checkBoxs */
Verifica se no documento contem checkBox se sim e se estiver true na variavel map checa o componente checkBox
setCheckBox
{ "repo_name": "danieldkm/agendaPAF", "path": "src/main/java/com/unifil/agendapaf/util/GerarDocx.java", "license": "gpl-2.0", "size": 13393 }
[ "java.util.HashMap", "javax.xml.bind.JAXBElement", "org.docx4j.TraversalUtil", "org.docx4j.XmlUtils", "org.docx4j.finders.ClassFinder", "org.docx4j.openpackaging.parts.WordprocessingML", "org.docx4j.wml.BooleanDefaultTrue", "org.docx4j.wml.CTFFCheckBox", "org.docx4j.wml.CTFFName", "org.docx4j.wml.FldChar" ]
import java.util.HashMap; import javax.xml.bind.JAXBElement; import org.docx4j.TraversalUtil; import org.docx4j.XmlUtils; import org.docx4j.finders.ClassFinder; import org.docx4j.openpackaging.parts.WordprocessingML; import org.docx4j.wml.BooleanDefaultTrue; import org.docx4j.wml.CTFFCheckBox; import org.docx4j.wml.CTFFName; import org.docx4j.wml.FldChar;
import java.util.*; import javax.xml.bind.*; import org.docx4j.*; import org.docx4j.finders.*; import org.docx4j.openpackaging.parts.*; import org.docx4j.wml.*;
[ "java.util", "javax.xml", "org.docx4j", "org.docx4j.finders", "org.docx4j.openpackaging", "org.docx4j.wml" ]
java.util; javax.xml; org.docx4j; org.docx4j.finders; org.docx4j.openpackaging; org.docx4j.wml;
2,547,842
private List<String> getArtifactsAbsolutePath( JavadocPathArtifact javadocArtifact ) throws MavenReportException { if ( ( StringUtils.isEmpty( javadocArtifact.getGroupId() ) ) && ( StringUtils.isEmpty( javadocArtifact.getArtifactId() ) ) && ( StringUtils.isEmpty( javadocArtifact.getVersion() ) ) ) { return Collections.emptyList(); } List<String> path = new ArrayList<>(); try { Artifact artifact = createAndResolveArtifact( javadocArtifact ); path.add( artifact.getFile().getAbsolutePath() ); DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate(); coordinate.setGroupId( javadocArtifact.getGroupId() ); coordinate.setArtifactId( javadocArtifact.getArtifactId() ); coordinate.setVersion( javadocArtifact.getVersion() ); Iterable<ArtifactResult> deps = dependencyResolver.resolveDependencies( session.getProjectBuildingRequest(), coordinate, ScopeFilter.including( "compile", "provided" ) ); for ( ArtifactResult a : deps ) { path.add( a.getArtifact().getFile().getAbsolutePath() ); } return path; } catch ( ArtifactResolverException e ) { throw new MavenReportException( "Unable to resolve artifact:" + javadocArtifact, e ); } catch ( DependencyResolverException e ) { throw new MavenReportException( "Unable to resolve dependencies for:" + javadocArtifact, e ); } } /** * creates an {@link Artifact} representing the configured {@link JavadocPathArtifact} and resolves it. * * @param javadocArtifact the {@link JavadocPathArtifact} to resolve * @return a resolved {@link Artifact}
List<String> function( JavadocPathArtifact javadocArtifact ) throws MavenReportException { if ( ( StringUtils.isEmpty( javadocArtifact.getGroupId() ) ) && ( StringUtils.isEmpty( javadocArtifact.getArtifactId() ) ) && ( StringUtils.isEmpty( javadocArtifact.getVersion() ) ) ) { return Collections.emptyList(); } List<String> path = new ArrayList<>(); try { Artifact artifact = createAndResolveArtifact( javadocArtifact ); path.add( artifact.getFile().getAbsolutePath() ); DefaultDependableCoordinate coordinate = new DefaultDependableCoordinate(); coordinate.setGroupId( javadocArtifact.getGroupId() ); coordinate.setArtifactId( javadocArtifact.getArtifactId() ); coordinate.setVersion( javadocArtifact.getVersion() ); Iterable<ArtifactResult> deps = dependencyResolver.resolveDependencies( session.getProjectBuildingRequest(), coordinate, ScopeFilter.including( STR, STR ) ); for ( ArtifactResult a : deps ) { path.add( a.getArtifact().getFile().getAbsolutePath() ); } return path; } catch ( ArtifactResolverException e ) { throw new MavenReportException( STR + javadocArtifact, e ); } catch ( DependencyResolverException e ) { throw new MavenReportException( STR + javadocArtifact, e ); } } /** * creates an {@link Artifact} representing the configured {@link JavadocPathArtifact} and resolves it. * * @param javadocArtifact the {@link JavadocPathArtifact} to resolve * @return a resolved {@link Artifact}
/** * Return the Javadoc artifact path and its transitive dependencies path from the local repository * * @param javadocArtifact not null * @return a list of locale artifacts absolute path * @throws MavenReportException if any */
Return the Javadoc artifact path and its transitive dependencies path from the local repository
getArtifactsAbsolutePath
{ "repo_name": "mcculls/maven-plugins", "path": "maven-javadoc-plugin/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java", "license": "apache-2.0", "size": 237779 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "org.apache.maven.artifact.Artifact", "org.apache.maven.plugins.javadoc.JavadocUtil", "org.apache.maven.plugins.javadoc.options.JavadocPathArtifact", "org.apache.maven.reporting.MavenReportException", "org.apache.maven.shared.artifact.filter.resolve.ScopeFilter", "org.apache.maven.shared.artifact.resolve.ArtifactResolverException", "org.apache.maven.shared.artifact.resolve.ArtifactResult", "org.apache.maven.shared.dependencies.DefaultDependableCoordinate", "org.apache.maven.shared.dependencies.resolve.DependencyResolverException", "org.codehaus.plexus.util.StringUtils" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugins.javadoc.JavadocUtil; import org.apache.maven.plugins.javadoc.options.JavadocPathArtifact; import org.apache.maven.reporting.MavenReportException; import org.apache.maven.shared.artifact.filter.resolve.ScopeFilter; import org.apache.maven.shared.artifact.resolve.ArtifactResolverException; import org.apache.maven.shared.artifact.resolve.ArtifactResult; import org.apache.maven.shared.dependencies.DefaultDependableCoordinate; import org.apache.maven.shared.dependencies.resolve.DependencyResolverException; import org.codehaus.plexus.util.StringUtils;
import java.util.*; import org.apache.maven.artifact.*; import org.apache.maven.plugins.javadoc.*; import org.apache.maven.plugins.javadoc.options.*; import org.apache.maven.reporting.*; import org.apache.maven.shared.artifact.filter.resolve.*; import org.apache.maven.shared.artifact.resolve.*; import org.apache.maven.shared.dependencies.*; import org.apache.maven.shared.dependencies.resolve.*; import org.codehaus.plexus.util.*;
[ "java.util", "org.apache.maven", "org.codehaus.plexus" ]
java.util; org.apache.maven; org.codehaus.plexus;
2,413,303
public RefCounted<SolrIndexSearcher> getSearcher() { return getSearcher(false,true,null); }
RefCounted<SolrIndexSearcher> function() { return getSearcher(false,true,null); }
/** * Return a registered {@link RefCounted}&lt;{@link SolrIndexSearcher}&gt; with * the reference count incremented. It <b>must</b> be decremented when no longer needed. * This method should not be called from SolrCoreAware.inform() since it can result * in a deadlock if useColdSearcher==false. * If handling a normal request, the searcher should be obtained from * {@link org.apache.solr.request.SolrQueryRequest#getSearcher()} instead. */
Return a registered <code>RefCounted</code>&lt;<code>SolrIndexSearcher</code>&gt; with the reference count incremented. It must be decremented when no longer needed. This method should not be called from SolrCoreAware.inform() since it can result in a deadlock if useColdSearcher==false. If handling a normal request, the searcher should be obtained from <code>org.apache.solr.request.SolrQueryRequest#getSearcher()</code> instead
getSearcher
{ "repo_name": "yintaoxue/read-open-source-code", "path": "solr-4.10.4/src/org/apache/solr/core/SolrCore.java", "license": "apache-2.0", "size": 95480 }
[ "org.apache.solr.search.SolrIndexSearcher", "org.apache.solr.util.RefCounted" ]
import org.apache.solr.search.SolrIndexSearcher; import org.apache.solr.util.RefCounted;
import org.apache.solr.search.*; import org.apache.solr.util.*;
[ "org.apache.solr" ]
org.apache.solr;
2,121,065
public Map<String, String> getParams(HttpMessage msg, HtmlParameter.Type type) { switch (type) { case form: return this.getFormParamParser(msg.getRequestHeader().getURI().toString()).getParams(msg, type); case url: return this.getUrlParamParser(msg.getRequestHeader().getURI().toString()).getParams(msg, type); default: throw new InvalidParameterException("Type not supported: " + type); } }
Map<String, String> function(HttpMessage msg, HtmlParameter.Type type) { switch (type) { case form: return this.getFormParamParser(msg.getRequestHeader().getURI().toString()).getParams(msg, type); case url: return this.getUrlParamParser(msg.getRequestHeader().getURI().toString()).getParams(msg, type); default: throw new InvalidParameterException(STR + type); } }
/** * Returns the specified parameters for the given message based on the parser associated with the * first context found that includes the URL for the message, or the default parser if it is not * in a context * @param msg * @param type * @return */
Returns the specified parameters for the given message based on the parser associated with the first context found that includes the URL for the message, or the default parser if it is not in a context
getParams
{ "repo_name": "GillesMoris/OSS", "path": "src/org/parosproxy/paros/model/Session.java", "license": "apache-2.0", "size": 54894 }
[ "java.security.InvalidParameterException", "java.util.Map", "org.parosproxy.paros.network.HtmlParameter", "org.parosproxy.paros.network.HttpMessage" ]
import java.security.InvalidParameterException; import java.util.Map; import org.parosproxy.paros.network.HtmlParameter; import org.parosproxy.paros.network.HttpMessage;
import java.security.*; import java.util.*; import org.parosproxy.paros.network.*;
[ "java.security", "java.util", "org.parosproxy.paros" ]
java.security; java.util; org.parosproxy.paros;
745,081
@Test public void exists() throws IOException { LOG.info("Starting exists"); assertFalse(dataStore.exists(new DataIdentifier(ID_PREFIX + 0))); LOG.info("Finished exists"); }
void function() throws IOException { LOG.info(STR); assertFalse(dataStore.exists(new DataIdentifier(ID_PREFIX + 0))); LOG.info(STR); }
/** * {@link CompositeDataStoreCache#get(String)} when no cache. * @throws IOException */
<code>CompositeDataStoreCache#get(String)</code> when no cache
exists
{ "repo_name": "stillalex/jackrabbit-oak", "path": "oak-blob-plugins/src/test/java/org/apache/jackrabbit/oak/plugins/blob/CachingDataStoreTest.java", "license": "apache-2.0", "size": 21620 }
[ "java.io.IOException", "org.apache.jackrabbit.core.data.DataIdentifier", "org.junit.Assert" ]
import java.io.IOException; import org.apache.jackrabbit.core.data.DataIdentifier; import org.junit.Assert;
import java.io.*; import org.apache.jackrabbit.core.data.*; import org.junit.*;
[ "java.io", "org.apache.jackrabbit", "org.junit" ]
java.io; org.apache.jackrabbit; org.junit;
2,680,842
Assert.notNull(version, "Version must not be null"); if (version.toString().endsWith(SNAPSHOT_SUFFIX)) { return SNAPSHOT; } if (PRERELEASE_PATTERN.matcher(version.toString()).matches()) { return PRERELEASE; } return GENERAL_AVAILABILITY; }
Assert.notNull(version, STR); if (version.toString().endsWith(SNAPSHOT_SUFFIX)) { return SNAPSHOT; } if (PRERELEASE_PATTERN.matcher(version.toString()).matches()) { return PRERELEASE; } return GENERAL_AVAILABILITY; }
/** * Deduce the {@link ReleaseStatus status} of a release given its {@link Version} * @param version a project version * @return the release status for this version */
Deduce the <code>ReleaseStatus status</code> of a release given its <code>Version</code>
getFromVersion
{ "repo_name": "spring-io/sagan", "path": "sagan-site/src/main/java/sagan/site/projects/ReleaseStatus.java", "license": "bsd-3-clause", "size": 1122 }
[ "org.springframework.util.Assert" ]
import org.springframework.util.Assert;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
2,910,620
public RegionServerServices createMockRegionServerService() throws IOException { return createMockRegionServerService((ServerName) null); }
RegionServerServices function() throws IOException { return createMockRegionServerService((ServerName) null); }
/** * Create a stubbed out RegionServerService, mainly for getting FS. */
Create a stubbed out RegionServerService, mainly for getting FS
createMockRegionServerService
{ "repo_name": "mahak/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java", "license": "apache-2.0", "size": 151013 }
[ "java.io.IOException", "org.apache.hadoop.hbase.regionserver.RegionServerServices" ]
import java.io.IOException; import org.apache.hadoop.hbase.regionserver.RegionServerServices;
import java.io.*; import org.apache.hadoop.hbase.regionserver.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
404,251
@SuppressWarnings({"unchecked"}) protected static List<LogEntry> readDocument(Document doc) { List<LogEntry> logEntries = new ArrayList<LogEntry>(); AuditLogger audit = Framework.getLocalService(AuditLogger.class); Element rootElement = doc.getRootElement(); Iterator<Element> it = rootElement.elementIterator(); while (it.hasNext()) { Element logEntryElement = it.next(); LogEntry logEntry = readLogEntry(audit, logEntryElement); logEntries.add(logEntry); } return logEntries; }
@SuppressWarnings({STR}) static List<LogEntry> function(Document doc) { List<LogEntry> logEntries = new ArrayList<LogEntry>(); AuditLogger audit = Framework.getLocalService(AuditLogger.class); Element rootElement = doc.getRootElement(); Iterator<Element> it = rootElement.elementIterator(); while (it.hasNext()) { Element logEntryElement = it.next(); LogEntry logEntry = readLogEntry(audit, logEntryElement); logEntries.add(logEntry); } return logEntries; }
/** * Will translate from a jdoc to a list of LogEntry objects. */
Will translate from a jdoc to a list of LogEntry objects
readDocument
{ "repo_name": "deadcyclo/nuxeo-features", "path": "nuxeo-platform-audit/nuxeo-platform-audit-io/src/main/java/org/nuxeo/ecm/platform/audit/io/IOLogEntryBase.java", "license": "lgpl-2.1", "size": 7792 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.dom4j.Document", "org.dom4j.Element", "org.nuxeo.ecm.platform.audit.api.AuditLogger", "org.nuxeo.ecm.platform.audit.api.LogEntry", "org.nuxeo.runtime.api.Framework" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.dom4j.Document; import org.dom4j.Element; import org.nuxeo.ecm.platform.audit.api.AuditLogger; import org.nuxeo.ecm.platform.audit.api.LogEntry; import org.nuxeo.runtime.api.Framework;
import java.util.*; import org.dom4j.*; import org.nuxeo.ecm.platform.audit.api.*; import org.nuxeo.runtime.api.*;
[ "java.util", "org.dom4j", "org.nuxeo.ecm", "org.nuxeo.runtime" ]
java.util; org.dom4j; org.nuxeo.ecm; org.nuxeo.runtime;
438,406
public static String toHumanReadableString(BareTypeParameterElement instance) { StringBuilder stringBuilder = new StringBuilder(); // append(null) will produce "null" stringBuilder.append(NAME).append(' ').append(instance.getSimpleName()); List<? extends BareTypeMirror> bounds = instance.getBounds(); if (!bounds.isEmpty()) { stringBuilder.append(" extends "); Iterator<? extends BareTypeMirror> boundIterator = bounds.iterator(); while (boundIterator.hasNext()) { stringBuilder.append(boundIterator.next()); if (boundIterator.hasNext()) { stringBuilder.append(" & "); } } } return stringBuilder.toString(); } }
static String function(BareTypeParameterElement instance) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(NAME).append(' ').append(instance.getSimpleName()); List<? extends BareTypeMirror> bounds = instance.getBounds(); if (!bounds.isEmpty()) { stringBuilder.append(STR); Iterator<? extends BareTypeMirror> boundIterator = bounds.iterator(); while (boundIterator.hasNext()) { stringBuilder.append(boundIterator.next()); if (boundIterator.hasNext()) { stringBuilder.append(STR); } } } return stringBuilder.toString(); } }
/** * Default implementation for {@link BareTypeParameterElement#toString()}. */
Default implementation for <code>BareTypeParameterElement#toString()</code>
toHumanReadableString
{ "repo_name": "priimak/cloudkeeper", "path": "cloudkeeper-core/cloudkeeper-model/src/main/java/com/svbio/cloudkeeper/model/bare/element/type/BareTypeParameterElement.java", "license": "apache-2.0", "size": 2379 }
[ "com.svbio.cloudkeeper.model.bare.type.BareTypeMirror", "java.util.Iterator", "java.util.List" ]
import com.svbio.cloudkeeper.model.bare.type.BareTypeMirror; import java.util.Iterator; import java.util.List;
import com.svbio.cloudkeeper.model.bare.type.*; import java.util.*;
[ "com.svbio.cloudkeeper", "java.util" ]
com.svbio.cloudkeeper; java.util;
1,600,023
return ArrayMath.logSum(ArrayMath.unbox(c.values())); }
return ArrayMath.logSum(ArrayMath.unbox(c.values())); }
/** * Returns ArrayMath.logSum of the values in this counter. * * @param c Argument counter (which is not modified) * @return ArrayMath.logSum of the values in this counter. */
Returns ArrayMath.logSum of the values in this counter
logSum
{ "repo_name": "codev777/CoreNLP", "path": "src/edu/stanford/nlp/stats/Counters.java", "license": "gpl-2.0", "size": 100293 }
[ "edu.stanford.nlp.math.ArrayMath" ]
import edu.stanford.nlp.math.ArrayMath;
import edu.stanford.nlp.math.*;
[ "edu.stanford.nlp" ]
edu.stanford.nlp;
548,996
public void setUncaughtExceptionHandler(UncaughtExceptionHandler handler) { RVMThread.dumpStack(); throw new Error("TODO"); }
void function(UncaughtExceptionHandler handler) { RVMThread.dumpStack(); throw new Error("TODO"); }
/** * <p> * Sets the default uncaught exception handler. * </p> * * @param handler The handler to set or <code>null</code>. * @throws SecurityException if the current SecurityManager fails the * checkAccess call. * @since 1.5 */
Sets the default uncaught exception handler.
setUncaughtExceptionHandler
{ "repo_name": "CodeOffloading/JikesRVM-CCO", "path": "jikesrvm-3.1.3/libraryInterface/Harmony/ASF/src/java/lang/Thread.java", "license": "epl-1.0", "size": 31758 }
[ "org.jikesrvm.scheduler.RVMThread" ]
import org.jikesrvm.scheduler.RVMThread;
import org.jikesrvm.scheduler.*;
[ "org.jikesrvm.scheduler" ]
org.jikesrvm.scheduler;
1,518,270
public void testReplaceValuesRandomAccess() { Multimap<String, Integer> multimap = create(); multimap.put("foo", 1); multimap.put("foo", 3); assertTrue(multimap.replaceValues("foo", Arrays.asList(2, 4)) instanceof RandomAccess); assertTrue(multimap.replaceValues("bar", Arrays.asList(2, 4)) instanceof RandomAccess); }
void function() { Multimap<String, Integer> multimap = create(); multimap.put("foo", 1); multimap.put("foo", 3); assertTrue(multimap.replaceValues("foo", Arrays.asList(2, 4)) instanceof RandomAccess); assertTrue(multimap.replaceValues("bar", Arrays.asList(2, 4)) instanceof RandomAccess); }
/** * Confirm that replaceValues() returns a List that implements RandomAccess, * even though get() doesn't. */
Confirm that replaceValues() returns a List that implements RandomAccess, even though get() doesn't
testReplaceValuesRandomAccess
{ "repo_name": "g0alshhhit/guavaHelper", "path": "guava-tests/test/com/google/common/collect/LinkedListMultimapTest.java", "license": "apache-2.0", "size": 17531 }
[ "java.util.Arrays", "java.util.RandomAccess" ]
import java.util.Arrays; import java.util.RandomAccess;
import java.util.*;
[ "java.util" ]
java.util;
2,422,268
public void setInterpreterGroupProperties(String interpreterGroupId, Properties properties) throws IOException { ManagedInterpreterGroup interpreterGroup = this.interpreterGroups.get(interpreterGroupId); for (List<Interpreter> session : interpreterGroup.sessions.values()) { for (Interpreter intp : session) { if (!intp.getProperties().equals(properties) && interpreterGroup.getRemoteInterpreterProcess() != null && interpreterGroup.getRemoteInterpreterProcess().isRunning()) { throw new IOException("Can not change interpreter properties when interpreter process " + "has already been launched"); } intp.setProperties(properties); } } }
void function(String interpreterGroupId, Properties properties) throws IOException { ManagedInterpreterGroup interpreterGroup = this.interpreterGroups.get(interpreterGroupId); for (List<Interpreter> session : interpreterGroup.sessions.values()) { for (Interpreter intp : session) { if (!intp.getProperties().equals(properties) && interpreterGroup.getRemoteInterpreterProcess() != null && interpreterGroup.getRemoteInterpreterProcess().isRunning()) { throw new IOException(STR + STR); } intp.setProperties(properties); } } }
/** * Throw exception when interpreter process has already launched * * @param interpreterGroupId * @param properties * @throws IOException */
Throw exception when interpreter process has already launched
setInterpreterGroupProperties
{ "repo_name": "jongyoul/incubator-zeppelin", "path": "zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java", "license": "apache-2.0", "size": 43768 }
[ "java.io.IOException", "java.util.List", "java.util.Properties" ]
import java.io.IOException; import java.util.List; import java.util.Properties;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,594,121
@Override public T visitPrimaryNoNewArray(@NotNull Java8Parser.PrimaryNoNewArrayContext ctx) { return visitChildren(ctx); }
@Override public T visitPrimaryNoNewArray(@NotNull Java8Parser.PrimaryNoNewArrayContext ctx) { return visitChildren(ctx); }
/** * {@inheritDoc} * * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> */
The default implementation returns the result of calling <code>#visitChildren</code> on ctx
visitMethodReference
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/Java8BaseVisitor.java", "license": "gpl-3.0", "size": 65479 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,462,934
public void setSchedulerObjectName(ObjectName schedulerObjectName) throws SchedulerException { this.schedulerObjectName = schedulerObjectName; }
void function(ObjectName schedulerObjectName) throws SchedulerException { this.schedulerObjectName = schedulerObjectName; }
/** * Set the name under which the Scheduler MBean is registered on the * remote MBean server. */
Set the name under which the Scheduler MBean is registered on the remote MBean server
setSchedulerObjectName
{ "repo_name": "suthat/signal", "path": "vendor/quartz-2.2.0/src/org/quartz/impl/RemoteMBeanScheduler.java", "license": "apache-2.0", "size": 31569 }
[ "javax.management.ObjectName", "org.quartz.SchedulerException" ]
import javax.management.ObjectName; import org.quartz.SchedulerException;
import javax.management.*; import org.quartz.*;
[ "javax.management", "org.quartz" ]
javax.management; org.quartz;
2,289,947
public String toString() { return DOM2Writer.nodeToString((Node)element); }
String function() { return DOM2Writer.nodeToString((Node)element); }
/** * return the string representation of the token. * * @return the string representation of the token. */
return the string representation of the token
toString
{ "repo_name": "fatfredyy/wss4j-ecc", "path": "src/main/java/org/apache/ws/security/message/token/DOMX509Data.java", "license": "apache-2.0", "size": 2911 }
[ "org.apache.ws.security.util.DOM2Writer", "org.w3c.dom.Node" ]
import org.apache.ws.security.util.DOM2Writer; import org.w3c.dom.Node;
import org.apache.ws.security.util.*; import org.w3c.dom.*;
[ "org.apache.ws", "org.w3c.dom" ]
org.apache.ws; org.w3c.dom;
2,820,248
private void saveIncrementalState(SqoopOptions options) throws IOException { if (!isIncremental(options)) { return; } Map<String, String> descriptor = options.getStorageDescriptor(); String jobName = options.getJobName(); if (null != jobName && null != descriptor) { // Actually save it back to the metastore. LOG.info("Saving incremental import state to the metastore"); JobStorageFactory ssf = new JobStorageFactory(options.getConf()); JobStorage storage = ssf.getJobStorage(descriptor); storage.open(descriptor); try { // Save the 'parent' SqoopOptions; this does not contain the mutations // to the SqoopOptions state that occurred over the course of this // execution, except for the one we specifically want to memorize: // the latest value of the check column. JobData data = new JobData(options.getParent(), this); storage.update(jobName, data); LOG.info("Updated data for job: " + jobName); } finally { storage.close(); } } else { // If there wasn't a parent SqoopOptions, then the incremental // state data was stored in the current SqoopOptions. LOG.info("Incremental import complete! To run another incremental " + "import of all data following this import, supply the " + "following arguments:"); SqoopOptions.IncrementalMode incrementalMode = options.getIncrementalMode(); switch (incrementalMode) { case AppendRows: LOG.info(" --incremental append"); break; case DateLastModified: LOG.info(" --incremental lastmodified"); break; default: LOG.warn("Undefined incremental mode: " + incrementalMode); break; } LOG.info(" --check-column " + options.getIncrementalTestColumn()); LOG.info(" --last-value " + options.getIncrementalLastValue()); LOG.info("(Consider saving this with 'sqoop job --create')"); } }
void function(SqoopOptions options) throws IOException { if (!isIncremental(options)) { return; } Map<String, String> descriptor = options.getStorageDescriptor(); String jobName = options.getJobName(); if (null != jobName && null != descriptor) { LOG.info(STR); JobStorageFactory ssf = new JobStorageFactory(options.getConf()); JobStorage storage = ssf.getJobStorage(descriptor); storage.open(descriptor); try { JobData data = new JobData(options.getParent(), this); storage.update(jobName, data); LOG.info(STR + jobName); } finally { storage.close(); } } else { LOG.info(STR + STR + STR); SqoopOptions.IncrementalMode incrementalMode = options.getIncrementalMode(); switch (incrementalMode) { case AppendRows: LOG.info(STR); break; case DateLastModified: LOG.info(STR); break; default: LOG.warn(STR + incrementalMode); break; } LOG.info(STR + options.getIncrementalTestColumn()); LOG.info(STR + options.getIncrementalLastValue()); LOG.info(STR); } }
/** * If this is an incremental import, then we should save the * user's state back to the metastore (if this job was run * from the metastore). Otherwise, log to the user what data * they need to supply next time. */
If this is an incremental import, then we should save the user's state back to the metastore (if this job was run from the metastore). Otherwise, log to the user what data they need to supply next time
saveIncrementalState
{ "repo_name": "dlanza1/sqoop", "path": "src/java/org/apache/sqoop/tool/ImportTool.java", "license": "apache-2.0", "size": 40926 }
[ "com.cloudera.sqoop.SqoopOptions", "com.cloudera.sqoop.metastore.JobData", "com.cloudera.sqoop.metastore.JobStorage", "com.cloudera.sqoop.metastore.JobStorageFactory", "java.io.IOException", "java.util.Map" ]
import com.cloudera.sqoop.SqoopOptions; import com.cloudera.sqoop.metastore.JobData; import com.cloudera.sqoop.metastore.JobStorage; import com.cloudera.sqoop.metastore.JobStorageFactory; import java.io.IOException; import java.util.Map;
import com.cloudera.sqoop.*; import com.cloudera.sqoop.metastore.*; import java.io.*; import java.util.*;
[ "com.cloudera.sqoop", "java.io", "java.util" ]
com.cloudera.sqoop; java.io; java.util;
2,874,690
public MicrosoftGraphGroupInner withCalendarView(List<MicrosoftGraphEvent> calendarView) { this.calendarView = calendarView; return this; }
MicrosoftGraphGroupInner function(List<MicrosoftGraphEvent> calendarView) { this.calendarView = calendarView; return this; }
/** * Set the calendarView property: The calendar view for the calendar. Read-only. * * @param calendarView the calendarView value to set. * @return the MicrosoftGraphGroupInner object itself. */
Set the calendarView property: The calendar view for the calendar. Read-only
withCalendarView
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/MicrosoftGraphGroupInner.java", "license": "mit", "size": 74957 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,780,077
public ExecutionContext getContext();
ExecutionContext function();
/** * Get the context for this session. * * @return the session's context; never null */
Get the context for this session
getContext
{ "repo_name": "flownclouds/modeshape", "path": "modeshape-jcr/src/main/java/org/modeshape/jcr/cache/SessionCache.java", "license": "apache-2.0", "size": 12357 }
[ "org.modeshape.jcr.ExecutionContext" ]
import org.modeshape.jcr.ExecutionContext;
import org.modeshape.jcr.*;
[ "org.modeshape.jcr" ]
org.modeshape.jcr;
1,508,447
public void setDate(Calendar newDate) { mDate = newDate; setText(DateFormat.getDateInstance(DateFormat.LONG).format( mDate.getTime())); }
void function(Calendar newDate) { mDate = newDate; setText(DateFormat.getDateInstance(DateFormat.LONG).format( mDate.getTime())); }
/** * Sets the date on the button. * * @param newDate new date to be set */
Sets the date on the button
setDate
{ "repo_name": "floatingatoll/geohashdroid-fork", "path": "src/net/exclaimindustries/tools/DateButton.java", "license": "bsd-3-clause", "size": 6127 }
[ "java.text.DateFormat", "java.util.Calendar" ]
import java.text.DateFormat; import java.util.Calendar;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
490,587
@Deprecated public List<String> fieldDataFields() { return docValueFields; }
List<String> function() { return docValueFields; }
/** * Gets the docvalue fields. * * @deprecated Use {@link SearchSourceBuilder#docValueFields()} instead. */
Gets the docvalue fields
fieldDataFields
{ "repo_name": "spiegela/elasticsearch", "path": "core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java", "license": "apache-2.0", "size": 55851 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,277,116
public boolean canHandleCommand(HmDatapoint dp, Object value);
boolean function(HmDatapoint dp, Object value);
/** * Returns true, if the virtual datapoint can handle a command for the given datapoint. */
Returns true, if the virtual datapoint can handle a command for the given datapoint
canHandleCommand
{ "repo_name": "actong/openhab2", "path": "addons/binding/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/virtual/VirtualDatapointHandler.java", "license": "epl-1.0", "size": 2119 }
[ "org.openhab.binding.homematic.internal.model.HmDatapoint" ]
import org.openhab.binding.homematic.internal.model.HmDatapoint;
import org.openhab.binding.homematic.internal.model.*;
[ "org.openhab.binding" ]
org.openhab.binding;
2,690,074
Builder replaceText(Node node, int length, String newContent) { int startPosition = node.getSourceOffset(); replacements.put( node.getSourceFileName(), CodeReplacement.create(startPosition, length, newContent)); return this; }
Builder replaceText(Node node, int length, String newContent) { int startPosition = node.getSourceOffset(); replacements.put( node.getSourceFileName(), CodeReplacement.create(startPosition, length, newContent)); return this; }
/** * Replaces text starting at the given node position. */
Replaces text starting at the given node position
replaceText
{ "repo_name": "GoogleChromeLabs/chromeos_smart_card_connector", "path": "third_party/closure-compiler/src/src/com/google/javascript/refactoring/SuggestedFix.java", "license": "apache-2.0", "size": 35397 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
1,251,480
private static HdfsFileStatus createFileStatus(byte[] path, INode node) { // length is zero for directories return new HdfsFileStatus( node instanceof INodeFile ? ((INodeFile)node).computeFileSize(true) : 0, node.isDirectory(), (node.isDirectory() || node.isLink()) ? 0 : ((INodeFile)node).getReplication(), (node.isDirectory() || node.isLink()) ? 0 : ((INodeFile)node).getPreferredBlockSize(), node.getModificationTime(), node.getAccessTime(), node.getFsPermission(), node.getUserName(), node.getGroupName(), node.isLink() ? ((INodeSymlink)node).getSymlink() : null, path); }
static HdfsFileStatus function(byte[] path, INode node) { return new HdfsFileStatus( node instanceof INodeFile ? ((INodeFile)node).computeFileSize(true) : 0, node.isDirectory(), (node.isDirectory() node.isLink()) ? 0 : ((INodeFile)node).getReplication(), (node.isDirectory() node.isLink()) ? 0 : ((INodeFile)node).getPreferredBlockSize(), node.getModificationTime(), node.getAccessTime(), node.getFsPermission(), node.getUserName(), node.getGroupName(), node.isLink() ? ((INodeSymlink)node).getSymlink() : null, path); }
/** * Create FileStatus by file INode */
Create FileStatus by file INode
createFileStatus
{ "repo_name": "sdecoder/CMDS-HDFS", "path": "hdfs/src/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java", "license": "apache-2.0", "size": 76258 }
[ "org.apache.hadoop.hdfs.protocol.HdfsFileStatus" ]
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
import org.apache.hadoop.hdfs.protocol.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,872,480
public Charset getUriEncoding() { return this.uriEncoding; }
Charset function() { return this.uriEncoding; }
/** * Returns the character encoding to use for URL decoding. * @return the URI encoding */
Returns the character encoding to use for URL decoding
getUriEncoding
{ "repo_name": "xiaoleiPENG/my-project", "path": "spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java", "license": "apache-2.0", "size": 29272 }
[ "java.nio.charset.Charset" ]
import java.nio.charset.Charset;
import java.nio.charset.*;
[ "java.nio" ]
java.nio;
760,297
protected boolean intersectsTag(CloudTag tag, int left, int right, int top, int bottom) { // // copy old rectangle // Rect rect1 = new Rect(tag.m_rect); // // construct new rectangle // Rect rect2 = new Rect(left, top, right, bottom); // // is it intersecting // boolean ret = Rect.intersects(rect1, rect2); return ret; }
boolean function(CloudTag tag, int left, int right, int top, int bottom) { Rect rect1 = new Rect(tag.m_rect); Rect rect2 = new Rect(left, top, right, bottom); boolean ret = Rect.intersects(rect1, rect2); return ret; }
/** * checks if the specified tag intersects the tag * * @param tag * with an rectangle associated * @param left * corner * @param right * corner * @param top * position * @param bottom * position * @return true when it intersects */
checks if the specified tag intersects the tag
intersectsTag
{ "repo_name": "novoid/tstest", "path": "android/src/org/me/tagstore/ui/CloudViewTagAdapter.java", "license": "gpl-3.0", "size": 17027 }
[ "android.graphics.Rect" ]
import android.graphics.Rect;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,896,897
public static Iterable<String> readLines(Path inputFile, Charset charset) throws IOException { return asByteSource(inputFile).asCharSource(charset).readLines(); }
static Iterable<String> function(Path inputFile, Charset charset) throws IOException { return asByteSource(inputFile).asCharSource(charset).readLines(); }
/** * Returns an iterable that allows iterating over text file contents line by line in the given * {@link Charset}. If the file ends in a line break, the iterator will return an empty string * as the last element. * * @throws IOException if there was an error */
Returns an iterable that allows iterating over text file contents line by line in the given <code>Charset</code>. If the file ends in a line break, the iterator will return an empty string as the last element
readLines
{ "repo_name": "hermione521/bazel", "path": "src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java", "license": "apache-2.0", "size": 38471 }
[ "java.io.IOException", "java.nio.charset.Charset" ]
import java.io.IOException; import java.nio.charset.Charset;
import java.io.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
238,131
private PointData createPointFigure(ROIShape shape) throws ParsingException { MeasurePointFigure fig = (MeasurePointFigure)shape.getFigure(); double cx = fig.getCentre().getX(); double cy = fig.getCentre().getY(); PointData point = new PointData(cx, cy); point.setVisible(fig.isVisible()); String text = fig.getText(); if (text != null && text.trim().length() > 0 && !text.equals(ROIFigure.DEFAULT_TEXT)) point.setText(fig.getText()); AffineTransform t = AttributeKeys.TRANSFORM.get(fig); if (t != null) point.setTransform(toTransform(t)); return point; }
PointData function(ROIShape shape) throws ParsingException { MeasurePointFigure fig = (MeasurePointFigure)shape.getFigure(); double cx = fig.getCentre().getX(); double cy = fig.getCentre().getY(); PointData point = new PointData(cx, cy); point.setVisible(fig.isVisible()); String text = fig.getText(); if (text != null && text.trim().length() > 0 && !text.equals(ROIFigure.DEFAULT_TEXT)) point.setText(fig.getText()); AffineTransform t = AttributeKeys.TRANSFORM.get(fig); if (t != null) point.setTransform(toTransform(t)); return point; }
/** * Creates a Bezier figure server side object from a MeasurePointFigure * client side object. * * @param shape See above. * @return See above. * @throws ParsingException If an error occurred while parsing. */
Creates a Bezier figure server side object from a MeasurePointFigure client side object
createPointFigure
{ "repo_name": "rleigh-dundee/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/util/roi/io/OutputServerStrategy.java", "license": "gpl-2.0", "size": 22578 }
[ "java.awt.geom.AffineTransform", "org.jhotdraw.draw.AttributeKeys", "org.openmicroscopy.shoola.util.roi.exception.ParsingException", "org.openmicroscopy.shoola.util.roi.figures.MeasurePointFigure", "org.openmicroscopy.shoola.util.roi.figures.ROIFigure", "org.openmicroscopy.shoola.util.roi.model.ROIShape" ]
import java.awt.geom.AffineTransform; import org.jhotdraw.draw.AttributeKeys; import org.openmicroscopy.shoola.util.roi.exception.ParsingException; import org.openmicroscopy.shoola.util.roi.figures.MeasurePointFigure; import org.openmicroscopy.shoola.util.roi.figures.ROIFigure; import org.openmicroscopy.shoola.util.roi.model.ROIShape;
import java.awt.geom.*; import org.jhotdraw.draw.*; import org.openmicroscopy.shoola.util.roi.exception.*; import org.openmicroscopy.shoola.util.roi.figures.*; import org.openmicroscopy.shoola.util.roi.model.*;
[ "java.awt", "org.jhotdraw.draw", "org.openmicroscopy.shoola" ]
java.awt; org.jhotdraw.draw; org.openmicroscopy.shoola;
1,542,526
try (ChronicleMap<Integer, Boolean> map = ChronicleMap.of(Integer.class, Boolean.class) .entries(1).create()) { map.put(7, true); Assert.assertEquals(true, map.get(7)); } }
try (ChronicleMap<Integer, Boolean> map = ChronicleMap.of(Integer.class, Boolean.class) .entries(1).create()) { map.put(7, true); Assert.assertEquals(true, map.get(7)); } }
/** * see issue http://stackoverflow.com/questions/26219313/strange-npe-from-chronicle-map-toy-code */
see issue HREF
testTestBooleanValues
{ "repo_name": "lburgazzoli/Chronicle-Map", "path": "src/test/java/net/openhft/chronicle/map/BooleanValuesTest.java", "license": "lgpl-3.0", "size": 1361 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,976,237
@Beta public void authenticateUsing(Credentials credentials) { this.setCredentials(credentials); this.accept(); } } public enum When { BEFORE, AFTER, EXCEPTION }
void function(Credentials credentials) { this.setCredentials(credentials); this.accept(); } } public enum When { BEFORE, AFTER, EXCEPTION }
/** * Authenticate an HTTP Basic Auth dialog. * Implicitly 'clicks ok' * * Usage: driver.switchTo().alert().authenticateUsing(new UsernamePasswordCredentials("cheese", * "secretGouda")); * @param credentials credentials to pass to Auth prompt */
Authenticate an HTTP Basic Auth dialog. Implicitly 'clicks ok' Usage: driver.switchTo().alert().authenticateUsing(new UsernamePasswordCredentials("cheese", "secretGouda"))
authenticateUsing
{ "repo_name": "sankha93/selenium", "path": "java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java", "license": "apache-2.0", "size": 34166 }
[ "org.openqa.selenium.security.Credentials" ]
import org.openqa.selenium.security.Credentials;
import org.openqa.selenium.security.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
2,076,888
private void attemptDrawShapesSelection() { this.drawShapes = BooleanUtilities.valueOf( this.drawShapesCheckBox.isSelected() ); }
void function() { this.drawShapes = BooleanUtilities.valueOf( this.drawShapesCheckBox.isSelected() ); }
/** * Allow the user to modify whether or not shapes are drawn at data points * by <tt>LineAndShapeRenderer</tt>s and <tt>StandardXYItemRenderer</tt>s. */
Allow the user to modify whether or not shapes are drawn at data points by LineAndShapeRenderers and StandardXYItemRenderers
attemptDrawShapesSelection
{ "repo_name": "raedle/univis", "path": "lib/jfreechart-1.0.1/src/org/jfree/chart/editor/DefaultPlotEditor.java", "license": "lgpl-2.1", "size": 23922 }
[ "org.jfree.util.BooleanUtilities" ]
import org.jfree.util.BooleanUtilities;
import org.jfree.util.*;
[ "org.jfree.util" ]
org.jfree.util;
2,714,403
void remove(K key, V value, Consumer<CompletableFuture<Entry<K, V>>> onRemoval) { CompletableFuture<Entry<K, V>> future; boolean removed = false; try (ReleasableLock ignored = writeLock.acquire()) { future = map.get(key); try { if (future != null) { if (future.isDone()) { Entry<K, V> entry = future.get(); if (Objects.equals(value, entry.value)) { removed = map.remove(key, future); } } } } catch (ExecutionException | InterruptedException e) { throw new IllegalStateException(e); } } if (future != null && removed) { segmentStats.eviction(); onRemoval.accept(future); } } private static class SegmentStats { private final LongAdder hits = new LongAdder(); private final LongAdder misses = new LongAdder(); private final LongAdder evictions = new LongAdder();
void remove(K key, V value, Consumer<CompletableFuture<Entry<K, V>>> onRemoval) { CompletableFuture<Entry<K, V>> future; boolean removed = false; try (ReleasableLock ignored = writeLock.acquire()) { future = map.get(key); try { if (future != null) { if (future.isDone()) { Entry<K, V> entry = future.get(); if (Objects.equals(value, entry.value)) { removed = map.remove(key, future); } } } } catch (ExecutionException InterruptedException e) { throw new IllegalStateException(e); } } if (future != null && removed) { segmentStats.eviction(); onRemoval.accept(future); } } private static class SegmentStats { private final LongAdder hits = new LongAdder(); private final LongAdder misses = new LongAdder(); private final LongAdder evictions = new LongAdder();
/** * remove an entry from the segment iff the future is done and the value is equal to the * expected value * * @param key the key of the entry to remove from the cache * @param value the value expected to be associated with the key * @param onRemoval a callback for the removed entry */
remove an entry from the segment iff the future is done and the value is equal to the expected value
remove
{ "repo_name": "strapdata/elassandra", "path": "server/src/main/java/org/elasticsearch/common/cache/Cache.java", "license": "apache-2.0", "size": 31030 }
[ "java.util.Objects", "java.util.concurrent.CompletableFuture", "java.util.concurrent.ExecutionException", "java.util.concurrent.atomic.LongAdder", "java.util.function.Consumer", "org.elasticsearch.common.util.concurrent.ReleasableLock" ]
import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.LongAdder; import java.util.function.Consumer; import org.elasticsearch.common.util.concurrent.ReleasableLock;
import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.function.*; import org.elasticsearch.common.util.concurrent.*;
[ "java.util", "org.elasticsearch.common" ]
java.util; org.elasticsearch.common;
1,227,711
@ApiModelProperty(example = "null", value = "Inform that the process allow IPI credit to Input process") public Boolean getAllowIPIcreditWhenInGoing() { return allowIPIcreditWhenInGoing; }
@ApiModelProperty(example = "null", value = STR) Boolean function() { return allowIPIcreditWhenInGoing; }
/** * Inform that the process allow IPI credit to Input process * @return allowIPIcreditWhenInGoing **/
Inform that the process allow IPI credit to Input process
getAllowIPIcreditWhenInGoing
{ "repo_name": "Avalara/avataxbr-clients", "path": "java-client/src/main/java/io/swagger/client/model/ProcessScenario.java", "license": "gpl-3.0", "size": 23116 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,573,898
private static void checkVertexInput(JythonJob.VertexInput vertexInput) { checkNotNull(vertexInput.getTable(), "VertexInput table name needs to be set"); checkNotNull(vertexInput.getId_column(), "VertexInput ID column needs to be set"); }
static void function(JythonJob.VertexInput vertexInput) { checkNotNull(vertexInput.getTable(), STR); checkNotNull(vertexInput.getId_column(), STR); }
/** * Check that the vertex input info is valid * * @param vertexInput data to check */
Check that the vertex input info is valid
checkVertexInput
{ "repo_name": "korsvanloon/giraph", "path": "giraph-hive/src/main/java/org/apache/giraph/hive/jython/HiveJythonUtils.java", "license": "apache-2.0", "size": 33834 }
[ "com.google.common.base.Preconditions", "org.apache.giraph.jython.JythonJob" ]
import com.google.common.base.Preconditions; import org.apache.giraph.jython.JythonJob;
import com.google.common.base.*; import org.apache.giraph.jython.*;
[ "com.google.common", "org.apache.giraph" ]
com.google.common; org.apache.giraph;
1,541,189
public String[] getSheetNames() throws BiffException, IOException, InvalidFormatException { if (getFile().getAbsolutePath().endsWith(".xlsx")) { // excel 2007 file if (workbookPOI == null) { createWorkbookPOI(); } String[] sheetNames = new String[getNumberOfSheets()]; for (int i = 0; i < getNumberOfSheets(); i++) { sheetNames[i] = workbookPOI.getSheetName(i); } return sheetNames; } else { // excel pre 2007 file if (workbookJXL == null) { createWorkbookJXL(); } return workbookJXL.getSheetNames(); } }
String[] function() throws BiffException, IOException, InvalidFormatException { if (getFile().getAbsolutePath().endsWith(".xlsx")) { if (workbookPOI == null) { createWorkbookPOI(); } String[] sheetNames = new String[getNumberOfSheets()]; for (int i = 0; i < getNumberOfSheets(); i++) { sheetNames[i] = workbookPOI.getSheetName(i); } return sheetNames; } else { if (workbookJXL == null) { createWorkbookJXL(); } return workbookJXL.getSheetNames(); } }
/** * Returns the names of all sheets in the excel file * @return * @throws IOException * @throws BiffException * @throws InvalidFormatException */
Returns the names of all sheets in the excel file
getSheetNames
{ "repo_name": "aborg0/RapidMiner-Unuk", "path": "src/com/rapidminer/operator/nio/model/ExcelResultSetConfiguration.java", "license": "agpl-3.0", "size": 15306 }
[ "java.io.IOException", "org.apache.poi.openxml4j.exceptions.InvalidFormatException" ]
import java.io.IOException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import java.io.*; import org.apache.poi.openxml4j.exceptions.*;
[ "java.io", "org.apache.poi" ]
java.io; org.apache.poi;
2,711,378
public Observable<ServiceResponse<Product>> validationOfBodyWithServiceResponseAsync(String resourceGroupName, int id) { if (this.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (this.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<Product>> function(String resourceGroupName, int id) { if (this.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (this.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Validates body parameters on the method. See swagger for details. * * @param resourceGroupName Required string between 3 and 10 chars with pattern [a-zA-Z0-9]+. * @param id Required int multiple of 10 from 100 to 1000. * @return the observable to the Product object */
Validates body parameters on the method. See swagger for details
validationOfBodyWithServiceResponseAsync
{ "repo_name": "tbombach/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/validation/implementation/AutoRestValidationTestImpl.java", "license": "mit", "size": 25390 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,525,035
public static File getGlobalPersistentDir(Configuration conf) { File pers = getRootDir(conf); pers = new File(pers, "persistent"); if (!pers.exists()) { if (pers.mkdirs()) { log.debug("Created globally persistent storage data dir '" + pers + "'"); } } log.trace("Calculated storage persistent dir '" + pers + "'"); return pers; }
static File function(Configuration conf) { File pers = getRootDir(conf); pers = new File(pers, STR); if (!pers.exists()) { if (pers.mkdirs()) { log.debug(STR + pers + "'"); } } log.trace(STR + pers + "'"); return pers; }
/** * <p>Get the location to store globally persistent data. Here 'global' * is in the sense that it should be shared among different instances * of the same bundle.</p> * <p/> * <p>The location of the persistent dir is calculated as * {@code getRootDir()/persistent}</p> * <p/> * <p>The persistent directory will be created it needed</p> * * @param conf the configuration used to look up * @return a {@link File} object pointing to the requested directory */
Get the location to store globally persistent data. Here 'global' is in the sense that it should be shared among different instances of the same bundle. The location of the persistent dir is calculated as getRootDir()/persistent The persistent directory will be created it needed
getGlobalPersistentDir
{ "repo_name": "statsbiblioteket/summa", "path": "Core/src/main/java/dk/statsbiblioteket/summa/storage/StorageUtils.java", "license": "apache-2.0", "size": 3173 }
[ "dk.statsbiblioteket.summa.common.configuration.Configuration", "java.io.File" ]
import dk.statsbiblioteket.summa.common.configuration.Configuration; import java.io.File;
import dk.statsbiblioteket.summa.common.configuration.*; import java.io.*;
[ "dk.statsbiblioteket.summa", "java.io" ]
dk.statsbiblioteket.summa; java.io;
241,514
public static void main(String[] args) throws FileNotFoundException, IOException { for (File f : listProperties()) { System.out.println("->" + f); String contents = readProperty(f); try (FileOutputStream out = new FileOutputStream(f)) { out.write(contents.getBytes("utf-8")); } } }
static void function(String[] args) throws FileNotFoundException, IOException { for (File f : listProperties()) { System.out.println("->" + f); String contents = readProperty(f); try (FileOutputStream out = new FileOutputStream(f)) { out.write(contents.getBytes("utf-8")); } } }
/** * Convert encoding * * @param args * @throws IOException * @throws FileNotFoundException */
Convert encoding
main
{ "repo_name": "andreas-eberle/settlers-remake", "path": "jsettlers.tools/src/main/java/jsettlers/dev/helper/translation/ConvertPropertiesToUtf8.java", "license": "mit", "size": 2494 }
[ "java.io.File", "java.io.FileNotFoundException", "java.io.FileOutputStream", "java.io.IOException" ]
import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,532,670
@Override public Double exec(Tuple input) throws IOException { if (input == null || input.size() == 0) return null; try { Object objGeometry = input.get(0); Geometry geometry = _geometryParser.parseGeometry(objGeometry); Geometry ssRect = SmallestSurroundingRectangle.get(geometry); Coordinate[] coords = ssRect.getCoordinates(); double lg1 = coords[0].distance(coords[1]); double lg2 = coords[1].distance(coords[2]); if (lg1>lg2) return lg1/lg2; else return lg2/lg1; } catch (Exception e) { throw new IOException("Caught exception processing input row ", e); } }
Double function(Tuple input) throws IOException { if (input == null input.size() == 0) return null; try { Object objGeometry = input.get(0); Geometry geometry = _geometryParser.parseGeometry(objGeometry); Geometry ssRect = SmallestSurroundingRectangle.get(geometry); Coordinate[] coords = ssRect.getCoordinates(); double lg1 = coords[0].distance(coords[1]); double lg2 = coords[1].distance(coords[2]); if (lg1>lg2) return lg1/lg2; else return lg2/lg1; } catch (Exception e) { throw new IOException(STR, e); } }
/** * Method invoked on every tuple during foreach evaluation. * @param input tuple<br> * first column is assumed to have a geometry * @exception java.io.IOException * @return length width ratio of the geometry */
Method invoked on every tuple during foreach evaluation
exec
{ "repo_name": "prashant003/interimage-2", "path": "interimage-geometry/src/main/java/br/puc_rio/ele/lvc/interimage/geometry/udf/LengthWidthRatio.java", "license": "apache-2.0", "size": 2546 }
[ "br.puc_rio.ele.lvc.interimage.geometry.SmallestSurroundingRectangle", "com.vividsolutions.jts.geom.Coordinate", "com.vividsolutions.jts.geom.Geometry", "java.io.IOException", "org.apache.pig.data.Tuple" ]
import br.puc_rio.ele.lvc.interimage.geometry.SmallestSurroundingRectangle; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import java.io.IOException; import org.apache.pig.data.Tuple;
import br.puc_rio.ele.lvc.interimage.geometry.*; import com.vividsolutions.jts.geom.*; import java.io.*; import org.apache.pig.data.*;
[ "br.puc_rio.ele", "com.vividsolutions.jts", "java.io", "org.apache.pig" ]
br.puc_rio.ele; com.vividsolutions.jts; java.io; org.apache.pig;
384,694
public void setPayrollTotalHours(BigDecimal payrollTotalHours);
void function(BigDecimal payrollTotalHours);
/** * Sets the payrollTotalHours * * @param payrollTotalHours The payrollTotalHours to set. */
Sets the payrollTotalHours
setPayrollTotalHours
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/integration/ld/LaborLedgerExpenseTransferAccountingLine.java", "license": "agpl-3.0", "size": 3401 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
2,136,133
public Collection<? extends SearchTreeNode> getChildren();
Collection<? extends SearchTreeNode> function();
/** * The children of this node. * @return The children of this node. */
The children of this node
getChildren
{ "repo_name": "eschwert/DL-Learner", "path": "components-core/src/main/java/org/dllearner/utilities/datastructures/SearchTreeNode.java", "license": "gpl-3.0", "size": 1319 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
68,058
public static Exchange copyExchangeAndSetCamelContext(Exchange exchange, CamelContext context, boolean handover) { DefaultExchange answer = new DefaultExchange(context, exchange.getPattern()); if (exchange.hasProperties()) { answer.setProperties(safeCopyProperties(exchange.getProperties())); } if (handover) { // Need to hand over the completion for async invocation exchange.handoverCompletions(answer); } answer.setIn(exchange.getIn().copy()); if (exchange.hasOut()) { answer.setOut(exchange.getOut().copy()); } answer.setException(exchange.getException()); return answer; }
static Exchange function(Exchange exchange, CamelContext context, boolean handover) { DefaultExchange answer = new DefaultExchange(context, exchange.getPattern()); if (exchange.hasProperties()) { answer.setProperties(safeCopyProperties(exchange.getProperties())); } if (handover) { exchange.handoverCompletions(answer); } answer.setIn(exchange.getIn().copy()); if (exchange.hasOut()) { answer.setOut(exchange.getOut().copy()); } answer.setException(exchange.getException()); return answer; }
/** * Copies the exchange but the copy will be tied to the given context * * @param exchange the source exchange * @param context the camel context * @param handover whether to handover on completions from the source to the copy * @return a copy with the given camel context */
Copies the exchange but the copy will be tied to the given context
copyExchangeAndSetCamelContext
{ "repo_name": "davidkarlsen/camel", "path": "core/camel-support/src/main/java/org/apache/camel/support/ExchangeHelper.java", "license": "apache-2.0", "size": 41703 }
[ "org.apache.camel.CamelContext", "org.apache.camel.Exchange" ]
import org.apache.camel.CamelContext; import org.apache.camel.Exchange;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
485,683
private JPanel getContentPanel() { if (contentPanel == null) { GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.gridx = 1; gridBagConstraints21.fill = GridBagConstraints.BOTH; gridBagConstraints21.gridy = 3; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.ipadx = 6; gridBagConstraints11.ipady = 7; gridBagConstraints11.gridy = 3; colorLabel = new JLabel(); colorLabel.setText("Color:"); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.gridy = 0; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.gridx = 1; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.ipadx = 6; gridBagConstraints.ipady = 7; gridBagConstraints.gridy = 0; nameLabel = new JLabel(); nameLabel.setText("Name:"); nameLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); contentPanel = new JPanel(); contentPanel.setLayout(new GridBagLayout()); contentPanel.add(nameLabel, gridBagConstraints); contentPanel.add(colorLabel, gridBagConstraints11); contentPanel.add(getNameTextField(), gridBagConstraints3); contentPanel.add(getColorPanel(), gridBagConstraints21); } return contentPanel; }
JPanel function() { if (contentPanel == null) { GridBagConstraints gridBagConstraints21 = new GridBagConstraints(); gridBagConstraints21.gridx = 1; gridBagConstraints21.fill = GridBagConstraints.BOTH; gridBagConstraints21.gridy = 3; GridBagConstraints gridBagConstraints11 = new GridBagConstraints(); gridBagConstraints11.gridx = 0; gridBagConstraints11.ipadx = 6; gridBagConstraints11.ipady = 7; gridBagConstraints11.gridy = 3; colorLabel = new JLabel(); colorLabel.setText(STR); GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.fill = GridBagConstraints.BOTH; gridBagConstraints3.gridy = 0; gridBagConstraints3.weightx = 1.0; gridBagConstraints3.gridx = 1; GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.ipadx = 6; gridBagConstraints.ipady = 7; gridBagConstraints.gridy = 0; nameLabel = new JLabel(); nameLabel.setText("Name:"); nameLabel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); contentPanel = new JPanel(); contentPanel.setLayout(new GridBagLayout()); contentPanel.add(nameLabel, gridBagConstraints); contentPanel.add(colorLabel, gridBagConstraints11); contentPanel.add(getNameTextField(), gridBagConstraints3); contentPanel.add(getColorPanel(), gridBagConstraints21); } return contentPanel; }
/** * This method initializes contentPanel * * @return javax.swing.JPanel */
This method initializes contentPanel
getContentPanel
{ "repo_name": "gilles-fabre/ezRPC", "path": "LogReporter/LogReporterTool/com/reporter/ProgDefinitionDialogVE.java", "license": "lgpl-3.0", "size": 5041 }
[ "java.awt.Cursor", "java.awt.GridBagConstraints", "java.awt.GridBagLayout", "javax.swing.JLabel", "javax.swing.JPanel" ]
import java.awt.Cursor; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JLabel; import javax.swing.JPanel;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,198,300
private void writeOut(int item, int[]prefix, int support) throws IOException{ // increase the number of itemsets found frequentCount++; // create a string uffer StringBuffer buffer = new StringBuffer(); // add the item buffer.append(item); buffer.append(" "); // next add all other items from the itemset for (int i = 0; i < prefix.length; i++) { buffer.append(prefix[i]); if (i != prefix.length - 1) { buffer.append(' '); } } //Finally, write the support. buffer.append(" #SUP: "); buffer.append(support); writer.write(buffer.toString()); writer.newLine(); // create new line to be ready for next itemset }
void function(int item, int[]prefix, int support) throws IOException{ frequentCount++; StringBuffer buffer = new StringBuffer(); buffer.append(item); buffer.append(" "); for (int i = 0; i < prefix.length; i++) { buffer.append(prefix[i]); if (i != prefix.length - 1) { buffer.append(' '); } } buffer.append(STR); buffer.append(support); writer.write(buffer.toString()); writer.newLine(); }
/** * Write a frequent itemset to the output file. * @param prefix the itemset * @param item an item that should be appended to the itemset * @param support the support of the itemset with the item * @throws IOException exception if error while writing to the output file. */
Write a frequent itemset to the output file
writeOut
{ "repo_name": "YinYanfei/CadalWorkspace", "path": "ca/pfv/spmf/algorithms/frequentpatterns/relim/AlgoRelim.java", "license": "gpl-3.0", "size": 12150 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,129,054
public static void renderFaceYNeg(RenderBlocks renderBlocks, double x, double y, double z, IIcon icon) { prepareRender(renderBlocks, ForgeDirection.DOWN, x, y, z, icon); setupVertex(renderBlocks, xMin, yMin, zMax, uTR, vTR, SOUTHWEST); setupVertex(renderBlocks, xMin, yMin, zMin, uBR, vBR, NORTHWEST); setupVertex(renderBlocks, xMax, yMin, zMin, uBL, vBL, NORTHEAST); setupVertex(renderBlocks, xMax, yMin, zMax, uTL, vTL, SOUTHEAST); }
static void function(RenderBlocks renderBlocks, double x, double y, double z, IIcon icon) { prepareRender(renderBlocks, ForgeDirection.DOWN, x, y, z, icon); setupVertex(renderBlocks, xMin, yMin, zMax, uTR, vTR, SOUTHWEST); setupVertex(renderBlocks, xMin, yMin, zMin, uBR, vBR, NORTHWEST); setupVertex(renderBlocks, xMax, yMin, zMin, uBL, vBL, NORTHEAST); setupVertex(renderBlocks, xMax, yMin, zMax, uTL, vTL, SOUTHEAST); }
/** * Renders the given texture to the bottom face of the block. Args: slope, x, y, z, texture */
Renders the given texture to the bottom face of the block. Args: slope, x, y, z, texture
renderFaceYNeg
{ "repo_name": "Techern/carpentersblocks", "path": "src/main/java/com/carpentersblocks/renderer/helper/RenderHelper.java", "license": "lgpl-2.1", "size": 21916 }
[ "net.minecraft.client.renderer.RenderBlocks", "net.minecraft.util.IIcon", "net.minecraftforge.common.util.ForgeDirection" ]
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.client.renderer.*; import net.minecraft.util.*; import net.minecraftforge.common.util.*;
[ "net.minecraft.client", "net.minecraft.util", "net.minecraftforge.common" ]
net.minecraft.client; net.minecraft.util; net.minecraftforge.common;
2,672,038
public List<ReplicationLinkInner> listReplicationLinks(String resourceGroupName, String serverName, String databaseName) { return listReplicationLinksWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
List<ReplicationLinkInner> function(String resourceGroupName, String serverName, String databaseName) { return listReplicationLinksWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
/** * Gets information about Azure SQL database replication links. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. * @param serverName The name of the Azure SQL server. * @param databaseName The name of the Azure SQL database to retrieve links for. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws CloudException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the List&lt;ReplicationLinkInner&gt; object if successful. */
Gets information about Azure SQL database replication links
listReplicationLinks
{ "repo_name": "anudeepsharma/azure-sdk-for-java", "path": "azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/implementation/DatabasesInner.java", "license": "mit", "size": 166183 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,326,652
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { Map<Class<?>, CurrentInstance> old = CurrentInstance.setCurrent(this); try { stream.defaultReadObject(); pendingAccessQueue = new ConcurrentLinkedQueue<>(); } finally { CurrentInstance.restoreInstances(old); } }
void function(ObjectInputStream stream) throws IOException, ClassNotFoundException { Map<Class<?>, CurrentInstance> old = CurrentInstance.setCurrent(this); try { stream.defaultReadObject(); pendingAccessQueue = new ConcurrentLinkedQueue<>(); } finally { CurrentInstance.restoreInstances(old); } }
/** * Override default deserialization logic to account for transient * {@link #pendingAccessQueue}. */
Override default deserialization logic to account for transient <code>#pendingAccessQueue</code>
readObject
{ "repo_name": "kironapublic/vaadin", "path": "server/src/main/java/com/vaadin/server/VaadinSession.java", "license": "apache-2.0", "size": 50910 }
[ "com.vaadin.util.CurrentInstance", "java.io.IOException", "java.io.ObjectInputStream", "java.util.Map", "java.util.concurrent.ConcurrentLinkedQueue" ]
import com.vaadin.util.CurrentInstance; import java.io.IOException; import java.io.ObjectInputStream; import java.util.Map; import java.util.concurrent.ConcurrentLinkedQueue;
import com.vaadin.util.*; import java.io.*; import java.util.*; import java.util.concurrent.*;
[ "com.vaadin.util", "java.io", "java.util" ]
com.vaadin.util; java.io; java.util;
1,818,205
public JSONObject put(String key, Collection value) throws JSONException { put(key, new JSONArray(value)); return this; }
JSONObject function(String key, Collection value) throws JSONException { put(key, new JSONArray(value)); return this; }
/** * Put a key/value pair in the JSONObject, where the value will be a * JSONArray which is produced from a Collection. * @param key A key string. * @param value A Collection value. * @return this. * @throws JSONException */
Put a key/value pair in the JSONObject, where the value will be a JSONArray which is produced from a Collection
put
{ "repo_name": "grtlinux/KIEA_JAVA7", "path": "KIEA_JAVA7/src/tain/kr/com/github/json/orgJson/v01/JSONObject.java", "license": "gpl-3.0", "size": 55937 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
864,098
public void showError(int i) { this.textCharDecrypted[i].setBorder(BorderFactory.createLineBorder(Color.red, 5)); this.textCharDecrypted[i].setText(""); this.errorMessage.setVisible(true); }
void function(int i) { this.textCharDecrypted[i].setBorder(BorderFactory.createLineBorder(Color.red, 5)); this.textCharDecrypted[i].setText(""); this.errorMessage.setVisible(true); }
/** * shows error message and highlights the texfield * @param i highlights the texfield */
shows error message and highlights the texfield
showError
{ "repo_name": "matthiasplappert/Cryptographics", "path": "cg_implementierung/src/edu/kit/iks/Cryptographics/Vigenere/Experiment/FirstExperimentView.java", "license": "mit", "size": 12260 }
[ "java.awt.Color", "javax.swing.BorderFactory" ]
import java.awt.Color; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,542,250
private void refillBuffer(int n) throws IOException { if (!tryRefillBuffer(n)) { throw InvalidProtocolBufferException.truncatedMessage(); } } /** * Tries to read more bytes from the input, making at least {@code n} bytes * available in the buffer. Caller must ensure that the requested space is * not yet available, and that the requested space is less than BUFFER_SIZE. * * @return {@code true} if the bytes could be made available; {@code false}
void function(int n) throws IOException { if (!tryRefillBuffer(n)) { throw InvalidProtocolBufferException.truncatedMessage(); } } /** * Tries to read more bytes from the input, making at least {@code n} bytes * available in the buffer. Caller must ensure that the requested space is * not yet available, and that the requested space is less than BUFFER_SIZE. * * @return {@code true} if the bytes could be made available; {@code false}
/** * Reads more bytes from the input, making at least {@code n} bytes available * in the buffer. Caller must ensure that the requested space is not yet * available, and that the requested space is less than BUFFER_SIZE. * * @throws InvalidProtocolBufferException The end of the stream or the current * limit was reached. */
Reads more bytes from the input, making at least n bytes available in the buffer. Caller must ensure that the requested space is not yet available, and that the requested space is less than BUFFER_SIZE
refillBuffer
{ "repo_name": "danakj/chromium", "path": "third_party/protobuf/java/core/src/main/java/com/google/protobuf/CodedInputStream.java", "license": "bsd-3-clause", "size": 44963 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,561,113
public static <E> Set<E> emptySet() { return Collections.<E>emptySet(); }
static <E> Set<E> function() { return Collections.<E>emptySet(); }
/** * Get a typed empty unmodifiable Set. * @param <E> the element type * @return an empty Set */
Get a typed empty unmodifiable Set
emptySet
{ "repo_name": "apache/commons-collections", "path": "src/main/java/org/apache/commons/collections4/SetUtils.java", "license": "apache-2.0", "size": 24909 }
[ "java.util.Collections", "java.util.Set" ]
import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,515,441
public GridUI getUI() { return (GridUI)ui; }
GridUI function() { return (GridUI)ui; }
/** * Returns the UI-Class for this JComponent. This is always a GridUI * * @return the UIClass * * @since 0.1 */
Returns the UI-Class for this JComponent. This is always a GridUI
getUI
{ "repo_name": "cismet/jGrid", "path": "src/main/java/com/guigarage/jgrid/JGrid.java", "license": "apache-2.0", "size": 29546 }
[ "com.guigarage.jgrid.ui.GridUI" ]
import com.guigarage.jgrid.ui.GridUI;
import com.guigarage.jgrid.ui.*;
[ "com.guigarage.jgrid" ]
com.guigarage.jgrid;
1,722,503
@Override public void init(IEditorSite site, IEditorInput editorInput) { setSite(site); setInputWithNotify(editorInput); setPartName(editorInput.getName()); site.setSelectionProvider(this); site.getPage().addPartListener(partListener); ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); }
void function(IEditorSite site, IEditorInput editorInput) { setSite(site); setInputWithNotify(editorInput); setPartName(editorInput.getName()); site.setSelectionProvider(this); site.getPage().addPartListener(partListener); ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE); }
/** * This is called during startup. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This is called during startup.
init
{ "repo_name": "occiware/Multi-Cloud-Studio", "path": "plugins/org.eclipse.cmf.occi.multicloud.elasticocci.editor/src-gen/org/eclipse/cmf/occi/multicloud/elasticocci/presentation/ElasticocciEditor.java", "license": "epl-1.0", "size": 55123 }
[ "org.eclipse.core.resources.IResourceChangeEvent", "org.eclipse.core.resources.ResourcesPlugin", "org.eclipse.ui.IEditorInput", "org.eclipse.ui.IEditorSite" ]
import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorSite;
import org.eclipse.core.resources.*; import org.eclipse.ui.*;
[ "org.eclipse.core", "org.eclipse.ui" ]
org.eclipse.core; org.eclipse.ui;
1,963,051
interface WithGitHubAccessToken<ParentT> { GitHubWithAttach<ParentT> withGitHubAccessToken(String personalAccessToken); } interface WithAttach<ParentT> extends Attachable.InUpdate<ParentT> { } interface GitHubWithAttach<ParentT> extends WithAttach<ParentT>, WithGitHubAccessToken<ParentT> { } }
interface WithGitHubAccessToken<ParentT> { GitHubWithAttach<ParentT> withGitHubAccessToken(String personalAccessToken); } interface WithAttach<ParentT> extends Attachable.InUpdate<ParentT> { } interface GitHubWithAttach<ParentT> extends WithAttach<ParentT>, WithGitHubAccessToken<ParentT> { } }
/** * Specifies the GitHub personal access token. You can acquire one from * https://github.com/settings/tokens. * @param personalAccessToken the personal access token from GitHub. * @return the next stage of the definition */
Specifies the GitHub personal access token. You can acquire one from HREF
withGitHubAccessToken
{ "repo_name": "jianghaolu/azure-sdk-for-java", "path": "azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/WebAppSourceControl.java", "license": "mit", "size": 13753 }
[ "com.microsoft.azure.management.resources.fluentcore.model.Attachable" ]
import com.microsoft.azure.management.resources.fluentcore.model.Attachable;
import com.microsoft.azure.management.resources.fluentcore.model.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,891,396
public IdentityProvider getIDPbyResourceId(Connection dbConnection, String resourceId, int tenantId, String tenantDomain) throws IdentityProviderManagementException { return getIDP(dbConnection, null, -1, resourceId, tenantId, tenantDomain); }
IdentityProvider function(Connection dbConnection, String resourceId, int tenantId, String tenantDomain) throws IdentityProviderManagementException { return getIDP(dbConnection, null, -1, resourceId, tenantId, tenantDomain); }
/** * Retrieves an IDP by it's ID. * * @param dbConnection Database Connection. * @param resourceId Identity Provider Resource ID. * @param tenantId Tenant ID of the IDP. * @param tenantDomain Tenant Domain of the IDP. * @return An Identity Provider with given name. * @throws IdentityProviderManagementException IdentityProviderManagementException */
Retrieves an IDP by it's ID
getIDPbyResourceId
{ "repo_name": "omindu/carbon-identity-framework", "path": "components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java", "license": "apache-2.0", "size": 199040 }
[ "java.sql.Connection", "org.wso2.carbon.identity.application.common.model.IdentityProvider", "org.wso2.carbon.idp.mgt.IdentityProviderManagementException" ]
import java.sql.Connection; import org.wso2.carbon.identity.application.common.model.IdentityProvider; import org.wso2.carbon.idp.mgt.IdentityProviderManagementException;
import java.sql.*; import org.wso2.carbon.identity.application.common.model.*; import org.wso2.carbon.idp.mgt.*;
[ "java.sql", "org.wso2.carbon" ]
java.sql; org.wso2.carbon;
90,887
public void draw() { player.draw(); for (Enemy e : enemies) e.draw(); for (Bullet b : playerBullets) b.draw(); for (Bullet b : enemyBullets) b.draw(); player.drawFocus(); }
void function() { player.draw(); for (Enemy e : enemies) e.draw(); for (Bullet b : playerBullets) b.draw(); for (Bullet b : enemyBullets) b.draw(); player.drawFocus(); }
/** * Draws the stage */
Draws the stage
draw
{ "repo_name": "HarZe/java-danmaku-engine", "path": "JDE/src/com/jde/model/stage/Stage.java", "license": "gpl-3.0", "size": 9134 }
[ "com.jde.model.entity.bullet.Bullet", "com.jde.model.entity.enemy.Enemy" ]
import com.jde.model.entity.bullet.Bullet; import com.jde.model.entity.enemy.Enemy;
import com.jde.model.entity.bullet.*; import com.jde.model.entity.enemy.*;
[ "com.jde.model" ]
com.jde.model;
541,879
protected FileInfo buildExpectedStructure() throws FileSystemException { // Build the expected structure final FileInfo base = new FileInfo(getReadFolder().getName().getBaseName(), FileType.FOLDER); base.addFile("file1.txt", FILE1_CONTENT); // file%.txt - test out encoding base.addFile("file%25.txt", FILE1_CONTENT); // file?test.txt - test out encoding (test.txt is not the queryString) // as we do not know if the current file provider we need to // ask it to normalize the name // todo: move this into the FileInfo class to do it generally? base.addFile("file space.txt", FILE1_CONTENT); base.addFile("empty.txt", ""); if (addEmptyDir) { base.addFolder("emptydir"); } final FileInfo dir = base.addFolder("dir1"); dir.addFile("file1.txt", TEST_FILE_CONTENT); dir.addFile("file2.txt", TEST_FILE_CONTENT); dir.addFile("file3.txt", TEST_FILE_CONTENT); final FileInfo subdir1 = dir.addFolder("subdir1"); subdir1.addFile("file1.txt", TEST_FILE_CONTENT); subdir1.addFile("file2.txt", TEST_FILE_CONTENT); subdir1.addFile("file3.txt", TEST_FILE_CONTENT); final FileInfo subdir2 = dir.addFolder("subdir2"); subdir2.addFile("file1.txt", TEST_FILE_CONTENT); subdir2.addFile("file2.txt", TEST_FILE_CONTENT); subdir2.addFile("file3.txt", TEST_FILE_CONTENT); final FileInfo subdir3 = dir.addFolder("subdir3"); subdir3.addFile("file1.txt", TEST_FILE_CONTENT); subdir3.addFile("file2.txt", TEST_FILE_CONTENT); subdir3.addFile("file3.txt", TEST_FILE_CONTENT); return base; }
FileInfo function() throws FileSystemException { final FileInfo base = new FileInfo(getReadFolder().getName().getBaseName(), FileType.FOLDER); base.addFile(STR, FILE1_CONTENT); base.addFile(STR, FILE1_CONTENT); base.addFile(STR, FILE1_CONTENT); base.addFile(STR, STRemptydirSTRdir1"); dir.addFile(STR, TEST_FILE_CONTENT); dir.addFile("file2.txtSTRfile3.txtSTRsubdir1"); subdir1.addFile(STR, TEST_FILE_CONTENT); subdir1.addFile("file2.txtSTRfile3.txtSTRsubdir2"); subdir2.addFile(STR, TEST_FILE_CONTENT); subdir2.addFile("file2.txtSTRfile3.txtSTRsubdir3"); subdir3.addFile(STR, TEST_FILE_CONTENT); subdir3.addFile("file2.txtSTRfile3.txt", TEST_FILE_CONTENT); return base; }
/** * Builds the expected structure of the read tests folder. * @throws FileSystemException (possibly) */
Builds the expected structure of the read tests folder
buildExpectedStructure
{ "repo_name": "virajsenevirathne/wso2-commons-vfs", "path": "core/src/test/java/org/apache/commons/vfs2/test/AbstractProviderTestCase.java", "license": "apache-2.0", "size": 13036 }
[ "org.apache.commons.vfs2.FileSystemException", "org.apache.commons.vfs2.FileType" ]
import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileType;
import org.apache.commons.vfs2.*;
[ "org.apache.commons" ]
org.apache.commons;
22,698
@SuppressWarnings( { "unchecked" }) public static void removeCapabilites() { Set<String> enabledActivityIds = new HashSet<>(activityManager.getEnabledActivityIds()); boolean update = false; for (String activity : activitySet) { update |= enabledActivityIds.remove(activity); } update(enabledActivityIds, update); }
@SuppressWarnings( { STR }) static void function() { Set<String> enabledActivityIds = new HashSet<>(activityManager.getEnabledActivityIds()); boolean update = false; for (String activity : activitySet) { update = enabledActivityIds.remove(activity); } update(enabledActivityIds, update); }
/** * Remove list of capabilities from IDE */
Remove list of capabilities from IDE
removeCapabilites
{ "repo_name": "dipakmankumbare/idecore", "path": "com.salesforce.ide.ui.editors/src/com/salesforce/ide/ui/editors/internal/EditorUtils.java", "license": "epl-1.0", "size": 3106 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,503,028
@Deprecated public int addPackageNames(User loggedInUser, String key, List packageNames) { ActivationKeyManager manager = ActivationKeyManager.getInstance(); ActivationKey activationKey = lookupKey(key, loggedInUser); validateKeyHasEntitlement(activationKey, "provisioning_entitled"); for (Iterator it = packageNames.iterator(); it.hasNext();) { String name = (String)it.next(); PackageName packageName = PackageFactory.lookupOrCreatePackageByName(name); manager.addPackage(activationKey, packageName, null); } return 1; }
int function(User loggedInUser, String key, List packageNames) { ActivationKeyManager manager = ActivationKeyManager.getInstance(); ActivationKey activationKey = lookupKey(key, loggedInUser); validateKeyHasEntitlement(activationKey, STR); for (Iterator it = packageNames.iterator(); it.hasNext();) { String name = (String)it.next(); PackageName packageName = PackageFactory.lookupOrCreatePackageByName(name); manager.addPackage(activationKey, packageName, null); } return 1; }
/** * Add packages to an activation key using package name only. * * @param loggedInUser The current user * @param key The activation key to act upon * @param packageNames List of package names to be added to this activation key * @return 1 on success, exception thrown otherwise. * @deprecated being replaced by addPackages(string sessionKey, string key, * array[packages]) * @since 10.2 * * @xmlrpc.doc Add packages to an activation key using package name only. * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param("string", "key") * @xmlrpc.param #array_single("string", "packageName") * @xmlrpc.returntype #return_int_success() */
Add packages to an activation key using package name only
addPackageNames
{ "repo_name": "aronparsons/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/activationkey/ActivationKeyHandler.java", "license": "gpl-2.0", "size": 46034 }
[ "com.redhat.rhn.domain.rhnpackage.PackageFactory", "com.redhat.rhn.domain.rhnpackage.PackageName", "com.redhat.rhn.domain.token.ActivationKey", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.manager.token.ActivationKeyManager", "java.util.Iterator", "java.util.List" ]
import com.redhat.rhn.domain.rhnpackage.PackageFactory; import com.redhat.rhn.domain.rhnpackage.PackageName; import com.redhat.rhn.domain.token.ActivationKey; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.manager.token.ActivationKeyManager; import java.util.Iterator; import java.util.List;
import com.redhat.rhn.domain.rhnpackage.*; import com.redhat.rhn.domain.token.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.manager.token.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
371,467